|
|
@@ -155,24 +155,15 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
|
|
|
//近5天将要到期的主账号总数
|
|
|
DateTime now = DateTime.now();
|
|
|
DateTime zero = DateUtil.beginOfDay(now);
|
|
|
- Object accountHead = redisService.get(RedisService.key.CACHE_HEAR_DATA_KEY.getNameFormat(zero.toString()));
|
|
|
- if (accountHead != null) {
|
|
|
- BackgroundDataView dataView = (BackgroundDataView) accountHead;
|
|
|
- backgroundDataView.setTotalNumOfWillExpireAccount(dataView.getTotalNumOfWillExpireAccount());
|
|
|
- backgroundDataView.setTotalExpiredAccountNum(dataView.getTotalExpiredAccountNum());
|
|
|
- backgroundDataView.setTotalNumOfExpiredSubAccount(dataView.getTotalNumOfExpiredSubAccount());
|
|
|
- } else {
|
|
|
- DateTime fiveDays = DateUtil.offsetDay(zero, 5);
|
|
|
- //5天后将到期的主账号
|
|
|
- List<Account> willExpireAccounts = Optional.ofNullable(accountService.list(Wrappers.lambdaQuery(Account.class).gt(Account::getExpiryTime, zero).le(Account::getExpiryTime, fiveDays))).orElse(new ArrayList<>());
|
|
|
- backgroundDataView.setTotalNumOfWillExpireAccount(willExpireAccounts.size());
|
|
|
- //已到期主账号
|
|
|
- List<Account> expiredAccounts = Optional.ofNullable(accountService.list(Wrappers.lambdaQuery(Account.class).le(Account::getExpiryTime, now))).orElse(new ArrayList<>());
|
|
|
- backgroundDataView.setTotalExpiredAccountNum(expiredAccounts.size());
|
|
|
- //已到期子账号
|
|
|
- List<GroupsRelation> expiredSubAccounts = Optional.ofNullable(groupsRelationMapper.selectList(Wrappers.lambdaQuery(GroupsRelation.class).le(GroupsRelation::getExpiryTime, now))).orElse(new ArrayList<>());
|
|
|
- backgroundDataView.setTotalNumOfExpiredSubAccount(expiredSubAccounts.size());
|
|
|
- redisService.set(RedisService.key.CACHE_HEAR_DATA_KEY.getNameFormat(zero.toString()), backgroundDataView, RedisService.key.CACHE_HEAR_DATA_KEY.getTimeout());
|
|
|
- }
|
|
|
+ DateTime fiveDays = DateUtil.offsetDay(zero, 5);
|
|
|
+ //5天后将到期的主账号
|
|
|
+ List<Account> willExpireAccounts = Optional.ofNullable(accountService.list(Wrappers.lambdaQuery(Account.class).ge(Account::getExpiryTime, zero).lt(Account::getExpiryTime, fiveDays))).orElse(new ArrayList<>());
|
|
|
+ backgroundDataView.setTotalNumOfWillExpireAccount(willExpireAccounts.size());
|
|
|
+ //已到期主账号
|
|
|
+ List<Account> expiredAccounts = Optional.ofNullable(accountService.list(Wrappers.lambdaQuery(Account.class).le(Account::getExpiryTime, now))).orElse(new ArrayList<>());
|
|
|
+ backgroundDataView.setTotalExpiredAccountNum(expiredAccounts.size());
|
|
|
+ //已到期子账号
|
|
|
+ List<GroupsRelation> expiredSubAccounts = Optional.ofNullable(groupsRelationMapper.selectList(Wrappers.lambdaQuery(GroupsRelation.class).le(GroupsRelation::getExpiryTime, now))).orElse(new ArrayList<>());
|
|
|
+ backgroundDataView.setTotalNumOfExpiredSubAccount(expiredSubAccounts.size());
|
|
|
}
|
|
|
}
|