From 5d43370b99a03391c9271d04d3f351f0fd734dae Mon Sep 17 00:00:00 2001
From: 935090232@qq.com <ak473600000>
Date: Thu, 18 Mar 2021 20:23:02 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/score_shop' into score_shop

---
 zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShoppingCartAction.java |   60 ++++++++++++++++++++++++++----------------------------------
 1 files changed, 26 insertions(+), 34 deletions(-)

diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShoppingCartAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShoppingCartAction.java
index 1afabd6..051afbe 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShoppingCartAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShoppingCartAction.java
@@ -1,25 +1,25 @@
 package com.matrix.system.shopXcx.api.action;
 
+import com.matrix.biz.bean.BizUser;
+import com.matrix.component.redis.RedisUserLoginUtils;
 import com.matrix.core.constance.SystemErrorCode;
 import com.matrix.core.constance.SystemMessageCode;
 import com.matrix.core.exception.GlobleException;
 import com.matrix.core.pojo.AjaxResult;
 import com.matrix.core.tools.StringUtils;
-import com.matrix.biz.bean.BizUser;
-import com.matrix.component.redis.RedisUserLoginUtils;
 import com.matrix.system.common.constance.AppConstance;
-
-import com.matrix.system.shopXcx.bean.ShopShoppingCart;
-import com.matrix.system.shopXcx.bean.ShopSku;
-import com.matrix.system.shopXcx.dao.ShopShoppingCartDao;
-import com.matrix.system.shopXcx.dao.ShopSkuDao;
 import com.matrix.system.shopXcx.api.service.ShoppingCartService;
 import com.matrix.system.shopXcx.api.service.WxShopCouponService;
 import com.matrix.system.shopXcx.api.vo.ShopCartBillVo;
 import com.matrix.system.shopXcx.api.vo.ShopCartVo;
+import com.matrix.system.shopXcx.bean.ShopShoppingCart;
+import com.matrix.system.shopXcx.bean.ShopSku;
+import com.matrix.system.shopXcx.dao.ShopShoppingCartDao;
+import com.matrix.system.shopXcx.dao.ShopSkuDao;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 import org.apache.commons.collections.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.HashMap;
@@ -32,7 +32,8 @@
  * @date 2019-06-12 19:15
  */
 @CrossOrigin(origins = "*", maxAge = 3600)
-@Controller
+@Api(tags = "购物车类")
+@RestController
 @RequestMapping(value = "wxapi/ShoppingCart")
 public class WxShoppingCartAction {
     @Autowired
@@ -50,12 +51,8 @@
     ShopSkuDao skuDao;
 
 
-    /**
-     * 根据ID删除购物车
-     *
-     * @param
-     * @return
-     */
+
+    @ApiOperation(value = "根据ID删除购物车", notes = "")
     @PostMapping("/deleteByCartId/{cartId}")
     @ResponseBody
     public AjaxResult deleteByCartId(@PathVariable("cartId") Integer cartId) {
@@ -66,16 +63,12 @@
         return new AjaxResult(AjaxResult.STATUS_SUCCESS, "删除成功");
     }
 
-    /**
-     * 根据用户ID查询购物车 没有分页
-     *
-     * @param
-     * @return
-     */
+
+    @ApiOperation(value = "根据用户ID查询购物车 没有分页", notes = "")
     @PostMapping("/findShoppingCart")
     @ResponseBody
     public AjaxResult getShoppingCartByUserId(@RequestBody ShopShoppingCart shoppingCart) {
-        List<ShopCartVo> cartList = shoppingCartService.findUserCartList(shoppingCart.getShopId());
+        List<ShopCartVo> cartList = shoppingCartService.findUserCartList(shoppingCart.getShopId(),ShopShoppingCart.CAR_TYPE_MICRO);
         AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, cartList, cartList.size());
         ShopCartBillVo shopCartBill = shoppingCartService.buildShopCartBillVo(cartList);
         result.putInMap("billTotal", shopCartBill.getBillTotal().stripTrailingZeros().toPlainString());
@@ -86,9 +79,8 @@
         return result;
     }
 
-    /**
-     * 批量删除
-     */
+
+    @ApiOperation(value = "批量删除", notes = "")
     @PostMapping(value = "/delShoppingCart/{keys}")
     public
     @ResponseBody
@@ -102,12 +94,13 @@
         }
     }
 
-    @PostMapping(value = "/getUserCartCount/{shopId}")
+    @ApiOperation(value = "查询微商城购物车数量", notes = "")
+    @PostMapping(value = "/getUserCartCount/{shopId}/{cartType}")
     public
     @ResponseBody
-    AjaxResult getUserCartCount(@PathVariable("shopId") Long shopId) {
+    AjaxResult getUserCartCount(@PathVariable("shopId") Long shopId,@PathVariable("cartType") Integer cartType) {
         BizUser loginUser = redisUserLoginUtils.getLoginUser(BizUser.class);
-        Integer userCartCount = shoppingCartDao.selectUserCartCount(shopId, loginUser.getOpenId());
+        Integer userCartCount = shoppingCartDao.selectUserCartCount(shopId, loginUser.getOpenId(),cartType);
         if (userCartCount == null) {
             userCartCount = 0;
         }
@@ -194,7 +187,7 @@
             return new AjaxResult(AjaxResult.STATUS_FAIL, "保存失败");
         }
         int userCartCount = shoppingCartDao.selectUserCartCount(shoppingCart.getShopId(),
-                loginUser.getOpenId());
+                loginUser.getOpenId(),shoppingCart.getCartType());
         AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, "保存成功");
         result.putInMap("userCartCount", userCartCount);
         return result;
@@ -258,7 +251,7 @@
      * @param
      * @return
      */
-    @RequestMapping("/updateCartSelected")
+    @PostMapping("/updateCartSelected")
     @ResponseBody
     public AjaxResult updateCartSelected(@RequestBody ShopShoppingCart shoppingCart) {
         Map<String, Object> modifyMap = new HashMap<>();
@@ -274,13 +267,12 @@
      * @param
      * @return
      */
-    @RequestMapping("/updateCartAllSelected/{shopId}/{isSelected}")
+    @PostMapping("/updateCartAllSelected/{shopId}/{isSelected}/{cartType}")
     @ResponseBody
     public AjaxResult updateCartAllSelected(@PathVariable("isSelected") Integer isSelected,
-                                            @PathVariable("shopId") Long shopId) {
-        Map<String, Object> modifyMap = new HashMap<>();
+                                            @PathVariable("shopId") Long shopId,@PathVariable("cartType") Integer cartType) {
         BizUser user = redisUserLoginUtils.getLoginUser(BizUser.class);
-        shoppingCartDao.updateAllSelected(user.getOpenId(),shopId, isSelected);
+        shoppingCartDao.updateAllSelected(user.getOpenId(),shopId, isSelected,cartType);
         return new AjaxResult(AjaxResult.STATUS_SUCCESS, "修改成功");
     }
 }

--
Gitblit v1.9.1