Browse Source

更新pt充值

Yangzw 1 month ago
parent
commit
1c24fdd7f5

+ 1 - 1
feifan-module-distri/feifan-module-distri-api/src/main/java/cn/newfeifan/mall/module/distri/enums/IntegralEnum.java

@@ -21,7 +21,7 @@ public enum IntegralEnum {
     RECOMMENDED_PERSON_QUOTA(11, "直推奖获得"),           //直推奖获得可用积分
     ORDER_CANCEL_BY_USER_REFUND_INTEGRAL(12,"手动取消支付返回"),
     BUY_ORDER(13,"用户下单"),
-    ORDER_SETTLEMENT(14,"订单收货,价格结算"),
+    ORDER_SETTLEMENT(14,"订单结算"),
     TEAM_BONUS(15,"团队奖"),
     LUCKY_BONUS(16,"幸运奖"),
     ;

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

@@ -217,6 +217,10 @@ public class DailyAwardRecordsServiceImpl implements DailyAwardRecordsService {
                 peopleNumber = 20;
             }
 
+            if(user.getUserId().equals(376L)){
+                System.out.println("376");
+            }
+
             // 获取到当前用户的所有下层用户
             List<Long> userIds = sharePathService.getUserIds(user.getUserId(), user.getDepth() + peopleNumber);
 

+ 18 - 7
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/integraltopuplog/IntegralTopUpLogServiceImpl.java

@@ -2,12 +2,15 @@ package cn.newfeifan.mall.module.distri.service.integraltopuplog;
 
 import cn.newfeifan.mall.framework.common.exception.ErrorCode;
 import cn.newfeifan.mall.module.distri.constant.DistriConstants;
+import cn.newfeifan.mall.module.distri.controller.admin.duser.vo.DuserSaveReqVO;
 import cn.newfeifan.mall.module.distri.controller.admin.integralchangelog.vo.IntegralChangeLogSaveReqVO;
 import cn.newfeifan.mall.module.distri.controller.admin.integral.vo.IntegralSaveReqVO;
+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.orderpercentage.OrderPercentageDO;
 import cn.newfeifan.mall.module.distri.enums.IntegralEnum;
 import cn.newfeifan.mall.module.distri.enums.IntegralTypeEnum;
+import cn.newfeifan.mall.module.distri.service.duser.DuserService;
 import cn.newfeifan.mall.module.distri.service.integralchangelog.IntegralChangeLogService;
 import cn.newfeifan.mall.module.distri.service.integral.IntegralService;
 import cn.newfeifan.mall.module.distri.service.orderpercentage.OrderPercentageService;
@@ -51,10 +54,14 @@ public class IntegralTopUpLogServiceImpl implements IntegralTopUpLogService {
 
     @Resource
     private IntegralChangeLogService integralChangeLogService;
+    @Resource
+    private DuserService duserService;
 
     @Override
     @Transactional(rollbackFor = Exception.class)
     public Long createConsumptionTopUpLog(IntegralTopUpLogSaveReqVO createReqVO) {
+        // 充值的额度
+        Long agentQuota = createReqVO.getIntegralPoints();
         OrderPercentageDO orderPercentageDO = orderPercentageService.queryStatus();
         // 充值额度校验
         quotaVerify(createReqVO.getUserId(), createReqVO.getIntegralPoints(), orderPercentageDO);
@@ -62,6 +69,9 @@ public class IntegralTopUpLogServiceImpl implements IntegralTopUpLogService {
         // 额度放大百万倍,存储需要(方便换算),和积分一样
         createReqVO.setIntegralPoints(createReqVO.getIntegralPoints() * DistriConstants.MILLION);
 
+        // 获取用户的会员类别信息
+        DuserDO user = duserService.getDuserByUser(createReqVO.getUserId());
+
         // 充值倍率
         if (createReqVO.getIntegralPoints() >= Long.parseLong(orderPercentageDO.getTriggerMagnificationPoints()) * DistriConstants.MILLION) {
             createReqVO.setPracticalIntegralPoints((long) (createReqVO.getIntegralPoints() * Double.parseDouble(orderPercentageDO.getIntegralMagnification())));
@@ -81,11 +91,11 @@ public class IntegralTopUpLogServiceImpl implements IntegralTopUpLogService {
         // 记录用户消费分变动日志
         integralChangeLogService.createConsumptionChangeLog(IntegralChangeLogSaveReqVO.builder()
                 .userId(consumptionTopUpLog.getUserId())
-                .integralPoints(consumptionTopUpLog.getPracticalIntegralPoints())
+                .integralPoints(consumptionTopUpLog.getIntegralPoints())
                 .afterIntegralPoints(integralDO.getRedCurrentQuota())
                 .integralStatus(IntegralEnum.PT_TOP_TUP.getType())
                 .integralType(IntegralTypeEnum.RED_INTEGRAL.getType())
-                .practicalIntegralPoints(consumptionTopUpLog.getIntegralPoints())
+                .practicalIntegralPoints(consumptionTopUpLog.getPracticalIntegralPoints())
                 .generateUserId(getLoginUserId())
                 .build());
 
@@ -97,11 +107,12 @@ public class IntegralTopUpLogServiceImpl implements IntegralTopUpLogService {
 //                .createIp(getClientIP())
 //                .build());
 
-//        // 当单笔充值大于设定金额时,将用户设置为代理商
-//        if(agentQuota >= Long.parseLong(orderPercentageDO.getAgentQuota()) && !user.getAgent()){
-//            user.setAgent(true);
-//            memberUserService.updateUser(BeanUtils.toBean(user, MemberUserUpdateReqVO.class));
-//        }
+
+        // 当单笔充值大于设定金额时,将用户设置为代理商
+        if(agentQuota >= Long.parseLong(orderPercentageDO.getTriggerMagnificationPoints()) && user.getCategoryId() != 3){
+            user.setCategoryId(3);
+            duserService.updateDuser(BeanUtils.toBean(user, DuserSaveReqVO.class));
+        }
 
         // 返回
         return consumptionTopUpLog.getId();

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

@@ -308,7 +308,7 @@ public class ShopSettlementServiceImpl implements ShopSettlementService {
                     .tradeOrderId(orderId)
                     .build()));
             // 更新订单的状态,将所有的订单状态更新为已完成
-            shopSettlementMapper.updateOrderById(orderIds);
+//            shopSettlementMapper.updateOrderById(orderIds);
 
             // 插入订单项结算信息(订单项二级)
             List<Long> orderItemIds = shopOrderItemIds.get(shopSett.getShopId());