|
@@ -12,9 +12,12 @@ import cn.newfeifan.mall.module.distri.dal.dataobject.ordercalc.OrderCalcDO;
|
|
|
import cn.newfeifan.mall.module.distri.dal.dataobject.orderpercentage.OrderPercentageDO;
|
|
|
import cn.newfeifan.mall.module.distri.dal.dataobject.ptprofit.PtProfitDO;
|
|
|
import cn.newfeifan.mall.module.distri.dal.dataobject.ptprofitdailystatisticslog.PtProfitDailyStatisticsLogDO;
|
|
|
+import cn.newfeifan.mall.module.distri.dal.dataobject.sharepath.SharePathDO;
|
|
|
import cn.newfeifan.mall.module.distri.dal.mysql.ptprofit.PtProfitMapper;
|
|
|
import cn.newfeifan.mall.module.distri.dal.mysql.ptprofitdailystatisticslog.PtProfitDailyStatisticsLogMapper;
|
|
|
import cn.newfeifan.mall.module.distri.enums.CaclEnum;
|
|
|
+import cn.newfeifan.mall.module.distri.enums.IntegralEnum;
|
|
|
+import cn.newfeifan.mall.module.distri.enums.ProfitTypeEnum;
|
|
|
import cn.newfeifan.mall.module.distri.service.dailyawardrecords.DailyAwardRecordsService;
|
|
|
import cn.newfeifan.mall.module.distri.service.duser.DuserService;
|
|
|
import cn.newfeifan.mall.module.distri.service.integral.IntegralService;
|
|
@@ -159,88 +162,74 @@ public class PartitionCrashServiceImpl implements PartitionCrashService {
|
|
|
}
|
|
|
//记录所有用户的id和积分
|
|
|
List<HashMap<Long, Long>> afterCrashMap = new ArrayList<>();
|
|
|
- // 获取当前合赢奖百分比
|
|
|
+ // 获取当前团队奖百分比
|
|
|
OrderPercentageDO orderPercentageDO = orderPercentageService.queryStatus();
|
|
|
|
|
|
- // 获取当前所有用户的父亲
|
|
|
- Map<Long, Long> sonAndParent = new HashMap<>();
|
|
|
- List<Long> userIds = duserDOS.stream().map(DuserDO::getUserId).collect(Collectors.toList());
|
|
|
-
|
|
|
- userIds.forEach(k -> {
|
|
|
- Long parent = sharePathService.queryParentBySonUserId(k);
|
|
|
- sonAndParent.put(k, parent);
|
|
|
- });
|
|
|
-
|
|
|
List<PartitionSonSaveReqVO> partitionSonSaveReqVOS = new ArrayList<>();
|
|
|
List<PartitionBrothersSaveReqVO> partitionBrothersSaveReqVOS = new ArrayList<>();
|
|
|
List<PartitionCrashSaveReqVO> partitionCrashSaveReqVOS = new ArrayList<>();
|
|
|
|
|
|
- // 本来在下面,搬上来,因为游客收益要扣减
|
|
|
- IntegralDO ptIntegralDO = integralService.selectByUser(PT_ID);
|
|
|
+ // 平台钱包
|
|
|
+ PtProfitDO ptProfit = ptProfitMapper.selectList().get(0);
|
|
|
|
|
|
duserDOS.forEach(k -> {
|
|
|
|
|
|
// 获取当前用户的钱包
|
|
|
IntegralDO integralDO = integralService.selectByUser(k.getUserId());
|
|
|
- // 获取当前用户信息
|
|
|
- MemberUserDO user = memberUserService.getUser(k.getUserId());
|
|
|
+ // 获取用户关系网
|
|
|
+ SharePathDO sharePathDO = sharePathService.getSharePathByDescendant(k.getUserId());
|
|
|
|
|
|
- // 获取当前父亲的钱包
|
|
|
- Long parent = sonAndParent.get(k.getUserId());
|
|
|
- IntegralDO parentIntegralDo = integralService.selectByUser(parent);
|
|
|
- if (parentIntegralDo != null) {
|
|
|
+ // 获取当前用户的钱包
|
|
|
+ if (integralDO != null) {
|
|
|
|
|
|
// 创建一个分区编号
|
|
|
String todayNo = crashTodayNo(k.getUserId());
|
|
|
|
|
|
- PartitionSonSaveReqVO.PartitionSonSaveReqVOBuilder sonBuilder = PartitionSonSaveReqVO.builder();
|
|
|
- PartitionBrothersSaveReqVO.PartitionBrothersSaveReqVOBuilder brotherBuilder = PartitionBrothersSaveReqVO.builder();
|
|
|
+ PartitionSonSaveReqVO.PartitionSonSaveReqVOBuilder leftBuilder = PartitionSonSaveReqVO.builder();
|
|
|
+ PartitionBrothersSaveReqVO.PartitionBrothersSaveReqVOBuilder rightBuilder = PartitionBrothersSaveReqVO.builder();
|
|
|
PartitionCrashSaveReqVO.PartitionCrashSaveReqVOBuilder crashSaveReqVOBuilder = PartitionCrashSaveReqVO.builder();
|
|
|
- sonBuilder.partNo(todayNo);
|
|
|
- sonBuilder.userId(k.getUserId());
|
|
|
- sonBuilder.name(k.getName());
|
|
|
- sonBuilder.nickName(k.getNickName());
|
|
|
- sonBuilder.hasHit(1);
|
|
|
+ leftBuilder.partNo(todayNo);
|
|
|
+ leftBuilder.userId(k.getUserId());
|
|
|
+ leftBuilder.userName(k.getUserName());
|
|
|
+ leftBuilder.hasHit(1);
|
|
|
|
|
|
- brotherBuilder.partNo(todayNo);
|
|
|
- brotherBuilder.userId(k.getUserId());
|
|
|
- brotherBuilder.name(k.getName());
|
|
|
- brotherBuilder.nickName(k.getNickName());
|
|
|
- brotherBuilder.hasHit(1);
|
|
|
+ rightBuilder.partNo(todayNo);
|
|
|
+ rightBuilder.userId(k.getUserId());
|
|
|
+ rightBuilder.userName(k.getUserName());
|
|
|
+ rightBuilder.hasHit(1);
|
|
|
|
|
|
|
|
|
crashSaveReqVOBuilder.partNo(todayNo);
|
|
|
crashSaveReqVOBuilder.userId(k.getUserId());
|
|
|
- crashSaveReqVOBuilder.nickName(k.getNickName());
|
|
|
- crashSaveReqVOBuilder.userName(k.getName());
|
|
|
+ crashSaveReqVOBuilder.userName(k.getUserName());
|
|
|
|
|
|
- // 获取当前用户的后代分区 , 并且该分区存在有下单的用户
|
|
|
- List<OrderCalcDO> sonOrderCalcDOS = sharePathService.selectSons(k.getUserId(), userId);
|
|
|
- if (sonOrderCalcDOS.isEmpty()) {
|
|
|
+ // 获取当前用户的左边分区 , 并且该分区存在有下单的用户
|
|
|
+ List<OrderCalcDO> leftOrderCalcDOS = sharePathService.selectArea(sharePathDO.getLeftChildId(), userId);
|
|
|
+ if (leftOrderCalcDOS.isEmpty()) {
|
|
|
// 插入空数据
|
|
|
- sonBuilder = addSonEmpty(sonBuilder, k);
|
|
|
+ leftBuilder = addSonEmpty(leftBuilder, k);
|
|
|
crashSaveReqVOBuilder.sonPrice(0L);
|
|
|
}
|
|
|
- // 合计儿子分支额度
|
|
|
+ // 合计左边分支额度
|
|
|
double grossProfitBonusQuotaPerc = Double.parseDouble(orderPercentageDO.getGrossProfitBonusQuotaPerc());
|
|
|
- Long sonSumPrice = (long) (sonOrderCalcDOS.stream().mapToLong(OrderCalcDO::getGrossProfit).sum() * grossProfitBonusQuotaPerc);
|
|
|
- sonBuilder.price(sonSumPrice);
|
|
|
+ Long sonSumPrice = (long) (leftOrderCalcDOS.stream().mapToLong(OrderCalcDO::getGrossProfit).sum() * grossProfitBonusQuotaPerc);
|
|
|
+ leftBuilder.price(sonSumPrice);
|
|
|
|
|
|
- // 获取当前用户的兄弟分区
|
|
|
- List<OrderCalcDO> brothersOrderCalcDOS = sharePathService.selectBrothers(k.getUserId(), userId, user);
|
|
|
- if (brothersOrderCalcDOS.isEmpty()) {
|
|
|
+ // 获取当前用户的右边分区
|
|
|
+ List<OrderCalcDO> rightOrderCalcDOS = sharePathService.selectArea(sharePathDO.getRightChildId(), userId);
|
|
|
+ if (rightOrderCalcDOS.isEmpty()) {
|
|
|
// 插入空数据
|
|
|
- brotherBuilder = addBrotherEmpty(brotherBuilder, k);
|
|
|
+ rightBuilder = addBrotherEmpty(rightBuilder, k);
|
|
|
crashSaveReqVOBuilder.brotherPrice(0L);
|
|
|
}
|
|
|
|
|
|
// 合并兄弟分支额度
|
|
|
- Long brotherSumPrice = (long) (brothersOrderCalcDOS.stream().mapToLong(OrderCalcDO::getGrossProfit).sum() * grossProfitBonusQuotaPerc);
|
|
|
- brotherBuilder.price(brotherSumPrice);
|
|
|
+ Long brotherSumPrice = (long) (rightOrderCalcDOS.stream().mapToLong(OrderCalcDO::getGrossProfit).sum() * grossProfitBonusQuotaPerc);
|
|
|
+ rightBuilder.price(brotherSumPrice);
|
|
|
|
|
|
|
|
|
// 判断,昨天是否有存余的分支
|
|
|
- PartitionCrashDO yesterdayCrash = crashYesterdayNo(k.getUserId(),1);
|
|
|
+ PartitionCrashDO yesterdayCrash = crashYesterdayNo(k.getUserId(), 1);
|
|
|
// 如果不为空, 则判断增加到哪个分支中
|
|
|
if (yesterdayCrash != null) {
|
|
|
if (yesterdayCrash.getSonPrice() >= yesterdayCrash.getBrotherPrice()) {
|
|
@@ -254,142 +243,77 @@ public class PartitionCrashServiceImpl implements PartitionCrashService {
|
|
|
Long smallQuota = 0L;
|
|
|
// 碰撞计算
|
|
|
if (sonSumPrice >= brotherSumPrice) {
|
|
|
- sonBuilder.size(1);
|
|
|
- brotherBuilder.size(0);
|
|
|
+ leftBuilder.size(1);
|
|
|
+ rightBuilder.size(0);
|
|
|
afterCrash = sonSumPrice - brotherSumPrice;
|
|
|
smallQuota = brotherSumPrice;
|
|
|
|
|
|
} else {
|
|
|
- sonBuilder.size(0);
|
|
|
- brotherBuilder.size(1);
|
|
|
+ leftBuilder.size(0);
|
|
|
+ rightBuilder.size(1);
|
|
|
afterCrash = brotherSumPrice - sonSumPrice;
|
|
|
smallQuota = sonSumPrice;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
crashSaveReqVOBuilder.brotherPrice(brotherSumPrice);
|
|
|
crashSaveReqVOBuilder.sonPrice(sonSumPrice);
|
|
|
crashSaveReqVOBuilder.afterHitQuota(afterCrash);
|
|
|
|
|
|
// 积分添加 添加的时候, 需要注意当前用户是否有足够的积分可以获取
|
|
|
// 碰撞后的额度的
|
|
|
- Long highQuota = integralDO.getHighQuota() + new BigDecimal(orderPercentageDO.getBaseMaxQuota()).longValue(); //加上基础的最大额度值
|
|
|
- Long parentHighQuota = parentIntegralDo.getHighQuota() + new BigDecimal(orderPercentageDO.getBaseMaxQuota()).longValue();
|
|
|
+ Long highQuota = integralDO.getHighQuota();
|
|
|
|
|
|
BigDecimal smallBigDecimal = new BigDecimal(String.valueOf(smallQuota));
|
|
|
- BigDecimal multiply = smallBigDecimal.divide(new BigDecimal("2.0"), 4, RoundingMode.DOWN);
|
|
|
- //直推人的本次添加积分
|
|
|
+
|
|
|
+ // 获取计算后积分, Long为userId, Integer为碰撞后额度
|
|
|
+ HashMap<Long, Long> map = new HashMap<>();
|
|
|
+
|
|
|
+ //直推人的的本次添加积分
|
|
|
Long amount = 0L;
|
|
|
//平台需要补回的收益(也可以理解为用户溢出)
|
|
|
- Long ptReplenish = multiply.longValue();
|
|
|
-
|
|
|
+ Long ptReplenish = smallBigDecimal.longValue();
|
|
|
//直推人
|
|
|
- if (multiply.longValue() != 0) {
|
|
|
+ if (smallBigDecimal.longValue() != 0) {
|
|
|
if (highQuota.compareTo(0L) > 0) {
|
|
|
-
|
|
|
- if (highQuota.compareTo(multiply.longValue()) > 0) {
|
|
|
- amount = multiply.longValue();
|
|
|
+ if (highQuota.compareTo(smallBigDecimal.longValue()) > 0) {
|
|
|
+ amount = smallBigDecimal.longValue();
|
|
|
ptReplenish = 0L;
|
|
|
} else {
|
|
|
amount = highQuota;
|
|
|
- ptReplenish = multiply.longValue() - highQuota;
|
|
|
+ ptReplenish = smallBigDecimal.longValue() - highQuota;
|
|
|
}
|
|
|
addHighQuota(userHighQuotaMap, integralDO.getUserId(), amount);
|
|
|
}
|
|
|
- integralDO.setFreezeQuota(integralDO.getFreezeQuota() + amount);
|
|
|
+ // 减去最高额度
|
|
|
integralDO.setHighQuota(integralDO.getHighQuota() - amount);
|
|
|
-
|
|
|
+ integralDO.setFreezeQuota(integralDO.getFreezeQuota() + amount);
|
|
|
|
|
|
integralDO.setAccumulatedQuota(integralDO.getAccumulatedQuota() + amount);
|
|
|
// 碰撞后的额度添加到日志中 增加日志模块
|
|
|
integralService.updateIntegral(BeanUtils.toBean(integralDO, IntegralSaveReqVO.class));
|
|
|
- Long logId = ptProfitLogService.addMessageFreeze(integralDO.getUserId(), integralDO.getUserId(), CaclEnum.SMALL_QUOTA_CRASH, amount,
|
|
|
- integralDO.getFreezeQuota(), JsonUtils.toJsonString(orderPercentageDO), ptReplenish, -amount, highQuota - amount);
|
|
|
-
|
|
|
- //记录每日用户有合赢将的记录,后面用来结算的
|
|
|
- dailyAwardRecordsService.addDailyAwardRecords(integralDO.getUserId(), integralDO.getUserId(), amount, logId, ptReplenish);
|
|
|
- }
|
|
|
- if (!ptReplenish.equals(0L)) {
|
|
|
- calcIntegral(ptReplenish, integralDO.getUserId(), JsonUtils.toJsonString(orderPercentageDO));
|
|
|
- }
|
|
|
|
|
|
- // 获取计算后积分, Long为userId, Integer为碰撞后额度
|
|
|
- HashMap<Long, Long> map = new HashMap<>();
|
|
|
+ ptProfit.setPtGrossAdd(ptProfit.getPtGrossAdd() - amount);
|
|
|
+ ptProfit.setPtTotalAdd(ptProfit.getPtTotalAdd() - amount);
|
|
|
|
|
|
- // 当用户为游客的时候上级不参与合赢奖
|
|
|
- if (!user.getVisitor()) {
|
|
|
- //直推人的上级的本次添加积分
|
|
|
- Long parentAmount = 0L;
|
|
|
- //平台需要补回的收益(也可以理解为用户溢出)
|
|
|
- Long parentPtReplenish = multiply.longValue();
|
|
|
- //直推人的父级
|
|
|
- if (multiply.longValue() != 0) {
|
|
|
- if (parentHighQuota.compareTo(0L) > 0) {
|
|
|
- if (parentHighQuota.compareTo(multiply.longValue()) > 0) {
|
|
|
- parentAmount = multiply.longValue();
|
|
|
- parentPtReplenish = 0L;
|
|
|
- } else {
|
|
|
- parentAmount = highQuota;
|
|
|
- parentPtReplenish = multiply.longValue() - highQuota;
|
|
|
- }
|
|
|
- addHighQuota(userHighQuotaMap, parentIntegralDo.getUserId(), parentAmount);
|
|
|
- }
|
|
|
- // 减去最高额度
|
|
|
- parentIntegralDo.setHighQuota(parentIntegralDo.getHighQuota() - parentAmount);
|
|
|
- parentIntegralDo.setFreezeQuota(parentIntegralDo.getFreezeQuota() + parentAmount);
|
|
|
-
|
|
|
- parentIntegralDo.setAccumulatedQuota(parentIntegralDo.getAccumulatedQuota() + parentAmount);
|
|
|
- // 碰撞后的额度添加到日志中 增加日志模块
|
|
|
- integralService.updateIntegral(BeanUtils.toBean(parentIntegralDo, IntegralSaveReqVO.class));
|
|
|
- Long logId = ptProfitLogService.addMessageFreeze(parentIntegralDo.getUserId(), integralDO.getUserId(), CaclEnum.SMALL_QUOTA_CRASH, parentAmount,
|
|
|
- parentIntegralDo.getFreezeQuota(), JsonUtils.toJsonString(orderPercentageDO), parentPtReplenish, -parentAmount, parentHighQuota - parentAmount);
|
|
|
-
|
|
|
- //记录每日用户有合赢将的记录,后面用来结算的
|
|
|
- dailyAwardRecordsService.addDailyAwardRecords(parentIntegralDo.getUserId(), integralDO.getUserId(), parentAmount, logId, parentPtReplenish);
|
|
|
- }
|
|
|
+ Long logId = ptProfitLogService.createPtProfitLog(integralDO.getUserId(), amount, ptProfit.getPtGrossAdd(),
|
|
|
+ JsonUtils.toJsonString(orderPercentageDO), IntegralEnum.TEAM_BONUS, ProfitTypeEnum.PT_PROFIT.getType());
|
|
|
|
|
|
- if (!parentPtReplenish.equals(0L)) {
|
|
|
- calcIntegral(parentPtReplenish, parentIntegralDo.getUserId(), JsonUtils.toJsonString(orderPercentageDO));
|
|
|
- }
|
|
|
+ //记录每日用户有团队奖的记录,后面用来结算的
|
|
|
+ dailyAwardRecordsService.addDailyAwardRecords(sharePathDO.getUserId(), integralDO.getUserId(), amount, logId, ptReplenish);
|
|
|
|
|
|
- if (!parentIntegralDo.getUserId().equals(PT_ID)) {
|
|
|
- map.put(parentIntegralDo.getUserId(), parentAmount);
|
|
|
- }
|
|
|
- } else if (multiply.longValue() != 0) {
|
|
|
- // 如果当前用户是游客,将上级推荐将加入到游客收益中,不算入到翁总的合赢奖
|
|
|
- Long visitorEarnings = multiply.longValue(); //单笔收益
|
|
|
-
|
|
|
- // 获取平台的游客收益
|
|
|
- PtProfitDO ptProfit = ptProfitService.getPtProfit();
|
|
|
- ptProfit.setVisitorEarnings(ptProfit.getVisitorEarnings() + visitorEarnings);
|
|
|
- ptProfit.setPtGrossAdd(ptProfit.getPtGrossAdd() - visitorEarnings);
|
|
|
- ptProfitService.updatePtProfit(BeanUtils.toBean(ptProfit, PtProfitSaveReqVO.class));
|
|
|
- ptIntegralDO.setCurrentQuota(ptIntegralDO.getCurrentQuota() - visitorEarnings);
|
|
|
-
|
|
|
- ptProfitLogService.addMessage(parent, CaclEnum.AFTER_CRASH_CALC_PT_TOTAL_QUOTA
|
|
|
- , -visitorEarnings, ptProfit.getPtTotalAdd() - visitorEarnings, JsonUtils.toJsonString(orderPercentageDO), null, null, null);
|
|
|
- ptProfitLogService.addMessage(parent, CaclEnum.AFTER_CRASH_CALC_PT_TOTAL_GROSS_QUOTA
|
|
|
- , -visitorEarnings, ptProfit.getPtGrossAdd(), JsonUtils.toJsonString(orderPercentageDO), null, null, null);
|
|
|
-
|
|
|
- // 记录平台游客收益log
|
|
|
- ptProfitLogService.addMessage(k.getUserId(), null ,CaclEnum.SMALL_QUOTA_CRASH_SETTLE, visitorEarnings, ptProfit.getVisitorEarnings()
|
|
|
- , null, null, JsonUtils.toJsonString(orderPercentageDO),null, null);
|
|
|
+ log.info("{}-用户获得了团队奖: ¥{}", integralDO.getUserName(), amount);
|
|
|
}
|
|
|
|
|
|
- // 如果为当前用户为平台,则不需要存入这个地方
|
|
|
- if (!k.getUserId().equals(PT_ID)) {
|
|
|
- map.put(k.getUserId(), amount);
|
|
|
+ if (!sharePathDO.getUserId().equals(PT_ID)) {
|
|
|
+ map.put(sharePathDO.getUserId(), amount);
|
|
|
}
|
|
|
|
|
|
afterCrashMap.add(map);
|
|
|
|
|
|
- log.info(k.getNickName() + "用户合赢奖已经计算: 该用户合赢奖为: \t" +
|
|
|
- "兄弟分区为: " + brotherBuilder.build() + "\t" +
|
|
|
- "后代分区为: " + sonBuilder.build() + "\t" +
|
|
|
- "碰撞分区为: " + crashSaveReqVOBuilder.build() + "\t");
|
|
|
+ log.info("{}用户合赢奖已经计算: 该用户合赢奖为: \t兄弟分区为: {}\t后代分区为: {}\t碰撞分区为: {}\t", k.getUserName(), rightBuilder.build(), leftBuilder.build(), crashSaveReqVOBuilder.build());
|
|
|
|
|
|
- partitionSonSaveReqVOS.add(sonBuilder.build());
|
|
|
- partitionBrothersSaveReqVOS.add(brotherBuilder.build());
|
|
|
+ partitionSonSaveReqVOS.add(leftBuilder.build());
|
|
|
+ partitionBrothersSaveReqVOS.add(rightBuilder.build());
|
|
|
partitionCrashSaveReqVOS.add(crashSaveReqVOBuilder.build());
|
|
|
|
|
|
|
|
@@ -401,79 +325,7 @@ public class PartitionCrashServiceImpl implements PartitionCrashService {
|
|
|
saveBatch(partitionCrashSaveReqVOS);
|
|
|
|
|
|
// 计算平台积分
|
|
|
- // 获取当前平台的额度
|
|
|
- PtProfitDO ptProfit = ptProfitService.getPtProfit();
|
|
|
-
|
|
|
- // 遍历hashMap
|
|
|
- for (HashMap<Long, Long> longIntegerHashMap : afterCrashMap) {
|
|
|
- for (Map.Entry<Long, Long> entry : longIntegerHashMap.entrySet()) {
|
|
|
- //暂时不设限制扣减
|
|
|
-// if (ptProfit.getPtGrossAdd() <= 0) {
|
|
|
-// break;
|
|
|
-// }
|
|
|
-
|
|
|
- if (entry.getValue() == 0) {
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
- // 获取当前用户的钱包
|
|
|
- IntegralDO integralDO = integralService.selectByUser(entry.getKey());
|
|
|
- // 获取当前父亲的钱包
|
|
|
- Long highQuota = integralDO.getHighQuota() + new BigDecimal(orderPercentageDO.getBaseMaxQuota()).longValue(); //加上基础的最大额度值
|
|
|
-
|
|
|
- for (Long key : userHighQuotaMap.keySet()) {
|
|
|
- if (key.equals(entry.getKey())) {
|
|
|
- if (userHighQuotaMap.get(key) > 0L) {
|
|
|
- highQuota = highQuota + entry.getValue();
|
|
|
- userHighQuotaMap.put(key, userHighQuotaMap.get(key) - entry.getValue());
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- //amount用于记录本次添加的值
|
|
|
- Long amount = 0L;
|
|
|
- //平台需要补回的收益
|
|
|
-// Long ptReplenish = entry.getValue();
|
|
|
-
|
|
|
- //如果直推人的可获取额度大于0,则能够获取
|
|
|
- if (highQuota.compareTo(0L) > 0) {
|
|
|
- if (highQuota.compareTo(entry.getValue()) > 0) {
|
|
|
- //如果最大额度 > 直推人可获取额度,则直接获取
|
|
|
- amount = entry.getValue();
|
|
|
- //平台没有需要补回的收益
|
|
|
-// ptReplenish = 0L;
|
|
|
- } else {
|
|
|
- //如果最大额度 < 直推人可获取额度,则获取自己的最大额度
|
|
|
- amount = highQuota;
|
|
|
- //用户本次没有拿到的直推奖
|
|
|
-// ptReplenish = entry.getValue() - highQuota;
|
|
|
- }
|
|
|
-
|
|
|
- integralService.updateIntegral(BeanUtils.toBean(integralDO, IntegralSaveReqVO.class));
|
|
|
-
|
|
|
-
|
|
|
- // 扣除平台收益
|
|
|
- log.info("扣除平台收益[合赢奖] " + "用户: " + entry.getKey() + "额度: " + amount);
|
|
|
- ptProfit.setPtGrossAdd(ptProfit.getPtGrossAdd() - amount);
|
|
|
- ptIntegralDO.setCurrentQuota(ptIntegralDO.getCurrentQuota() - amount);
|
|
|
- // 平台扣除积分
|
|
|
- ptProfit.setPtTotalAdd(ptProfit.getPtTotalAdd() - amount);
|
|
|
- // 碰撞后的额度添加到日志中 增加日志模块
|
|
|
- ptProfitLogService.addMessage(entry.getKey(), CaclEnum.AFTER_CRASH_CALC_PT_TOTAL_QUOTA
|
|
|
- , -entry.getValue(), ptProfit.getPtTotalAdd(), JsonUtils.toJsonString(orderPercentageDO), null, null, null);
|
|
|
- ptProfitLogService.addMessage(entry.getKey(), CaclEnum.AFTER_CRASH_CALC_PT_TOTAL_GROSS_QUOTA
|
|
|
- , -entry.getValue(), ptProfit.getPtGrossAdd(), JsonUtils.toJsonString(orderPercentageDO), null, null, null);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- integralService.updateIntegral(BeanUtils.toBean(ptIntegralDO, IntegralSaveReqVO.class));
|
|
|
- ptProfitService.updatePtProfit(PtProfitSaveReqVO.builder().id(ptProfit.getId())
|
|
|
- .ptAdd(ptProfit.getPtAdd())
|
|
|
- .ptGrossAdd(ptProfit.getPtGrossAdd())
|
|
|
- .ptTotalAdd(ptProfit.getPtTotalAdd()).build());
|
|
|
+ ptProfitService.updatePtProfit(BeanUtils.toBean(ptProfit, PtProfitSaveReqVO.class));
|
|
|
|
|
|
// 计算平台当日的碰撞支出
|
|
|
Long sum = 0L;
|
|
@@ -544,8 +396,7 @@ public class PartitionCrashServiceImpl implements PartitionCrashService {
|
|
|
|
|
|
private PartitionBrothersSaveReqVO.PartitionBrothersSaveReqVOBuilder addBrotherEmpty(PartitionBrothersSaveReqVO.PartitionBrothersSaveReqVOBuilder brotherBuilder, DuserDO duserDO) {
|
|
|
|
|
|
- return brotherBuilder.name(duserDO.getName())
|
|
|
- .nickName(duserDO.getNickName())
|
|
|
+ return brotherBuilder.userName(duserDO.getUserName())
|
|
|
.size(0)
|
|
|
.price(0L)
|
|
|
.afterHitQuota(0L)
|
|
@@ -555,8 +406,7 @@ public class PartitionCrashServiceImpl implements PartitionCrashService {
|
|
|
private PartitionSonSaveReqVO.PartitionSonSaveReqVOBuilder addSonEmpty(
|
|
|
PartitionSonSaveReqVO.PartitionSonSaveReqVOBuilder sonBuilder,
|
|
|
DuserDO duserDO) {
|
|
|
- return sonBuilder.name(duserDO.getName())
|
|
|
- .nickName(duserDO.getNickName())
|
|
|
+ return sonBuilder.userName(duserDO.getUserName())
|
|
|
.size(0)
|
|
|
.price(0L)
|
|
|
.afterHitQuota(0L)
|