This commit is contained in:
xiezhijun 2021-06-30 18:53:22 +08:00
commit 60ca29c320
18 changed files with 629 additions and 129 deletions

View File

@ -7,6 +7,7 @@ import com.stdiet.common.utils.DateUtils;
import com.stdiet.common.utils.StringUtils;
import com.stdiet.common.utils.sign.AesUtils;
import com.stdiet.custom.domain.SysOrderPause;
import com.stdiet.custom.domain.SysVideoComment;
import com.stdiet.custom.domain.SysWxAdLog;
import com.stdiet.custom.service.*;
import com.stdiet.custom.utils.CookieUtils;
@ -45,6 +46,9 @@ public class SysWapController extends BaseController {
@Autowired
ISysSmsConfirmServie iSysSmsConfirmServie;
@Autowired
ISysNutritionalVideoService iSysNutritionalVideoService;
/**
* 客户食谱详情
@ -159,6 +163,12 @@ public class SysWapController extends BaseController {
return AjaxResult.success();
}
/**
* 获取验证码
*
* @param request
* @return
*/
@GetMapping(value = "/checkCookie")
public AjaxResult checkCookie(HttpServletRequest request) {
JSONObject resultObj = CookieUtils.checkCookieValida(request, "token");
@ -169,6 +179,12 @@ public class SysWapController extends BaseController {
}
}
/**
* 验证码校验
*
* @param phone
* @return
*/
@GetMapping(value = "/getCode")
public AjaxResult getCode(@RequestParam String phone) {
@ -200,8 +216,6 @@ public class SysWapController extends BaseController {
String tokenStr = phone + "_" + new Date().getTime() + "_" + RandomStringUtils.randomAlphanumeric(8);
Cookie cookie = new Cookie("token", AesUtils.encrypt(tokenStr));
cookie.setMaxAge(24 * 60 * 60);
// cookie.setSecure(true);
// cookie.setHttpOnly(true);
cookie.setPath("/");
response.addCookie(cookie);
return new AjaxResult(20000, "登录成功");
@ -214,4 +228,63 @@ public class SysWapController extends BaseController {
}
}
@GetMapping(value = "/video/comment")
public AjaxResult getVideoComment(SysVideoComment videoComment, HttpServletRequest request) {
JSONObject result = CookieUtils.checkCookieValida(request, "token");
String phone = result.getString("phone");
List<SysVideoComment> comments = iSysNutritionalVideoService.selectVideoCommentByTopicId(videoComment, phone == null ? "" : phone);
return AjaxResult.success(comments);
}
@PostMapping(value = "/video/post/comment")
public AjaxResult insertVideoComment(@RequestBody SysVideoComment videoComment, HttpServletRequest request) {
JSONObject result = CookieUtils.checkCookieValida(request, "token");
if (result.getInteger("code") != 200) {
return AjaxResult.error(result.getInteger("code"), result.getString("msg"));
}
videoComment.setFromUid(result.getString("phone"));
videoComment.setFromRole("phone");
SysVideoComment comment = iSysNutritionalVideoService.insertVideoComment(videoComment);
if (StringUtils.isNull(comment)) {
return AjaxResult.error();
}
return AjaxResult.success(comment);
}
@PostMapping(value = "/video/post/reply")
public AjaxResult insertVideoCommentReply(@RequestBody SysVideoComment videoComment, HttpServletRequest request) {
JSONObject result = CookieUtils.checkCookieValida(request, "token");
if (result.getInteger("code") != 200) {
return AjaxResult.error(result.getInteger("code"), result.getString("msg"));
}
videoComment.setFromUid(result.getString("phone"));
videoComment.setFromRole("phone");
SysVideoComment reply = iSysNutritionalVideoService.insertVideoCommentReply(videoComment);
if (StringUtils.isNull(reply)) {
return AjaxResult.error();
}
return AjaxResult.success(reply);
}
@DeleteMapping("/video/delete/comment/{id}")
public AjaxResult deleteVideoComment(@PathVariable String id) {
return toAjax(iSysNutritionalVideoService.deleteVideoCommentById(id));
}
@DeleteMapping("/video/delete/reply/{id}")
public AjaxResult deleteVideoReply(@PathVariable String id) {
return toAjax(iSysNutritionalVideoService.deleteVideoCommentReplyById(id));
}
}

View File

@ -47,11 +47,6 @@ public class VideoWebInterfaceController extends BaseController {
JSONObject result = CookieUtils.checkCookieValida(request, "token");
if (result.getInteger("code") != 200) {
// TableDataInfo errInfo = new TableDataInfo();
// errInfo.setCode(result.getInteger("code"));
// errInfo.setMsg(result.getString("msg"));
// return errInfo;
Cookie cookie = new Cookie("token", "");
cookie.setMaxAge(24 * 60 * 60);
cookie.setPath("/");

View File

@ -31,4 +31,6 @@ public class SysRecipesPlanListInfo {
private Integer status;
private String remark;
}

View File

@ -0,0 +1,101 @@
package com.stdiet.custom.domain;
import com.alibaba.fastjson.JSONArray;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import java.util.Date;
import java.util.List;
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class SysVideoComment {
/**
*
*/
String id;
/**
* 问题id
*/
String topicId;
/**
* 问题类型
*/
Integer topicType;
String commentId;
String replyId;
Integer replyType;
/**
* 角色
*/
String uid;
String fromUid;
String toUid;
/**
* 问题内容
*/
String content;
/**
* 图片地址
*/
JSONArray img;
/**
* 创建时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
Date createTime;
/**
* 0-未读 1-已读
*/
Integer read;
/**
* 更新时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
Date updateTime;
/**
* 角色
*/
String role;
String fromRole;
String toRole;
// 非持久化字段
/**
* 角色名字
*/
String fromName;
String toName;
String name;
String avatar;
String fromAvatar;
String toAvatar;
List<SysVideoComment> comments;
List<SysVideoComment> replys;
Integer count;
Boolean owner;
}

View File

@ -0,0 +1,17 @@
package com.stdiet.custom.mapper;
import com.stdiet.custom.domain.SysVideoComment;
import java.util.List;
public interface SysVideoCommentMapper {
List<SysVideoComment> selectVideoCommentByTopicId(SysVideoComment videoComment);
int insertVideoComment(SysVideoComment videoComment);
int insertVideoCommentReply(SysVideoComment videoComment);
int deleteVideoCommentById(String id);
int deleteVideoCommentReplyById(String id);
}

View File

@ -1,20 +1,18 @@
package com.stdiet.custom.service;
import com.stdiet.custom.domain.SysNutritionalVideo;
import com.stdiet.custom.domain.SysVideoComment;
import java.util.List;
import java.util.Map;
import com.stdiet.custom.domain.SysNutritionalVideo;
import com.stdiet.custom.domain.SysVideoClassify;
import org.apache.ibatis.annotations.Param;
/**
* 营养视频Service接口
*
* @author xzj
* @date 2021-04-29
*/
public interface ISysNutritionalVideoService
{
public interface ISysNutritionalVideoService {
/**
* 查询营养视频
*
@ -65,6 +63,7 @@ public interface ISysNutritionalVideoService
/**
* 获取视频
*
* @param videoId
* @return
*/
@ -72,12 +71,14 @@ public interface ISysNutritionalVideoService
/**
* 阿里云视频查询检索
*
* @return
*/
public Map<String, Object> searchVideo(String key, Integer status, Integer pageNo, Integer pageSize, String scrollToken);
/**
* 更新微信展示状态
*
* @param wxShow
* @param ids
* @return
@ -86,7 +87,38 @@ public interface ISysNutritionalVideoService
/**
* 更新视频播放量
*
* @return
*/
public int updateVideoPlayNum(String videoId);
/**
* 获取评论
*
* @param videoComment
* @return
*/
public List<SysVideoComment> selectVideoCommentByTopicId(SysVideoComment videoComment, String phone);
/**
* 添加评论
*
* @param videoComment
* @return
*/
public SysVideoComment insertVideoComment(SysVideoComment videoComment);
/**
* 添加回复
*
* @param videoComment
* @return
*/
public SysVideoComment insertVideoCommentReply(SysVideoComment videoComment);
public int deleteVideoCommentById(String id);
public int deleteVideoCommentReplyById(String id);
}

View File

@ -154,6 +154,10 @@ public class SysCustomerServiceImpl implements ISysCustomerService {
@Override
public Map<String, Object> getPhysicalSignsById(Long id) {
Map<String, Object> result = new HashMap<>();
SysCustomer customer = sysCustomerMapper.selectSysCustomerById(id);
result.put("customerInfo", customer);
String key = "customerHealthy";
result.put("type", 0);
//查询健康评估信息

View File

@ -1,22 +1,24 @@
package com.stdiet.custom.service.impl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.aliyun.vod20170321.models.SearchMediaResponse;
import com.aliyun.vod20170321.models.SearchMediaResponseBody;
import com.stdiet.common.utils.AliyunVideoUtils;
import com.stdiet.common.utils.DateUtils;
import com.stdiet.common.utils.StringUtils;
import com.stdiet.common.utils.oss.AliyunOSSUtils;
import com.stdiet.custom.domain.SysNutritionalVideo;
import com.stdiet.custom.domain.SysVideoComment;
import com.stdiet.custom.mapper.SysNutritionalVideoMapper;
import com.stdiet.custom.mapper.SysVideoCommentMapper;
import com.stdiet.custom.service.ISysNutritionalVideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import com.stdiet.custom.mapper.SysNutritionalVideoMapper;
import com.stdiet.custom.domain.SysNutritionalVideo;
import com.stdiet.custom.service.ISysNutritionalVideoService;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 营养视频Service业务层处理
@ -25,11 +27,13 @@ import com.stdiet.custom.service.ISysNutritionalVideoService;
* @date 2021-04-29
*/
@Service
public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoService
{
public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoService {
@Autowired
private SysNutritionalVideoMapper sysNutritionalVideoMapper;
@Autowired
private SysVideoCommentMapper sysVideoCommentMapper;
/**
* 查询营养视频
*
@ -37,8 +41,7 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi
* @return 营养视频
*/
@Override
public SysNutritionalVideo selectSysNutritionalVideoById(Long id)
{
public SysNutritionalVideo selectSysNutritionalVideoById(Long id) {
return sysNutritionalVideoMapper.selectSysNutritionalVideoById(id);
}
@ -49,8 +52,7 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi
* @return 营养视频
*/
@Override
public List<SysNutritionalVideo> selectSysNutritionalVideoList(SysNutritionalVideo sysNutritionalVideo, boolean flag)
{
public List<SysNutritionalVideo> selectSysNutritionalVideoList(SysNutritionalVideo sysNutritionalVideo, boolean flag) {
List<SysNutritionalVideo> list = sysNutritionalVideoMapper.selectSysNutritionalVideoList(sysNutritionalVideo);
if (flag && list != null && list.size() > 0) {
List<String> fileUrl = new ArrayList<>();
@ -103,8 +105,7 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi
* @return 结果
*/
@Override
public int insertSysNutritionalVideo(SysNutritionalVideo sysNutritionalVideo)
{
public int insertSysNutritionalVideo(SysNutritionalVideo sysNutritionalVideo) {
sysNutritionalVideo.setCreateTime(DateUtils.getNowDate());
//判断封面是上传的还是阿里云视频截图封面
if (isSnapshot(sysNutritionalVideo.getCoverUrl())) {
@ -127,8 +128,7 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi
* @return 结果
*/
@Override
public int updateSysNutritionalVideo(SysNutritionalVideo sysNutritionalVideo)
{
public int updateSysNutritionalVideo(SysNutritionalVideo sysNutritionalVideo) {
sysNutritionalVideo.setUpdateTime(DateUtils.getNowDate());
sysNutritionalVideo.setCoverUrl(sysNutritionalVideo.getCoverUrl() == null ? "" : sysNutritionalVideo.getCoverUrl());
String coverUrl = sysNutritionalVideo.getCoverUrl();
@ -160,8 +160,7 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi
* @return 结果
*/
@Override
public int deleteSysNutritionalVideoByIds(Long[] ids)
{
public int deleteSysNutritionalVideoByIds(Long[] ids) {
int row = sysNutritionalVideoMapper.deleteSysNutritionalVideoByIds(ids);
if (row > 0) {
updateAliyunVideoCateId(ids);
@ -176,8 +175,7 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi
* @return 结果
*/
@Override
public int deleteSysNutritionalVideoById(Long id)
{
public int deleteSysNutritionalVideoById(Long id) {
int row = sysNutritionalVideoMapper.deleteSysNutritionalVideoById(id);
if (row > 0) {
Long[] ids = {id};
@ -188,6 +186,7 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi
/**
* 获取视频
*
* @param videoId
* @return
*/
@ -197,6 +196,7 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi
/**
* 阿里云视频查询检索
*
* @return
*/
public Map<String, Object> searchVideo(String key, Integer showFlag, Integer pageNo, Integer pageSize, String scrollToken) {
@ -251,6 +251,7 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi
/**
* 更新微信展示状态
*
* @param wxShow
* @param ids
* @return
@ -261,6 +262,7 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi
/**
* 将删除的阿里云视频放入回收站
*
* @param ids
*/
@Async
@ -279,14 +281,83 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi
/**
* 更新视频播放量
*
* @return
*/
public int updateVideoPlayNum(String videoId) {
return sysNutritionalVideoMapper.updateVideoPlayNum(videoId);
}
@Override
public List<SysVideoComment> selectVideoCommentByTopicId(SysVideoComment videoComment, String uid) {
List<SysVideoComment> comments = sysVideoCommentMapper.selectVideoCommentByTopicId(videoComment);
for (SysVideoComment comment : comments) {
if(comment.getFromUid().equals(uid)){
comment.setOwner(true);
} else {
comment.setOwner(false);
}
if (comment.getFromRole().equals("phone")) {
comment.setFromUid(StringUtils.hiddenPhoneNumber(comment.getFromUid()));
}
if (comment.getToRole().equals("phone")) {
comment.setToUid(StringUtils.hiddenPhoneNumber(comment.getToUid()));
}
List<SysVideoComment> replys = comment.getReplys();
for (SysVideoComment reply : replys) {
if(reply.getFromUid().equals(uid)){
reply.setOwner(true);
} else {
reply.setOwner(false);
}
if (reply.getFromRole().equals("phone")) {
reply.setFromUid(StringUtils.hiddenPhoneNumber(reply.getFromUid()));
}
if (reply.getToRole().equals("phone")) {
reply.setToUid(StringUtils.hiddenPhoneNumber(reply.getToUid()));
}
}
}
return comments;
}
@Override
public SysVideoComment insertVideoComment(SysVideoComment videoComment) {
String uuid = java.util.UUID.randomUUID().toString().replace("-", "");
videoComment.setId(uuid);
int rows = sysVideoCommentMapper.insertVideoComment(videoComment);
if (rows > 0) {
return videoComment;
}
return null;
}
@Override
public SysVideoComment insertVideoCommentReply(SysVideoComment videoComment) {
String id = java.util.UUID.randomUUID().toString().replace("-", "");
videoComment.setId(id);
String uuid = java.util.UUID.randomUUID().toString().replace("-", "");
videoComment.setReplyId(uuid);
int rows = sysVideoCommentMapper.insertVideoCommentReply(videoComment);
if (rows > 0) {
return videoComment;
}
return null;
}
@Override
public int deleteVideoCommentById(String id) {
return sysVideoCommentMapper.deleteVideoCommentById(id);
}
@Override
public int deleteVideoCommentReplyById(String id) {
return sysVideoCommentMapper.deleteVideoCommentReplyById(id);
}
/**
* 判断是否为阿里点播的截图
*
* @param url
* @return
*/
@ -295,5 +366,4 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi
}
}

View File

@ -36,11 +36,13 @@
<result property="nutritionist" column="nutritionist"/>
<result property="nutritionistAssisId" column="nutritionist_assis_id"/>
<result property="nutritionistAssis" column="nutritionist_assis"/>
<result property="remark" column="remark"/>
</resultMap>
<sql id="selectSysRecipesPlanVo">
select id, order_id, cus_id, out_id, start_date, end_date, start_num_day, end_num_day, recipes_id, send_flag, send_time, pause_date, create_time, create_by, update_time, update_by, del_flag, review_status, sub_send, sms_send, subscribed from sys_recipes_plan
select id, order_id, cus_id, out_id, start_date, end_date, start_num_day, end_num_day, recipes_id, send_flag, send_time, pause_date, create_time, create_by, update_time, update_by, del_flag, review_status, sub_send, sms_send, subscribed, remark
from sys_recipes_plan
</sql>
<select id="selectSysRecipesPlanList" parameterType="SysRecipesPlan" resultMap="SysRecipesPlanResult">
@ -141,6 +143,7 @@
<if test="subscribed != null">subscribed = #{subscribed},</if>
<if test="subSend != null">sub_send = #{subSend},</if>
<if test="smsSend != null">sms_send = #{smsSend},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id} and del_flag = 0
</update>
@ -185,7 +188,8 @@
srp.subscribed
FROM sys_recipes_plan srp
LEFT JOIN sys_customer sc ON sc.id = srp.cus_id
LEFT JOIN sys_user su_nutritionist ON su_nutritionist.user_id = sc.main_dietitian AND su_nutritionist.del_flag = 0
LEFT JOIN sys_user su_nutritionist ON su_nutritionist.user_id = sc.main_dietitian AND su_nutritionist.del_flag =
0
LEFT JOIN sys_user su_nutritionist_assis ON su_nutritionist_assis.user_id = sc.assistant_dietitian AND
su_nutritionist_assis.del_flag = 0
WHERE srp.del_flag = 0 AND sc.del_flag = 0 AND srp.type = 0
@ -249,6 +253,7 @@
<result property="recipesId" column="recipes_id"/>
<result property="sendFlag" column="send_flag"/>
<result property="subscribed" column="subscribed"/>
<result property="remark" column="remark"/>
<association property="menus" column="recipes_id" select="selectMenuIds"/>
</resultMap>
@ -256,12 +261,12 @@
and review_status = 2 and send_flag = 1
-->
<select id="selectRecipesPlanListInfo" resultMap="SysRecipesPlanListInfoResult">
select id, start_date, end_date, start_num_day, end_num_day, recipes_id, send_flag, subscribed from sys_recipes_plan where out_id=#{outId} and del_flag = 0
select id, start_date, end_date, start_num_day, end_num_day, recipes_id, send_flag, subscribed, remark from sys_recipes_plan where out_id=#{outId} and del_flag = 0
</select>
<!-- and review_status = 2 and send_flag = 1-->
<select id="selectRecipesPlanListInfoByCusId" resultMap="SysRecipesPlanListInfoResult">
select id, start_date, end_date, start_num_day, end_num_day, recipes_id, send_flag, subscribed from sys_recipes_plan where cus_id=#{cusId} and del_flag = 0
select id, start_date, end_date, start_num_day, end_num_day, recipes_id, send_flag, subscribed, remark from sys_recipes_plan where cus_id=#{cusId} and del_flag = 0
</select>
<resultMap type="SysRecipesDaily" id="SysRecipesResult">

View File

@ -0,0 +1,148 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.stdiet.custom.mapper.SysVideoCommentMapper">
<resultMap id="SysVideoCommentResult" type="SysVideoComment">
<result column="id" property="id"/>
<result column="topic_id" property="topicId"/>
<result column="content" property="content"/>
<result column="from_uid" property="fromUid"/>
<result column="from_role" property="fromRole"/>
<result column="to_uid" property="toUid"/>
<result column="to_role" property="toRole"/>
<!-- <result column="img" property="img" typeHandler="com.stdiet.custom.typehandler.ArrayJsonHandler"/>-->
<result column="create_time" property="createTime"/>
<!-- <association property="fromName" column="{uid=from_uid,role=from_role}" select="selectUserInfo"/>-->
<!-- <association property="fromAvatar" column="{uid=from_uid,role=from_role}" select="selectUserAvatar"/>-->
<!-- <association property="toName" column="{uid=to_uid,role=to_role}" select="selectUserInfo"/>-->
<association property="replys" column="id"
select="selectVideoCommentReplyByCommentId"/>
</resultMap>
<resultMap id="SysVideoCommentReplyResult" type="SysVideoComment">
<result column="id" property="id"/>
<result column="topic_id" property="topicId"/>
<result column="comment_id" property="commentId"/>
<result column="content" property="content"/>
<result column="from_uid" property="fromUid"/>
<result column="from_role" property="fromRole"/>
<result column="to_uid" property="toUid"/>
<result column="to_role" property="toRole"/>
<result column="reply_id" property="replyId"/>
<!-- <result column="img" property="img" typeHandler="com.stdiet.custom.typehandler.ArrayJsonHandler"/>-->
<result column="create_time" property="createTime"/>
<!-- <association property="fromName" column="{uid=from_uid,role=from_role}" select="selectUserInfo"/>-->
<!-- <association property="fromAvatar" column="{uid=from_uid,role=from_role}" select="selectUserAvatar"/>-->
<!-- <association property="toName" column="{uid=to_uid,role=to_role}" select="selectUserInfo"/>-->
<!-- <association property="toAvatar" column="{uid=to_uid,role=to_role}" select="selectUserAvatar"/>-->
</resultMap>
<select id="selectVideoCommentByTopicId" resultMap="SysVideoCommentResult">
select * from sys_nutritional_video_comment where topic_id = #{topicId} and del_flag = 0
order by create_time asc
</select>
<select id="selectVideoCommentReplyByCommentId" resultMap="SysVideoCommentReplyResult">
select * from sys_nutritional_video_reply where comment_id = #{id} and del_flag = 0
order by create_time asc
</select>
<!-- 查询人名-->
<select id="selectUserInfo" parameterType="java.util.Map" resultType="String">
<choose>
<when test="_parameter.get('role') == 'customer'">
select name from sys_customer where id = #{uid}
</when>
<otherwise>
select nick_name from sys_user where user_id = #{uid}
</otherwise>
</choose>
</select>
<!-- 查询头像-->
<select id="selectUserAvatar" parameterType="java.util.Map" resultType="String">
<choose>
<when test="_parameter.get('role') == 'customer'">
select avatar_url from sys_wx_user_info where cus_id = #{uid}
</when>
<otherwise>
select IF(avatar != '', CONCAT("https://api.stdiet.top/prod-api", avatar), '') as avatar from sys_user
where user_id = #{uid}
</otherwise>
</choose>
</select>
<!-- 插入问题回复-->
<insert id="insertVideoComment" parameterType="SysVideoComment">
insert into sys_nutritional_video_comment
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="topicId != null">topic_id,</if>
<if test="fromUid != null">from_uid,</if>
<if test="fromRole != null">from_role,</if>
<if test="toUid != null">to_uid,</if>
<if test="toRole != null">to_role,</if>
<if test="content != null">content,</if>
<if test="img != null">img,</if>
<if test="topicId != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="topicId != null">#{topicId},</if>
<if test="fromUid != null">#{fromUid},</if>
<if test="fromRole != null">#{fromRole},</if>
<if test="toUid != null">#{toUid},</if>
<if test="toRole != null">#{toRole},</if>
<if test="content != null">#{content},</if>
<if test="img != null">
#{img, jdbcType=OTHER, typeHandler=com.stdiet.custom.typehandler.ArrayJsonHandler},
</if>
<if test="topicId != null">now(),</if>
</trim>
</insert>
<!-- 插入问题回复-->
<insert id="insertVideoCommentReply" parameterType="SysVideoComment" useGeneratedKeys="true" keyColumn="id"
keyProperty="id">
insert into sys_nutritional_video_reply
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="commentId != null">comment_id,</if>
<if test="replyId != null">reply_id,</if>
<if test="content != null">content,</if>
<if test="fromUid != null">from_uid,</if>
<if test="toUid != null">to_uid,</if>
<if test="img != null">img,</if>
<if test="fromRole != null">from_role,</if>
<if test="toRole != null">to_role,</if>
<if test="content != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="commentId != null">#{commentId},</if>
<if test="replyId != null">#{replyId},</if>
<if test="content != null">#{content},</if>
<if test="fromUid != null">#{fromUid},</if>
<if test="toUid != null">#{toUid},</if>
<if test="img != null">
#{img, jdbcType=OTHER, typeHandler=com.stdiet.custom.typehandler.ArrayJsonHandler},
</if>
<if test="fromRole != null">#{fromRole},</if>
<if test="toRole != null">#{toRole},</if>
<if test="content != null">now(),</if>
</trim>
</insert>
<update id="deleteVideoCommentById" parameterType="String">
update sys_nutritional_video_comment set del_flag = 1 where id = #{id}
</update>
<update id="deleteVideoCommentReplyById" parameterType="String">
update sys_nutritional_video_reply set del_flag = 1 where id = #{id}
</update>
</mapper>

View File

@ -20,6 +20,12 @@
:value.sync="data.avoidFood"
@onConfirm="handleOnConfirm"
/>
<RemarkCom
v-if="dev && showRemark"
title="营养师点评"
:value.sync="data.recipesPlanRemark"
@onConfirm="handleOnRemarkConfirm"
/>
</div>
</template>
<script>
@ -39,6 +45,10 @@ export default {
type: Boolean,
default: false,
},
showRemark: {
type: Boolean,
default: false,
},
},
components: {
"text-info": TextInfo,
@ -115,6 +125,21 @@ export default {
});
},
},
watch: {
data(val, oldVal) {
if (
val &&
val.dietitianName &&
!this.basicInfo[3].some((obj) => obj.value === "dietitianName")
) {
this.basicInfo.splice(3, 0, [
{ title: "主营养师", value: "dietitianName" },
{ title: "营养师助理", value: "assDietitianName" },
{ title: "售后营养师", value: "afterDietitianName" },
]);
}
},
},
};
</script>
<style lang="scss" scoped>

View File

@ -4,7 +4,7 @@
placement="right"
trigger="click"
width="400"
title="备注"
:title="title"
@hide="handleOnHide"
>
<el-input
@ -12,10 +12,10 @@
v-model="nData"
rows="6"
placeholder="请输入备注信息"
maxlength="300"
maxlength="600"
show-word-limit
/>
<span slot="reference" class="trigger">备注 </span>
<span slot="reference" class="trigger">{{ title }}</span>
</el-popover>
<div class="content">
<span v-if="newLine">
@ -35,6 +35,10 @@ export default {
type: String,
default: "",
},
title: {
type: String,
default: "备注",
},
},
components: {},
data() {

View File

@ -21,6 +21,12 @@
:value.sync="data.avoidFood"
@onConfirm="handleOnConfirm"
/>
<RemarkCom
v-if="dev && showRemark"
title="营养师点评"
:value.sync="data.recipesPlanRemark"
@onConfirm="handleOnRemarkConfirm"
/>
</div>
<el-collapse>
<el-collapse-item
@ -57,6 +63,7 @@ import TextInfo from "@/components/TextInfo";
import ACFCom from "./ACFCom";
import RemarkCom from "./RemarkCom";
import { updateHealthy } from "@/api/custom/healthy";
import { updateRecipesPlan } from "@/api/custom/recipesPlan";
export default {
name: "HealthyView",
@ -69,6 +76,10 @@ export default {
type: Boolean,
default: false,
},
showRemark: {
type: Boolean,
default: false,
},
},
components: {
"text-info": TextInfo,
@ -238,6 +249,33 @@ export default {
}
});
},
handleOnRemarkConfirm(data) {
const { pathname } = window.location;
const recipesId = pathname.substring(pathname.lastIndexOf("/") + 1);
updateRecipesPlan({
id: recipesId,
...data,
}).then((res) => {
if (res.code === 200) {
this.$message.success("修改成功");
}
});
},
},
watch: {
data(val, oldVal) {
if (
val &&
val.dietitianName &&
!this.basicInfo[3].some((obj) => obj.value === "dietitianName")
) {
this.basicInfo.splice(3, 0, [
{ title: "主营养师", value: "dietitianName" },
{ title: "营养师助理", value: "assDietitianName" },
{ title: "售后营养师", value: "afterDietitianName" },
]);
}
},
},
};
</script>

View File

@ -1,6 +1,6 @@
import {
getCustomerPhysicalSignsByCusId,
getCustomer
getCustomerPhysicalSignsByCusId
// getCustomer
} from "@/api/custom/customer";
import { dealHealthy } from "@/utils/healthyData";
import {
@ -34,8 +34,6 @@ const oriState = {
healthyDataType: 0,
avoidFoodIds: [],
//
customerData: {},
//
planList: [],
planListLoading: false
};
@ -130,7 +128,8 @@ const actions = {
dispatch("fetchTopicDetailActions", {
topicId: defTopic.topicId,
id: defTopic.id,
uid: defTopic.uid
uid: defTopic.uid,
callback: payload.callback
});
}, 100);
mTopicList = result.rows;
@ -145,7 +144,6 @@ const actions = {
const {
healthyData,
planList,
customerData,
topicList,
customerList
} = state;
@ -158,11 +156,6 @@ const actions = {
if (!planList.length || planList[0].cusId !== parseInt(uid)) {
dispatch("getRecipesPlanActions", { cusId: uid });
}
// 客户档案
if (customerData.id !== parseInt(uid)) {
dispatch("getCustomerFileActions", { cusId: uid });
}
//
const result = await fetchTopicDetail({ topicId, id });
if (result.code === 200) {
// 设置已读
@ -184,12 +177,6 @@ const actions = {
});
}
},
async getCustomerFileActions({ commit }, payload) {
const result = await getCustomer(payload.cusId);
if (result.code === 200) {
commit("save", { customerData: result.data });
}
},
async postTopicReplyActions(
{ commit, rootGetters, dispatch, state },
payload
@ -223,7 +210,7 @@ const actions = {
const healthyDataResult = await getCustomerPhysicalSignsByCusId(
payload.cusId
);
const newState = {};
const newState = { healthyData: {}, avoidFoodIds: [] };
if (healthyDataResult.code === 200) {
if (!healthyDataResult.data.customerHealthy) {
// throw new Error("客户还没填写健康评估表");
@ -236,6 +223,12 @@ const actions = {
newState.avoidFoodIds = (newState.healthyData.avoidFood || []).map(
obj => obj.id
);
newState.healthyData.dietitianName =
healthyDataResult.data.customerInfo.dietitianName;
newState.healthyData.assDietitianName =
healthyDataResult.data.customerInfo.assDietitianName;
newState.healthyData.afterDietitianName =
healthyDataResult.data.customerInfo.afterDietitianName;
}
}
commit("save", {

View File

@ -49,7 +49,8 @@ const oriState = {
igdTypeOptions: [],
physicalSignsOptions: [],
//
curShortCutObj: {}
curShortCutObj: {},
recipesPlanRemark: ""
};
const mutations = {
@ -147,7 +148,8 @@ const actions = {
endNumDay,
recipesId,
cusId,
reviewStatus
reviewStatus,
remark
} = planResponse.data;
commit("updateStateData", {
cusId,
@ -157,7 +159,8 @@ const actions = {
name: payload.name,
planId: payload.planId,
startNum: startNumDay,
endNum: endNumDay
endNum: endNumDay,
recipesPlanRemark: remark
});
getDicts("cus_cus_unit").then(response => {
commit("updateStateData", { cusUnitOptions: response.data });
@ -237,7 +240,8 @@ const actions = {
commit("updateStateData", payload);
}
},
async getHealthyData({ commit }, payload) {
async getHealthyData({ commit, state }, payload) {
const { recipesPlanRemark } = state;
commit("updateStateData", { healthDataLoading: true });
const healthyDataResult = await getCustomerPhysicalSignsByCusId(
payload.cusId
@ -256,7 +260,10 @@ const actions = {
commit("updateStateData", {
healthDataLoading: false,
healthyDataType,
healthyData,
healthyData: {
...healthyData,
recipesPlanRemark
},
avoidFoodIds: (healthyData.avoidFood || []).map(obj => obj.id)
});
},

View File

@ -237,7 +237,12 @@ export default {
this.replyTarget = "";
this.replyContent = "";
this.replyObj = {};
this.fetchTopicListApi({ fromUid: data.uid });
this.fetchTopicListApi({
fromUid: data.uid,
callback: (msg) => {
this.$message.error(msg);
},
});
}
},
handleOnTopicClick(data) {

View File

@ -15,22 +15,6 @@
:data="healthyDataType === 1 ? healthyData : {}"
v-show="healthyDataType === 1"
/>
<div v-if="customerData.id" class="customer_service_info">
<div class="info_item">
<span>主任营养师</span>
<span>
{{ customerData.dietitianName || "无" }}
</span>
</div>
<div class="info_item">
<span>营养师助理</span>
<span>{{ customerData.assDietitianName || "无" }}</span>
</div>
<div class="info_item">
<span>售后营养师</span>
<span>{{ customerData.afterDietitianName || "无" }}</span>
</div>
</div>
</div>
</el-tab-pane>
<el-tab-pane label="食谱计划" name="plan">
@ -69,12 +53,7 @@ export default {
},
},
computed: {
...mapState([
"healthyData",
"healthyDataType",
"healthDataLoading",
"customerData",
]),
...mapState(["healthyData", "healthyDataType", "healthDataLoading"]),
},
};
</script>

View File

@ -10,11 +10,13 @@
<div class="content">
<HealthyView
dev
showRemark
:data="healthyDataType === 0 ? healthyData : {}"
v-show="healthyDataType === 0"
/>
<BodySignView
dev
showRemark
:data="healthyDataType === 1 ? healthyData : {}"
v-show="healthyDataType === 1"
/>