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);
/**
* 根据评论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);
}

View File

@ -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查询打卡点评消息以及未读消息数量包含点评营养师信息客户信息点评内容

View File

@ -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);

View File

@ -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);
}
}

View File

@ -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>