commit
e72deee8fb
@ -3,14 +3,7 @@ package com.stdiet.web.controller.custom;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
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.annotation.Log;
|
||||||
import com.stdiet.common.core.controller.BaseController;
|
import com.stdiet.common.core.controller.BaseController;
|
||||||
import com.stdiet.common.core.domain.AjaxResult;
|
import com.stdiet.common.core.domain.AjaxResult;
|
||||||
@ -40,7 +33,8 @@ public class SysVideoClassifyController extends BaseController
|
|||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(SysVideoClassify sysVideoClassify)
|
public TableDataInfo list(SysVideoClassify sysVideoClassify)
|
||||||
{
|
{
|
||||||
startPage();
|
//startPage();
|
||||||
|
//sysVideoClassify.setParentId(0L);
|
||||||
List<SysVideoClassify> list = sysVideoClassifyService.selectSysVideoClassifyList(sysVideoClassify);
|
List<SysVideoClassify> list = sysVideoClassifyService.selectSysVideoClassifyList(sysVideoClassify);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
@ -105,9 +99,9 @@ public class SysVideoClassifyController extends BaseController
|
|||||||
* 查询视频分类列表
|
* 查询视频分类列表
|
||||||
*/
|
*/
|
||||||
@GetMapping("/getAllClassify")
|
@GetMapping("/getAllClassify")
|
||||||
public AjaxResult getAllClassify()
|
public AjaxResult getAllClassify(SysVideoClassify sysVideoClassify)
|
||||||
{
|
{
|
||||||
List<SysVideoClassify> list = sysVideoClassifyService.getAllClassify();
|
List<SysVideoClassify> list = sysVideoClassifyService.getAllClassify(sysVideoClassify);
|
||||||
return AjaxResult.success(list);
|
return AjaxResult.success(list);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -0,0 +1,104 @@
|
|||||||
|
package com.stdiet.web.controller.custom;
|
||||||
|
|
||||||
|
import com.aliyun.vod20170321.models.GetPlayInfoResponseBody;
|
||||||
|
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.utils.AliyunVideoUtils;
|
||||||
|
import com.stdiet.common.utils.StringUtils;
|
||||||
|
import com.stdiet.common.utils.oss.AliyunOSSUtils;
|
||||||
|
import com.stdiet.custom.domain.SysNutritionalVideo;
|
||||||
|
import com.stdiet.custom.domain.SysVideoClassify;
|
||||||
|
import com.stdiet.custom.dto.response.NutritionalVideoResponse;
|
||||||
|
import com.stdiet.custom.dto.response.VideoClassifyResponse;
|
||||||
|
import com.stdiet.custom.service.ISysNutritionalVideoService;
|
||||||
|
import com.stdiet.custom.service.ISysVideoClassifyService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/web/video")
|
||||||
|
public class VideoWebInterfaceController extends BaseController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysVideoClassifyService sysVideoClassifyService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysNutritionalVideoService sysNutritionalVideoService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询视频分类目录列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/getAllClassify")
|
||||||
|
public TableDataInfo getClassifyAndVideo(SysVideoClassify sysVideoClassify)
|
||||||
|
{
|
||||||
|
//不分页则不需要传pageNum、pageSize参数
|
||||||
|
startPage();
|
||||||
|
//父级分类ID 0表示主分类
|
||||||
|
sysVideoClassify.setParentId(0L);
|
||||||
|
//客户类型 0 未付费客户 1已付费客户
|
||||||
|
sysVideoClassify.setUserType(1);
|
||||||
|
List<VideoClassifyResponse> list = sysVideoClassifyService.getAllClassifyAndVideo(sysVideoClassify);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据视频videoId获取视频详情以及播放地址
|
||||||
|
* @param videoId 阿里云中对应videoId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/getVideoDetail/{videoId}")
|
||||||
|
public AjaxResult getVideoDetail(@PathVariable("videoId") String videoId)
|
||||||
|
{
|
||||||
|
if(StringUtils.isEmpty(videoId)){
|
||||||
|
return AjaxResult.error("视频加载失败");
|
||||||
|
}
|
||||||
|
SysNutritionalVideo sysNutritionalVideo = sysNutritionalVideoService.selectSysNutritionalVideByVideoId(videoId);
|
||||||
|
if(sysNutritionalVideo == null){
|
||||||
|
return AjaxResult.error("视频加载失败");
|
||||||
|
}
|
||||||
|
NutritionalVideoResponse nutritionalVideoResponse = new NutritionalVideoResponse();
|
||||||
|
try {
|
||||||
|
GetPlayInfoResponseBody playInfoResponseBody = AliyunVideoUtils.getVideoVisitDetail(videoId);
|
||||||
|
List<GetPlayInfoResponseBody.GetPlayInfoResponseBodyPlayInfoListPlayInfo> playList = playInfoResponseBody.playInfoList.playInfo;
|
||||||
|
if (playList != null && playList.size() > 0) {
|
||||||
|
//播放地址
|
||||||
|
nutritionalVideoResponse.setPlayUrl(playList.get(0).getPlayURL());
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
return AjaxResult.error("视频加载失败");
|
||||||
|
}
|
||||||
|
//视频封面URL
|
||||||
|
if (StringUtils.isNotEmpty(sysNutritionalVideo.getCoverUrl())) {
|
||||||
|
nutritionalVideoResponse.setCoverUrl(AliyunOSSUtils.generatePresignedUrl(sysNutritionalVideo.getCoverUrl()));
|
||||||
|
} else {
|
||||||
|
nutritionalVideoResponse.setCoverUrl(AliyunVideoUtils.getVideoCoverUrl(videoId));
|
||||||
|
}
|
||||||
|
//视频描述
|
||||||
|
nutritionalVideoResponse.setDescription(sysNutritionalVideo.getDescription());
|
||||||
|
//视频标题
|
||||||
|
nutritionalVideoResponse.setTitle(sysNutritionalVideo.getTitle());
|
||||||
|
//视频播放量
|
||||||
|
nutritionalVideoResponse.setPlayNum(sysNutritionalVideo.getPlayNum());
|
||||||
|
|
||||||
|
return AjaxResult.success(nutritionalVideoResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新视频播放次数
|
||||||
|
* @param videoId 阿里云中对应videoId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/updateVideoPlayNum")
|
||||||
|
public AjaxResult updateVideoPlayNum(@RequestParam(value = "videoId") String videoId) {
|
||||||
|
if(StringUtils.isEmpty(videoId)){
|
||||||
|
return AjaxResult.error("更新失败");
|
||||||
|
}
|
||||||
|
return toAjax(sysNutritionalVideoService.updateVideoPlayNum(videoId));
|
||||||
|
}
|
||||||
|
}
|
@ -714,7 +714,9 @@ public class WechatAppletController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@GetMapping("/getVideoClassify")
|
@GetMapping("/getVideoClassify")
|
||||||
public AjaxResult getVideoClassify(@RequestParam("openid")String openid) {
|
public AjaxResult getVideoClassify(@RequestParam("openid")String openid) {
|
||||||
List<SysVideoClassify> list = sysVideoClassifyService.selectSysVideoClassifyList(new SysVideoClassify());
|
SysVideoClassify param = new SysVideoClassify();
|
||||||
|
param.setParentId(0L);
|
||||||
|
List<SysVideoClassify> list = sysVideoClassifyService.getAllClassify(param);
|
||||||
List<List<Map<String,Object>>> result = new ArrayList<>();
|
List<List<Map<String,Object>>> result = new ArrayList<>();
|
||||||
int groupCount = 3;
|
int groupCount = 3;
|
||||||
SysVideoClassify all = new SysVideoClassify();
|
SysVideoClassify all = new SysVideoClassify();
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
package com.stdiet.custom.domain;
|
package com.stdiet.custom.domain;
|
||||||
|
|
||||||
|
import com.stdiet.custom.dto.response.VideoClassifyTwoResponse;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
|
||||||
import com.stdiet.common.annotation.Excel;
|
import com.stdiet.common.annotation.Excel;
|
||||||
import com.stdiet.common.core.domain.BaseEntity;
|
import com.stdiet.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 视频分类对象 sys_video_classify
|
* 视频分类对象 sys_video_classify
|
||||||
*
|
*
|
||||||
@ -24,10 +26,17 @@ public class SysVideoClassify extends BaseEntity
|
|||||||
@Excel(name = "分类名称")
|
@Excel(name = "分类名称")
|
||||||
private String cateName;
|
private String cateName;
|
||||||
|
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
private Integer orderNum;
|
||||||
|
|
||||||
/** 类型标识,0全部可看 1客户可看 2额外付费观看 */
|
/** 类型标识,0全部可看 1客户可看 2额外付费观看 */
|
||||||
@Excel(name = "类型标识,0全部可看 1客户可看 2额外付费观看")
|
@Excel(name = "类型标识,0全部可看 1客户可看 2额外付费观看")
|
||||||
private Integer payFlag;
|
private Integer payFlag;
|
||||||
|
|
||||||
/** 删除标识 0未删除 1已删除 */
|
/** 删除标识 0未删除 1已删除 */
|
||||||
private Integer delFlag;
|
private Integer delFlag;
|
||||||
|
|
||||||
|
//用户类型 0 普通用户 1付费客户
|
||||||
|
private Integer userType;
|
||||||
}
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
package com.stdiet.custom.dto.response;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class VideoClassifyResponse implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
//目录分类ID
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
//目录分类名称
|
||||||
|
private String cateName;
|
||||||
|
|
||||||
|
//用户类型 0 普通用户 1付费客户
|
||||||
|
private Integer userType;
|
||||||
|
|
||||||
|
//子分类
|
||||||
|
private List<VideoClassifyTwoResponse> childrenClassify;
|
||||||
|
|
||||||
|
//子视频
|
||||||
|
private List<VideoResponse> childrenVideo;
|
||||||
|
}
|
@ -0,0 +1,45 @@
|
|||||||
|
package com.stdiet.custom.dto.response;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class VideoClassifyThreeResponse implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
//目录分类ID
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
//目录分类名称
|
||||||
|
private String cateName;
|
||||||
|
|
||||||
|
//子视频
|
||||||
|
private List<Map<String, Object>> childrenVideo;
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCateName() {
|
||||||
|
return cateName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCateName(String cateName) {
|
||||||
|
this.cateName = cateName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Map<String, Object>> getChildrenVideo() {
|
||||||
|
return childrenVideo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChildrenVideo(List<Map<String, Object>> childrenVideo) {
|
||||||
|
this.childrenVideo = childrenVideo;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,56 @@
|
|||||||
|
package com.stdiet.custom.dto.response;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class VideoClassifyTwoResponse implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
//目录分类ID
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
//目录分类名称
|
||||||
|
private String cateName;
|
||||||
|
|
||||||
|
//子分类
|
||||||
|
private List<VideoClassifyThreeResponse> childrenClassify;
|
||||||
|
|
||||||
|
//子视频
|
||||||
|
private List<Map<String, Object>> childrenVideo;
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCateName() {
|
||||||
|
return cateName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCateName(String cateName) {
|
||||||
|
this.cateName = cateName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<VideoClassifyThreeResponse> getChildrenClassify() {
|
||||||
|
return childrenClassify;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChildrenClassify(List<VideoClassifyThreeResponse> childrenClassify) {
|
||||||
|
this.childrenClassify = childrenClassify;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Map<String, Object>> getChildrenVideo() {
|
||||||
|
return childrenVideo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChildrenVideo(List<Map<String, Object>> childrenVideo) {
|
||||||
|
this.childrenVideo = childrenVideo;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
package com.stdiet.custom.dto.response;
|
||||||
|
|
||||||
|
import com.stdiet.common.utils.AliyunVideoUtils;
|
||||||
|
import com.stdiet.common.utils.StringUtils;
|
||||||
|
import com.stdiet.common.utils.oss.AliyunOSSUtils;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class VideoResponse implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
//阿里云中对应视频ID
|
||||||
|
private String videoId;
|
||||||
|
|
||||||
|
//视频标题
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
//视频封面
|
||||||
|
private String coverUrl;
|
||||||
|
|
||||||
|
//播放次数
|
||||||
|
private Integer playNum;
|
||||||
|
|
||||||
|
public String getVideoId() {
|
||||||
|
return videoId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVideoId(String videoId) {
|
||||||
|
this.videoId = videoId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCoverUrl() {
|
||||||
|
if (StringUtils.isNotEmpty(this.coverUrl)) {
|
||||||
|
return AliyunOSSUtils.generatePresignedUrl(this.coverUrl);
|
||||||
|
} else {
|
||||||
|
return AliyunVideoUtils.getVideoCoverUrl(this.videoId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCoverUrl(String coverUrl) {
|
||||||
|
this.coverUrl = coverUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getPlayNum() {
|
||||||
|
return playNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlayNum(Integer playNum) {
|
||||||
|
this.playNum = playNum;
|
||||||
|
}
|
||||||
|
}
|
@ -2,6 +2,7 @@ package com.stdiet.custom.mapper;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.stdiet.custom.domain.SysVideoClassify;
|
import com.stdiet.custom.domain.SysVideoClassify;
|
||||||
|
import com.stdiet.custom.dto.response.VideoClassifyResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 视频分类Mapper接口
|
* 视频分类Mapper接口
|
||||||
@ -63,5 +64,12 @@ public interface SysVideoClassifyMapper
|
|||||||
* 获取所有类别
|
* 获取所有类别
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<SysVideoClassify> getAllClassify();
|
public List<SysVideoClassify> getAllClassify(SysVideoClassify sysVideoClassify);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据父级ID获取下面子分类以及视频
|
||||||
|
* @param parentId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<VideoClassifyResponse> getOneAllClassifyAndVideo(SysVideoClassify sysVideoClassify);
|
||||||
}
|
}
|
@ -4,6 +4,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.stdiet.custom.domain.SysNutritionalVideo;
|
import com.stdiet.custom.domain.SysNutritionalVideo;
|
||||||
|
import com.stdiet.custom.domain.SysVideoClassify;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2,6 +2,7 @@ package com.stdiet.custom.service;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.stdiet.custom.domain.SysVideoClassify;
|
import com.stdiet.custom.domain.SysVideoClassify;
|
||||||
|
import com.stdiet.custom.dto.response.VideoClassifyResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 视频分类Service接口
|
* 视频分类Service接口
|
||||||
@ -63,5 +64,12 @@ public interface ISysVideoClassifyService
|
|||||||
* 获取所有类别
|
* 获取所有类别
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<SysVideoClassify> getAllClassify();
|
public List<SysVideoClassify> getAllClassify(SysVideoClassify sysVideoClassify);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按分类层级分类,返回视频目录列表
|
||||||
|
*
|
||||||
|
* @return 视频分类集合
|
||||||
|
*/
|
||||||
|
public List<VideoClassifyResponse> getAllClassifyAndVideo(SysVideoClassify sysVideoClassify);
|
||||||
}
|
}
|
@ -378,7 +378,7 @@ public class SysOrderServiceImpl implements ISysOrderService {
|
|||||||
LocalDate newStartTime = null;
|
LocalDate newStartTime = null;
|
||||||
//判断是否提成单,拆分单中的副单,体验单,定金单
|
//判断是否提成单,拆分单中的副单,体验单,定金单
|
||||||
if(sysOrder.getStartTime() == null || sysOrder.getAfterSaleCommissOrder().intValue() == 1 || sysOrder.getMainOrderId().intValue() != 0 ||
|
if(sysOrder.getStartTime() == null || sysOrder.getAfterSaleCommissOrder().intValue() == 1 || sysOrder.getMainOrderId().intValue() != 0 ||
|
||||||
"2".equals(sysOrder.getOrderType()) || "1".equals(sysOrder.getOrderMoneyType())){
|
"2".equals(sysOrder.getOrderType()) || !isNeedByOrderMoneyType(sysOrder)){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//判断前一个订单的结束时间是否大于第二个订单的
|
//判断前一个订单的结束时间是否大于第二个订单的
|
||||||
@ -404,6 +404,21 @@ public class SysOrderServiceImpl implements ISysOrderService {
|
|||||||
return row;
|
return row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//定金单或尾款单是否需要生成食谱计划,2021-01-12修改为6月11日之后成交的订单只生成定金单计划
|
||||||
|
private boolean isNeedByOrderMoneyType(SysOrder sysOrder){
|
||||||
|
if("0".equals(sysOrder.getOrderMoneyType())){
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
//成交时间
|
||||||
|
LocalDate orderDate = DateUtils.dateToLocalDate(sysOrder.getOrderTime());
|
||||||
|
if(ChronoUnit.DAYS.between(SysRecipesPlanServiceImpl.newVersionPlanStartDate, orderDate) >= 0){
|
||||||
|
return "1".equals(sysOrder.getOrderMoneyType());
|
||||||
|
}else{
|
||||||
|
return "2".equals(sysOrder.getOrderMoneyType());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 给对象SysOrder对象设置服务到期时间
|
* 给对象SysOrder对象设置服务到期时间
|
||||||
*
|
*
|
||||||
|
@ -44,6 +44,9 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private SysRecipesMapper sysRecipesMapper;
|
private SysRecipesMapper sysRecipesMapper;
|
||||||
|
|
||||||
|
//2021-06-11之后(大于等于)成交的订单,只生成定金单食谱计划,不生成尾款食谱计划,之前成交的订单还是保持之前逻辑
|
||||||
|
public static final LocalDate newVersionPlanStartDate = DateUtils.stringToLocalDate("2021-06-11", "yyyy-MM-dd");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询食谱计划
|
* 查询食谱计划
|
||||||
*
|
*
|
||||||
@ -172,7 +175,7 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService {
|
|||||||
//判断是否提成单,拆分单中的副单,体验单,定金单
|
//判断是否提成单,拆分单中的副单,体验单,定金单
|
||||||
if (sysOrder.getAfterSaleCommissOrder().intValue() == 1 || sysOrder.getMainOrderId().intValue() != 0 ||
|
if (sysOrder.getAfterSaleCommissOrder().intValue() == 1 || sysOrder.getMainOrderId().intValue() != 0 ||
|
||||||
// "2".equals(sysOrder.getOrderType()) || // 体验单也需要生成计划 2021.05.29
|
// "2".equals(sysOrder.getOrderType()) || // 体验单也需要生成计划 2021.05.29
|
||||||
"1".equals(sysOrder.getOrderMoneyType()) || sysOrder.getCounted() == 1) {
|
!isNeedByOrderMoneyType(sysOrder) || sysOrder.getCounted() == 1) {
|
||||||
System.out.println("---------------------" + sysOrder.getOrderId() + "不生成食谱------------------------");
|
System.out.println("---------------------" + sysOrder.getOrderId() + "不生成食谱------------------------");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -208,6 +211,21 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//定金单或尾款单是否需要生成食谱计划,2021-01-12修改为6月11日之后成交的订单只生成定金单计划
|
||||||
|
private boolean isNeedByOrderMoneyType(SysOrder sysOrder){
|
||||||
|
if("0".equals(sysOrder.getOrderMoneyType())){
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
//成交时间
|
||||||
|
LocalDate orderDate = DateUtils.dateToLocalDate(sysOrder.getOrderTime());
|
||||||
|
if(ChronoUnit.DAYS.between(newVersionPlanStartDate, orderDate) >= 0){
|
||||||
|
return "1".equals(sysOrder.getOrderMoneyType());
|
||||||
|
}else{
|
||||||
|
return "2".equals(sysOrder.getOrderMoneyType());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询食谱计划中对应食谱存在天数缺失的食谱计划,食谱计划发生变化时,可能会导致sys_customer_daily_menu表中天数缺失,需要查询出来进行补充
|
* 查询食谱计划中对应食谱存在天数缺失的食谱计划,食谱计划发生变化时,可能会导致sys_customer_daily_menu表中天数缺失,需要查询出来进行补充
|
||||||
* @param cusId 客户ID
|
* @param cusId 客户ID
|
||||||
|
@ -2,6 +2,8 @@ package com.stdiet.custom.service.impl;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.stdiet.common.utils.DateUtils;
|
import com.stdiet.common.utils.DateUtils;
|
||||||
|
import com.stdiet.custom.dto.response.VideoClassifyResponse;
|
||||||
|
import com.stdiet.custom.mapper.SysNutritionalVideoMapper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.stdiet.custom.mapper.SysVideoClassifyMapper;
|
import com.stdiet.custom.mapper.SysVideoClassifyMapper;
|
||||||
@ -20,6 +22,9 @@ public class SysVideoClassifyServiceImpl implements ISysVideoClassifyService
|
|||||||
@Autowired
|
@Autowired
|
||||||
private SysVideoClassifyMapper sysVideoClassifyMapper;
|
private SysVideoClassifyMapper sysVideoClassifyMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysNutritionalVideoMapper sysNutritionalVideoMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询视频分类
|
* 查询视频分类
|
||||||
*
|
*
|
||||||
@ -94,12 +99,28 @@ public class SysVideoClassifyServiceImpl implements ISysVideoClassifyService
|
|||||||
return sysVideoClassifyMapper.deleteSysVideoClassifyById(id);
|
return sysVideoClassifyMapper.deleteSysVideoClassifyById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean delChildrenClassify(Long id){
|
||||||
|
//判断分类下是否存在视频,存在视频不能删除
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取所有类别
|
* 获取所有类别
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SysVideoClassify> getAllClassify(){
|
public List<SysVideoClassify> getAllClassify(SysVideoClassify sysVideoClassify){
|
||||||
return sysVideoClassifyMapper.getAllClassify();
|
return sysVideoClassifyMapper.getAllClassify(sysVideoClassify);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按分类层级分类,返回视频目录列表
|
||||||
|
*
|
||||||
|
* @param sysVideoClassify 视频分类
|
||||||
|
* @return 视频分类集合
|
||||||
|
*/
|
||||||
|
public List<VideoClassifyResponse> getAllClassifyAndVideo(SysVideoClassify sysVideoClassify){
|
||||||
|
return sysVideoClassifyMapper.getOneAllClassifyAndVideo(sysVideoClassify);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -42,7 +42,11 @@
|
|||||||
and snv.show_flag = #{showFlag}
|
and snv.show_flag = #{showFlag}
|
||||||
</if>
|
</if>
|
||||||
<if test="cateId != null">
|
<if test="cateId != null">
|
||||||
and snv.cate_id = #{cateId}
|
and snv.cate_id in (
|
||||||
|
select id from sys_video_classify where del_flag = 0
|
||||||
|
and (id = #{cateId} or id in (select s.id from sys_video_classify s where s.parent_id = #{cateId} and s.del_flag = 0)
|
||||||
|
or id in (select ss.id from sys_video_classify ss where ss.del_flag = 0 and ss.parent_id in (select a.id from sys_video_classify a where a.parent_id = #{cateId} and a.del_flag = 0 )))
|
||||||
|
)
|
||||||
</if>
|
</if>
|
||||||
<if test="payLevel != null">
|
<if test="payLevel != null">
|
||||||
and snv.pay_level = #{payLevel}
|
and snv.pay_level = #{payLevel}
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
<resultMap type="SysVideoClassify" id="SysVideoClassifyResult">
|
<resultMap type="SysVideoClassify" id="SysVideoClassifyResult">
|
||||||
<result property="id" column="id" />
|
<result property="id" column="id" />
|
||||||
<result property="cateName" column="cate_name" />
|
<result property="cateName" column="cate_name" />
|
||||||
|
<result property="parentId" column="parent_id" />
|
||||||
|
<result property="orderNum" column="order_num" />
|
||||||
<result property="payFlag" column="pay_flag" />
|
<result property="payFlag" column="pay_flag" />
|
||||||
<result property="createTime" column="create_time" />
|
<result property="createTime" column="create_time" />
|
||||||
<result property="createBy" column="create_by" />
|
<result property="createBy" column="create_by" />
|
||||||
@ -16,12 +18,16 @@
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectSysVideoClassifyVo">
|
<sql id="selectSysVideoClassifyVo">
|
||||||
select id, cate_name, pay_flag, create_time, create_by, update_time, update_by, del_flag from sys_video_classify
|
select id, cate_name, parent_id, order_num, pay_flag, create_time, create_by, update_time, update_by, del_flag from sys_video_classify
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectSysVideoClassifyList" parameterType="SysVideoClassify" resultMap="SysVideoClassifyResult">
|
<select id="selectSysVideoClassifyList" parameterType="SysVideoClassify" resultMap="SysVideoClassifyResult">
|
||||||
<include refid="selectSysVideoClassifyVo"/>
|
select id, cate_name, parent_id, order_num, pay_flag, create_time from sys_video_classify
|
||||||
where del_flag = 0
|
where del_flag = 0
|
||||||
|
<if test="parentId != null">
|
||||||
|
and parent_id = #{parentId}
|
||||||
|
</if>
|
||||||
|
order by order_num asc,id asc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectSysVideoClassifyById" parameterType="Long" resultMap="SysVideoClassifyResult">
|
<select id="selectSysVideoClassifyById" parameterType="Long" resultMap="SysVideoClassifyResult">
|
||||||
@ -34,6 +40,8 @@
|
|||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
<if test="id != null">id,</if>
|
<if test="id != null">id,</if>
|
||||||
<if test="cateName != null">cate_name,</if>
|
<if test="cateName != null">cate_name,</if>
|
||||||
|
<if test="parentId != null">parent_id,</if>
|
||||||
|
<if test="orderNum != null">order_num,</if>
|
||||||
<if test="payFlag != null">pay_flag,</if>
|
<if test="payFlag != null">pay_flag,</if>
|
||||||
<if test="createTime != null">create_time,</if>
|
<if test="createTime != null">create_time,</if>
|
||||||
<if test="createBy != null">create_by,</if>
|
<if test="createBy != null">create_by,</if>
|
||||||
@ -44,6 +52,8 @@
|
|||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="id != null">#{id},</if>
|
<if test="id != null">#{id},</if>
|
||||||
<if test="cateName != null">#{cateName},</if>
|
<if test="cateName != null">#{cateName},</if>
|
||||||
|
<if test="parentId != null">#{parentId},</if>
|
||||||
|
<if test="orderNum != null">#{orderNum},</if>
|
||||||
<if test="payFlag != null">#{payFlag},</if>
|
<if test="payFlag != null">#{payFlag},</if>
|
||||||
<if test="createTime != null">#{createTime},</if>
|
<if test="createTime != null">#{createTime},</if>
|
||||||
<if test="createBy != null">#{createBy},</if>
|
<if test="createBy != null">#{createBy},</if>
|
||||||
@ -57,6 +67,8 @@
|
|||||||
update sys_video_classify
|
update sys_video_classify
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
<if test="cateName != null">cate_name = #{cateName},</if>
|
<if test="cateName != null">cate_name = #{cateName},</if>
|
||||||
|
<if test="parentId != null">parent_id = #{parentId},</if>
|
||||||
|
<if test="orderNum != null">order_num = #{orderNum},</if>
|
||||||
<if test="payFlag != null">pay_flag = #{payFlag},</if>
|
<if test="payFlag != null">pay_flag = #{payFlag},</if>
|
||||||
<if test="createTime != null">create_time = #{createTime},</if>
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
<if test="createBy != null">create_by = #{createBy},</if>
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||||||
@ -78,8 +90,73 @@
|
|||||||
</foreach>
|
</foreach>
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<select id="getAllClassify" resultMap="SysVideoClassifyResult">
|
<select id="getAllClassify" resultMap="SysVideoClassifyResult" parameterType="SysVideoClassify">
|
||||||
select id,cate_name from sys_video_classify where del_flag = 0
|
select id, cate_name, parent_id, order_num, pay_flag, create_time, create_by, update_time, update_by, del_flag from sys_video_classify
|
||||||
|
where del_flag = 0
|
||||||
|
<if test="parentId != null">
|
||||||
|
and parent_id = #{parentId}
|
||||||
|
</if>
|
||||||
|
order by order_num asc,id asc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<resultMap type="com.stdiet.custom.dto.response.VideoClassifyResponse" id="VideoClassifyOneResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="cateName" column="cate_name" />
|
||||||
|
<result property="userType" column="userType"></result>
|
||||||
|
<!-- 查询子分类 -->
|
||||||
|
<association property="childrenClassify" column="{userType=userType,id=id}" select="getTwoAllClassifyAndVideo"/>
|
||||||
|
<!-- 查询子视频 -->
|
||||||
|
<association property="childrenVideo" column="{userType=userType,id=id}" select="getAllVideoByClassify"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap type="com.stdiet.custom.dto.response.VideoClassifyResponse" id="VideoClassifyTwoResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="cateName" column="cate_name" />
|
||||||
|
<result property="userType" column="userType"></result>
|
||||||
|
<!-- 查询子分类 -->
|
||||||
|
<association property="childrenClassify" column="{userType=userType,id=id}" select="getThreeAllClassifyAndVideo"/>
|
||||||
|
<!-- 查询子视频 -->
|
||||||
|
<association property="childrenVideo" column="{userType=userType,id=id}" select="getAllVideoByClassify"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap type="com.stdiet.custom.dto.response.VideoClassifyResponse" id="VideoClassifyThreeResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="cateName" column="cate_name" />
|
||||||
|
<result property="userType" column="userType" ></result>
|
||||||
|
<!-- 查询子视频 -->
|
||||||
|
<association property="childrenVideo" column="{userType=userType,id=id}" select="getAllVideoByClassify"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<select id="getOneAllClassifyAndVideo" resultMap="VideoClassifyOneResult" parameterType="SysVideoClassify">
|
||||||
|
select id, cate_name, #{userType} as userType from sys_video_classify
|
||||||
|
where del_flag = 0 and parent_id = #{parentId} and 1 = 1
|
||||||
|
order by order_num asc,id asc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getTwoAllClassifyAndVideo" resultMap="VideoClassifyTwoResult">
|
||||||
|
select id, cate_name,#{userType} as userType from sys_video_classify
|
||||||
|
where del_flag = 0 and parent_id = #{id} and 2 = 2
|
||||||
|
order by order_num asc,id asc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getThreeAllClassifyAndVideo" resultMap="VideoClassifyThreeResult">
|
||||||
|
select id, cate_name,#{userType} as userType from sys_video_classify
|
||||||
|
where del_flag = 0 and parent_id = #{id} and 3 = 3
|
||||||
|
order by order_num asc,id asc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getAllVideoByClassify" resultType="com.stdiet.custom.dto.response.VideoResponse">
|
||||||
|
select snv.video_id as videoId, snv.title, snv.cover_url as coverUrl,snv.play_num as playNum
|
||||||
|
from sys_nutritional_video snv where cate_id = #{id} and del_flag = 0 and show_flag = 1
|
||||||
|
<if test="userType != null">
|
||||||
|
<if test="userType == 0">
|
||||||
|
and pay_level = 0
|
||||||
|
</if>
|
||||||
|
<if test="userType == 1">
|
||||||
|
and (pay_level = 0 or pay_level = 1)
|
||||||
|
</if>
|
||||||
|
</if>
|
||||||
|
order by priority_level desc,id asc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
@ -106,7 +106,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
|||||||
"/wap/**",
|
"/wap/**",
|
||||||
"/investigate/**",
|
"/investigate/**",
|
||||||
"/common/customerUploadFile",
|
"/common/customerUploadFile",
|
||||||
"/custom/nutritionQuestion/regenerateNutritionQuestionIndex"
|
"/custom/nutritionQuestion/regenerateNutritionQuestionIndex",
|
||||||
|
"/web/**"
|
||||||
).anonymous()
|
).anonymous()
|
||||||
.antMatchers(
|
.antMatchers(
|
||||||
HttpMethod.GET,
|
HttpMethod.GET,
|
||||||
|
@ -26,15 +26,14 @@
|
|||||||
<UploadFile ref="uploadFile" :prefix="'videoCover'" @callbackMethod="handleCoverUrl" :tips="'视频未传封面图片时,会主动截取封面,但会存在延迟,请勿直接发布到小程序'"></UploadFile>
|
<UploadFile ref="uploadFile" :prefix="'videoCover'" @callbackMethod="handleCoverUrl" :tips="'视频未传封面图片时,会主动截取封面,但会存在延迟,请勿直接发布到小程序'"></UploadFile>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<div style="display:flex">
|
<div style="display:flex">
|
||||||
<el-form-item label="视频类别" prop="cateId">
|
<el-form-item label="视频类别" prop="cateId" style="width:300px">
|
||||||
<el-select v-model="videoFrom.cateId" clearable filterable placeholder="请选择类别">
|
<treeselect
|
||||||
<el-option
|
v-model="videoFrom.cateId"
|
||||||
v-for="classify in classifyList"
|
:options="classifyList"
|
||||||
:key="classify.id"
|
:normalizer="normalizer"
|
||||||
:label="classify.cateName"
|
:show-count="true"
|
||||||
:value="classify.id"
|
placeholder="选择分类"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="视频权限" prop="payLevel" style="margin-left:40px">
|
<el-form-item label="视频权限" prop="payLevel" style="margin-left:40px">
|
||||||
<el-select v-model="videoFrom.payLevel" clearable filterable placeholder="请选择权限">
|
<el-select v-model="videoFrom.payLevel" clearable filterable placeholder="请选择权限">
|
||||||
@ -78,6 +77,9 @@
|
|||||||
import {getUploadVideoAuth,addNutritionalVideo } from "@/api/custom/nutritionalVideo";
|
import {getUploadVideoAuth,addNutritionalVideo } from "@/api/custom/nutritionalVideo";
|
||||||
import {getAllClassify } from "@/api/custom/videoClassify";
|
import {getAllClassify } from "@/api/custom/videoClassify";
|
||||||
import UploadFile from "@/components/FileUpload/UploadFile";
|
import UploadFile from "@/components/FileUpload/UploadFile";
|
||||||
|
import Treeselect from "@riophae/vue-treeselect";
|
||||||
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||||
|
import IconSelect from "@/components/IconSelect";
|
||||||
export default {
|
export default {
|
||||||
name: "UploadVideo",
|
name: "UploadVideo",
|
||||||
data () {
|
data () {
|
||||||
@ -140,7 +142,7 @@
|
|||||||
|
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
UploadFile
|
UploadFile,Treeselect, IconSelect
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
showDialog(classifyList, callback){
|
showDialog(classifyList, callback){
|
||||||
@ -150,7 +152,8 @@
|
|||||||
this.resetVideoFrom();
|
this.resetVideoFrom();
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.callback = callback;
|
this.callback = callback;
|
||||||
this.classifyList = classifyList;
|
this.dealClassify(classifyList);
|
||||||
|
//this.classifyList = classifyList;
|
||||||
},
|
},
|
||||||
handleCoverUrl(url){
|
handleCoverUrl(url){
|
||||||
this.videoFrom.coverUrl = url;
|
this.videoFrom.coverUrl = url;
|
||||||
@ -181,6 +184,23 @@
|
|||||||
},
|
},
|
||||||
submitVideoForm(){
|
submitVideoForm(){
|
||||||
|
|
||||||
|
},
|
||||||
|
/** 转换菜单数据结构 */
|
||||||
|
normalizer(node) {
|
||||||
|
if (node.children && !node.children.length) {
|
||||||
|
delete node.children;
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
id: node.id,
|
||||||
|
label: node.cateName,
|
||||||
|
children: node.children
|
||||||
|
};
|
||||||
|
},
|
||||||
|
dealClassify(data){
|
||||||
|
this.classifyList = [];
|
||||||
|
const classify = { id: 0, cateName: '主分类', children: [] };
|
||||||
|
classify.children = this.handleTree(data, "id");
|
||||||
|
this.classifyList.push(classify);
|
||||||
},
|
},
|
||||||
cancel(){
|
cancel(){
|
||||||
if(this.uploading){
|
if(this.uploading){
|
||||||
@ -211,6 +231,14 @@
|
|||||||
this.authProgress = 0
|
this.authProgress = 0
|
||||||
this.statusText = ""
|
this.statusText = ""
|
||||||
}**/
|
}**/
|
||||||
|
//视频分类不能选择主分类
|
||||||
|
if(this.videoFrom.cateId == 0){
|
||||||
|
this.$message({
|
||||||
|
message: "视频分类不能选择主分类",
|
||||||
|
type: "warning",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.videoFrom.fileName = this.file.name;
|
this.videoFrom.fileName = this.file.name;
|
||||||
if(this.videoFrom.fileName == null || this.videoFrom.fileName.length == 0 || this.videoFrom.fileName.lastIndexOf(".") == -1){
|
if(this.videoFrom.fileName == null || this.videoFrom.fileName.length == 0 || this.videoFrom.fileName.lastIndexOf(".") == -1){
|
||||||
this.$message({
|
this.$message({
|
||||||
|
@ -21,14 +21,22 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="视频类别" prop="cateId">
|
<el-form-item label="视频类别" prop="cateId">
|
||||||
<el-select v-model="queryParams.cateId" clearable filterable placeholder="请选择类别">
|
<!-- <el-select v-model="queryParams.cateId" clearable filterable placeholder="请选择类别">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="classify in classifyList"
|
v-for="classify in classifyList"
|
||||||
:key="classify.id"
|
:key="classify.id"
|
||||||
:label="classify.cateName"
|
:label="classify.cateName"
|
||||||
:value="classify.id"
|
:value="classify.id"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>-->
|
||||||
|
<treeselect
|
||||||
|
v-model="queryParams.cateId"
|
||||||
|
:options="classifyList"
|
||||||
|
:normalizer="normalizer"
|
||||||
|
:show-count="true"
|
||||||
|
placeholder="选择分类"
|
||||||
|
style="width:200px"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="视频权限" prop="payLevel">
|
<el-form-item label="视频权限" prop="payLevel">
|
||||||
<el-select v-model="queryParams.payLevel" clearable filterable placeholder="请选择权限">
|
<el-select v-model="queryParams.payLevel" clearable filterable placeholder="请选择权限">
|
||||||
@ -243,7 +251,9 @@
|
|||||||
|
|
||||||
<!-- 视频分类管理 -->
|
<!-- 视频分类管理 -->
|
||||||
<el-dialog title="视频分类列表" :visible.sync="videoClassifyOpen" width="800px" append-to-body @closed="getAllVideoClassify();">
|
<el-dialog title="视频分类列表" :visible.sync="videoClassifyOpen" width="800px" append-to-body @closed="getAllVideoClassify();">
|
||||||
<VideoClassify ref="videoClassifyRef"></VideoClassify>
|
<div style="height: 500px; overflow: auto">
|
||||||
|
<VideoClassify ref="videoClassifyRef"></VideoClassify>
|
||||||
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -255,6 +265,9 @@
|
|||||||
import UploadFile from "@/components/FileUpload/UploadFile";
|
import UploadFile from "@/components/FileUpload/UploadFile";
|
||||||
import VideoClassify from "../videoClassify";
|
import VideoClassify from "../videoClassify";
|
||||||
import AutoHideMessage from "@/components/AutoHideMessage";
|
import AutoHideMessage from "@/components/AutoHideMessage";
|
||||||
|
import Treeselect from "@riophae/vue-treeselect";
|
||||||
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||||
|
import IconSelect from "@/components/IconSelect";
|
||||||
export default {
|
export default {
|
||||||
name: "NutritionalVideo",
|
name: "NutritionalVideo",
|
||||||
data() {
|
data() {
|
||||||
@ -318,7 +331,7 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
UploadVideo,UploadFile,VideoClassify,AutoHideMessage
|
UploadVideo,UploadFile,VideoClassify,AutoHideMessage,Treeselect, IconSelect
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/** 查询营养视频列表 */
|
/** 查询营养视频列表 */
|
||||||
@ -337,7 +350,10 @@
|
|||||||
getAllVideoClassify(){
|
getAllVideoClassify(){
|
||||||
getAllClassify().then(response => {
|
getAllClassify().then(response => {
|
||||||
if(response.code == 200){
|
if(response.code == 200){
|
||||||
this.classifyList = response.data;
|
this.classifyList = [];
|
||||||
|
const classify = { id: 0, cateName: '主分类', children: [] };
|
||||||
|
classify.children = this.handleTree(response.data, "id");
|
||||||
|
this.classifyList.push(classify);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -411,6 +427,17 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
/** 转换菜单数据结构 */
|
||||||
|
normalizer(node) {
|
||||||
|
if (node.children && !node.children.length) {
|
||||||
|
delete node.children;
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
id: node.id,
|
||||||
|
label: node.cateName,
|
||||||
|
children: node.children
|
||||||
|
};
|
||||||
|
},
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
submitForm() {
|
submitForm() {
|
||||||
this.$refs["form"].validate(valid => {
|
this.$refs["form"].validate(valid => {
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
v-hasPermi="['custom:videoClassify:add']"
|
v-hasPermi="['custom:videoClassify:add']"
|
||||||
>新增</el-button>
|
>新增</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<!--<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="success"
|
type="success"
|
||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
@ -54,7 +54,7 @@
|
|||||||
@click="handleDelete"
|
@click="handleDelete"
|
||||||
v-hasPermi="['custom:videoClassify:remove']"
|
v-hasPermi="['custom:videoClassify:remove']"
|
||||||
>删除</el-button>
|
>删除</el-button>
|
||||||
</el-col>
|
</el-col>-->
|
||||||
<!--<el-col :span="1.5">
|
<!--<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="warning"
|
type="warning"
|
||||||
@ -67,11 +67,29 @@
|
|||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="videoClassifyList" @selection-change="handleSelectionChange">
|
<el-table
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
v-loading="loading"
|
||||||
<el-table-column label="分类名称" align="center" prop="cateName" />
|
:data="videoClassifyList"
|
||||||
|
row-key="id"
|
||||||
|
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
||||||
|
>
|
||||||
|
<el-table-column label="分类名称" prop="cateName" :show-overflow-tooltip="true"/>
|
||||||
|
<el-table-column label="显示排序" prop="orderNum" align="center"/>
|
||||||
|
<el-table-column label="创建时间" prop="createTime" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
icon="el-icon-plus"
|
||||||
|
type="text"
|
||||||
|
size="mini"
|
||||||
|
v-if="threeLevelClassify.indexOf(scope.row.id) == -1"
|
||||||
|
@click="handleAdd(scope.row)"
|
||||||
|
v-hasPermi="['custom:videoClassify:add']"
|
||||||
|
>新增</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
@ -90,21 +108,34 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<pagination
|
<!--<pagination
|
||||||
v-show="total>0"
|
v-show="total>0"
|
||||||
:total="total"
|
:total="total"
|
||||||
:page.sync="queryParams.pageNum"
|
:page.sync="queryParams.pageNum"
|
||||||
:limit.sync="queryParams.pageSize"
|
:limit.sync="queryParams.pageSize"
|
||||||
@pagination="getList"
|
@pagination="getList"
|
||||||
/>
|
/>-->
|
||||||
|
|
||||||
<!-- 添加或修改视频分类对话框 -->
|
<!-- 添加或修改视频分类对话框 -->
|
||||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="上级分类">
|
||||||
|
<treeselect
|
||||||
|
v-model="form.parentId"
|
||||||
|
:options="classifyOptions"
|
||||||
|
:normalizer="normalizer"
|
||||||
|
:show-count="true"
|
||||||
|
placeholder="选择上级分类"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="分类名称" prop="cateName">
|
<el-form-item label="分类名称" prop="cateName">
|
||||||
<el-input v-model.trim="form.cateName" placeholder="请输入分类名称" />
|
<el-input v-model.trim="form.cateName" placeholder="请输入分类名称" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="显示排序" prop="orderNum">
|
||||||
|
<el-input-number v-model="form.orderNum" controls-position="right" :min="0" />
|
||||||
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
<el-button @click="cancel">取 消</el-button>
|
<el-button @click="cancel">取 消</el-button>
|
||||||
@ -114,8 +145,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listVideoClassify, getVideoClassify, delVideoClassify, addVideoClassify, updateVideoClassify, exportVideoClassify } from "@/api/custom/videoClassify";
|
import { listVideoClassify, getVideoClassify, delVideoClassify, addVideoClassify, updateVideoClassify, exportVideoClassify,getAllClassify } from "@/api/custom/videoClassify";
|
||||||
|
import Treeselect from "@riophae/vue-treeselect";
|
||||||
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||||
|
import IconSelect from "@/components/IconSelect";
|
||||||
export default {
|
export default {
|
||||||
name: "VideoClassify",
|
name: "VideoClassify",
|
||||||
data() {
|
data() {
|
||||||
@ -152,21 +185,26 @@
|
|||||||
cateName: [
|
cateName: [
|
||||||
{ required: true, message: "分类名称不能为空", trigger: "blur" },
|
{ required: true, message: "分类名称不能为空", trigger: "blur" },
|
||||||
],
|
],
|
||||||
}
|
},
|
||||||
|
classifyOptions:[],
|
||||||
|
//三级目录ID
|
||||||
|
threeLevelClassify:[]
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
components: { Treeselect, IconSelect },
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList();
|
||||||
|
this.getTreeselect();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/** 查询视频分类列表 */
|
/** 查询视频分类列表 */
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
listVideoClassify(this.queryParams).then(response => {
|
listVideoClassify(this.queryParams).then(response => {
|
||||||
this.videoClassifyList = response.rows;
|
this.videoClassifyList = this.handleTree(response.rows, "id");
|
||||||
this.total = response.total;
|
this.total = response.total;
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 取消按钮
|
// 取消按钮
|
||||||
cancel() {
|
cancel() {
|
||||||
@ -178,6 +216,8 @@
|
|||||||
this.form = {
|
this.form = {
|
||||||
id: null,
|
id: null,
|
||||||
cateName: null,
|
cateName: null,
|
||||||
|
parentId: null,
|
||||||
|
orderNum: 0,
|
||||||
payFlag: null,
|
payFlag: null,
|
||||||
createTime: null,
|
createTime: null,
|
||||||
createBy: null,
|
createBy: null,
|
||||||
@ -204,8 +244,13 @@
|
|||||||
this.multiple = !selection.length
|
this.multiple = !selection.length
|
||||||
},
|
},
|
||||||
/** 新增按钮操作 */
|
/** 新增按钮操作 */
|
||||||
handleAdd() {
|
handleAdd(row) {
|
||||||
this.reset();
|
this.reset();
|
||||||
|
if (row != null && row.id) {
|
||||||
|
this.form.parentId = row.id;
|
||||||
|
} else {
|
||||||
|
this.form.parentId = 0;
|
||||||
|
}
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "添加视频分类";
|
this.title = "添加视频分类";
|
||||||
},
|
},
|
||||||
@ -215,20 +260,29 @@
|
|||||||
const id = row.id || this.ids
|
const id = row.id || this.ids
|
||||||
getVideoClassify(id).then(response => {
|
getVideoClassify(id).then(response => {
|
||||||
this.form = response.data;
|
this.form = response.data;
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "修改视频分类";
|
this.title = "修改视频分类";
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
submitForm() {
|
submitForm() {
|
||||||
this.$refs["form"].validate(valid => {
|
this.$refs["form"].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
//三级分类不能作为父级
|
||||||
|
if(this.threeLevelClassify.indexOf(this.form.parentId) != -1){
|
||||||
|
this.$message({
|
||||||
|
message: "最多只支持三级分类,三级类别不能作为上级",
|
||||||
|
type: "warning",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (this.form.id != null) {
|
if (this.form.id != null) {
|
||||||
updateVideoClassify(this.form).then(response => {
|
updateVideoClassify(this.form).then(response => {
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.msgSuccess("修改成功");
|
this.msgSuccess("修改成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
|
this.getTreeselect();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@ -237,6 +291,7 @@
|
|||||||
this.msgSuccess("新增成功");
|
this.msgSuccess("新增成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
|
this.getTreeselect();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -269,7 +324,39 @@
|
|||||||
}).then(response => {
|
}).then(response => {
|
||||||
this.download(response.msg);
|
this.download(response.msg);
|
||||||
}).catch(function() {});
|
}).catch(function() {});
|
||||||
}
|
},
|
||||||
|
/** 转换菜单数据结构 */
|
||||||
|
normalizer(node) {
|
||||||
|
if (node.children && !node.children.length) {
|
||||||
|
delete node.children;
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
id: node.id,
|
||||||
|
label: node.cateName,
|
||||||
|
children: node.children
|
||||||
|
};
|
||||||
|
},
|
||||||
|
/** 查询目录下拉树结构 */
|
||||||
|
getTreeselect() {
|
||||||
|
getAllClassify().then(response => {
|
||||||
|
this.classifyOptions = [];
|
||||||
|
const classify = { id: 0, cateName: '主分类', children: [] };
|
||||||
|
classify.children = this.handleTree(response.data, "id");
|
||||||
|
classify.children.forEach((item,i) => {
|
||||||
|
if(item.children && item.children.length > 0){
|
||||||
|
item.children.forEach((tem,j) => {
|
||||||
|
if(tem.children && tem.children.length > 0){
|
||||||
|
tem.children.forEach(element => {
|
||||||
|
this.threeLevelClassify.push(element.id);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//console.log(this.threeLevelClassify.length);
|
||||||
|
this.classifyOptions.push(classify);
|
||||||
|
});
|
||||||
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user