应收账单模块,调整枚举代码优化3

This commit is contained in:
caojia
2026-09-17 11:19:19 +08:00
parent e2a8731d39
commit e25fd6358e
@@ -292,15 +292,11 @@ public class ArBillServiceImpl implements IArBillService
bill.getStatus(),
"账单状态已发生变化,请刷新后重试", operator, requestId);
}
// 账单确认:应收形成,按账单金额占用客户授信额度(账户不存在时仅CNY会自动初始化)
customerMoneyService.occupyCredit(bill.getCustomerId(), bill.getCurrency(),
nvl(bill.getTotalAmount()));
// 账单确认:应收形成,按账单金额占用客户授信额度。
// 不校验可用额度,兼容历史 used_credit 可高于总额度、外币账户静默跳过的口径。
customerAccountApi.occupyCredit(buildCreditCommand(bill, "确认应收账单"));
recordSuccess(bill, ArLogObjectType.BILL, ArLogOperationType.CONFIRM,
"确认应收账单", ArBillStatus.DRAFT.getCode(), ArBillStatus.CONFIRMED.getCode(), requestId, operator);
// 账单确认:应收形成,按账单金额占用客户授信额度(账户不存在时仅CNY会自动初始化)。
// 不校验可用额度,兼容历史 used_credit 可高于总额度、外币账户静默跳过的口径
customerAccountApi.occupyCredit(buildCreditCommand(bill));
recordSuccess(bill, "CONFIRM", "确认应收账单", ArBillStatus.DRAFT.getCode(), ArBillStatus.CONFIRMED.getCode(), requestId, operator);
return selectArBillById(arBillId);
}
@@ -341,11 +337,10 @@ public class ArBillServiceImpl implements IArBillService
bill.getStatus(),
"账单状态已发生变化,请刷新后重试", operator, requestId);
}
// 账单作废:已确认账单占用的授信额度全额释放(可作废的CONFIRMED账单必然零核销)
// 账单作废:已确认账单占用的授信额度全额释放(可作废的CONFIRMED账单必然零核销)。
if (currentStatus == ArBillStatus.CONFIRMED)
{
customerMoneyService.releaseCredit(bill.getCustomerId(), bill.getCurrency(),
nvl(bill.getTotalAmount()));
customerAccountApi.releaseCredit(buildCreditCommand(bill, "作废应收账单"));
}
if (!sourceBillIds.isEmpty())
{
@@ -575,6 +570,22 @@ public class ArBillServiceImpl implements IArBillService
return new ServiceException(message);
}
/** 构造客户资金模块使用的应收账单授信命令,确认和作废共用同一业务标识。 */
private CreditUsageCommand buildCreditCommand(ArBill bill, String reason)
{
CreditUsageCommand command = new CreditUsageCommand();
command.setCustomerId(bill.getCustomerId());
command.setCurrency(bill.getCurrency());
command.setAmount(nvl(bill.getTotalAmount()));
command.setBizType(CustomerFundBizType.AR_BILL);
command.setBizId(bill.getArBillId());
command.setBizNo(bill.getBillNo());
command.setReason(reason + ":" + bill.getBillNo());
// 应收确认沿用历史口径:允许已用额度暂时超过额度上限;释放场景该字段无意义。
command.setCheckAvailable(Boolean.FALSE);
return command;
}
private byte[] buildWorkbook(ArBill bill) throws IOException
{
ClassPathResource resource = new ClassPathResource(EXPORT_TEMPLATE_RESOURCE);