Procházet zdrojové kódy

新增特殊商品退货提示

JiangChongBo před 2 roky
rodič
revize
010e92eaa5

+ 4 - 0
src/main/java/com/caimei365/order/mapper/CartClubMapper.java

@@ -108,4 +108,8 @@ public interface CartClubMapper {
     Integer getClubTypeById(Integer userId);
 
     void deleteCartSku(@Param("userId") Integer userId, @Param("oldSkuId") Integer oldSkuId);
+
+
+    String getHelpContent(Integer helpId);
+
 }

+ 9 - 0
src/main/java/com/caimei365/order/model/vo/CartShopVo.java

@@ -69,4 +69,13 @@ public class CartShopVo implements Serializable {
      * 商品分帐号
      */
     private String splitCode;
+
+    /**
+     * 能否退货  1 能 2不能
+     */
+    private Integer returnGoodsStutas;
+    /**
+     * 特殊商品退货须知提示  (取后台帮助中心id1040的数据)
+     */
+    private String  helpContent;
 }

+ 57 - 0
src/main/java/com/caimei365/order/service/impl/CartClubServiceImpl.java

@@ -910,12 +910,22 @@ public class CartClubServiceImpl implements CartClubService {
         if (firstSize != shopList.size()) {
             shopList = cartClubMapper.getCartShopsByProductIds(userId, skuIdList, 2);
         }
+        String helpContent=null;
+        boolean flag=false;
         if (null != shopList && shopList.size() > 0) {
             // 遍历供应商列表
             List<String> finalIdList = skuIdList;//购物车商品skuId列表
             Integer finalUserIdentity = userIdentity;
             Integer finalUserClubType = userClubType;
             Integer finalUserIdentity1 = userIdentity;
+            for (int i=0;i<shopList.size();i++) {
+                //订单中存在不能退货的商品则给出不能退货提示
+                if(null!=shopList.get(i).getReturnGoodsStutas()&&shopList.get(i).getReturnGoodsStutas()==2){
+                    flag=true;
+                    helpContent = cartClubMapper.getHelpContent(1040);
+                    break;
+                }
+            }
             shopList.forEach(shop -> {
                 if (null != shop) {
                     // 该供应商下商品种类
@@ -1200,6 +1210,13 @@ public class CartClubServiceImpl implements CartClubService {
         resultData.put("userBeans", userBeans);
         resultData.put("includeRecharge", includeRecharge);
         resultData.put("couponList", couponList);
+        if(flag){
+            resultData.put("returnGoodsStutas", 2);
+            resultData.put("helpContent", helpContent);
+        }else{
+            resultData.put("returnGoodsStutas", 1);
+            resultData.put("helpContent", null);
+        }
         return ResponseJson.success(resultData);
     }
 
@@ -1278,12 +1295,22 @@ public class CartClubServiceImpl implements CartClubService {
         // 商品的供应商列表
         List<CartShopVo> shopList = cartClubMapper.getShopsByProductIds(productIdList);
         //按供应商分类统计商品
+        String helpContent=null;
+        boolean flag=false;
         if (null != shopList && shopList.size() > 0) {
             // 遍历供应商列表
             List<Integer> finalIdList = skuIdList;//商品id列表
             Integer finalUserIdentity = userIdentity;
             Integer finalUserClubType = userClubType;
             Integer finalUserIdentity1 = userIdentity;
+            for (int i=0;i<shopList.size();i++) {
+                //订单中存在不能退货的商品则给出不能退货提示
+                if(null!=shopList.get(i).getReturnGoodsStutas()&&shopList.get(i).getReturnGoodsStutas()==2){
+                     flag=true;
+                     helpContent = cartClubMapper.getHelpContent(1040);
+                     break;
+                }
+            }
             shopList.forEach(shop -> {
                 if (null != shop) {
                     // 该供应商下商品种类
@@ -1568,6 +1595,13 @@ public class CartClubServiceImpl implements CartClubService {
         resultData.put("userBeans", userBeans);
         resultData.put("includeRecharge", includeRecharge);
         resultData.put("couponList", couponList);
+        if(flag){
+            resultData.put("returnGoodsStutas", 2);
+            resultData.put("helpContent", helpContent);
+        }else{
+            resultData.put("returnGoodsStutas", 1);
+            resultData.put("helpContent", null);
+        }
         return ResponseJson.success(resultData);
     }
 
@@ -1804,6 +1838,22 @@ public class CartClubServiceImpl implements CartClubService {
         Integer userBeans = baseMapper.getUserBeans(cartDto.getUserId());
         // 获取用户可用优惠券
         List<CouponVo> couponList = getUserCartCoupons(cartList, cartDto.getSource(), cartDto.getUserId());
+        //订单中存在不能退货的商品则给出不能退货提示
+                boolean flag=false;
+                String helpContent=null;
+                if(null!=shopList&&shopList.size()>0){
+                    for (CartShopVo so:shopList) {
+                        List<CartItemVo> carList = so.getCartList();
+                        if(null!=carList&&carList.size()>0){
+                            for (CartItemVo op:carList) {
+                                if(null!=op.getReturnGoodsStutas()&&op.getReturnGoodsStutas()==2){
+                                    flag=true;
+                                    helpContent=op.getHelpContent();
+                                }
+                            }
+                        }
+                    }
+                }
         // 包装返回数据
         Map<String, Object> resultData = new HashMap<>();
         resultData.put("list", shopList);
@@ -1819,6 +1869,13 @@ public class CartClubServiceImpl implements CartClubService {
         resultData.put("includeRecharge", includeRecharge);
         resultData.put("promotions", totalPromotions);
         resultData.put("couponList", couponList);
+        if(flag){
+            resultData.put("returnGoodsStutas", 2);
+            resultData.put("helpContent", helpContent);
+        }else{
+            resultData.put("returnGoodsStutas", 1);
+            resultData.put("helpContent", null);
+        }
         return ResponseJson.success(resultData);
     }
 

+ 23 - 1
src/main/java/com/caimei365/order/service/impl/OrderClubServiceImpl.java

@@ -274,7 +274,22 @@ public class OrderClubServiceImpl implements OrderClubService {
         }
         // 收货地址
         OrderUserinfoVo userInfo = addressMapper.getOrderUserinfo(orderId);
-
+        //订单中存在不能退货的商品则给出不能退货提示
+        boolean flag=false;
+        String helpContent=null;
+        if(null!=shopOrderList&&shopOrderList.size()>0){
+            for (ShopOrderVo so:shopOrderList) {
+                List<OrderProductVo> orderProductList = so.getOrderProductList();
+                if(null!=orderProductList&&orderProductList.size()>0){
+                    for (OrderProductVo op:orderProductList) {
+                        if(null!=op.getReturnGoodsStutas()&&op.getReturnGoodsStutas()==2){
+                            flag=true;
+                            helpContent=op.getHelpContent();
+                        }
+                    }
+                }
+            }
+        }
         Map<String, Object> map = new HashMap<>();
         map.put("order", order);
         map.put("shopOrderList", shopOrderList);
@@ -284,6 +299,13 @@ public class OrderClubServiceImpl implements OrderClubService {
         map.put("discernReceiptList", discernReceiptList);
         map.put("returnedPurchaseList", returnedPurchaseList);
         map.put("clause", clause);
+        if(flag){
+            map.put("returnGoodsStutas", 2);
+            map.put("helpContent", helpContent);
+        }else{
+            map.put("returnGoodsStutas", 1);
+            map.put("helpContent", null);
+        }
         return ResponseJson.success(map);
     }
 

+ 6 - 0
src/main/resources/mapper/CartClubMapper.xml

@@ -18,6 +18,7 @@
         c.shopID AS shopId,
         s.name AS shopName,
         s.logo AS shopLogo,
+        p.returnGoodsStutas,
         s.shopType as shopType
         <if test="status!=null and status == 1">
             ,p.splitCode
@@ -39,6 +40,7 @@
         s.shopID AS shopId,
         s.name AS shopName,
         s.logo AS shopLogo,
+        p.returnGoodsStutas,
         p.productType
         FROM shop s
         LEFT JOIN product p ON p.shopID = s.shopID
@@ -332,4 +334,8 @@
         FROM club
         WHERE userID = #{userId}
     </select>
+
+    <select id="getHelpContent" resultType="java.lang.String">
+        select content from helppage where helpPageID=#{helpId}
+    </select>
 </mapper>