/** * 修改指定的通讯费信息 * * @return String */ public String comsPayCommunicationUpdate() { ComsPayCommunication ComsPayCommunication = (ComsPayCommunication) request.getSession().getAttribute("ComsPayCommunication"); Authuser user = (Authuser) request.getSession().getAttribute("currentUser"); ComsPayCommunication.setReimbursedNum(reimbursedNum); ComsPayCommunication.setReimbursedMoney(reimbursedMoney); ComsPayCommunication.setReimbursedType(reimbursedType); ComsPayCommunication.setInvoiceCode(invoiceCode); ComsPayCommunication.setTermid(termid); ComsPayCommunication.setTermno(termnos); ComsPayCommunication.setTermseq(termSeqs); ComsPayCommunication.setAddress(address); ComsPayCommunication.setItemUid(addItemUid); // 从终端表取得项目编号 ComsPayCommunication.setCostTypeCode("100016"); ComsPayCommunication.setRealCost(realCost); ComsPayCommunication.setOrgInnerCode01(orgInnerCode01); ComsPayCommunication.setOrgInnerCode02(orgInnerCode02); ComsPayCommunication.setOrgInnerCode03(orgInnerCode03); ComsPayCommunication.setRemark(remark); ComsPayCommunication.setPayState("1"); ComsPayCommunication.setTransactionPerson(tsPerson); ComsPayCommunication.setUserid(user.getUserid()); ComsPayCommunication.setSubmitDate(DateConvert.Date2String(new java.util.Date())); ComsPayCommunication.setCostDate(startCostDate); try { // 修改通讯费 comsPayCommunicationService.updateComsPayCommunication(ComsPayCommunication); // 加上审计日志 new LogAssistant( user.getUsername().trim(), request.getRemoteAddr() + ":" + TrackOpterationEnum.UPDATE.getOperation(), "修改通讯费[" + payUid + "]成功") .logUserOpt(); this.message = "修改通讯费信息成功!"; } catch (RuntimeException re) { message = "发生内部异常,修改通讯费[" + payUid + "]失败!请与管理员联系"; log.error(message + ",Error Message:" + re.getMessage()); } return SUCCESS; }
/** * 添加通讯费支付信息 * * @return String */ public String comsPayCommunicationAdd() { Authuser user = (Authuser) request.getSession().getAttribute("currentUser"); /** 得到支付期间 */ Date startDate = DateConvert.Convert(startCostDate + "-01"); Date endDate = DateConvert.Convert(endCostDate + "-01"); int months = AppCommonVarRegiter.countMonthSpace(startDate, endDate); double realPayCost = 0; // 如果有多个月份需要平分支付金额 if (payTotalMoney != 0 && months != 0 && (sTermNo != null && sTermNo.length > 0)) { realPayCost = payTotalMoney / (months * sTermNo.length); } String batchNum = UUID.randomUUID().toString(); List<ComsPayCommunication> addList = new ArrayList<ComsPayCommunication>(); if (sTermNo != null && sTermNo.length > 0) { for (int j = 0; j < sTermNo.length; j++) { String termBatchNum = UUID.randomUUID().toString(); for (int i = 0; i < months; i++) { String date = DateConvert.getNextMonth(startDate, i, "yyyyMM"); ComsPayCommunication ComsPayCommunication = new ComsPayCommunication(); ComsPayCommunication.setReimbursedNum(reimbursedNum); ComsPayCommunication.setReimbursedMoney(reimbursedMoney); ComsPayCommunication.setReimbursedType(reimbursedType); ComsPayCommunication.setInvoiceCode(invoiceCode); ComsPayCommunication.setTermid(Integer.parseInt(sTermInfoId[j].trim())); ComsPayCommunication.setTermno(sTermNo[j].trim()); ComsPayCommunication.setTermseq(sTermSeq[j].trim()); ComsPayCommunication.setAddress(sAddress[j].trim()); ComsPayCommunication.setItemUid(sItemUid[j].trim()); // 从终端表取得项目编号 ComsPayCommunication.setOrgInnerCode01(sOrgInnerCode01[j]); ComsPayCommunication.setOrgInnerCode02(sOrgInnerCode02[j]); ComsPayCommunication.setOrgInnerCode03(sOrgInnerCode03[j]); ComsPayCommunication.setRemark(remark); ComsPayCommunication.setCostTypeCode("100016"); ComsPayCommunication.setPayState("1"); ComsPayCommunication.setTransactionPerson(tsPerson); ComsPayCommunication.setUserid(user.getUserid()); ComsPayCommunication.setSubmitDate(DateConvert.Date2String(new java.util.Date())); ComsPayCommunication.setCostDate(date); ComsPayCommunication.setRealCost(realPayCost); ComsPayCommunication.setPayTotalMoney(payTotalMoney); ComsPayCommunication.setBatchNum(batchNum); ComsPayCommunication.setTermBatchNum(termBatchNum); addList.add(ComsPayCommunication); } } } // 添加通讯费支付 String errMessage = comsPayCommunicationService.batchSave(addList); // 加上审计日志 if (errMessage != null) { this.setErrMessage(errMessage); return INPUT; } else { String msg = "添加通讯费支付终端号为[" + termnos + "],终端序列号为[" + termSeqs + "]," + "支付成本期从[" + startCostDate + "]到[" + endCostDate + "] 成功"; new LogAssistant( user.getUsername().trim(), request.getRemoteAddr() + ":" + TrackOpterationEnum.ADD.getOperation(), msg) .logUserOpt(); this.message = "添加通讯费支付登记成功!"; } return SUCCESS; }