Browse Source

修改合赢奖计算, 修改营销数据计算

gaohp 10 months ago
parent
commit
2e45b0d039
22 changed files with 322 additions and 88 deletions
  1. 18 12
      feifan-module-distri/feifan-module-distri-api/src/main/java/cn/newfeifan/mall/module/distri/enums/CaclEnum.java
  2. 7 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/duser/DuserController.java
  3. 2 2
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/ptprofit/vo/PtProfitSaveReqVO.java
  4. 2 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/duser/DuserService.java
  5. 11 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/duser/DuserServiceImpl.java
  6. 4 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/integral/IntegralService.java
  7. 7 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/integral/IntegralServiceImpl.java
  8. 61 41
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/ordercalc/OrderCalcServiceImpl.java
  9. 3 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/partitionbrothers/PartitionBrothersService.java
  10. 7 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/partitionbrothers/PartitionBrothersServiceImpl.java
  11. 90 21
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/partitioncrash/PartitionCrashServiceImpl.java
  12. 4 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/partitionson/PartitionSonService.java
  13. 8 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/partitionson/PartitionSonServiceImpl.java
  14. 31 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/tools/LoginMessageTool.java
  15. 15 11
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/controller/admin/order/TradeOrderController.java
  16. 1 0
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/dal/mysql/order/TradeOrderMapper.java
  17. 2 0
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/service/order/TradeOrderQueryService.java
  18. 6 0
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/service/order/TradeOrderQueryServiceImpl.java
  19. 33 0
      feifan-module-mall/feifan-module-trade-biz/src/main/resources/mapper/order/BrokerageUserMapper.xml
  20. 4 0
      feifan-module-member/feifan-module-member-biz/src/main/java/cn/newfeifan/mall/module/member/service/user/MemberUserService.java
  21. 5 0
      feifan-module-member/feifan-module-member-biz/src/main/java/cn/newfeifan/mall/module/member/service/user/MemberUserServiceImpl.java
  22. 1 1
      feifan-module-mp/feifan-module-mp-biz/src/main/java/cn/newfeifan/mall/module/mp/service/account/MpAccountServiceImpl.java

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

@@ -6,18 +6,19 @@ import lombok.Getter;
 @Getter
 @AllArgsConstructor
 public enum CaclEnum {
-    PLATFORM_SERVICE_FEE(1, "平台服务费"),
-    PLATFORM_REVENUE(2, "平台收益"),
-    RECOMMENDED_PERSON_QUOTA(3, "推荐人额度"),
-    DIRECT_REFERRAL_QUOTA(4, "直推人额度"),
-    TOGETHER_AWARD(5, "合赢奖"),
-    HIGH_QUOTA(6, "最高可以获得积分"),
-    SMALL_QUOTA_CRASH(7, "小区额度分配"),
-    AFTER_CRASH_CALC_PT_TOTAL_QUOTA(8, "碰撞后计算平台总收益"),
-    ORDER_PAY_INTEGRAL(9,"购物获得积分"),//购物获得冻结积分
-    ORDER_REFUND_INTEGRAL(10,"订单退款,积分退回"),
-    ORDER_INTEGRAL_UNFREEZE(11,"订单积分到账")//购物收货7天后,冻结积分变为可用积分
-    ;
+    PLATFORM_TOTAL_ADD(0, "平台总收益", "平台总收益"),
+    PLATFORM_SERVICE_FEE(1, "平台服务费", "平台服务费"),
+    PLATFORM_REVENUE(2, "平台收益", "平台收益"),
+    RECOMMENDED_PERSON_QUOTA(3, "推荐人额度", "推荐人额度"),
+    DIRECT_REFERRAL_QUOTA(4, "直推人额度", "直推人额度"),
+    TOGETHER_AWARD(5, "合赢奖", "合赢奖"),
+    HIGH_QUOTA(6, "最高可以获得积分", "最高可以获得积分"),
+    SMALL_QUOTA_CRASH(7, "小区额度分配", "小区额度分配"),
+    AFTER_CRASH_CALC_PT_TOTAL_QUOTA(8, "碰撞后计算平台总收益", "碰撞后计算平台总收益"),
+    AFTER_CRASH_CALC_PT_TOTAL_GROSS_QUOTA(9, "碰撞后计算平台收益", "碰撞后计算平台收益"),
+    ORDER_PAY_INTEGRAL(10, "购物获得积分", "购物获得冻结积分"),
+    ORDER_REFUND_INTEGRAL(11, "订单退款,积分退回", "购物收货7天后,冻结积分变为可用积分"),
+    ORDER_INTEGRAL_UNFREEZE(12, "订单积分到账", "订单积分到账");
 
     /**
      * 来源
@@ -27,5 +28,10 @@ public enum CaclEnum {
      * 类型的名字
      */
     private final String name;
+    /**
+     * 描述
+     */
+    private final String mark;
+
 
 }

+ 7 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/duser/DuserController.java

@@ -104,6 +104,13 @@ public class DuserController {
         return success(duserInfo);
     }
 
+    @GetMapping("/initDuser")
+    @Operation(summary = "初始化营销人员数据")
+    public CommonResult<DuserInfoVO> initDuser() {
+        DuserInfoVO duserInfo = duserService.initDuser();
+        return success(duserInfo);
+    }
+
 
 
 }

+ 2 - 2
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/ptprofit/vo/PtProfitSaveReqVO.java

@@ -16,10 +16,10 @@ public class PtProfitSaveReqVO {
     @Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "24754")
     private Long id;
 
-    @Schema(description = "平台收益(0.3888 之外的收益)")
+    @Schema(description = "平台服务费(毛利下的百分比收益)")
     private Integer ptAdd;
 
-    @Schema(description = "平台服务费(毛利下的百分比收益)")
+    @Schema(description = "平台收益(0.3888 之外的收益)")
     private Integer ptGrossAdd;
 
     @Schema(description = "平台总收益")

+ 2 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/duser/DuserService.java

@@ -86,4 +86,6 @@ public interface DuserService {
     List<DuserDO> getDuserByName(String name);
 
     DuserDO getDuserByMobile(String mobile);
+
+    DuserInfoVO initDuser();
 }

+ 11 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/duser/DuserServiceImpl.java

@@ -111,6 +111,16 @@ public class DuserServiceImpl implements DuserService {
         );
     }
 
+    @Override
+    public DuserInfoVO initDuser() {
+
+        List<MemberUserDO> memberUserDOS = memberUserService.getAllUser();
+        for (MemberUserDO memberUserDO : memberUserDOS) {
+            checkAndCreat(memberUserDO.getId());
+        }
+        return null;
+    }
+
     @Override
     public PageResult<DuserDO> getDuserPage(DuserPageReqVO pageReqVO) {
         return duserMapper.selectPage(pageReqVO);
@@ -184,6 +194,7 @@ public class DuserServiceImpl implements DuserService {
                     .name(user.getName())
                     .freezeQuota(0)
                     .categoryId(3L)
+                    .highQuota(0)
                     .userId(userId).build();
             Long integralId = integralService.createIntegral(integralSaveReqVO);
             integralDO = new IntegralDO().setId(integralId);

+ 4 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/integral/IntegralService.java

@@ -77,4 +77,8 @@ public interface IntegralService {
     IntegralDO selectUserParent(Long userId);
 
 
+
+    List<IntegralDO> selectAllUser();
+
+
 }

+ 7 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/integral/IntegralServiceImpl.java

@@ -112,4 +112,11 @@ public class IntegralServiceImpl implements IntegralService {
         return integralMapper.selectOne(new LambdaQueryWrapperX<IntegralDO>().eqIfPresent(IntegralDO::getUserId, parentId));
     }
 
+    @Override
+    public List<IntegralDO> selectAllUser() {
+
+        return    integralMapper.selectList();
+
+    }
+
 }

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

@@ -28,6 +28,7 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.validation.annotation.Validated;
 
 import java.math.BigDecimal;
+import java.math.BigInteger;
 import java.math.RoundingMode;
 import java.time.LocalDateTime;
 import java.util.*;
@@ -136,13 +137,10 @@ public class OrderCalcServiceImpl implements OrderCalcService {
         sharePathService.createSharePathByUserId(userId);
 
         try {
-
             OrderPercentageDO orderPercentageDO = orderPercentageService.queryStatus();
             // 当前计算百分比模板
             String percentTemplate = JsonUtils.toJsonString(orderPercentageDO);
-
             calc(tradeOrderDO, orderPercentageDO, percentTemplate);
-
         } catch (Exception e) {
 
         } finally {
@@ -154,16 +152,12 @@ public class OrderCalcServiceImpl implements OrderCalcService {
 
     @Override
     public List<OrderCalcDO> queryTodayCalcByUserIds(LocalDateTime todayStart, LocalDateTime todayEnd) {
-
-        return   orderCalcMapper.selectList(new LambdaQueryWrapperX<OrderCalcDO>().betweenIfPresent(OrderCalcDO::getCreateTime,todayStart,todayEnd));
-
+        return orderCalcMapper.selectList(new LambdaQueryWrapperX<OrderCalcDO>().betweenIfPresent(OrderCalcDO::getCreateTime, todayStart, todayEnd));
     }
 
     private void calc(List<DistriOrderMessage> tradeOrderDO, OrderPercentageDO orderPercentageDO, String percentTemplate) {
 
-        // 给用户分组
-
-
+        List<PtProfitSaveReqVO> savePFitMap = new ArrayList<>();
         // 每个订单收益
         List<OrderCalcSaveReqVO> saveList = new ArrayList<>();
         // 平台收益
@@ -175,6 +169,15 @@ public class OrderCalcServiceImpl implements OrderCalcService {
 
         // todo 修改用户身价 如何从订单中获取身价?
         List<DuserSaveReqVO> duserSaveReqVOS = new ArrayList<>();
+        BigDecimal oneHundred = new BigDecimal(BigInteger.ONE);
+
+
+        // 计算,毛利中100 之外的百分比
+        BigDecimal otherOneHundred = oneHundred.subtract(new BigDecimal(orderPercentageDO.getGrossProfitUserQuotaPerc()))
+                .subtract(new BigDecimal(orderPercentageDO.getGrossProfitAncestorQuotaPerc()))
+                .subtract(new BigDecimal(orderPercentageDO.getGrossProfitBonusQuotaPerc()))
+                .subtract(new BigDecimal(orderPercentageDO.getGrossProfitPlatformQuotaPerc()));
+
 
         PtProfitDO ptProfitDO = ptProfitService.getPtProfit();
         PtProfitDO finalPtProfitDO = ptProfitDO;
@@ -186,25 +189,32 @@ public class OrderCalcServiceImpl implements OrderCalcService {
 
             // 计算
             // 计算利润: (价格 - 成本价格) * 产品数量
-//            Integer profit = (k.getPrice() - k.getCostPrice()) * k.getProductCount();
-
             BigDecimal profit = price.subtract(costPrice).multiply(productCount);
 
+
             // 计算毛利: 利润 * 0.38
-            BigDecimal grossProfit = profit.multiply(new BigDecimal(String.valueOf(orderPercentageDO.getGrossProfitPerc()))).setScale(4, RoundingMode.DOWN);
+            BigDecimal grossProfit = profit.multiply(new BigDecimal(orderPercentageDO.getGrossProfitPerc())).setScale(4, RoundingMode.DOWN);
+
+            // 计算平台收益
+            BigDecimal grossProfitAfterBonus = profit.multiply(oneHundred.subtract(new BigDecimal(orderPercentageDO.getGrossProfitPerc()))).setScale(4, RoundingMode.DOWN);
 
-            // 计算推荐人额度: 毛利 * 0.35
+            if (otherOneHundred.compareTo(new BigDecimal(BigInteger.ZERO)) > 0) {
+                grossProfitAfterBonus.add(grossProfit.multiply(otherOneHundred).setScale(4, RoundingMode.DOWN));
+            }
+
+            // 用户所得: 毛利 * 0.35
             BigDecimal ancestorQuota = grossProfit.multiply(new BigDecimal(orderPercentageDO.getGrossProfitUserQuotaPerc())).setScale(4, RoundingMode.DOWN);
 
-            // 计算直推人额度: 毛利 * 0.35
+            // 直推奖: 毛利 * 0.35
             BigDecimal descendantQuota = grossProfit.multiply(new BigDecimal(orderPercentageDO.getGrossProfitAncestorQuotaPerc())).setScale(4, RoundingMode.DOWN);
 
-            // 计算合赢奖: 毛利 * 0.08
+            // 合赢将: 毛利 * 0.08
             BigDecimal bonusQuota = grossProfit.multiply(new BigDecimal(orderPercentageDO.getGrossProfitBonusQuotaPerc())).setScale(4, RoundingMode.DOWN);
 
-            // 计算平台收益: 毛利 * 0.22
+            // 平台服务费: 毛利 * 0.22
             BigDecimal platformQuota = grossProfit.multiply(new BigDecimal(orderPercentageDO.getGrossProfitPlatformQuotaPerc())).setScale(4, RoundingMode.DOWN);
 
+
             // 计算当前下单人的毛利的三倍
             BigDecimal highQuota = grossProfit.multiply(new BigDecimal("3")).setScale(4, RoundingMode.DOWN);
 
@@ -213,8 +223,9 @@ public class OrderCalcServiceImpl implements OrderCalcService {
             int ancestorQuotaInt = ancestorQuota.multiply(new BigDecimal("10000")).setScale(0, RoundingMode.DOWN).intValueExact();
             int descendantQuotaInt = descendantQuota.multiply(new BigDecimal("10000")).setScale(0, RoundingMode.DOWN).intValueExact();
             int bonusQuotaInt = bonusQuota.multiply(new BigDecimal("10000")).setScale(0, RoundingMode.DOWN).intValueExact();
-            int platformQuotaInt = platformQuota.multiply(new BigDecimal("10000")).setScale(0, RoundingMode.DOWN).intValueExact();
             int highQuotaInt = highQuota.multiply(new BigDecimal("10000")).setScale(0, RoundingMode.DOWN).intValueExact();
+            int grossProfitAfterBonusInt = grossProfitAfterBonus.multiply(new BigDecimal("10000")).setScale(0, RoundingMode.DOWN).intValueExact();
+            int platformQuotaInt = platformQuota.multiply(new BigDecimal("10000")).setScale(0, RoundingMode.DOWN).intValueExact();
 
 
             // 获取当前下单人关系
@@ -246,33 +257,25 @@ public class OrderCalcServiceImpl implements OrderCalcService {
             // 增加平台收益
             // 平台服务费
 
-            BigDecimal ptGrossAdd = new BigDecimal(finalPtProfitDO.getPtGrossAdd());
-            BigDecimal ptAdd = new BigDecimal(finalPtProfitDO.getPtAdd());
-            BigDecimal ptTotalAdd = new BigDecimal(finalPtProfitDO.getPtTotalAdd());
-            BigDecimal bonusQuotaPerc = new BigDecimal(orderPercentageDO.getGrossProfitPerc());
-
-            // 计算平台收益:毛利润减去合赢奖百分比后的金额
-            BigDecimal one = BigDecimal.ONE;
-            BigDecimal grossProfitAfterBonus = grossProfit.multiply(one.subtract(bonusQuotaPerc));
-            BigDecimal newPtAdd = ptAdd.add(grossProfitAfterBonus);
-            BigDecimal newPtGrossAdd = ptGrossAdd.add(platformQuota);
-
-            // 计算平台总收益
-            BigDecimal newPtTotal = ptTotalAdd.add(newPtGrossAdd).add(newPtAdd);
-
-            // 换成整数
-            int ptGrossAddInt = newPtGrossAdd.intValue();
-            int ptAddInt = newPtAdd.intValue();
-            int ptTotalInt = newPtTotal.intValue();
-
-            PtProfitSaveReqVO ptProfitSaveReqVO = PtProfitSaveReqVO.builder().ptAdd(ptAddInt).ptGrossAdd(ptGrossAddInt).ptTotalAdd(ptTotalInt).build();
+            PtProfitSaveReqVO ptProfitSaveReqVO = PtProfitSaveReqVO.builder().ptAdd(platformQuotaInt).ptGrossAdd(grossProfitAfterBonusInt).ptTotalAdd(platformQuotaInt + grossProfitAfterBonusInt).build();
             ptProfitSaveReqVOS.add(ptProfitSaveReqVO);
             // ========== 增加日志记录 =================
 
             // 平台记录
-            PtProfitLogSaveReqVO ptGrossAddLog = PtProfitLogSaveReqVO.builder().orderId(k.getOrderId()).profitStatus(CaclEnum.PLATFORM_SERVICE_FEE.getType()).orderNo(k.getNo()).amount(platformQuotaInt).afterAmount(ptProfitSaveReqVO.getPtGrossAdd()).percentTemplate(percentTemplate).build();
+            // 平台总收益
+            // 平台总收益
+            PtProfitLogSaveReqVO ptTotal = PtProfitLogSaveReqVO.builder().orderId(k.getOrderId())
+                    .profitStatus(CaclEnum.PLATFORM_TOTAL_ADD.getType()).orderNo(k.getNo())
+                    .amount(platformQuotaInt + grossProfitAfterBonusInt).afterAmount(ptProfitDO.getPtTotalAdd() + platformQuotaInt + grossProfitAfterBonusInt).percentTemplate(percentTemplate).build();
+            // 平台收益
+            PtProfitLogSaveReqVO ptGrossAddLog = PtProfitLogSaveReqVO.builder().orderId(k.getOrderId())
+                    .profitStatus(CaclEnum.PLATFORM_REVENUE.getType()).orderNo(k.getNo())
+                    .amount(grossProfitAfterBonusInt).afterAmount(ptProfitDO.getPtGrossAdd() + ptProfitSaveReqVO.getPtGrossAdd()).percentTemplate(percentTemplate).build();
 
-            PtProfitLogSaveReqVO ptAddLog = PtProfitLogSaveReqVO.builder().orderId(k.getOrderId()).profitStatus(CaclEnum.PLATFORM_REVENUE.getType()).orderNo(k.getNo()).amount(grossProfitAfterBonus.intValue()).afterAmount(ptProfitSaveReqVO.getPtAdd()).percentTemplate(percentTemplate).build();
+            // 平台服务费
+            PtProfitLogSaveReqVO ptAddLog = PtProfitLogSaveReqVO.builder().orderId(k.getOrderId())
+                    .profitStatus(CaclEnum.PLATFORM_SERVICE_FEE.getType()).orderNo(k.getNo())
+                    .amount(platformQuotaInt).afterAmount(ptProfitDO.getPtAdd() + ptProfitSaveReqVO.getPtAdd()).percentTemplate(percentTemplate).build();
 
 
             // 推荐人记录
@@ -287,6 +290,7 @@ public class OrderCalcServiceImpl implements OrderCalcService {
             PtProfitLogSaveReqVO hyjLog = PtProfitLogSaveReqVO.builder().orderId(k.getOrderId()).profitStatus(CaclEnum.TOGETHER_AWARD.getType()).orderNo(k.getNo()).amount(bonusQuotaInt).afterAmount(0).percentTemplate(percentTemplate).build();
 
 
+            ptProfitLogSaveReqVOS.add(ptTotal);
             ptProfitLogSaveReqVOS.add(ptGrossAddLog);
             ptProfitLogSaveReqVOS.add(ptAddLog);
             ptProfitLogSaveReqVOS.add(tjrLog);
@@ -299,12 +303,28 @@ public class OrderCalcServiceImpl implements OrderCalcService {
 
         // 信息整合
         // 计算平台收益
-        ptProfitDO = calcPtProfit(ptProfitDO, ptProfitSaveReqVOS);
+//        ptProfitDO = calcPtProfit(ptProfitDO, ptProfitSaveReqVOS);
 
         // 将信息存储到数据库中
         orderCalcMapper.insertBatch(BeanUtils.toBean(saveList, OrderCalcDO.class));
-        ptProfitService.updatePtProfit(BeanUtils.toBean(ptProfitDO, PtProfitSaveReqVO.class));
+
         ptProfitLogService.saveBatch(ptProfitLogSaveReqVOS);
+
+        PtProfitDO ptProfit = ptProfitService.getPtProfit();
+        // 计算总积分
+        int total = ptProfitSaveReqVOS.stream().mapToInt(PtProfitSaveReqVO::getPtTotalAdd).sum();
+        int add = ptProfitSaveReqVOS.stream().mapToInt(PtProfitSaveReqVO::getPtAdd).sum();
+        int grossAdd = ptProfitSaveReqVOS.stream().mapToInt(PtProfitSaveReqVO::getPtGrossAdd).sum();
+        ptProfit.setPtAdd(ptProfit.getPtAdd() + add);
+        ptProfit.setPtTotalAdd(ptProfit.getPtTotalAdd() + total);
+        ptProfit.setPtGrossAdd(ptProfit.getPtGrossAdd() + grossAdd);
+        PtProfitSaveReqVO ptProfitSaveReqVO = PtProfitSaveReqVO.builder()
+                .id(ptProfitDO.getId())
+                .ptTotalAdd(ptProfit.getPtTotalAdd())
+                .ptAdd(ptProfit.getPtAdd())
+                .ptGrossAdd(ptProfit.getPtGrossAdd()).build();
+        ptProfitService.updatePtProfit(ptProfitSaveReqVO);
+
     }
 
     private PtProfitDO calcPtProfit(PtProfitDO ptProfitDO, List<PtProfitSaveReqVO> ptProfitSaveReqVOS) {

+ 3 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/partitionbrothers/PartitionBrothersService.java

@@ -52,4 +52,7 @@ public interface PartitionBrothersService {
      */
     PageResult<PartitionBrothersDO> getPartitionBrothersPage(PartitionBrothersPageReqVO pageReqVO);
 
+
+    void saveBatch(List<PartitionBrothersSaveReqVO> partitionBrothersSaveReqVOS);
+
 }

+ 7 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/partitionbrothers/PartitionBrothersServiceImpl.java

@@ -71,4 +71,11 @@ public class PartitionBrothersServiceImpl implements PartitionBrothersService {
         return partitionBrothersMapper.selectPage(pageReqVO);
     }
 
+    @Override
+    public void saveBatch(List<PartitionBrothersSaveReqVO> partitionBrothersSaveReqVOS) {
+        List<PartitionBrothersDO> ptProfit = BeanUtils.toBean(partitionBrothersSaveReqVOS, PartitionBrothersDO.class);
+        partitionBrothersMapper.insertBatch(ptProfit);
+
+    }
+
 }

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

@@ -5,6 +5,8 @@ import cn.newfeifan.mall.framework.mybatis.core.query.LambdaQueryWrapperX;
 import cn.newfeifan.mall.module.distri.controller.admin.integral.vo.IntegralSaveReqVO;
 import cn.newfeifan.mall.module.distri.controller.admin.partitionbrothers.vo.PartitionBrothersSaveReqVO;
 import cn.newfeifan.mall.module.distri.controller.admin.partitionson.vo.PartitionSonSaveReqVO;
+import cn.newfeifan.mall.module.distri.controller.admin.ptprofit.vo.PtProfitSaveReqVO;
+import cn.newfeifan.mall.module.distri.controller.admin.ptprofitlog.vo.PtProfitLogSaveReqVO;
 import cn.newfeifan.mall.module.distri.dal.dataobject.duser.DuserDO;
 import cn.newfeifan.mall.module.distri.dal.dataobject.integral.IntegralDO;
 import cn.newfeifan.mall.module.distri.dal.dataobject.ordercalc.OrderCalcDO;
@@ -18,14 +20,18 @@ import cn.newfeifan.mall.module.distri.service.partitionbrothers.PartitionBrothe
 import cn.newfeifan.mall.module.distri.service.partitionson.PartitionSonService;
 import cn.newfeifan.mall.module.distri.service.ptprofit.PtProfitService;
 import cn.newfeifan.mall.module.distri.service.ptprofitlog.PtProfitLogService;
+import cn.newfeifan.mall.module.distri.tools.LoginMessageTool;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 import cn.newfeifan.mall.module.distri.service.sharepath.SharePathService;
+
 import javax.annotation.Resource;
 
 import org.springframework.validation.annotation.Validated;
 
 import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.LocalTime;
@@ -41,6 +47,7 @@ import cn.newfeifan.mall.framework.common.util.object.BeanUtils;
 import cn.newfeifan.mall.module.distri.dal.mysql.partitioncrash.PartitionCrashMapper;
 
 import static cn.newfeifan.mall.framework.common.exception.util.ServiceExceptionUtil.exception;
+import static cn.newfeifan.mall.module.distri.constant.DistriConstants.PT_ID;
 import static cn.newfeifan.mall.module.distri.enums.ErrorCodeConstants.*;
 
 /**
@@ -50,6 +57,7 @@ import static cn.newfeifan.mall.module.distri.enums.ErrorCodeConstants.*;
  */
 @Service
 @Validated
+@Slf4j
 public class PartitionCrashServiceImpl implements PartitionCrashService {
 
     @Resource
@@ -133,14 +141,33 @@ public class PartitionCrashServiceImpl implements PartitionCrashService {
         if (duserDOS.isEmpty()) {
             return;
         }
+        List<HashMap<Long, Integer>> afterCrashMap = new ArrayList<>();
         // 获取当前合赢奖百分比
         OrderPercentageDO orderPercentageDO = orderPercentageService.queryStatus();
-        List<HashMap<Long, Integer>> afterCrashMap = duserDOS.stream().map(k -> CompletableFuture.supplyAsync(() -> {
 
+        // 获取用户的钱包信息
+        List<IntegralDO> integralDOS = integralService.selectAllUser();
+        Map<Long, IntegralDO> integralDOMap = integralDOS.stream().collect(Collectors.toMap(IntegralDO::getUserId, k -> k));
+
+        // 获取当前所有用户的父亲
+        Map<Long, Long> sonAndParent = new HashMap<>();
+        List<Long> userIds = duserDOS.stream().map(DuserDO::getUserId).collect(Collectors.toList());
+        userIds.stream().map(k -> CompletableFuture.supplyAsync(() -> {
+            Long parent = sharePathService.queryParentBySonUserId(k);
+            sonAndParent.put(k, parent);
+            return parent;
+        })).collect(Collectors.toList()).stream().map(CompletableFuture::join).collect(Collectors.toList());
+
+        List<PartitionSonSaveReqVO> partitionSonSaveReqVOS = new ArrayList<>();
+        List<PartitionBrothersSaveReqVO> partitionBrothersSaveReqVOS = new ArrayList<>();
+        List<PartitionCrashSaveReqVO> partitionCrashSaveReqVOS = new ArrayList<>();
+
+        duserDOS.forEach(k -> {
             // 获取当前用户的钱包
-            IntegralDO integralDO = integralService.selectByUser(k.getUserId());
+            IntegralDO integralDO = integralDOMap.get(k.getUserId());
             // 获取当前父亲的钱包
-            IntegralDO parentIntegralDo = integralService.selectUserParent(k.getUserId());
+            Long parent = sonAndParent.get(k.getUserId());
+            IntegralDO parentIntegralDo = integralDOMap.get(parent);
 
             // 创建一个分区编号
             String todayNo = crashTodayNo(k.getUserId());
@@ -150,11 +177,13 @@ public class PartitionCrashServiceImpl implements PartitionCrashService {
             PartitionBrothersSaveReqVO.PartitionBrothersSaveReqVOBuilder brotherBuilder = 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);
 
             brotherBuilder.partNo(todayNo);
+            brotherBuilder.userId(k.getUserId());
             brotherBuilder.name(k.getName());
             brotherBuilder.nickName(k.getNickName());
             brotherBuilder.hasHit(1);
@@ -170,11 +199,10 @@ public class PartitionCrashServiceImpl implements PartitionCrashService {
                 // 插入空数据
                 sonBuilder = addSonEmpty(sonBuilder, k);
                 crashSaveReqVOBuilder.sonPrice(0);
-                partitionSonService.createPartitionSon(sonBuilder.build());
             }
             // 合计儿子分支额度
             Integer sonSumPrice = sonOrderCalcDOS.stream().mapToInt(OrderCalcDO::getGrossProfitBonusQuota).sum();
-            crashSaveReqVOBuilder.sonPrice(sonSumPrice);
+            sonBuilder.price(sonSumPrice);
 
             // 获取当前用户的兄弟分区
             List<OrderCalcDO> brothersOrderCalcDOS = sharePathService.selectBrothers(k.getUserId(), userId);
@@ -182,21 +210,22 @@ public class PartitionCrashServiceImpl implements PartitionCrashService {
                 // 插入空数据
                 brotherBuilder = addBrotherEmpty(brotherBuilder, k);
                 crashSaveReqVOBuilder.brotherPrice(0);
-                partitionBrothersService.createPartitionBrothers(brotherBuilder.build());
             }
 
             // 合并兄弟分支额度
             Integer brotherSumPrice = brothersOrderCalcDOS.stream().mapToInt(OrderCalcDO::getGrossProfitBonusQuota).sum();
-            crashSaveReqVOBuilder.brotherPrice(sonSumPrice);
+            brotherBuilder.price(brotherSumPrice);
 
 
             // 判断,昨天是否有存余的分支
             PartitionCrashDO yesterdayCrash = partitionCrashMapper.selectOne(new LambdaQueryWrapperX<PartitionCrashDO>().eqIfPresent(PartitionCrashDO::getPartNo, yesterdayNo));
             // 如果不为空, 则判断增加到哪个分支中
-            if (yesterdayCrash.getSonPrice() >= yesterdayCrash.getBrotherPrice()) {
-                sonSumPrice = sonSumPrice + yesterdayCrash.getSonPrice();
-            } else {
-                brotherSumPrice = brotherSumPrice + yesterdayCrash.getBrotherPrice();
+            if (yesterdayCrash != null) {
+                if (yesterdayCrash.getSonPrice() >= yesterdayCrash.getBrotherPrice()) {
+                    sonSumPrice = sonSumPrice + yesterdayCrash.getSonPrice();
+                } else {
+                    brotherSumPrice = brotherSumPrice + yesterdayCrash.getBrotherPrice();
+                }
             }
 
             int afterCrash = 0;
@@ -226,7 +255,7 @@ public class PartitionCrashServiceImpl implements PartitionCrashService {
             Integer parentHighQuota = parentIntegralDo.getHighQuota();
 
             BigDecimal smallBigDecimal = new BigDecimal(String.valueOf(smallQuota));
-            BigDecimal multiply = smallBigDecimal.multiply(new BigDecimal(String.valueOf(orderPercentageDO.getDivideIntoPerc())));
+            BigDecimal multiply = smallBigDecimal.divide(new BigDecimal("2.0"), 4, RoundingMode.DOWN);
             if (compare(highQuota, multiply)) {
                 Integer currentQuota = integralDO.getCurrentQuota();
                 integralDO.setCurrentQuota(currentQuota + multiply.intValue());
@@ -239,16 +268,42 @@ public class PartitionCrashServiceImpl implements PartitionCrashService {
                 parentIntegralDo.setCurrentQuota(currentQuota + multiply.intValue());
                 // 碰撞后的额度添加到日志中 增加日志模块
                 integralService.updateIntegral(BeanUtils.toBean(parentIntegralDo, IntegralSaveReqVO.class));
+                LoginMessageTool.messageSave(() -> PtProfitLogSaveReqVO.builder()
+                        .amount(currentQuota)
+                        .afterAmount(currentQuota + parentIntegralDo.getCurrentQuota())
+                        .userId(parentIntegralDo.getUserId())
+                        .percentTemplate(JsonUtils.toJsonString(orderPercentageDO))
+                        .profitStatus(CaclEnum.SMALL_QUOTA_CRASH.getType())
+                        .build());
                 ptProfitLogService.addMessage(parentIntegralDo.getUserId(), CaclEnum.SMALL_QUOTA_CRASH, currentQuota, parentIntegralDo.getCurrentQuota(), JsonUtils.toJsonString(orderPercentageDO));
             }
 
             // 获取计算后积分, Long为userId, Integer为碰撞后额度
             HashMap<Long, Integer> map = new HashMap<>();
-            map.put(k.getUserId(), multiply.intValue());
-            map.put(parentIntegralDo.getUserId(), multiply.intValue());
-            return map;
+            // 如果为当前用户为平台,则不需要存入这个地方
+            if (!k.getUserId().equals(PT_ID)){
+                map.put(k.getUserId(), multiply.intValue());
+            }
+            if (!parentIntegralDo.getUserId().equals(PT_ID)){
+                map.put(parentIntegralDo.getUserId(), multiply.intValue());
+            }
+            afterCrashMap.add(map);
+
+            log.info(k.getNickName() + "用户合赢奖已经计算: 该用户合赢奖为: \t" +
+                    "兄弟分区为: " + brotherBuilder.build() + "\t" +
+                    "后代分区为: " + sonBuilder.build() + "\t" +
+                    "碰撞分区为: " + crashSaveReqVOBuilder.build() + "\t");
+
+            partitionSonSaveReqVOS.add(sonBuilder.build());
+            partitionBrothersSaveReqVOS.add(brotherBuilder.build());
+            partitionCrashSaveReqVOS.add(crashSaveReqVOBuilder.build());
 
-        })).collect(Collectors.toList()).stream().map(CompletableFuture::join).collect(Collectors.toList());
+
+        });
+
+        partitionSonService.saveBatch(partitionSonSaveReqVOS);
+        partitionBrothersService.saveBatch(partitionBrothersSaveReqVOS);
+        saveBatch(partitionCrashSaveReqVOS);
 
         // 计算平台积分
         // 获取当前平台的额度
@@ -256,18 +311,27 @@ public class PartitionCrashServiceImpl implements PartitionCrashService {
         // 遍历hashMap
         for (HashMap<Long, Integer> longIntegerHashMap : afterCrashMap) {
             for (Map.Entry<Long, Integer> entry : longIntegerHashMap.entrySet()) {
-                if (ptProfit.getPtTotalAdd() <= 0) {
+                if (ptProfit.getPtGrossAdd() <= 0) {
                     break;
                 }
                 // 当前平台总积分
-                Integer ptTotalAdd = ptProfit.getPtTotalAdd();
+//                Integer ptTotalAdd = ptProfit.getPtTotalAdd();
+                // 扣除平台收益
+                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
-                        , ptTotalAdd, ptProfit.getPtTotalAdd() - entry.getValue(), JsonUtils.toJsonString(orderPercentageDO));
+                        , -entry.getValue(), ptProfit.getPtTotalAdd() - entry.getValue(), JsonUtils.toJsonString(orderPercentageDO));
+                ptProfitLogService.addMessage(entry.getKey(), CaclEnum.AFTER_CRASH_CALC_PT_TOTAL_GROSS_QUOTA
+                        , -entry.getValue(), ptProfit.getPtTotalAdd() - entry.getValue(), JsonUtils.toJsonString(orderPercentageDO));
             }
         }
+        ptProfitService.updatePtProfit(PtProfitSaveReqVO.builder().id(ptProfit.getId())
+                .ptAdd(ptProfit.getPtAdd())
+                .ptGrossAdd(ptProfit.getPtGrossAdd())
+                .ptTotalAdd(ptProfit.getPtTotalAdd()).build());
     }
 
     public Boolean compare(Integer highQuota, BigDecimal afterCrash) {
@@ -276,6 +340,11 @@ public class PartitionCrashServiceImpl implements PartitionCrashService {
         return i >= 0;
     }
 
+    public void saveBatch(List<PartitionCrashSaveReqVO> partitionCrashSaveReqVOS) {
+
+        List<PartitionCrashDO> ptProfit = BeanUtils.toBean(partitionCrashSaveReqVOS, PartitionCrashDO.class);
+        partitionCrashMapper.insertBatch(ptProfit);
+    }
 
     private PartitionBrothersSaveReqVO.PartitionBrothersSaveReqVOBuilder addBrotherEmpty(PartitionBrothersSaveReqVO.PartitionBrothersSaveReqVOBuilder brotherBuilder, DuserDO duserDO) {
 
@@ -303,7 +372,7 @@ public class PartitionCrashServiceImpl implements PartitionCrashService {
     public String crashTodayNo(Long userId) {
         LocalDateTime todayStart = LocalDateTime.of(LocalDate.now(), LocalTime.MIDNIGHT); // 今天的开始时间,即午夜12点
         String todayStartString = todayStart.toString();
-        return "CRASH:" + userId + todayStartString;
+        return "CRASH:" + userId + ":" + todayStartString;
 
     }
 
@@ -312,7 +381,7 @@ public class PartitionCrashServiceImpl implements PartitionCrashService {
         LocalDateTime todayStart = LocalDateTime.of(LocalDate.now(), LocalTime.MIDNIGHT); // 今天的开始时间,即午夜12点
         LocalDateTime localDateTime = todayStart.minusDays(1);
         String yesterdayString = localDateTime.toString();
-        return "CRASH:" + userId + yesterdayString;
+        return "CRASH:" + userId + ":" + yesterdayString;
 
     }
 

+ 4 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/partitionson/PartitionSonService.java

@@ -52,4 +52,8 @@ public interface PartitionSonService {
      */
     PageResult<PartitionSonDO> getPartitionSonPage(PartitionSonPageReqVO pageReqVO);
 
+
+    void saveBatch(List<PartitionSonSaveReqVO> partitionSonSaveReqVOS);
+
+
 }

+ 8 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/partitionson/PartitionSonServiceImpl.java

@@ -1,5 +1,6 @@
 package cn.newfeifan.mall.module.distri.service.partitionson;
 
+import cn.newfeifan.mall.module.distri.dal.dataobject.ptprofit.PtProfitDO;
 import org.springframework.stereotype.Service;
 import javax.annotation.Resource;
 import org.springframework.validation.annotation.Validated;
@@ -71,4 +72,11 @@ public class PartitionSonServiceImpl implements PartitionSonService {
         return partitionSonMapper.selectPage(pageReqVO);
     }
 
+    @Override
+    public void saveBatch(List<PartitionSonSaveReqVO> partitionSonSaveReqVOS) {
+        // 批量存储数据
+        List<PartitionSonDO> ptProfit = BeanUtils.toBean(partitionSonSaveReqVOS, PartitionSonDO.class);
+        partitionSonMapper.insertBatch(ptProfit);
+    }
+
 }

+ 31 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/tools/LoginMessageTool.java

@@ -0,0 +1,31 @@
+package cn.newfeifan.mall.module.distri.tools;
+
+
+import cn.newfeifan.mall.module.distri.controller.admin.ptprofitlog.vo.PtProfitLogSaveReqVO;
+import cn.newfeifan.mall.module.distri.dal.dataobject.ptprofitlog.PtProfitLogDO;
+import cn.newfeifan.mall.module.distri.enums.CaclEnum;
+import cn.newfeifan.mall.module.distri.service.ptprofitlog.PtProfitLogService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.function.Function;
+import java.util.function.Supplier;
+
+@Component
+public class LoginMessageTool {
+
+
+    private static PtProfitLogService ptProfitLogService;
+
+
+    @Autowired
+    LoginMessageTool(PtProfitLogService ptProfitLogService) {
+        LoginMessageTool.ptProfitLogService = ptProfitLogService;
+    }
+
+    public static void messageSave(Supplier<PtProfitLogSaveReqVO> createProfitLogFunction) {
+        PtProfitLogSaveReqVO ptProfitLogSaveReqVO = createProfitLogFunction.get();
+        ptProfitLogService.createPtProfitLog(ptProfitLogSaveReqVO);
+    }
+
+}

+ 15 - 11
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/controller/admin/order/TradeOrderController.java

@@ -220,24 +220,15 @@ public class TradeOrderController {
     public CommonResult<Map<Integer, Long>> getOrderCountByUser(@RequestParam(value = "userId", required = false) Long userId) {
         Map<Integer, Long> orderCount = Maps.newLinkedHashMapWithExpectedSize(6);
 
-        orderCount.put(-1, tradeOrderQueryService.getOrderCount(null,userId));
+        orderCount.put(-1, tradeOrderQueryService.getOrderCount(null, userId));
         orderCount.put(TradeOrderStatusEnum.UNPAID.getStatus(), tradeOrderQueryService.getOrderCount(TradeOrderStatusEnum.UNPAID.getStatus(), userId));
-        orderCount.put(TradeOrderStatusEnum.UNDELIVERED.getStatus(), tradeOrderQueryService.getOrderCount(TradeOrderStatusEnum.UNDELIVERED.getStatus(),userId));
+        orderCount.put(TradeOrderStatusEnum.UNDELIVERED.getStatus(), tradeOrderQueryService.getOrderCount(TradeOrderStatusEnum.UNDELIVERED.getStatus(), userId));
         orderCount.put(TradeOrderStatusEnum.DELIVERED.getStatus(), tradeOrderQueryService.getOrderCount(TradeOrderStatusEnum.DELIVERED.getStatus(), userId));
         orderCount.put(TradeOrderStatusEnum.COMPLETED.getStatus(), tradeOrderQueryService.getOrderCount(TradeOrderStatusEnum.COMPLETED.getStatus(), userId));
         orderCount.put(TradeOrderStatusEnum.CANCELED.getStatus(), tradeOrderQueryService.getOrderCount(TradeOrderStatusEnum.CANCELED.getStatus(), userId));
         return success(orderCount);
     }
 
-    @GetMapping("/startCalc")
-    @Operation(summary = "计算启动")
-    public CommonResult<String> startCalc() {
-        List<DistriOrderMessage> appTradeOrderDetailRespVos = tradeOrderQueryService.queryAllOrder();
-        CalcMessage calcMessage = CalcMessage.builder().distriOrderMessages(appTradeOrderDetailRespVos).build();
-        distriOrderProducer.sendDistriOrderMessage(calcMessage);
-        return success("success");
-    }
-
 
     @GetMapping("/pay/page")
     @Operation(summary = "获得支付订单分页")
@@ -258,4 +249,17 @@ public class TradeOrderController {
     }
 
 
+    @GetMapping("/startCalc")
+    @Operation(summary = "计算启动")
+    public CommonResult<String> startCalc(@RequestParam("orderIds") List<Long> orderIds) {
+//        List<DistriOrderMessage> appTradeOrderDetailRespVos = tradeOrderQueryService.queryAllOrder();
+        List<DistriOrderMessage> appTradeOrderDetailRespVos = tradeOrderQueryService.queryAllOrder(orderIds);
+        CalcMessage calcMessage = CalcMessage.builder().distriOrderMessages(appTradeOrderDetailRespVos).build();
+        distriOrderProducer.sendDistriOrderMessage(calcMessage);
+        return success("success");
+    }
+
+
+
+
 }

+ 1 - 0
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/dal/mysql/order/TradeOrderMapper.java

@@ -153,4 +153,5 @@ public interface TradeOrderMapper extends BaseMapperX<TradeOrderDO> {
 
     List<DistriOrderMessage> queryAllOrder(@Param("start") LocalDateTime start, @Param("end") LocalDateTime end);
 
+    List<DistriOrderMessage> queryAllOrderByOrderIds(@Param("orderIds") List<Long> orderIds);
 }

+ 2 - 0
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/service/order/TradeOrderQueryService.java

@@ -213,6 +213,8 @@ public interface TradeOrderQueryService {
      */
     List<DistriOrderMessage> queryAllOrder();
 
+    List<DistriOrderMessage> queryAllOrder(List<Long> orderIds);
+
     /**
      * 获取店铺信息
      * @return 店铺商户

+ 6 - 0
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/service/order/TradeOrderQueryServiceImpl.java

@@ -269,6 +269,12 @@ public class TradeOrderQueryServiceImpl implements TradeOrderQueryService {
 
     }
 
+    @Override
+    public List<DistriOrderMessage> queryAllOrder(List<Long> orderIds) {
+        // 根据orderIds获取订单
+        return tradeOrderMapper.queryAllOrderByOrderIds(orderIds);
+    }
+
 
     @Override
     public ShopBO getShop() {

+ 33 - 0
feifan-module-mall/feifan-module-trade-biz/src/main/resources/mapper/order/BrokerageUserMapper.xml

@@ -40,4 +40,37 @@
                            on toi.sku_id = ps.id
         where  tor.update_time BETWEEN #{start} AND #{end}
     </select>
+    <select id="queryAllOrderByOrderIds"
+            resultMap="BaseResultMap">
+        select tor.total_price as totalPrice,
+        ps.cost_price as costPrice,
+        ps.price as price,
+        tor.product_count as productCount,
+        tor.`no` as `no`,
+        tor.id as orderId,
+        tor.user_id as userId,
+        ps.merchant_id as merchantId,
+        ps.shop_id as shopId,
+        ps.shop_id as shopId,
+        mu.`name` as name,
+        mu.nickname as nickname
+        from trade_order tor
+        LEFT JOIN member_user mu
+        ON tor.user_id = mu.id
+        LEFT JOIN trade_order_item toi
+        on tor.id = toi.order_id
+        LEFT JOIN product_sku ps
+        on toi.sku_id = ps.id
+        <where>
+            tor.pay_status = 1
+            <if test="orderIds!=null">
+                and tor.id in (
+                <foreach collection="orderIds" item="orderId" separator=",">
+                    #{orderId}
+                </foreach>
+                )
+            </if>
+        </where>
+
+    </select>
 </mapper>

+ 4 - 0
feifan-module-member/feifan-module-member-biz/src/main/java/cn/newfeifan/mall/module/member/service/user/MemberUserService.java

@@ -187,4 +187,8 @@ public interface MemberUserService {
      */
     boolean updateUserPoint(Long userId, Integer point);
 
+
+    List<MemberUserDO> getAllUser();
+
+
 }

+ 5 - 0
feifan-module-member/feifan-module-member-biz/src/main/java/cn/newfeifan/mall/module/member/service/user/MemberUserServiceImpl.java

@@ -314,4 +314,9 @@ public class MemberUserServiceImpl implements MemberUserService {
         return true;
     }
 
+    @Override
+    public List<MemberUserDO> getAllUser() {
+        return memberUserMapper.selectList();
+    }
+
 }

+ 1 - 1
feifan-module-mp/feifan-module-mp-biz/src/main/java/cn/newfeifan/mall/module/mp/service/account/MpAccountServiceImpl.java

@@ -76,7 +76,7 @@ public class MpAccountServiceImpl implements MpAccountService {
                 if (!ex.getMessage().contains("doesn't exist")) {
                     throw ex;
                 }
-                log.error("[微信公众号 feifan-module-mp - 表结构未导入][参考 https://doc.iocoder.cn/mp/build/ 开启]");
+                log.error("[微信公众号 feifan-module-mp - 表结构未导入]");
             }
             log.info("[initLocalCacheIfUpdate][缓存公众号账号,数量为:{}]", accounts.size());