From dbf75a26645da0978797b5da2341fdaf6ca7bbbe Mon Sep 17 00:00:00 2001 From: aike <17730485278@139.com> Date: Wed, 17 Sep 2025 16:43:43 +0800 Subject: [PATCH] =?UTF-8?q?demand:=20=20TMS=E7=B3=BB=E7=BB=9F=E8=B4=A2?= =?UTF-8?q?=E5=8A=A1=E9=94=80=E8=B4=A6=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit committer: heyu --- .../impl/EmisWriteoffApplyServiceImpl.java | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisWriteoffApplyServiceImpl.java b/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisWriteoffApplyServiceImpl.java index cdb6bccfd..2ec6b06f3 100644 --- a/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisWriteoffApplyServiceImpl.java +++ b/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisWriteoffApplyServiceImpl.java @@ -1021,7 +1021,7 @@ public class EmisWriteoffApplyServiceImpl extends EmisBaseService implements IEm } // 收集需要更新额度的客户和销售员信息 - Set customerCodes = new HashSet<>(); + Set custNos = new HashSet<>(); Set salesmenNames = new HashSet<>(); // 遍历明细,获取运单信息 @@ -1032,7 +1032,7 @@ public class EmisWriteoffApplyServiceImpl extends EmisBaseService implements IEm if (waybill != null) { // 收集客户代码 if (StringUtil.isNotBlank(waybill.getCustomerCode())) { - customerCodes.add(waybill.getCustomerCode()); + custNos.add(waybill.getCustNo()); } // 收集销售员代码 if (StringUtil.isNotBlank(waybill.getSalesmen())) { @@ -1043,11 +1043,11 @@ public class EmisWriteoffApplyServiceImpl extends EmisBaseService implements IEm } // 更新客户信用额度 - for (String customerCode : customerCodes) { + for (String custNo : custNos) { try { - updateCustomerCreditLimit(customerCode); + updateCustomerCreditLimit(custNo); } catch (Exception e) { - log.error("更新客户信用额度失败,客户代码: {}", customerCode, e); + log.error("更新客户信用额度失败,客户代码: {}", custNo, e); } } @@ -1069,22 +1069,22 @@ public class EmisWriteoffApplyServiceImpl extends EmisBaseService implements IEm /** * 更新客户信用额度 * - * @param customerCode 客户代码 + * @param custNo 客户代码 */ - private void updateCustomerCreditLimit(String customerCode) throws EmisBizError { + private void updateCustomerCreditLimit(String custNo) throws EmisBizError { try { // 查询客户信用额度信息 EmisCreditCustomer query = new EmisCreditCustomer(); - query.setCustomerCode(customerCode); + query.setMonthlyPayCode(custNo); List creditList = emisCreditCustomerService.selectEmisCreditCustomerList(query); for (EmisCreditCustomer credit : creditList) { // 调用更新方法,这会触发额度重算 emisCreditCustomerService.updateEmisCreditCustomer(credit); - log.info("客户信用额度更新成功,客户代码: {}", customerCode); + log.info("客户信用额度更新成功,客户代码: {}", custNo); } } catch (Exception e) { - log.error("更新客户信用额度失败,客户代码: {}", customerCode, e); + log.error("更新客户信用额度失败,客户代码: {}", custNo, e); throw e; } } @@ -1128,7 +1128,8 @@ public class EmisWriteoffApplyServiceImpl extends EmisBaseService implements IEm String title = ""; String message = ""; - String clickPath = "/d24/financialManagement/WriteoffApplyList"; + String applyPath = "/ruyERj/WriteoffApplyApplicationList"; + String checkPath = "/ruyERj/WriteoffApplyCheckLis"; // 获取申请人姓名 String applyManName = StringUtils.hasText(apply.getApplyManName()) ? apply.getApplyManName() @@ -1167,13 +1168,13 @@ public class EmisWriteoffApplyServiceImpl extends EmisBaseService implements IEm } // 发送通知给申请人 - sendNoticeToEmpUser(apply.getApplyManCode(), title, message, clickPath); + sendNoticeToEmpUser(apply.getApplyManCode(), title, message, applyPath); // 如果是总部驳回,还需要通知财务中心审批人员 if ("headquartersReject".equals(actionType) && StringUtils.hasText(apply.getCenterConfirmManCode())) { String centerTitle = "您审核通过的销账申请被" + operatorName + "驳回,申请编号:" + apply.getApplyNo() + ",驳回原因:" + (StringUtils.hasText(rejectReason) ? rejectReason : "无"); - sendNoticeToEmpUser(apply.getCenterConfirmManCode(), centerTitle, "", clickPath); + sendNoticeToEmpUser(apply.getCenterConfirmManCode(), centerTitle, "", checkPath); } log.info("销账申请通知发送成功,申请编号:{},操作类型:{}", apply.getApplyNo(), actionType); @@ -1248,10 +1249,11 @@ public class EmisWriteoffApplyServiceImpl extends EmisBaseService implements IEm updateWaybill.setPaymentStatus("2"); // 部分付款 } } else { - // 审核驳回:只考虑已收金额与运单金额比较 - if (receivedMoney.compareTo(BigDecimal.ZERO) == 0) { + // 审核驳回:已收金额-申请金额后再与运单金额比较 + BigDecimal actualReceivedMoney = receivedMoney.subtract(applyMoney); + if (actualReceivedMoney.compareTo(BigDecimal.ZERO) <= 0) { updateWaybill.setPaymentStatus("0"); // 未付款 - } else if (receivedMoney.compareTo(waybillFreight) >= 0) { + } else if (actualReceivedMoney.compareTo(waybillFreight) >= 0) { updateWaybill.setPaymentStatus("1"); // 已付款 } else { updateWaybill.setPaymentStatus("2"); // 部分付款