diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysVideoClassifyController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysVideoClassifyController.java index 13eff2c96..b677d5491 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysVideoClassifyController.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysVideoClassifyController.java @@ -3,14 +3,7 @@ package com.stdiet.web.controller.custom; import java.util.List; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import com.stdiet.common.annotation.Log; import com.stdiet.common.core.controller.BaseController; import com.stdiet.common.core.domain.AjaxResult; @@ -40,7 +33,8 @@ public class SysVideoClassifyController extends BaseController @GetMapping("/list") public TableDataInfo list(SysVideoClassify sysVideoClassify) { - startPage(); + //startPage(); + //sysVideoClassify.setParentId(0L); List list = sysVideoClassifyService.selectSysVideoClassifyList(sysVideoClassify); return getDataTable(list); } @@ -105,9 +99,9 @@ public class SysVideoClassifyController extends BaseController * 查询视频分类列表 */ @GetMapping("/getAllClassify") - public AjaxResult getAllClassify() + public AjaxResult getAllClassify(SysVideoClassify sysVideoClassify) { - List list = sysVideoClassifyService.getAllClassify(); + List list = sysVideoClassifyService.getAllClassify(sysVideoClassify); return AjaxResult.success(list); } } \ No newline at end of file diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/VideoWebInterfaceController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/VideoWebInterfaceController.java new file mode 100644 index 000000000..9a79b8e0e --- /dev/null +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/VideoWebInterfaceController.java @@ -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 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 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)); + } +} diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WechatAppletController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WechatAppletController.java index 5a91d40bd..a22baae83 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WechatAppletController.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WechatAppletController.java @@ -714,7 +714,9 @@ public class WechatAppletController extends BaseController { */ @GetMapping("/getVideoClassify") public AjaxResult getVideoClassify(@RequestParam("openid")String openid) { - List list = sysVideoClassifyService.selectSysVideoClassifyList(new SysVideoClassify()); + SysVideoClassify param = new SysVideoClassify(); + param.setParentId(0L); + List list = sysVideoClassifyService.getAllClassify(param); List>> result = new ArrayList<>(); int groupCount = 3; SysVideoClassify all = new SysVideoClassify(); diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysVideoClassify.java b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysVideoClassify.java index 8384a6de6..8fd99336e 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysVideoClassify.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysVideoClassify.java @@ -1,11 +1,13 @@ package com.stdiet.custom.domain; +import com.stdiet.custom.dto.response.VideoClassifyTwoResponse; 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.core.domain.BaseEntity; +import java.util.List; +import java.util.Map; + /** * 视频分类对象 sys_video_classify * @@ -24,10 +26,17 @@ public class SysVideoClassify extends BaseEntity @Excel(name = "分类名称") private String cateName; + private Long parentId; + + private Integer orderNum; + /** 类型标识,0全部可看 1客户可看 2额外付费观看 */ @Excel(name = "类型标识,0全部可看 1客户可看 2额外付费观看") private Integer payFlag; /** 删除标识 0未删除 1已删除 */ private Integer delFlag; + + //用户类型 0 普通用户 1付费客户 + private Integer userType; } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/dto/response/VideoClassifyResponse.java b/stdiet-custom/src/main/java/com/stdiet/custom/dto/response/VideoClassifyResponse.java new file mode 100644 index 000000000..8ed1199ad --- /dev/null +++ b/stdiet-custom/src/main/java/com/stdiet/custom/dto/response/VideoClassifyResponse.java @@ -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 childrenClassify; + + //子视频 + private List childrenVideo; +} diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/dto/response/VideoClassifyThreeResponse.java b/stdiet-custom/src/main/java/com/stdiet/custom/dto/response/VideoClassifyThreeResponse.java new file mode 100644 index 000000000..2347bb744 --- /dev/null +++ b/stdiet-custom/src/main/java/com/stdiet/custom/dto/response/VideoClassifyThreeResponse.java @@ -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> 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> getChildrenVideo() { + return childrenVideo; + } + + public void setChildrenVideo(List> childrenVideo) { + this.childrenVideo = childrenVideo; + } +} diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/dto/response/VideoClassifyTwoResponse.java b/stdiet-custom/src/main/java/com/stdiet/custom/dto/response/VideoClassifyTwoResponse.java new file mode 100644 index 000000000..e88544e6a --- /dev/null +++ b/stdiet-custom/src/main/java/com/stdiet/custom/dto/response/VideoClassifyTwoResponse.java @@ -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 childrenClassify; + + //子视频 + private List> 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 getChildrenClassify() { + return childrenClassify; + } + + public void setChildrenClassify(List childrenClassify) { + this.childrenClassify = childrenClassify; + } + + public List> getChildrenVideo() { + return childrenVideo; + } + + public void setChildrenVideo(List> childrenVideo) { + this.childrenVideo = childrenVideo; + } +} diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/dto/response/VideoResponse.java b/stdiet-custom/src/main/java/com/stdiet/custom/dto/response/VideoResponse.java new file mode 100644 index 000000000..4d45331ef --- /dev/null +++ b/stdiet-custom/src/main/java/com/stdiet/custom/dto/response/VideoResponse.java @@ -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; + } +} diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysVideoClassifyMapper.java b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysVideoClassifyMapper.java index c1a905237..0e00d8a56 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysVideoClassifyMapper.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysVideoClassifyMapper.java @@ -2,6 +2,7 @@ package com.stdiet.custom.mapper; import java.util.List; import com.stdiet.custom.domain.SysVideoClassify; +import com.stdiet.custom.dto.response.VideoClassifyResponse; /** * 视频分类Mapper接口 @@ -63,5 +64,12 @@ public interface SysVideoClassifyMapper * 获取所有类别 * @return */ - public List getAllClassify(); + public List getAllClassify(SysVideoClassify sysVideoClassify); + + /** + * 根据父级ID获取下面子分类以及视频 + * @param parentId + * @return + */ + public List getOneAllClassifyAndVideo(SysVideoClassify sysVideoClassify); } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysNutritionalVideoService.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysNutritionalVideoService.java index b288333b0..09b96e8e3 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysNutritionalVideoService.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysNutritionalVideoService.java @@ -4,6 +4,7 @@ import java.util.List; import java.util.Map; import com.stdiet.custom.domain.SysNutritionalVideo; +import com.stdiet.custom.domain.SysVideoClassify; import org.apache.ibatis.annotations.Param; /** diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysVideoClassifyService.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysVideoClassifyService.java index a3eeacebb..8290de7fe 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysVideoClassifyService.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysVideoClassifyService.java @@ -2,6 +2,7 @@ package com.stdiet.custom.service; import java.util.List; import com.stdiet.custom.domain.SysVideoClassify; +import com.stdiet.custom.dto.response.VideoClassifyResponse; /** * 视频分类Service接口 @@ -63,5 +64,12 @@ public interface ISysVideoClassifyService * 获取所有类别 * @return */ - public List getAllClassify(); + public List getAllClassify(SysVideoClassify sysVideoClassify); + + /** + * 按分类层级分类,返回视频目录列表 + * + * @return 视频分类集合 + */ + public List getAllClassifyAndVideo(SysVideoClassify sysVideoClassify); } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysOrderServiceImpl.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysOrderServiceImpl.java index e58d884ee..f7fd404c5 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysOrderServiceImpl.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysOrderServiceImpl.java @@ -378,7 +378,7 @@ public class SysOrderServiceImpl implements ISysOrderService { LocalDate newStartTime = null; //判断是否提成单,拆分单中的副单,体验单,定金单 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; } //判断前一个订单的结束时间是否大于第二个订单的 @@ -404,6 +404,21 @@ public class SysOrderServiceImpl implements ISysOrderService { 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对象设置服务到期时间 * diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysRecipesPlanServiceImpl.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysRecipesPlanServiceImpl.java index b0a01c0ce..58b09b2f8 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysRecipesPlanServiceImpl.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysRecipesPlanServiceImpl.java @@ -44,6 +44,9 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService { @Autowired 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 || // "2".equals(sysOrder.getOrderType()) || // 体验单也需要生成计划 2021.05.29 - "1".equals(sysOrder.getOrderMoneyType()) || sysOrder.getCounted() == 1) { + !isNeedByOrderMoneyType(sysOrder) || sysOrder.getCounted() == 1) { System.out.println("---------------------" + sysOrder.getOrderId() + "不生成食谱------------------------"); 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表中天数缺失,需要查询出来进行补充 * @param cusId 客户ID diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysVideoClassifyServiceImpl.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysVideoClassifyServiceImpl.java index bb5e0a47c..14f791aa3 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysVideoClassifyServiceImpl.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysVideoClassifyServiceImpl.java @@ -2,6 +2,8 @@ package com.stdiet.custom.service.impl; import java.util.List; 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.stereotype.Service; import com.stdiet.custom.mapper.SysVideoClassifyMapper; @@ -20,6 +22,9 @@ public class SysVideoClassifyServiceImpl implements ISysVideoClassifyService @Autowired private SysVideoClassifyMapper sysVideoClassifyMapper; + @Autowired + private SysNutritionalVideoMapper sysNutritionalVideoMapper; + /** * 查询视频分类 * @@ -94,12 +99,28 @@ public class SysVideoClassifyServiceImpl implements ISysVideoClassifyService return sysVideoClassifyMapper.deleteSysVideoClassifyById(id); } + private boolean delChildrenClassify(Long id){ + //判断分类下是否存在视频,存在视频不能删除 + + return true; + } + /** * 获取所有类别 * @return */ @Override - public List getAllClassify(){ - return sysVideoClassifyMapper.getAllClassify(); + public List getAllClassify(SysVideoClassify sysVideoClassify){ + return sysVideoClassifyMapper.getAllClassify(sysVideoClassify); + } + + /** + * 按分类层级分类,返回视频目录列表 + * + * @param sysVideoClassify 视频分类 + * @return 视频分类集合 + */ + public List getAllClassifyAndVideo(SysVideoClassify sysVideoClassify){ + return sysVideoClassifyMapper.getOneAllClassifyAndVideo(sysVideoClassify); } } \ No newline at end of file diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysNutritionalVideoMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysNutritionalVideoMapper.xml index a468e8714..59d21ec58 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysNutritionalVideoMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysNutritionalVideoMapper.xml @@ -42,7 +42,11 @@ and snv.show_flag = #{showFlag} - 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 ))) + ) and snv.pay_level = #{payLevel} diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysVideoClassifyMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysVideoClassifyMapper.xml index 688addef8..3259c594c 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysVideoClassifyMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysVideoClassifyMapper.xml @@ -7,6 +7,8 @@ + + @@ -16,12 +18,16 @@ - 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 - select id,cate_name from sys_video_classify where del_flag = 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/stdiet-framework/src/main/java/com/stdiet/framework/config/SecurityConfig.java b/stdiet-framework/src/main/java/com/stdiet/framework/config/SecurityConfig.java index 07f5dc900..2358e498b 100644 --- a/stdiet-framework/src/main/java/com/stdiet/framework/config/SecurityConfig.java +++ b/stdiet-framework/src/main/java/com/stdiet/framework/config/SecurityConfig.java @@ -106,7 +106,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { "/wap/**", "/investigate/**", "/common/customerUploadFile", - "/custom/nutritionQuestion/regenerateNutritionQuestionIndex" + "/custom/nutritionQuestion/regenerateNutritionQuestionIndex", + "/web/**" ).anonymous() .antMatchers( HttpMethod.GET, diff --git a/stdiet-ui/src/components/UploadVideo/index.vue b/stdiet-ui/src/components/UploadVideo/index.vue index 9a5462a86..af0031d96 100644 --- a/stdiet-ui/src/components/UploadVideo/index.vue +++ b/stdiet-ui/src/components/UploadVideo/index.vue @@ -26,15 +26,14 @@
- - - + - @@ -78,6 +77,9 @@ import {getUploadVideoAuth,addNutritionalVideo } from "@/api/custom/nutritionalVideo"; import {getAllClassify } from "@/api/custom/videoClassify"; 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 { name: "UploadVideo", data () { @@ -140,7 +142,7 @@ }, components: { - UploadFile + UploadFile,Treeselect, IconSelect }, methods: { showDialog(classifyList, callback){ @@ -150,7 +152,8 @@ this.resetVideoFrom(); this.open = true; this.callback = callback; - this.classifyList = classifyList; + this.dealClassify(classifyList); + //this.classifyList = classifyList; }, handleCoverUrl(url){ this.videoFrom.coverUrl = url; @@ -181,6 +184,23 @@ }, 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(){ if(this.uploading){ @@ -211,6 +231,14 @@ this.authProgress = 0 this.statusText = "" }**/ + //视频分类不能选择主分类 + if(this.videoFrom.cateId == 0){ + this.$message({ + message: "视频分类不能选择主分类", + type: "warning", + }); + return; + } this.videoFrom.fileName = this.file.name; if(this.videoFrom.fileName == null || this.videoFrom.fileName.length == 0 || this.videoFrom.fileName.lastIndexOf(".") == -1){ this.$message({ diff --git a/stdiet-ui/src/views/custom/nutritionalVideo/index.vue b/stdiet-ui/src/views/custom/nutritionalVideo/index.vue index 291731549..dea7f8b97 100644 --- a/stdiet-ui/src/views/custom/nutritionalVideo/index.vue +++ b/stdiet-ui/src/views/custom/nutritionalVideo/index.vue @@ -21,14 +21,22 @@ - + + @@ -243,7 +251,9 @@ - +
+ +
@@ -255,6 +265,9 @@ import UploadFile from "@/components/FileUpload/UploadFile"; import VideoClassify from "../videoClassify"; 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 { name: "NutritionalVideo", data() { @@ -318,7 +331,7 @@ }); }, components: { - UploadVideo,UploadFile,VideoClassify,AutoHideMessage + UploadVideo,UploadFile,VideoClassify,AutoHideMessage,Treeselect, IconSelect }, methods: { /** 查询营养视频列表 */ @@ -337,7 +350,10 @@ getAllVideoClassify(){ getAllClassify().then(response => { 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() { this.$refs["form"].validate(valid => { diff --git a/stdiet-ui/src/views/custom/videoClassify/index.vue b/stdiet-ui/src/views/custom/videoClassify/index.vue index 0a1ada151..1e45c5c1f 100644 --- a/stdiet-ui/src/views/custom/videoClassify/index.vue +++ b/stdiet-ui/src/views/custom/videoClassify/index.vue @@ -35,7 +35,7 @@ v-hasPermi="['custom:videoClassify:add']" >新增 - + + + + + + + +