From c4b58c8cd3023e813d581c84c7e3571d9c7cc703 Mon Sep 17 00:00:00 2001 From: luojiaquan <1583622118@qq.com> Date: Tue, 22 Sep 2026 09:53:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=B8=E9=94=80=E8=AE=B0=E5=BD=95=E9=A2=9D?= =?UTF-8?q?=E5=BA=A6=E5=8F=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/impl/CustomerAccountApiImpl.java | 46 ++++++++- .../src/components/ColumnSettings/index.vue | 36 +++---- bms-front/src/directive/index.js | 2 - .../src/directive/resizableColumn/index.js | 93 ------------------- bms-front/src/utils/columnSettings.js | 9 +- .../customerinfo/index.vue | 6 +- .../supplierinfo/index.vue | 6 +- 7 files changed, 78 insertions(+), 120 deletions(-) delete mode 100644 bms-front/src/directive/resizableColumn/index.js diff --git a/bms-back/ruoyi-system/src/main/java/com/ruoyi/customer/customermoney/api/impl/CustomerAccountApiImpl.java b/bms-back/ruoyi-system/src/main/java/com/ruoyi/customer/customermoney/api/impl/CustomerAccountApiImpl.java index 3781910b..286f5cd2 100644 --- a/bms-back/ruoyi-system/src/main/java/com/ruoyi/customer/customermoney/api/impl/CustomerAccountApiImpl.java +++ b/bms-back/ruoyi-system/src/main/java/com/ruoyi/customer/customermoney/api/impl/CustomerAccountApiImpl.java @@ -376,9 +376,10 @@ public class CustomerAccountApiImpl implements ICustomerAccountApi BigDecimal afterBalance = beforeBalance.subtract(changeAmount); BigDecimal frozenBalance = nz(account.getFrozenBalance()); account.setBalance(afterBalance); + BigDecimal beforeUsedCredit = nz(account.getUsedCredit()); if (Boolean.TRUE.equals(command.getReleaseUsedCredit())) { - account.setUsedCredit(nz(account.getUsedCredit()).subtract(changeAmount).max(BigDecimal.ZERO) + account.setUsedCredit(beforeUsedCredit.subtract(changeAmount).max(BigDecimal.ZERO) .setScale(MONEY_SCALE, RoundingMode.HALF_UP)); } account.setUpdateBy(username); @@ -390,6 +391,18 @@ public class CustomerAccountApiImpl implements ICustomerAccountApi CustomerBalanceFlow flow = newBalanceFlow(account, command, flowCurrency, originalAmount, -1, beforeBalance, afterBalance, frozenBalance, frozenBalance, username, userId); customerMoneyMapper.insertFlow(flow); + + // 核销扣款联动释放已用额度:补写额度流水(RELEASE),保证 used_credit 变动台账完整 + BigDecimal afterUsedCredit = nz(account.getUsedCredit()); + if (Boolean.TRUE.equals(command.getReleaseUsedCredit()) + && afterUsedCredit.compareTo(beforeUsedCredit) < 0) + { + writeUsedCreditFlow(account, toCreditUsageCommand(command, accountCurrency, null), + CustomerCreditFlow.CHANGE_RELEASE, -1, + beforeUsedCredit, afterUsedCredit, + beforeUsedCredit.subtract(afterUsedCredit), + username, userId); + } return flow; } @@ -412,10 +425,11 @@ public class CustomerAccountApiImpl implements ICustomerAccountApi BigDecimal afterBalance = beforeBalance.add(changeAmount); BigDecimal frozenBalance = nz(account.getFrozenBalance()); account.setBalance(afterBalance); + BigDecimal beforeUsedCredit = nz(account.getUsedCredit()); if (Boolean.TRUE.equals(command.getReoccupyUsedCredit())) { // 反核销回补:账单恢复未清偿,授信占用同步加回(允许出现高于总额度的占用存量) - account.setUsedCredit(nz(account.getUsedCredit()).add(changeAmount) + account.setUsedCredit(beforeUsedCredit.add(changeAmount) .setScale(MONEY_SCALE, RoundingMode.HALF_UP)); } account.setUpdateBy(username); @@ -427,11 +441,39 @@ public class CustomerAccountApiImpl implements ICustomerAccountApi CustomerBalanceFlow flow = newBalanceFlow(account, command, flowCurrency, originalAmount, 1, beforeBalance, afterBalance, frozenBalance, frozenBalance, username, userId); customerMoneyMapper.insertFlow(flow); + + // 反核销回补联动重新占用已用额度:补写额度流水(OCCUPY),与核销释放流水方向相反、可勾稽 + BigDecimal afterUsedCredit = nz(account.getUsedCredit()); + if (Boolean.TRUE.equals(command.getReoccupyUsedCredit()) + && afterUsedCredit.compareTo(beforeUsedCredit) > 0) + { + String reoccupyReason = "反核销重新占用授信额度" + + (StringUtils.hasText(command.getBizNo()) ? ":" + command.getBizNo() : ""); + writeUsedCreditFlow(account, toCreditUsageCommand(command, accountCurrency, reoccupyReason), + CustomerCreditFlow.CHANGE_OCCUPY, 1, + beforeUsedCredit, afterUsedCredit, + afterUsedCredit.subtract(beforeUsedCredit), + username, userId); + } return flow; } /* ================= 内部实现 ================= */ + /** 余额变动命令 -> 额度占用命令(复用业务单据信息,金额取实际联动额由调用方写流水时传入) */ + private CreditUsageCommand toCreditUsageCommand(BalanceChangeCommand source, String accountCurrency, String reason) + { + CreditUsageCommand target = new CreditUsageCommand(); + target.setCustomerId(source.getCustomerId()); + target.setCurrency(accountCurrency); + target.setAmount(money(source.getAmount())); + target.setBizType(source.getBizType()); + target.setBizId(source.getBizId()); + target.setBizNo(source.getBizNo()); + target.setReason(reason); + return target; + } + /** 额度占用/释放写额度流水(before/after 为已用额度快照) */ private CustomerCreditFlow writeUsedCreditFlow(CustomerAccount account, CreditUsageCommand command, String changeType, int direction, BigDecimal beforeUsed, BigDecimal afterUsed, diff --git a/bms-front/src/components/ColumnSettings/index.vue b/bms-front/src/components/ColumnSettings/index.vue index eaae6aa8..e0d6c559 100644 --- a/bms-front/src/components/ColumnSettings/index.vue +++ b/bms-front/src/components/ColumnSettings/index.vue @@ -1,14 +1,14 @@