fix:非信保合同不进行投保金额校验

This commit is contained in:
zzs 2024-12-03 17:15:10 +08:00
parent 534ed72806
commit 02d604790b
2 changed files with 20 additions and 13 deletions

View File

@ -437,7 +437,7 @@ public class StorageTransAuditOp extends AbstractOperationServicePlugIn {
dataEntitie = BusinessDataServiceHelper.loadSingle(dataEntitie.getPkValue(), dataEntitie.getDynamicObjectType().getName()); dataEntitie = BusinessDataServiceHelper.loadSingle(dataEntitie.getPkValue(), dataEntitie.getDynamicObjectType().getName());
DynamicObject customer = dataEntitie.getDynamicObject("yem_customer"); DynamicObject customer = dataEntitie.getDynamicObject("yem_customer");
DynamicObjectCollection creditDetails = dataEntitie.getDynamicObjectCollection("yem_creditdetail"); DynamicObjectCollection creditDetails = dataEntitie.getDynamicObjectCollection("yem_creditdetail");
if (YEM.isNotEmpty(customer) && creditDetails.size() > 0) { if (YEM.isNotEmpty(customer) && !creditDetails.isEmpty()) {
DynamicObject method = TotalUtil.getSettlementMethod(dataEntitie); DynamicObject method = TotalUtil.getSettlementMethod(dataEntitie);
DynamicObject company = dataEntitie.getDynamicObject("yem_company.yem_erporg"); DynamicObject company = dataEntitie.getDynamicObject("yem_company.yem_erporg");
String swiftCode = TotalUtil.getSwiftCode(dataEntitie); String swiftCode = TotalUtil.getSwiftCode(dataEntitie);
@ -488,20 +488,15 @@ public class StorageTransAuditOp extends AbstractOperationServicePlugIn {
addNew.set("yem_year_e", creditDetail.get("yem_year_e"));//年份 addNew.set("yem_year_e", creditDetail.get("yem_year_e"));//年份
addNew.set("yem_creditstatus_e", creditDetail.get("yem_creditstatus_e"));//投保状态 addNew.set("yem_creditstatus_e", creditDetail.get("yem_creditstatus_e"));//投保状态
} else {
throw new KDBizException(String.format("找不到客户:%s的客户信保额度申请单", customer.getString("name")));
}
}
BigDecimal decimal = CreditBackFillUtils.calcRemainingAmount(csrCreditLine); BigDecimal decimal = CreditBackFillUtils.calcRemainingAmount(csrCreditLine);
csrCreditLine.set("yem_balance", decimal); csrCreditLine.set("yem_balance", decimal);
// SaveServiceHelper.update(new DynamicObject[]{csrCreditLine}); OperationResult operate = OperationServiceHelper.executeOperate("save", csrCreditLine.getDynamicObjectType().getName(), new DynamicObject[]{csrCreditLine}, OperateOption.create());
OperationResult Operate = OperationServiceHelper.executeOperate("save", csrCreditLine.getDynamicObjectType().getName(), new DynamicObject[]{csrCreditLine}, OperateOption.create()); if (!operate.isSuccess()) {
if (Operate.isSuccess()) { throw new KDBizException("客户信保额度申请保存失败!" + operate.getMessage());
}
}
} }
} }
dataEntitie.set("yem_whether", true);
} }
} }
} }

View File

@ -36,8 +36,20 @@ public class StorageAuditValid extends AbstractValidator {
DynamicObject company = dataEntitie.getDynamicObject("yem_company.yem_erporg"); DynamicObject company = dataEntitie.getDynamicObject("yem_company.yem_erporg");
String swiftCode = TotalUtil.getSwiftCode(dataEntitie); String swiftCode = TotalUtil.getSwiftCode(dataEntitie);
DynamicObject csrCreditLine = TotalUtil.getCsrCreditLine(customer, method, company, swiftCode); DynamicObject csrCreditLine = TotalUtil.getCsrCreditLine(customer, method, company, swiftCode);
DynamicObjectCollection creditDetails = dataEntitie.getDynamicObjectCollection("yem_creditdetail");
boolean isNeedVail = false;
for (DynamicObject creditDetail : creditDetails) {
DynamicObject salecontractno = creditDetail.getDynamicObject("yem_salecontractno");
if (salecontractno == null) continue;
salecontractno = BusinessDataServiceHelper.loadSingle(salecontractno.getPkValue(), salecontractno.getDynamicObjectType().getName());
boolean issinosurecon = salecontractno.getBoolean("yem_issinosurecon");
if (issinosurecon) {
isNeedVail = true;
}
}
if (YEM.isNotEmpty(customer) && YEM.isNotEmpty(csrCreditLine)) { if (YEM.isNotEmpty(customer) && YEM.isNotEmpty(csrCreditLine)) {
log.info("客户信保限额申请:[{}]", csrCreditLine.getString("billno")); log.info("客户信保限额申请:[{}]", csrCreditLine.getString("billno"));
BigDecimal decimal = CreditBackFillUtils.calcRemainingAmount(csrCreditLine); BigDecimal decimal = CreditBackFillUtils.calcRemainingAmount(csrCreditLine);
BigDecimal usacreditamt = dataEntitie.getBigDecimal("yem_usacreditamt"); BigDecimal usacreditamt = dataEntitie.getBigDecimal("yem_usacreditamt");
@ -49,7 +61,7 @@ public class StorageAuditValid extends AbstractValidator {
this.addMessage(dataes, String.format("当前客户对应的信保额度申请剩余额度小于0请确认剩余额度[%s] : 投保金额[%s]", decimal, usacreditamt)); this.addMessage(dataes, String.format("当前客户对应的信保额度申请剩余额度小于0请确认剩余额度[%s] : 投保金额[%s]", decimal, usacreditamt));
return; return;
} }
} else { } else if (isNeedVail) {
this.addMessage(dataes, "找不到客户:"+customer.getString("name")+"的客户信保额度申请单"); this.addMessage(dataes, "找不到客户:"+customer.getString("name")+"的客户信保额度申请单");
} }
} }