Explorar el Código

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

zhangxin hace 3 semanas
padre
commit
04894b245b

+ 1 - 0
yami-shop-api/src/main/java/com/yami/shop/api/ApiApplication.java

@@ -26,6 +26,7 @@ public class ApiApplication extends SpringBootServletInitializer{
 
 	public static void main(String[] args) {
         SpringApplication.run(ApiApplication.class, args);
+        System.out.println("swagger文档:http://localhost:8112/doc.html");
 	}
 	
 	@Override

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

@@ -65,14 +65,14 @@ public class ProdCommController {
 
     @GetMapping("/commList")
     @ApiOperation(value = "商品详情-查看商品评价(0好评 1中评 2差评 3有图)")
-    public ResponseEntity<IPage<ProdComm>> commList(PageParam<ProdComm> page, Long skuId,Long shopId, Integer commStatus) {
-        return ResponseEntity.ok(prodCommService.commList(page,skuId,shopId,commStatus));
+    public ResponseEntity<IPage<ProdComm>> commList(PageParam<ProdComm> page, Long skuId,Long shopId, Integer commStatus,Long channelId) {
+        return ResponseEntity.ok(prodCommService.commList(page,skuId,shopId,commStatus,channelId));
     }
 
     @GetMapping("/commentCount")
     @ApiOperation(value = "商品详情-评价数量-好评率")
-    public ResponseEntity<Map<String, Object>> commentCount(Long skuId,Long shopId) {
-        return ResponseEntity.ok(prodCommService.commentCount(skuId,shopId));
+    public ResponseEntity<Map<String, Object>> commentCount(Long skuId,Long shopId,Long channelId) {
+        return ResponseEntity.ok(prodCommService.commentCount(skuId,shopId,channelId));
     }
 
     @GetMapping("/myCommList")

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

@@ -20,6 +20,8 @@ public class SkuBuyTogetherOftenVo {
     private Long skuId;
     @ApiModelProperty("prod_id")
     private Long prodId;
+    @ApiModelProperty("门店id")
+    private Long shopId;
     @ApiModelProperty("商品名")
     private String skuName;
     @ApiModelProperty("图片")

+ 1 - 0
yami-shop-platform/src/main/java/com/yami/shop/platform/PlatformApplication.java

@@ -26,6 +26,7 @@ public class PlatformApplication extends SpringBootServletInitializer{
 
 	public static void main(String[] args) {
         SpringApplication.run(PlatformApplication.class, args);
+        System.out.println("swagger文档:http://localhost:8114/doc.html");
 	}
 
 	@Override

+ 5 - 4
yami-shop-service/src/main/java/com/yami/shop/dao/ProdCommMapper.java

@@ -31,13 +31,14 @@ public interface ProdCommMapper extends BaseMapper<ProdComm> {
     IPage<ProdComm> getProdCommPage(Page page, @Param("prodComm") ProdComm prodComm, @Param("shopId") Long shopId);
 
     IPage<ProdComm> commList(@Param("page") PageParam<ProdComm> page, @Param("skuId") Long skuId,
-                             @Param("shopId") Long shopId,@Param("commStatus") Integer commStatus);
+                             @Param("shopId") Long shopId,@Param("commStatus") Integer commStatus,
+                             @Param("channelId") Long channelId);
 
-    Integer commentCount(@Param("skuId") Long skuId, @Param("shopId") Long shopId, @Param("evaluate") Integer evaluate);
+    Integer commentCount(@Param("skuId") Long skuId, @Param("shopId") Long shopId, @Param("evaluate") Integer evaluate,@Param("channelId") Long channelId);
 
-    Integer picCount(@Param("skuId") Long skuId, @Param("shopId") Long shopId);
+    Integer picCount(@Param("skuId") Long skuId, @Param("shopId") Long shopId,@Param("channelId") Long channelId);
 
-    String goodRate(@Param("skuId") Long skuId, @Param("shopId") Long shopId);
+    String goodRate(@Param("skuId") Long skuId, @Param("shopId") Long shopId,@Param("channelId") Long channelId);
 
     IPage<ProdComm> myCommList(@Param("page") PageParam<ProdComm> page, @Param("userId") String userId);
 

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

@@ -32,9 +32,9 @@ public interface ProdCommService extends IService<ProdComm> {
 
     void comm(Order order, ProdCommParam prodCommParam);
 
-    IPage<ProdComm> commList(PageParam<ProdComm> page,Long skuId,Long shopId,Integer commStatus);
+    IPage<ProdComm> commList(PageParam<ProdComm> page,Long skuId,Long shopId,Integer commStatus,Long channelId);
 
-    Map<String, Object> commentCount(Long skuId, Long shopId);
+    Map<String, Object> commentCount(Long skuId, Long shopId,Long channelId);
 
     IPage<ProdComm> myCommList(PageParam<ProdComm> page, String userId);
 

+ 9 - 9
yami-shop-service/src/main/java/com/yami/shop/service/impl/ProdCommServiceImpl.java

@@ -130,8 +130,8 @@ public class ProdCommServiceImpl extends ServiceImpl<ProdCommMapper, ProdComm> i
     }
 
     @Override
-    public IPage<ProdComm> commList(PageParam<ProdComm> page, Long skuId,Long shopId,Integer commStatus) {
-        IPage<ProdComm> commList = prodCommMapper.commList(page, skuId,shopId,commStatus);
+    public IPage<ProdComm> commList(PageParam<ProdComm> page, Long skuId,Long shopId,Integer commStatus,Long channelId) {
+        IPage<ProdComm> commList = prodCommMapper.commList(page, skuId,shopId,commStatus,channelId);
         List<ProdComm> records = commList.getRecords();
         if (!records.isEmpty()){
             records.forEach(c->
@@ -142,14 +142,14 @@ public class ProdCommServiceImpl extends ServiceImpl<ProdCommMapper, ProdComm> i
     }
 
     @Override
-    public Map<String, Object> commentCount(Long skuId, Long shopId) {
+    public Map<String, Object> commentCount(Long skuId, Long shopId,Long channelId) {
         Map<String, Object> map = new LinkedTreeMap<>();
-        map.put("all", prodCommMapper.commentCount(skuId, shopId,null));
-        map.put("goodCount", prodCommMapper.commentCount(skuId, shopId,0));
-        map.put("middleCount", prodCommMapper.commentCount(skuId, shopId,1));
-        map.put("badCount", prodCommMapper.commentCount(skuId, shopId,2));
-        map.put("picCount", prodCommMapper.picCount(skuId, shopId));
-        map.put("goodRate", prodCommMapper.goodRate(skuId, shopId));
+        map.put("all", prodCommMapper.commentCount(skuId, shopId,null,channelId));
+        map.put("goodCount", prodCommMapper.commentCount(skuId, shopId,0,channelId));
+        map.put("middleCount", prodCommMapper.commentCount(skuId, shopId,1,channelId));
+        map.put("badCount", prodCommMapper.commentCount(skuId, shopId,2,channelId));
+        map.put("picCount", prodCommMapper.picCount(skuId, shopId,channelId));
+        map.put("goodRate", prodCommMapper.goodRate(skuId, shopId,channelId));
         return map;
     }
 

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

@@ -988,7 +988,7 @@
     </select>
 
     <select id="statusCount" resultType="integer">
-        SELECT count(1) FROM `tz_order` WHERE  dvy_type=1 and hb_order_status in
+        SELECT count(1) FROM `tz_order` WHERE hb_order_status in
         <foreach collection="status" item="status" separator="," open="(" close=")">
             #{status}
         </foreach>

+ 37 - 18
yami-shop-service/src/main/resources/mapper/ProdCommMapper.xml

@@ -29,11 +29,11 @@
                count(CASE WHEN evaluate = 0 THEN 1 ELSE null END)     AS praise_number,
                count(CASE WHEN evaluate = 1 THEN 1 ELSE null END)     AS secondary_number,
                count(CASE WHEN evaluate = 2 THEN 1 ELSE null END)     AS negative_number,
-               count(CASE WHEN score = 1 THEN 1 ELSE null END)     AS scoreNumber1,
-               count(CASE WHEN score = 2 THEN 1 ELSE null END)     AS scoreNumber2,
-               count(CASE WHEN score = 3 THEN 1 ELSE null END)     AS scoreNumber3,
-               count(CASE WHEN score = 4 THEN 1 ELSE null END)     AS scoreNumber4,
-               count(CASE WHEN score = 5 THEN 1 ELSE null END)     AS scoreNumber5,
+               count(CASE WHEN score = 1 THEN 1 ELSE null END)        AS scoreNumber1,
+               count(CASE WHEN score = 2 THEN 1 ELSE null END)        AS scoreNumber2,
+               count(CASE WHEN score = 3 THEN 1 ELSE null END)        AS scoreNumber3,
+               count(CASE WHEN score = 4 THEN 1 ELSE null END)        AS scoreNumber4,
+               count(CASE WHEN score = 5 THEN 1 ELSE null END)        AS scoreNumber5,
                count(CASE WHEN pics is not null THEN 1 ELSE null END) AS pic_number
         FROM tz_prod_comm
         WHERE prod_id = #{prodId}
@@ -42,7 +42,10 @@
 
 
     <sql id="ProdCommDto_SQL">
-        pc.prod_comm_id,
+        pc
+        .
+        prod_comm_id
+        ,
         pc.reply_content,
         pc.rec_time,
         pc.score,
@@ -158,7 +161,9 @@
         SELECT b.nick_name,b.pic avatar,a.*
         FROM tz_prod_comm a
         LEFT JOIN tz_user b on a.user_id=b.user_id
-        WHERE a.order_number in (SELECT order_number FROM tz_order_item WHERE sku_id = #{skuId} and shop_id=#{shopId}) and a.`status`=1
+        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.sku_id = #{skuId} and a.shop_id = #{shopId} and b.channel_id=#{channelId}) and a.`status`=1
         <choose>
             <when test="commStatus == 3">
                 and !ISNULL(a.pics)
@@ -173,8 +178,10 @@
     <select id="commentCount" resultType="integer">
         SELECT COUNT(1)
         FROM tz_prod_comm
-        WHERE order_number in (SELECT order_number FROM tz_order_item WHERE sku_id = #{skuId} and shop_id = #{shopId})
-          and `status` = 1
+        WHERE 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.sku_id = #{skuId} and a.shop_id = #{shopId} and b.channel_id=#{channelId})
+        and `status` = 1
         <if test="evaluate!=null">
             and evaluate = #{evaluate}
         </if>
@@ -183,28 +190,40 @@
     <select id="picCount" resultType="integer">
         SELECT COUNT(1)
         FROM tz_prod_comm
-        WHERE order_number in (SELECT order_number FROM tz_order_item WHERE sku_id = #{skuId} and shop_id = #{shopId})
+        WHERE 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.sku_id = #{skuId}
+                                 and a.shop_id = #{shopId}
+                                 and b.channel_id = #{channelId})
           and `status` = 1
           and TRIM(pics) > ''
     </select>
 
     <select id="goodRate" resultType="string">
-        SELECT IFNULL(CONCAT(CAST(SUM(CASE WHEN pc.evaluate = 0 THEN 1 ELSE 0 END) * 100.0 / COUNT(*) AS DECIMAL(5,2)),'%'),'100%') AS rate
+        SELECT IFNULL(CONCAT(CAST(SUM(CASE WHEN pc.evaluate = 0 AND pc.`status` = 1 THEN 1 ELSE 0 END) * 100.0 /
+                                  COUNT(*) AS DECIMAL(5, 2)), '%'), '100%') AS rate
         FROM tz_prod_comm pc
-                 JOIN tz_order_item oi ON pc.order_number = oi.order_number
-        WHERE oi.sku_id = #{skuId} and oi.shop_id = #{shopId} AND pc.`status` = 1
+        WHERE pc.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.sku_id = #{skuId}
+                                    and a.shop_id = #{shopId}
+                                    and b.channel_id = #{channelId})
     </select>
 
     <select id="myCommList" resultMap="BaseResultMap">
-        SELECT b.nick_name,b.pic avatar,a.*
+        SELECT b.nick_name, b.pic avatar, a.*
         FROM tz_prod_comm a
-                 LEFT JOIN tz_user b on a.user_id=b.user_id
-        WHERE a.user_id=#{userId}
-        ORDER BY a.rec_time desc,a.prod_comm_id desc
+                 LEFT JOIN tz_user b on a.user_id = b.user_id
+        WHERE a.user_id = #{userId}
+        ORDER BY a.rec_time desc, a.prod_comm_id desc
     </select>
 
     <select id="getShopName" resultType="string">
-        SELECT shop_name FROM tz_shop_detail WHERE shop_id =(SELECT shop_id FROM tz_order WHERE order_number=#{orderNumber})
+        SELECT shop_name
+        FROM tz_shop_detail
+        WHERE shop_id = (SELECT shop_id FROM tz_order WHERE order_number = #{orderNumber})
     </select>
 
     <select id="backendCommList" resultMap="BaseResultMap">

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

@@ -181,7 +181,7 @@
     </update>
 
     <select id="buyTogetherOften" resultType="com.yami.shop.bean.vo.SkuBuyTogetherOftenVo">
-        SELECT b.sku_id, b.prod_id, b.sku_name, b.pic, c.channel_prod_price, d.shop_sku_stocks
+        SELECT a.shop_id,b.sku_id, b.prod_id, b.sku_name, b.pic, c.channel_prod_price, d.shop_sku_stocks
         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