From 1f5fe096397a7bb04716d26907af6566a6c24881 Mon Sep 17 00:00:00 2001 From: xiezhijun <15270898033@163.com> Date: Wed, 4 Aug 2021 15:48:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E4=B8=AD=E5=BF=83=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../custom/WechatAppletController.java | 39 +++++ .../domain/entityEnum/MessageNoticeEnum.java | 6 +- .../custom/mapper/SysMessageNoticeMapper.java | 57 +++++++ .../custom/mapper/SysServicesTopicMapper.java | 21 +++ .../service/ISysMessageNoticeService.java | 46 +++++ .../service/ISysServicesTopicService.java | 7 + .../impl/SysMessageNoticeServiceImpl.java | 161 +++++++++++++++++- .../impl/SysRecipesPlanServiceImpl.java | 6 + .../impl/SysServicesTopicServiceImp.java | 35 ++++ .../mapper/custom/SysCustomerMapper.xml | 32 +++- .../mapper/custom/SysMessageNoticeMapper.xml | 73 ++++++++ .../mapper/custom/SysServicesTopicMapper.xml | 15 ++ 12 files changed, 488 insertions(+), 10 deletions(-) diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WechatAppletController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WechatAppletController.java index 381eb20eb..af9c67524 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WechatAppletController.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WechatAppletController.java @@ -738,6 +738,10 @@ public class WechatAppletController extends BaseController { sysPunchThumbsup.setPunchId(Long.parseLong(AesUtils.decrypt(sysPunchThumbsup.getEncPunchId()))); rows = sysPunchThumbsupService.insertSysPunchThumbsup(sysPunchThumbsup); if (rows > 0) { + //发送点赞消息 + SysWxUserLog sysWxUserLog = sysWxUserLogService.selectSysWxUserLogById(sysPunchThumbsup.getPunchId()+""); + sysMessageNoticeService.sendpunchDynamicThumbsUpMessage(sysWxUserLog, sysPunchThumbsup.getCusOpenid()); + Map resultData = new HashMap<>(); resultData.put("id", AesUtils.encrypt(String.valueOf(sysPunchThumbsup.getId()))); resultData.put("openid", sysPunchThumbsup.getCusOpenid()); @@ -888,6 +892,41 @@ public class WechatAppletController extends BaseController { return AjaxResult.success(reply); } + + /** + * 查询消息列表 + * @param cusId 客户ID + * @param messageType 0 查询全部 1 查询打卡点评消息 2 打卡动态点赞消息 3 服务消息(食谱更新、执行反馈消息) + * @return + */ + @GetMapping("/getMessageNoticeData") + public AjaxResult getMessageNoticeList(@RequestParam("cusId")String cusId, @RequestParam(value = "messageType", required = false, defaultValue = "0")Integer messageType) { + cusId = StringUtils.isNotEmpty(cusId) ? AesUtils.decrypt(cusId) : "0"; + Map result = new HashMap<>(); + //查询打卡消息 + if(messageType.intValue() == 0 || messageType.intValue() == 1){ + startPage(); + Map punchResult = sysMessageNoticeService.getPunchCommentMessageByCusId(Long.parseLong(cusId)); + List> list = (List>)punchResult.get("data"); + punchResult.put("data",getDataTable(list)); + result.put("punchMessageData", punchResult); + } + if(messageType.intValue() == 0 || messageType.intValue() == 2){ + startPage(); + Map thumbsUpResult = sysMessageNoticeService.getPunchDynamicThumbsUpMessage(Long.parseLong(cusId)); + List> list = (List>)thumbsUpResult.get("data"); + thumbsUpResult.put("data",getDataTable(list)); + result.put("thumbsUpMessageData", thumbsUpResult); + } + if(messageType.intValue() == 0 || messageType.intValue() == 3){ + startPage(); + Map serviceResult = sysMessageNoticeService.getServiceMessage(Long.parseLong(cusId)); + List> list = (List>)serviceResult.get("data"); + serviceResult.put("data",getDataTable(list)); + result.put("serviceMessageData", serviceResult); + } + return AjaxResult.success(result); + } } diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/domain/entityEnum/MessageNoticeEnum.java b/stdiet-custom/src/main/java/com/stdiet/custom/domain/entityEnum/MessageNoticeEnum.java index 8c51636f8..275cf2e25 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/domain/entityEnum/MessageNoticeEnum.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/domain/entityEnum/MessageNoticeEnum.java @@ -3,8 +3,10 @@ package com.stdiet.custom.domain.entityEnum; public enum MessageNoticeEnum{ systemMessage("系统通知", 0, 0, "系统通知"), - punchComment("打卡点评", 1, 1, "%s打卡点评"); //%s 为打卡时间 - + punchComment("打卡点评", 1, 1, "%s打卡点评"), //%s 为打卡时间 + punchDynamicThumbsUp("打卡动态点赞", 1, 2, ""), + recipesPlanMessage("食谱更新通知", 1, 3, ""), + topicMessage("执行反馈通知", 1, 4, ""); //消息名称 private String name; diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysMessageNoticeMapper.java b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysMessageNoticeMapper.java index 7f69ad171..bbf810e6f 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysMessageNoticeMapper.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysMessageNoticeMapper.java @@ -1,8 +1,11 @@ package com.stdiet.custom.mapper; import java.util.List; +import java.util.Map; + import com.stdiet.custom.domain.SysMessageNotice; import com.stdiet.custom.dto.response.MessageNoticeResponse; +import org.apache.ibatis.annotations.Param; /** * 客户消息通知Mapper接口 @@ -73,4 +76,58 @@ public interface SysMessageNoticeMapper * @return */ public int getCustomerMessageCount(SysMessageNotice sysMessageNotice); + + /** + * 根据客户ID查询打卡点评消息(包含点评营养师信息、客户信息、点评内容) + * @param cusId 客户ID + * @return + */ + List> getPunchCommentMessageByCusId(@Param("cusId")Long cusId); + + /** + * 查询打卡点评未读消息数量 + * @param cusId 客户ID + * @return + */ + int getUnReadPunchMessageNum(@Param("cusId")Long cusId); + + /** + * 根据打卡ID和openid查询点赞消息 + * @param punchId 打卡ID + * @param openid 点赞用户openid + * @return + */ + SysMessageNotice getMessageByPunchIdAndOpenId(@Param("punchId")Long punchId, @Param("openid")String openid); + + /** + * 根据客户ID查询点赞消息列表 + * @param cusId 客户ID + * @return + */ + List> getPunchDynamicThumbsUpMessage(Long cusId); + + /** + * 查询未读点赞数量 + * @param cusId 客户ID + * @return + */ + int getUnReadThumbsUpMessageNum(Long cusId); + + /** + * 根据消息类型、客户ID、消息关键词查询消息 + */ + SysMessageNotice getMessageByCusIdAndTypeKey(SysMessageNotice sysMessageNotice); + + /** + * 根据客户ID查询服务消息(食谱发送消息、执行反馈回复消息) + * @return + */ + List> getServiceMessage(Long cusId); + + /** + * 根据客户ID查询未读服务消息数量 + * @param cusId + * @return + */ + int getUnReadServiceMessageNum(Long cusId); } \ No newline at end of file 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 ee93cf6d7..2df2bd5ca 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 @@ -32,4 +32,25 @@ public interface SysServicesTopicMapper { * @return */ int getServicesTopicNum(@Param("cusId")Long cusId); + + /** + * 根据topicId查询内容 + * @param topicId + * @return + */ + String getTopicContentByTopicId(String topicId); + + /** + * 根据评论ID查询评论内容 + * @param commentId + * @return + */ + String getCommentContentByCommentId(String commentId); + + /** + * 查询回复内容 + * @param replyId + * @return + */ + String getReplyContentByReplyId(String replyId); } 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 7349e0ec6..3893c32e1 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 @@ -1,10 +1,15 @@ package com.stdiet.custom.service; import java.util.List; +import java.util.Map; + import com.stdiet.custom.domain.SysMessageNotice; +import com.stdiet.custom.domain.SysRecipesPlan; +import com.stdiet.custom.domain.SysServicesTopic; import com.stdiet.custom.domain.SysWxUserLog; import com.stdiet.custom.domain.entityEnum.MessageNoticeEnum; import com.stdiet.custom.dto.response.MessageNoticeResponse; +import org.apache.ibatis.annotations.Param; /** * 客户消息通知Service接口 @@ -89,4 +94,45 @@ public interface ISysMessageNoticeService * @param sysWxUserLog */ public void sendPunchCommentMessage(SysWxUserLog sysWxUserLog); + + /** + * 发送打卡动态点赞消息 + * @param sysWxUserLog + * @param openId 点赞用户openid + */ + public void sendpunchDynamicThumbsUpMessage(SysWxUserLog sysWxUserLog, String openId); + + /** + * 发送食谱消息 + * @param sysRecipesPlan + */ + public void sendRecipesPlanMessage(SysRecipesPlan sysRecipesPlan); + + /** + * 发送执行反馈话题消息 + * @param topic 话题对象 + * @param type 类型 1评论 2回复 + * @param originalContent 话题内容或被回复的内容 + */ + public void sendTopicMessage(SysServicesTopic topic, int type, String originalContent); + + /** + * 根据客户ID查询打卡点评消息以及未读消息数量(包含点评营养师信息、客户信息、点评内容) + * @param cusId 客户ID + * @return + */ + Map getPunchCommentMessageByCusId(Long cusId); + + /** + * 根据客户ID查询点赞消息列表 + * @param cusId 客户ID + * @return + */ + Map getPunchDynamicThumbsUpMessage(Long cusId); + + /** + * 根据客户ID查询服务消息(食谱发送消息、执行反馈回复消息) + * @return + */ + Map getServiceMessage(Long cusId); } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysServicesTopicService.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysServicesTopicService.java index 4a24aa401..4ff5242f5 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysServicesTopicService.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysServicesTopicService.java @@ -30,4 +30,11 @@ public interface ISysServicesTopicService { * @return */ int getServicesTopicNum(Long cusId); + + /** + * 根据topicId查询内容 + * @param topicId + * @return + */ + String getTopicContentByTopicId(String topicId); } 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 a5110a50a..44cc4baa6 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 @@ -1,11 +1,13 @@ package com.stdiet.custom.service.impl; -import java.util.Date; +import java.util.HashMap; import java.util.List; +import java.util.Map; + +import com.alibaba.fastjson.JSONArray; import com.stdiet.common.utils.DateUtils; import com.stdiet.common.utils.StringUtils; -import com.stdiet.custom.domain.SysCustomer; -import com.stdiet.custom.domain.SysWxUserLog; +import com.stdiet.custom.domain.*; import com.stdiet.custom.domain.entityEnum.MessageNoticeEnum; import com.stdiet.custom.dto.response.MessageNoticeResponse; import com.stdiet.custom.service.ISysCustomerService; @@ -13,7 +15,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import com.stdiet.custom.mapper.SysMessageNoticeMapper; -import com.stdiet.custom.domain.SysMessageNotice; import com.stdiet.custom.service.ISysMessageNoticeService; /** @@ -151,7 +152,7 @@ public class SysMessageNoticeServiceImpl implements ISysMessageNoticeService @Override @Async public void sendPunchCommentMessage(SysWxUserLog sysWxUserLog){ - if(sysWxUserLog == null || StringUtils.isEmpty(sysWxUserLog.getOpenid())){ + if(sysWxUserLog == null || StringUtils.isEmpty(sysWxUserLog.getOpenid()) || sysWxUserLog.getId() == null){ return; } SysCustomer sysCustomer = sysCustomerService.getCustomerByOpenId(sysWxUserLog.getOpenid()); @@ -161,9 +162,157 @@ public class SysMessageNoticeServiceImpl implements ISysMessageNoticeService sysMessageNotice.setMessageType(MessageNoticeEnum.punchComment.getType()); sysMessageNotice.setReadType(0); sysMessageNotice.setMessageCustomer(sysCustomer.getId()); - sysMessageNotice.setMessageTitle(String.format(MessageNoticeEnum.punchComment.getTitleTemplate(), DateUtils.dateTime(sysWxUserLog.getLogTime()))); + sysMessageNotice.setMessageTitle(""); sysMessageNotice.setMessageContent(sysWxUserLog.getComment()); + sysMessageNotice.setMessageKey(sysWxUserLog.getId()+""); sendMessageNoticeToCustomer(MessageNoticeEnum.punchComment, sysMessageNotice); } } + + /** + * 发送打卡动态点赞消息 + * @param sysWxUserLog + * @param openId 点赞用户openid + */ + @Override + @Async + public void sendpunchDynamicThumbsUpMessage(SysWxUserLog sysWxUserLog, String openId){ + if(sysWxUserLog == null || StringUtils.isEmpty(sysWxUserLog.getOpenid()) || sysWxUserLog.getId() == null){ + return; + } + //自己给自己点赞不发送消息 + if(sysWxUserLog.getOpenid().equals(openId)){ + return; + } + SysCustomer sysCustomer = sysCustomerService.getCustomerByOpenId(sysWxUserLog.getOpenid()); + if(sysCustomer != null){ + //根据openid、打卡ID查询是否已经存在点赞消息 + SysMessageNotice existSysMessageNotice = sysMessageNoticeMapper.getMessageByPunchIdAndOpenId(sysWxUserLog.getId(), openId); + if(existSysMessageNotice != null){ + return; + } + SysMessageNotice sysMessageNotice = new SysMessageNotice(); + sysMessageNotice.setMessageProperty(1); + sysMessageNotice.setMessageType(MessageNoticeEnum.punchDynamicThumbsUp.getType()); + sysMessageNotice.setReadType(0); + sysMessageNotice.setMessageCustomer(sysCustomer.getId()); + sysMessageNotice.setMessageTitle(""); + sysMessageNotice.setMessageContent(openId); + sysMessageNotice.setMessageKey(sysWxUserLog.getId()+""); + sendMessageNoticeToCustomer(MessageNoticeEnum.punchDynamicThumbsUp, sysMessageNotice); + } + } + + /** + * 发送执行反馈消息 + */ + @Override + @Async + public void sendTopicMessage(SysServicesTopic topic, int type, String originalContent){ + if(topic == null){ + return; + } + Map content = new HashMap<>(); + //回复内容 + content.put("replyContent", topic.getContent()); + //类型:1 评论 2回复 + content.put("type", type); + //topic的内容 + content.put("originalContent", originalContent); + + SysMessageNotice sysMessageNotice = new SysMessageNotice(); + sysMessageNotice.setMessageProperty(1); + sysMessageNotice.setMessageType(MessageNoticeEnum.topicMessage.getType()); + sysMessageNotice.setReadType(0); + sysMessageNotice.setMessageCustomer(Long.parseLong(topic.getToUid())); + sysMessageNotice.setMessageTitle(""); + sysMessageNotice.setMessageContent(JSONArray.toJSONString(content)); + sysMessageNotice.setMessageKey(topic.getTopicId()); + sendMessageNoticeToCustomer(MessageNoticeEnum.topicMessage, sysMessageNotice); + } + + /** + * 发送食谱更新消息 + */ + @Override + @Async + public void sendRecipesPlanMessage(SysRecipesPlan sysRecipesPlan){ + if(sysRecipesPlan == null || sysRecipesPlan.getCusId() == null || sysRecipesPlan.getRecipesId() == null){ + return; + } + SysMessageNotice sysMessageNotice = new SysMessageNotice(); + sysMessageNotice.setMessageType(MessageNoticeEnum.recipesPlanMessage.getType()); + sysMessageNotice.setMessageKey(sysRecipesPlan.getRecipesId()+""); + sysMessageNotice.setMessageCustomer(sysRecipesPlan.getCusId()); + //根据食谱ID查询是否已经发送过 + SysMessageNotice existMessageNotice = sysMessageNoticeMapper.getMessageByCusIdAndTypeKey(sysMessageNotice); + if(existMessageNotice != null){ + return; + } + sysMessageNotice.setMessageProperty(1); + sysMessageNotice.setReadType(0); + sysMessageNotice.setMessageTitle(""); + Map content = new HashMap<>(); + content.put("startNumDay", sysRecipesPlan.getStartNumDay()); + content.put("endNumDay", sysRecipesPlan.getEndNumDay()); + sysMessageNotice.setMessageContent(JSONArray.toJSONString(content)); + sendMessageNoticeToCustomer(MessageNoticeEnum.recipesPlanMessage, sysMessageNotice); + } + + /** + * 根据客户ID查询打卡点评消息以及未读消息数量(包含点评营养师信息、客户信息、点评内容) + * @param cusId 客户ID + * @return + */ + @Override + public Map getPunchCommentMessageByCusId(Long cusId){ + List> punchMessageList = sysMessageNoticeMapper.getPunchCommentMessageByCusId(cusId); + int unReadPunchMessageNum = 0; + if(punchMessageList != null && punchMessageList.size() > 0){ + //查询未读消息 + unReadPunchMessageNum = sysMessageNoticeMapper.getUnReadPunchMessageNum(cusId); + } + + Map result = new HashMap<>(); + result.put("data", punchMessageList); + result.put("unReadNum", unReadPunchMessageNum); + return result; + } + + /** + * 根据客户ID查询点赞消息列表 + * @param cusId 客户ID + * @return + */ + @Override + public Map getPunchDynamicThumbsUpMessage(Long cusId){ + List> thumbsUpMessageList = sysMessageNoticeMapper.getPunchDynamicThumbsUpMessage(cusId); + int unReadThumbsUpMessageNum = 0; + if(thumbsUpMessageList != null && thumbsUpMessageList.size() > 0){ + //查询未读消息 + unReadThumbsUpMessageNum = sysMessageNoticeMapper.getUnReadThumbsUpMessageNum(cusId); + } + Map result = new HashMap<>(); + result.put("data", thumbsUpMessageList); + result.put("unReadNum", unReadThumbsUpMessageNum); + return result; + } + + /** + * 根据客户ID查询服务消息(食谱发送消息、执行反馈回复消息) + * @return + */ + @Override + public Map getServiceMessage(Long cusId){ + List> serviceMessageList = sysMessageNoticeMapper.getServiceMessage(cusId); + int unReadServiceMessageNum = 0; + if(serviceMessageList != null && serviceMessageList.size() > 0){ + //查询未读消息 + unReadServiceMessageNum = sysMessageNoticeMapper.getUnReadServiceMessageNum(cusId); + } + Map result = new HashMap<>(); + result.put("data", serviceMessageList); + result.put("unReadNum", unReadServiceMessageNum); + return result; + } } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysRecipesPlanServiceImpl.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysRecipesPlanServiceImpl.java index 5b4d6ab56..3b840d2aa 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysRecipesPlanServiceImpl.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysRecipesPlanServiceImpl.java @@ -44,6 +44,8 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService { private ISysCustomerService sysCustomerService; @Autowired private SysRecipesMapper sysRecipesMapper; + @Autowired + private ISysMessageNoticeService sysMessageNoticeService; //2021-06-11之后(大于等于)成交的订单,只生成定金单食谱计划,不生成尾款食谱计划,之前成交的订单还是保持之前逻辑 public static final LocalDate newVersionPlanStartDate = DateUtils.stringToLocalDate("2021-06-01", "yyyy-MM-dd"); @@ -117,6 +119,10 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService { sysRecipesPlan.setSmsSend(1); } } + //发送食谱消息 + if(StringUtils.isNotNull(recipesPlan)) { + sysMessageNoticeService.sendRecipesPlanMessage(recipesPlan); + } } } 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 898a18a29..23d9096c6 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 @@ -10,6 +10,7 @@ import com.stdiet.custom.domain.SysWxUserInfo; import com.stdiet.custom.mapper.SysCustomerMapper; import com.stdiet.custom.mapper.SysServicesTopicMapper; import com.stdiet.custom.server.WebSocketServer; +import com.stdiet.custom.service.ISysMessageNoticeService; import com.stdiet.custom.service.ISysServicesTopicService; import com.stdiet.custom.service.ISysWxUserInfoService; import com.stdiet.custom.utils.WsUtils; @@ -31,6 +32,9 @@ public class SysServicesTopicServiceImp implements ISysServicesTopicService { @Autowired ISysWxUserInfoService iSysWxUserInfoService; + @Autowired + ISysMessageNoticeService sysMessageNoticeService; + @Override public List selectSysServicesTopicByUserIdAndRole(SysServicesTopic topic) { return servicesTopicMapper.selectSysServicesTopicByUserIdAndRole(topic); @@ -145,6 +149,19 @@ public class SysServicesTopicServiceImp implements ISysServicesTopicService { status.setRole(topic.getRole()); servicesTopicMapper.updateSysServicesTopicStatus(status); + //发送消息 + 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()); + } + if(StringUtils.isNotEmpty(content)){ + sysMessageNoticeService.sendTopicMessage(topic, 2, content); + } + } + afterReply(topic); } return topic; @@ -164,6 +181,15 @@ public class SysServicesTopicServiceImp implements ISysServicesTopicService { status.setRole(topic.getRole()); servicesTopicMapper.updateSysServicesTopicStatus(status); + //发送消息 + if("customer".equals(topic.getToRole()) && StringUtils.isNotEmpty(topic.getToUid())){ + //查询topic内容 + String content = servicesTopicMapper.getTopicContentByTopicId(topic.getTopicId()); + if(StringUtils.isNotEmpty(content)){ + sysMessageNoticeService.sendTopicMessage(topic, 1, content); + } + } + afterReply(topic); } return topic; @@ -229,4 +255,13 @@ public class SysServicesTopicServiceImp implements ISysServicesTopicService { public int getServicesTopicNum(Long cusId){ return servicesTopicMapper.getServicesTopicNum(cusId); } + + /** + * 根据topicId查询内容 + * @param topicId + * @return + */ + public String getTopicContentByTopicId(String topicId){ + return servicesTopicMapper.getTopicContentByTopicId(topicId); + } } diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerMapper.xml index fcde93fbb..0d9f38a16 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerMapper.xml @@ -202,9 +202,37 @@ where phone = #{phone} and del_flag = 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + - + select sc.id, sc.name, sc.phone, sc.main_dietitian, sc.assistant_dietitian, sc.after_dietitian, sc.salesman, sc.on_sale_id + from sys_customer sc left join sys_wx_user_info wu on wu.phone = sc.phone where wu.openid = #{openid} and sc.del_flag = 0 order by sc.id desc limit 1 diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysMessageNoticeMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysMessageNoticeMapper.xml index e7377f342..0a8684878 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysMessageNoticeMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysMessageNoticeMapper.xml @@ -141,4 +141,77 @@ and smn.message_type = #{messageType} + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysServicesTopicMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysServicesTopicMapper.xml index 404f0c8e8..29545a6b4 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysServicesTopicMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysServicesTopicMapper.xml @@ -325,4 +325,19 @@ + + + + + + + + + \ No newline at end of file