Commit ef1fc4d0 by zhangxingmin

push

parent df5c75e6
...@@ -288,10 +288,15 @@ public class ApiExpectedFortuneAsyncService { ...@@ -288,10 +288,15 @@ public class ApiExpectedFortuneAsyncService {
// 已生效非首期佣金增量(非定时(生效)) // 已生效非首期佣金增量(非定时(生效))
Map<String, BigDecimal> rycDeltaMap = new HashMap<>(); Map<String, BigDecimal> rycDeltaMap = new HashMap<>();
//收集去重的转介人业务ID
HashSet<String> hashSet = new HashSet<>();
for (AlgorithmCollectResDto resDto : filteredCollectResDtos) { for (AlgorithmCollectResDto resDto : filteredCollectResDtos) {
String agentId = resDto.getClientUserBizId(); String agentId = resDto.getClientUserBizId();
Integer fortunePeriod = resDto.getFortunePeriod(); Integer fortunePeriod = resDto.getFortunePeriod();
hashSet.add(agentId);
//积分解冻时间 //积分解冻时间
LocalDateTime thawingTime = resDto.getThawingTime(); LocalDateTime thawingTime = resDto.getThawingTime();
for (AlgorithmResDto algorithmResDto : resDto.getAlgorithmResDtoList()) { for (AlgorithmResDto algorithmResDto : resDto.getAlgorithmResDtoList()) {
...@@ -308,8 +313,6 @@ public class ApiExpectedFortuneAsyncService { ...@@ -308,8 +313,6 @@ public class ApiExpectedFortuneAsyncService {
//已生效首期佣金增量(非定时(生效)) //已生效首期佣金增量(非定时(生效))
firstCommissionDeltaMap.merge(agentId, val, BigDecimal::add); firstCommissionDeltaMap.merge(agentId, val, BigDecimal::add);
} else { } else {
//未生效非首期佣金增量(定时(冻结))
noRycDeltaMap.merge(agentId, val, BigDecimal::add);
//已生效非首期佣金增量(非定时(生效)) //已生效非首期佣金增量(非定时(生效))
rycDeltaMap.merge(agentId, val, BigDecimal::add); rycDeltaMap.merge(agentId, val, BigDecimal::add);
} }
...@@ -317,32 +320,27 @@ public class ApiExpectedFortuneAsyncService { ...@@ -317,32 +320,27 @@ public class ApiExpectedFortuneAsyncService {
}else if (thawingTime != null && thawingTime.compareTo(LocalDateTime.now()) > 0){ }else if (thawingTime != null && thawingTime.compareTo(LocalDateTime.now()) > 0){
//判断积分解冻时间(年月日 + 00:00:00)(冷静期时间 + 期数)是否大于当前时间(年月日时分秒) //判断积分解冻时间(年月日 + 00:00:00)(冷静期时间 + 期数)是否大于当前时间(年月日时分秒)
//如果大于当前时间,走定时任务来解冻积分。 //如果大于当前时间,走定时任务来解冻积分。
// 未生效个人累计积分增量(定时(冻结)) // 未生效个人累计积分增量(定时(冻结))
noDeltaMap.merge(agentId, val, BigDecimal::add); noDeltaMap.merge(agentId, val, BigDecimal::add);
} // 根据期数判断佣金类型
if (fortunePeriod != null && fortunePeriod == 1) {
//未生效首期佣金增量(定时(冻结))
// 根据期数判断佣金类型 noFirstCommissionDeltaMap.merge(agentId, val, BigDecimal::add);
if (fortunePeriod != null && fortunePeriod == 1) { } else {
//未生效首期佣金增量(定时(冻结)) //未生效非首期佣金增量(定时(冻结))
noFirstCommissionDeltaMap.merge(agentId, val, BigDecimal::add); noRycDeltaMap.merge(agentId, val, BigDecimal::add);
//已生效首期佣金增量(非定时(生效)) }
firstCommissionDeltaMap.merge(agentId, val, BigDecimal::add);
} else {
//未生效非首期佣金增量(定时(冻结))
noRycDeltaMap.merge(agentId, val, BigDecimal::add);
//已生效非首期佣金增量(非定时(生效))
rycDeltaMap.merge(agentId, val, BigDecimal::add);
} }
} }
} }
// 更新或新建累计积分记录 // 更新或新建累计积分记录
List<AgentAccumulatedFyc> toUpdateList = new ArrayList<>(); List<AgentAccumulatedFyc> toUpdateList = new ArrayList<>();
for (String agentId : deltaMap.keySet()) { for (String agentId : hashSet) {
//个人累计积分增量(定时(冻结)和 未定时(生效)场景 //已生效个人累计积分增量(非定时(生效)
BigDecimal delta = deltaMap.get(agentId); BigDecimal delta = deltaMap.get(agentId);
//未生效个人累计积分增量(定时(冻结))
BigDecimal noDelta = noDeltaMap.get(agentId);
//未生效首期佣金增量(定时(冻结)) //未生效首期佣金增量(定时(冻结))
BigDecimal noFirstDelta = noFirstCommissionDeltaMap.getOrDefault(agentId, BigDecimal.ZERO); BigDecimal noFirstDelta = noFirstCommissionDeltaMap.getOrDefault(agentId, BigDecimal.ZERO);
...@@ -360,22 +358,26 @@ public class ApiExpectedFortuneAsyncService { ...@@ -360,22 +358,26 @@ public class ApiExpectedFortuneAsyncService {
} }
// 应用增量 // 应用增量
//未生效累计积分(不限业务场景) //未生效累计积分(不限业务场景)
fyc.setNoEffect(fyc.getNoEffect().add(delta)); fyc.setNoEffect(fyc.getNoEffect().add(noDelta));
//未生效累计首期佣金积分值(佣金场景) //未生效累计首期佣金积分值(佣金场景)
fyc.setNoFirstCommission(fyc.getNoFirstCommission().add(noFirstDelta)); fyc.setNoFirstCommission(fyc.getNoFirstCommission().add(noFirstDelta));
//未生效累计非首期佣金积分值(佣金场景) //未生效累计非首期佣金积分值(佣金场景)
fyc.setNoRyc(fyc.getNoRyc().add(noRycDelta)); fyc.setNoRyc(fyc.getNoRyc().add(noRycDelta));
//已生效累计积分(不限业务场景) //已生效累计积分(不限业务场景)
fyc.setNoEffect(fyc.getNoEffect().add(delta)); fyc.setEffect(fyc.getEffect().add(delta));
//已生效累计首期佣金积分值(佣金场景) //已生效累计首期佣金积分值(佣金场景)
fyc.setNoFirstCommission(fyc.getNoFirstCommission().add(noFirstDelta)); fyc.setFirstCommission(fyc.getFirstCommission().add(firstDelta));
//已生效累计非首期佣金积分值(佣金场景) //已生效累计非首期佣金积分值(佣金场景)
fyc.setNoRyc(fyc.getNoRyc().add(noRycDelta)); fyc.setRyc(fyc.getRyc().add(rycDelta));
//累计积分 = 未生效累计积分 + 已生效累计积分 //累计积分 = 未生效累计积分 + 已生效累计积分
fyc.setTotalFyc(fyc.getNoEffect().add(fyc.getEffect())); fyc.setTotalFyc(fyc.getNoEffect().add(fyc.getEffect()));
//晋升职级累计积分 = 已生效累计积分 - 已生效累计非首期佣金积分值
BigDecimal promotion = fyc.getEffect().subtract(fyc.getRyc());
fyc.setPromotion(promotion.compareTo(BigDecimal.ZERO) <= 0 ? BigDecimal.ZERO : promotion);
//最后计算日期,记录最后一次计算累计FYC的日期
fyc.setLastCalcDate(LocalDateTime.now());
toUpdateList.add(fyc); toUpdateList.add(fyc);
} }
......
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