From 7aa04bdddba0e2b02fd7dce5036cdef0bed40e22 Mon Sep 17 00:00:00 2001 From: wangqing <408564126@qq.com> Date: Tue, 2 Apr 2024 11:22:51 +0800 Subject: [PATCH] fix enable/disable notice --- .../src/main/java/com/luoo/comment/pojo/UserInfo.java | 4 ++-- .../java/com/luoo/comment/service/CommentService.java | 6 +++--- .../main/java/com/luoo/user/controller/MyController.java | 8 ++++---- .../main/java/com/luoo/user/dto/response/UserRespDTO.java | 4 ++-- luoo_user/src/main/java/com/luoo/user/pojo/UserInfo.java | 4 ++-- .../com/luoo/user/service/UserCollectInfoService.java | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/luoo_comment/src/main/java/com/luoo/comment/pojo/UserInfo.java b/luoo_comment/src/main/java/com/luoo/comment/pojo/UserInfo.java index 9ec5d85..2bbb360 100644 --- a/luoo_comment/src/main/java/com/luoo/comment/pojo/UserInfo.java +++ b/luoo_comment/src/main/java/com/luoo/comment/pojo/UserInfo.java @@ -140,9 +140,9 @@ public class UserInfo implements Serializable { /** * 是否启用通知 */ - private int enableNotice; + private Integer enableNotice; /** * 是否启用推送 */ - private int enablePush; + private Integer enablePush; } diff --git a/luoo_comment/src/main/java/com/luoo/comment/service/CommentService.java b/luoo_comment/src/main/java/com/luoo/comment/service/CommentService.java index d72364a..2e83e3f 100644 --- a/luoo_comment/src/main/java/com/luoo/comment/service/CommentService.java +++ b/luoo_comment/src/main/java/com/luoo/comment/service/CommentService.java @@ -107,7 +107,7 @@ public class CommentService { commentHis.setJournalImage(parentComment.getJournalImage()); commentHis.setCreateTime(new Date()); UserInfo parentCommentUser =userInfoService.findById(parentComment.getUserId()); - if (0 != parentCommentUser.getEnableNotice()) { + if (null ==parentCommentUser.getEnableNotice() || 1 == parentCommentUser.getEnableNotice()) { commentHisDao.save(commentHis); } @@ -139,7 +139,7 @@ public class CommentService { userMessageDto.setSendUserAvatar(Constants.RESOURCE_PREFIX+userLoginDto.getAvatar()); userMessageDto.setSendUserId(userLoginDto.getUserId()); userMessageDto.setSendUserNickName(userLoginDto.getNickName()); - if (0 != parentCommentUser.getEnableNotice()) { + if (null ==parentCommentUser.getEnableNotice() || 1 == parentCommentUser.getEnableNotice()) { rabbitTemplate.convertAndSend("userMessage",userMessageDto); } @@ -241,7 +241,7 @@ public class CommentService { Comment parentComment = commentDao.findById(commentId).get(); UserInfo parentCommentUser =userInfoService.findById(parentComment.getUserId()); - if (0 != parentCommentUser.getEnableNotice()) { + if (null ==parentCommentUser.getEnableNotice() || 1 == parentCommentUser.getEnableNotice()) { /** * 向被点赞者发消息 */ 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 5c5c31b..f47c67e 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 @@ -123,11 +123,11 @@ public class MyController extends BaseController { userRespDTO.setAppleEmail(user.getAppleEmail()); userRespDTO.setEnableNotice(1); userRespDTO.setEnablePush(1); - if (0 ==user.getEnableNotice()) { - userRespDTO.setEnableNotice(0); + if (null != user.getEnableNotice()) { + userRespDTO.setEnableNotice(user.getEnableNotice()); } - if (0 == user.getEnablePush()) { - userRespDTO.setEnablePush(0); + if (null != user.getEnablePush()) { + userRespDTO.setEnablePush(user.getEnablePush()); } return Result.success(userRespDTO); } 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 14e758f..7bc8cc9 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 @@ -64,10 +64,10 @@ public class UserRespDTO implements Serializable { * 是否启用通知 */ @ApiModelProperty(value = "是否启用通知,0为关闭,1为启用,默认启用") - private int enableNotice; + private Integer enableNotice; /** * 是否启用推送 */ @ApiModelProperty(value = "是否启用推送,0为关闭,1为启用,默认启用") - private int enablePush; + private Integer enablePush; } diff --git a/luoo_user/src/main/java/com/luoo/user/pojo/UserInfo.java b/luoo_user/src/main/java/com/luoo/user/pojo/UserInfo.java index 72f4787..b3bb57b 100644 --- a/luoo_user/src/main/java/com/luoo/user/pojo/UserInfo.java +++ b/luoo_user/src/main/java/com/luoo/user/pojo/UserInfo.java @@ -164,9 +164,9 @@ public class UserInfo implements Serializable { /** * 是否启用通知 */ - private int enableNotice; + private Integer enableNotice; /** * 是否启用推送 */ - private int enablePush; + private Integer enablePush; } diff --git a/luoo_user/src/main/java/com/luoo/user/service/UserCollectInfoService.java b/luoo_user/src/main/java/com/luoo/user/service/UserCollectInfoService.java index 535248f..70650e3 100644 --- a/luoo_user/src/main/java/com/luoo/user/service/UserCollectInfoService.java +++ b/luoo_user/src/main/java/com/luoo/user/service/UserCollectInfoService.java @@ -279,7 +279,7 @@ public class UserCollectInfoService { // 向他人发送 新粉丝 消息 UserInfo followUserInfo =userInfoDao.findById(objectId).get(); - if (0 != followUserInfo.getEnableNotice()) { + if (null == followUserInfo.getEnableNotice() || 1== followUserInfo.getEnableNotice() ) { sendMessageToFollows(user, objectId); }