‘linchangsheng’ 2 weeks ago
parent
commit
7695868467

+ 15 - 31
src/main/java/com/gree/mall/miniapp/logic/goods/GoodsLogic.java

@@ -67,6 +67,12 @@ public class GoodsLogic {
     @Autowired
     GoodsTagRelaService goodsTagRelaService;
 
+    @Autowired
+    GoodsApplyService goodsApplyService;
+
+    @Autowired
+    GoodsApplyItemService goodsApplyItemService;
+
     /**
      * 商品列表
      *
@@ -82,47 +88,25 @@ public class GoodsLogic {
                 currentCompanyWechat.getUser().getUserId(), currentCompanyWechat.getUser().getType(),
                 keyword, categoryId,sort,null);
 
-      //  this.supplyGoodsNewBean(page,currentCompanyWechat);
+        this.supplyGoodsNewBean(page,currentCompanyWechat);
         return page;
     }
 
 
 
     public void supplyGoodsNewBean(IPage<GoodsNewBean> page, CurrentCompanyWechat currentCompanyWechat){
-        //判定上坪是否在秒杀中 在就覆盖其价格
+        //判定是否存在价格调整 在就覆盖其价格
         for (GoodsNewBean goodsNewBean : page.getRecords()) {
             if(goodsNewBean == null){
                 continue;
             }
-            SecKillActivitySpec secKillActivitySpec = secActivityStageMapper.getSecKillActivitySpecByGoodId(goodsNewBean.getGoodsId());
-            if(secKillActivitySpec != null){
-                goodsNewBean.setOrgGoodsPrice(secKillActivitySpec.getGoodsPrice());
-                goodsNewBean.setGoodsPrice(secKillActivitySpec.getPrice());
-            }
-            if(goodsNewBean.getGoodsType().equals(GoodsTypeEnum.PACKAGE.toString())){
-                goodsNewBean.setOrgGoodsPrice(goodsNewBean.getPackageMinAmount());
-                goodsNewBean.setGoodsPrice(goodsNewBean.getPackageMinAmount());
-            }
-
-        }
-
-        //补充标签
-        for (GoodsNewBean goodsNewBean : page.getRecords()) {
-            //查询上标签
-            List<GoodsTagRela> list1 = goodsTagRelaService.lambdaQuery().eq(GoodsTagRela::getGoodsId, goodsNewBean.getGoodsId())
-                    .eq(GoodsTagRela::getType,1).list();
-            if (list1.size() > 0) {
-                List<String> collect1 = list1.stream().map(GoodsTagRela::getGoodsTagName).collect(Collectors.toList());
-                goodsNewBean.setTags1(collect1);
-            }
-
-            //查询活动专区标签 //查询下标签
-            //活动商品
-            List<GoodsTagRela> list = goodsTagRelaService.lambdaQuery().eq(GoodsTagRela::getGoodsId, goodsNewBean.getGoodsId())
-                    .eq(GoodsTagRela::getType,2).list();
-            if (list.size() > 0) {
-                List<String> collect1 = list.stream().map(GoodsTagRela::getGoodsTagName).collect(Collectors.toList());
-                goodsNewBean.setTags2(collect1);
+            GoodsApply goodsApply = goodsApplyService.lambdaQuery().eq(GoodsApply::getGoodsId, goodsNewBean.getGoodsId())
+                    .eq(GoodsApply::getWebsitId, currentCompanyWechat.getUser().getWebsitId())
+                    .eq(GoodsApply::getStatus, "OK")
+                    .last("limit 1").one();
+            if(goodsApply != null){
+                goodsNewBean.setOrgGoodsPrice(goodsApply.getOrgGoodsPrice());
+                goodsNewBean.setGoodsPrice(goodsApply.getGoodsPrice());
             }
         }
     }

+ 16 - 15
src/main/java/com/gree/mall/miniapp/logic/order/OrderLogic.java

@@ -141,6 +141,9 @@ public class OrderLogic {
     @Autowired
     GoodsService goodsService;
 
+    @Autowired
+    GoodsApplyService goodsApplyService;
+
 
     /**
      * 立即购买
@@ -226,6 +229,18 @@ public class OrderLogic {
             }
             //处理库存并返回商品规格
             GoodsSpec goodsSpec = this.stock(buyGood.getGoodsSpecId(), goods.getGoodsName(), buyGood.getNum());
+
+
+            GoodsApply goodsApply = goodsApplyService.lambdaQuery().eq(GoodsApply::getGoodsId, buyGood.getGoodsId())
+                    .eq(GoodsApply::getWebsitId, currentCompanyWechat.getUser().getWebsitId())
+                    .eq(GoodsApply::getStatus, "OK")
+                    .last("limit 1").one();
+            if(goodsApply != null){
+
+            }
+
+
+
             //礼品卡商品(此处会重置规格的价格)
             Boolean isGift = this.giftGoods(userId, exchangeCode, true, goods, goodsSpec, buyGood.getNum());
             if (!hasGiftCode)
@@ -355,7 +370,7 @@ public class OrderLogic {
             throw new RemoteServiceException("订单存在“以旧换新”活动商品,只能数量“1”单品下单");
         }
         //补充网点师傅相关信息
-     //   this.supplyWorkUser(orderInfo, user);
+        this.supplyWorkUser(orderInfo, user);
 
         //实际需要支付的金额(包含运费)
         BigDecimal payAmount = totalPrice.add(totalFreight);
@@ -548,20 +563,6 @@ public class OrderLogic {
             orderInfo.setWorkerName(user.getWorkName());
             orderInfo.setWorkerPhone(user.getWorkPhone());
             orderInfo.setPosition(user.getPosition());
-        } else {
-            //非业务员那就找到业务员
-            if (StringUtils.isNotEmpty(user.getServiceId())) {
-                User workUser = userService.getById(user.getServiceId());
-                if (workUser != null) {
-                    orderInfo.setWorkerId(workUser.getWorkUserId());
-                    orderInfo.setWorkerName(workUser.getWorkName());
-                    orderInfo.setWorkerPhone(workUser.getWorkPhone());
-                    orderInfo.setPosition(workUser.getPosition());
-                    if (workUser.getCustomerServiceFlag() != null && workUser.getCustomerServiceFlag()) {
-                        orderInfo.setSource("svip邀请");
-                    }
-                }
-            }
         }
         ServiceWorkerBean serviceWorkerBean = userInfoMapper.queryWebsitByWorkId(orderInfo.getWorkerId());
         if (serviceWorkerBean != null) {