浏览代码

Merge branch 'master' of http://git.zonelife.cn:3000/fubojin/smqjh

zhangxin 3 周之前
父节点
当前提交
542d9fbf80

+ 2 - 1
yami-shop-api/src/main/java/com/yami/shop/api/controller/OrderController.java

@@ -78,7 +78,8 @@ public class OrderController {
     @ApiOperation(value = "结算,生成订单信息", notes = "传入下单所需要的参数进行下单")
     public ResponseEntity<ShopCartOrderMergerDto> confirm(@Valid @RequestBody OrderParam orderParam) {
         if (orderParam.getShopId() == null){
-            throw new GlobalException("请选择店铺!");
+            orderParam.setShopId(1L);
+//            throw new GlobalException("请选择店铺!");
         }
         String userId = SecurityUtils.getUser().getUserId();
 

+ 4 - 4
yami-shop-api/src/main/java/com/yami/shop/api/controller/ProdCommController.java

@@ -19,6 +19,7 @@ import com.yami.shop.bean.model.Order;
 import com.yami.shop.bean.model.ProdComm;
 import com.yami.shop.common.exception.GlobalException;
 import com.yami.shop.common.util.PageParam;
+import com.yami.shop.security.api.util.SecurityUtils;
 import com.yami.shop.service.OrderService;
 import com.yami.shop.service.ProdCommService;
 import io.swagger.annotations.Api;
@@ -33,8 +34,8 @@ import java.util.Map;
 import java.util.Objects;
 
 @RestController
-//@RequestMapping("/p/prodComm")
-@RequestMapping("/prodComm")
+@RequestMapping("/p/prodComm")
+//@RequestMapping("/prodComm")
 @Api(tags = "评论接口")
 @AllArgsConstructor
 public class ProdCommController {
@@ -81,7 +82,6 @@ public class ProdCommController {
     @GetMapping("/myCommList")
     @ApiOperation(value = "小程序-我的评价")
     public ResponseEntity<IPage<ProdComm>> myCommList(PageParam<ProdComm> page) {
-        //return ResponseEntity.ok(prodCommService.myCommList(page, SecurityUtils.getUser().getUserId()));
-        return ResponseEntity.ok(prodCommService.myCommList(page, "ecf5703f3e284f7fa0845244be4018fc"));
+        return ResponseEntity.ok(prodCommService.myCommList(page, SecurityUtils.getUser().getUserId()));
     }
 }

+ 2 - 2
yami-shop-api/src/main/java/com/yami/shop/api/controller/SkuController.java

@@ -51,10 +51,10 @@ public class SkuController {
 
     @GetMapping("/buyTogetherOften")
     @ApiOperation(value = "商品详情-经常一起买")
-    public ResponseEntity<IPage<SkuBuyTogetherOftenVo>> buyTogetherOften(PageParam<SkuBuyTogetherOftenVo> page, Long prodId,Long shopId,Long channelId) {
+    public ResponseEntity<IPage<SkuBuyTogetherOftenVo>> buyTogetherOften(PageParam<SkuBuyTogetherOftenVo> page, Long prodId,Long shopId,Long channelId,String userId) {
         shopId = shopId == null ? 1 : shopId;
         channelId = channelId == null ? 1 : channelId;
-        return ResponseEntity.ok(skuService.buyTogetherOften(page,prodId,shopId,channelId));
+        return ResponseEntity.ok(skuService.buyTogetherOften(page,prodId,shopId,channelId,userId));
     }
 
 }

+ 3 - 0
yami-shop-bean/src/main/java/com/yami/shop/bean/vo/SkuBuyTogetherOftenVo.java

@@ -30,4 +30,7 @@ public class SkuBuyTogetherOftenVo {
     private String price;
     @ApiModelProperty("库存")
     private Integer shopSkuStocks;
+    @ApiModelProperty("购物车数量")
+    private Integer prodCount;
+
 }

+ 3 - 1
yami-shop-service/src/main/java/com/yami/shop/dao/SkuMapper.java

@@ -54,5 +54,7 @@ public interface SkuMapper extends BaseMapper<Sku> {
 
     IPage<SkuBuyTogetherOftenVo> buyTogetherOften(@Param("page") PageParam<SkuBuyTogetherOftenVo> page,
                                                   @Param("prodId") Long prodId, @Param("shopId") Long shopId,
-                                                  @Param("channelId") Long channelId);
+                                                  @Param("channelId") Long channelId,
+                                                  @Param("userId") String userId
+    );
 }

+ 1 - 1
yami-shop-service/src/main/java/com/yami/shop/service/SkuService.java

@@ -65,5 +65,5 @@ public interface SkuService extends IService<Sku> {
 
     void removeSkuCacheBySkuId(Long skuId, Long prodId);
 
-    IPage<SkuBuyTogetherOftenVo> buyTogetherOften(PageParam<SkuBuyTogetherOftenVo> page, Long prodId,Long shopId,Long channelId);
+    IPage<SkuBuyTogetherOftenVo> buyTogetherOften(PageParam<SkuBuyTogetherOftenVo> page, Long prodId,Long shopId,Long channelId,String userId);
 }

+ 2 - 2
yami-shop-service/src/main/java/com/yami/shop/service/impl/SkuServiceImpl.java

@@ -68,7 +68,7 @@ public class SkuServiceImpl extends ServiceImpl<SkuMapper, Sku> implements SkuSe
     }
 
     @Override
-    public IPage<SkuBuyTogetherOftenVo> buyTogetherOften(PageParam<SkuBuyTogetherOftenVo> page, Long prodId,Long shopId,Long channelId) {
-        return skuMapper.buyTogetherOften(page, prodId,shopId,channelId);
+    public IPage<SkuBuyTogetherOftenVo> buyTogetherOften(PageParam<SkuBuyTogetherOftenVo> page, Long prodId,Long shopId,Long channelId,String userId) {
+        return skuMapper.buyTogetherOften(page, prodId,shopId,channelId,userId);
     }
 }

+ 2 - 1
yami-shop-service/src/main/resources/mapper/SkuMapper.xml

@@ -181,11 +181,12 @@
     </update>
 
     <select id="buyTogetherOften" resultType="com.yami.shop.bean.vo.SkuBuyTogetherOftenVo">
-        SELECT a.shop_id,b.sku_id, b.prod_id, b.prod_name, b.pic, c.channel_prod_price, d.shop_sku_stocks
+        SELECT a.shop_id,b.sku_id, b.prod_id, b.prod_name, b.pic, c.channel_prod_price, d.shop_sku_stocks,IFNULL(e.basket_count,0) prodCount
         FROM tz_order_item a
                  LEFT JOIN tz_sku b on a.sku_id = b.sku_id
                  LEFT JOIN tz_channel_prod c on a.sku_id = c.sku_id and c.is_delete = 0
                  LEFT JOIN tz_shop_sku d on a.sku_id = d.sku_id and d.is_delete = 0
+                 LEFT JOIN tz_basket e on a.prod_id=e.prod_id and a.sku_id=e.sku_id and a.shop_id=e.shop_id and e.user_id=#{userId}
         WHERE a.order_number in (SELECT a.order_number FROM tz_order_item a
                                  LEFT JOIN tz_order b on a.order_number=b.order_number
                                  WHERE a.prod_id = #{prodId} and a.shop_id = #{shopId} and b.channel_id=#{channelId})