Commit f423ad8b authored by renjie's avatar renjie

admin接口bug

parent 63d370b3
...@@ -382,7 +382,7 @@ public class AdministratorServiceImpl implements AdministratorService { ...@@ -382,7 +382,7 @@ public class AdministratorServiceImpl implements AdministratorService {
public IpCountQueryResultDto queyrIpCount(String username) { public IpCountQueryResultDto queyrIpCount(String username) {
IpCountQueryResultDto ipCountQueryResultDto = new IpCountQueryResultDto(); IpCountQueryResultDto ipCountQueryResultDto = new IpCountQueryResultDto();
if (StringUtils.isBlank(username)) { if (StringUtils.isBlank(username)) {
long ipcount_using = ipResourceRepository.countAllByIsDeleted(false); long ipcount_using = ipResourceRepository.countAllByIsDeletedAndValidTimeGreaterThan(false, Instant.now().toEpochMilli());
long ipcount_all = ipResourceRepository.count(); long ipcount_all = ipResourceRepository.count();
ipCountQueryResultDto.setIpCount_using(ipcount_using); ipCountQueryResultDto.setIpCount_using(ipcount_using);
ipCountQueryResultDto.setIpCount_all(ipcount_all); ipCountQueryResultDto.setIpCount_all(ipcount_all);
...@@ -394,7 +394,7 @@ public class AdministratorServiceImpl implements AdministratorService { ...@@ -394,7 +394,7 @@ public class AdministratorServiceImpl implements AdministratorService {
ipCountQueryResultDto.setIpCount_using(ipCountRecord.getIp_using()); ipCountQueryResultDto.setIpCount_using(ipCountRecord.getIp_using());
} }
} else { } else {
long ipcount_using = ipResourceRepository.countAllByOwnerAndIsDeleted(username, false); long ipcount_using = ipResourceRepository.countAllByOwnerAndIsDeletedAndValidTimeGreaterThan(username, false, Instant.now().toEpochMilli());
long ipcount_all = ipResourceRepository.countAllByOwner(username); long ipcount_all = ipResourceRepository.countAllByOwner(username);
ipCountQueryResultDto.setIpCount_using(ipcount_using); ipCountQueryResultDto.setIpCount_using(ipcount_using);
ipCountQueryResultDto.setIpCount_all(ipcount_all); ipCountQueryResultDto.setIpCount_all(ipcount_all);
...@@ -453,12 +453,12 @@ public class AdministratorServiceImpl implements AdministratorService { ...@@ -453,12 +453,12 @@ public class AdministratorServiceImpl implements AdministratorService {
promotion.setTotalCommission(promotion.getTotalCommission() + (int)totalCommission); promotion.setTotalCommission(promotion.getTotalCommission() + (int)totalCommission);
promotion.setCommission(promotion.getCommission() + x.getPromotion().getCommission()); promotion.setCommission(promotion.getCommission() + x.getPromotion().getCommission());
double secondCommission = 0; double secondCommission = 0;
ipCount.addAndGet(ipResourceRepository.countAllByOwnerAndIsDeleted(x.getName(), false)); ipCount.addAndGet(ipResourceRepository.countAllByOwnerAndIsDeletedAndValidTimeGreaterThan(x.getName(), false, Instant.now().toEpochMilli()));
if (finalAccount.getPromotion().isSale() && x.getParent() == null) { if (finalAccount.getPromotion().isSale() && x.getParent() == null) {
List<Account> secondPromotes = accountRepository.findByPromotionCodeAndParentIsNull(x.getPromotion().getCode()); List<Account> secondPromotes = accountRepository.findByPromotionCodeAndParentIsNull(x.getPromotion().getCode());
if (secondPromotes != null && secondPromotes.size() > 0) { if (secondPromotes != null && secondPromotes.size() > 0) {
for (Account secondPromote : secondPromotes) { for (Account secondPromote : secondPromotes) {
ipCount.addAndGet(ipResourceRepository.countAllByOwnerAndIsDeleted(secondPromote.getName(), false)); ipCount.addAndGet(ipResourceRepository.countAllByOwnerAndIsDeletedAndValidTimeGreaterThan(secondPromote.getName(), false, Instant.now().toEpochMilli()));
List<UserPrePaidBilling> userPrePaidBillings1 = userPrePaidBillingRepository.findByAdministratorAndPayMethodInAndTimestampBetween(secondPromote.getName(), Arrays.asList(1,2,3), dateTime1.getTime(), dateTime2.getTime()); List<UserPrePaidBilling> userPrePaidBillings1 = userPrePaidBillingRepository.findByAdministratorAndPayMethodInAndTimestampBetween(secondPromote.getName(), Arrays.asList(1,2,3), dateTime1.getTime(), dateTime2.getTime());
if (userPrePaidBillings1 != null && userPrePaidBillings1.size() > 0) if (userPrePaidBillings1 != null && userPrePaidBillings1.size() > 0)
secondCommission += userPrePaidBillings1.stream().mapToDouble(UserPrePaidBilling::getTotal).sum(); secondCommission += userPrePaidBillings1.stream().mapToDouble(UserPrePaidBilling::getTotal).sum();
......
...@@ -44,8 +44,8 @@ public interface IpResourceRepository extends MongoRepository<IpResource, String ...@@ -44,8 +44,8 @@ public interface IpResourceRepository extends MongoRepository<IpResource, String
int countByStatusAndIdInAndIsDeleted(int status, List<String> ipIds, boolean isDeleted); int countByStatusAndIdInAndIsDeleted(int status, List<String> ipIds, boolean isDeleted);
long countAllByIsDeleted(boolean isDeleted); long countAllByIsDeletedAndValidTimeGreaterThan(boolean isDeleted, long time);
long countAllByOwnerAndIsDeleted(String username, boolean isDeleted); long countAllByOwnerAndIsDeletedAndValidTimeGreaterThan(String username, boolean isDeleted, long time);
long countAllByOwner(String username); long countAllByOwner(String username);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment