From b57f4a7a77579b31258795e2481c39965dbe9911 Mon Sep 17 00:00:00 2001 From: caiyuchao Date: Thu, 16 Jan 2025 20:40:09 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=B5=81=E9=87=8F?= =?UTF-8?q?=E8=B4=A6=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/wfc_user_db/wfc_user_db.sql | 2 +- .../org/wfc/user/service/impl/UAccountServiceImpl.java | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/sql/wfc_user_db/wfc_user_db.sql b/sql/wfc_user_db/wfc_user_db.sql index 894f6c0..c5ec571 100644 --- a/sql/wfc_user_db/wfc_user_db.sql +++ b/sql/wfc_user_db/wfc_user_db.sql @@ -657,7 +657,7 @@ CREATE TABLE `u_role` ( `role_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '角色ID', `role_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '角色名称', `role_key` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '角色权限字符串', - `role_sort` int(11) NOT NULL COMMENT '显示顺序', + `role_sort` int(11) NULL COMMENT '显示顺序', `data_scope` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '1' COMMENT '数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限)', `menu_check_strictly` tinyint(1) NULL DEFAULT 1 COMMENT '菜单树选择项是否关联显示', `dept_check_strictly` tinyint(1) NULL DEFAULT 1 COMMENT '部门树选择项是否关联显示', diff --git a/wfc-modules/wfc-user/src/main/java/org/wfc/user/service/impl/UAccountServiceImpl.java b/wfc-modules/wfc-user/src/main/java/org/wfc/user/service/impl/UAccountServiceImpl.java index e6c7080..39a3d80 100644 --- a/wfc-modules/wfc-user/src/main/java/org/wfc/user/service/impl/UAccountServiceImpl.java +++ b/wfc-modules/wfc-user/src/main/java/org/wfc/user/service/impl/UAccountServiceImpl.java @@ -111,6 +111,13 @@ public class UAccountServiceImpl extends ServiceImpl i account.setBalanceUsed(BigDecimal.ZERO); account.setBalance(BigDecimal.ZERO); cancelUserIds.add(account.getUserId()); + + UBill bill = new UBill(); + bill.setUserId(account.getUserId()); + bill.setType(2); + bill.setStatus(1); + bill.setAmount(account.getBalanceUsed()); + billMapper.insert(bill); } this.updateById(account); } @@ -120,6 +127,7 @@ public class UAccountServiceImpl extends ServiceImpl i bill.setUserId(historyVo.getUserId()); bill.setCdrHistoryId(historyVo.getId()); bill.setStatus(1); + bill.setType(2); bill.setAmount(BillRuleUtil.calc(billRule, historyVo.getTrafficDown() + historyVo.getTrafficUp())); billMapper.insert(bill); @@ -133,6 +141,7 @@ public class UAccountServiceImpl extends ServiceImpl i } if (account.getBalance().compareTo(bill.getAmount()) > 0) { account.setBalance(account.getBalance().subtract(bill.getAmount())); + account.setBalanceUsed(BigDecimal.ZERO); } else { account.setBalance(BigDecimal.ZERO); account.setBalanceUsed(BigDecimal.ZERO); @@ -249,6 +258,7 @@ public class UAccountServiceImpl extends ServiceImpl i BigDecimal balance = Optional.ofNullable(dashboardVo.getBalance()).orElse(BigDecimal.ZERO); if (balance.compareTo(balanceUsed) >= 0) { dashboardVo.setBalance(balance.subtract(balanceUsed)); + } else { dashboardVo.setBalance(BigDecimal.ZERO); }