From d49c4335300c06504760c1bf02f3320da98964ae Mon Sep 17 00:00:00 2001
From: 935090232@qq.com <ak473600000>
Date: Thu, 01 Apr 2021 10:00:07 +0800
Subject: [PATCH] 积分
---
zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShoppingCartAction.java | 50 ++++++++++++++++++++++++--------------------------
1 files changed, 24 insertions(+), 26 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 e01efca..4508e1c 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
@@ -8,6 +8,8 @@
import com.matrix.core.pojo.AjaxResult;
import com.matrix.core.tools.StringUtils;
import com.matrix.system.common.constance.AppConstance;
+import com.matrix.system.common.interceptor.HostInterceptor;
+import com.matrix.system.shopXcx.api.service.OrderCouponGroupService;
import com.matrix.system.shopXcx.api.service.ShoppingCartService;
import com.matrix.system.shopXcx.api.service.WxShopCouponService;
import com.matrix.system.shopXcx.api.vo.ShopCartBillVo;
@@ -17,6 +19,7 @@
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.web.bind.annotation.*;
@@ -49,13 +52,10 @@
@Autowired
ShopSkuDao skuDao;
+ @Autowired
+ OrderCouponGroupService orderCouponGroupService;
- /**
- * 根据ID删除购物车
- *
- * @param
- * @return
- */
+ @ApiOperation(value = "根据ID删除购物车", notes = "")
@PostMapping("/deleteByCartId/{cartId}")
@ResponseBody
public AjaxResult deleteByCartId(@PathVariable("cartId") Integer cartId) {
@@ -66,18 +66,17 @@
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(),ShopShoppingCart.CAR_TYPE_MICRO);
- AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, cartList, cartList.size());
- ShopCartBillVo shopCartBill = shoppingCartService.buildShopCartBillVo(cartList);
+ BizUser loginUser = redisUserLoginUtils.getLoginUser(BizUser.class);
+ String userId = loginUser.getOpenId();
+ List<ShopShoppingCart> list = shoppingCartDao.selectByCartUserId(shoppingCart.getShopId(),userId);
+ List<ShopCartVo> shopCartVoList = shoppingCartService.buildShopCart(list);
+ AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, shopCartVoList, shopCartVoList.size());
+ ShopCartBillVo shopCartBill = shoppingCartService.buildShopCartBillVo(shopCartVoList);
result.putInMap("billTotal", shopCartBill.getBillTotal().stripTrailingZeros().toPlainString());
result.putInMap("selectCount", shopCartBill.getSelectCount());
result.putInMap("cartCount", shopCartBill.getCartCount());
@@ -86,9 +85,8 @@
return result;
}
- /**
- * 批量删除
- */
+
+ @ApiOperation(value = "批量删除", notes = "")
@PostMapping(value = "/delShoppingCart/{keys}")
public
@ResponseBody
@@ -102,6 +100,7 @@
}
}
+ @ApiOperation(value = "查询微商城购物车数量", notes = "")
@PostMapping(value = "/getUserCartCount/{shopId}")
public
@ResponseBody
@@ -125,9 +124,9 @@
AjaxResult saveShoppingCart(@RequestBody ShopShoppingCart shoppingCart) {
//查询到sku设置对应的产品id
- ShopSku sku= skuDao.selectById(shoppingCart.getCartSkuId());
- if(sku==null){
- return new AjaxResult(AjaxResult.STATUS_FAIL,"无效的产品id");
+ ShopSku sku = skuDao.selectById(shoppingCart.getCartSkuId());
+ if (sku == null) {
+ return new AjaxResult(AjaxResult.STATUS_FAIL, "无效的产品id");
}
shoppingCart.setCartProductId(sku.getpId());
@@ -136,7 +135,7 @@
shoppingCart.setCreateBy(loginUser.getOpenId());
shoppingCart.setUpdateBy(loginUser.getOpenId());
shoppingCart.setCartUserId(loginUser.getOpenId());
- shoppingCart.setCartType(ShopShoppingCart.CAR_TYPE_MICRO);
+ shoppingCart.setCompanyId(HostInterceptor.getCompanyId());
ShopShoppingCart shoppCartLimt = shoppingCartDao.selectBuyLimit(shoppingCart.getCartProductId(),
shoppingCart.getCartSkuId());
// Integer buyLimitNum = 0;
@@ -275,13 +274,12 @@
* @param
* @return
*/
- @PostMapping("/updateCartAllSelected/{shopId}/{isSelected}/{cartType}")
+ @PostMapping("/updateCartAllSelected/{shopId}/{isSelected}")
@ResponseBody
public AjaxResult updateCartAllSelected(@PathVariable("isSelected") Integer isSelected,
- @PathVariable("shopId") Long shopId,@PathVariable("cartType") Integer cartType) {
- Map<String, Object> modifyMap = new HashMap<>();
+ @PathVariable("shopId") Long shopId) {
BizUser user = redisUserLoginUtils.getLoginUser(BizUser.class);
- shoppingCartDao.updateAllSelected(user.getOpenId(),shopId, isSelected,cartType);
+ shoppingCartDao.updateAllSelected(user.getOpenId(), shopId, isSelected);
return new AjaxResult(AjaxResult.STATUS_SUCCESS, "修改成功");
}
}
--
Gitblit v1.9.1