diff --git a/luoo_user/src/main/java/com/luoo/user/controller/MyController.java b/luoo_user/src/main/java/com/luoo/user/controller/MyController.java index 2c9067e..6af9403 100644 --- a/luoo_user/src/main/java/com/luoo/user/controller/MyController.java +++ b/luoo_user/src/main/java/com/luoo/user/controller/MyController.java @@ -13,6 +13,7 @@ import java.util.function.Function; import java.util.stream.Collectors; import com.github.houbb.sensitive.word.bs.SensitiveWordBs; +import com.luoo.user.dao.UserMessageDao; import com.luoo.user.dto.TotalCommentVo; import com.luoo.user.pojo.*; import com.luoo.user.service.*; @@ -102,6 +103,9 @@ public class MyController extends BaseController { @Autowired private RedisTemplate redisTemplate; + @Autowired + private UserMessageDao userMessageDao; + @ApiOperation(value = "1.获取个人信息", notes = "游客无法获取个人信息") @GetMapping("/userInfo") @GlobalInterceptor(checkAppUserLogin = true) @@ -356,7 +360,12 @@ public class MyController extends BaseController { userRespDTO.setThumbUpCount(totalCommentVo.getTotalThumbup()); userRespDTO.setCommentReplyCount(totalCommentVo.getTotalComment()); } - + UserMessage userMessage = userMessageDao.findTopByUserIdOrderBySendTimeDesc(user.getId()); + userRespDTO.setHaveNewMessage(false); + if (null!=userMessage) { + int read = userMessage.getHaveRead(); + userRespDTO.setHaveNewMessage(read==0?true:false); + } return userRespDTO; } diff --git a/luoo_user/src/main/java/com/luoo/user/dao/UserMessageDao.java b/luoo_user/src/main/java/com/luoo/user/dao/UserMessageDao.java index f1993c6..f5d03cd 100644 --- a/luoo_user/src/main/java/com/luoo/user/dao/UserMessageDao.java +++ b/luoo_user/src/main/java/com/luoo/user/dao/UserMessageDao.java @@ -17,5 +17,7 @@ public interface UserMessageDao extends MongoRepository { UserMessage findTopByUserIdAndTypeOrderBySendTimeDesc(String userId,int type); + UserMessage findTopByUserIdOrderBySendTimeDesc(String userId); + } diff --git a/luoo_user/src/main/java/com/luoo/user/dto/response/UserRespDTO.java b/luoo_user/src/main/java/com/luoo/user/dto/response/UserRespDTO.java index 353f23d..49d0200 100644 --- a/luoo_user/src/main/java/com/luoo/user/dto/response/UserRespDTO.java +++ b/luoo_user/src/main/java/com/luoo/user/dto/response/UserRespDTO.java @@ -41,4 +41,6 @@ public class UserRespDTO implements Serializable { private int relation=1; @ApiModelProperty(value = "IP 归属地,精确到省份", example = "北京") private String ipLocation; + @ApiModelProperty(value = "是否有新的未读消息,true为有,false为无") + private boolean haveNewMessage; }