2
0

feat: 可用套餐数量

This commit is contained in:
caiyuchao
2025-03-14 17:04:17 +08:00
parent 16dc1360ef
commit 42fb1c3d7a
2 changed files with 9 additions and 5 deletions

View File

@@ -67,4 +67,6 @@ public class UAccountDashboardVo {
private Long activity; private Long activity;
private Integer status; private Integer status;
private Integer packageNum;
} }

View File

@@ -37,11 +37,11 @@ import org.wfc.user.domain.vo.UAccountDashboardVo;
import org.wfc.user.domain.vo.UCdrUserVo; import org.wfc.user.domain.vo.UCdrUserVo;
import org.wfc.user.domain.vo.UClientCurrentVo; import org.wfc.user.domain.vo.UClientCurrentVo;
import org.wfc.user.mapper.UAccountMapper; import org.wfc.user.mapper.UAccountMapper;
import org.wfc.user.mapper.UAccountPackageMapper;
import org.wfc.user.mapper.UBillMapper; import org.wfc.user.mapper.UBillMapper;
import org.wfc.user.mapper.UBillRuleMapper; import org.wfc.user.mapper.UBillRuleMapper;
import org.wfc.user.mapper.UCdrMapper; import org.wfc.user.mapper.UCdrMapper;
import org.wfc.user.mapper.UClientMapper; import org.wfc.user.mapper.UClientMapper;
import org.wfc.user.service.IUAccountPackageService;
import org.wfc.user.service.IUAccountService; import org.wfc.user.service.IUAccountService;
import org.wfc.user.service.IUClientService; import org.wfc.user.service.IUClientService;
import org.wfc.user.util.AccountUtil; import org.wfc.user.util.AccountUtil;
@@ -92,7 +92,7 @@ public class UAccountServiceImpl extends ServiceImpl<UAccountMapper, UAccount> i
private IUClientService uClientService; private IUClientService uClientService;
@Autowired @Autowired
private UAccountPackageMapper accountPackageMapper; private IUAccountPackageService accountPackageService;
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void statAndCancelAuthUser() { public void statAndCancelAuthUser() {
@@ -171,7 +171,7 @@ public class UAccountServiceImpl extends ServiceImpl<UAccountMapper, UAccount> i
UAccount account = this.getOne(Wrappers.<UAccount>lambdaQuery().eq(UAccount::getUserId, loginClient.getUserId()), false); UAccount account = this.getOne(Wrappers.<UAccount>lambdaQuery().eq(UAccount::getUserId, loginClient.getUserId()), false);
// 套餐失效,但是还有其他可用套餐 // 套餐失效,但是还有其他可用套餐
if (!AccountUtil.isPackageValid(account, current)) { if (!AccountUtil.isPackageValid(account, current)) {
List<UAccountPackage> accountPackages = accountPackageMapper.selectList(Wrappers.<UAccountPackage>lambdaQuery() List<UAccountPackage> accountPackages = accountPackageService.list(Wrappers.<UAccountPackage>lambdaQuery()
.eq(UAccountPackage::getAccountId, account.getId()).orderByAsc(UAccountPackage::getCreateTime)); .eq(UAccountPackage::getAccountId, account.getId()).orderByAsc(UAccountPackage::getCreateTime));
Optional<UAccountPackage> accountPackageOptional = accountPackages.stream().findFirst(); Optional<UAccountPackage> accountPackageOptional = accountPackages.stream().findFirst();
if (accountPackageOptional.isPresent()) { if (accountPackageOptional.isPresent()) {
@@ -189,7 +189,7 @@ public class UAccountServiceImpl extends ServiceImpl<UAccountMapper, UAccount> i
account.setEndTime(endTime); account.setEndTime(endTime);
// 更新账号套餐和删除使用套餐 // 更新账号套餐和删除使用套餐
this.updateById(account); this.updateById(account);
accountPackageMapper.deleteById(accountPackage.getId()); accountPackageService.removeById(accountPackage.getId());
} }
} }
@@ -284,8 +284,10 @@ public class UAccountServiceImpl extends ServiceImpl<UAccountMapper, UAccount> i
} else { } else {
dashboardVo.setStatus(0); dashboardVo.setStatus(0);
} }
} }
List<UAccountPackage> accountPackages = accountPackageService.queryList(new UAccountPackage());
dashboardVo.setPackageNum(accountPackages.size());
return dashboardVo; return dashboardVo;
} }