!342 修复图片导出问题

Merge pull request !342 from 德仔/develop
This commit is contained in:
德仔 2021-08-06 07:03:38 +00:00 committed by Gitee
commit dd02be417b
25 changed files with 1187 additions and 338 deletions

View File

@ -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<SysCustomer> list = sysWxUserLogService.selectNotPunchCustomerByDate(sysCustomer);
return getDataTable(list);
}
}

View File

@ -76,12 +76,14 @@ public class WechatAppletController extends BaseController {
private ISysServicesTopicService iSysServicesTopicService;
@Autowired
private ISysVideoClassifyService sysVideoClassifyService;
@Autowired
private ISysWxBannerImageService sysWxBannerImageService;
@Autowired
private ISysPunchThumbsupService sysPunchThumbsupService;
@Autowired
private ISysCustomerHealthyService sysCustomerHealthyService;
@Autowired
private ISysCustomerPhysicalSignsService sysCustomerPhysicalSignsService;
/**
* 查询微信小程序中展示的客户案例
@ -442,13 +444,26 @@ public class WechatAppletController extends BaseController {
}
// 更新时间超过21天重新登录获取最新信息
if (StringUtils.isEmpty(curWxUserInfo.getAvatarUrl()) || ChronoUnit.DAYS.between(DateUtils.dateToLocalDate(curWxUserInfo.getUpdateTime()), LocalDate.now()) >= 21) {
if (
// StringUtils.isEmpty(curWxUserInfo.getAvatarUrl()) ||
ChronoUnit.DAYS.between(DateUtils.dateToLocalDate(curWxUserInfo.getUpdateTime()), LocalDate.now()) >= 21) {
return AjaxResult.error(5001, "信息缺失或者过期需要重新登录");
}
SysCustomerHealthy customerHealthy = sysCustomerHealthyService.selectSysCustomerHealthyByCustomerId(curWxUserInfo.getCusId());
if (customerHealthy == null) {
SysCustomerPhysicalSigns customerPhysicalSigns = sysCustomerPhysicalSignsService.selectSysCustomerPhysicalSignsByCusId(curWxUserInfo.getCusId());
if (customerPhysicalSigns != null) {
curWxUserInfo.setSex(customerPhysicalSigns.getSex().toString());
}
} else {
curWxUserInfo.setSex(customerHealthy.getSex().toString());
}
curWxUserInfo.setCustomerId(AesUtils.encrypt(curWxUserInfo.getCusId().toString()));
curWxUserInfo.setCusId(null);
// 并返回一系列登录后的数据
return AjaxResult.success(curWxUserInfo);
}
@ -715,16 +730,19 @@ public class WechatAppletController extends BaseController {
public TableDataInfo getCommunityPunch() {
startPage();
List<CommunityPunchReponse> list = sysWxUserLogService.getCommunityPunch(new SysWxUserLog());
// if (list != null && list.size() > 0) {
// for (CommunityPunchReponse comm : list) {
// comm.setId(AesUtils.encrypt(comm.getId()));
// comm.setCusId(AesUtils.encrypt(comm.getCusId()));
// comm.setThumbsupNum(comm.getThumbsupOpenid() != null ? comm.getThumbsupOpenid().size() : 0);
// }
// }
return getDataTable(list);
}
/**
*
*/
@GetMapping("/getCustomerActivity")
public TableDataInfo getCustomerActivity(@RequestParam String openid) {
startPage();
return getDataTable(sysWxUserLogService.getCommunityPunchByOpenid(openid));
}
/**
* 打卡社区点赞
*
@ -738,6 +756,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<String, Object> resultData = new HashMap<>();
resultData.put("id", AesUtils.encrypt(String.valueOf(sysPunchThumbsup.getId())));
resultData.put("openid", sysPunchThumbsup.getCusOpenid());
@ -888,6 +910,37 @@ 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";
startPage();
Map<String, Object> result = new HashMap<>();
// List<Map<String, Object>> list = new ArrayList<>();
//查询打卡消息
if (messageType.intValue() == 0 || messageType.intValue() == 1) {
result = sysMessageNoticeService.getPunchCommentMessageByCusId(Long.parseLong(cusId));
// list = (List<Map<String, Object>>) result.get("data");
}
if (messageType.intValue() == 0 || messageType.intValue() == 2) {
result = sysMessageNoticeService.getPunchDynamicThumbsUpMessage(Long.parseLong(cusId));
// list = (List<Map<String, Object>>) result.get("data");
}
if (messageType.intValue() == 0 || messageType.intValue() == 3) {
result = sysMessageNoticeService.getServiceMessage(Long.parseLong(cusId));
// list = (List<Map<String, Object>>) result.get("data");
}
// TableDataInfo tableDataInfo = getDataTable(list);
// result.put("total", tableDataInfo.getTotal());
return AjaxResult.success(result);
}
}

View File

@ -3,7 +3,6 @@ package com.stdiet.custom.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.stdiet.common.annotation.Excel;
import com.stdiet.common.core.domain.BaseEntity;
import com.stdiet.common.utils.StringUtils;
import lombok.Data;
import java.math.BigDecimal;
@ -65,6 +64,9 @@ public class SysWxUserLog extends BaseEntity {
private String sportDesc;
@Excel(name = "是否生理期", readConverterExp = "Y=是,N=否")
private String menstrualPeriod;
/**
* 用户头像
*/
@ -89,155 +91,126 @@ public class SysWxUserLog extends BaseEntity {
*/
@Excel(name = "排便情况", readConverterExp = "Y=是,N=否")
private String defecation;
public void setDefecation(String defecation) {
if (defecation.equals("Y") || defecation.equals("N")) {
this.defecation = defecation.equals("Y") ? "" : "";
// this.defecation = defecation.equals("Y") ? "顺畅" : "其他";
} else {
this.defecation = defecation;
}
}
private String defecationDesc;
/**
* 饮水量
*/
@Excel(name = "饮水量")
private Long water;
@JsonFormat(pattern = "yyyy-MM-dd")
private Date logTime;
//客户ID
private Long customerId;
//建议
private String remark;
/**
* 非持久化字段客户姓名
*/
@Excel(name = "姓名")
private String customerName;
//营养师ID
private Long nutritionistId;
/**
* 非持久化字段营养师
*/
@Excel(name = "营养师")
private String nutritionist;
/**
* 情绪
*/
@Excel(name = "情绪")
private String emotion;
private String emotionDesc;
/**
* 食谱之外的食物
*/
@Excel(name = "食谱之外的食物")
private String slyEatFood;
/**
* 是否便秘Y是 N否
*/
@Excel(name = "是否便秘", readConverterExp = "Y=是,N=否")
private String constipation;
/**
* 食材描述
*/
@Excel(name = "食材描述")
private String ingredientDesc;
/**
* 早餐照片
*/
@Excel(name = "早餐照片")
private String breakfastImages;
/**
* 午餐照片
*/
@Excel(name = "午餐照片")
private String lunchImages;
/**
* 午餐照片
*/
@Excel(name = "午餐照片")
private String dinnerImages;
/**
* 加餐照片
*/
@Excel(name = "加餐照片")
private String extraMealImages;
/**
* 体型对比照
*/
@Excel(name = "体型对比照")
private String bodyImages;
private String bodyDesc;
/**
* 服务建议
*/
@Excel(name = "服务建议")
private String suggest;
/**
* 目标体重
*/
@Excel(name = "目标体重")
private BigDecimal targetWeight;
/**
* 执行评分五分制
*/
@Excel(name = "执行评分,五分制")
private BigDecimal executionScore;
/**
* 点评
*/
@Excel(name = "点评")
private String comment;
/**
* 点赞数量
*/
@Excel(name = "点赞数量")
private Long thumbsupNum;
/**
* 健康宣言
*/
@Excel(name = "健康宣言")
private String healthManifesto;
/**
* 删除标识 0未删除 1已删除
*/
private Long delFlag;
//售后营养师ID
private Long afterNutritionistId;
//售后营养师
@Excel(name = "售后营养师")
private String afterNutritionist;
//图片预览路径
private Map<String, List<String>> imagesUrl;
public void setDefecation(String defecation) {
if (defecation.equals("Y") || defecation.equals("N")) {
// this.defecation = defecation.equals("Y") ? "" : "";
this.defecation = defecation.equals("Y") ? "顺畅" : "其他";
} else {
this.defecation = defecation;
}
}
}

View File

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

View File

@ -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<Map<String,Object>> 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<Map<String,Object>> getPunchDynamicThumbsUpMessage(Long cusId);
/**
* 查询未读点赞数量
* @param cusId 客户ID
* @return
*/
int getUnReadThumbsUpMessageNum(Long cusId);
/**
* 根据消息类型客户ID消息关键词查询消息
*/
SysMessageNotice getMessageByCusIdAndTypeKey(SysMessageNotice sysMessageNotice);
/**
* 根据客户ID查询服务消息食谱发送消息执行反馈回复消息
* @return
*/
List<Map<String,Object>> getServiceMessage(Long cusId);
/**
* 根据客户ID查询未读服务消息数量
* @param cusId
* @return
*/
int getUnReadServiceMessageNum(Long cusId);
}

View File

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

View File

@ -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;
/**
@ -100,6 +102,8 @@ public interface SysWxUserLogMapper
*/
List<CommunityPunchReponse> getCommunityPunch(SysWxUserLog sysWxUserLog);
List<CommunityPunchReponse> getCommunityPunchByOpenid(String openid);
/**
* 根据打卡社区
* @param sysWxUserLog
@ -113,4 +117,10 @@ public interface SysWxUserLogMapper
*/
int getPunchCustomerTotalNum();
/**
* 根据日期营养师助理售后查询指定日期未打卡的客户信息
* @return
*/
List<SysCustomer> selectNotPunchCustomerByDate(SysCustomer sysCustomer);
}

View File

@ -1,7 +1,6 @@
package com.stdiet.custom.page;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.stdiet.common.utils.StringUtils;
import lombok.Data;
import java.math.BigDecimal;
@ -53,6 +52,11 @@ public class WxLogInfo {
*/
private String constipation;
/**
* 是否生理期
*/
private String menstrualPeriod;
/**
* 食材描述
*/
@ -123,8 +127,8 @@ public class WxLogInfo {
public void setDefecation(String defecation) {
if (defecation.equals("Y") || defecation.equals("N")) {
this.defecation = defecation.equals("Y") ? "" : "";
// this.defecation = defecation.equals("Y") ? "顺畅" : "其他";
// this.defecation = defecation.equals("Y") ? "" : "";
this.defecation = defecation.equals("Y") ? "顺畅" : "其他";
} else {
this.defecation = defecation;
}
@ -146,4 +150,8 @@ public class WxLogInfo {
this.constipation = constipation.equals("Y") ? "" : "";
}
public void setMenstrualPeriod(String menstrualPeriod) {
this.menstrualPeriod = menstrualPeriod.equals("Y") ? "" : "";
}
}

View File

@ -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<String,Object> getPunchCommentMessageByCusId(Long cusId);
/**
* 根据客户ID查询点赞消息列表
* @param cusId 客户ID
* @return
*/
Map<String,Object> getPunchDynamicThumbsUpMessage(Long cusId);
/**
* 根据客户ID查询服务消息食谱发送消息执行反馈回复消息
* @return
*/
Map<String,Object> getServiceMessage(Long cusId);
}

View File

@ -30,4 +30,11 @@ public interface ISysServicesTopicService {
* @return
*/
int getServicesTopicNum(Long cusId);
/**
* 根据topicId查询内容
* @param topicId
* @return
*/
String getTopicContentByTopicId(String topicId);
}

View File

@ -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;
@ -102,6 +103,8 @@ public interface ISysWxUserLogService
*/
List<CommunityPunchReponse> getCommunityPunch(SysWxUserLog sysWxUserLog);
List<CommunityPunchReponse> getCommunityPunchByOpenid(String openid);
/**
* 根据打卡社区
* @param sysWxUserLog
@ -115,4 +118,10 @@ public interface ISysWxUserLogService
*/
int getPunchCustomerTotalNum();
/**
* 根据日期营养师助理售后查询指定日期未打卡的客户信息
* @return
*/
List<SysCustomer> selectNotPunchCustomerByDate(SysCustomer sysCustomer);
}

View File

@ -1,20 +1,21 @@
package com.stdiet.custom.service.impl;
import java.util.Date;
import java.util.List;
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.mapper.SysMessageNoticeMapper;
import com.stdiet.custom.service.ISysCustomerService;
import com.stdiet.custom.service.ISysMessageNoticeService;
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;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 客户消息通知Service业务层处理
@ -23,8 +24,7 @@ import com.stdiet.custom.service.ISysMessageNoticeService;
* @date 2021-04-26
*/
@Service
public class SysMessageNoticeServiceImpl implements ISysMessageNoticeService
{
public class SysMessageNoticeServiceImpl implements ISysMessageNoticeService {
@Autowired
private SysMessageNoticeMapper sysMessageNoticeMapper;
@ -38,8 +38,7 @@ public class SysMessageNoticeServiceImpl implements ISysMessageNoticeService
* @return 客户消息通知
*/
@Override
public SysMessageNotice selectSysMessageNoticeById(Long id)
{
public SysMessageNotice selectSysMessageNoticeById(Long id) {
return sysMessageNoticeMapper.selectSysMessageNoticeById(id);
}
@ -50,8 +49,7 @@ public class SysMessageNoticeServiceImpl implements ISysMessageNoticeService
* @return 客户消息通知
*/
@Override
public List<SysMessageNotice> selectSysMessageNoticeList(SysMessageNotice sysMessageNotice)
{
public List<SysMessageNotice> selectSysMessageNoticeList(SysMessageNotice sysMessageNotice) {
return sysMessageNoticeMapper.selectSysMessageNoticeList(sysMessageNotice);
}
@ -62,8 +60,7 @@ public class SysMessageNoticeServiceImpl implements ISysMessageNoticeService
* @return 结果
*/
@Override
public int insertSysMessageNotice(SysMessageNotice sysMessageNotice)
{
public int insertSysMessageNotice(SysMessageNotice sysMessageNotice) {
sysMessageNotice.setCreateTime(DateUtils.getNowDate());
return sysMessageNoticeMapper.insertSysMessageNotice(sysMessageNotice);
}
@ -75,8 +72,7 @@ public class SysMessageNoticeServiceImpl implements ISysMessageNoticeService
* @return 结果
*/
@Override
public int updateSysMessageNotice(SysMessageNotice sysMessageNotice)
{
public int updateSysMessageNotice(SysMessageNotice sysMessageNotice) {
sysMessageNotice.setUpdateTime(DateUtils.getNowDate());
return sysMessageNoticeMapper.updateSysMessageNotice(sysMessageNotice);
}
@ -88,8 +84,7 @@ public class SysMessageNoticeServiceImpl implements ISysMessageNoticeService
* @return 结果
*/
@Override
public int deleteSysMessageNoticeByIds(Long[] ids)
{
public int deleteSysMessageNoticeByIds(Long[] ids) {
return sysMessageNoticeMapper.deleteSysMessageNoticeByIds(ids);
}
@ -100,20 +95,20 @@ public class SysMessageNoticeServiceImpl implements ISysMessageNoticeService
* @return 结果
*/
@Override
public int deleteSysMessageNoticeById(Long id)
{
public int deleteSysMessageNoticeById(Long id) {
return sysMessageNoticeMapper.deleteSysMessageNoticeById(id);
}
/**
* 根据客户ID查询客户信息包含私有信息以及公共消息
*
* @param sysMessageNotice
* @return
*/
@Override
public List<MessageNoticeResponse> getCustomerMessage(SysMessageNotice sysMessageNotice){
public List<MessageNoticeResponse> getCustomerMessage(SysMessageNotice sysMessageNotice) {
List<MessageNoticeResponse> responsesList = sysMessageNoticeMapper.getCustomerMessage(sysMessageNotice);
if(responsesList != null && responsesList.size() > 0){
if (responsesList != null && responsesList.size() > 0) {
for (MessageNoticeResponse messageNoticeResponse : responsesList) {
messageNoticeResponse.setMessageTypeName(MessageNoticeEnum.getNoticeEnumByType(messageNoticeResponse.getMessageType()).getName());
}
@ -123,12 +118,13 @@ public class SysMessageNoticeServiceImpl implements ISysMessageNoticeService
/**
* 消息发送
*
* @param messageNoticeEnum
* @param sysMessageNotice
* @return
*/
@Override
public int sendMessageNoticeToCustomer(MessageNoticeEnum messageNoticeEnum, SysMessageNotice sysMessageNotice){
public int sendMessageNoticeToCustomer(MessageNoticeEnum messageNoticeEnum, SysMessageNotice sysMessageNotice) {
sysMessageNotice.setMessageProperty(messageNoticeEnum.getProperty());
sysMessageNotice.setMessageType(messageNoticeEnum.getType());
return sysMessageNoticeMapper.insertSysMessageNotice(sysMessageNotice);
@ -136,34 +132,201 @@ public class SysMessageNoticeServiceImpl implements ISysMessageNoticeService
/**
* 根据客户ID查询客户消息数量
*
* @param sysMessageNotice
* @return
*/
@Override
public int getCustomerMessageCount(SysMessageNotice sysMessageNotice){
public int getCustomerMessageCount(SysMessageNotice sysMessageNotice) {
return sysMessageNoticeMapper.getCustomerMessageCount(sysMessageNotice);
}
/**
* 发送打卡点评消息
*
* @param sysWxUserLog
*/
@Override
@Async
public void sendPunchCommentMessage(SysWxUserLog sysWxUserLog){
if(sysWxUserLog == null || StringUtils.isEmpty(sysWxUserLog.getOpenid())){
public void sendPunchCommentMessage(SysWxUserLog sysWxUserLog) {
if (sysWxUserLog == null || StringUtils.isEmpty(sysWxUserLog.getOpenid()) || sysWxUserLog.getId() == null) {
return;
}
SysCustomer sysCustomer = sysCustomerService.getCustomerByOpenId(sysWxUserLog.getOpenid());
if(sysCustomer != null){
if (sysCustomer != null) {
SysMessageNotice sysMessageNotice = new SysMessageNotice();
sysMessageNotice.setMessageProperty(1);
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<String, Object> content = new HashMap<>();
//回复内容
content.put("replyContent", topic.getContent());
//类型1 评论 2回复
content.put("type", type);
//评论或回复的ID
content.put("id", topic.getId());
//评论ID
content.put("commentId", topic.getCommentId());
//回复ID
content.put("replyId", topic.getReplyId());
//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<String, Object> 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<String, Object> getPunchCommentMessageByCusId(Long cusId) {
List<Map<String, Object>> punchMessageList = sysMessageNoticeMapper.getPunchCommentMessageByCusId(cusId);
int unReadPunchMessageNum = 0;
if (punchMessageList != null && punchMessageList.size() > 0) {
//查询未读消息
unReadPunchMessageNum = sysMessageNoticeMapper.getUnReadPunchMessageNum(cusId);
}
for (Map<String, Object> obj : punchMessageList) {
String dietAvatar = ((String) obj.get("dietAvatar"));
if (!dietAvatar.startsWith("http")) {
obj.put("dietAvatar", "https://manage.stdiet.cn/prod-api" + dietAvatar);
}
}
Map<String, Object> result = new HashMap<>();
result.put("data", punchMessageList);
result.put("unReadNum", unReadPunchMessageNum);
return result;
}
/**
* 根据客户ID查询点赞消息列表
*
* @param cusId 客户ID
* @return
*/
@Override
public Map<String, Object> getPunchDynamicThumbsUpMessage(Long cusId) {
List<Map<String, Object>> thumbsUpMessageList = sysMessageNoticeMapper.getPunchDynamicThumbsUpMessage(cusId);
int unReadThumbsUpMessageNum = 0;
if (thumbsUpMessageList != null && thumbsUpMessageList.size() > 0) {
//查询未读消息
unReadThumbsUpMessageNum = sysMessageNoticeMapper.getUnReadThumbsUpMessageNum(cusId);
}
Map<String, Object> result = new HashMap<>();
result.put("data", thumbsUpMessageList);
result.put("unReadNum", unReadThumbsUpMessageNum);
return result;
}
/**
* 根据客户ID查询服务消息食谱发送消息执行反馈回复消息
*
* @return
*/
@Override
public Map<String, Object> getServiceMessage(Long cusId) {
List<Map<String, Object>> serviceMessageList = sysMessageNoticeMapper.getServiceMessage(cusId);
int unReadServiceMessageNum = 0;
if (serviceMessageList != null && serviceMessageList.size() > 0) {
//查询未读消息
unReadServiceMessageNum = sysMessageNoticeMapper.getUnReadServiceMessageNum(cusId);
}
Map<String, Object> result = new HashMap<>();
result.put("data", serviceMessageList);
result.put("unReadNum", unReadServiceMessageNum);
return result;
}
}

View File

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

View File

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

View File

@ -1,25 +1,15 @@
package com.stdiet.custom.service.impl;
import java.util.List;
import com.stdiet.common.config.AliyunOSSConfig;
import com.stdiet.common.exception.file.FileNameLengthLimitExceededException;
import com.stdiet.common.utils.DateUtils;
import com.stdiet.common.utils.file.FileUploadUtils;
import com.stdiet.common.utils.file.MimeTypeUtils;
import com.stdiet.common.utils.oss.AliyunOSSUtils;
import com.stdiet.custom.domain.SysMessageNotice;
import com.stdiet.custom.domain.SysWxUserInfo;
import com.stdiet.custom.domain.entityEnum.MessageNoticeEnum;
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;
import com.stdiet.custom.page.WxLogInfo;
import com.stdiet.custom.service.ISysMessageNoticeService;
import com.stdiet.custom.service.ISysWxUserLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.stdiet.custom.mapper.SysWxUserLogMapper;
import com.stdiet.custom.domain.SysWxUserLog;
import com.stdiet.custom.service.ISysWxUserLogService;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
/**
* 微信用户记录Service业务层处理
@ -56,7 +46,7 @@ public class SysWxUserLogServiceImpl implements ISysWxUserLogService {
@Override
public List<WxLogInfo> selectWxLogInfoList(SysWxUserLog sysWxUserLog) {
return sysWxUserLogMapper.selectWxLogInfoList(sysWxUserLog);
return sysWxUserLogMapper.selectWxLogInfoList(sysWxUserLog);
}
/**
@ -110,64 +100,86 @@ public class SysWxUserLogServiceImpl implements ISysWxUserLogService {
/**
* 根据openid和手机号查询打卡记录
*
* @return
*/
@Override
public List<WxLogInfo> getWxLogInfoList(SysWxUserLog sysWxUserLog){
public List<WxLogInfo> getWxLogInfoList(SysWxUserLog sysWxUserLog) {
return sysWxUserLogMapper.getWxLogInfoList(sysWxUserLog);
}
/**
* 根据日期和openid查询打卡记录
*
* @param sysWxUserLog
* @return
*/
public SysWxUserLog selectSysWxUserLogByDateAndOpenId(SysWxUserLog sysWxUserLog){
public SysWxUserLog selectSysWxUserLogByDateAndOpenId(SysWxUserLog sysWxUserLog) {
return sysWxUserLogMapper.selectSysWxUserLogByDateAndOpenId(sysWxUserLog);
}
/**
* 根据客户ID查询对应打卡体重数据
*
* @param sysWxUserLog
* @return
*/
public List<SysWxUserLog> getWxUserLogListByCustomerId(SysWxUserLog sysWxUserLog){
public List<SysWxUserLog> getWxUserLogListByCustomerId(SysWxUserLog sysWxUserLog) {
return sysWxUserLogMapper.getWxUserLogListByCustomerId(sysWxUserLog);
}
/**
* 根据ID查询打卡详情
*
* @param sysWxUserLog
* @return
*/
public WxLogInfo getWxLogInfoDetailById(SysWxUserLog sysWxUserLog){
public WxLogInfo getWxLogInfoDetailById(SysWxUserLog sysWxUserLog) {
return sysWxUserLogMapper.getWxLogInfoDetailById(sysWxUserLog);
}
/**
* 查询打卡社区记录
*
* @param sysWxUserLog
* @return
*/
public List<CommunityPunchReponse> getCommunityPunch(SysWxUserLog sysWxUserLog){
public List<CommunityPunchReponse> getCommunityPunch(SysWxUserLog sysWxUserLog) {
return sysWxUserLogMapper.getCommunityPunch(sysWxUserLog);
}
public List<CommunityPunchReponse> getCommunityPunchByOpenid(String openid) {
return sysWxUserLogMapper.getCommunityPunchByOpenid(openid);
}
/**
* 根据打卡社区
*
* @param sysWxUserLog
* @return
*/
public int getPunchTotalNum(SysWxUserLog sysWxUserLog){
return sysWxUserLogMapper.getPunchTotalNum(sysWxUserLog);
public int getPunchTotalNum(SysWxUserLog sysWxUserLog) {
return sysWxUserLogMapper.getPunchTotalNum(sysWxUserLog);
}
/**
* 查询打卡社区总共打卡人数
*
* @return
*/
public int getPunchCustomerTotalNum(){
return sysWxUserLogMapper.getPunchCustomerTotalNum();
public int getPunchCustomerTotalNum() {
return sysWxUserLogMapper.getPunchCustomerTotalNum();
}
/**
* 根据日期营养师助理售后查询指定日期未打卡的客户信息
*
* @return
*/
@Override
public List<SysCustomer> selectNotPunchCustomerByDate(SysCustomer sysCustomer) {
return sysWxUserLogMapper.selectNotPunchCustomerByDate(sysCustomer);
}
}

View File

@ -5,123 +5,123 @@
<mapper namespace="com.stdiet.custom.mapper.SysCustomerHealthyMapper">
<resultMap type="SysCustomerHealthy" id="SysCustomerHealthyResult">
<result property="id" column="id" />
<result property="customerId" column="customer_id" />
<result property="id" column="id"/>
<result property="customerId" column="customer_id"/>
<!-- 非持久化字段,客户姓名 -->
<result property="name" column="name"></result>
<result property="name" column="name"/>
<!-- 非持久化字段,客户手机号 -->
<result property="phone" column="phone"></result>
<result property="conditioningProjectId" column="conditioning_project_id" />
<result property="phone" column="phone"/>
<result property="conditioningProjectId" column="conditioning_project_id"/>
<!-- 非持久化字段,调理项目名称 -->
<result property="conditioningProject" column="conditioning_project" />
<result property="sex" column="sex" />
<result property="age" column="age" />
<result property="weight" column="weight" />
<result property="tall" column="tall" />
<result property="condiment" column="condiment" />
<result property="otherCondiment" column="other_condiment" />
<result property="cookingStyle" column="cooking_style" />
<result property="cookingStyleRate" column="cooking_style_rate" />
<result property="washVegetablesStyle" column="wash_vegetables_style" />
<result property="otherWashVegetablesStyle" column="other_wash_vegetables_style" />
<result property="breakfastType" column="breakfast_type" />
<result property="breakfastFood" column="breakfast_food" />
<result property="lunchType" column="lunch_type" />
<result property="dinner" column="dinner" />
<result property="vegetableRate" column="vegetable_rate" />
<result property="commonMeat" column="common_meat" />
<result property="dinnerTime" column="dinner_time" />
<result property="supperNum" column="supper_num" />
<result property="supperFood" column="supper_food" />
<result property="dietHotAndCold" column="diet_hot_and_cold" />
<result property="dietFlavor" column="diet_flavor" />
<result property="vegetablesNum" column="vegetables_num" />
<result property="vegetablesRateType" column="vegetables_rate_type" />
<result property="fruitsNum" column="fruits_num" />
<result property="fruitsTime" column="fruits_time" />
<result property="fruitsRate" column="fruits_rate" />
<result property="riceNum" column="rice_num" />
<result property="riceFull" column="rice_full" />
<result property="eatingSpeed" column="eating_speed" />
<result property="snacks" column="snacks" />
<result property="otherSnacks" column="other_snacks" />
<result property="healthProductsFlag" column="health_products_flag" />
<result property="healthProductsBrand" column="health_products_brand" />
<result property="healthProductsName" column="health_products_name" />
<result property="healthProductsWeekRate" column="health_products_week_rate" />
<result property="healthProductsDayRate" column="health_products_day_rate" />
<result property="waterNum" column="water_num" />
<result property="waterType" column="water_type" />
<result property="waterHabit" column="water_habit" />
<result property="drinksNum" column="drinks_num" />
<result property="drinkWineFlag" column="drink_wine_flag" />
<result property="drinkWineClassify" column="drink_wine_classify" />
<result property="otherWineClassify" column="other_wine_classify" />
<result property="drinkWineAmount" column="drink_wine_amount" />
<result property="smokeFlag" column="smoke_flag" />
<result property="smokeRate" column="smoke_rate" />
<result property="secondSmoke" column="second_smoke" />
<result property="workIndustry" column="work_industry" />
<result property="workType" column="work_type" />
<result property="defecationNum" column="defecation_num" />
<result property="otherDefecationNum" column="other_defecation_num" />
<result property="defecationTime" column="defecation_time" />
<result property="defecationShape" column="defecation_shape" />
<result property="defecationSmell" column="defecation_smell" />
<result property="defecationSpeed" column="defecation_speed" />
<result property="defecationColor" column="defecation_color" />
<result property="motionNum" column="motion_num" />
<result property="motionDuration" column="motion_duration" />
<result property="motionTime" column="motion_time" />
<result property="aerobicMotionClassify" column="aerobic_motion_classify" />
<result property="anaerobicMotionClassify" column="anaerobic_motion_classify" />
<result property="anaerobicAerobicMotionClassify" column="anaerobic_aerobic_motion_classify" />
<result property="otherMotionClassify" column="other_motion_classify" />
<result property="motionField" column="motion_field" />
<result property="otherMotionField" column="other_motion_field" />
<result property="sleepTime" column="sleep_time" />
<result property="sleepQuality" column="sleep_quality" />
<result property="sleepDrugFlag" column="sleep_drug_flag" />
<result property="sleepDrug" column="sleep_drug" />
<result property="stayupLateFlag" column="stayup_late_flag" />
<result property="stayupLateWeekNum" column="stayup_late_week_num" />
<result property="familyIllnessHistory" column="family_illness_history" />
<result property="otherFamilyIllnessHistory" column="other_family_illness_history" />
<result property="operationHistory" column="operation_history" />
<result property="otherOperationHistory" column="other_operation_history" />
<result property="nearOperationFlag" column="near_operation_flag" />
<result property="recoveryeSituation" column="recoverye_situation" />
<result property="longEatDrugFlag" column="long_eat_drug_flag" />
<result property="longEatDrugClassify" column="long_eat_drug_classify" />
<result property="otherLongEatDrugClassify" column="other_long_eat_drug_classify" />
<result property="allergyFlag" column="allergy_flag" />
<result property="allergySituation" column="allergy_situation" />
<result property="allergen" column="allergen" />
<result property="otherAllergen" column="other_allergen" />
<result property="medicalReport" column="medical_report" />
<result property="medicalReportName" column="medical_report_name" />
<result property="position" column="position" />
<result property="experience" column="experience" />
<result property="rebound" column="rebound" />
<result property="difficulty" column="difficulty" />
<result property="crux" column="crux" />
<result property="dishesIngredient" column="dishes_ingredient" />
<result property="makeFoodType" column="make_food_type" />
<result property="physicalSignsId" column="physical_signs_id" />
<result property="otherPhysicalSigns" column="other_physical_signs" />
<result property="bloodData" column="blood_data" />
<result property="moistureDate" column="moisture_date" />
<result property="remark" column="remark"></result>
<result property="guidance" column="guidance" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="delFlag" column="del_flag" />
<result property="avoidFood" column="avoid_food" typeHandler="com.stdiet.custom.typehandler.ArrayJsonHandler" />
<result property="conditioningProject" column="conditioning_project"/>
<result property="sex" column="sex"/>
<result property="age" column="age"/>
<result property="weight" column="weight"/>
<result property="tall" column="tall"/>
<result property="condiment" column="condiment"/>
<result property="otherCondiment" column="other_condiment"/>
<result property="cookingStyle" column="cooking_style"/>
<result property="cookingStyleRate" column="cooking_style_rate"/>
<result property="washVegetablesStyle" column="wash_vegetables_style"/>
<result property="otherWashVegetablesStyle" column="other_wash_vegetables_style"/>
<result property="breakfastType" column="breakfast_type"/>
<result property="breakfastFood" column="breakfast_food"/>
<result property="lunchType" column="lunch_type"/>
<result property="dinner" column="dinner"/>
<result property="vegetableRate" column="vegetable_rate"/>
<result property="commonMeat" column="common_meat"/>
<result property="dinnerTime" column="dinner_time"/>
<result property="supperNum" column="supper_num"/>
<result property="supperFood" column="supper_food"/>
<result property="dietHotAndCold" column="diet_hot_and_cold"/>
<result property="dietFlavor" column="diet_flavor"/>
<result property="vegetablesNum" column="vegetables_num"/>
<result property="vegetablesRateType" column="vegetables_rate_type"/>
<result property="fruitsNum" column="fruits_num"/>
<result property="fruitsTime" column="fruits_time"/>
<result property="fruitsRate" column="fruits_rate"/>
<result property="riceNum" column="rice_num"/>
<result property="riceFull" column="rice_full"/>
<result property="eatingSpeed" column="eating_speed"/>
<result property="snacks" column="snacks"/>
<result property="otherSnacks" column="other_snacks"/>
<result property="healthProductsFlag" column="health_products_flag"/>
<result property="healthProductsBrand" column="health_products_brand"/>
<result property="healthProductsName" column="health_products_name"/>
<result property="healthProductsWeekRate" column="health_products_week_rate"/>
<result property="healthProductsDayRate" column="health_products_day_rate"/>
<result property="waterNum" column="water_num"/>
<result property="waterType" column="water_type"/>
<result property="waterHabit" column="water_habit"/>
<result property="drinksNum" column="drinks_num"/>
<result property="drinkWineFlag" column="drink_wine_flag"/>
<result property="drinkWineClassify" column="drink_wine_classify"/>
<result property="otherWineClassify" column="other_wine_classify"/>
<result property="drinkWineAmount" column="drink_wine_amount"/>
<result property="smokeFlag" column="smoke_flag"/>
<result property="smokeRate" column="smoke_rate"/>
<result property="secondSmoke" column="second_smoke"/>
<result property="workIndustry" column="work_industry"/>
<result property="workType" column="work_type"/>
<result property="defecationNum" column="defecation_num"/>
<result property="otherDefecationNum" column="other_defecation_num"/>
<result property="defecationTime" column="defecation_time"/>
<result property="defecationShape" column="defecation_shape"/>
<result property="defecationSmell" column="defecation_smell"/>
<result property="defecationSpeed" column="defecation_speed"/>
<result property="defecationColor" column="defecation_color"/>
<result property="motionNum" column="motion_num"/>
<result property="motionDuration" column="motion_duration"/>
<result property="motionTime" column="motion_time"/>
<result property="aerobicMotionClassify" column="aerobic_motion_classify"/>
<result property="anaerobicMotionClassify" column="anaerobic_motion_classify"/>
<result property="anaerobicAerobicMotionClassify" column="anaerobic_aerobic_motion_classify"/>
<result property="otherMotionClassify" column="other_motion_classify"/>
<result property="motionField" column="motion_field"/>
<result property="otherMotionField" column="other_motion_field"/>
<result property="sleepTime" column="sleep_time"/>
<result property="sleepQuality" column="sleep_quality"/>
<result property="sleepDrugFlag" column="sleep_drug_flag"/>
<result property="sleepDrug" column="sleep_drug"/>
<result property="stayupLateFlag" column="stayup_late_flag"/>
<result property="stayupLateWeekNum" column="stayup_late_week_num"/>
<result property="familyIllnessHistory" column="family_illness_history"/>
<result property="otherFamilyIllnessHistory" column="other_family_illness_history"/>
<result property="operationHistory" column="operation_history"/>
<result property="otherOperationHistory" column="other_operation_history"/>
<result property="nearOperationFlag" column="near_operation_flag"/>
<result property="recoveryeSituation" column="recoverye_situation"/>
<result property="longEatDrugFlag" column="long_eat_drug_flag"/>
<result property="longEatDrugClassify" column="long_eat_drug_classify"/>
<result property="otherLongEatDrugClassify" column="other_long_eat_drug_classify"/>
<result property="allergyFlag" column="allergy_flag"/>
<result property="allergySituation" column="allergy_situation"/>
<result property="allergen" column="allergen"/>
<result property="otherAllergen" column="other_allergen"/>
<result property="medicalReport" column="medical_report"/>
<result property="medicalReportName" column="medical_report_name"/>
<result property="position" column="position"/>
<result property="experience" column="experience"/>
<result property="rebound" column="rebound"/>
<result property="difficulty" column="difficulty"/>
<result property="crux" column="crux"/>
<result property="dishesIngredient" column="dishes_ingredient"/>
<result property="makeFoodType" column="make_food_type"/>
<result property="physicalSignsId" column="physical_signs_id"/>
<result property="otherPhysicalSigns" column="other_physical_signs"/>
<result property="bloodData" column="blood_data"/>
<result property="moistureDate" column="moisture_date"/>
<result property="remark" column="remark"/>
<result property="guidance" column="guidance"/>
<result property="createTime" column="create_time"/>
<result property="createBy" column="create_by"/>
<result property="updateTime" column="update_time"/>
<result property="updateBy" column="update_by"/>
<result property="delFlag" column="del_flag"/>
<result property="avoidFood" column="avoid_food" typeHandler="com.stdiet.custom.typehandler.ArrayJsonHandler"/>
<!-- column是传的参数, select是调用的查询 -->
<association property="signList" column="physical_signs_id" select="getSignByIds"/>
<association property="healthyExtend" column="id" select="getHealthyExtendedByHealthyId"></association>
<association property="healthyExtend" column="id" select="getHealthyExtendedByHealthyId"/>
</resultMap>
<sql id="selectSysCustomerHealthyVo">
@ -134,9 +134,10 @@
<include refid="selectSysCustomerHealthyVo"/>,sc.name,sc.phone,cp.dict_label as conditioning_project
from sys_customer_healthy as sch
LEFT JOIN sys_customer sc on sc.id = sch.customer_id
LEFT JOIN (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'conditioning_project') AS cp ON cp.dict_value = sch.conditioning_project_id
LEFT JOIN (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'conditioning_project') AS cp ON
cp.dict_value = sch.conditioning_project_id
where sch.del_flag = 0 and sc.del_flag = 0
<if test="conditioningProjectId != null "> and sch.conditioning_project_id = #{conditioningProjectId}</if>
<if test="conditioningProjectId != null ">and sch.conditioning_project_id = #{conditioningProjectId}</if>
<if test="name != null and name != ''">
and (sc.name like concat('%',#{name},'%') or sc.phone like concat('%',#{name},'%'))
</if>
@ -147,7 +148,8 @@
<include refid="selectSysCustomerHealthyVo"/>,sc.name,sc.phone,cp.dict_label as conditioning_project
from sys_customer_healthy as sch
left join sys_customer sc on sc.id = sch.customer_id
LEFT JOIN (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'conditioning_project') AS cp ON cp.dict_value = sch.conditioning_project_id
LEFT JOIN (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'conditioning_project') AS cp ON
cp.dict_value = sch.conditioning_project_id
where sch.del_flag = 0 and sc.del_flag = 0 and sch.id = #{id}
</select>
@ -156,11 +158,12 @@
<include refid="selectSysCustomerHealthyVo"/>,sc.name,sc.phone,cp.dict_label as conditioning_project
from sys_customer_healthy as sch
left join sys_customer sc on sc.id = sch.customer_id
LEFT JOIN (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'conditioning_project') AS cp ON cp.dict_value = sch.conditioning_project_id
LEFT JOIN (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'conditioning_project') AS cp ON
cp.dict_value = sch.conditioning_project_id
where sch.del_flag = 0 and sc.del_flag = 0 and sch.customer_id = #{customerId} order by sch.id desc limit 1
</select>
<insert id="insertSysCustomerHealthy" parameterType="SysCustomerHealthy" useGeneratedKeys="true" keyProperty="id">
<insert id="insertSysCustomerHealthy" parameterType="SysCustomerHealthy" useGeneratedKeys="true" keyProperty="id">
insert into sys_customer_healthy
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
@ -380,7 +383,9 @@
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="avoidFood != null">#{avoid_food, jdbcType=OTHER, typeHandler=com.stdiet.custom.typehandler.ArrayJsonHandler},</if>
<if test="avoidFood != null">
#{avoid_food, jdbcType=OTHER, typeHandler=com.stdiet.custom.typehandler.ArrayJsonHandler},
</if>
</trim>
</insert>
@ -450,7 +455,9 @@
<if test="motionTime != null">motion_time = #{motionTime},</if>
<if test="aerobicMotionClassify != null">aerobic_motion_classify = #{aerobicMotionClassify},</if>
<if test="anaerobicMotionClassify != null">anaerobic_motion_classify = #{anaerobicMotionClassify},</if>
<if test="anaerobicAerobicMotionClassify != null">anaerobic_aerobic_motion_classify = #{anaerobicAerobicMotionClassify},</if>
<if test="anaerobicAerobicMotionClassify != null">anaerobic_aerobic_motion_classify =
#{anaerobicAerobicMotionClassify},
</if>
<if test="otherMotionClassify != null">other_motion_classify = #{otherMotionClassify},</if>
<if test="motionField != null">motion_field = #{motionField},</if>
<if test="otherMotionField != null">other_motion_field = #{otherMotionField},</if>
@ -461,7 +468,8 @@
<if test="stayupLateFlag != null">stayup_late_flag = #{stayupLateFlag},</if>
<if test="stayupLateWeekNum != null">stayup_late_week_num = #{stayupLateWeekNum},</if>
<if test="familyIllnessHistory != null">family_illness_history = #{familyIllnessHistory},</if>
<if test="otherFamilyIllnessHistory != null">other_family_illness_history = #{otherFamilyIllnessHistory},</if>
<if test="otherFamilyIllnessHistory != null">other_family_illness_history = #{otherFamilyIllnessHistory},
</if>
<if test="operationHistory != null">operation_history = #{operationHistory},</if>
<if test="otherOperationHistory != null">other_operation_history = #{otherOperationHistory},</if>
<if test="nearOperationFlag != null">near_operation_flag = #{nearOperationFlag},</if>
@ -493,7 +501,9 @@
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="avoidFood != null">avoid_food = #{avoidFood, jdbcType=OTHER, typeHandler=com.stdiet.custom.typehandler.ArrayJsonHandler},</if>
<if test="avoidFood != null">avoid_food =
#{avoidFood, jdbcType=OTHER, typeHandler=com.stdiet.custom.typehandler.ArrayJsonHandler},
</if>
</trim>
where id = #{id}
</update>
@ -527,41 +537,43 @@
</update>
<resultMap type="SysDictData" id="SysDictDataResult">
<id property="dictCode" column="dict_code" />
<result property="dictSort" column="dict_sort" />
<result property="dictLabel" column="dict_label" />
<result property="dictValue" column="dict_value" />
<result property="dictType" column="dict_type" />
<id property="dictCode" column="dict_code"/>
<result property="dictSort" column="dict_sort"/>
<result property="dictLabel" column="dict_label"/>
<result property="dictValue" column="dict_value"/>
<result property="dictType" column="dict_type"/>
</resultMap>
<select id="selectDictDataByTypeAndValue" parameterType="SysDictData" resultMap="SysDictDataResult">
select dict_code, dict_sort, dict_label, dict_value, dict_type from sys_dict_data
where status = '0' and dict_type = #{dictType}
and dict_value in <foreach collection="dictValueList" item="item" index="index"
open="(" separator="," close=")">#{item}</foreach>
and dict_value in
<foreach collection="dictValueList" item="item" index="index"
open="(" separator="," close=")">#{item}
</foreach>
order by dict_sort asc
</select>
<resultMap type="SysCustomerHealthyExtended" id="HealthyExtendedResult">
<result property="id" column="id" />
<result property="healthyId" column="healthy_id" />
<result property="waist" column="waist" />
<result property="hipline" column="hipline" />
<result property="eatFruitsMessage" column="eat_fruits_message" />
<result property="longEatDrugMessage" column="long_eat_drug_message" />
<result property="medicationCompliance" column="medication_compliance" />
<result property="adverseReactionsFlag" column="adverse_reactions_flag" />
<result property="adverseReactions" column="adverse_reactions" />
<result property="bloodSugarMessage" column="blood_sugar_message" />
<result property="depressedStateMessage" column="depressed_state_message" />
<result property="bloodPressureMessage" column="blood_pressure_message" />
<result property="anxietyStateMessage" column="anxiety_state_message" />
<result property="menstruationMessage" column="menstruation_message" />
<result property="gastrointestinalMessage" column="gastrointestinal_message" />
<result property="postpartumConditioningMessage" column="postpartum_conditioning_message" />
<result property="hypertensionMessage" column="hypertension_message" />
<result property="hyperlipidemiaMessage" column="hyperlipidemia_message" />
<result property="delFlag" column="del_flag" />
<result property="id" column="id"/>
<result property="healthyId" column="healthy_id"/>
<result property="waist" column="waist"/>
<result property="hipline" column="hipline"/>
<result property="eatFruitsMessage" column="eat_fruits_message"/>
<result property="longEatDrugMessage" column="long_eat_drug_message"/>
<result property="medicationCompliance" column="medication_compliance"/>
<result property="adverseReactionsFlag" column="adverse_reactions_flag"/>
<result property="adverseReactions" column="adverse_reactions"/>
<result property="bloodSugarMessage" column="blood_sugar_message"/>
<result property="depressedStateMessage" column="depressed_state_message"/>
<result property="bloodPressureMessage" column="blood_pressure_message"/>
<result property="anxietyStateMessage" column="anxiety_state_message"/>
<result property="menstruationMessage" column="menstruation_message"/>
<result property="gastrointestinalMessage" column="gastrointestinal_message"/>
<result property="postpartumConditioningMessage" column="postpartum_conditioning_message"/>
<result property="hypertensionMessage" column="hypertension_message"/>
<result property="hyperlipidemiaMessage" column="hyperlipidemia_message"/>
<result property="delFlag" column="del_flag"/>
</resultMap>
<select id="getHealthyExtendedByHealthyId" parameterType="Long" resultMap="HealthyExtendedResult">

View File

@ -202,9 +202,37 @@
where phone = #{phone} and del_flag = 0
</select>
<resultMap type="SysCustomer" id="SysCustomerResultExtended">
<result property="id" column="id"/>
<result property="name" column="name"/>
<result property="phone" column="phone"/>
<result property="email" column="email"/>
<result property="address" column="address"/>
<result property="payDate" column="pay_date"/>
<result property="startDate" column="start_date"/>
<result property="fansTime" column="fans_time"/>
<result property="fansChannel" column="fans_channel"/>
<result property="purchaseNum" column="purchase_num"/>
<result property="payTotal" column="pay_total"/>
<result property="chargePerson" column="charge_person"/>
<result property="followStatus" column="follow_status"/>
<result property="createTime" column="create_time"/>
<result property="createBy" column="create_by"/>
<result property="updateTime" column="update_time"/>
<result property="updateBy" column="update_by"/>
<result property="channelId" column="channel_id"/>
<result property="mainDietitian" column="main_dietitian"/>
<result property="assistantDietitian" column="assistant_dietitian"/>
<result property="afterDietitian" column="after_dietitian"/>
<result property="salesman" column="salesman"/>
<result property="onSaleId" column="on_sale_id" />
</resultMap>
<!-- 根据openId查询客户 -->
<select id="getCustomerByOpenId" parameterType="String" resultMap="SysCustomerResult">
select sc.id from sys_customer sc
<select id="getCustomerByOpenId" parameterType="String" resultMap="SysCustomerResultExtended">
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
</select>

View File

@ -141,4 +141,77 @@
and smn.message_type = #{messageType}
</if>
</select>
<!-- 根据客户ID查询打卡点评消息包含点评营养师信息、客户信息、点评内容 -->
<select id="getPunchCommentMessageByCusId" parameterType="Long" resultType="Map">
select
message.id,message.message_type as messageType, message.message_content as content, message.read_type as readType,
DATE_FORMAT(message.create_time,'%Y-%m-%d %H:%i') as createTime, log.id as punchId, log.health_manifesto as healthManifesto,info.nick_name cusNickName,info.avatar_url as cusAvatar,diet.nick_name as dietNickName,diet.avatar as dietAvatar
from (
select id,message_customer,message_type,message_title,message_content,message_key,read_type,create_time from sys_message_notice
where del_flag = 0 and message_property = 1 and message_customer = #{cusId}
and message_type = 1
) message
left join sys_wx_user_log log on log.id = message.message_key and log.del_flag = 0
left join sys_wx_user_info info on info.openid = log.openid
left join sys_customer cus on cus.del_flag = 0 and cus.id = message.message_customer
left join sys_user diet on diet.user_id = cus.main_dietitian and diet.del_flag = 0 and diet.status = 0
order by message.id desc
</select>
<!-- 根据用户查询打卡点评的未读消息 -->
<select id="getUnReadPunchMessageNum" parameterType="Long" resultType="int">
select count(id) from sys_message_notice
where del_flag = 0 and message_property = 1
and message_type = 1 and read_type = 0 and message_customer = #{cusId}
</select>
<!-- 根据打卡ID、点赞openid查询点赞消息 -->
<select id="getMessageByPunchIdAndOpenId" resultMap="SysMessageNoticeResult">
select * from sys_message_notice where message_property = 1 and del_flag = 0 and message_type = 2
and message_key = #{punchId} and message_content = #{openid} order by id desc limit 1
</select>
<!-- 根据客户ID查询点赞消息 -->
<select id="getPunchDynamicThumbsUpMessage" parameterType="Long" resultType="Map">
select message.id,message.read_type as readType, message.message_type as messageType,DATE_FORMAT(message.create_time,'%Y-%m-%d %H:%i') as createTime, log.id as punchId, log.health_manifesto as healthManifesto,
thumbsUpUser.nick_name as thumbsUpUserNickName,thumbsUpUser.avatar_url as thumbsUpUserAvatar, punchUser.nick_name as cusNickName, punchUser.avatar_url as cusAvatar
from
(
select id,message_customer,message_type,message_title,message_content,message_key,read_type,create_time from sys_message_notice
where del_flag = 0 and message_property = 1 and message_customer = #{cusId}
and message_type = 2
) message
left join sys_wx_user_info as thumbsUpUser on thumbsUpUser.openid = message.message_content
left join sys_wx_user_log as log on log.id = message.message_key and log.del_flag = 0
left join sys_wx_user_info as punchUser on punchUser.openid = log.openid
order by message.id desc
</select>
<!-- 查询点赞未读消息数量 -->
<select id="getUnReadThumbsUpMessageNum" parameterType="Long" resultType="int">
select count(id) from sys_message_notice
where del_flag = 0 and message_property = 1 and read_type = 0 and message_type = 2 and message_customer = #{cusId}
</select>
<!-- 查询消息是否存在 -->
<select id="getMessageByCusIdAndTypeKey" parameterType="SysMessageNotice" resultMap="SysMessageNoticeResult">
select * from sys_message_notice where del_flag = 0 and message_customer = #{messageCustomer}
and message_type = #{messageType} and message_key= #{messageKey} order by id desc limit 1
</select>
<!-- 查询服务消息(包含食谱更新消息、意见反馈回复消息) -->
<select id="getServiceMessage" parameterType="Long" resultType="Map">
select id, message_content as content, message_key as messageKey,
read_type as readType, message_type as messageType, DATE_FORMAT(create_time,'%Y-%m-%d %H:%i') as createTime from sys_message_notice
where del_flag = 0 and message_property = 1 and message_customer = #{cusId}
and (message_type = 3 or message_type = 4)
order by id desc
</select>
<!-- 查询未读服务消息数量 -->
<select id="getUnReadServiceMessageNum" parameterType="Long" resultType="int">
select count(id) from sys_message_notice
where del_flag = 0 and message_property = 1 and read_type = 0 and (message_type = 3 || message_type = 4) and message_customer = #{cusId}
</select>
</mapper>

View File

@ -325,4 +325,19 @@
<select id="getServicesTopicNum" parameterType="Long" resultType="int">
select count(1) from sys_services_topic where del_flag = 0 and uid = #{cusId}
</select>
<!-- 根据topicId查询内容 -->
<select id="getTopicContentByTopicId" resultType="String" parameterType="String">
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
</select>
<!-- 根据replyId查询回复内容 -->
<select id="getReplyContentByReplyId" resultType="String" parameterType="String">
select content from sys_services_topic_reply where id = #{replyId} limit 1
</select>
</mapper>

View File

@ -46,11 +46,12 @@
<result property="thumbsupNum" column="thumbsup_num"/>
<result property="healthManifesto" column="health_manifesto"/>
<result property="delFlag" column="del_flag"/>
<result property="menstrualPeriod" column="menstrual_period"/>
<!-- 非持久字段 -->
<result property="customerName" column="customer_name"></result>
<result property="customerName" column="customer_name"/>
<!-- 营养师 -->
<result property="nutritionist" column="nutritionist"></result>
<result property="afterNutritionist" column="after_nutritionist"></result>
<result property="nutritionist" column="nutritionist"/>
<result property="afterNutritionist" column="after_nutritionist"/>
</resultMap>
<resultMap type="com.stdiet.custom.page.WxLogInfo" id="WxLogInfo">
@ -73,16 +74,21 @@
<result property="constipation" column="constipation"/>
<result property="remark" column="remark"/>
<result property="ingredientDesc" column="ingredient_desc"/>
<!-- <result property="breakfastImages" column="breakfast_images"/>-->
<result property="breakfastImagesUrl" column="breakfast_images" typeHandler="com.stdiet.custom.typehandler.ImagesHandler"/>
<!-- <result property="lunchImages" column="lunch_images"/>-->
<result property="lunchImagesUrl" column="lunch_images" typeHandler="com.stdiet.custom.typehandler.ImagesHandler"/>
<!-- <result property="dinnerImages" column="dinner_images"/>-->
<result property="dinnerImagesUrl" column="dinner_images" typeHandler="com.stdiet.custom.typehandler.ImagesHandler"/>
<!-- <result property="extraMealImages" column="extra_meal_images"/>-->
<result property="extraMealImagesUrl" column="extra_meal_images" typeHandler="com.stdiet.custom.typehandler.ImagesHandler"/>
<!-- <result property="bodyImages" column="body_images"/>-->
<result property="bodyImagesUrl" column="body_images" typeHandler="com.stdiet.custom.typehandler.ImagesHandler"/>
<!-- <result property="breakfastImages" column="breakfast_images"/>-->
<result property="breakfastImagesUrl" column="breakfast_images"
typeHandler="com.stdiet.custom.typehandler.ImagesHandler"/>
<!-- <result property="lunchImages" column="lunch_images"/>-->
<result property="lunchImagesUrl" column="lunch_images"
typeHandler="com.stdiet.custom.typehandler.ImagesHandler"/>
<!-- <result property="dinnerImages" column="dinner_images"/>-->
<result property="dinnerImagesUrl" column="dinner_images"
typeHandler="com.stdiet.custom.typehandler.ImagesHandler"/>
<!-- <result property="extraMealImages" column="extra_meal_images"/>-->
<result property="extraMealImagesUrl" column="extra_meal_images"
typeHandler="com.stdiet.custom.typehandler.ImagesHandler"/>
<!-- <result property="bodyImages" column="body_images"/>-->
<result property="bodyImagesUrl" column="body_images"
typeHandler="com.stdiet.custom.typehandler.ImagesHandler"/>
<result property="bodyDesc" column="body_desc"/>
<result property="suggest" column="suggest"/>
<result property="targetWeight" column="target_weight"/>
@ -90,11 +96,12 @@
<result property="comment" column="comment"/>
<result property="thumbsupNum" column="thumbsup_num"/>
<result property="healthManifesto" column="health_manifesto"/>
<result property="menstrualPeriod" column="menstrual_period"/>
</resultMap>
<sql id="selectSysWxUserLogVo">
select id,openid, weight, appid, phone, log_time, sleep_time, wakeup_time, sport, sport_desc, avatar_url, diet, diet_desc, insomnia, defecation, defecation_desc, water, create_by, create_time, update_by, update_time, remark,
emotion, emotion_desc,sly_eat_food,constipation,ingredient_desc,breakfast_images,lunch_images,dinner_images,extra_meal_images,body_images,body_desc,suggest,execution_score,comment,health_manifesto
emotion, emotion_desc,sly_eat_food,constipation,ingredient_desc,breakfast_images,lunch_images,dinner_images,extra_meal_images,body_images,body_desc,suggest,execution_score,comment,health_manifesto,menstrual_period
from sys_wx_user_log
</sql>
@ -106,8 +113,10 @@
<select id="selectSysWxUserLogList" parameterType="SysWxUserLog" resultMap="SysWxUserLogResult">
SELECT
wxlog.id,wxinfo.appid,wxinfo.openid,wxinfo.avatar_url,wxinfo.phone,wxlog.weight,wxlog.log_time,wxlog.sleep_time,
wxlog.wakeup_time,wxlog.defecation, wxlog.defecation_desc, wxlog.water, wxlog.insomnia,wxlog.sport, wxlog.sport_desc,wxlog.diet, wxlog.diet_desc,wxlog.remark,
wxlog.emotion, wxlog.emotion_desc,wxlog.sly_eat_food,wxlog.constipation,wxlog.ingredient_desc,wxlog.breakfast_images,
wxlog.wakeup_time,wxlog.defecation, wxlog.defecation_desc, wxlog.water, wxlog.insomnia,wxlog.sport,
wxlog.sport_desc,wxlog.diet, wxlog.diet_desc,wxlog.remark,
wxlog.emotion, wxlog.menstrual_period,
wxlog.emotion_desc,wxlog.sly_eat_food,wxlog.constipation,wxlog.ingredient_desc,wxlog.breakfast_images,
wxlog.lunch_images,wxlog.dinner_images,wxlog.extra_meal_images,wxlog.body_images,wxlog.body_desc,
wxlog.suggest,wxlog.execution_score,wxlog.comment,sc.name as customer_name, su.nick_name as nutritionist,
su_atferSale.nick_name as after_nutritionist, wxlog.health_manifesto, wxlog.log_time
@ -205,6 +214,7 @@
<if test="thumbsupNum != null">thumbsup_num,</if>
<if test="healthManifesto != null">health_manifesto,</if>
<if test="delFlag != null">del_flag,</if>
<if test="menstrualPeriod != null">menstrual_period,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="openid != null">#{openid},</if>
@ -246,6 +256,7 @@
<if test="thumbsupNum != null">#{thumbsupNum},</if>
<if test="healthManifesto != null">#{healthManifesto},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="menstrualPeriod != null">menstrual_period = #{menstrualPeriod},</if>
</trim>
</insert>
@ -288,6 +299,7 @@
<if test="thumbsupNum != null">thumbsup_num = #{thumbsupNum},</if>
<if test="healthManifesto != null">health_manifesto = #{healthManifesto},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="menstrualPeriod != null">menstrual_period = #{menstrualPeriod},</if>
</trim>
where id = #{id}
</update>
@ -305,9 +317,11 @@
<!-- 根据openid和手机号查询对应打卡记录 -->
<select id="getWxLogInfoList" parameterType="SysWxUserLog" resultMap="WxLogInfo">
SELECT wxlog.id,wxlog.weight,wxlog.log_time,wxlog.sleep_time, wxlog.wakeup_time,wxlog.defecation, wxlog.defecation_desc, wxlog.water, wxlog.insomnia,wxlog.sport, wxlog.sport_desc,wxlog.diet, wxlog.diet_desc,
wxlog.emotion, wxlog.emotion_desc,wxlog.sly_eat_food,wxlog.constipation,wxlog.ingredient_desc,wxlog.breakfast_images,wxlog.lunch_images,wxlog.dinner_images,wxlog.extra_meal_images,wxlog.body_images, wxlog.body_desc
,wxlog.remark,wxlog.execution_score,wxlog.comment, wxlog.health_manifesto
SELECT wxlog.id,wxlog.weight,wxlog.log_time,wxlog.sleep_time, wxlog.wakeup_time,wxlog.defecation, wxlog.defecation_desc,
wxlog.water, wxlog.insomnia,wxlog.sport, wxlog.sport_desc,wxlog.diet, wxlog.diet_desc,
wxlog.emotion, wxlog.emotion_desc,wxlog.sly_eat_food,wxlog.constipation,wxlog.ingredient_desc,wxlog.breakfast_images,
wxlog.lunch_images,wxlog.dinner_images,wxlog.extra_meal_images,wxlog.body_images, wxlog.body_desc,
wxlog.remark,wxlog.execution_score,wxlog.comment, wxlog.health_manifesto, wxlog.menstrual_period
FROM sys_wx_user_log wxlog
where wxlog.del_flag = 0 and wxlog.openid = #{openid}
order by wxlog.log_time asc
@ -350,9 +364,11 @@
<!-- 根据openid和手机号查询对应打卡记录 -->
<select id="getWxLogInfoDetailById" parameterType="SysWxUserLog" resultMap="WxLogInfo">
SELECT wxlog.id,wxlog.weight,wxlog.log_time,wxlog.sleep_time, wxlog.wakeup_time,wxlog.defecation, wxlog.defecation_desc, wxlog.water, wxlog.insomnia,wxlog.sport, wxlog.sport_desc,wxlog.diet, wxlog.diet_desc,
wxlog.emotion, wxlog.emotion_desc,wxlog.sly_eat_food,wxlog.constipation,wxlog.ingredient_desc,wxlog.breakfast_images,wxlog.lunch_images,wxlog.dinner_images,wxlog.extra_meal_images,wxlog.body_images, wxlog.body_desc
,wxlog.remark,wxlog.execution_score,wxlog.comment
SELECT wxlog.id,wxlog.weight,wxlog.log_time,wxlog.sleep_time, wxlog.wakeup_time,wxlog.defecation, wxlog.defecation_desc,
wxlog.water, wxlog.insomnia,wxlog.sport, wxlog.sport_desc,wxlog.diet, wxlog.diet_desc,
wxlog.emotion, wxlog.emotion_desc,wxlog.sly_eat_food,wxlog.constipation,wxlog.ingredient_desc,wxlog.breakfast_images,
wxlog.lunch_images,wxlog.dinner_images,wxlog.extra_meal_images,wxlog.body_images, wxlog.body_desc,
wxlog.remark,wxlog.execution_score,wxlog.comment,wxlog.menstrual_period
FROM sys_wx_user_log wxlog left join sys_wx_user_info wxinfo on wxinfo.openid = wxlog.openid
where wxlog.del_flag = 0 and wxlog.id = #{id}
order by wxlog.log_time desc
@ -365,11 +381,10 @@
<result property="nickName" column="nick_name"/>
<result property="avatarUrl" column="avatar_url"/>
<result property="logTime" column="log_time"/>
<result property="weight" column="weight"/>
<result property="comment" column="comment"/>
<result property="healthManifesto" column="health_manifesto"/>
<association property="thumbsupNum" column="id" select="getPunchThumbsupCount"/>
<!-- 查询最近五天体重 -->
<association property="thumbsupNum" column="id" select="getPunchThumbsupCount"/>
<!-- 查询体重 -->
<association property="weightData" column="{id=openid}" select="getRecentWeight"/>
<!-- 查询点赞的openid -->
<association property="thumbsupUser" column="id" select="getPunchThumbsupList"/>
@ -378,19 +393,45 @@
<!-- 查询打卡社区内容 -->
<select id="getCommunityPunch" resultMap="punchReponseMap" parameterType="SysWxUserLog">
SELECT * FROM
(SELECT id, openid, `comment`, health_manifesto, log_time FROM sys_wx_user_log WHERE TO_DAYS(log_time) = TO_DAYS(NOW()) AND del_flag = 0) AS wxlog
(SELECT id, openid, `comment`, health_manifesto, log_time FROM sys_wx_user_log
WHERE TO_DAYS(log_time) = TO_DAYS(NOW()) AND del_flag = 0) AS wxlog
LEFT JOIN (SELECT openid, nick_name, avatar_url FROM sys_wx_user_info) AS wxinfo
USING(openid)
ORDER BY log_time DESC
</select>
<resultMap id="punchReponseMap2" type="com.stdiet.custom.dto.response.CommunityPunchReponse">
<result property="id" column="id" typeHandler="com.stdiet.custom.typehandler.EncryptedIdHandler"/>
<result property="openid" column="openid"/>
<result property="nickName" column="nick_name"/>
<result property="avatarUrl" column="avatar_url"/>
<result property="logTime" column="log_time"/>
<result property="comment" column="comment"/>
<result property="healthManifesto" column="health_manifesto"/>
<association property="thumbsupNum" column="id" select="getPunchThumbsupCount"/>
<!-- 查询体重 -->
<!-- <association property="weightData" column="{id=openid}" select="getRecentWeight"/>-->
<!-- 查询点赞的openid -->
<association property="thumbsupUser" column="id" select="getPunchThumbsupList"/>
</resultMap>
<!-- 客户活动-->
<select id="getCommunityPunchByOpenid" resultMap="punchReponseMap2" parameterType="String">
SELECT * FROM
(SELECT id, openid, `comment`, health_manifesto, log_time FROM sys_wx_user_log
WHERE openid = #{openid} AND del_flag = 0) AS wxlog
LEFT JOIN (SELECT openid, nick_name, avatar_url FROM sys_wx_user_info) AS wxinfo
USING(openid)
ORDER BY log_time DESC
</select>
<!-- 查询打卡社区中点赞的openid -->
<!-- <select id="getPunchThumbsupList" parameterType="Long" resultType="Map">-->
<!-- select * from-->
<!-- (select id, cus_openid as openid, DATE_FORMAT(create_time,'%Y-%m-%d %H:%i') as `time` from sys_punch_thumbsup where punch_id = #{id} and del_flag = 0 order by create_time asc) as tu-->
<!-- left join (SELECT openid, nick_name as nickName, avatar_url as avatarUrl FROM sys_wx_user_info) AS wxinfo-->
<!-- using(openid)-->
<!-- </select>-->
<!-- <select id="getPunchThumbsupList" parameterType="Long" resultType="Map">-->
<!-- select * from-->
<!-- (select id, cus_openid as openid, DATE_FORMAT(create_time,'%Y-%m-%d %H:%i') as `time` from sys_punch_thumbsup where punch_id = #{id} and del_flag = 0 order by create_time asc) as tu-->
<!-- left join (SELECT openid, nick_name as nickName, avatar_url as avatarUrl FROM sys_wx_user_info) AS wxinfo-->
<!-- using(openid)-->
<!-- </select>-->
<resultMap id="thumbupUserResultMap" type="Map">
<result property="id" column="id" typeHandler="com.stdiet.custom.typehandler.EncryptedIdHandler"/>
@ -424,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())
</select>
<!-- 根据日期查询该日期中未打卡客户(根据食谱计划判断今日是否需要打卡) -->
<select id="selectNotPunchCustomerByDate" parameterType="SysCustomer" resultType="SysCustomer">
select plan.cus_id as id, cus.name, cus.main_dietitian as mainDietitian, cus.assistant_dietitian as assistantDietitian,cus.after_dietitian as afterDietitian from
(
select DISTINCT cus_id from sys_recipes_plan where end_date >= DATE_FORMAT(#{startDate},'%Y-%m-%d') and DATE_FORMAT(#{startDate},'%Y-%m-%d') >= start_date and del_flag = 0 and instr(pause_date, DATE_FORMAT(#{startDate},'%Y%m%d')) = 0
) as plan
left join sys_customer cus on cus.id = plan.cus_id and cus.del_flag = 0
where plan.cus_id not in
(
select info.cus_id from sys_wx_user_log log left join sys_wx_user_info info on info.openid = log.openid
where log.del_flag = 0 and DATE_FORMAT(log.log_time,'%Y-%m-%d') = DATE_FORMAT(#{startDate},'%Y-%m-%d')
)
<if test="mainDietitian != null">
and cus.main_dietitian = #{mainDietitian}
</if>
<if test="assistantDietitian != null">
and cus.assistant_dietitian = #{assistantDietitian}
</if>
<if test="afterDietitian != null">
and cus.after_dietitian = #{afterDietitian}
</if>
order by plan.cus_id desc
</select>
</mapper>

View File

@ -79,6 +79,17 @@ export function commentPunchContent(data) {
})
}
// 查询未打卡用户列表
export function getNotPunchCustomer(query) {
return request({
url: '/custom/wxUserLog/selectNotPunchCustomerByDate',
method: 'get',
params: query
})
}

View File

@ -0,0 +1,208 @@
<template>
<!-- -->
<!-- 查询未打卡客户信息 -->
<el-dialog :title="title" :visible.sync="open" width="1050px" :close-on-click-modal="false" append-to-body @closed="cancel">
<!--<div style="margin-bottom: 20px;color:red"></div>-->
<el-form :model="queryParams" ref="queryForm" :inline="true" >
<el-form-item label="打卡日期" prop="startDate" >
<el-date-picker
v-model="queryParams.startDate"
align="right"
type="date"
placeholder="选择打卡日期"
value-format="yyyy-MM-dd"
:picker-options="pickerOptions">
</el-date-picker>
</el-form-item>
<el-form-item label="营养师" prop="mainDietitian" >
<el-select
v-model="queryParams.mainDietitian"
placeholder="请选择销售"
clearable
filterable
size="small"
>
<el-option
v-for="dict in nutritionistIdOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
/>
</el-select>
</el-form-item>
<!--<el-form-item label="营养师助理" prop="assistantDietitian" label-width="50px">
<el-select
v-model="queryParams.assistantDietitian"
placeholder="请选择销售"
clearable
filterable
size="small"
>
<el-option
v-for="dict in nutriAssisIdOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
/>
</el-select>
</el-form-item>-->
<el-form-item label="售后" prop="afterDietitian" >
<el-select
v-model="queryParams.afterDietitian"
placeholder="请选择销售"
clearable
filterable
size="small"
>
<el-option
v-for="dict in afterSaleIdOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<div style="height: 550px; overflow: auto">
<el-table v-loading="loading" :data="notPunchCustomerList">
<el-table-column label="客户姓名" align="center" prop="name" />
<el-table-column label="营养师" align="center" prop="mainDietitian" :formatter="nutritionistFormat"/>
<el-table-column label="售后营养师" align="center" prop="afterDietitian" :formatter="afterDietitianFormat"/>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getNotLunchCustomer"
/>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel">取消</el-button>
</div>
</el-dialog>
</template>
<script>
import { getNotPunchCustomer } from "@/api/custom/wxUserLog";
import { mapGetters } from "vuex";
import dayjs from "dayjs";
const nowTime = dayjs().format("YYYY-MM-DD");
export default {
name: "NotPunchCustomer",
components: {
},
data() {
return {
//
loading: true,
//
title: "",
//
open: false,
total: 0,
//
rules: {
},
queryParams:{
startDate: nowTime,
mainDietitian: null,
assistantDietitian: null,
afterDietitian: null,
pageNum: 1,
pageSize: 10
},
pickerOptions: {
disabledDate(time) {
return time.getTime() > Date.now();
},
},
notPunchCustomerList: [],
nutritionistIdOptions: [],
afterSaleIdOptions: []
};
},
created(){
},
computed: {
...mapGetters([
//
//"preSaleIdOptions"
]),
},
methods: {
showDialog(queryParams, nutritionistIdOptions, afterSaleIdOptions) {
this.nutritionistIdOptions = nutritionistIdOptions != null ? nutritionistIdOptions.slice(1) : [];
this.afterSaleIdOptions = afterSaleIdOptions != null ? afterSaleIdOptions.slice(1) : [];
this.queryParams.startDate = queryParams.startDate != null ? queryParams.startDate : nowTime;
this.queryParams.mainDietitian = queryParams.nutritionistId != null ? queryParams.nutritionistId : null;
this.queryParams.afterDietitian = queryParams.afterNutritionistId != null ? queryParams.afterNutritionistId : null;
this.title = "未打卡用户列表";
this.reset();
this.getNotLunchCustomer();
this.open = true;
},
reset(){
},
/** 提交按钮 */
submitForm() {
},
onClosed() {
this.reset();
},
cancel(){
this.open = false;
this.reset();
},
//
getNotLunchCustomer() {
getNotPunchCustomer(this.queryParams).then((response) => {
/*response.data.forEach((item,index) => {
item.liveRoomName = item.liveNutritionistName + " " + item.liveRoomName;
});*/
this.notPunchCustomerList = response.rows;
this.total = response.total;
this.loading = false;
});
},
handleQuery(){
this.getNotLunchCustomer();
},
resetQuery(){
this.queryParams = {
startDate: nowTime,
mainDietitian: null,
assistantDietitian: null,
afterDietitian: null
};
},
//
nutritionistFormat(row, column) {
return this.selectDictLabel(this.nutritionistIdOptions, row.mainDietitian);
},
//
nutriAssisFormat(row, column) {
return this.selectDictLabel(this.nutriAssisIdOptions, row.assistantDietitian);
},
//
afterDietitianFormat(row, column) {
return this.selectDictLabel(this.afterSaleIdOptions, row.afterDietitian);
},
}
};
</script>
<style lang="scss" scoped>
</style>

View File

@ -30,25 +30,25 @@
</el-select>
</el-form-item>
<el-form-item label="关键词" prop="keyWordArray" label-width="100px">
<el-select
v-model="form.keyWordArray"
multiple
filterable
clearable
allow-create
default-first-option
placeholder="请创建模板关键词,用于模板检索,按回车创建"
style="width:100%"
<el-select
v-model="form.keyWordArray"
multiple
filterable
clearable
allow-create
default-first-option
placeholder="请创建模板关键词,用于模板检索,按回车创建"
style="width: 100%"
>
<el-option
v-for="dict in keyOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
>
<el-option
v-for="dict in keyOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
>
</el-option>
</el-select>
</el-form-item>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="备注" prop="remark" label-width="100px">
<el-input
@ -80,7 +80,7 @@ export default {
nutritionistId: null,
remark: null,
keyWordArray: null,
keyWord: null
keyWord: null,
},
//
rules: {
@ -93,16 +93,16 @@ export default {
],
},
visible: false,
keyOptions:[
keyOptions: [
{
dictLabel: "1-7",
dictValue: "1-7"
dictValue: "1-7",
},
{
dictLabel: "高血压",
dictValue: "高血压"
}
]
dictValue: "高血压",
},
],
};
},
computed: {
@ -120,7 +120,10 @@ export default {
this.reset();
if (data) {
this.title = "修改模板";
data.keyWordArray = (data.keyWord != null && data.keyWord != "") ? data.keyWord.split(",") : null;
data.keyWordArray =
data.keyWord != null && data.keyWord != ""
? data.keyWord.split(",")
: null;
this.form = data;
} else {
this.title = "创建模板";
@ -129,8 +132,11 @@ export default {
submitForm() {
this.$refs["form"].validate((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.form.keyWord =
this.form.keyWordArray != null && this.form.keyWordArray.length > 0
? this.form.keyWordArray.join(",").replaceAll("", ",")
: null;
// this.form.keyWord = (this.form.keyWord || "").replace("", ",");
this.$emit("onConfirm", this.form);
this.visible = false;
}
@ -145,29 +151,33 @@ export default {
nutritionistId: null,
remark: null,
keyWordArray: null,
keyWord: null
keyWord: null,
};
this.resetForm("form");
},
cancel() {
this.visible = false;
},
checkFormat(keyWordArray){
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 (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);
if (!flag) {
this.msgError(msg);
}
return flag;
}
},
},
};
</script>

View File

@ -252,7 +252,7 @@ export default {
}
const tmpNum = document.getElementById(`day_num_${idx}`);
if (tmpNum) {
tmpNum.innerText = `${startNum + idx}`;
tmpNum.innerText = `${parseInt(startNum) + idx}`;
}
});

View File

@ -81,16 +81,15 @@
</el-form>
<el-row :gutter="10" class="mb8">
<!--<el-col :span="1.5">
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-plus"
icon="el-icon-s-flag"
size="mini"
@click="handleAdd"
v-hasPermi="['custom:wxUserLog:add']"
>新增
@click="showNotLunch()"
>未打卡客户列表
</el-button>
</el-col>-->
</el-col>
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="success"-->
@ -298,6 +297,8 @@
<PunchLogEdit ref="punchLogEditRef"></PunchLogEdit>
<!-- 详情 -->
<PunchLogDetail ref="punchLogDetailRef"></PunchLogDetail>
<!-- 未打卡用户 -->
<NotPunchCustomer ref="notPunchCustomerRef"></NotPunchCustomer>
</div>
</template>
@ -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);
}
},
};
</script>