瀏覽代碼

门店标签

qxy 1 周之前
父節點
當前提交
167781798f

+ 4 - 0
alien-entity/src/main/java/shop/alien/entity/store/vo/StoreCommentVo.java

@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonInclude;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import shop.alien.entity.store.StoreComment;
+import shop.alien.entity.store.StoreImg;
 
 import java.util.List;
 
@@ -65,4 +66,7 @@ public class StoreCommentVo extends StoreComment {
 
     @ApiModelProperty(value = "门店名称")
     private String  storeName;
+
+    @ApiModelProperty(value = "图片地址")
+    private List<StoreImg> imgList;
 }

+ 14 - 0
alien-entity/src/main/java/shop/alien/mapper/StoreCommentMapper.java

@@ -149,4 +149,18 @@ public interface StoreCommentMapper extends BaseMapper<StoreComment> {
             "AND luo.user_id = #{userId} " +
             "AND luo.id IN (SELECT business_id FROM store_comment WHERE business_type = 5 AND user_id = #{userId} AND delete_flag = 0)")
     IPage<LifeUserOrderCommentVo> getCommentOrderYPJPage(IPage<LifeUserOrderCommentVo> page, @Param("userId") String userId);
+
+
+    @Select("SELECT\n" +
+            "\ts.*,\n" +
+            "\tlu.user_name, \n" +
+            "\tlu.user_image \n" +
+            "FROM\n" +
+            "\tstore_comment s\n" +
+            "\tLEFT JOIN life_user lu ON s.user_id = lu.id \n" +
+            "WHERE\n" +
+            "\ts.business_type = 5 \n" +
+            "\tAND s.store_id = #{storeId}\n" +
+            "\tLIMIT 1")
+    StoreCommentVo getCommentOneInfo(@Param("storeId") int storeId);
 }

+ 39 - 15
alien-entity/src/main/java/shop/alien/mapper/TagsMainMapper.java

@@ -6,6 +6,7 @@ import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import shop.alien.entity.store.TagsMain;
+import shop.alien.entity.store.vo.StoreCommentVo;
 import shop.alien.entity.store.vo.TagsMainVo;
 
 import java.util.List;
@@ -41,23 +42,46 @@ public interface TagsMainMapper extends BaseMapper<TagsMain> {
     })
     int insertBatchTagsMain(List<TagsMain> tagsMainList);
 
-    @Select("<script>" +
-            "SELECT\n" +
-            "    main.id,\n" +
-            "    main.tag_name,\n" +
-            "    main.store_id,\n" +
-            "    main.tag_type,\n" +
-            "    IFNULL(GROUP_CONCAT(DISTINCT synonym.comment_id ORDER BY synonym.comment_id SEPARATOR ','), '') AS evaluateNumber\n" +
+    @Select("SELECT\n" +
+            "  main.id,\n" +
+            "  main.tag_name,\n" +
+            "  main.store_id,\n" +
+            "  main.tag_type,\n" +
+            "  IFNULL(GROUP_CONCAT(DISTINCT synonym.comment_id ORDER BY synonym.comment_id SEPARATOR ','), '') AS evaluate_ids,\n" +
+            "  IFNULL(COUNT(DISTINCT synonym.comment_id), 0) AS evaluateNumber\n" +
             "FROM\n" +
-            "    tags_main main\n" +
-            "    LEFT JOIN tags_synonym synonym \n" +
-            "        ON main.id = synonym.main_tag_id\n" +
-            "        AND synonym.delete_flag = 0  \n" +
+            "  tags_main main\n" +
+            "LEFT JOIN tags_synonym synonym \n" +
+            "  ON main.id = synonym.main_tag_id\n" +
+            "  AND synonym.delete_flag = 0  \n" +
             "WHERE\n" +
-            "    main.store_id = #{storeId} \n" +
-            "    AND main.delete_flag = 0\n" +
+            "  main.store_id = #{storeId}\n" +
+            "  AND main.delete_flag = 0\n" +
             "GROUP BY\n" +
-            "    main.id" +
-            "</script>")
+            "  main.id, main.tag_name, main.store_id, main.tag_type  \n" +
+            "ORDER BY\n" +
+            "  main.id;")
     List<TagsMainVo> getStoreEvaluateTags(Integer storeId);
+
+    @Select("SELECT\n" +
+            "  ts.comment_id,\n" +
+            "  MIN(ts.id) AS tag_id,  \n" +
+            "  ts.main_tag_id,\n" +
+            "  GROUP_CONCAT(DISTINCT ts.synonym_tag SEPARATOR ',') AS synonym_tags,  \n" +
+            "  MIN(ts.delete_flag) AS tag_delete_flag,\n" +
+            "  MAX(ts.created_time) AS tag_created_time,\n" +
+            "  sc.*\n" +
+            "FROM\n" +
+            "  tags_synonym ts\n" +
+            "LEFT JOIN store_comment sc \n" +
+            "  ON ts.comment_id = sc.id\n" +
+            "WHERE\n" +
+            "  ts.main_tag_id = #{mainId}  \n" +
+            "GROUP BY\n" +
+            "  ts.comment_id, ts.main_tag_id,  \n" +
+            "  sc.id  \n" +
+            "ORDER BY\n" +
+            "  sc.created_time DESC; ")
+    List<StoreCommentVo> getstoreCommentList(Integer mainId);
+
 }

+ 36 - 9
alien-store/src/main/java/shop/alien/store/controller/StoreInfoController.java

@@ -13,16 +13,11 @@ import shop.alien.entity.result.R;
 import shop.alien.entity.store.*;
 import shop.alien.entity.store.dto.StoreInfoDto;
 import shop.alien.entity.store.vo.*;
-import shop.alien.mapper.StoreCommentSummaryInterestMapper;
-import shop.alien.mapper.StoreImgMapper;
-import shop.alien.mapper.TagsMainMapper;
-import shop.alien.mapper.WebAuditMapper;
+import shop.alien.mapper.*;
 import shop.alien.store.service.StoreInfoService;
 
 import java.io.IOException;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
 
 /**
  * 二期-门店信息Controller
@@ -49,6 +44,8 @@ public class StoreInfoController {
 
     private final StoreCommentSummaryInterestMapper storeCommentSummaryInterestMapper;
 
+    private final StoreCommentMapper storeCommentMapper;
+
     @ApiOperation("获取所有门店")
     @ApiOperationSupport(order = 1)
     @GetMapping("/getAll")
@@ -850,10 +847,40 @@ public class StoreInfoController {
     @ApiImplicitParams({
             @ApiImplicitParam(name = "storeId", value = "门店id", dataType = "int", paramType = "query", required = true)
     })
-    public R<List<TagsMainVo>> getStoreEvaluateTags(@RequestParam("storeId") int storeId) {
+    public R<Map<String,Object>> getStoreEvaluateTags(@RequestParam("storeId") int storeId) {
         log.info("StoreInfoController.getStoreEvaluateTags?storeId={}, tagType={}", storeId);
+        Map<String,Object> map = new HashMap<>();
         List<TagsMainVo> voList = tagsMainMapper.getStoreEvaluateTags(storeId);
-        return R.data(voList);
+        if(voList !=null && voList.size()>0){
+            StoreCommentVo storeComment = storeCommentMapper.getCommentOneInfo(storeId);
+            if(storeComment!=null){
+                if(storeComment.getImgId()!=null){
+                    List<String> imgIds = Arrays.asList(storeComment.getImgId().split(","));
+                    List<StoreImg> storeImgs = storeImgMapper.selectList(new LambdaQueryWrapper<StoreImg>().in(StoreImg::getId, imgIds));
+                    storeComment.setImgList(storeImgs);
+                }
+                LambdaQueryWrapper<StoreComment> lambdaQueryWrapper1 = new LambdaQueryWrapper<>();
+                lambdaQueryWrapper1.eq(StoreComment :: getStoreId, storeId);
+                lambdaQueryWrapper1.eq(StoreComment :: getBusinessType, 5);
+                lambdaQueryWrapper1.eq(StoreComment :: getDeleteFlag, 0);
+                Integer commitCount = storeCommentMapper.selectCount(lambdaQueryWrapper1);
+                map.put("commitCount",commitCount);
+            }
+            map.put("tag",voList);
+            map.put("evaluate",storeComment);
+        }
+        return R.data(map);
+    }
+
+    @ApiOperation(value = "AI服务-门店评价标签下评价")
+    @GetMapping("/getStoreEvaluateTagsList")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "mainId", value = "标签id", dataType = "int", paramType = "query", required = true)
+    })
+    public R<List<StoreCommentVo>> getStoreEvaluateTagsList(@RequestParam("mainId") int mainId) {
+        log.info("StoreInfoController.getStoreEvaluateTagsList?mainId={}", mainId);
+        List<StoreCommentVo> list = tagsMainMapper.getstoreCommentList(mainId);
+        return R.data(list);
     }
 
     @ApiOperation(value = "AI服务-门店趣味信息")