2
0

fix: 修复账单

This commit is contained in:
caiyuchao
2025-01-16 21:21:42 +08:00
parent b57f4a7a77
commit 6d9048f31c
2 changed files with 13 additions and 8 deletions

View File

@@ -108,10 +108,7 @@ public class UAccountServiceImpl extends ServiceImpl<UAccountMapper, UAccount> i
account.setBalance(BigDecimal.ZERO);
}
if (account.getBalance().compareTo(account.getBalanceUsed()) <= 0) {
account.setBalanceUsed(BigDecimal.ZERO);
account.setBalance(BigDecimal.ZERO);
cancelUserIds.add(account.getUserId());
if (account.getBalanceUsed().compareTo(BigDecimal.ZERO) > 0) {
UBill bill = new UBill();
bill.setUserId(account.getUserId());
bill.setType(2);
@@ -119,10 +116,18 @@ public class UAccountServiceImpl extends ServiceImpl<UAccountMapper, UAccount> i
bill.setAmount(account.getBalanceUsed());
billMapper.insert(bill);
}
account.setBalanceUsed(BigDecimal.ZERO);
account.setBalance(BigDecimal.ZERO);
cancelUserIds.add(account.getUserId());
}
this.updateById(account);
}
for (UCdrLatestHistoryVo historyVo : latestHistoryList) {
List<UBill> uBills = billMapper.selectList(Wrappers.<UBill>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<UAccountMapper, UAccount> 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);

View File

@@ -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
</select>
</mapper>