Merge branch 'xzj' of gitee.com:darlk/ShengTangManage into develop

This commit is contained in:
huangdeliang 2021-08-06 16:52:34 +08:00
commit 0d7e5fc48a
5 changed files with 33 additions and 23 deletions

View File

@ -41,16 +41,17 @@ public interface SysServicesTopicMapper {
String getTopicContentByTopicId(String topicId); String getTopicContentByTopicId(String topicId);
/** /**
* 根据评论ID查询评论内容 * 根据评论ID查询话题内容
* @param commentId * @param commentId
* @return * @return
*/ */
String getCommentContentByCommentId(String commentId); SysServicesTopic getTopicContentByCommentId(String commentId);
/** /**
* 查询回复内容 * 根据角色和话题ID查询对应status表中的ID
* @param replyId * @param topicId
* @param role
* @return * @return
*/ */
String getReplyContentByReplyId(String replyId); Long getStatusIdByRoleAndTopicId(@Param("topicId")String topicId, @Param("role")String role);
} }

View File

@ -114,7 +114,7 @@ public interface ISysMessageNoticeService
* @param type 类型 1评论 2回复 * @param type 类型 1评论 2回复
* @param originalContent 话题内容或被回复的内容 * @param originalContent 话题内容或被回复的内容
*/ */
public void sendTopicMessage(SysServicesTopic topic, int type, String originalContent); public void sendTopicMessage(SysServicesTopic topic, int type, Long statusId, String originalContent);
/** /**
* 根据客户ID查询打卡点评消息以及未读消息数量包含点评营养师信息客户信息点评内容 * 根据客户ID查询打卡点评消息以及未读消息数量包含点评营养师信息客户信息点评内容

View File

@ -206,7 +206,7 @@ public class SysMessageNoticeServiceImpl implements ISysMessageNoticeService {
*/ */
@Override @Override
@Async @Async
public void sendTopicMessage(SysServicesTopic topic, int type, String originalContent) { public void sendTopicMessage(SysServicesTopic topic, int type, Long statusId, String originalContent) {
if (topic == null) { if (topic == null) {
return; return;
} }
@ -215,12 +215,12 @@ public class SysMessageNoticeServiceImpl implements ISysMessageNoticeService {
content.put("replyContent", topic.getContent()); content.put("replyContent", topic.getContent());
//类型1 评论 2回复 //类型1 评论 2回复
content.put("type", type); content.put("type", type);
//评论或回复的ID //话题对应的状态已读未读ID
content.put("id", topic.getId()); content.put("id", statusId);
//评论ID //评论ID
content.put("commentId", topic.getCommentId()); //content.put("commentId", topic.getCommentId());
//回复ID //回复ID
content.put("replyId", topic.getReplyId()); //content.put("replyId", topic.getReplyId());
//topic的内容 //topic的内容
content.put("originalContent", originalContent); content.put("originalContent", originalContent);

View File

@ -149,16 +149,23 @@ public class SysServicesTopicServiceImp implements ISysServicesTopicService {
status.setRole(topic.getRole()); status.setRole(topic.getRole());
servicesTopicMapper.updateSysServicesTopicStatus(status); 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())){ if("customer".equals(topic.getToRole()) && StringUtils.isNotEmpty(topic.getToUid())){
String content = ""; String content = "";
if(StringUtils.isNotEmpty(topic.getReplyId()) ){ Long statusId = 0L;
content = servicesTopicMapper.getReplyContentByReplyId(topic.getReplyId()); if(StringUtils.isNotEmpty(topic.getCommentId())){
}else if(StringUtils.isNotEmpty(topic.getCommentId())){ SysServicesTopic tp = servicesTopicMapper.getTopicContentByCommentId(topic.getCommentId());
content = servicesTopicMapper.getCommentContentByCommentId(topic.getReplyId()); if(tp != null){
content = tp.getContent();
//查询客户对象status表的id
statusId = servicesTopicMapper.getStatusIdByRoleAndTopicId(tp.getTopicId(), topic.getToRole());
}
} }
if(StringUtils.isNotEmpty(content)){ 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())){ if("customer".equals(topic.getToRole()) && StringUtils.isNotEmpty(topic.getToUid())){
//查询topic内容 //查询topic内容
String content = servicesTopicMapper.getTopicContentByTopicId(topic.getTopicId()); String content = servicesTopicMapper.getTopicContentByTopicId(topic.getTopicId());
//查询客户对象status表的id
Long statusId = servicesTopicMapper.getStatusIdByRoleAndTopicId(topic.getTopicId(), topic.getToRole());
if(StringUtils.isNotEmpty(content)){ if(StringUtils.isNotEmpty(content)){
sysMessageNoticeService.sendTopicMessage(topic, 1, content); sysMessageNoticeService.sendTopicMessage(topic, 1, statusId, content);
} }
} }

View File

@ -331,13 +331,13 @@
select content from sys_services_topic where topic_id = #{topicId} limit 1 select content from sys_services_topic where topic_id = #{topicId} limit 1
</select> </select>
<!-- 根据CommentId查询评论内容 --> <!-- 根据CommentId查询话题内容 -->
<select id="getCommentContentByCommentId" resultType="String" parameterType="String"> <select id="getTopicContentByCommentId" resultType="SysServicesTopic" parameterType="String">
select content from sys_services_topic_comment where id = #{commentId} 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> </select>
<!-- 根据replyId查询回复内容 --> <!-- 根据角色和话题ID查询对应消息状态ID -->
<select id="getReplyContentByReplyId" resultType="String" parameterType="String"> <select id="getStatusIdByRoleAndTopicId" parameterType="String" resultType="Long">
select content from sys_services_topic_reply where id = #{replyId} limit 1 select id from sys_services_topic_status where topic_id = #{topicId} and role = #{role} limit 1
</select> </select>
</mapper> </mapper>