From 265a4d7ca3ee0c418a610db52fc862920140cafe Mon Sep 17 00:00:00 2001 From: 935090232@qq.com <ak473600000> Date: Sun, 21 Mar 2021 10:18:08 +0800 Subject: [PATCH] 新增积分付款模块 --- zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShoppingCartAction.java | 21 +++++++++++++-------- 1 files changed, 13 insertions(+), 8 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 91eeace..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 @@ -9,6 +9,7 @@ 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; @@ -51,7 +52,8 @@ @Autowired ShopSkuDao skuDao; - + @Autowired + OrderCouponGroupService orderCouponGroupService; @ApiOperation(value = "根据ID删除购物车", notes = "") @PostMapping("/deleteByCartId/{cartId}") @@ -69,9 +71,12 @@ @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()); @@ -119,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()); @@ -274,7 +279,7 @@ public AjaxResult updateCartAllSelected(@PathVariable("isSelected") Integer isSelected, @PathVariable("shopId") Long shopId) { BizUser user = redisUserLoginUtils.getLoginUser(BizUser.class); - shoppingCartDao.updateAllSelected(user.getOpenId(),shopId, isSelected); + shoppingCartDao.updateAllSelected(user.getOpenId(), shopId, isSelected); return new AjaxResult(AjaxResult.STATUS_SUCCESS, "修改成功"); } } -- Gitblit v1.9.1