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] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=B0=8F=E7=A8=8B=E5=BA=8F?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E4=B8=AD=E5=BF=83=E6=8E=A5=E5=8F=A3=E4=BC=98?= =?UTF-8?q?=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 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 id from sys_services_topic_status where topic_id = #{topicId} and role = #{role} limit 1 \ No newline at end of file