Selaa lähdekoodia

bugfix:打卡广场评论

刘云鑫 2 kuukautta sitten
vanhempi
commit
df35308876

+ 2 - 2
alien-entity/src/main/java/shop/alien/entity/store/CommonComment.java

@@ -28,11 +28,11 @@ public class CommonComment implements Serializable {
     @TableId(value = "id", type = IdType.AUTO)
     private Long id;
 
-    @ApiModelProperty(value = "评论来源类型:1-评价的评论 2-动态评论")
+    @ApiModelProperty(value = "评论来源类型:1-评价的评论 2-动态评论 3-打卡评论")
     @TableField("source_type")
     private Integer sourceType;
 
-    @ApiModelProperty(value = "来源关联ID:source_type=1时=rating.id,=2时=动态ID")
+    @ApiModelProperty(value = "来源关联ID:source_type=1时=rating.id,=2时=动态ID,=3打卡id")
     @TableField("source_id")
     private Long sourceId;
 

+ 1 - 1
alien-store/src/main/java/shop/alien/store/controller/CommonCommentController.java

@@ -140,7 +140,7 @@ public class CommonCommentController {
     public R getCommitCount(@RequestParam Integer sourceId,
                             @RequestParam Integer sourceType,
                             @RequestParam String userId,
-                            @RequestParam String userType){
+                            @RequestParam(required = false) String userType){
         return R.data(commonCommentService.getCommitCount(sourceId, sourceType, userId, userType));
     }
 }

+ 2 - 2
alien-store/src/main/java/shop/alien/store/service/LifeCommentService.java

@@ -196,7 +196,7 @@ public class LifeCommentService {
                 return commonRatingMapper.update(null, new UpdateWrapper<CommonRating>()
                         .setSql("like_count = like_count + 1")
                         .eq("id", huifuId));
-            } else if (CommonConstant.COMMENT_LIKE.equals(type) || CommonConstant.DYNAMIC_LIKE.equals(type)) {
+            } else if (CommonConstant.COMMENT_LIKE.equals(type) || CommonConstant.DYNAMIC_LIKE.equals(type) || CommonConstant.CLOCK_IN_LIKE.equals(type)) {
                 // 12-评论点赞:更新评论表点赞数
                 return commonCommentMapper.update(null, new UpdateWrapper<CommonComment>()
                         .setSql("like_count = like_count + 1")
@@ -364,7 +364,7 @@ public class LifeCommentService {
                 return commonRatingMapper.update(null, new UpdateWrapper<CommonRating>()
                         .setSql("like_count = like_count - 1")
                         .eq("id", huifuId));
-            } else if (CommonConstant.COMMENT_LIKE.equals(type) || CommonConstant.DYNAMIC_LIKE.equals(type)) {
+            } else if (CommonConstant.COMMENT_LIKE.equals(type) || CommonConstant.DYNAMIC_LIKE.equals(type) || CommonConstant.CLOCK_IN_LIKE.equals(type)) {
                 // 12-评论点赞:更新评论表点赞数
                 return commonCommentMapper.update(null, new UpdateWrapper<CommonComment>()
                         .setSql("like_count = like_count - 1")

+ 2 - 0
alien-store/src/main/java/shop/alien/store/service/impl/CommonCommentServiceImpl.java

@@ -86,6 +86,8 @@ public class CommonCommentServiceImpl extends ServiceImpl<CommonCommentMapper, C
             likeType = CommonConstant.COMMENT_LIKE;
         } else if (sourceType == CommentSourceTypeEnum.DYNAMIC_COMMENT.getType()) {
             likeType = CommonConstant.DYNAMIC_LIKE;
+        } else if (sourceType == CommentSourceTypeEnum.CLOCK_IN_COMMENT.getType()){
+            likeType = CommonConstant.CLOCK_IN_LIKE;
         }
         List<CommonCommentVo> firstLevelComment = getFirstLevelComment(sourceType, sourceId, pageNum, pageSize, userId,likeType);
         CommonRatingVo commonRatingVo = new CommonRatingVo();

+ 7 - 3
alien-store/src/main/java/shop/alien/store/service/impl/StoreClockInServiceImpl.java

@@ -1,6 +1,7 @@
 package shop.alien.store.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
+import com.alibaba.fastjson2.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
@@ -12,16 +13,16 @@ import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
-import com.alibaba.fastjson2.JSONObject;
 import shop.alien.entity.store.*;
 import shop.alien.entity.store.vo.StoreClockInVo;
 import shop.alien.entity.store.vo.WebSocketVo;
 import shop.alien.mapper.*;
 import shop.alien.store.config.WebSocketProcess;
+import shop.alien.store.service.CommonCommentService;
 import shop.alien.store.service.StoreClockInService;
 import shop.alien.store.service.StoreCommentService;
 import shop.alien.store.util.ai.AiContentModerationUtil;
-import shop.alien.store.util.ai.AiVideoModerationUtil;
+import shop.alien.util.common.constant.CommentSourceTypeEnum;
 
 import javax.annotation.PostConstruct;
 import javax.annotation.PreDestroy;
@@ -66,6 +67,8 @@ public class StoreClockInServiceImpl extends ServiceImpl<StoreClockInMapper, Sto
 
     private final LifeNoticeMapper lifeNoticeMapper;
 
+    private final CommonCommentService commonCommentService;
+
     private final WebSocketProcess webSocketProcess;
 
     // 初始化线程池
@@ -253,7 +256,8 @@ public class StoreClockInServiceImpl extends ServiceImpl<StoreClockInMapper, Sto
 //            vo.setClockInStoreNum(clockInStoreNumMap.get(vo.getStoreId()));
 //            // 打卡次数
 //            vo.setClockInNum(clockInNum);
-            vo.setCommentCount(Integer.parseInt(storeCommentService.getCommitCountAndScore(vo.getId(), 4, vo.getStoreId(),null,null).get("commitCount").toString()));
+            Map<String, Object> commitCount = commonCommentService.getCommitCount(vo.getId(), CommentSourceTypeEnum.CLOCK_IN_COMMENT.getType(), userId.toString(), null);
+            vo.setCommentCount(Integer.parseInt(commitCount.get("commentCount").toString()));
             if(Arrays.asList("酒吧", "KTV", "洗浴汗蒸", "按摩足疗").contains(vo.getBusinessSectionName())){
                 vo.setStoreTypeNew(1);
             } else if (Arrays.asList("丽人美发", "运动健身").contains(vo.getBusinessSectionName())){

+ 1 - 0
alien-store/src/main/java/shop/alien/store/util/CommonConstant.java

@@ -112,6 +112,7 @@ public class CommonConstant {
     public static final String RATING_LIKE = "11";
     public static final String COMMENT_LIKE = "12";
     public static final String DYNAMIC_LIKE = "13";
+    public static final String CLOCK_IN_LIKE = "14";
 
 
     /**

+ 2 - 1
alien-util/src/main/java/shop/alien/util/common/constant/CommentSourceTypeEnum.java

@@ -3,7 +3,8 @@ package shop.alien.util.common.constant;
 
 public enum CommentSourceTypeEnum {
     STORE_COMMENT(1, "店铺评价"),
-    DYNAMIC_COMMENT(2, "动态评论");
+    DYNAMIC_COMMENT(2, "动态评论"),
+    CLOCK_IN_COMMENT(3, "打卡评论");
     private final Integer type;
     private final String info;