From d20a4aade6f9ed5111b496ac9abdff9f05f81535 Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期三, 15 一月 2025 22:32:02 +0800
Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/qijisheng

---
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java |   40 ++++++++++++++++++++--------------------
 1 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java
index 38932d5..d621963 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java
@@ -6,10 +6,7 @@
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.account.api.feignClient.AppUserClient;
-import com.ruoyi.account.api.feignClient.BalanceChangeRecordClient;
-import com.ruoyi.account.api.feignClient.UserCouponClient;
-import com.ruoyi.account.api.feignClient.UserPointClient;
+import com.ruoyi.account.api.feignClient.*;
 import com.ruoyi.account.api.model.*;
 import com.ruoyi.common.core.domain.R;
 import com.ruoyi.common.core.exception.ServiceException;
@@ -89,9 +86,6 @@
     private UserPointClient userPointClient;
     
     @Resource
-    private PointSettingClient pointSettingClient;
-    
-    @Resource
     private OrderBalancePaymentService orderBalancePaymentService;
     
     @Resource
@@ -115,6 +109,9 @@
 
     @Resource
     private UserCouponClient userCouponClient;
+    
+    @Resource
+    private UserChangeLogClient userChangeLogClient;
     
     
 
@@ -205,7 +202,7 @@
         if(StringUtils.isNotEmpty(order.getExpressResult())){
             MapTrackKD100Vo mapTrackKD100Vo = JSON.parseObject(order.getExpressResult(), MapTrackKD100Vo.class);
             List<QueryKD100ListVo> data = mapTrackKD100Vo.getData();
-            orderDetailVO.setExpress(data.size() > 0 ? data.get(0).getContext() : "");
+            orderDetailVO.setExpress(null != data && data.size() > 0 ? data.get(0).getContext() : "");
         }
         
         if(order.getOrderType() == 1){
@@ -286,6 +283,7 @@
         if(StringUtils.isNotEmpty(technicianId) && !"null".equals(technicianId)){
             order.setTechnicianId(Integer.valueOf(technicianId));
         }
+        // TODO
         orderMapper.updateById(order);
     }
     
@@ -518,11 +516,6 @@
             }
             appUser.setTotalPoint(appUser.getTotalPoint() - shopPoint);
 
-            boolean vipDemotion = vipDemotion(appUser.getShopPoint(), appUser.getVipId());
-            if(vipDemotion){
-                appUser.setVipId(appUser.getVipId() - 1);
-            }
-
             //构建积分流水明细
             UserPoint userPoint = new UserPoint();
             userPoint.setType(1);
@@ -534,6 +527,12 @@
             userPoint.setObjectId(order.getId());
             userPointClient.saveUserPoint(userPoint);
             appUserClient.editAppUserById(appUser);
+    
+            //降级检测
+            boolean vipDemotion = vipDemotion(appUser.getShopPoint(), appUser.getVipId());
+            if(vipDemotion){
+                appUserClient.vipDemotion(appUser.getId());
+            }
             //回退优惠券状态
             if(null != order.getUserCouponId()){
                 UserCoupon userCoupon = userCouponClient.getUserCoupon(order.getUserCouponId()).getData();
@@ -650,11 +649,6 @@
         }
         appUser.setTotalPoint(appUser.getTotalPoint() - shopPoint);
 
-        boolean vipDemotion = vipDemotion(appUser.getShopPoint(), appUser.getVipId());
-        if(vipDemotion){
-            appUser.setVipId(appUser.getVipId() - 1);
-        }
-
         //构建积分流水明细
         UserPoint userPoint = new UserPoint();
         userPoint.setType(1);
@@ -666,6 +660,12 @@
         userPoint.setObjectId(order.getId());
         userPointClient.saveUserPoint(userPoint);
         appUserClient.editAppUserById(appUser);
+    
+        //降级检测
+        boolean vipDemotion = vipDemotion(appUser.getShopPoint(), appUser.getVipId());
+        if(vipDemotion){
+            appUserClient.vipDemotion(appUser.getId());
+        }
 
         //回退优惠券状态
         if(null != order.getUserCouponId()){
@@ -853,8 +853,8 @@
      * @return
      */
     @Override
-    public Integer getGoodsSaleNum(Integer goodsId, Integer type) {
-        return this.baseMapper.getGoodsSaleNum(goodsId, type);
+    public Integer getGoodsSaleNum(Integer goodsId, Integer type, Long userId) {
+        return this.baseMapper.getGoodsSaleNum(goodsId, type, userId);
     }
 
 

--
Gitblit v1.7.1