demand: TMS系统财务销账优化
committer: heyu
This commit is contained in:
parent
9173fc069b
commit
dbf75a2664
@ -1021,7 +1021,7 @@ public class EmisWriteoffApplyServiceImpl extends EmisBaseService implements IEm
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 收集需要更新额度的客户和销售员信息
|
// 收集需要更新额度的客户和销售员信息
|
||||||
Set<String> customerCodes = new HashSet<>();
|
Set<String> custNos = new HashSet<>();
|
||||||
Set<String> salesmenNames = new HashSet<>();
|
Set<String> salesmenNames = new HashSet<>();
|
||||||
|
|
||||||
// 遍历明细,获取运单信息
|
// 遍历明细,获取运单信息
|
||||||
@ -1032,7 +1032,7 @@ public class EmisWriteoffApplyServiceImpl extends EmisBaseService implements IEm
|
|||||||
if (waybill != null) {
|
if (waybill != null) {
|
||||||
// 收集客户代码
|
// 收集客户代码
|
||||||
if (StringUtil.isNotBlank(waybill.getCustomerCode())) {
|
if (StringUtil.isNotBlank(waybill.getCustomerCode())) {
|
||||||
customerCodes.add(waybill.getCustomerCode());
|
custNos.add(waybill.getCustNo());
|
||||||
}
|
}
|
||||||
// 收集销售员代码
|
// 收集销售员代码
|
||||||
if (StringUtil.isNotBlank(waybill.getSalesmen())) {
|
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 {
|
try {
|
||||||
updateCustomerCreditLimit(customerCode);
|
updateCustomerCreditLimit(custNo);
|
||||||
} catch (Exception e) {
|
} 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 {
|
try {
|
||||||
// 查询客户信用额度信息
|
// 查询客户信用额度信息
|
||||||
EmisCreditCustomer query = new EmisCreditCustomer();
|
EmisCreditCustomer query = new EmisCreditCustomer();
|
||||||
query.setCustomerCode(customerCode);
|
query.setMonthlyPayCode(custNo);
|
||||||
List<EmisCreditCustomer> creditList = emisCreditCustomerService.selectEmisCreditCustomerList(query);
|
List<EmisCreditCustomer> creditList = emisCreditCustomerService.selectEmisCreditCustomerList(query);
|
||||||
|
|
||||||
for (EmisCreditCustomer credit : creditList) {
|
for (EmisCreditCustomer credit : creditList) {
|
||||||
// 调用更新方法,这会触发额度重算
|
// 调用更新方法,这会触发额度重算
|
||||||
emisCreditCustomerService.updateEmisCreditCustomer(credit);
|
emisCreditCustomerService.updateEmisCreditCustomer(credit);
|
||||||
log.info("客户信用额度更新成功,客户代码: {}", customerCode);
|
log.info("客户信用额度更新成功,客户代码: {}", custNo);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("更新客户信用额度失败,客户代码: {}", customerCode, e);
|
log.error("更新客户信用额度失败,客户代码: {}", custNo, e);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1128,7 +1128,8 @@ public class EmisWriteoffApplyServiceImpl extends EmisBaseService implements IEm
|
|||||||
|
|
||||||
String title = "";
|
String title = "";
|
||||||
String message = "";
|
String message = "";
|
||||||
String clickPath = "/d24/financialManagement/WriteoffApplyList";
|
String applyPath = "/ruyERj/WriteoffApplyApplicationList";
|
||||||
|
String checkPath = "/ruyERj/WriteoffApplyCheckLis";
|
||||||
|
|
||||||
// 获取申请人姓名
|
// 获取申请人姓名
|
||||||
String applyManName = StringUtils.hasText(apply.getApplyManName()) ? apply.getApplyManName()
|
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())) {
|
if ("headquartersReject".equals(actionType) && StringUtils.hasText(apply.getCenterConfirmManCode())) {
|
||||||
String centerTitle = "您审核通过的销账申请被" + operatorName + "驳回,申请编号:" + apply.getApplyNo() +
|
String centerTitle = "您审核通过的销账申请被" + operatorName + "驳回,申请编号:" + apply.getApplyNo() +
|
||||||
",驳回原因:" + (StringUtils.hasText(rejectReason) ? rejectReason : "无");
|
",驳回原因:" + (StringUtils.hasText(rejectReason) ? rejectReason : "无");
|
||||||
sendNoticeToEmpUser(apply.getCenterConfirmManCode(), centerTitle, "", clickPath);
|
sendNoticeToEmpUser(apply.getCenterConfirmManCode(), centerTitle, "", checkPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("销账申请通知发送成功,申请编号:{},操作类型:{}", apply.getApplyNo(), actionType);
|
log.info("销账申请通知发送成功,申请编号:{},操作类型:{}", apply.getApplyNo(), actionType);
|
||||||
@ -1248,10 +1249,11 @@ public class EmisWriteoffApplyServiceImpl extends EmisBaseService implements IEm
|
|||||||
updateWaybill.setPaymentStatus("2"); // 部分付款
|
updateWaybill.setPaymentStatus("2"); // 部分付款
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 审核驳回:只考虑已收金额与运单金额比较
|
// 审核驳回:已收金额-申请金额后再与运单金额比较
|
||||||
if (receivedMoney.compareTo(BigDecimal.ZERO) == 0) {
|
BigDecimal actualReceivedMoney = receivedMoney.subtract(applyMoney);
|
||||||
|
if (actualReceivedMoney.compareTo(BigDecimal.ZERO) <= 0) {
|
||||||
updateWaybill.setPaymentStatus("0"); // 未付款
|
updateWaybill.setPaymentStatus("0"); // 未付款
|
||||||
} else if (receivedMoney.compareTo(waybillFreight) >= 0) {
|
} else if (actualReceivedMoney.compareTo(waybillFreight) >= 0) {
|
||||||
updateWaybill.setPaymentStatus("1"); // 已付款
|
updateWaybill.setPaymentStatus("1"); // 已付款
|
||||||
} else {
|
} else {
|
||||||
updateWaybill.setPaymentStatus("2"); // 部分付款
|
updateWaybill.setPaymentStatus("2"); // 部分付款
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user