diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysWxUserLogController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysWxUserLogController.java index 9d8872060..102f99f8b 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysWxUserLogController.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysWxUserLogController.java @@ -10,6 +10,7 @@ import com.stdiet.common.utils.DateUtils; import com.stdiet.common.utils.StringUtils; import com.stdiet.common.utils.oss.AliyunOSSUtils; import com.stdiet.common.utils.poi.ExcelUtil; +import com.stdiet.custom.domain.SysCustomer; import com.stdiet.custom.domain.SysWxUserInfo; import com.stdiet.custom.domain.SysWxUserLog; import com.stdiet.custom.page.WxLogInfo; @@ -223,4 +224,16 @@ public class SysWxUserLogController extends BaseController { } return toAjax(row); } + + /** + * 查询指定日期未打卡用户 + */ + @PreAuthorize("@ss.hasPermi('custom:wxUserLog:list')") + @GetMapping("/selectNotPunchCustomerByDate") + public TableDataInfo selectNotPunchCustomerByDate(SysCustomer sysCustomer) { + startPage(); + List list = sysWxUserLogService.selectNotPunchCustomerByDate(sysCustomer); + return getDataTable(list); + } + } \ No newline at end of file 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 40c237b27..831ffb41f 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 @@ -754,6 +754,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()); @@ -904,6 +908,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/SysRecipesTemplate.java b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysRecipesTemplate.java index 852575c92..22bdae692 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysRecipesTemplate.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysRecipesTemplate.java @@ -1,6 +1,7 @@ package com.stdiet.custom.domain; import com.fasterxml.jackson.annotation.JsonFormat; +import com.stdiet.common.annotation.Excel; import lombok.Data; import java.util.Date; @@ -21,6 +22,9 @@ public class SysRecipesTemplate { Long planId; + /** 关键词,使用 , 隔开 */ + private String keyWord; + String remark; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") 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/mapper/SysWxUserLogMapper.java b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysWxUserLogMapper.java index 807424cde..db01015a4 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysWxUserLogMapper.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysWxUserLogMapper.java @@ -2,9 +2,11 @@ package com.stdiet.custom.mapper; import java.util.List; +import com.stdiet.custom.domain.SysCustomer; import com.stdiet.custom.domain.SysWxUserInfo; import com.stdiet.custom.domain.SysWxUserLog; import com.stdiet.custom.dto.response.CommunityPunchReponse; +import com.stdiet.custom.dto.response.CustomerListResponse; import com.stdiet.custom.page.WxLogInfo; /** @@ -115,4 +117,10 @@ public interface SysWxUserLogMapper */ int getPunchCustomerTotalNum(); + /** + * 根据日期、营养师、助理、售后查询指定日期未打卡的客户信息 + * @return + */ + List selectNotPunchCustomerByDate(SysCustomer sysCustomer); + } \ No newline at end of file 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/ISysWxUserLogService.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysWxUserLogService.java index 5903d99e3..8df270c91 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysWxUserLogService.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysWxUserLogService.java @@ -2,6 +2,7 @@ package com.stdiet.custom.service; import java.util.List; +import com.stdiet.custom.domain.SysCustomer; import com.stdiet.custom.domain.SysWxUserInfo; import com.stdiet.custom.domain.SysWxUserLog; import com.stdiet.custom.dto.response.CommunityPunchReponse; @@ -117,4 +118,10 @@ public interface ISysWxUserLogService */ int getPunchCustomerTotalNum(); + /** + * 根据日期、营养师、助理、售后查询指定日期未打卡的客户信息 + * @return + */ + List selectNotPunchCustomerByDate(SysCustomer sysCustomer); + } \ No newline at end of file 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/java/com/stdiet/custom/service/impl/SysWxUserLogServiceImpl.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysWxUserLogServiceImpl.java index bdaf62794..eb8e1d202 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysWxUserLogServiceImpl.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysWxUserLogServiceImpl.java @@ -1,5 +1,6 @@ package com.stdiet.custom.service.impl; +import com.stdiet.custom.domain.SysCustomer; import com.stdiet.custom.domain.SysWxUserLog; import com.stdiet.custom.dto.response.CommunityPunchReponse; import com.stdiet.custom.mapper.SysWxUserLogMapper; @@ -171,4 +172,14 @@ public class SysWxUserLogServiceImpl implements ISysWxUserLogService { return sysWxUserLogMapper.getPunchCustomerTotalNum(); } + /** + * 根据日期、营养师、助理、售后查询指定日期未打卡的客户信息 + * + * @return + */ + @Override + public List selectNotPunchCustomerByDate(SysCustomer sysCustomer) { + return sysWxUserLogMapper.selectNotPunchCustomerByDate(sysCustomer); + } + } \ No newline at end of file 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/SysRecipesTemplateMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysRecipesTemplateMapper.xml index 98d612f0d..052247487 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysRecipesTemplateMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysRecipesTemplateMapper.xml @@ -10,6 +10,7 @@ + @@ -23,7 +24,7 @@ select count(1) from sys_services_topic where del_flag = 0 and uid = #{cusId} + + + + + + + + + \ No newline at end of file diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysWxUserLogMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysWxUserLogMapper.xml index 804c7d274..0ae0f26e4 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysWxUserLogMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysWxUserLogMapper.xml @@ -465,5 +465,35 @@ select count(wxlog.openid) from sys_wx_user_log wxlog where wxlog.del_flag = 0 and to_days(log_time) = to_days(now()) + + + \ No newline at end of file diff --git a/stdiet-ui/src/api/custom/wxUserLog.js b/stdiet-ui/src/api/custom/wxUserLog.js index cbaeb5abf..621eadc34 100644 --- a/stdiet-ui/src/api/custom/wxUserLog.js +++ b/stdiet-ui/src/api/custom/wxUserLog.js @@ -79,6 +79,17 @@ export function commentPunchContent(data) { }) } +// 查询未打卡用户列表 +export function getNotPunchCustomer(query) { + return request({ + url: '/custom/wxUserLog/selectNotPunchCustomerByDate', + method: 'get', + params: query + }) +} + + + diff --git a/stdiet-ui/src/components/PunchLog/NotPunchCustomer/index.vue b/stdiet-ui/src/components/PunchLog/NotPunchCustomer/index.vue new file mode 100644 index 000000000..a79a05f46 --- /dev/null +++ b/stdiet-ui/src/components/PunchLog/NotPunchCustomer/index.vue @@ -0,0 +1,208 @@ + + + + diff --git a/stdiet-ui/src/components/TemplateDialog/index.vue b/stdiet-ui/src/components/TemplateDialog/index.vue index 3b53f2f57..8c700337a 100644 --- a/stdiet-ui/src/components/TemplateDialog/index.vue +++ b/stdiet-ui/src/components/TemplateDialog/index.vue @@ -29,6 +29,27 @@ > + + + + + + + { - if (valid) { + if (valid && this.checkFormat(this.form.keyWordArray)) { + this.form.keyWord = (this.form.keyWordArray != null && this.form.keyWordArray.length > 0) ? this.form.keyWordArray.join(",") : null; + this.form.keyWord = this.form.keyWord.replace(",",","); this.$emit("onConfirm", this.form); this.visible = false; } @@ -108,12 +144,30 @@ export default { nutriAssisId: null, nutritionistId: null, remark: null, + keyWordArray: null, + keyWord: null }; this.resetForm("form"); }, cancel() { this.visible = false; }, + checkFormat(keyWordArray){ + let flag = true; + let msg = ""; + if(keyWordArray != null && keyWordArray.length > 0){ + keyWordArray.forEach((item,index) => { + if(item.indexOf(",") != -1 || item.indexOf(",") != -1 || item.indexOf(" ") != -1){ + msg = "关键词中不能含有逗号和空格"; + flag = false; + } + }); + } + if(!flag){ + this.msgError(msg); + } + return flag; + } }, }; diff --git a/stdiet-ui/src/views/custom/recipesBuild/RecommendView/TemplateView/index.vue b/stdiet-ui/src/views/custom/recipesBuild/RecommendView/TemplateView/index.vue index d8cdee2f9..7eaf859ec 100644 --- a/stdiet-ui/src/views/custom/recipesBuild/RecommendView/TemplateView/index.vue +++ b/stdiet-ui/src/views/custom/recipesBuild/RecommendView/TemplateView/index.vue @@ -8,11 +8,22 @@ - + + + - + + + + + + import { listRecipesTemplate } from "@/api/custom/recipesTemplate"; import { mapState } from "vuex"; +import AutoHideMessage from "@/components/AutoHideMessage"; export default { name: "TemplateView", data() { @@ -97,9 +118,13 @@ export default { pageNum: 1, pageSize: 10, reviewStatus: 2, + keys: null }, }; }, + components:{ + AutoHideMessage + }, props: ["view"], computed: { ...mapState({ @@ -119,6 +144,7 @@ export default { /** 重置按钮操作 */ resetQuery() { this.resetForm("queryForm"); + this.queryParams.keys = null; this.handleQuery(); }, handleOnBackClick() { @@ -132,7 +158,7 @@ export default { getList() { this.loading = true; const params = JSON.parse(JSON.stringify(this.queryParams)); - params.keys = (params.name || "").split(" "); + //params.keys = (params.name || "").split(" "); listRecipesTemplate(params).then((res) => { if (res.code === 200) { this.dataList = res.rows; diff --git a/stdiet-ui/src/views/custom/recipesTemplate/index.vue b/stdiet-ui/src/views/custom/recipesTemplate/index.vue index c3ef7d801..0c69d6fbd 100644 --- a/stdiet-ui/src/views/custom/recipesTemplate/index.vue +++ b/stdiet-ui/src/views/custom/recipesTemplate/index.vue @@ -7,11 +7,28 @@ v-show="showSearch" > - + />--> + + + + + + + + + + - { + response.rows.forEach((item,index) => { + item.keyWordArray = (item.keyWord != null && item.keyWord != "") ? item.keyWord.split(",") : []; + }); this.recipesTemplateList = response.rows; this.total = response.total; this.loading = false; @@ -289,6 +331,7 @@ export default { /** 重置按钮操作 */ resetQuery() { this.resetForm("queryForm"); + this.queryParams.keys = null; this.handleQuery(); }, getReviewStatusName(status) { diff --git a/stdiet-ui/src/views/custom/wxUserLog/index.vue b/stdiet-ui/src/views/custom/wxUserLog/index.vue index b1c034ccd..4c1a87f42 100644 --- a/stdiet-ui/src/views/custom/wxUserLog/index.vue +++ b/stdiet-ui/src/views/custom/wxUserLog/index.vue @@ -81,16 +81,15 @@ - + @@ -298,6 +297,8 @@ + + @@ -314,6 +315,7 @@ import { mapGetters } from "vuex"; import PunchLogDetail from "@/components/PunchLog/PunchLogDetail"; import PunchLogEdit from "@/components/PunchLog/PunchLogEdit"; import AutoHideMessage from "@/components/AutoHideMessage"; +import NotPunchCustomer from "@/components/PunchLog/NotPunchCustomer" import dayjs from "dayjs"; export default { name: "WxUserLog", @@ -369,7 +371,7 @@ export default { }; }, components:{ - PunchLogDetail,AutoHideMessage,PunchLogEdit + PunchLogDetail,AutoHideMessage,PunchLogEdit,NotPunchCustomer }, created() { this.getList(); @@ -563,6 +565,10 @@ export default { }) .catch(function () {}); }, + showNotLunch(){ + this.queryParams.startDate = this.logTimeScope && this.logTimeScope.length > 0 ? this.logTimeScope[0] : null; + this.$refs.notPunchCustomerRef.showDialog(this.queryParams, this.nutritionistIdOptions,this.afterSaleIdOptions); + } }, };