Ver código fonte

Merge remote-tracking branch 'origin/master'

Ben 5 meses atrás
pai
commit
69600603f4

+ 3 - 3
feifan-module-distri/feifan-module-distri-api/src/main/java/cn/newfeifan/mall/module/distri/enums/CaclEnum.java

@@ -9,13 +9,13 @@ public enum CaclEnum {
     PLATFORM_TOTAL_ADD(0, "平台总收益", "平台总收益"),
     PLATFORM_SERVICE_FEE(1, "平台服务费", "平台服务费"),
     PLATFORM_REVENUE(2, "平台收益", "平台收益"),
-    RECOMMENDED_PERSON_QUOTA(3, "直推奖额度", "直推奖额度"),
+    RECOMMENDED_PERSON_QUOTA(3, "直推奖获得", "直推奖额度"),
     DIRECT_REFERRAL_QUOTA(4, "用户自得额度", "用户自得额度"),
     TOGETHER_AWARD(5, "合赢奖", "合赢奖"),
     HIGH_QUOTA(6, "最高可以获得积分", "最高可以获得积分"),
-    SMALL_QUOTA_CRASH(7, "小区额度分配", "小区额度分配"),
+    SMALL_QUOTA_CRASH(7, "合赢奖获得", "小区额度分配"),
     AFTER_CRASH_CALC_PT_TOTAL_QUOTA(8, "碰撞后计算平台总收益", "碰撞后计算平台总收益"),
-    ORDER_PAY_INTEGRAL(9, "购物获得积分", "购物获得冻结积分"),
+    ORDER_PAY_INTEGRAL(9, "购物获得冻结积分", "购物获得冻结积分"),
     ORDER_REFUND_INTEGRAL(10, "订单退款,积分退回", "购物收货7天后,冻结积分变为可用积分"),
     ORDER_INTEGRAL_UNFREEZE(11, "订单积分到账", "订单积分到账"),
     AFTER_CRASH_CALC_PT_TOTAL_GROSS_QUOTA(12, "碰撞后计算平台收益", "碰撞后计算平台收益"),

+ 0 - 1
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/dal/mysql/ptprofitlog/PtProfitLogMapper.java

@@ -27,7 +27,6 @@ public interface PtProfitLogMapper extends BaseMapperX<PtProfitLogDO> {
         List<Integer> profitStatus = Arrays.asList(
                 RECOMMENDED_PERSON_QUOTA.getType(),
                 DIRECT_REFERRAL_QUOTA.getType(),
-                HIGH_QUOTA.getType(),
                 ORDER_PAY_INTEGRAL.getType(),
                 FREEZE_CHANGE_INTEGRAL.getType(),
                 SMALL_QUOTA_CRASH.getType()

+ 4 - 11
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/ordercalc/OrderCalcServiceImpl.java

@@ -373,11 +373,13 @@ public class OrderCalcServiceImpl implements OrderCalcService {
                     .amount(amount)
                     .afterAmount(integralDOAncestor.getCurrentQuota())
                     .ancestorQuotaAmount(ptReplenish)
+                    .maxAvailablePointsAmount(-amount)
+                    .afterMaxAvailablePointsAmount(ancestorHighQuota - amount)
                     .percentTemplate(percentTemplate)
                     .build();
 
 
-            // 用户自得记录+户冻结积分转化成可用记录
+            // 用户自得记录 + 户冻结积分转化成可用 + 扣减最高可用额度记录
             PtProfitLogSaveReqVO ztrLog = PtProfitLogSaveReqVO.builder()
                     .orderId(k.getOrderId())
                     .profitStatus(CaclEnum.DIRECT_REFERRAL_QUOTA.getType())
@@ -385,16 +387,8 @@ public class OrderCalcServiceImpl implements OrderCalcService {
                     .userId(sharePath.getDescendant())
                     .amount(descendantQuotaInt)
                     .afterAmount(integralDO.getCurrentQuota() + descendantQuotaInt)
-                    .freezeAmount(descendantQuotaInt)
+                    .freezeAmount(-descendantQuotaInt)
                     .afterFreezeAmount(integralDO.getFreezeQuota())
-                    .percentTemplate(percentTemplate)
-                    .build();
-
-            PtProfitLogSaveReqVO highQuotaLog = PtProfitLogSaveReqVO.builder()
-                    .orderId(k.getOrderId())
-                    .profitStatus(CaclEnum.HIGH_QUOTA.getType())
-                    .orderNo(k.getNo())
-                    .userId(sharePath.getDescendant())
                     .maxAvailablePointsAmount(highQuotaInt)
                     .afterMaxAvailablePointsAmount(integralDO.getHighQuota())
                     .percentTemplate(percentTemplate)
@@ -416,7 +410,6 @@ public class OrderCalcServiceImpl implements OrderCalcService {
             ptProfitLogSaveReqVOS.add(tjrLog);
             ptProfitLogSaveReqVOS.add(ztrLog);
             ptProfitLogSaveReqVOS.add(hyjLog);
-            ptProfitLogSaveReqVOS.add(highQuotaLog);
 
 
         });

+ 7 - 44
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/partitioncrash/PartitionCrashServiceImpl.java

@@ -293,7 +293,7 @@ public class PartitionCrashServiceImpl implements PartitionCrashService {
                     // 碰撞后的额度添加到日志中 增加日志模块
                     integralService.updateIntegral(BeanUtils.toBean(integralDO, IntegralSaveReqVO.class));
                     ptProfitLogService.addMessage(k.getUserId(), CaclEnum.SMALL_QUOTA_CRASH, amount,
-                            integralDO.getCurrentQuota(), JsonUtils.toJsonString(orderPercentageDO), ptReplenish);
+                            integralDO.getCurrentQuota(), JsonUtils.toJsonString(orderPercentageDO), ptReplenish,-amount,highQuota - amount);
                 }
 
                 //直推人的上级的本次添加积分
@@ -320,31 +320,9 @@ public class PartitionCrashServiceImpl implements PartitionCrashService {
                     // 碰撞后的额度添加到日志中 增加日志模块
                     integralService.updateIntegral(BeanUtils.toBean(parentIntegralDo, IntegralSaveReqVO.class));
                     ptProfitLogService.addMessage(parentIntegralDo.getUserId(), CaclEnum.SMALL_QUOTA_CRASH, parentAmount,
-                            parentIntegralDo.getCurrentQuota(), JsonUtils.toJsonString(orderPercentageDO), parentPtReplenish);
+                            parentIntegralDo.getCurrentQuota(), JsonUtils.toJsonString(orderPercentageDO), parentPtReplenish,-parentAmount,parentHighQuota - parentAmount);
                 }
-//                if (compare(highQuota, multiply) && multiply.longValue() != 0) {
-//                    integralDO.setCurrentQuota(integralDO.getCurrentQuota() + multiply.intValue());
-//                    integralDO.setHighQuota(integralDO.getHighQuota() - multiply.intValue());
-//
-//                    addHighQuota(userHighQuotaMap, integralDO.getUserId(), (long) multiply.intValue());
-//
-//                    integralDO.setAccumulatedQuota(integralDO.getAccumulatedQuota() + multiply.intValue());
-//                    // 碰撞后的额度添加到日志中 增加日志模块
-//                    integralService.updateIntegral(BeanUtils.toBean(integralDO, IntegralSaveReqVO.class));
-//                    ptProfitLogService.addMessage(k.getUserId(), CaclEnum.SMALL_QUOTA_CRASH, Long.parseLong(String.valueOf(multiply.intValue())), integralDO.getCurrentQuota(), JsonUtils.toJsonString(orderPercentageDO));
-//                }
-//                if (compare(parentHighQuota, multiply) && multiply.longValue() != 0) {
-//                    // 减去最高额度
-//                    parentIntegralDo.setCurrentQuota(parentIntegralDo.getCurrentQuota() + multiply.intValue());
-//                    parentIntegralDo.setHighQuota(parentIntegralDo.getHighQuota() - multiply.intValue());
-//
-//                    addHighQuota(userHighQuotaMap, parentIntegralDo.getUserId(), (long) multiply.intValue());
-//
-//                    parentIntegralDo.setAccumulatedQuota(parentIntegralDo.getAccumulatedQuota() + multiply.intValue());
-//                    // 碰撞后的额度添加到日志中 增加日志模块
-//                    integralService.updateIntegral(BeanUtils.toBean(parentIntegralDo, IntegralSaveReqVO.class));
-//                    ptProfitLogService.addMessage(parentIntegralDo.getUserId(), CaclEnum.SMALL_QUOTA_CRASH, Long.parseLong(String.valueOf(multiply.intValue())), parentIntegralDo.getCurrentQuota(), JsonUtils.toJsonString(orderPercentageDO));
-//                }
+
                 if (!ptReplenish.equals(0L)) {
                     calcIntegral(ptReplenish, integralDO.getUserId(), JsonUtils.toJsonString(orderPercentageDO));
                 }
@@ -440,25 +418,10 @@ public class PartitionCrashServiceImpl implements PartitionCrashService {
                     ptProfit.setPtTotalAdd(ptProfit.getPtTotalAdd() - amount);
                     // 碰撞后的额度添加到日志中 增加日志模块
                     ptProfitLogService.addMessage(entry.getKey(), CaclEnum.AFTER_CRASH_CALC_PT_TOTAL_QUOTA
-                            , -entry.getValue(), ptProfit.getPtTotalAdd(), JsonUtils.toJsonString(orderPercentageDO), null);
+                            , -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);
+                            , -entry.getValue(), ptProfit.getPtGrossAdd(), JsonUtils.toJsonString(orderPercentageDO), null,null,null);
                 }
-//                if (highQuota.compareTo(0L) > 0) {
-//                    integralService.updateIntegral(BeanUtils.toBean(integralDO, IntegralSaveReqVO.class));
-//
-//
-//                    // 扣除平台收益
-//                    log.info("扣除平台收益[合赢奖] " + "用户 " + entry.getKey() + "额度: " + entry.getValue());
-//                    ptProfit.setPtGrossAdd(ptProfit.getPtGrossAdd() - entry.getValue());
-//                    // 平台扣除积分
-//                    ptProfit.setPtTotalAdd(ptProfit.getPtTotalAdd() - entry.getValue());
-//                    // 碰撞后的额度添加到日志中 增加日志模块
-//                    ptProfitLogService.addMessage(entry.getKey(), CaclEnum.AFTER_CRASH_CALC_PT_TOTAL_QUOTA
-//                            , -entry.getValue(), ptProfit.getPtTotalAdd(), JsonUtils.toJsonString(orderPercentageDO),null);
-//                    ptProfitLogService.addMessage(entry.getKey(), CaclEnum.AFTER_CRASH_CALC_PT_TOTAL_GROSS_QUOTA
-//                            , -entry.getValue(), ptProfit.getPtTotalAdd(), JsonUtils.toJsonString(orderPercentageDO),null);
-//                }
             }
         }
         ptProfitService.updatePtProfit(PtProfitSaveReqVO.builder().id(ptProfit.getId())
@@ -492,8 +455,8 @@ public class PartitionCrashServiceImpl implements PartitionCrashService {
 
     private void calcIntegral(Long multiply, Long userId, String jsonString) {
         PtProfitDO ptProfit = ptProfitService.getPtProfit();
-        ptProfitLogService.addMessage(null, CaclEnum.GROSS_PROFIT_BONUS_QUOTA_PERC_EXCEED_MAXIMUM_LIMIT, multiply,
-                ptProfit.getPtTotalAdd(), jsonString, userId);
+        ptProfitLogService.addMessage(userId, CaclEnum.GROSS_PROFIT_BONUS_QUOTA_PERC_EXCEED_MAXIMUM_LIMIT, multiply,
+                ptProfit.getPtTotalAdd(), jsonString, null,null,null);
     }
 
     private void createPtProfitDailyStatisticsLog(Long sum) {

+ 1 - 1
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/ptprofitlog/PtProfitLogService.java

@@ -65,7 +65,7 @@ public interface PtProfitLogService {
      * @param jsonString  百分比计算模板
      * @param accumulatedQuotAmount  合赢奖溢出
      */
-    void addMessage(Long userId, CaclEnum caclEnum, Long amount, Long afterAmount, String jsonString,Long accumulatedQuotAmount);
+    void addMessage(Long userId, CaclEnum caclEnum, Long amount, Long afterAmount, String jsonString,Long accumulatedQuotAmount, Long maxAvailablePointsAmount ,Long afterMaxAvailablePointsAmount);
     void addMessage(Long userId, CaclEnum caclEnum, Integer amount, Integer afterAmount);
 
     /**

+ 3 - 1
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/ptprofitlog/PtProfitLogServiceImpl.java

@@ -89,7 +89,7 @@ public class PtProfitLogServiceImpl implements PtProfitLogService {
     }
 
     @Override
-    public void addMessage(Long userId, CaclEnum caclEnum, Long amount, Long afterAmount, String percentTemplate,Long accumulatedQuotAmount) {
+    public void addMessage(Long userId, CaclEnum caclEnum, Long amount, Long afterAmount, String percentTemplate,Long accumulatedQuotAmount, Long maxAvailablePointsAmount ,Long afterMaxAvailablePointsAmount) {
         PtProfitLogSaveReqVO ptProfitLog = PtProfitLogSaveReqVO.builder()
                 .afterAmount(afterAmount)
                 .amount(amount)
@@ -97,6 +97,8 @@ public class PtProfitLogServiceImpl implements PtProfitLogService {
                 .userId(userId)
                 .profitStatus(caclEnum.getType())
                 .accumulatedQuotaAmount(accumulatedQuotAmount)
+                .maxAvailablePointsAmount(maxAvailablePointsAmount)
+                .afterMaxAvailablePointsAmount(afterMaxAvailablePointsAmount)
                 .build();
         ptProfitLogMapper.insert(BeanUtils.toBean(ptProfitLog, PtProfitLogDO.class));
         // todo 发送通知