|
@@ -141,7 +141,7 @@ public class PartitionCrashServiceImpl implements PartitionCrashService {
|
|
|
if (duserDOS.isEmpty()) {
|
|
|
return;
|
|
|
}
|
|
|
- List<HashMap<Long, Integer>> afterCrashMap = new ArrayList<>();
|
|
|
+ List<HashMap<Long, Long>> afterCrashMap = new ArrayList<>();
|
|
|
// 获取当前合赢奖百分比
|
|
|
OrderPercentageDO orderPercentageDO = orderPercentageService.queryStatus();
|
|
|
|
|
@@ -198,10 +198,10 @@ public class PartitionCrashServiceImpl implements PartitionCrashService {
|
|
|
if (sonOrderCalcDOS.isEmpty()) {
|
|
|
// 插入空数据
|
|
|
sonBuilder = addSonEmpty(sonBuilder, k);
|
|
|
- crashSaveReqVOBuilder.sonPrice(0);
|
|
|
+ crashSaveReqVOBuilder.sonPrice(0L);
|
|
|
}
|
|
|
// 合计儿子分支额度
|
|
|
- Integer sonSumPrice = sonOrderCalcDOS.stream().mapToInt(OrderCalcDO::getGrossProfitBonusQuota).sum();
|
|
|
+ Long sonSumPrice = sonOrderCalcDOS.stream().mapToLong(OrderCalcDO::getGrossProfitBonusQuota).sum();
|
|
|
sonBuilder.price(sonSumPrice);
|
|
|
|
|
|
// 获取当前用户的兄弟分区
|
|
@@ -209,11 +209,11 @@ public class PartitionCrashServiceImpl implements PartitionCrashService {
|
|
|
if (brothersOrderCalcDOS.isEmpty()) {
|
|
|
// 插入空数据
|
|
|
brotherBuilder = addBrotherEmpty(brotherBuilder, k);
|
|
|
- crashSaveReqVOBuilder.brotherPrice(0);
|
|
|
+ crashSaveReqVOBuilder.brotherPrice(0L);
|
|
|
}
|
|
|
|
|
|
// 合并兄弟分支额度
|
|
|
- Integer brotherSumPrice = brothersOrderCalcDOS.stream().mapToInt(OrderCalcDO::getGrossProfitBonusQuota).sum();
|
|
|
+ Long brotherSumPrice = brothersOrderCalcDOS.stream().mapToLong(OrderCalcDO::getGrossProfitBonusQuota).sum();
|
|
|
brotherBuilder.price(brotherSumPrice);
|
|
|
|
|
|
|
|
@@ -228,8 +228,8 @@ public class PartitionCrashServiceImpl implements PartitionCrashService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- int afterCrash = 0;
|
|
|
- Integer smallQuota = 0;
|
|
|
+ Long afterCrash = 0L;
|
|
|
+ Long smallQuota = 0L;
|
|
|
// 碰撞计算
|
|
|
if (sonSumPrice >= brotherSumPrice) {
|
|
|
sonBuilder.size(1);
|
|
@@ -251,20 +251,20 @@ public class PartitionCrashServiceImpl implements PartitionCrashService {
|
|
|
|
|
|
// 积分添加 添加的时候, 需要注意当前用户是否有足够的积分可以获取
|
|
|
// 碰撞后的额度的
|
|
|
- Integer highQuota = integralDO.getHighQuota();
|
|
|
- Integer parentHighQuota = parentIntegralDo.getHighQuota();
|
|
|
+ Long highQuota = integralDO.getHighQuota();
|
|
|
+ Long parentHighQuota = parentIntegralDo.getHighQuota();
|
|
|
|
|
|
BigDecimal smallBigDecimal = new BigDecimal(String.valueOf(smallQuota));
|
|
|
BigDecimal multiply = smallBigDecimal.divide(new BigDecimal("2.0"), 4, RoundingMode.DOWN);
|
|
|
if (compare(highQuota, multiply)) {
|
|
|
- Integer currentQuota = integralDO.getCurrentQuota();
|
|
|
+ Long currentQuota = integralDO.getCurrentQuota();
|
|
|
integralDO.setCurrentQuota(currentQuota + multiply.intValue());
|
|
|
// 碰撞后的额度添加到日志中 增加日志模块
|
|
|
integralService.updateIntegral(BeanUtils.toBean(integralDO, IntegralSaveReqVO.class));
|
|
|
ptProfitLogService.addMessage(k.getUserId(), CaclEnum.SMALL_QUOTA_CRASH, currentQuota, integralDO.getCurrentQuota(), JsonUtils.toJsonString(orderPercentageDO));
|
|
|
}
|
|
|
if (compare(parentHighQuota, multiply)) {
|
|
|
- Integer currentQuota = parentIntegralDo.getCurrentQuota();
|
|
|
+ Long currentQuota = parentIntegralDo.getCurrentQuota();
|
|
|
parentIntegralDo.setCurrentQuota(currentQuota + multiply.intValue());
|
|
|
// 碰撞后的额度添加到日志中 增加日志模块
|
|
|
integralService.updateIntegral(BeanUtils.toBean(parentIntegralDo, IntegralSaveReqVO.class));
|
|
@@ -279,13 +279,13 @@ public class PartitionCrashServiceImpl implements PartitionCrashService {
|
|
|
}
|
|
|
|
|
|
// 获取计算后积分, Long为userId, Integer为碰撞后额度
|
|
|
- HashMap<Long, Integer> map = new HashMap<>();
|
|
|
+ HashMap<Long, Long> map = new HashMap<>();
|
|
|
// 如果为当前用户为平台,则不需要存入这个地方
|
|
|
if (!k.getUserId().equals(PT_ID)){
|
|
|
- map.put(k.getUserId(), multiply.intValue());
|
|
|
+ map.put(k.getUserId(), multiply.longValue());
|
|
|
}
|
|
|
if (!parentIntegralDo.getUserId().equals(PT_ID)){
|
|
|
- map.put(parentIntegralDo.getUserId(), multiply.intValue());
|
|
|
+ map.put(parentIntegralDo.getUserId(), multiply.longValue());
|
|
|
}
|
|
|
afterCrashMap.add(map);
|
|
|
|
|
@@ -309,8 +309,8 @@ public class PartitionCrashServiceImpl implements PartitionCrashService {
|
|
|
// 获取当前平台的额度
|
|
|
PtProfitDO ptProfit = ptProfitService.getPtProfit();
|
|
|
// 遍历hashMap
|
|
|
- for (HashMap<Long, Integer> longIntegerHashMap : afterCrashMap) {
|
|
|
- for (Map.Entry<Long, Integer> entry : longIntegerHashMap.entrySet()) {
|
|
|
+ for (HashMap<Long, Long> longIntegerHashMap : afterCrashMap) {
|
|
|
+ for (Map.Entry<Long, Long> entry : longIntegerHashMap.entrySet()) {
|
|
|
if (ptProfit.getPtGrossAdd() <= 0) {
|
|
|
break;
|
|
|
}
|
|
@@ -334,7 +334,7 @@ public class PartitionCrashServiceImpl implements PartitionCrashService {
|
|
|
.ptTotalAdd(ptProfit.getPtTotalAdd()).build());
|
|
|
}
|
|
|
|
|
|
- public Boolean compare(Integer highQuota, BigDecimal afterCrash) {
|
|
|
+ public Boolean compare(Long highQuota, BigDecimal afterCrash) {
|
|
|
BigDecimal high = new BigDecimal(String.valueOf(highQuota));
|
|
|
int i = high.compareTo(afterCrash);
|
|
|
return i >= 0;
|
|
@@ -351,8 +351,8 @@ public class PartitionCrashServiceImpl implements PartitionCrashService {
|
|
|
return brotherBuilder.name(duserDO.getName())
|
|
|
.nickName(duserDO.getNickName())
|
|
|
.size(0)
|
|
|
- .price(0)
|
|
|
- .afterHitQuota(0)
|
|
|
+ .price(0L)
|
|
|
+ .afterHitQuota(0L)
|
|
|
.hasHit(0);
|
|
|
}
|
|
|
|
|
@@ -362,8 +362,8 @@ public class PartitionCrashServiceImpl implements PartitionCrashService {
|
|
|
return sonBuilder.name(duserDO.getName())
|
|
|
.nickName(duserDO.getNickName())
|
|
|
.size(0)
|
|
|
- .price(0)
|
|
|
- .afterHitQuota(0)
|
|
|
+ .price(0L)
|
|
|
+ .afterHitQuota(0L)
|
|
|
.hasHit(0);
|
|
|
}
|
|
|
|