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.StringUtils;
import com.stdiet.common.utils.sign.AesUtils; import com.stdiet.common.utils.sign.AesUtils;
import com.stdiet.custom.domain.SysOrderPause; import com.stdiet.custom.domain.SysOrderPause;
import com.stdiet.custom.domain.SysVideoComment;
import com.stdiet.custom.domain.SysWxAdLog; import com.stdiet.custom.domain.SysWxAdLog;
import com.stdiet.custom.service.*; import com.stdiet.custom.service.*;
import com.stdiet.custom.utils.CookieUtils; import com.stdiet.custom.utils.CookieUtils;
@ -45,6 +46,9 @@ public class SysWapController extends BaseController {
@Autowired @Autowired
ISysSmsConfirmServie iSysSmsConfirmServie; ISysSmsConfirmServie iSysSmsConfirmServie;
@Autowired
ISysNutritionalVideoService iSysNutritionalVideoService;
/** /**
* 客户食谱详情 * 客户食谱详情
@ -159,6 +163,12 @@ public class SysWapController extends BaseController {
return AjaxResult.success(); return AjaxResult.success();
} }
/**
* 获取验证码
*
* @param request
* @return
*/
@GetMapping(value = "/checkCookie") @GetMapping(value = "/checkCookie")
public AjaxResult checkCookie(HttpServletRequest request) { public AjaxResult checkCookie(HttpServletRequest request) {
JSONObject resultObj = CookieUtils.checkCookieValida(request, "token"); JSONObject resultObj = CookieUtils.checkCookieValida(request, "token");
@ -169,6 +179,12 @@ public class SysWapController extends BaseController {
} }
} }
/**
* 验证码校验
*
* @param phone
* @return
*/
@GetMapping(value = "/getCode") @GetMapping(value = "/getCode")
public AjaxResult getCode(@RequestParam String phone) { public AjaxResult getCode(@RequestParam String phone) {
@ -200,8 +216,6 @@ public class SysWapController extends BaseController {
String tokenStr = phone + "_" + new Date().getTime() + "_" + RandomStringUtils.randomAlphanumeric(8); String tokenStr = phone + "_" + new Date().getTime() + "_" + RandomStringUtils.randomAlphanumeric(8);
Cookie cookie = new Cookie("token", AesUtils.encrypt(tokenStr)); Cookie cookie = new Cookie("token", AesUtils.encrypt(tokenStr));
cookie.setMaxAge(24 * 60 * 60); cookie.setMaxAge(24 * 60 * 60);
// cookie.setSecure(true);
// cookie.setHttpOnly(true);
cookie.setPath("/"); cookie.setPath("/");
response.addCookie(cookie); response.addCookie(cookie);
return new AjaxResult(20000, "登录成功"); 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"); JSONObject result = CookieUtils.checkCookieValida(request, "token");
if (result.getInteger("code") != 200) { 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 cookie = new Cookie("token", "");
cookie.setMaxAge(24 * 60 * 60); cookie.setMaxAge(24 * 60 * 60);
cookie.setPath("/"); cookie.setPath("/");

View File

@ -31,4 +31,6 @@ public class SysRecipesPlanListInfo {
private Integer status; 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; package com.stdiet.custom.service;
import com.stdiet.custom.domain.SysNutritionalVideo;
import com.stdiet.custom.domain.SysVideoComment;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.stdiet.custom.domain.SysNutritionalVideo;
import com.stdiet.custom.domain.SysVideoClassify;
import org.apache.ibatis.annotations.Param;
/** /**
* 营养视频Service接口 * 营养视频Service接口
* *
* @author xzj * @author xzj
* @date 2021-04-29 * @date 2021-04-29
*/ */
public interface ISysNutritionalVideoService public interface ISysNutritionalVideoService {
{
/** /**
* 查询营养视频 * 查询营养视频
* *
@ -65,6 +63,7 @@ public interface ISysNutritionalVideoService
/** /**
* 获取视频 * 获取视频
*
* @param videoId * @param videoId
* @return * @return
*/ */
@ -72,12 +71,14 @@ public interface ISysNutritionalVideoService
/** /**
* 阿里云视频查询检索 * 阿里云视频查询检索
*
* @return * @return
*/ */
public Map<String,Object> searchVideo(String key, Integer status, Integer pageNo, Integer pageSize, String scrollToken); public Map<String, Object> searchVideo(String key, Integer status, Integer pageNo, Integer pageSize, String scrollToken);
/** /**
* 更新微信展示状态 * 更新微信展示状态
*
* @param wxShow * @param wxShow
* @param ids * @param ids
* @return * @return
@ -86,7 +87,38 @@ public interface ISysNutritionalVideoService
/** /**
* 更新视频播放量 * 更新视频播放量
*
* @return * @return
*/ */
public int updateVideoPlayNum(String videoId); 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 @Override
public Map<String, Object> getPhysicalSignsById(Long id) { public Map<String, Object> getPhysicalSignsById(Long id) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
SysCustomer customer = sysCustomerMapper.selectSysCustomerById(id);
result.put("customerInfo", customer);
String key = "customerHealthy"; String key = "customerHealthy";
result.put("type", 0); result.put("type", 0);
//查询健康评估信息 //查询健康评估信息

View File

@ -1,22 +1,24 @@
package com.stdiet.custom.service.impl; 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.SearchMediaResponse;
import com.aliyun.vod20170321.models.SearchMediaResponseBody; import com.aliyun.vod20170321.models.SearchMediaResponseBody;
import com.stdiet.common.utils.AliyunVideoUtils; import com.stdiet.common.utils.AliyunVideoUtils;
import com.stdiet.common.utils.DateUtils; import com.stdiet.common.utils.DateUtils;
import com.stdiet.common.utils.StringUtils; import com.stdiet.common.utils.StringUtils;
import com.stdiet.common.utils.oss.AliyunOSSUtils; 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.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.stdiet.custom.mapper.SysNutritionalVideoMapper;
import com.stdiet.custom.domain.SysNutritionalVideo; import java.util.ArrayList;
import com.stdiet.custom.service.ISysNutritionalVideoService; import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* 营养视频Service业务层处理 * 营养视频Service业务层处理
@ -25,11 +27,13 @@ import com.stdiet.custom.service.ISysNutritionalVideoService;
* @date 2021-04-29 * @date 2021-04-29
*/ */
@Service @Service
public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoService public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoService {
{
@Autowired @Autowired
private SysNutritionalVideoMapper sysNutritionalVideoMapper; private SysNutritionalVideoMapper sysNutritionalVideoMapper;
@Autowired
private SysVideoCommentMapper sysVideoCommentMapper;
/** /**
* 查询营养视频 * 查询营养视频
* *
@ -37,8 +41,7 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi
* @return 营养视频 * @return 营养视频
*/ */
@Override @Override
public SysNutritionalVideo selectSysNutritionalVideoById(Long id) public SysNutritionalVideo selectSysNutritionalVideoById(Long id) {
{
return sysNutritionalVideoMapper.selectSysNutritionalVideoById(id); return sysNutritionalVideoMapper.selectSysNutritionalVideoById(id);
} }
@ -49,35 +52,34 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi
* @return 营养视频 * @return 营养视频
*/ */
@Override @Override
public List<SysNutritionalVideo> selectSysNutritionalVideoList(SysNutritionalVideo sysNutritionalVideo, boolean flag) public List<SysNutritionalVideo> selectSysNutritionalVideoList(SysNutritionalVideo sysNutritionalVideo, boolean flag) {
{
List<SysNutritionalVideo> list = sysNutritionalVideoMapper.selectSysNutritionalVideoList(sysNutritionalVideo); List<SysNutritionalVideo> list = sysNutritionalVideoMapper.selectSysNutritionalVideoList(sysNutritionalVideo);
if(flag && list != null && list.size() > 0){ if (flag && list != null && list.size() > 0) {
List<String> fileUrl = new ArrayList<>(); List<String> fileUrl = new ArrayList<>();
List<String> videoIdList = new ArrayList<>(); List<String> videoIdList = new ArrayList<>();
for (SysNutritionalVideo video : list) { for (SysNutritionalVideo video : list) {
if(StringUtils.isNotEmpty(video.getCoverUrl())){ if (StringUtils.isNotEmpty(video.getCoverUrl())) {
fileUrl.add(video.getCoverUrl()); fileUrl.add(video.getCoverUrl());
}else{ } else {
videoIdList.add(video.getVideoId()); videoIdList.add(video.getVideoId());
} }
} }
if(fileUrl.size() > 0){ if (fileUrl.size() > 0) {
List<String> downUrlList = AliyunOSSUtils.generatePresignedUrl(fileUrl); List<String> downUrlList = AliyunOSSUtils.generatePresignedUrl(fileUrl);
if(downUrlList != null && downUrlList.size() > 0){ if (downUrlList != null && downUrlList.size() > 0) {
int index = 0; int index = 0;
for (SysNutritionalVideo video : list) { for (SysNutritionalVideo video : list) {
if (StringUtils.isNotEmpty(video.getCoverUrl())) { if (StringUtils.isNotEmpty(video.getCoverUrl())) {
video.setCoverUrl(downUrlList.get(index)); video.setCoverUrl(downUrlList.get(index));
index++; index++;
if(index == downUrlList.size()){ if (index == downUrlList.size()) {
break; break;
} }
} }
} }
} }
} }
if(videoIdList.size() > 0) { if (videoIdList.size() > 0) {
List<String> coverUrlList = AliyunVideoUtils.getVideoCoverUrl(videoIdList); List<String> coverUrlList = AliyunVideoUtils.getVideoCoverUrl(videoIdList);
if (coverUrlList != null && coverUrlList.size() > 0) { if (coverUrlList != null && coverUrlList.size() > 0) {
int index = 0; int index = 0;
@ -85,7 +87,7 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi
if (StringUtils.isEmpty(video.getCoverUrl())) { if (StringUtils.isEmpty(video.getCoverUrl())) {
video.setCoverUrl(coverUrlList.get(index)); video.setCoverUrl(coverUrlList.get(index));
index++; index++;
if(index == coverUrlList.size()){ if (index == coverUrlList.size()) {
break; break;
} }
} }
@ -103,15 +105,14 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi
* @return 结果 * @return 结果
*/ */
@Override @Override
public int insertSysNutritionalVideo(SysNutritionalVideo sysNutritionalVideo) public int insertSysNutritionalVideo(SysNutritionalVideo sysNutritionalVideo) {
{
sysNutritionalVideo.setCreateTime(DateUtils.getNowDate()); sysNutritionalVideo.setCreateTime(DateUtils.getNowDate());
//判断封面是上传的还是阿里云视频截图封面 //判断封面是上传的还是阿里云视频截图封面
if(isSnapshot(sysNutritionalVideo.getCoverUrl())){ if (isSnapshot(sysNutritionalVideo.getCoverUrl())) {
//更新阿里云视频封面 //更新阿里云视频封面
try{ try {
AliyunVideoUtils.updateVideoCoverUrl(sysNutritionalVideo.getVideoId(), sysNutritionalVideo.getCoverUrl()); AliyunVideoUtils.updateVideoCoverUrl(sysNutritionalVideo.getVideoId(), sysNutritionalVideo.getCoverUrl());
}catch (Exception e){ } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return 0; return 0;
} }
@ -127,15 +128,14 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi
* @return 结果 * @return 结果
*/ */
@Override @Override
public int updateSysNutritionalVideo(SysNutritionalVideo sysNutritionalVideo) public int updateSysNutritionalVideo(SysNutritionalVideo sysNutritionalVideo) {
{
sysNutritionalVideo.setUpdateTime(DateUtils.getNowDate()); sysNutritionalVideo.setUpdateTime(DateUtils.getNowDate());
sysNutritionalVideo.setCoverUrl(sysNutritionalVideo.getCoverUrl() == null ? "" : sysNutritionalVideo.getCoverUrl()); sysNutritionalVideo.setCoverUrl(sysNutritionalVideo.getCoverUrl() == null ? "" : sysNutritionalVideo.getCoverUrl());
String coverUrl = sysNutritionalVideo.getCoverUrl(); String coverUrl = sysNutritionalVideo.getCoverUrl();
//判断封面是上传的还是阿里云视频截图封面 //判断封面是上传的还是阿里云视频截图封面
sysNutritionalVideo.setCoverUrl(isSnapshot(coverUrl) ? "" : coverUrl); sysNutritionalVideo.setCoverUrl(isSnapshot(coverUrl) ? "" : coverUrl);
int row = sysNutritionalVideoMapper.updateSysNutritionalVideo(sysNutritionalVideo); int row = sysNutritionalVideoMapper.updateSysNutritionalVideo(sysNutritionalVideo);
if(row > 0){ if (row > 0) {
sysNutritionalVideo.setCoverUrl(isSnapshot(coverUrl) ? coverUrl : null); sysNutritionalVideo.setCoverUrl(isSnapshot(coverUrl) ? coverUrl : null);
updateAliyunVideo(sysNutritionalVideo); updateAliyunVideo(sysNutritionalVideo);
} }
@ -143,12 +143,12 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi
} }
@Async @Async
public void updateAliyunVideo(SysNutritionalVideo sysNutritionalVideo){ public void updateAliyunVideo(SysNutritionalVideo sysNutritionalVideo) {
try{ try {
if(sysNutritionalVideo != null && sysNutritionalVideo.getVideoId() != null){ if (sysNutritionalVideo != null && sysNutritionalVideo.getVideoId() != null) {
AliyunVideoUtils.updateVideo(sysNutritionalVideo.getVideoId(), sysNutritionalVideo.getTitle(), sysNutritionalVideo.getTags(), sysNutritionalVideo.getDescription(), null, sysNutritionalVideo.getCoverUrl()); AliyunVideoUtils.updateVideo(sysNutritionalVideo.getVideoId(), sysNutritionalVideo.getTitle(), sysNutritionalVideo.getTags(), sysNutritionalVideo.getDescription(), null, sysNutritionalVideo.getCoverUrl());
} }
}catch (Exception e){ } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -160,10 +160,9 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteSysNutritionalVideoByIds(Long[] ids) public int deleteSysNutritionalVideoByIds(Long[] ids) {
{
int row = sysNutritionalVideoMapper.deleteSysNutritionalVideoByIds(ids); int row = sysNutritionalVideoMapper.deleteSysNutritionalVideoByIds(ids);
if(row > 0){ if (row > 0) {
updateAliyunVideoCateId(ids); updateAliyunVideoCateId(ids);
} }
return row; return row;
@ -176,10 +175,9 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteSysNutritionalVideoById(Long id) public int deleteSysNutritionalVideoById(Long id) {
{
int row = sysNutritionalVideoMapper.deleteSysNutritionalVideoById(id); int row = sysNutritionalVideoMapper.deleteSysNutritionalVideoById(id);
if(row > 0){ if (row > 0) {
Long[] ids = {id}; Long[] ids = {id};
updateAliyunVideoCateId(ids); updateAliyunVideoCateId(ids);
} }
@ -188,30 +186,32 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi
/** /**
* 获取视频 * 获取视频
*
* @param videoId * @param videoId
* @return * @return
*/ */
public SysNutritionalVideo selectSysNutritionalVideByVideoId(String videoId){ public SysNutritionalVideo selectSysNutritionalVideByVideoId(String videoId) {
return sysNutritionalVideoMapper.selectSysNutritionalVideByVideoId(videoId); return sysNutritionalVideoMapper.selectSysNutritionalVideByVideoId(videoId);
} }
/** /**
* 阿里云视频查询检索 * 阿里云视频查询检索
*
* @return * @return
*/ */
public Map<String,Object> searchVideo(String key, Integer showFlag, Integer pageNo, Integer pageSize, String scrollToken){ public Map<String, Object> searchVideo(String key, Integer showFlag, Integer pageNo, Integer pageSize, String scrollToken) {
pageSize = pageSize.intValue() > 100 ? 10 : pageSize; pageSize = pageSize.intValue() > 100 ? 10 : pageSize;
long total = 0; long total = 0;
String newScrollToken = null; String newScrollToken = null;
List<SysNutritionalVideo> nutritionalVideoList = new ArrayList<>(); List<SysNutritionalVideo> nutritionalVideoList = new ArrayList<>();
try { try {
SearchMediaResponse response = AliyunVideoUtils.searchVideo(key, getStatusString(showFlag), pageNo, pageSize, scrollToken); SearchMediaResponse response = AliyunVideoUtils.searchVideo(key, getStatusString(showFlag), pageNo, pageSize, scrollToken);
if(response != null){ if (response != null) {
SearchMediaResponseBody body = response.body; SearchMediaResponseBody body = response.body;
total = body.total; total = body.total;
newScrollToken = body.scrollToken; newScrollToken = body.scrollToken;
List<SearchMediaResponseBody.SearchMediaResponseBodyMediaList> mediaList = body.mediaList; List<SearchMediaResponseBody.SearchMediaResponseBodyMediaList> mediaList = body.mediaList;
if(mediaList != null && mediaList.size() > 0){ if (mediaList != null && mediaList.size() > 0) {
for (SearchMediaResponseBody.SearchMediaResponseBodyMediaList media : mediaList) { for (SearchMediaResponseBody.SearchMediaResponseBodyMediaList media : mediaList) {
SysNutritionalVideo sysNutritionalVideo = new SysNutritionalVideo(); SysNutritionalVideo sysNutritionalVideo = new SysNutritionalVideo();
sysNutritionalVideo.setTitle(media.video.title); sysNutritionalVideo.setTitle(media.video.title);
@ -225,7 +225,7 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi
} }
} }
} }
}catch (Exception e){ } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
@ -235,65 +235,135 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi
return result; return result;
} }
private String getStatusString(Integer status){ private String getStatusString(Integer status) {
if(status == null){ if (status == null) {
return "Normal,Blocked"; return "Normal,Blocked";
} }
return status.intValue() == 1 ? "Normal" : "Blocked"; return status.intValue() == 1 ? "Normal" : "Blocked";
} }
private Integer getStatus(String status){ private Integer getStatus(String status) {
if(status == null){ if (status == null) {
return 1; return 1;
} }
return "Normal".equals(status) ? 1 : 0; return "Normal".equals(status) ? 1 : 0;
} }
/** /**
* 更新微信展示状态 * 更新微信展示状态
*
* @param wxShow * @param wxShow
* @param ids * @param ids
* @return * @return
*/ */
public int updateWxshowByIds(Integer wxShow, Long[] ids){ public int updateWxshowByIds(Integer wxShow, Long[] ids) {
return sysNutritionalVideoMapper.updateWxshowByIds(wxShow, ids); return sysNutritionalVideoMapper.updateWxshowByIds(wxShow, ids);
} }
/** /**
* 将删除的阿里云视频放入回收站 * 将删除的阿里云视频放入回收站
*
* @param ids * @param ids
*/ */
@Async @Async
public void updateAliyunVideoCateId(Long[] ids){ public void updateAliyunVideoCateId(Long[] ids) {
try { try {
List<String> videoIdList = sysNutritionalVideoMapper.getVideoIdByIds(ids); List<String> videoIdList = sysNutritionalVideoMapper.getVideoIdByIds(ids);
if(videoIdList != null && videoIdList.size() > 0){ if (videoIdList != null && videoIdList.size() > 0) {
for (String videoId : videoIdList) { for (String videoId : videoIdList) {
AliyunVideoUtils.delVideo(videoId); AliyunVideoUtils.delVideo(videoId);
} }
} }
}catch (Exception e){ } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
/** /**
* 更新视频播放量 * 更新视频播放量
*
* @return * @return
*/ */
public int updateVideoPlayNum(String videoId){ public int updateVideoPlayNum(String videoId) {
return sysNutritionalVideoMapper.updateVideoPlayNum(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 * @param url
* @return * @return
*/ */
private boolean isSnapshot(String url){ private boolean isSnapshot(String url) {
return StringUtils.isNotEmpty(url) && url.startsWith("http://outin"); return StringUtils.isNotEmpty(url) && url.startsWith("http://outin");
} }
} }

View File

@ -36,11 +36,13 @@
<result property="nutritionist" column="nutritionist"/> <result property="nutritionist" column="nutritionist"/>
<result property="nutritionistAssisId" column="nutritionist_assis_id"/> <result property="nutritionistAssisId" column="nutritionist_assis_id"/>
<result property="nutritionistAssis" column="nutritionist_assis"/> <result property="nutritionistAssis" column="nutritionist_assis"/>
<result property="remark" column="remark"/>
</resultMap> </resultMap>
<sql id="selectSysRecipesPlanVo"> <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> </sql>
<select id="selectSysRecipesPlanList" parameterType="SysRecipesPlan" resultMap="SysRecipesPlanResult"> <select id="selectSysRecipesPlanList" parameterType="SysRecipesPlan" resultMap="SysRecipesPlanResult">
@ -141,6 +143,7 @@
<if test="subscribed != null">subscribed = #{subscribed},</if> <if test="subscribed != null">subscribed = #{subscribed},</if>
<if test="subSend != null">sub_send = #{subSend},</if> <if test="subSend != null">sub_send = #{subSend},</if>
<if test="smsSend != null">sms_send = #{smsSend},</if> <if test="smsSend != null">sms_send = #{smsSend},</if>
<if test="remark != null">remark = #{remark},</if>
</trim> </trim>
where id = #{id} and del_flag = 0 where id = #{id} and del_flag = 0
</update> </update>
@ -185,10 +188,11 @@
srp.subscribed srp.subscribed
FROM sys_recipes_plan srp FROM sys_recipes_plan srp
LEFT JOIN sys_customer sc ON sc.id = srp.cus_id 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 LEFT JOIN sys_user su_nutritionist_assis ON su_nutritionist_assis.user_id = sc.assistant_dietitian AND
su_nutritionist_assis.del_flag = 0 su_nutritionist_assis.del_flag = 0
WHERE srp.del_flag = 0 AND sc.del_flag = 0 AND srp.type = 0 WHERE srp.del_flag = 0 AND sc.del_flag = 0 AND srp.type = 0
<if test="orderId != null">AND srp.order_id = #{orderId}</if> <if test="orderId != null">AND srp.order_id = #{orderId}</if>
<if test="sendFlag != null">AND srp.send_flag = #{sendFlag}</if> <if test="sendFlag != null">AND srp.send_flag = #{sendFlag}</if>
<if test="customer != null and customer != ''">AND (sc.name like concat('%',#{customer},'%') OR sc.phone like <if test="customer != null and customer != ''">AND (sc.name like concat('%',#{customer},'%') OR sc.phone like
@ -249,6 +253,7 @@
<result property="recipesId" column="recipes_id"/> <result property="recipesId" column="recipes_id"/>
<result property="sendFlag" column="send_flag"/> <result property="sendFlag" column="send_flag"/>
<result property="subscribed" column="subscribed"/> <result property="subscribed" column="subscribed"/>
<result property="remark" column="remark"/>
<association property="menus" column="recipes_id" select="selectMenuIds"/> <association property="menus" column="recipes_id" select="selectMenuIds"/>
</resultMap> </resultMap>
@ -256,12 +261,12 @@
and review_status = 2 and send_flag = 1 and review_status = 2 and send_flag = 1
--> -->
<select id="selectRecipesPlanListInfo" resultMap="SysRecipesPlanListInfoResult"> <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> </select>
<!-- and review_status = 2 and send_flag = 1--> <!-- and review_status = 2 and send_flag = 1-->
<select id="selectRecipesPlanListInfoByCusId" resultMap="SysRecipesPlanListInfoResult"> <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> </select>
<resultMap type="SysRecipesDaily" id="SysRecipesResult"> <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" :value.sync="data.avoidFood"
@onConfirm="handleOnConfirm" @onConfirm="handleOnConfirm"
/> />
<RemarkCom
v-if="dev && showRemark"
title="营养师点评"
:value.sync="data.recipesPlanRemark"
@onConfirm="handleOnRemarkConfirm"
/>
</div> </div>
</template> </template>
<script> <script>
@ -39,6 +45,10 @@ export default {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
showRemark: {
type: Boolean,
default: false,
},
}, },
components: { components: {
"text-info": TextInfo, "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> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

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

View File

@ -21,6 +21,12 @@
:value.sync="data.avoidFood" :value.sync="data.avoidFood"
@onConfirm="handleOnConfirm" @onConfirm="handleOnConfirm"
/> />
<RemarkCom
v-if="dev && showRemark"
title="营养师点评"
:value.sync="data.recipesPlanRemark"
@onConfirm="handleOnRemarkConfirm"
/>
</div> </div>
<el-collapse> <el-collapse>
<el-collapse-item <el-collapse-item
@ -57,6 +63,7 @@ import TextInfo from "@/components/TextInfo";
import ACFCom from "./ACFCom"; import ACFCom from "./ACFCom";
import RemarkCom from "./RemarkCom"; import RemarkCom from "./RemarkCom";
import { updateHealthy } from "@/api/custom/healthy"; import { updateHealthy } from "@/api/custom/healthy";
import { updateRecipesPlan } from "@/api/custom/recipesPlan";
export default { export default {
name: "HealthyView", name: "HealthyView",
@ -69,6 +76,10 @@ export default {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
showRemark: {
type: Boolean,
default: false,
},
}, },
components: { components: {
"text-info": TextInfo, "text-info": TextInfo,
@ -121,7 +132,7 @@ export default {
{ title: "过敏源", value: "allergen" }, { title: "过敏源", value: "allergen" },
], ],
}, },
{ {
title: "运动习惯评估", title: "运动习惯评估",
content: [ content: [
{ title: "每周运动次数", value: "motionNum" }, { title: "每周运动次数", value: "motionNum" },
@ -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> </script>

View File

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

View File

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

View File

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

View File

@ -15,22 +15,6 @@
:data="healthyDataType === 1 ? healthyData : {}" :data="healthyDataType === 1 ? healthyData : {}"
v-show="healthyDataType === 1" 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> </div>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="食谱计划" name="plan"> <el-tab-pane label="食谱计划" name="plan">
@ -69,12 +53,7 @@ export default {
}, },
}, },
computed: { computed: {
...mapState([ ...mapState(["healthyData", "healthyDataType", "healthDataLoading"]),
"healthyData",
"healthyDataType",
"healthDataLoading",
"customerData",
]),
}, },
}; };
</script> </script>

View File

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