jyc 1 月之前
父节点
当前提交
281f457d81

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

@@ -59,4 +59,7 @@ public class StoreCommentVo extends StoreComment {
 
     @ApiModelProperty(value = "商家or用户(0商家/1用户)")
     private Integer storeUserFlag;
+
+    private String storeUserName;
+    private String storeUserImg;
 }

+ 31 - 0
alien-store/src/main/java/shop/alien/store/service/impl/StoreCommentServiceImpl.java

@@ -195,6 +195,9 @@ public class StoreCommentServiceImpl extends ServiceImpl<StoreCommentMapper, Sto
             if (StringUtils.isNotEmpty(records.get(i).getPhoneId())) {
                 if (records.get(i).getPhoneId().contains("store_")) {
                     storeCommentVo.setStoreUserFlag(0);
+                    StoreUser storeUser = storeUserMapper.selectOne(new LambdaQueryWrapper<StoreUser>().eq(StoreUser::getStoreId, records.get(i).getStoreId()));
+                    storeCommentVo.setStoreUserName(storeUser.getName());
+                    storeCommentVo.setStoreUserImg(storeUser.getHeadImg());
                 } else {
                     storeCommentVo.setStoreUserFlag(1);
                 }
@@ -248,8 +251,36 @@ public class StoreCommentServiceImpl extends ServiceImpl<StoreCommentMapper, Sto
 //                        .eq(null != businessId && 6 == businessId, "a.business_id", businessId)
                         .eq("a.delete_flag", 0).eq("a.reply_id", child.getId()).orderByDesc("a.created_time");
                 List<StoreCommentVo> childComment2List = storeCommentMapper.getCommentList(childQueryCommentWrapper);
+
+                //商家用户
+                for (StoreCommentVo commentVo : childComment2List) {
+                    if (StringUtils.isNotEmpty(commentVo.getPhoneId())) {
+                        if (commentVo.getPhoneId().contains("store_")) {
+                            commentVo.setStoreUserFlag(0);
+                            StoreUser storeUser = storeUserMapper.selectOne(new LambdaQueryWrapper<StoreUser>().eq(StoreUser::getStoreId, child.getStoreId()));
+                            commentVo.setStoreUserName(storeUser.getName());
+                            commentVo.setStoreUserImg(storeUser.getHeadImg());
+                        } else {
+                            commentVo.setStoreUserFlag(1);
+                        }
+                    }
+                }
+
                 child.setStoreComment(childComment2List);
                 storeCommentVo.setCommitCount(storeCommentVo.getCommitCount() + childComment2List.size());
+
+                //商家用户
+                if (StringUtils.isNotEmpty(child.getPhoneId())) {
+                    if (child.getPhoneId().contains("store_")) {
+                        child.setStoreUserFlag(0);
+                        StoreUser storeUser = storeUserMapper.selectOne(new LambdaQueryWrapper<StoreUser>().eq(StoreUser::getStoreId, child.getStoreId()));
+                        child.setStoreUserName(storeUser.getName());
+                        child.setStoreUserImg(storeUser.getHeadImg());
+                    } else {
+                        child.setStoreUserFlag(1);
+                    }
+                }
+
             });
             //筛选商家评论
             List<StoreCommentVo> storeCommentList = new ArrayList<>();