Commit 7e11662a authored by xuxin's avatar xuxin

管理员界面-推广码下线查询 调试

parent 14dc0779
......@@ -511,9 +511,13 @@ public class AdministratorServiceImpl implements AdministratorService {
@Override
public PromotionInfoDto countPromotionInfos(String username, String promotionCode, String beginDate, String endDate) {
// 1. 根据传入的 username 或者 推荐码 获取用户信息
long start = System.currentTimeMillis();
Account account = getAccount(username, promotionCode);
log.info("===>countPromotionInfos step-1 consume time {}", System.currentTimeMillis() - start);
// 2. 获取 该推荐码下所有的用户
start = System.currentTimeMillis();
List<Account> accounts = accountRepository.findAllByPromotionCodeAndParentIsNull(account.getPromotion().getCode());
log.info("===>countPromotionInfos step-2 consume time {}", System.currentTimeMillis() - start);
// promotion 用来存储所有用户的消费信息
PromotionInfoDto promotionInfoDto = new PromotionInfoDto();
......@@ -527,12 +531,15 @@ public class AdministratorServiceImpl implements AdministratorService {
Date beginTime = formatter.parse(beginDate);
Date endTime = formatter.parse(endDate);
start = System.currentTimeMillis();
if (accounts != null && accounts.size() > 0) {
// 邀请的一级用户数
promotionInfoDto.setFirstLevelInvitedUsers(accounts.size());
int i = 3, j = 0;
accounts.forEach(x -> {
long start2 = System.currentTimeMillis();
int[] arr1 = getCommissionAndIps(beginTime, endTime, x);
log.info("===>countPromotionInfos step-3-{} consume time {}", accounts.indexOf(x) + 1, (System.currentTimeMillis() - start2));
promotionInfoDto.setFirstLevelCommission(promotionInfoDto.getFirstLevelCommission() + arr1[0]);
promotionInfoDto.setFirstLevelIps(promotionInfoDto.getFirstLevelIps() + arr1[1]);
......@@ -543,7 +550,9 @@ public class AdministratorServiceImpl implements AdministratorService {
if (secondPromotes != null && secondPromotes.size() > 0) {
for (Account secondPromote : secondPromotes) {
// 将下级账户及下级账户的子账户中未过期的ip统计到 ipCount中
long start3 = System.currentTimeMillis();
int[] arr2 = getCommissionAndIps(beginTime, endTime, secondPromote);
log.info("===>countPromotionInfos step-3-{}-{} consume time {}", accounts.indexOf(x) + 1, secondPromotes.indexOf(secondPromote) + 1, (System.currentTimeMillis() - start3));
promotionInfoDto.setSecondLevelCommission(promotionInfoDto.getSecondLevelCommission() + arr2[0]);
promotionInfoDto.setSecondLevelIps(promotionInfoDto.getSecondLevelIps() + arr2[1]);
}
......@@ -551,7 +560,7 @@ public class AdministratorServiceImpl implements AdministratorService {
}
});
}
log.info("===>countPromotionInfos step-4 consume time {}", System.currentTimeMillis() - start);
// 设置总ip
promotionInfoDto.setAllLevelIps(promotionInfoDto.getFirstLevelIps() + promotionInfoDto.getSecondLevelIps());
// 设置应当提现的礼物金额
......
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