From 53eba87b3687449a61e6080c3316618a93e8d508 Mon Sep 17 00:00:00 2001 From: xiezhijun <15270898033@163.com> Date: Fri, 6 Aug 2021 16:14:31 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=B0=8F=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E6=B6=88=E6=81=AF=E4=B8=AD=E5=BF=83=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../custom/mapper/SysServicesTopicMapper.java | 11 +++++----- .../service/ISysMessageNoticeService.java | 2 +- .../impl/SysMessageNoticeServiceImpl.java | 10 ++++----- .../impl/SysServicesTopicServiceImp.java | 21 +++++++++++++------ .../mapper/custom/SysServicesTopicMapper.xml | 12 +++++------ 5 files changed, 33 insertions(+), 23 deletions(-) diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysServicesTopicMapper.java b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysServicesTopicMapper.java index 2df2bd5ca..2e70b5041 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysServicesTopicMapper.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysServicesTopicMapper.java @@ -41,16 +41,17 @@ public interface SysServicesTopicMapper { String getTopicContentByTopicId(String topicId); /** - * 根据评论ID查询评论内容 + * 根据评论ID查询话题内容 * @param commentId * @return */ - String getCommentContentByCommentId(String commentId); + SysServicesTopic getTopicContentByCommentId(String commentId); /** - * 查询回复内容 - * @param replyId + * 根据角色和话题ID查询对应status表中的ID + * @param topicId + * @param role * @return */ - String getReplyContentByReplyId(String replyId); + Long getStatusIdByRoleAndTopicId(@Param("topicId")String topicId, @Param("role")String role); } diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysMessageNoticeService.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysMessageNoticeService.java index 3893c32e1..8660258d9 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysMessageNoticeService.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysMessageNoticeService.java @@ -114,7 +114,7 @@ public interface ISysMessageNoticeService * @param type 类型 1评论 2回复 * @param originalContent 话题内容或被回复的内容 */ - public void sendTopicMessage(SysServicesTopic topic, int type, String originalContent); + public void sendTopicMessage(SysServicesTopic topic, int type, Long statusId, String originalContent); /** * 根据客户ID查询打卡点评消息以及未读消息数量(包含点评营养师信息、客户信息、点评内容) diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysMessageNoticeServiceImpl.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysMessageNoticeServiceImpl.java index a4a3434a1..1d0dc0a0e 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysMessageNoticeServiceImpl.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysMessageNoticeServiceImpl.java @@ -206,7 +206,7 @@ public class SysMessageNoticeServiceImpl implements ISysMessageNoticeService { */ @Override @Async - public void sendTopicMessage(SysServicesTopic topic, int type, String originalContent) { + public void sendTopicMessage(SysServicesTopic topic, int type, Long statusId, String originalContent) { if (topic == null) { return; } @@ -215,12 +215,12 @@ public class SysMessageNoticeServiceImpl implements ISysMessageNoticeService { content.put("replyContent", topic.getContent()); //类型:1 评论 2回复 content.put("type", type); - //评论或回复的ID - content.put("id", topic.getId()); + //话题对应的状态已读未读ID + content.put("id", statusId); //评论ID - content.put("commentId", topic.getCommentId()); + //content.put("commentId", topic.getCommentId()); //回复ID - content.put("replyId", topic.getReplyId()); + //content.put("replyId", topic.getReplyId()); //topic的内容 content.put("originalContent", originalContent); diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysServicesTopicServiceImp.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysServicesTopicServiceImp.java index 23d9096c6..eb16295ca 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysServicesTopicServiceImp.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysServicesTopicServiceImp.java @@ -149,16 +149,23 @@ public class SysServicesTopicServiceImp implements ISysServicesTopicService { status.setRole(topic.getRole()); servicesTopicMapper.updateSysServicesTopicStatus(status); + SysServicesTopic tp2 = servicesTopicMapper.getTopicContentByCommentId(topic.getCommentId()); + System.out.println(tp2.getContent() + "---------" + tp2.getTopicId()); + //发送消息 if("customer".equals(topic.getToRole()) && StringUtils.isNotEmpty(topic.getToUid())){ String content = ""; - if(StringUtils.isNotEmpty(topic.getReplyId()) ){ - content = servicesTopicMapper.getReplyContentByReplyId(topic.getReplyId()); - }else if(StringUtils.isNotEmpty(topic.getCommentId())){ - content = servicesTopicMapper.getCommentContentByCommentId(topic.getReplyId()); + Long statusId = 0L; + if(StringUtils.isNotEmpty(topic.getCommentId())){ + SysServicesTopic tp = servicesTopicMapper.getTopicContentByCommentId(topic.getCommentId()); + if(tp != null){ + content = tp.getContent(); + //查询客户对象status表的id + statusId = servicesTopicMapper.getStatusIdByRoleAndTopicId(tp.getTopicId(), topic.getToRole()); + } } if(StringUtils.isNotEmpty(content)){ - sysMessageNoticeService.sendTopicMessage(topic, 2, content); + sysMessageNoticeService.sendTopicMessage(topic, 2, statusId, content); } } @@ -185,8 +192,10 @@ public class SysServicesTopicServiceImp implements ISysServicesTopicService { if("customer".equals(topic.getToRole()) && StringUtils.isNotEmpty(topic.getToUid())){ //查询topic内容 String content = servicesTopicMapper.getTopicContentByTopicId(topic.getTopicId()); + //查询客户对象status表的id + Long statusId = servicesTopicMapper.getStatusIdByRoleAndTopicId(topic.getTopicId(), topic.getToRole()); if(StringUtils.isNotEmpty(content)){ - sysMessageNoticeService.sendTopicMessage(topic, 1, content); + sysMessageNoticeService.sendTopicMessage(topic, 1, statusId, content); } } diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysServicesTopicMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysServicesTopicMapper.xml index 29545a6b4..9d69838ad 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysServicesTopicMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysServicesTopicMapper.xml @@ -331,13 +331,13 @@ select content from sys_services_topic where topic_id = #{topicId} limit 1 </select> - <!-- 根据CommentId查询评论内容 --> - <select id="getCommentContentByCommentId" resultType="String" parameterType="String"> - select content from sys_services_topic_comment where id = #{commentId} limit 1 + <!-- 根据CommentId查询话题内容 --> + <select id="getTopicContentByCommentId" resultType="SysServicesTopic" parameterType="String"> + select topic_id as topicId,content from sys_services_topic where topic_id in (select topic_id from sys_services_topic_comment where id = #{commentId} ) limit 1 </select> - <!-- 根据replyId查询回复内容 --> - <select id="getReplyContentByReplyId" resultType="String" parameterType="String"> - select content from sys_services_topic_reply where id = #{replyId} limit 1 + <!-- 根据角色和话题ID查询对应消息状态ID --> + <select id="getStatusIdByRoleAndTopicId" parameterType="String" resultType="Long"> + select id from sys_services_topic_status where topic_id = #{topicId} and role = #{role} limit 1 </select> </mapper> \ No newline at end of file From 35420de8fe9fa89215966d29ee090610825595e5 Mon Sep 17 00:00:00 2001 From: xiezhijun <15270898033@163.com> Date: Fri, 6 Aug 2021 17:14:07 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=B0=8F=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E6=B6=88=E6=81=AF=E4=B8=AD=E5=BF=83=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../custom/service/ISysMessageNoticeService.java | 2 +- .../service/impl/SysMessageNoticeServiceImpl.java | 4 ++-- .../service/impl/SysServicesTopicServiceImp.java | 13 +++++++------ 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysMessageNoticeService.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysMessageNoticeService.java index 8660258d9..a159a7748 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysMessageNoticeService.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysMessageNoticeService.java @@ -114,7 +114,7 @@ public interface ISysMessageNoticeService * @param type 类型 1评论 2回复 * @param originalContent 话题内容或被回复的内容 */ - public void sendTopicMessage(SysServicesTopic topic, int type, Long statusId, String originalContent); + public void sendTopicMessage(SysServicesTopic topic, int type, String topicId, Long statusId, String originalContent); /** * 根据客户ID查询打卡点评消息以及未读消息数量(包含点评营养师信息、客户信息、点评内容) diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysMessageNoticeServiceImpl.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysMessageNoticeServiceImpl.java index 1d0dc0a0e..07e211a17 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysMessageNoticeServiceImpl.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysMessageNoticeServiceImpl.java @@ -206,7 +206,7 @@ public class SysMessageNoticeServiceImpl implements ISysMessageNoticeService { */ @Override @Async - public void sendTopicMessage(SysServicesTopic topic, int type, Long statusId, String originalContent) { + public void sendTopicMessage(SysServicesTopic topic, int type, String topicId, Long statusId, String originalContent) { if (topic == null) { return; } @@ -231,7 +231,7 @@ public class SysMessageNoticeServiceImpl implements ISysMessageNoticeService { sysMessageNotice.setMessageCustomer(Long.parseLong(topic.getToUid())); sysMessageNotice.setMessageTitle(""); sysMessageNotice.setMessageContent(JSONArray.toJSONString(content)); - sysMessageNotice.setMessageKey(topic.getTopicId()); + sysMessageNotice.setMessageKey(topicId); sendMessageNoticeToCustomer(MessageNoticeEnum.topicMessage, sysMessageNotice); } diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysServicesTopicServiceImp.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysServicesTopicServiceImp.java index eb16295ca..a182c5e38 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysServicesTopicServiceImp.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysServicesTopicServiceImp.java @@ -149,23 +149,24 @@ public class SysServicesTopicServiceImp implements ISysServicesTopicService { status.setRole(topic.getRole()); servicesTopicMapper.updateSysServicesTopicStatus(status); - SysServicesTopic tp2 = servicesTopicMapper.getTopicContentByCommentId(topic.getCommentId()); - System.out.println(tp2.getContent() + "---------" + tp2.getTopicId()); + /*SysServicesTopic tp2 = servicesTopicMapper.getTopicContentByCommentId(topic.getCommentId()); + System.out.println(tp2.getContent() + "---------" + tp2.getTopicId());*/ //发送消息 if("customer".equals(topic.getToRole()) && StringUtils.isNotEmpty(topic.getToUid())){ String content = ""; Long statusId = 0L; + SysServicesTopic tp = null; if(StringUtils.isNotEmpty(topic.getCommentId())){ - SysServicesTopic tp = servicesTopicMapper.getTopicContentByCommentId(topic.getCommentId()); + tp = servicesTopicMapper.getTopicContentByCommentId(topic.getCommentId()); if(tp != null){ content = tp.getContent(); //查询客户对象status表的id statusId = servicesTopicMapper.getStatusIdByRoleAndTopicId(tp.getTopicId(), topic.getToRole()); } } - if(StringUtils.isNotEmpty(content)){ - sysMessageNoticeService.sendTopicMessage(topic, 2, statusId, content); + if(tp != null && StringUtils.isNotEmpty(content)){ + sysMessageNoticeService.sendTopicMessage(topic, 2, tp.getTopicId(), statusId, content); } } @@ -195,7 +196,7 @@ public class SysServicesTopicServiceImp implements ISysServicesTopicService { //查询客户对象status表的id Long statusId = servicesTopicMapper.getStatusIdByRoleAndTopicId(topic.getTopicId(), topic.getToRole()); if(StringUtils.isNotEmpty(content)){ - sysMessageNoticeService.sendTopicMessage(topic, 1, statusId, content); + sysMessageNoticeService.sendTopicMessage(topic, 1, topic.getTopicId(), statusId, content); } } From fec0ad49be0932592a79e657bae7a54d197442c9 Mon Sep 17 00:00:00 2001 From: huangdeliang <huangdeliang@skieer.com> Date: Fri, 6 Aug 2021 18:33:35 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/custom/SysServicesTopicMapper.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysServicesTopicMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysServicesTopicMapper.xml index 9d69838ad..39a6bf4d7 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysServicesTopicMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysServicesTopicMapper.xml @@ -140,7 +140,7 @@ <select id="selectSysServicesTopicSessionByTopicId" resultMap="SysServicesTopicSessionResult" parameterType="String"> - select topic_id, uid, 'customer' as role, content, img, create_time from sys_services_topic where topic_id = #{topicId} + select topic_id, uid, 'customer' as role, topic_type, content, img, create_time from sys_services_topic where topic_id = #{topicId} </select> <select id="selectServicesTopicCommentByTopicId" resultMap="ServicesTopicCommentResult">