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