diff --git a/pom.xml b/pom.xml index b49f0bd5d..c96194afb 100644 --- a/pom.xml +++ b/pom.xml @@ -198,6 +198,12 @@ aliyun-sdk-oss ${aliyun-oss.version} + + + com.aliyun + vod20170321 + 2.0.0 + diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerController.java index a4660d826..a85fc2e2d 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerController.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerController.java @@ -15,12 +15,14 @@ import com.stdiet.custom.domain.SysCustomerPhysicalSigns; import com.stdiet.custom.service.ISysCustomerHealthyService; import com.stdiet.custom.service.ISysCustomerPhysicalSignsService; import com.stdiet.custom.service.ISysCustomerService; +import com.stdiet.custom.service.ISysPhysicalSignsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import java.util.ArrayList; import java.util.List; +import java.util.regex.Pattern; /** * 客户体征信息Controller @@ -40,6 +42,9 @@ public class SysCustomerController extends BaseController { @Autowired private ISysCustomerHealthyService sysCustomerHealthyService; + @Autowired + private ISysPhysicalSignsService sysPhysicalSignsService; + /** * 查询客户信息列表 */ @@ -56,6 +61,20 @@ public class SysCustomerController extends BaseController { sysCustomer.setChannels(remark.split("\\|")); } } + + //体征查询 + if(StringUtils.isNotEmpty(sysCustomer.getPhysicalSignsId())){ + //判断是否数字ID + Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$"); + if(pattern.matcher(sysCustomer.getPhysicalSignsId()).matches()){ + List signIdList = new ArrayList<>(); + signIdList.add(Long.parseLong(sysCustomer.getPhysicalSignsId())); + sysCustomer.setSignIdList(signIdList); + }else { + sysCustomer.setSignIdList(sysPhysicalSignsService.getSignIdByName(sysCustomer.getPhysicalSignsId())); + } + } + list = sysCustomerService.selectSysCustomerList(sysCustomer); if (list != null && list.size() > 0) { for (SysCustomer sysCus : list) { diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysNutritionalVideoController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysNutritionalVideoController.java new file mode 100644 index 000000000..018959480 --- /dev/null +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysNutritionalVideoController.java @@ -0,0 +1,103 @@ +package com.stdiet.web.controller.custom; + +import java.util.List; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.stdiet.common.annotation.Log; +import com.stdiet.common.core.controller.BaseController; +import com.stdiet.common.core.domain.AjaxResult; +import com.stdiet.common.enums.BusinessType; +import com.stdiet.custom.domain.SysNutritionalVideo; +import com.stdiet.custom.service.ISysNutritionalVideoService; +import com.stdiet.common.utils.poi.ExcelUtil; +import com.stdiet.common.core.page.TableDataInfo; + +/** + * 营养视频Controller + * + * @author xzj + * @date 2021-04-29 + */ +@RestController +@RequestMapping("/custom/nutritionalVideo") +public class SysNutritionalVideoController extends BaseController +{ + @Autowired + private ISysNutritionalVideoService sysNutritionalVideoService; + + /** + * 查询营养视频列表 + */ + @PreAuthorize("@ss.hasPermi('custom:nutritionalVideo:list')") + @GetMapping("/list") + public TableDataInfo list(SysNutritionalVideo sysNutritionalVideo) + { + startPage(); + List list = sysNutritionalVideoService.selectSysNutritionalVideoList(sysNutritionalVideo); + return getDataTable(list); + } + + /** + * 导出营养视频列表 + */ + @PreAuthorize("@ss.hasPermi('custom:nutritionalVideo:export')") + @Log(title = "营养视频", businessType = BusinessType.EXPORT) + @GetMapping("/export") + public AjaxResult export(SysNutritionalVideo sysNutritionalVideo) + { + List list = sysNutritionalVideoService.selectSysNutritionalVideoList(sysNutritionalVideo); + ExcelUtil util = new ExcelUtil(SysNutritionalVideo.class); + return util.exportExcel(list, "nutritionalVideo"); + } + + /** + * 获取营养视频详细信息 + */ + @PreAuthorize("@ss.hasPermi('custom:nutritionalVideo:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return AjaxResult.success(sysNutritionalVideoService.selectSysNutritionalVideoById(id)); + } + + /** + * 新增营养视频 + */ + @PreAuthorize("@ss.hasPermi('custom:nutritionalVideo:add')") + @Log(title = "营养视频", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody SysNutritionalVideo sysNutritionalVideo) + { + return toAjax(sysNutritionalVideoService.insertSysNutritionalVideo(sysNutritionalVideo)); + } + + /** + * 修改营养视频 + */ + @PreAuthorize("@ss.hasPermi('custom:nutritionalVideo:edit')") + @Log(title = "营养视频", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody SysNutritionalVideo sysNutritionalVideo) + { + return toAjax(sysNutritionalVideoService.updateSysNutritionalVideo(sysNutritionalVideo)); + } + + /** + * 删除营养视频 + */ + @PreAuthorize("@ss.hasPermi('custom:nutritionalVideo:remove')") + @Log(title = "营养视频", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(sysNutritionalVideoService.deleteSysNutritionalVideoByIds(ids)); + } +} \ No newline at end of file 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 24de56979..9d8872060 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 @@ -13,6 +13,7 @@ import com.stdiet.common.utils.poi.ExcelUtil; import com.stdiet.custom.domain.SysWxUserInfo; import com.stdiet.custom.domain.SysWxUserLog; import com.stdiet.custom.page.WxLogInfo; +import com.stdiet.custom.service.ISysMessageNoticeService; import com.stdiet.custom.service.ISysOrderService; import com.stdiet.custom.service.ISysWxUserInfoService; import com.stdiet.custom.service.ISysWxUserLogService; @@ -40,8 +41,12 @@ public class SysWxUserLogController extends BaseController { @Autowired private ISysWxUserInfoService sysWxUserInfoService; + @Autowired private ISysOrderService sysOrderService; + @Autowired + private ISysMessageNoticeService sysMessageNoticeService; + /** * 查询微信用户记录列表 */ @@ -211,6 +216,11 @@ public class SysWxUserLogController extends BaseController { @PreAuthorize("@ss.hasPermi('custom:wxUserLog:query')") @PostMapping("/commentPunchContent") public AjaxResult commentPunchContent(@RequestBody SysWxUserLog sysWxUserLog) { - return toAjax(sysWxUserLogService.updateSysWxUserLog(sysWxUserLog)); + int row = sysWxUserLogService.updateSysWxUserLog(sysWxUserLog); + if(row > 0){ + SysWxUserLog log = sysWxUserLogService.selectSysWxUserLogById(sysWxUserLog.getId()+""); + sysMessageNoticeService.sendPunchCommentMessage(log); + } + return toAjax(row); } } \ 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 ada26efdf..59a48e8cf 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 @@ -1,9 +1,14 @@ package com.stdiet.web.controller.custom; +import com.aliyun.vod20170321.models.GetPlayInfoResponseBody; +import com.aliyun.vod20170321.models.GetVideoInfoResponseBody; +import com.aliyun.vod20170321.models.GetVideoListResponseBody; +import com.itextpdf.io.util.DateTimeUtil; import com.stdiet.common.core.controller.BaseController; import com.stdiet.common.core.domain.AjaxResult; import com.stdiet.common.core.page.TableDataInfo; import com.stdiet.common.exception.file.FileNameLengthLimitExceededException; +import com.stdiet.common.utils.AliyunVideoUtils; import com.stdiet.common.utils.DateUtils; import com.stdiet.common.utils.StringUtils; import com.stdiet.common.utils.file.FileUploadUtils; @@ -12,8 +17,11 @@ import com.stdiet.common.utils.oss.AliyunOSSUtils; import com.stdiet.common.utils.sign.AesUtils; import com.stdiet.custom.domain.*; import com.stdiet.custom.dto.response.CustomerCaseResponse; +import com.stdiet.custom.dto.response.MessageNoticeResponse; +import com.stdiet.custom.dto.response.NutritionalVideoResponse; import com.stdiet.custom.page.WxLogInfo; import com.stdiet.custom.service.*; +import org.aspectj.weaver.loadtime.Aj; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @@ -46,6 +54,15 @@ public class WechatAppletController extends BaseController { @Autowired private ISysCustomerService iSysCustomerService; + @Autowired + private ISysMessageNoticeService sysMessageNoticeService; + + @Autowired + private ISysCustomerService sysCustomerService; + + @Autowired + private ISysNutritionalVideoService sysNutritionalVideoService; + /** * 查询微信小程序中展示的客户案例 */ @@ -82,8 +99,7 @@ public class WechatAppletController extends BaseController { } /** - * 同步客户信息,返回订单数量 - * + * 同步客户信息 * @param sysWxUserInfo * @return */ @@ -100,7 +116,17 @@ public class WechatAppletController extends BaseController { } else { sysWxUserInfoService.insertSysWxUserInfo(sysWxUserInfo); } - return AjaxResult.success(); + Map result = new HashMap<>(); + //根据手机号查询返回用户加密ID + SysCustomer customer = sysCustomerService.getCustomerByPhone(sysWxUserInfo.getPhone()); + result.put("customerId", customer != null ? AesUtils.encrypt(customer.getId()+"", null) : null); + //查询未读消息数量 + SysMessageNotice messageParam = new SysMessageNotice(); + messageParam.setReadType(0); + messageParam.setMessageCustomer(customer != null ? customer.getId() : 0); + int unReadNoticeTotal = sysMessageNoticeService.getCustomerMessageCount(messageParam); + result.put("unReadNoticeTotal", unReadNoticeTotal); + return AjaxResult.success(result); } /** @@ -305,6 +331,98 @@ public class WechatAppletController extends BaseController { return toAjax(sysAskNutritionQuestionService.insertSysAskNutritionQuestion(sysAskNutritionQuestion)); } + /** + * 获取用户通知消息 + */ + @GetMapping(value = "/getCustomerMessage") + public TableDataInfo getCustomerMessage(SysMessageNotice sysMessageNotice) { + startPage(); + if(StringUtils.isNotEmpty(sysMessageNotice.getCustomerId())){ + sysMessageNotice.setMessageCustomer(Long.parseLong(AesUtils.decrypt(sysMessageNotice.getCustomerId(), null))); + }else{ + sysMessageNotice.setMessageCustomer(0L); + } + List list = sysMessageNoticeService.getCustomerMessage(sysMessageNotice); + return getDataTable(list); + } + + /** + * 更新用户通知消息已读状态 + */ + @GetMapping(value = "/updateMessageReadStatus") + public AjaxResult updateMessageReadStatus(@RequestParam("id")Long id) { + SysMessageNotice sysMessageNotice = new SysMessageNotice(); + sysMessageNotice.setReadType(1); + sysMessageNotice.setId(id); + return toAjax(sysMessageNoticeService.updateSysMessageNotice(sysMessageNotice)); + } + + /** + * 更新用户通知消息已读状态 + */ + @GetMapping(value = "/getVideoList") + public TableDataInfo getVideoList(SysNutritionalVideo sysNutritionalVideo) { + AjaxResult result = AjaxResult.success(); + startPage(); + //int total = 0; + //List nutritionalVideoList = new ArrayList<>(); + try{ + /**GetVideoListResponseBody videoListResponseBody = AliyunVideoUtils.getVideoListByPage(null, "Normal", 1, 10); + if(videoListResponseBody != null){ + total = videoListResponseBody.total; + for (GetVideoListResponseBody.GetVideoListResponseBodyVideoListVideo video : videoListResponseBody.videoList.video) { + NutritionalVideoResponse nutritionalVideoResponse = new NutritionalVideoResponse(); + nutritionalVideoResponse.setCoverURL(video.getCoverURL()); + nutritionalVideoResponse.setTitle(video.getTitle()); + nutritionalVideoResponse.setVideoId(video.getVideoId()); + nutritionalVideoResponse.setDescription(video.getDescription()); + nutritionalVideoResponse.setTags(video.getTags()); + nutritionalVideoList.add(nutritionalVideoResponse); + System.out.println(video.getVideoId()); + System.out.println(video.getCoverURL()); + System.out.println(video.getTitle()); + System.out.println(video.getDescription()); + } + } + System.out.println();**/ + sysNutritionalVideo.setShowFlag(1); + List list = sysNutritionalVideoService.selectSysNutritionalVideoList(sysNutritionalVideo); + return getDataTable(list); + }catch (Exception e){ + e.printStackTrace(); + } + return null; + } + + + /** + * 根据视频id获取播放链接 + */ + @GetMapping(value = "/getVideoDetailById") + public AjaxResult getVideoDetailById(@RequestParam(value = "videoId") String videoId) { + AjaxResult result = AjaxResult.success(); + NutritionalVideoResponse nutritionalVideoResponse = new NutritionalVideoResponse(); + try{ + SysNutritionalVideo sysNutritionalVideo = sysNutritionalVideoService.selectSysNutritionalVideByVideoId(videoId); + if(sysNutritionalVideo != null){ + GetPlayInfoResponseBody playInfoResponseBody = AliyunVideoUtils.getVideoVisitDetail(videoId); + //GetVideoInfoResponseBody videoInfoResponseBody = AliyunVideoUtils.getVideoById(videoId); + List playList = playInfoResponseBody.playInfoList.playInfo; + if(playList != null && playList.size() > 0){ + nutritionalVideoResponse.setPlayUrl(playList.get(0).getPlayURL()); + } + nutritionalVideoResponse.setDescription(sysNutritionalVideo.getDescription()); + nutritionalVideoResponse.setTags(sysNutritionalVideo.getTags()); + nutritionalVideoResponse.setTitle(sysNutritionalVideo.getTitle()); + nutritionalVideoResponse.setCreateTime(DateUtils.dateTime(sysNutritionalVideo.getCreateTime())); + } + }catch (Exception e){ + e.printStackTrace(); + } + result.put("videoDetail", nutritionalVideoResponse); + return result; + } + @PostMapping("/login") public AjaxResult login(@RequestBody SysWxUserInfo sysWxUserInfo) { if (StringUtils.isEmpty(sysWxUserInfo.getOpenid())) { @@ -333,5 +451,4 @@ public class WechatAppletController extends BaseController { sysWxUserInfoService.updateSysWxUserInfo(curWxUserInfo); return AjaxResult.success(curWxUserInfo); - } } diff --git a/stdiet-common/src/main/java/com/stdiet/common/utils/AliyunVideoUtils.java b/stdiet-common/src/main/java/com/stdiet/common/utils/AliyunVideoUtils.java new file mode 100644 index 000000000..e370a5b6e --- /dev/null +++ b/stdiet-common/src/main/java/com/stdiet/common/utils/AliyunVideoUtils.java @@ -0,0 +1,127 @@ +package com.stdiet.common.utils; + +import com.aliyun.vod20170321.models.*; +import com.aliyun.teaopenapi.models.*; +import com.stdiet.common.config.AliyunOSSConfig; +import org.apache.commons.collections4.Get; + +public class AliyunVideoUtils { + + public static com.aliyun.vod20170321.Client videoClient = null; + + public static final String default_definition = "FD,LD,SD,HD"; + + public static final String default_stream_type = "video"; + + public static final String default_output_type = "oss"; + + public static final String default_formats = "mp4"; + + /** + * 初始化视频点播Client + * @return + * @throws Exception + */ + public static com.aliyun.vod20170321.Client createClient() throws Exception { + if(videoClient == null){ + synchronized (com.aliyun.vod20170321.Client.class){ + if(videoClient == null){ + Config config = new Config() + // 您的AccessKey ID + .setAccessKeyId(AliyunOSSConfig.AccessKeyID) + // 您的AccessKey Secret + .setAccessKeySecret(AliyunOSSConfig.AccessKeySecret); + // 访问的域名 + config.endpoint = "vod.cn-shenzhen.aliyuncs.com"; + videoClient = new com.aliyun.vod20170321.Client(config); + } + } + } + return videoClient; + } + + /** + * 分页获取视频列表 + * @param pageNo 页码 + * @param pageSize 每页数量 + * @return + * @throws Exception + */ + public static GetVideoListResponseBody getVideoListByPage(Long cateId, String status, Integer pageNo, Integer pageSize) throws Exception{ + com.aliyun.vod20170321.Client client = AliyunVideoUtils.createClient(); + GetVideoListRequest getVideoListRequest = new GetVideoListRequest() + .setCateId(cateId == null ? null : cateId) + .setStatus(status == null ? "Normal": status) + .setPageNo(pageNo == null ? 1 : pageNo) + .setPageSize(pageSize == null ? 10 : pageSize); + GetVideoListResponse videoListResponse = client.getVideoList(getVideoListRequest); + if(videoListResponse != null){ + return videoListResponse.getBody(); + } + return null; + } + + /** + * 根据videoID获取视频访问地址信息 + * @param videoId + * @throws Exception + */ + public static GetPlayInfoResponseBody getVideoVisitDetail(String videoId) throws Exception{ + com.aliyun.vod20170321.Client client = AliyunVideoUtils.createClient(); + GetPlayInfoRequest getPlayInfoRequest = new GetPlayInfoRequest() + .setVideoId(videoId) + .setStreamType(default_stream_type) + .setOutputType(default_output_type) + .setFormats(default_formats); + GetPlayInfoResponse getPlayInfoResponse = client.getPlayInfo(getPlayInfoRequest); + if(getPlayInfoResponse != null){ + return getPlayInfoResponse.getBody(); + } + return null; + } + + /** + * 根据videoID获取视频信息 + * @param videoId + * @throws Exception + */ + public static GetVideoInfoResponseBody getVideoById (String videoId) throws Exception{ + com.aliyun.vod20170321.Client client = AliyunVideoUtils.createClient(); + GetVideoInfoRequest getVideoInfoRequest = new GetVideoInfoRequest() + .setVideoId(videoId); + GetVideoInfoResponse response = client.getVideoInfo(getVideoInfoRequest); + if(response != null){ + return response.body; + } + return null; + } + + /** + * 根据视频消息获取上传凭证 + * @param cateId + * @param fileName + * @param title + * @param coverURL + * @param tags + * @param description + */ + public static CreateUploadVideoResponse createUploadVideoRequest(Long cateId, String fileName, String title, String coverURL, String tags, String description) throws Exception{ + com.aliyun.vod20170321.Client client = AliyunVideoUtils.createClient(); + CreateUploadVideoRequest createUploadVideoRequest = new CreateUploadVideoRequest() + .setDescription(description) + .setCoverURL(coverURL) + .setFileName(fileName) + .setTitle(title) + .setCateId(cateId) + .setTags(tags); + return client.createUploadVideo(createUploadVideoRequest); + } + + + + + + + + +} diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomer.java b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomer.java index a99cd9447..072923305 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomer.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomer.java @@ -2,6 +2,8 @@ package com.stdiet.custom.domain; import java.math.BigDecimal; import java.util.Date; +import java.util.List; + import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import org.apache.commons.lang3.builder.ToStringBuilder; @@ -102,4 +104,10 @@ public class SysCustomer extends BaseEntity private String[] channels; + //病史体征ID集合,非持久化字段 + private List signIdList; + + //病史体征ID + private String physicalSignsId; + } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysMessageNotice.java b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysMessageNotice.java new file mode 100644 index 000000000..befb87e6a --- /dev/null +++ b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysMessageNotice.java @@ -0,0 +1,54 @@ +package com.stdiet.custom.domain; + +import lombok.Data; +import com.stdiet.common.annotation.Excel; +import com.stdiet.common.core.domain.BaseEntity; + +/** + * 客户消息通知对象 sys_message_notice + * + * @author xzj + * @date 2021-04-26 + */ +@Data +public class SysMessageNotice extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** $column.columnComment */ + private Long id; + + /** 消息属性,0 公共消息 1 私有消息 */ + @Excel(name = "消息属性,0 公共消息 1 私有消息") + private Integer messageProperty; + + /** 消息对应客户ID (公共消息时该字段为0) */ + @Excel(name = "消息对应客户ID (公共消息时该字段为0)") + private Long messageCustomer; + + //用户加密ID,非持久化字段 + private String customerId; + + /** 消息类型 */ + @Excel(name = "消息类型") + private Integer messageType; + + /** 消息标题 */ + @Excel(name = "消息标题") + private String messageTitle; + + /** 消息内容 */ + @Excel(name = "消息内容") + private String messageContent; + + /** 是否已读 0未读 1已读 */ + @Excel(name = "是否已读 0未读 1已读") + private Integer readType; + + /** 当前消息对应关键参数,多个参数可保存json字符串 */ + @Excel(name = "当前消息对应关键参数,多个参数可保存json字符串") + private String messageKey; + + /** 删除标识 0未删除 1已删除 */ + private Integer delFlag; +} \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysNutritionalVideo.java b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysNutritionalVideo.java new file mode 100644 index 000000000..2bff9acb0 --- /dev/null +++ b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysNutritionalVideo.java @@ -0,0 +1,55 @@ +package com.stdiet.custom.domain; + +import com.stdiet.common.annotation.Excel; +import com.stdiet.common.core.domain.BaseEntity; +import lombok.Data; + +/** + * 营养视频对象 sys_nutritional_video + * + * @author xzj + * @date 2021-04-29 + */ +@Data +public class SysNutritionalVideo extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** $column.columnComment */ + private Long id; + + /** 视频分类ID */ + @Excel(name = "视频分类ID") + private Long cateId; + + /** 阿里云视频ID */ + @Excel(name = "阿里云视频ID") + private String videoId; + + /** 视频封面URL */ + @Excel(name = "视频封面URL") + private String coverUrl; + + /** 视频标题 */ + @Excel(name = "视频标题") + private String title; + + /** 视频描述 */ + @Excel(name = "视频描述") + private String description; + + /** 视频大小,单位:字节 */ + @Excel(name = "视频大小,单位:字节") + private Long videoSize; + + /** 标签,使用 , 隔开 */ + @Excel(name = "标签,使用 , 隔开") + private String tags; + + /** 是否显示,0不显示 1显示,默认0 */ + @Excel(name = "是否显示,0不显示 1显示,默认0") + private Integer showFlag; + + /** 删除标识,0未删除 1已删除,默认0 */ + private Integer delFlag; +} \ No newline at end of file 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 new file mode 100644 index 000000000..8c51636f8 --- /dev/null +++ b/stdiet-custom/src/main/java/com/stdiet/custom/domain/entityEnum/MessageNoticeEnum.java @@ -0,0 +1,75 @@ +package com.stdiet.custom.domain.entityEnum; + +public enum MessageNoticeEnum{ + + systemMessage("系统通知", 0, 0, "系统通知"), + punchComment("打卡点评", 1, 1, "%s打卡点评"); //%s 为打卡时间 + + + //消息名称 + private String name; + + //消息属性 0公共 1私有 + private Integer property; + + //消息类型 + private Integer type; + + //消息标题模板 + private String titleTemplate; + + MessageNoticeEnum(String name, Integer property, Integer type, String titleTemplate){ + this.name = name; + this.property = property; + this.type = type; + this.titleTemplate = titleTemplate; + } + + /** + * 根据type类型获取枚举对象 + * @param type + * @return + */ + public static MessageNoticeEnum getNoticeEnumByType(Integer type){ + for (MessageNoticeEnum messageEnum : MessageNoticeEnum.values()) { + if(messageEnum.getType().intValue() == type.intValue()){ + return messageEnum; + } + } + return systemMessage; + } + + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getType() { + return type; + } + + public void setType(Integer type) { + this.type = type; + } + + public Integer getProperty() { + return property; + } + + public void setProperty(Integer property) { + this.property = property; + } + + public String getTitleTemplate() { + return titleTemplate; + } + + public void setTitleTemplate(String titleTemplate) { + this.titleTemplate = titleTemplate; + } + +} diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/dto/response/MessageNoticeResponse.java b/stdiet-custom/src/main/java/com/stdiet/custom/dto/response/MessageNoticeResponse.java new file mode 100644 index 000000000..6d4df2071 --- /dev/null +++ b/stdiet-custom/src/main/java/com/stdiet/custom/dto/response/MessageNoticeResponse.java @@ -0,0 +1,43 @@ +package com.stdiet.custom.dto.response; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +@Data +public class MessageNoticeResponse implements Serializable { + + private static final long serialVersionUID = 1L; + + private Long id; + + /** 消息属性,0 公共消息 1 私有消息 */ + private Integer messageProperty; + + /** 消息对应客户ID (公共消息时该字段为0) */ + private Long messageCustomer; + + /** 消息类型 */ + private Integer messageType; + + //消息类型名称 + private String messageTypeName; + + /** 消息标题 */ + private String messageTitle; + + /** 消息内容 */ + private String messageContent; + + /** 是否已读 0未读 1已读 */ + private Integer readType; + + /** 当前消息对应关键参数,多个参数可保存json字符串 */ + private String messageKey; + + /** 创建时间 **/ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm") + private Date createTime; +} diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/dto/response/NutritionalVideoResponse.java b/stdiet-custom/src/main/java/com/stdiet/custom/dto/response/NutritionalVideoResponse.java new file mode 100644 index 000000000..d3827493c --- /dev/null +++ b/stdiet-custom/src/main/java/com/stdiet/custom/dto/response/NutritionalVideoResponse.java @@ -0,0 +1,39 @@ +package com.stdiet.custom.dto.response; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class NutritionalVideoResponse implements Serializable { + + private static final long serialVersionUID = 1L; + + //分类ID + public Long cateId; + + //分类名称 + public String cateName; + + //标题 + public String title; + + //标签 + public String tags; + + //视频ID + public String videoId; + + //封面URL + public String coverURL; + + //视频描述 + public String description; + + //播放链接 + public String playUrl; + + + public String createTime; + +} diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysCustomerMapper.java b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysCustomerMapper.java index 388e7b86c..1d89f4d94 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysCustomerMapper.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysCustomerMapper.java @@ -67,4 +67,11 @@ public interface SysCustomerMapper * @return 结果 */ SysCustomer getCustomerByPhone(@Param("phone")String phone); + + /** + * 根据openid查询客户信息 + * @param openid + * @return + */ + SysCustomer getCustomerByOpenId(@Param("openid")String openid); } \ No newline at end of file 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 new file mode 100644 index 000000000..7f69ad171 --- /dev/null +++ b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysMessageNoticeMapper.java @@ -0,0 +1,76 @@ +package com.stdiet.custom.mapper; + +import java.util.List; +import com.stdiet.custom.domain.SysMessageNotice; +import com.stdiet.custom.dto.response.MessageNoticeResponse; + +/** + * 客户消息通知Mapper接口 + * + * @author xzj + * @date 2021-04-26 + */ +public interface SysMessageNoticeMapper +{ + /** + * 查询客户消息通知 + * + * @param id 客户消息通知ID + * @return 客户消息通知 + */ + public SysMessageNotice selectSysMessageNoticeById(Long id); + + /** + * 查询客户消息通知列表 + * + * @param sysMessageNotice 客户消息通知 + * @return 客户消息通知集合 + */ + public List selectSysMessageNoticeList(SysMessageNotice sysMessageNotice); + + /** + * 新增客户消息通知 + * + * @param sysMessageNotice 客户消息通知 + * @return 结果 + */ + public int insertSysMessageNotice(SysMessageNotice sysMessageNotice); + + /** + * 修改客户消息通知 + * + * @param sysMessageNotice 客户消息通知 + * @return 结果 + */ + public int updateSysMessageNotice(SysMessageNotice sysMessageNotice); + + /** + * 删除客户消息通知 + * + * @param id 客户消息通知ID + * @return 结果 + */ + public int deleteSysMessageNoticeById(Long id); + + /** + * 批量删除客户消息通知 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + public int deleteSysMessageNoticeByIds(Long[] ids); + + /** + * 根据客户ID查询客户信息(包含私有信息以及公共消息) + * @param sysMessageNotice + * @return + */ + public List getCustomerMessage(SysMessageNotice sysMessageNotice); + + /** + * 根据客户ID查询客户消息数量 + * @param sysMessageNotice + * @return + */ + public int getCustomerMessageCount(SysMessageNotice sysMessageNotice); +} \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysNutritionalVideoMapper.java b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysNutritionalVideoMapper.java new file mode 100644 index 000000000..2594a4ef1 --- /dev/null +++ b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysNutritionalVideoMapper.java @@ -0,0 +1,69 @@ +package com.stdiet.custom.mapper; + +import java.util.List; +import com.stdiet.custom.domain.SysNutritionalVideo; +import org.apache.ibatis.annotations.Param; + +/** + * 营养视频Mapper接口 + * + * @author xzj + * @date 2021-04-29 + */ +public interface SysNutritionalVideoMapper +{ + /** + * 查询营养视频 + * + * @param id 营养视频ID + * @return 营养视频 + */ + public SysNutritionalVideo selectSysNutritionalVideoById(Long id); + + /** + * 查询营养视频列表 + * + * @param sysNutritionalVideo 营养视频 + * @return 营养视频集合 + */ + public List selectSysNutritionalVideoList(SysNutritionalVideo sysNutritionalVideo); + + /** + * 新增营养视频 + * + * @param sysNutritionalVideo 营养视频 + * @return 结果 + */ + public int insertSysNutritionalVideo(SysNutritionalVideo sysNutritionalVideo); + + /** + * 修改营养视频 + * + * @param sysNutritionalVideo 营养视频 + * @return 结果 + */ + public int updateSysNutritionalVideo(SysNutritionalVideo sysNutritionalVideo); + + /** + * 删除营养视频 + * + * @param id 营养视频ID + * @return 结果 + */ + public int deleteSysNutritionalVideoById(Long id); + + /** + * 批量删除营养视频 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + public int deleteSysNutritionalVideoByIds(Long[] ids); + + /** + * 获取视频 + * @param videoId + * @return + */ + public SysNutritionalVideo selectSysNutritionalVideByVideoId(@Param("videoId")String videoId); +} \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysPhysicalSignsMapper.java b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysPhysicalSignsMapper.java index 22cca22d8..cbd9b349b 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysPhysicalSignsMapper.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysPhysicalSignsMapper.java @@ -2,6 +2,7 @@ package com.stdiet.custom.mapper; import java.util.List; import com.stdiet.custom.domain.SysPhysicalSigns; +import org.apache.ibatis.annotations.Param; /** * 体征Mapper接口 @@ -58,4 +59,11 @@ public interface SysPhysicalSignsMapper * @return 结果 */ public int deleteSysPhysicalSignsByIds(Long[] ids); + + /** + * 根据名称查询体征ID集合 + * @param name + * @return + */ + List getSignIdByName(@Param("name") String name); } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCustomerService.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCustomerService.java index c88766acf..6a16b1990 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCustomerService.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCustomerService.java @@ -81,4 +81,11 @@ public interface ISysCustomerService Map getPhysicalSignsByOutId(String id); + /** + * 根据openid查询客户信息 + * @param openid + * @return + */ + SysCustomer getCustomerByOpenId(String openid); + } \ 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 new file mode 100644 index 000000000..7349e0ec6 --- /dev/null +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysMessageNoticeService.java @@ -0,0 +1,92 @@ +package com.stdiet.custom.service; + +import java.util.List; +import com.stdiet.custom.domain.SysMessageNotice; +import com.stdiet.custom.domain.SysWxUserLog; +import com.stdiet.custom.domain.entityEnum.MessageNoticeEnum; +import com.stdiet.custom.dto.response.MessageNoticeResponse; + +/** + * 客户消息通知Service接口 + * + * @author xzj + * @date 2021-04-26 + */ +public interface ISysMessageNoticeService +{ + /** + * 查询客户消息通知 + * + * @param id 客户消息通知ID + * @return 客户消息通知 + */ + public SysMessageNotice selectSysMessageNoticeById(Long id); + + /** + * 查询客户消息通知列表 + * + * @param sysMessageNotice 客户消息通知 + * @return 客户消息通知集合 + */ + public List selectSysMessageNoticeList(SysMessageNotice sysMessageNotice); + + /** + * 新增客户消息通知 + * + * @param sysMessageNotice 客户消息通知 + * @return 结果 + */ + public int insertSysMessageNotice(SysMessageNotice sysMessageNotice); + + /** + * 修改客户消息通知 + * + * @param sysMessageNotice 客户消息通知 + * @return 结果 + */ + public int updateSysMessageNotice(SysMessageNotice sysMessageNotice); + + /** + * 批量删除客户消息通知 + * + * @param ids 需要删除的客户消息通知ID + * @return 结果 + */ + public int deleteSysMessageNoticeByIds(Long[] ids); + + /** + * 删除客户消息通知信息 + * + * @param id 客户消息通知ID + * @return 结果 + */ + public int deleteSysMessageNoticeById(Long id); + + /** + * 根据客户ID查询客户信息(包含私有信息以及公共消息) + * @param sysMessageNotice + * @return + */ + public List getCustomerMessage(SysMessageNotice sysMessageNotice); + + /** + * 消息发送 + * @param messageNoticeEnum + * @param sysMessageNotice + * @return + */ + public int sendMessageNoticeToCustomer(MessageNoticeEnum messageNoticeEnum, SysMessageNotice sysMessageNotice); + + /** + * 根据客户ID查询客户消息数量 + * @param sysMessageNotice + * @return + */ + public int getCustomerMessageCount(SysMessageNotice sysMessageNotice); + + /** + * 发送打卡点评消息 + * @param sysWxUserLog + */ + public void sendPunchCommentMessage(SysWxUserLog sysWxUserLog); +} \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysNutritionalVideoService.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysNutritionalVideoService.java new file mode 100644 index 000000000..7a844ceae --- /dev/null +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysNutritionalVideoService.java @@ -0,0 +1,68 @@ +package com.stdiet.custom.service; + +import java.util.List; +import com.stdiet.custom.domain.SysNutritionalVideo; + +/** + * 营养视频Service接口 + * + * @author xzj + * @date 2021-04-29 + */ +public interface ISysNutritionalVideoService +{ + /** + * 查询营养视频 + * + * @param id 营养视频ID + * @return 营养视频 + */ + public SysNutritionalVideo selectSysNutritionalVideoById(Long id); + + /** + * 查询营养视频列表 + * + * @param sysNutritionalVideo 营养视频 + * @return 营养视频集合 + */ + public List selectSysNutritionalVideoList(SysNutritionalVideo sysNutritionalVideo); + + /** + * 新增营养视频 + * + * @param sysNutritionalVideo 营养视频 + * @return 结果 + */ + public int insertSysNutritionalVideo(SysNutritionalVideo sysNutritionalVideo); + + /** + * 修改营养视频 + * + * @param sysNutritionalVideo 营养视频 + * @return 结果 + */ + public int updateSysNutritionalVideo(SysNutritionalVideo sysNutritionalVideo); + + /** + * 批量删除营养视频 + * + * @param ids 需要删除的营养视频ID + * @return 结果 + */ + public int deleteSysNutritionalVideoByIds(Long[] ids); + + /** + * 删除营养视频信息 + * + * @param id 营养视频ID + * @return 结果 + */ + public int deleteSysNutritionalVideoById(Long id); + + /** + * 获取视频 + * @param videoId + * @return + */ + public SysNutritionalVideo selectSysNutritionalVideByVideoId(String videoId); +} \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysPhysicalSignsService.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysPhysicalSignsService.java index 204ba992a..eee6b4ce0 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysPhysicalSignsService.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysPhysicalSignsService.java @@ -58,4 +58,11 @@ public interface ISysPhysicalSignsService * @return 结果 */ public int deleteSysPhysicalSignsById(Long id); + + /** + * 根据名称查询体征ID集合 + * @param name + * @return + */ + List getSignIdByName(String name); } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCustomerServiceImpl.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCustomerServiceImpl.java index d4e9a85e6..eb3851d4c 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCustomerServiceImpl.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCustomerServiceImpl.java @@ -168,4 +168,13 @@ public class SysCustomerServiceImpl implements ISysCustomerService { public Map getPhysicalSignsByOutId(String id) { return null; } + + /** + * 根据openid查询客户信息 + * @param openid + * @return + */ + public SysCustomer getCustomerByOpenId(String openid){ + return sysCustomerMapper.getCustomerByOpenId(openid); + } } \ 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 new file mode 100644 index 000000000..a5110a50a --- /dev/null +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysMessageNoticeServiceImpl.java @@ -0,0 +1,169 @@ +package com.stdiet.custom.service.impl; + +import java.util.Date; +import java.util.List; +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.entityEnum.MessageNoticeEnum; +import com.stdiet.custom.dto.response.MessageNoticeResponse; +import com.stdiet.custom.service.ISysCustomerService; +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; + +/** + * 客户消息通知Service业务层处理 + * + * @author xzj + * @date 2021-04-26 + */ +@Service +public class SysMessageNoticeServiceImpl implements ISysMessageNoticeService +{ + @Autowired + private SysMessageNoticeMapper sysMessageNoticeMapper; + + @Autowired + private ISysCustomerService sysCustomerService; + + /** + * 查询客户消息通知 + * + * @param id 客户消息通知ID + * @return 客户消息通知 + */ + @Override + public SysMessageNotice selectSysMessageNoticeById(Long id) + { + return sysMessageNoticeMapper.selectSysMessageNoticeById(id); + } + + /** + * 查询客户消息通知列表 + * + * @param sysMessageNotice 客户消息通知 + * @return 客户消息通知 + */ + @Override + public List selectSysMessageNoticeList(SysMessageNotice sysMessageNotice) + { + return sysMessageNoticeMapper.selectSysMessageNoticeList(sysMessageNotice); + } + + /** + * 新增客户消息通知 + * + * @param sysMessageNotice 客户消息通知 + * @return 结果 + */ + @Override + public int insertSysMessageNotice(SysMessageNotice sysMessageNotice) + { + sysMessageNotice.setCreateTime(DateUtils.getNowDate()); + return sysMessageNoticeMapper.insertSysMessageNotice(sysMessageNotice); + } + + /** + * 修改客户消息通知 + * + * @param sysMessageNotice 客户消息通知 + * @return 结果 + */ + @Override + public int updateSysMessageNotice(SysMessageNotice sysMessageNotice) + { + sysMessageNotice.setUpdateTime(DateUtils.getNowDate()); + return sysMessageNoticeMapper.updateSysMessageNotice(sysMessageNotice); + } + + /** + * 批量删除客户消息通知 + * + * @param ids 需要删除的客户消息通知ID + * @return 结果 + */ + @Override + public int deleteSysMessageNoticeByIds(Long[] ids) + { + return sysMessageNoticeMapper.deleteSysMessageNoticeByIds(ids); + } + + /** + * 删除客户消息通知信息 + * + * @param id 客户消息通知ID + * @return 结果 + */ + @Override + public int deleteSysMessageNoticeById(Long id) + { + return sysMessageNoticeMapper.deleteSysMessageNoticeById(id); + } + + /** + * 根据客户ID查询客户信息(包含私有信息以及公共消息) + * @param sysMessageNotice + * @return + */ + @Override + public List getCustomerMessage(SysMessageNotice sysMessageNotice){ + List responsesList = sysMessageNoticeMapper.getCustomerMessage(sysMessageNotice); + if(responsesList != null && responsesList.size() > 0){ + for (MessageNoticeResponse messageNoticeResponse : responsesList) { + messageNoticeResponse.setMessageTypeName(MessageNoticeEnum.getNoticeEnumByType(messageNoticeResponse.getMessageType()).getName()); + } + } + return responsesList; + } + + /** + * 消息发送 + * @param messageNoticeEnum + * @param sysMessageNotice + * @return + */ + @Override + public int sendMessageNoticeToCustomer(MessageNoticeEnum messageNoticeEnum, SysMessageNotice sysMessageNotice){ + sysMessageNotice.setMessageProperty(messageNoticeEnum.getProperty()); + sysMessageNotice.setMessageType(messageNoticeEnum.getType()); + return sysMessageNoticeMapper.insertSysMessageNotice(sysMessageNotice); + } + + /** + * 根据客户ID查询客户消息数量 + * @param sysMessageNotice + * @return + */ + @Override + 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())){ + return; + } + SysCustomer sysCustomer = sysCustomerService.getCustomerByOpenId(sysWxUserLog.getOpenid()); + 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.setMessageContent(sysWxUserLog.getComment()); + sendMessageNoticeToCustomer(MessageNoticeEnum.punchComment, sysMessageNotice); + } + } +} \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysNutritionalVideoServiceImpl.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysNutritionalVideoServiceImpl.java new file mode 100644 index 000000000..47ed3f8a6 --- /dev/null +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysNutritionalVideoServiceImpl.java @@ -0,0 +1,105 @@ +package com.stdiet.custom.service.impl; + +import java.util.List; +import com.stdiet.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.stdiet.custom.mapper.SysNutritionalVideoMapper; +import com.stdiet.custom.domain.SysNutritionalVideo; +import com.stdiet.custom.service.ISysNutritionalVideoService; + +/** + * 营养视频Service业务层处理 + * + * @author xzj + * @date 2021-04-29 + */ +@Service +public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoService +{ + @Autowired + private SysNutritionalVideoMapper sysNutritionalVideoMapper; + + /** + * 查询营养视频 + * + * @param id 营养视频ID + * @return 营养视频 + */ + @Override + public SysNutritionalVideo selectSysNutritionalVideoById(Long id) + { + return sysNutritionalVideoMapper.selectSysNutritionalVideoById(id); + } + + /** + * 查询营养视频列表 + * + * @param sysNutritionalVideo 营养视频 + * @return 营养视频 + */ + @Override + public List selectSysNutritionalVideoList(SysNutritionalVideo sysNutritionalVideo) + { + return sysNutritionalVideoMapper.selectSysNutritionalVideoList(sysNutritionalVideo); + } + + /** + * 新增营养视频 + * + * @param sysNutritionalVideo 营养视频 + * @return 结果 + */ + @Override + public int insertSysNutritionalVideo(SysNutritionalVideo sysNutritionalVideo) + { + sysNutritionalVideo.setCreateTime(DateUtils.getNowDate()); + return sysNutritionalVideoMapper.insertSysNutritionalVideo(sysNutritionalVideo); + } + + /** + * 修改营养视频 + * + * @param sysNutritionalVideo 营养视频 + * @return 结果 + */ + @Override + public int updateSysNutritionalVideo(SysNutritionalVideo sysNutritionalVideo) + { + sysNutritionalVideo.setUpdateTime(DateUtils.getNowDate()); + return sysNutritionalVideoMapper.updateSysNutritionalVideo(sysNutritionalVideo); + } + + /** + * 批量删除营养视频 + * + * @param ids 需要删除的营养视频ID + * @return 结果 + */ + @Override + public int deleteSysNutritionalVideoByIds(Long[] ids) + { + return sysNutritionalVideoMapper.deleteSysNutritionalVideoByIds(ids); + } + + /** + * 删除营养视频信息 + * + * @param id 营养视频ID + * @return 结果 + */ + @Override + public int deleteSysNutritionalVideoById(Long id) + { + return sysNutritionalVideoMapper.deleteSysNutritionalVideoById(id); + } + + /** + * 获取视频 + * @param videoId + * @return + */ + public SysNutritionalVideo selectSysNutritionalVideByVideoId(String videoId){ + return sysNutritionalVideoMapper.selectSysNutritionalVideByVideoId(videoId); + } +} \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysPhysicalSignsServiceImpl.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysPhysicalSignsServiceImpl.java index 71d5a4182..1aa9f149e 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysPhysicalSignsServiceImpl.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysPhysicalSignsServiceImpl.java @@ -90,4 +90,14 @@ public class SysPhysicalSignsServiceImpl implements ISysPhysicalSignsService { return sysPhysicalSignsMapper.deleteSysPhysicalSignsById(id); } + + /** + * 根据名称查询体征ID集合 + * @param name + * @return + */ + @Override + public List getSignIdByName(String name){ + return sysPhysicalSignsMapper.getSignIdByName(name); + } } \ No newline at end of file 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 0d736d07a..dbe7129c7 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 @@ -8,8 +8,11 @@ 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.page.WxLogInfo; +import com.stdiet.custom.service.ISysMessageNoticeService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.stdiet.custom.mapper.SysWxUserLogMapper; diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysAskNutritionQuestionMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysAskNutritionQuestionMapper.xml index f3b9d8f17..48e5f08d7 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysAskNutritionQuestionMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysAskNutritionQuestionMapper.xml @@ -26,6 +26,7 @@ from sys_ask_nutrition_question where del_flag = 0 and question like concat('%',#{question},'%') + order by id desc - - where del_flag = 0 - and (name like concat('%', #{name}, '%') or phone like concat('%', #{name}, '%')) - and main_dietitian = #{mainDietitian} - and (isnull(main_dietitian) or main_dietitian=0) - and salesman = #{salesman} - and (isnull(salesman) or salesman=0) - and after_dietitian = #{afterDietitian} - and (isnull(after_dietitian) or after_dietitian=0) - and assistant_dietitian = #{assistantDietitian} - and (isnull(assistant_dietitian) or assistant_dietitian=0) - and fans_channel = #{fansChannel} - and channel_id = #{channelId} + select + sc.id, sc.name, sc.phone, sc.email, sc.fans_time, sc.fans_channel, sc.address, sc.pay_date, sc.start_date, sc.purchase_num, sc.pay_total, sc.main_dietitian, + sc.assistant_dietitian, sc.after_dietitian, sc.salesman, sc.charge_person, sc.follow_status, sc.create_time,sc.channel_id + from sys_customer sc + left join sys_customer_healthy as sch + on sch.customer_id = sc.id and sch.del_flag = 0 + where sc.del_flag = 0 + + and (sc.name like concat('%', #{name}, '%') or sc.phone like concat('%', #{name}, '%')) + + and sc.main_dietitian = #{mainDietitian} + and (isnull(sc.main_dietitian) or sc.main_dietitian=0) + and sc.salesman = #{salesman} + and (isnull(sc.salesman) or sc.salesman=0) + and sc.after_dietitian = #{afterDietitian} + and (isnull(sc.after_dietitian) or sc.after_dietitian=0) + and sc.assistant_dietitian = #{assistantDietitian} + and (isnull(sc.assistant_dietitian) or sc.assistant_dietitian=0) + and sc.fans_channel = #{fansChannel} + and sc.channel_id = #{channelId} - and channel_id in + and sc.channel_id in #{cn} - order by create_time desc + + and ( + sch.other_physical_signs like concat('%', #{name}, '%') + + FIND_IN_SET(#{signId}, sch.physical_signs_id) + + ) + + order by sc.create_time desc + + \ No newline at end of file diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysMessageNoticeMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysMessageNoticeMapper.xml new file mode 100644 index 000000000..e7377f342 --- /dev/null +++ b/stdiet-custom/src/main/resources/mapper/custom/SysMessageNoticeMapper.xml @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id, message_property, message_customer, message_type, message_title, message_content, read_type, message_key, create_time, create_by, update_time, update_by, del_flag + + + + + + + + insert into sys_message_notice + + id, + message_property, + message_customer, + message_type, + message_title, + message_content, + read_type, + message_key, + create_time, + create_by, + update_time, + update_by, + del_flag, + + + #{id}, + #{messageProperty}, + #{messageCustomer}, + #{messageType}, + #{messageTitle}, + #{messageContent}, + #{readType}, + #{messageKey}, + #{createTime}, + #{createBy}, + #{updateTime}, + #{updateBy}, + #{delFlag}, + + + + + update sys_message_notice + + message_property = #{messageProperty}, + message_customer = #{messageCustomer}, + message_type = #{messageType}, + message_title = #{messageTitle}, + message_content = #{messageContent}, + read_type = #{readType}, + message_key = #{messageKey}, + create_time = #{createTime}, + create_by = #{createBy}, + update_time = #{updateTime}, + update_by = #{updateBy}, + del_flag = #{delFlag}, + + where id = #{id} + + + + update sys_message_notice set del_flag = 1 where id = #{id} + + + + update sys_message_notice set del_flag = 1 where id in + + #{id} + + + + + + + + + \ No newline at end of file diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysNutritionalVideoMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysNutritionalVideoMapper.xml new file mode 100644 index 000000000..9561dcb9b --- /dev/null +++ b/stdiet-custom/src/main/resources/mapper/custom/SysNutritionalVideoMapper.xml @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + + + + + + + + + select id, cate_id, video_id, cover_url, title, description, video_size, tags, show_flag, create_time, create_by, update_time, update_by, del_flag from sys_nutritional_video + + + + + + + + insert into sys_nutritional_video + + cate_id, + video_id, + cover_url, + title, + description, + video_size, + tags, + show_flag, + create_time, + create_by, + update_time, + update_by, + del_flag, + + + #{cateId}, + #{videoId}, + #{coverUrl}, + #{title}, + #{description}, + #{videoSize}, + #{tags}, + #{showFlag}, + #{createTime}, + #{createBy}, + #{updateTime}, + #{updateBy}, + #{delFlag}, + + + + + update sys_nutritional_video + + cate_id = #{cateId}, + video_id = #{videoId}, + cover_url = #{coverUrl}, + title = #{title}, + description = #{description}, + video_size = #{videoSize}, + tags = #{tags}, + show_flag = #{showFlag}, + create_time = #{createTime}, + create_by = #{createBy}, + update_time = #{updateTime}, + update_by = #{updateBy}, + del_flag = #{delFlag}, + + where id = #{id} + + + + update sys_nutritional_video set del_flag = 1 where id = #{id} + + + + update sys_nutritional_video set del_flag = 1 where id in + + #{id} + + + + + + \ No newline at end of file diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysPhysicalSignsMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysPhysicalSignsMapper.xml index 0c6493d6b..081231caa 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysPhysicalSignsMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysPhysicalSignsMapper.xml @@ -66,5 +66,10 @@ + + + \ No newline at end of file diff --git a/stdiet-ui/src/views/custom/askQuestion/index.vue b/stdiet-ui/src/views/custom/askQuestion/index.vue index 5db66b6ad..f0ee6985c 100644 --- a/stdiet-ui/src/views/custom/askQuestion/index.vue +++ b/stdiet-ui/src/views/custom/askQuestion/index.vue @@ -49,6 +49,7 @@ +