From 6d9048f31c9693245b940ce105a92782d74cb26b Mon Sep 17 00:00:00 2001 From: caiyuchao Date: Thu, 16 Jan 2025 21:21:42 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=B4=A6=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/UAccountServiceImpl.java | 20 +++++++++++-------- .../resources/mapper/user/UBillMapper.xml | 1 + 2 files changed, 13 insertions(+), 8 deletions(-) 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 39a3d80..fbf1517 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 @@ -108,21 +108,26 @@ public class UAccountServiceImpl extends ServiceImpl i account.setBalance(BigDecimal.ZERO); } if (account.getBalance().compareTo(account.getBalanceUsed()) <= 0) { + if (account.getBalanceUsed().compareTo(BigDecimal.ZERO) > 0) { + UBill bill = new UBill(); + bill.setUserId(account.getUserId()); + bill.setType(2); + bill.setStatus(1); + bill.setAmount(account.getBalanceUsed()); + billMapper.insert(bill); + } 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); } for (UCdrLatestHistoryVo historyVo : latestHistoryList) { + List uBills = billMapper.selectList(Wrappers.lambdaQuery().eq(UBill::getCdrHistoryId, historyVo.getId())); + if (CollUtil.isNotEmpty(uBills)) { + continue; + } UBill bill = new UBill(); bill.setUserId(historyVo.getUserId()); bill.setCdrHistoryId(historyVo.getId()); @@ -226,7 +231,6 @@ public class UAccountServiceImpl extends ServiceImpl i Date current = new Date(); if (AccountUtil.isValid(account, current)) { wifiApi.authClient(client.getSiteId(), client.getClientMac()); - wifiApi.reconnectClient(client.getSiteId(), client.getClientMac()); // 带宽限速 ClientRateLimitSettingDto clientRateLimitSetting = OmadaConvert.INSTANCE.toClientRateLimitSettingDto(account); diff --git a/wfc-modules/wfc-user/src/main/resources/mapper/user/UBillMapper.xml b/wfc-modules/wfc-user/src/main/resources/mapper/user/UBillMapper.xml index 2f9db25..dc3c1db 100644 --- a/wfc-modules/wfc-user/src/main/resources/mapper/user/UBillMapper.xml +++ b/wfc-modules/wfc-user/src/main/resources/mapper/user/UBillMapper.xml @@ -16,5 +16,6 @@ LEFT JOIN u_cdr_history h ON h.id = b.cdr_history_id AND h.del_flag = 0 AND b.user_id = #{userId} + order by b.create_time desc