|
@@ -289,7 +289,7 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
|
|
}));
|
|
}));
|
|
if (communityCommentRaffle != null) {
|
|
if (communityCommentRaffle != null) {
|
|
BeanUtils.copyProperties(communityCommentRaffle, communityCommentRaffleVo);
|
|
BeanUtils.copyProperties(communityCommentRaffle, communityCommentRaffleVo);
|
|
- CommunityUserInfoVo communityUserInfoVo = communityArticleService.selectCommunityUserInfoById(communityCommentRaffle.getUserId());
|
|
|
|
|
|
+ CommunityUserInfoVo communityUserInfoVo = communityArticleService.selectCommunityUserInfoById(communityCommentRaffle.getUserId(),true);
|
|
communityCommentRaffleVo.setUserName(communityUserInfoVo.getNickName());
|
|
communityCommentRaffleVo.setUserName(communityUserInfoVo.getNickName());
|
|
communityCommentRaffleVo.setUserAvatar(communityUserInfoVo.getAvatar());
|
|
communityCommentRaffleVo.setUserAvatar(communityUserInfoVo.getAvatar());
|
|
articleVo.setCommentRaffleVo(communityCommentRaffleVo);
|
|
articleVo.setCommentRaffleVo(communityCommentRaffleVo);
|
|
@@ -579,7 +579,7 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
|
|
.findFirst()
|
|
.findFirst()
|
|
.ifPresent(communityCommentRaffle -> {
|
|
.ifPresent(communityCommentRaffle -> {
|
|
BeanUtils.copyProperties(communityCommentRaffle, communityCommentRaffleVo);
|
|
BeanUtils.copyProperties(communityCommentRaffle, communityCommentRaffleVo);
|
|
- CommunityUserInfoVo communityUserInfoVo = communityArticleService.selectCommunityUserInfoById(communityCommentRaffle.getUserId());
|
|
|
|
|
|
+ CommunityUserInfoVo communityUserInfoVo = communityArticleService.selectCommunityUserInfoById(communityCommentRaffle.getUserId(),true);
|
|
communityCommentRaffleVo.setUserName(communityUserInfoVo.getNickName());
|
|
communityCommentRaffleVo.setUserName(communityUserInfoVo.getNickName());
|
|
communityCommentRaffleVo.setUserAvatar(communityUserInfoVo.getAvatar());
|
|
communityCommentRaffleVo.setUserAvatar(communityUserInfoVo.getAvatar());
|
|
articleVo.setCommentRaffleVo(communityCommentRaffleVo);
|
|
articleVo.setCommentRaffleVo(communityCommentRaffleVo);
|
|
@@ -1163,7 +1163,7 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
|
|
* @return 用户信息
|
|
* @return 用户信息
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
- public CommunityUserInfoVo selectCommunityUserInfoById(Long userId) {
|
|
|
|
|
|
+ public CommunityUserInfoVo selectCommunityUserInfoById(Long userId,boolean isToken) {
|
|
SysUser sysUser = sysUserMapper.selectUserById(userId);
|
|
SysUser sysUser = sysUserMapper.selectUserById(userId);
|
|
CommunityUserInfo communityUserInfo = communityUserInfoMapper.selectOne(new QueryWrapper<CommunityUserInfo>().eq("user_id", userId));
|
|
CommunityUserInfo communityUserInfo = communityUserInfoMapper.selectOne(new QueryWrapper<CommunityUserInfo>().eq("user_id", userId));
|
|
CommunityUserInfoVo communityUserInfoVo = new CommunityUserInfoVo();
|
|
CommunityUserInfoVo communityUserInfoVo = new CommunityUserInfoVo();
|
|
@@ -1204,14 +1204,15 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
|
|
communityUserInfoVo.setAddress(address);
|
|
communityUserInfoVo.setAddress(address);
|
|
//设置是否被当前登录的用户关注
|
|
//设置是否被当前登录的用户关注
|
|
communityUserInfoVo.setLike(false);
|
|
communityUserInfoVo.setLike(false);
|
|
- Long loginUserId = SecurityUtils.getLoginUser().getUserId();
|
|
|
|
- if (!Objects.equals(userId, loginUserId)) {
|
|
|
|
- CommunityUserLike communityUserLike = communityUserLikeMapper.selectOne(new QueryWrapper<CommunityUserLike>().eq("user_id", loginUserId).eq("like_user_id", userId));
|
|
|
|
- if (!Objects.isNull(communityUserLike) && !Objects.isNull(communityUserLike.getId())) {
|
|
|
|
- communityUserInfoVo.setLike(true);
|
|
|
|
|
|
+ if (isToken) {
|
|
|
|
+ Long loginUserId = SecurityUtils.getLoginUser().getUserId();
|
|
|
|
+ if (!Objects.equals(userId, loginUserId)) {
|
|
|
|
+ CommunityUserLike communityUserLike = communityUserLikeMapper.selectOne(new QueryWrapper<CommunityUserLike>().eq("user_id", loginUserId).eq("like_user_id", userId));
|
|
|
|
+ if (!Objects.isNull(communityUserLike) && !Objects.isNull(communityUserLike.getId())) {
|
|
|
|
+ communityUserInfoVo.setLike(true);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
return communityUserInfoVo;
|
|
return communityUserInfoVo;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1671,14 +1672,14 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
|
|
commentRaffle.setCreateTime(DateUtils.parseDate(DateUtils.getTime()));
|
|
commentRaffle.setCreateTime(DateUtils.parseDate(DateUtils.getTime()));
|
|
communityCommentRaffleMapper.insert(commentRaffle);
|
|
communityCommentRaffleMapper.insert(commentRaffle);
|
|
BeanUtils.copyProperties(commentRaffle, communityCommentRaffleVo);
|
|
BeanUtils.copyProperties(commentRaffle, communityCommentRaffleVo);
|
|
- communityUserInfoVo = communityArticleService.selectCommunityUserInfoById(commentRaffle.getUserId());
|
|
|
|
|
|
+ communityUserInfoVo = communityArticleService.selectCommunityUserInfoById(commentRaffle.getUserId(),true);
|
|
communityCommentRaffleVo.setUserName(communityUserInfoVo.getNickName());
|
|
communityCommentRaffleVo.setUserName(communityUserInfoVo.getNickName());
|
|
communityCommentRaffleVo.setUserAvatar(communityUserInfoVo.getAvatar());
|
|
communityCommentRaffleVo.setUserAvatar(communityUserInfoVo.getAvatar());
|
|
return communityCommentRaffleVo;
|
|
return communityCommentRaffleVo;
|
|
}
|
|
}
|
|
|
|
|
|
BeanUtils.copyProperties(communityCommentRaffle, communityCommentRaffleVo);
|
|
BeanUtils.copyProperties(communityCommentRaffle, communityCommentRaffleVo);
|
|
- communityUserInfoVo = communityArticleService.selectCommunityUserInfoById(communityCommentRaffle.getUserId());
|
|
|
|
|
|
+ communityUserInfoVo = communityArticleService.selectCommunityUserInfoById(communityCommentRaffle.getUserId(),true);
|
|
communityCommentRaffleVo.setUserName(communityUserInfoVo.getNickName());
|
|
communityCommentRaffleVo.setUserName(communityUserInfoVo.getNickName());
|
|
communityCommentRaffleVo.setUserAvatar(communityUserInfoVo.getAvatar());
|
|
communityCommentRaffleVo.setUserAvatar(communityUserInfoVo.getAvatar());
|
|
return communityCommentRaffleVo;
|
|
return communityCommentRaffleVo;
|