瀏覽代碼

Merge remote-tracking branch 'origin/master'

liweifan 2 年之前
父節點
當前提交
48aa52f597

+ 1 - 0
cooleshow-mall/mall-admin/src/main/java/com/yonge/cooleshow/admin/service/impl/PmsProductServiceImpl.java

@@ -200,6 +200,7 @@ public class PmsProductServiceImpl implements PmsProductService {
         //修改sku
         if(CollUtil.isNotEmpty(updateSkuList)){
             for (PmsSkuStock pmsSkuStock : updateSkuList) {
+                pmsSkuStock.setLockStock(null);
                 skuStockMapper.updateByPrimaryKeySelective(pmsSkuStock);
             }
         }

+ 39 - 1
cooleshow-mall/mall-portal/src/main/java/com/yonge/cooleshow/portal/controller/PmsPortalProductController.java

@@ -2,18 +2,26 @@ package com.yonge.cooleshow.portal.controller;
 
 import com.yonge.cooleshow.mall.common.api.CommonPage;
 import com.yonge.cooleshow.mall.common.api.CommonResult;
+import com.yonge.cooleshow.mbg.mapper.OmsCartItemMapper;
+import com.yonge.cooleshow.mbg.model.OmsCartItem;
+import com.yonge.cooleshow.mbg.model.OmsCartItemExample;
 import com.yonge.cooleshow.mbg.model.PmsProduct;
+import com.yonge.cooleshow.mbg.model.PmsSkuStock;
 import com.yonge.cooleshow.portal.domain.PmsPortalProductDetail;
 import com.yonge.cooleshow.portal.dto.ProductSearch;
 import com.yonge.cooleshow.portal.dto.ProductSearchConditionVo;
 import com.yonge.cooleshow.portal.service.PmsPortalProductService;
+import com.yonge.cooleshow.portal.service.UmsMemberService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
+import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * 前台商品管理Controller
@@ -23,10 +31,14 @@ import java.util.List;
 @Api(tags = "PmsPortalProductController 前台商品管理")
 @RequestMapping("/product")
 public class PmsPortalProductController {
-
+    @Autowired
+    private UmsMemberService umsMemberService;
     @Autowired
     private PmsPortalProductService portalProductService;
 
+    @Autowired
+    private OmsCartItemMapper omsCartItemMapper;
+
     @ApiOperation(value = "综合搜索、筛选、排序")
     @RequestMapping(value = "/search", method = RequestMethod.POST)
     @ResponseBody
@@ -51,4 +63,30 @@ public class PmsPortalProductController {
         PmsPortalProductDetail productDetail = portalProductService.detail(id);
         return CommonResult.success(productDetail);
     }
+
+
+    @ApiOperation("购物车数量")
+    @RequestMapping(value = "/cart/{id}", method = RequestMethod.GET)
+    @ResponseBody
+    public CommonResult cart(@PathVariable Long id) {
+        try {
+            OmsCartItemExample omsCartItemExample = new OmsCartItemExample();
+            omsCartItemExample.createCriteria().andProductSkuIdEqualTo(id)
+                              .andHiddenEqualTo(0)
+                              .andDeleteStatusEqualTo(0)
+                              .andMemberIdEqualTo(umsMemberService.getCurrentMember().getId());
+            List<OmsCartItem> omsCartItems = omsCartItemMapper.selectByExample(omsCartItemExample);
+            if (CollectionUtils.isEmpty(omsCartItems)) {
+                return CommonResult.success(0);
+            } else {
+                return CommonResult.success(omsCartItems.get(0).getQuantity());
+
+            }
+        }catch (Exception e) {
+            return CommonResult.success(0);
+        }
+
+
+
+    }
 }

+ 1 - 1
cooleshow-mall/mall-portal/src/main/java/com/yonge/cooleshow/portal/service/impl/OmsCartItemServiceImpl.java

@@ -91,7 +91,7 @@ public class OmsCartItemServiceImpl implements OmsCartItemService {
                 throw new BizException("库存不足");
             }
             cartItem.setModifyDate(new Date());
-            existCartItem.setQuantity(existCartItem.getQuantity() + cartItem.getQuantity());
+            existCartItem.setQuantity(cartItem.getQuantity());
             cartItemMapper.updateByPrimaryKey(existCartItem);
         }
         return existCartItem;

+ 1 - 1
cooleshow-user/user-biz/src/main/resources/config/mybatis/SysMessageMapper.xml

@@ -197,7 +197,7 @@
 
 	<select id="queryCountOfUnread" resultMap="Mapper" parameterType="map">
 		SELECT group_ key_,COUNT(*) value_ FROM sys_message
-		WHERE user_id_ = #{userId} AND read_status_ = 0 and status_ = 2
+		WHERE user_id_ = #{userId} AND read_status_ = 0
 		AND (client_id_ = #{jpushType} OR client_id_ IS NULL)  and send_time_ &lt;= now()
 		<if test="type != null">
 		and type_ = #{type}