Merge branch 'master' of gitee.com:darlk/ShengTangManage into develop
This commit is contained in:
commit
8fe1a3eba6
@ -1,11 +1,13 @@
|
||||
package com.stdiet.web.controller;
|
||||
|
||||
import com.stdiet.common.config.AliyunOSSConfig;
|
||||
import com.stdiet.common.core.domain.AjaxResult;
|
||||
import com.stdiet.common.core.domain.entity.SysUser;
|
||||
import com.stdiet.common.utils.StringUtils;
|
||||
import com.stdiet.common.utils.oss.AliyunOSSUtils;
|
||||
import com.stdiet.common.utils.poi.ExcelUtil;
|
||||
import com.stdiet.custom.domain.SysNutritionQuestion;
|
||||
import com.stdiet.custom.domain.SysNutritionalVideo;
|
||||
import com.stdiet.custom.domain.SysWxUserInfo;
|
||||
import com.stdiet.custom.domain.SysWxUserLog;
|
||||
import com.stdiet.custom.mapper.SysCustomerPhysicalSignsMapper;
|
||||
@ -13,6 +15,7 @@ import com.stdiet.custom.mapper.SysNutritionQuestionMapper;
|
||||
import com.stdiet.custom.mapper.SysWxUserInfoMapper;
|
||||
import com.stdiet.custom.mapper.SysWxUserLogMapper;
|
||||
import com.stdiet.custom.service.ISysNutritionQuestionService;
|
||||
import com.stdiet.custom.service.ISysNutritionalVideoService;
|
||||
import com.stdiet.custom.service.ISysWxUserLogService;
|
||||
import com.stdiet.custom.utils.LuceneIndexUtils;
|
||||
import com.stdiet.framework.web.domain.server.Sys;
|
||||
@ -28,6 +31,7 @@ import org.springframework.stereotype.Component;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
@Order(value = 1)
|
||||
@ -42,6 +46,9 @@ public class MyApplicationRunner implements ApplicationRunner {
|
||||
@Autowired
|
||||
private ISysNutritionQuestionService sysNutritionQuestionService;
|
||||
|
||||
@Autowired
|
||||
private ISysNutritionalVideoService sysNutritionalVideoService;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@ -105,4 +112,19 @@ public class MyApplicationRunner implements ApplicationRunner {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void updateVideo(){
|
||||
Map<String, Object> map = sysNutritionalVideoService.searchVideo(null, null, 1,100, null);
|
||||
if(map != null){
|
||||
List<SysNutritionalVideo> list = (List<SysNutritionalVideo>)map.get("nutritionalVideoList");
|
||||
if(list != null && list.size() > 0){
|
||||
for (SysNutritionalVideo video : list) {
|
||||
sysNutritionalVideoService.insertSysNutritionalVideo(video);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -2,14 +2,20 @@ package com.stdiet.web.controller.custom;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import com.stdiet.common.utils.DateUtils;
|
||||
import com.stdiet.custom.domain.SysCommissionDayDetail;
|
||||
import com.stdiet.custom.domain.SysOrder;
|
||||
import com.stdiet.custom.domain.SysOrderCommisionDayDetail;
|
||||
import com.stdiet.custom.dto.request.SysOrderCommision;
|
||||
import com.stdiet.custom.service.ISysCommissionDayService;
|
||||
import com.stdiet.custom.service.ISysNutritionalVideoService;
|
||||
import com.stdiet.custom.service.ISysOrderService;
|
||||
import com.stdiet.custom.service.impl.SysCommissionDayServiceImpl;
|
||||
import com.stdiet.framework.web.domain.server.Sys;
|
||||
import com.stdiet.system.domain.CusSalesman;
|
||||
import com.stdiet.system.service.ISysUserService;
|
||||
@ -41,6 +47,7 @@ import com.stdiet.common.core.page.TableDataInfo;
|
||||
@RestController
|
||||
@RequestMapping("/custom/commision")
|
||||
public class SysCommisionController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ISysCommisionService sysCommisionService;
|
||||
|
||||
@ -50,6 +57,9 @@ public class SysCommisionController extends BaseController {
|
||||
@Autowired
|
||||
private ISysCommissionDayService sysCommissionDayService;
|
||||
|
||||
@Autowired
|
||||
private ISysNutritionalVideoService sysNutritionalVideoService;
|
||||
|
||||
/**
|
||||
* 查询业务提成比例列表
|
||||
*/
|
||||
@ -158,6 +168,14 @@ public class SysCommisionController extends BaseController {
|
||||
@GetMapping("/detail")
|
||||
public TableDataInfo getDetail(SysCommision sysCommision) {
|
||||
startPage();
|
||||
if(sysCommision.getPostId() != null && sysCommision.getPostId().intValue() > 0){
|
||||
//查询售后所有ID
|
||||
SysCommision param = new SysCommision();
|
||||
param.setPostId(sysCommision.getPostId());
|
||||
List<Long> userIds = sysCommisionService.getAfterSaleId(param);
|
||||
sysCommision.setUserIds(userIds.size() == 0 ? null : userIds);
|
||||
sysCommision.setPostId(null);
|
||||
}
|
||||
List<SysCommision> list = sysCommisionService.selectSysCommisionDetail(sysCommision);
|
||||
for (SysCommision detail : list) {
|
||||
detail.setRate(0F);
|
||||
@ -165,22 +183,38 @@ public class SysCommisionController extends BaseController {
|
||||
tmpQueryCom.setUserId(detail.getUserId());
|
||||
tmpQueryCom.setPostId(detail.getPostId());
|
||||
List<SysCommision> tmpComList = sysCommisionService.selectSysCommisionList(tmpQueryCom);
|
||||
|
||||
//按比例开始时间分类
|
||||
Map<String, List<SysCommision>> rateYearMonthMap = sysCommissionDayService.getRateMapByStartTime(tmpComList);
|
||||
String yearMonth = DateUtils.stringToLocalDate(sysCommision.getBeginTime(),"yyyy-MM-dd").getYear() + "" + DateUtils.stringToLocalDate(sysCommision.getBeginTime(),"yyyy-MM-dd").getMonth().getValue();
|
||||
List<SysCommision> yearMonthRateList = new ArrayList<>();
|
||||
for (String rateMonth : rateYearMonthMap.keySet()) {
|
||||
if(Long.parseLong(yearMonth) >= Long.parseLong(rateMonth)){
|
||||
yearMonthRateList = rateYearMonthMap.get(rateMonth);
|
||||
}else{
|
||||
break;
|
||||
}
|
||||
}
|
||||
float dAmount = detail.getAmount().floatValue();
|
||||
for (int i = 0; i < tmpComList.size(); i++) {
|
||||
SysCommision com = tmpComList.get(i);
|
||||
for (int i = 0; i < yearMonthRateList.size(); i++) {
|
||||
SysCommision com = yearMonthRateList.get(i);
|
||||
float cAmount = com.getAmount().floatValue();
|
||||
if (dAmount <= cAmount && i == 0) {
|
||||
Long rateStartYearMonth = null;
|
||||
if(com.getStartTime() != null){
|
||||
rateStartYearMonth = Long.parseLong(DateUtils.dateToLocalDate(com.getStartTime()).getYear() + "" + DateUtils.dateToLocalDate(com.getStartTime()).getMonth().getValue());
|
||||
}else{
|
||||
rateStartYearMonth = 19001L;
|
||||
}
|
||||
if (dAmount <= cAmount && i == 0 && Long.parseLong(yearMonth) >= rateStartYearMonth) {
|
||||
// 第一条规则
|
||||
detail.setRate(com.getRate());
|
||||
break;
|
||||
} else if (i == tmpComList.size() - 1 && dAmount > cAmount) {
|
||||
} else if (i == yearMonthRateList.size() - 1 && dAmount > cAmount && Long.parseLong(yearMonth) >= rateStartYearMonth) {
|
||||
// 最后一条规则
|
||||
detail.setRate(com.getRate());
|
||||
break;
|
||||
} else if (cAmount < dAmount && dAmount <= tmpComList.get(i + 1).getAmount().floatValue()) {
|
||||
} else if (cAmount < dAmount && dAmount <= yearMonthRateList.get(i + 1).getAmount().floatValue() && Long.parseLong(yearMonth) >= rateStartYearMonth) {
|
||||
// 中间规则
|
||||
detail.setRate(tmpComList.get(i + 1).getRate());
|
||||
detail.setRate(yearMonthRateList.get(i + 1).getRate());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -188,6 +222,7 @@ public class SysCommisionController extends BaseController {
|
||||
float amount = detail.getAmount().floatValue();
|
||||
amount = amount * detail.getRate() / 100F;
|
||||
detail.setCommision(new BigDecimal(amount));
|
||||
|
||||
}
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ public class SysFileUploadController extends BaseController {
|
||||
* 上传文件到OSS返回URL
|
||||
*/
|
||||
@PostMapping(value = "/{prefix}")
|
||||
@PreAuthorize("@ss.hasPermi('custom:file:upload')")
|
||||
//@PreAuthorize("@ss.hasPermi('custom:file:upload')")
|
||||
public AjaxResult uploadCseFile(MultipartFile file, @PathVariable String prefix) throws Exception {
|
||||
|
||||
try {
|
||||
|
@ -4,8 +4,10 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.aliyun.vod20170321.models.CreateUploadVideoResponse;
|
||||
import com.aliyun.vod20170321.models.GetVideoListResponseBody;
|
||||
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 org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -34,32 +36,18 @@ public class SysNutritionalVideoController extends BaseController
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('custom:nutritionalVideo:list')")
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(SysNutritionalVideo sysNutritionalVideo, @RequestParam(value = "pageNum", defaultValue = "1") int pageNum, @RequestParam(value = "pageSize", defaultValue = "5")int pageSize)
|
||||
public TableDataInfo list(SysNutritionalVideo sysNutritionalVideo)
|
||||
{
|
||||
AjaxResult result = AjaxResult.success();
|
||||
int total = 0;
|
||||
List<SysNutritionalVideo> nutritionalVideoList = new ArrayList<>();
|
||||
try{
|
||||
GetVideoListResponseBody videoListResponseBody = AliyunVideoUtils.getVideoListByPage(null, "Normal,Blocked", pageNum, pageSize);
|
||||
if(videoListResponseBody != null){
|
||||
total = videoListResponseBody.total;
|
||||
for (GetVideoListResponseBody.GetVideoListResponseBodyVideoListVideo video : videoListResponseBody.videoList.video) {
|
||||
SysNutritionalVideo nutritionalVideo = new SysNutritionalVideo();
|
||||
nutritionalVideo.setCoverUrl(video.getCoverURL());
|
||||
nutritionalVideo.setTitle(video.getTitle());
|
||||
nutritionalVideo.setVideoId(video.getVideoId());
|
||||
nutritionalVideo.setDescription(video.getDescription());
|
||||
nutritionalVideo.setTags(video.getTags());
|
||||
nutritionalVideoList.add(nutritionalVideo);
|
||||
nutritionalVideo.setShowFlag("Normal".equals(video.getStatus()) ? 1 : 0);
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
/*AjaxResult result = AjaxResult.success();
|
||||
Map<String, Object> map = sysNutritionalVideoService.searchVideo(sysNutritionalVideo.getKey(), sysNutritionalVideo.getShowFlag(), pageNum, pageSize, null);
|
||||
if(map != null){
|
||||
result.put("total", map.get("total"));
|
||||
result.put("rows", map.get("nutritionalVideoList"));
|
||||
}
|
||||
result.put("total",total);
|
||||
result.put("rows", nutritionalVideoList);
|
||||
return result;
|
||||
return result;*/
|
||||
startPage();
|
||||
List<SysNutritionalVideo> list = sysNutritionalVideoService.selectSysNutritionalVideoList(sysNutritionalVideo, true);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -69,7 +57,11 @@ public class SysNutritionalVideoController extends BaseController
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return AjaxResult.success(sysNutritionalVideoService.selectSysNutritionalVideoById(id));
|
||||
SysNutritionalVideo sysNutritionalVideos = sysNutritionalVideoService.selectSysNutritionalVideoById(id);
|
||||
if(sysNutritionalVideos != null && StringUtils.isNotEmpty(sysNutritionalVideos.getCoverUrl())){
|
||||
sysNutritionalVideos.setPreviewUrl(AliyunOSSUtils.generatePresignedUrl(sysNutritionalVideos.getCoverUrl()));
|
||||
}
|
||||
return AjaxResult.success(sysNutritionalVideos);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -80,6 +72,7 @@ public class SysNutritionalVideoController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SysNutritionalVideo sysNutritionalVideo)
|
||||
{
|
||||
sysNutritionalVideo.setShowFlag(1);
|
||||
return toAjax(sysNutritionalVideoService.insertSysNutritionalVideo(sysNutritionalVideo));
|
||||
}
|
||||
|
||||
@ -93,7 +86,7 @@ public class SysNutritionalVideoController extends BaseController
|
||||
{
|
||||
AjaxResult result = AjaxResult.error();
|
||||
try {
|
||||
CreateUploadVideoResponse response = AliyunVideoUtils.createUploadVideoRequest(sysNutritionalVideo.getCateId(), sysNutritionalVideo.getFileName(), sysNutritionalVideo.getTitle(), sysNutritionalVideo.getCoverUrl(), sysNutritionalVideo.getTags(), sysNutritionalVideo.getDescription());
|
||||
CreateUploadVideoResponse response = AliyunVideoUtils.createUploadVideoRequest(null, sysNutritionalVideo.getFileName(), sysNutritionalVideo.getTitle(), null, sysNutritionalVideo.getTags(), sysNutritionalVideo.getDescription());
|
||||
if(response != null){
|
||||
result = AjaxResult.success();
|
||||
result.put("uploadAuth", response.body);
|
||||
@ -125,4 +118,20 @@ public class SysNutritionalVideoController extends BaseController
|
||||
{
|
||||
return toAjax(sysNutritionalVideoService.deleteSysNutritionalVideoByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改营养小知识是否微信展示状态
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('custom:nutritionalVideo:edit')")
|
||||
@Log(title = "微信展示状态修改", businessType = BusinessType.UPDATE)
|
||||
@GetMapping("/updateWxShow")
|
||||
public AjaxResult updateWxShow(@RequestParam("id")String id, @RequestParam("showFlag")Integer showFlag)
|
||||
{
|
||||
if(StringUtils.isEmpty(id) || showFlag == null){
|
||||
return AjaxResult.error();
|
||||
}
|
||||
Long[] ids = {Long.parseLong(id)};
|
||||
return toAjax(sysNutritionalVideoService.updateWxshowByIds(showFlag, ids));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,113 @@
|
||||
package com.stdiet.web.controller.custom;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.stdiet.common.annotation.Log;
|
||||
import com.stdiet.common.core.controller.BaseController;
|
||||
import com.stdiet.common.core.domain.AjaxResult;
|
||||
import com.stdiet.common.enums.BusinessType;
|
||||
import com.stdiet.custom.domain.SysVideoClassify;
|
||||
import com.stdiet.custom.service.ISysVideoClassifyService;
|
||||
import com.stdiet.common.utils.poi.ExcelUtil;
|
||||
import com.stdiet.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 视频分类Controller
|
||||
*
|
||||
* @author xzj
|
||||
* @date 2021-05-05
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/custom/videoClassify")
|
||||
public class SysVideoClassifyController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysVideoClassifyService sysVideoClassifyService;
|
||||
|
||||
/**
|
||||
* 查询视频分类列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('custom:videoClassify:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysVideoClassify sysVideoClassify)
|
||||
{
|
||||
startPage();
|
||||
List<SysVideoClassify> list = sysVideoClassifyService.selectSysVideoClassifyList(sysVideoClassify);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出视频分类列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('custom:videoClassify:export')")
|
||||
@Log(title = "视频分类", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SysVideoClassify sysVideoClassify)
|
||||
{
|
||||
List<SysVideoClassify> list = sysVideoClassifyService.selectSysVideoClassifyList(sysVideoClassify);
|
||||
ExcelUtil<SysVideoClassify> util = new ExcelUtil<SysVideoClassify>(SysVideoClassify.class);
|
||||
return util.exportExcel(list, "videoClassify");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取视频分类详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('custom:videoClassify:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return AjaxResult.success(sysVideoClassifyService.selectSysVideoClassifyById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增视频分类
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('custom:videoClassify:add')")
|
||||
@Log(title = "视频分类", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SysVideoClassify sysVideoClassify)
|
||||
{
|
||||
return toAjax(sysVideoClassifyService.insertSysVideoClassify(sysVideoClassify));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改视频分类
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('custom:videoClassify:edit')")
|
||||
@Log(title = "视频分类", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SysVideoClassify sysVideoClassify)
|
||||
{
|
||||
return toAjax(sysVideoClassifyService.updateSysVideoClassify(sysVideoClassify));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除视频分类
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('custom:videoClassify:remove')")
|
||||
@Log(title = "视频分类", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(sysVideoClassifyService.deleteSysVideoClassifyByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询视频分类列表
|
||||
*/
|
||||
@GetMapping("/getAllClassify")
|
||||
public AjaxResult getAllClassify()
|
||||
{
|
||||
List<SysVideoClassify> list = sysVideoClassifyService.getAllClassify();
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
}
|
@ -360,30 +360,16 @@ public class WechatAppletController extends BaseController {
|
||||
* 获取视频列表
|
||||
*/
|
||||
@GetMapping(value = "/getVideoList")
|
||||
public AjaxResult getVideoList(SysNutritionalVideo sysNutritionalVideo, @RequestParam(value = "pageNum", defaultValue = "1") int pageNum, @RequestParam(value = "pageSize", defaultValue = "5") int pageSize) {
|
||||
AjaxResult result = AjaxResult.success();
|
||||
int total = 0;
|
||||
List<NutritionalVideoResponse> nutritionalVideoList = new ArrayList<>();
|
||||
try {
|
||||
GetVideoListResponseBody videoListResponseBody = AliyunVideoUtils.getVideoListByPage(null, "Normal", pageNum, pageSize);
|
||||
if (videoListResponseBody != null) {
|
||||
total = videoListResponseBody.total;
|
||||
for (GetVideoListResponseBody.GetVideoListResponseBodyVideoListVideo video : videoListResponseBody.videoList.video) {
|
||||
NutritionalVideoResponse nutritionalVideoResponse = new NutritionalVideoResponse();
|
||||
nutritionalVideoResponse.setCoverUrl(video.getCoverURL());
|
||||
nutritionalVideoResponse.setTitle(video.getTitle());
|
||||
nutritionalVideoResponse.setVideoId(video.getVideoId());
|
||||
nutritionalVideoResponse.setDescription(video.getDescription());
|
||||
nutritionalVideoResponse.setTags(video.getTags());
|
||||
nutritionalVideoList.add(nutritionalVideoResponse);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
result.put("total", total);
|
||||
result.put("rows", nutritionalVideoList);
|
||||
return result;
|
||||
public TableDataInfo getVideoList(SysNutritionalVideo sysNutritionalVideo) {
|
||||
/* AjaxResult result = AjaxResult.success();
|
||||
Map<String, Object> map = sysNutritionalVideoService.searchVideo(sysNutritionalVideo.getKey(), 1, pageNum, pageSize, null);
|
||||
result.put("total", map.get("total"));
|
||||
result.put("rows", map.get("nutritionalVideoList"));
|
||||
return result;*/
|
||||
startPage();
|
||||
sysNutritionalVideo.setShowFlag(1);
|
||||
List<SysNutritionalVideo> list = sysNutritionalVideoService.selectSysNutritionalVideoList(sysNutritionalVideo, true);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
|
@ -14,11 +14,13 @@ public class AliyunVideoUtils {
|
||||
|
||||
public static final String default_output_type = "oss";
|
||||
|
||||
public static final String default_formats = "mp4";
|
||||
public static final String default_formats = "cdn";
|
||||
|
||||
//播放地址日期,30天
|
||||
public static final Long default_authTimeout = 2592000L;
|
||||
|
||||
public static final String search_field = "VideoId,Title,CoverURL,CateName,Tags,Status,Description,CreationTime";
|
||||
|
||||
/**
|
||||
* 初始化视频点播Client
|
||||
* @return
|
||||
@ -43,7 +45,7 @@ public class AliyunVideoUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页获取视频列表
|
||||
* 分页获取视频列表(限于5000条,不能关键词搜索)
|
||||
* @param pageNo 页码
|
||||
* @param pageSize 每页数量
|
||||
* @return
|
||||
@ -120,6 +122,37 @@ public class AliyunVideoUtils {
|
||||
return client.createUploadVideo(createUploadVideoRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param key
|
||||
* @param status
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @throws Exception
|
||||
*/
|
||||
public static SearchMediaResponse searchVideo(String key, String status, Integer pageNo, Integer pageSize, String scrollToken) throws Exception{
|
||||
com.aliyun.vod20170321.Client client = AliyunVideoUtils.createClient();
|
||||
SearchMediaRequest searchMediaRequest = new SearchMediaRequest()
|
||||
.setSearchType("video")
|
||||
.setFields(search_field)
|
||||
.setPageNo(pageNo == null ? 1 : pageNo)
|
||||
.setPageSize(pageSize == null ? 10 : pageSize)
|
||||
.setSortBy("CateId:Asc,CreationTime:Desc")
|
||||
.setScrollToken(scrollToken);
|
||||
if(StringUtils.isNotEmpty(key) || StringUtils.isNotEmpty(status)){
|
||||
String matchString = null;
|
||||
if(StringUtils.isNotEmpty(key)){
|
||||
matchString += StringUtils.format("(Title = '%s' or Description = '%s')", key, key);
|
||||
}
|
||||
if(StringUtils.isNotEmpty(status)) {
|
||||
matchString += matchString == null ? "" : " and ";
|
||||
matchString += StringUtils.format("(Status = '%s')", status);
|
||||
}
|
||||
System.out.println(matchString);
|
||||
searchMediaRequest.setMatch(matchString);
|
||||
}
|
||||
return client.searchMedia(searchMediaRequest);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.stdiet.custom.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
@ -7,6 +8,8 @@ import com.stdiet.common.annotation.Excel;
|
||||
import com.stdiet.common.core.domain.BaseEntity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 业务提成比例对象 sys_commision
|
||||
@ -28,6 +31,8 @@ public class SysCommision extends BaseEntity {
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
private List<Long> userIds;
|
||||
|
||||
/**
|
||||
* 岗位id
|
||||
*/
|
||||
@ -54,6 +59,11 @@ public class SysCommision extends BaseEntity {
|
||||
@Excel(name = "比例", suffix = "%")
|
||||
private Float rate;
|
||||
|
||||
/** 比例开始时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date startTime;
|
||||
|
||||
/**
|
||||
* 提成
|
||||
*/
|
||||
|
@ -22,6 +22,8 @@ public class SysNutritionalVideo extends BaseEntity
|
||||
@Excel(name = "视频分类ID")
|
||||
private Long cateId;
|
||||
|
||||
private String cateName;
|
||||
|
||||
/** 阿里云视频ID */
|
||||
@Excel(name = "阿里云视频ID")
|
||||
private String videoId;
|
||||
@ -30,6 +32,9 @@ public class SysNutritionalVideo extends BaseEntity
|
||||
@Excel(name = "视频封面URL")
|
||||
private String coverUrl;
|
||||
|
||||
//预览URL
|
||||
private String previewUrl;
|
||||
|
||||
/** 视频标题 */
|
||||
@Excel(name = "视频标题")
|
||||
private String title;
|
||||
@ -50,9 +55,21 @@ public class SysNutritionalVideo extends BaseEntity
|
||||
@Excel(name = "是否显示,0不显示 1显示,默认0")
|
||||
private Integer showFlag;
|
||||
|
||||
/** 优先级,默认0 */
|
||||
@Excel(name = "优先级,默认0")
|
||||
private Long priorityLevel;
|
||||
|
||||
/** 视频付费等级,0无需付费 1客户可看 2付费可看 */
|
||||
@Excel(name = "视频付费等级,0无需付费 1客户可看 2付费可看")
|
||||
private Long payLevel;
|
||||
|
||||
private String payLevelName;
|
||||
|
||||
/** 删除标识,0未删除 1已删除,默认0 */
|
||||
private Integer delFlag;
|
||||
|
||||
//文件名称
|
||||
private String fileName;
|
||||
|
||||
private String key;
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package com.stdiet.custom.domain;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* 视频分类对象 sys_video_classify
|
||||
*
|
||||
* @author xzj
|
||||
* @date 2021-05-05
|
||||
*/
|
||||
@Data
|
||||
public class SysVideoClassify extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** $column.columnComment */
|
||||
private Long id;
|
||||
|
||||
/** 分类名称 */
|
||||
@Excel(name = "分类名称")
|
||||
private String cateName;
|
||||
|
||||
/** 类型标识,0全部可看 1客户可看 2额外付费观看 */
|
||||
@Excel(name = "类型标识,0全部可看 1客户可看 2额外付费观看")
|
||||
private Integer payFlag;
|
||||
|
||||
/** 删除标识 0未删除 1已删除 */
|
||||
private Integer delFlag;
|
||||
}
|
@ -68,4 +68,6 @@ public interface SysCommisionMapper
|
||||
* @return
|
||||
*/
|
||||
List<SysCommision> getAfterSaleAndNutri(SysCommision sysCommision);
|
||||
|
||||
List<Long> getAfterSaleId(SysCommision sysCommision);
|
||||
}
|
||||
|
@ -66,4 +66,13 @@ public interface SysNutritionalVideoMapper
|
||||
* @return
|
||||
*/
|
||||
public SysNutritionalVideo selectSysNutritionalVideByVideoId(@Param("videoId")String videoId);
|
||||
|
||||
|
||||
/**
|
||||
* 更新微信展示状态
|
||||
* @param wxShow
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
public int updateWxshowByIds(@Param("wxShow")Integer wxShow, @Param("array") Long[] ids);
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
package com.stdiet.custom.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.stdiet.custom.domain.SysVideoClassify;
|
||||
|
||||
/**
|
||||
* 视频分类Mapper接口
|
||||
*
|
||||
* @author xzj
|
||||
* @date 2021-05-05
|
||||
*/
|
||||
public interface SysVideoClassifyMapper
|
||||
{
|
||||
/**
|
||||
* 查询视频分类
|
||||
*
|
||||
* @param id 视频分类ID
|
||||
* @return 视频分类
|
||||
*/
|
||||
public SysVideoClassify selectSysVideoClassifyById(Long id);
|
||||
|
||||
/**
|
||||
* 查询视频分类列表
|
||||
*
|
||||
* @param sysVideoClassify 视频分类
|
||||
* @return 视频分类集合
|
||||
*/
|
||||
public List<SysVideoClassify> selectSysVideoClassifyList(SysVideoClassify sysVideoClassify);
|
||||
|
||||
/**
|
||||
* 新增视频分类
|
||||
*
|
||||
* @param sysVideoClassify 视频分类
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSysVideoClassify(SysVideoClassify sysVideoClassify);
|
||||
|
||||
/**
|
||||
* 修改视频分类
|
||||
*
|
||||
* @param sysVideoClassify 视频分类
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysVideoClassify(SysVideoClassify sysVideoClassify);
|
||||
|
||||
/**
|
||||
* 删除视频分类
|
||||
*
|
||||
* @param id 视频分类ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysVideoClassifyById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除视频分类
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysVideoClassifyByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 获取所有类别
|
||||
* @return
|
||||
*/
|
||||
public List<SysVideoClassify> getAllClassify();
|
||||
}
|
@ -62,4 +62,11 @@ public interface ISysCommisionService
|
||||
public int deleteSysCommisionById(Long ruleId);
|
||||
|
||||
public List<SysCommision> selectSysCommisionDetail(SysCommision sysCommision);
|
||||
|
||||
/**
|
||||
* 查询售后、营养师用户信息
|
||||
* @param sysCommision
|
||||
* @return
|
||||
*/
|
||||
List<Long> getAfterSaleId(SysCommision sysCommision);
|
||||
}
|
||||
|
@ -39,4 +39,11 @@ public interface ISysCommissionDayService {
|
||||
*/
|
||||
AjaxResult calculateOrderCommissionDetail(SysCommision sysCommision);
|
||||
|
||||
/**
|
||||
* 根据开始生效时间分类提成比例
|
||||
* @param tmpComList
|
||||
* @return
|
||||
*/
|
||||
Map<String, List<SysCommision>> getRateMapByStartTime(List<SysCommision> tmpComList);
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.stdiet.custom.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.stdiet.custom.domain.SysNutritionalVideo;
|
||||
|
||||
/**
|
||||
@ -25,7 +27,7 @@ public interface ISysNutritionalVideoService
|
||||
* @param sysNutritionalVideo 营养视频
|
||||
* @return 营养视频集合
|
||||
*/
|
||||
public List<SysNutritionalVideo> selectSysNutritionalVideoList(SysNutritionalVideo sysNutritionalVideo);
|
||||
public List<SysNutritionalVideo> selectSysNutritionalVideoList(SysNutritionalVideo sysNutritionalVideo, boolean flag);
|
||||
|
||||
/**
|
||||
* 新增营养视频
|
||||
@ -65,4 +67,18 @@ public interface ISysNutritionalVideoService
|
||||
* @return
|
||||
*/
|
||||
public SysNutritionalVideo selectSysNutritionalVideByVideoId(String videoId);
|
||||
|
||||
/**
|
||||
* 阿里云视频查询检索
|
||||
* @return
|
||||
*/
|
||||
public Map<String,Object> searchVideo(String key, Integer status, Integer pageNo, Integer pageSize, String scrollToken);
|
||||
|
||||
/**
|
||||
* 更新微信展示状态
|
||||
* @param wxShow
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
public int updateWxshowByIds(Integer wxShow, Long[] ids);
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
package com.stdiet.custom.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.stdiet.custom.domain.SysVideoClassify;
|
||||
|
||||
/**
|
||||
* 视频分类Service接口
|
||||
*
|
||||
* @author xzj
|
||||
* @date 2021-05-05
|
||||
*/
|
||||
public interface ISysVideoClassifyService
|
||||
{
|
||||
/**
|
||||
* 查询视频分类
|
||||
*
|
||||
* @param id 视频分类ID
|
||||
* @return 视频分类
|
||||
*/
|
||||
public SysVideoClassify selectSysVideoClassifyById(Long id);
|
||||
|
||||
/**
|
||||
* 查询视频分类列表
|
||||
*
|
||||
* @param sysVideoClassify 视频分类
|
||||
* @return 视频分类集合
|
||||
*/
|
||||
public List<SysVideoClassify> selectSysVideoClassifyList(SysVideoClassify sysVideoClassify);
|
||||
|
||||
/**
|
||||
* 新增视频分类
|
||||
*
|
||||
* @param sysVideoClassify 视频分类
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSysVideoClassify(SysVideoClassify sysVideoClassify);
|
||||
|
||||
/**
|
||||
* 修改视频分类
|
||||
*
|
||||
* @param sysVideoClassify 视频分类
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysVideoClassify(SysVideoClassify sysVideoClassify);
|
||||
|
||||
/**
|
||||
* 批量删除视频分类
|
||||
*
|
||||
* @param ids 需要删除的视频分类ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysVideoClassifyByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除视频分类信息
|
||||
*
|
||||
* @param id 视频分类ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysVideoClassifyById(Long id);
|
||||
|
||||
/**
|
||||
* 获取所有类别
|
||||
* @return
|
||||
*/
|
||||
public List<SysVideoClassify> getAllClassify();
|
||||
}
|
@ -98,4 +98,14 @@ public class SysCommisionServiceImpl implements ISysCommisionService
|
||||
public List<SysCommision> selectSysCommisionDetail(SysCommision sysCommision) {
|
||||
return sysCommisionMapper.selectSysCommisionDetail(sysCommision);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询售后、营养师用户信息
|
||||
* @param sysCommision
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Long> getAfterSaleId(SysCommision sysCommision){
|
||||
return sysCommisionMapper.getAfterSaleId(sysCommision);
|
||||
}
|
||||
}
|
||||
|
@ -296,7 +296,7 @@ public class SysCommissionDayServiceImpl implements ISysCommissionDayService {
|
||||
//该笔订单当月的成交总额
|
||||
sysOrderCommisionDayDetail.setMonthOrderTotalAmount(everyMonthTotalAmountMap.get(yearMonth));
|
||||
//该笔订单对应提成比例
|
||||
sysOrderCommisionDayDetail.setCommissionRate(rateMap.get(yearMonth));
|
||||
sysOrderCommisionDayDetail.setCommissionRate(rateMap.get(yearMonth) == null ? rateMap.get("19001") : rateMap.get(yearMonth));
|
||||
//计算该笔订单总提成
|
||||
sysOrderCommisionDayDetail.setOrderCommission(getMoney(sysOrderCommisionDayDetail.getOrderAmount().doubleValue() * sysOrderCommisionDayDetail.getCommissionRate() / 100D));
|
||||
//每年每月提成
|
||||
@ -357,24 +357,43 @@ public class SysCommissionDayServiceImpl implements ISysCommissionDayService {
|
||||
tmpQueryCom.setPostId(postId);
|
||||
List<SysCommision> tmpComList = sysCommisionMapper.selectSysCommisionList(tmpQueryCom);
|
||||
Map<String, Float> rateMap = new TreeMap<>(new MyComparator());
|
||||
//取第一个区间为默认提成比例
|
||||
rateMap.put("19001", (tmpComList != null && tmpComList.size() > 0) ? tmpComList.get(0).getRate() : 0.0F);
|
||||
//按比例开始时间分类
|
||||
Map<String, List<SysCommision>> rateYearMonthMap = getRateMapByStartTime(tmpComList);
|
||||
for(String yearMonth : amountMap.keySet()){
|
||||
BigDecimal orderAmount = amountMap.get(yearMonth);
|
||||
rateMap.put(yearMonth, 0F);
|
||||
if(tmpComList != null && tmpComList.size() > 0){
|
||||
for (int i = 0; i < tmpComList.size(); i++) {
|
||||
SysCommision com = tmpComList.get(i);
|
||||
List<SysCommision> yearMonthRateList = null;
|
||||
for (String rateMonth : rateYearMonthMap.keySet()) {
|
||||
if(Long.parseLong(yearMonth) >= Long.parseLong(rateMonth)){
|
||||
yearMonthRateList = rateYearMonthMap.get(rateMonth);
|
||||
}else{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(yearMonthRateList != null && yearMonthRateList.size() > 0){
|
||||
for (int i = 0; i < yearMonthRateList.size(); i++) {
|
||||
SysCommision com = yearMonthRateList.get(i);
|
||||
double cAmount = com.getAmount().floatValue();
|
||||
if (orderAmount.floatValue() <= cAmount && i == 0) {
|
||||
Long rateStartYearMonth = null;
|
||||
if(com.getStartTime() != null){
|
||||
rateStartYearMonth = Long.parseLong(DateUtils.dateToLocalDate(com.getStartTime()).getYear() + "" + DateUtils.dateToLocalDate(com.getStartTime()).getMonth().getValue());
|
||||
}else{
|
||||
rateStartYearMonth = 19001L;
|
||||
}
|
||||
|
||||
if (orderAmount.floatValue() <= cAmount && i == 0 && Long.parseLong(yearMonth) >= rateStartYearMonth) {
|
||||
// 第一条规则
|
||||
rateMap.put(yearMonth,com.getRate());
|
||||
break;
|
||||
} else if (i == tmpComList.size() - 1 && orderAmount.floatValue() > cAmount) {
|
||||
} else if (i == yearMonthRateList.size() - 1 && orderAmount.floatValue() > cAmount && Long.parseLong(yearMonth) >= rateStartYearMonth) {
|
||||
// 最后一条规则
|
||||
rateMap.put(yearMonth,com.getRate());
|
||||
break;
|
||||
} else if (cAmount < orderAmount.floatValue() && orderAmount.floatValue() <= tmpComList.get(i + 1).getAmount().floatValue()) {
|
||||
} else if (cAmount < orderAmount.floatValue() && orderAmount.floatValue() <= yearMonthRateList.get(i + 1).getAmount().floatValue() && Long.parseLong(yearMonth) >= rateStartYearMonth) {
|
||||
// 中间规则
|
||||
rateMap.put(yearMonth,tmpComList.get(i + 1).getRate());
|
||||
rateMap.put(yearMonth,yearMonthRateList.get(i + 1).getRate());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -383,6 +402,33 @@ public class SysCommissionDayServiceImpl implements ISysCommissionDayService {
|
||||
return rateMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据比例开始执行时间进行分类
|
||||
* @param tmpComList
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Map<String, List<SysCommision>> getRateMapByStartTime(List<SysCommision> tmpComList){
|
||||
Map<String, List<SysCommision>> result = new TreeMap<>(new MyComparator());
|
||||
for (SysCommision sysCommision : tmpComList) {
|
||||
String rateStartYearMonth = null;
|
||||
if(sysCommision.getStartTime() != null){
|
||||
rateStartYearMonth = DateUtils.dateToLocalDate(sysCommision.getStartTime()).getYear() + "" + DateUtils.dateToLocalDate(sysCommision.getStartTime()).getMonth().getValue();
|
||||
}else{
|
||||
rateStartYearMonth = 19001+"";
|
||||
}
|
||||
if(result.containsKey(rateStartYearMonth)){
|
||||
result.get(rateStartYearMonth).add(sysCommision);
|
||||
}else{
|
||||
List<SysCommision> list = new ArrayList<>();
|
||||
list.add(sysCommision);
|
||||
result.put(rateStartYearMonth, list);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询2021年1月份之后所有订单,对订单进行处理,得出每笔订单的相关信息
|
||||
* @param sysCommision 是否
|
||||
@ -547,12 +593,12 @@ public class SysCommissionDayServiceImpl implements ISysCommissionDayService {
|
||||
}
|
||||
}
|
||||
}
|
||||
for (SysOrderCommisionDayDetail c : sysOrderCommisionDayDetailList) {
|
||||
/**for (SysOrderCommisionDayDetail c : sysOrderCommisionDayDetailList) {
|
||||
System.out.println(c.getOrderId() + "-" + c.getNutritionistId() + "-" + c.getAfterSaleId() + "-"+
|
||||
DateUtils.localDateToString(c.getServerStartDate(),"yyyy-MM-dd") + "-" +
|
||||
DateUtils.localDateToString(c.getServerEndDate(),"yyyy-MM-dd") +
|
||||
"-" + c.getDayMoney().doubleValue() + "-" + c.getOrderAmount().doubleValue());
|
||||
}
|
||||
}**/
|
||||
return sysOrderCommisionDayDetailList;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,15 @@
|
||||
package com.stdiet.custom.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.aliyun.vod20170321.models.SearchMediaResponse;
|
||||
import com.aliyun.vod20170321.models.SearchMediaResponseBody;
|
||||
import com.stdiet.common.utils.AliyunVideoUtils;
|
||||
import com.stdiet.common.utils.DateUtils;
|
||||
import com.stdiet.common.utils.oss.AliyunOSSUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.stdiet.custom.mapper.SysNutritionalVideoMapper;
|
||||
@ -39,9 +47,24 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi
|
||||
* @return 营养视频
|
||||
*/
|
||||
@Override
|
||||
public List<SysNutritionalVideo> selectSysNutritionalVideoList(SysNutritionalVideo sysNutritionalVideo)
|
||||
public List<SysNutritionalVideo> selectSysNutritionalVideoList(SysNutritionalVideo sysNutritionalVideo, boolean flag)
|
||||
{
|
||||
return sysNutritionalVideoMapper.selectSysNutritionalVideoList(sysNutritionalVideo);
|
||||
List<SysNutritionalVideo> list = sysNutritionalVideoMapper.selectSysNutritionalVideoList(sysNutritionalVideo);
|
||||
if(flag && list != null && list.size() > 0){
|
||||
List<String> fileUrl = new ArrayList<>();
|
||||
for (SysNutritionalVideo video : list) {
|
||||
fileUrl.add(video.getCoverUrl());
|
||||
}
|
||||
List<String> downUrlList = AliyunOSSUtils.generatePresignedUrl(fileUrl);
|
||||
if(downUrlList != null && downUrlList.size() > 0){
|
||||
int index = 0;
|
||||
for (String downUrl : downUrlList) {
|
||||
list.get(index).setCoverUrl(downUrl);
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -102,4 +125,69 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi
|
||||
public SysNutritionalVideo selectSysNutritionalVideByVideoId(String videoId){
|
||||
return sysNutritionalVideoMapper.selectSysNutritionalVideByVideoId(videoId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 阿里云视频查询检索
|
||||
* @return
|
||||
*/
|
||||
public Map<String,Object> searchVideo(String key, Integer showFlag, Integer pageNo, Integer pageSize, String scrollToken){
|
||||
pageSize = pageSize.intValue() > 100 ? 10 : pageSize;
|
||||
long total = 0;
|
||||
String newScrollToken = null;
|
||||
List<SysNutritionalVideo> nutritionalVideoList = new ArrayList<>();
|
||||
try {
|
||||
SearchMediaResponse response = AliyunVideoUtils.searchVideo(key, getStatusString(showFlag), pageNo, pageSize, scrollToken);
|
||||
if(response != null){
|
||||
SearchMediaResponseBody body = response.body;
|
||||
total = body.total;
|
||||
newScrollToken = body.scrollToken;
|
||||
List<SearchMediaResponseBody.SearchMediaResponseBodyMediaList> mediaList = body.mediaList;
|
||||
if(mediaList != null && mediaList.size() > 0){
|
||||
for (SearchMediaResponseBody.SearchMediaResponseBodyMediaList media : mediaList) {
|
||||
SysNutritionalVideo sysNutritionalVideo = new SysNutritionalVideo();
|
||||
sysNutritionalVideo.setTitle(media.video.title);
|
||||
sysNutritionalVideo.setCoverUrl(media.video.coverURL);
|
||||
sysNutritionalVideo.setShowFlag(getStatus(media.video.getStatus()));
|
||||
sysNutritionalVideo.setTags(media.video.tags);
|
||||
//String createTime = media.video.creationTime;
|
||||
sysNutritionalVideo.setDescription(media.video.description);
|
||||
sysNutritionalVideo.setVideoId(media.video.videoId);
|
||||
nutritionalVideoList.add(sysNutritionalVideo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("total", total);
|
||||
result.put("newScrollToken", newScrollToken);
|
||||
result.put("nutritionalVideoList", nutritionalVideoList);
|
||||
return result;
|
||||
}
|
||||
|
||||
private String getStatusString(Integer status){
|
||||
if(status == null){
|
||||
return "Normal,Blocked";
|
||||
}
|
||||
return status.intValue() == 1 ? "Normal" : "Blocked";
|
||||
}
|
||||
|
||||
private Integer getStatus(String status){
|
||||
if(status == null){
|
||||
return 1;
|
||||
}
|
||||
return "Normal".equals(status) ? 1 : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新微信展示状态
|
||||
* @param wxShow
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
public int updateWxshowByIds(Integer wxShow, Long[] ids){
|
||||
return sysNutritionalVideoMapper. updateWxshowByIds(wxShow, ids);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,105 @@
|
||||
package com.stdiet.custom.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.stdiet.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.stdiet.custom.mapper.SysVideoClassifyMapper;
|
||||
import com.stdiet.custom.domain.SysVideoClassify;
|
||||
import com.stdiet.custom.service.ISysVideoClassifyService;
|
||||
|
||||
/**
|
||||
* 视频分类Service业务层处理
|
||||
*
|
||||
* @author xzj
|
||||
* @date 2021-05-05
|
||||
*/
|
||||
@Service
|
||||
public class SysVideoClassifyServiceImpl implements ISysVideoClassifyService
|
||||
{
|
||||
@Autowired
|
||||
private SysVideoClassifyMapper sysVideoClassifyMapper;
|
||||
|
||||
/**
|
||||
* 查询视频分类
|
||||
*
|
||||
* @param id 视频分类ID
|
||||
* @return 视频分类
|
||||
*/
|
||||
@Override
|
||||
public SysVideoClassify selectSysVideoClassifyById(Long id)
|
||||
{
|
||||
return sysVideoClassifyMapper.selectSysVideoClassifyById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询视频分类列表
|
||||
*
|
||||
* @param sysVideoClassify 视频分类
|
||||
* @return 视频分类
|
||||
*/
|
||||
@Override
|
||||
public List<SysVideoClassify> selectSysVideoClassifyList(SysVideoClassify sysVideoClassify)
|
||||
{
|
||||
return sysVideoClassifyMapper.selectSysVideoClassifyList(sysVideoClassify);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增视频分类
|
||||
*
|
||||
* @param sysVideoClassify 视频分类
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertSysVideoClassify(SysVideoClassify sysVideoClassify)
|
||||
{
|
||||
sysVideoClassify.setCreateTime(DateUtils.getNowDate());
|
||||
return sysVideoClassifyMapper.insertSysVideoClassify(sysVideoClassify);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改视频分类
|
||||
*
|
||||
* @param sysVideoClassify 视频分类
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateSysVideoClassify(SysVideoClassify sysVideoClassify)
|
||||
{
|
||||
sysVideoClassify.setUpdateTime(DateUtils.getNowDate());
|
||||
return sysVideoClassifyMapper.updateSysVideoClassify(sysVideoClassify);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除视频分类
|
||||
*
|
||||
* @param ids 需要删除的视频分类ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysVideoClassifyByIds(Long[] ids)
|
||||
{
|
||||
return sysVideoClassifyMapper.deleteSysVideoClassifyByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除视频分类信息
|
||||
*
|
||||
* @param id 视频分类ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysVideoClassifyById(Long id)
|
||||
{
|
||||
return sysVideoClassifyMapper.deleteSysVideoClassifyById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有类别
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<SysVideoClassify> getAllClassify(){
|
||||
return sysVideoClassifyMapper.getAllClassify();
|
||||
}
|
||||
}
|
@ -12,6 +12,7 @@
|
||||
<result property="postName" column="post_name"/>
|
||||
<result property="amount" column="amount"/>
|
||||
<result property="rate" column="rate"/>
|
||||
<result property="startTime" column="start_time" />
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
@ -114,6 +115,12 @@
|
||||
<where>
|
||||
<if test="postId != null and postId != ''">and post_id = #{postId}</if>
|
||||
<if test="userId != null and userId != ''">and user_id = #{userId}</if>
|
||||
<if test="userIds != null">
|
||||
and user_id in
|
||||
<foreach item="id" collection="userIds" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@ -136,6 +143,8 @@
|
||||
<if test="userId != null ">and user_id = #{userId}</if>
|
||||
<if test="postId != null ">and post_id = #{postId}</if>
|
||||
</where>
|
||||
<!-- 请勿随意修改排序方式,会影响提成计算 -->
|
||||
order by user_id asc,amount asc,start_time asc
|
||||
</select>
|
||||
|
||||
<select id="selectSysCommisionById" parameterType="SysCommision" resultMap="SysCommisionResult">
|
||||
@ -152,6 +161,7 @@
|
||||
<if test="postId != null">post_id,</if>
|
||||
<if test="amount != null">amount,</if>
|
||||
<if test="rate != null">rate,</if>
|
||||
<if test="startTime != null">start_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
@ -163,6 +173,7 @@
|
||||
<if test="postId != null">#{postId},</if>
|
||||
<if test="amount != null">#{amount},</if>
|
||||
<if test="rate != null">#{rate},</if>
|
||||
<if test="startTime != null">#{startTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
@ -178,6 +189,7 @@
|
||||
<if test="postId != null">post_id = #{postId},</if>
|
||||
<if test="amount != null">amount = #{amount},</if>
|
||||
<if test="rate != null">rate = #{rate},</if>
|
||||
<if test="startTime != null">start_time = #{startTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
@ -207,4 +219,11 @@
|
||||
<if test="postId != null and postId != ''">and sp.post_id = #{postId}</if>
|
||||
<if test="userId != null and userId != ''">and su.user_id = #{userId}</if>
|
||||
</select>
|
||||
|
||||
<select id="getAfterSaleId" parameterType="SysCommision" resultType="Long">
|
||||
SELECT su.user_id FROM sys_user su
|
||||
LEFT JOIN sys_user_post sup ON sup.user_id = su.user_id
|
||||
LEFT JOIN sys_post sp ON sp.post_id = sup.post_id
|
||||
WHERE su.del_flag = 0 and sp.post_id = #{postId}
|
||||
</select>
|
||||
</mapper>
|
@ -14,22 +14,42 @@
|
||||
<result property="videoSize" column="video_size" />
|
||||
<result property="tags" column="tags" />
|
||||
<result property="showFlag" column="show_flag" />
|
||||
<result property="priorityLevel" column="priority_level" />
|
||||
<result property="payLevel" column="pay_level" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
|
||||
<result property="payLevelName" column="pay_level_name"></result>
|
||||
<result property="cateName" column="cate_name"></result>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSysNutritionalVideoVo">
|
||||
select id, cate_id, video_id, cover_url, title, description, video_size, tags, show_flag, create_time, create_by, update_time, update_by, del_flag from sys_nutritional_video
|
||||
select id, cate_id, video_id, cover_url, title, description, priority_level,pay_level,video_size, tags, show_flag, create_time, create_by, update_time, update_by, del_flag from sys_nutritional_video
|
||||
</sql>
|
||||
|
||||
<select id="selectSysNutritionalVideoList" parameterType="SysNutritionalVideo" resultMap="SysNutritionalVideoResult">
|
||||
<include refid="selectSysNutritionalVideoVo"/> where del_flag = 0
|
||||
select snv.id, snv.cate_id, snv.video_id, snv.cover_url, snv.title, snv.description, snv.priority_level,snv.pay_level,snv.video_size, snv.tags, snv.show_flag, snv.create_time,
|
||||
pay.dict_label as pay_level_name, svc.cate_name
|
||||
from sys_nutritional_video snv
|
||||
left join (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'video_pay_level') AS pay ON pay.dict_value = snv.pay_level
|
||||
left join sys_video_classify svc on svc.id = snv.cate_id and svc.del_flag = 0
|
||||
where snv.del_flag = 0
|
||||
<if test="showFlag != null">
|
||||
and show_flag = #{showFlag}
|
||||
and snv.show_flag = #{showFlag}
|
||||
</if>
|
||||
<if test="cateId != null">
|
||||
and snv.cate_id = #{cateId}
|
||||
</if>
|
||||
<if test="payLevel != null">
|
||||
and snv.pay_level = #{payLevel}
|
||||
</if>
|
||||
<if test="key != null and key != ''">
|
||||
and (snv.title like concat('%',#{key},'%') or snv.description like concat('%',#{key},'%'))
|
||||
</if>
|
||||
order by snv.priority_level DESC,snv.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="selectSysNutritionalVideoById" parameterType="Long" resultMap="SysNutritionalVideoResult">
|
||||
@ -48,8 +68,10 @@
|
||||
<if test="videoSize != null">video_size,</if>
|
||||
<if test="tags != null">tags,</if>
|
||||
<if test="showFlag != null">show_flag,</if>
|
||||
<if test="priorityLevel != null">priority_level,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="payLevel != null">pay_level,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
@ -63,8 +85,10 @@
|
||||
<if test="videoSize != null">#{videoSize},</if>
|
||||
<if test="tags != null">#{tags},</if>
|
||||
<if test="showFlag != null">#{showFlag},</if>
|
||||
<if test="priorityLevel != null">#{priorityLevel},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="payLevel != null">#{payLevel},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="delFlag != null">#{delFlag},</if>
|
||||
@ -82,8 +106,10 @@
|
||||
<if test="videoSize != null">video_size = #{videoSize},</if>
|
||||
<if test="tags != null">tags = #{tags},</if>
|
||||
<if test="showFlag != null">show_flag = #{showFlag},</if>
|
||||
<if test="priorityLevel != null">priority_level = #{priorityLevel},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="payLevel != null">pay_level = #{payLevel},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||
@ -106,4 +132,11 @@
|
||||
<include refid="selectSysNutritionalVideoVo"/> where video_id = #{videoId} and del_flag = 0 limit 1
|
||||
</select>
|
||||
|
||||
<update id="updateWxshowByIds" parameterType="String">
|
||||
update sys_nutritional_video set show_flag = #{wxShow} where del_flag = 0 and id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,85 @@
|
||||
<?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.SysVideoClassifyMapper">
|
||||
|
||||
<resultMap type="SysVideoClassify" id="SysVideoClassifyResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="cateName" column="cate_name" />
|
||||
<result property="payFlag" column="pay_flag" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSysVideoClassifyVo">
|
||||
select id, cate_name, pay_flag, create_time, create_by, update_time, update_by, del_flag from sys_video_classify
|
||||
</sql>
|
||||
|
||||
<select id="selectSysVideoClassifyList" parameterType="SysVideoClassify" resultMap="SysVideoClassifyResult">
|
||||
<include refid="selectSysVideoClassifyVo"/>
|
||||
where del_flag = 0
|
||||
</select>
|
||||
|
||||
<select id="selectSysVideoClassifyById" parameterType="Long" resultMap="SysVideoClassifyResult">
|
||||
<include refid="selectSysVideoClassifyVo"/>
|
||||
where id = #{id} and del_flag = 0
|
||||
</select>
|
||||
|
||||
<insert id="insertSysVideoClassify" parameterType="SysVideoClassify">
|
||||
insert into sys_video_classify
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="cateName != null">cate_name,</if>
|
||||
<if test="payFlag != null">pay_flag,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="cateName != null">#{cateName},</if>
|
||||
<if test="payFlag != null">#{payFlag},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="delFlag != null">#{delFlag},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateSysVideoClassify" parameterType="SysVideoClassify">
|
||||
update sys_video_classify
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="cateName != null">cate_name = #{cateName},</if>
|
||||
<if test="payFlag != null">pay_flag = #{payFlag},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="deleteSysVideoClassifyById" parameterType="Long">
|
||||
update sys_video_classify set del_flag = 1 where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="deleteSysVideoClassifyByIds" parameterType="String">
|
||||
update sys_video_classify set del_flag = 1 where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<select id="getAllClassify" resultMap="SysVideoClassifyResult">
|
||||
select id,cate_name from sys_video_classify where del_flag = 0
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -13,9 +13,9 @@
|
||||
rel="stylesheet"
|
||||
href="//at.alicdn.com/t/font_2343184_w0runuauamq.css"
|
||||
/>
|
||||
<script src="/lib/aliyunVideo/es6-promise.min.js"></script>
|
||||
<script src="/lib/aliyunVideo/aliyun-oss-sdk-6.13.0.min.js"></script>
|
||||
<script src="/lib/aliyunVideo/aliyun-upload-sdk-1.5.2.min.js"></script>
|
||||
<script src="../lib/aliyunVideo/es6-promise.min.js"></script>
|
||||
<script src="../lib/aliyunVideo/aliyun-oss-sdk-6.13.0.min.js"></script>
|
||||
<script src="../lib/aliyunVideo/aliyun-upload-sdk-1.5.2.min.js"></script>
|
||||
|
||||
<title><%= webpackConfig.name %></title>
|
||||
<style>
|
||||
|
20
stdiet-ui/public/lib/aliyunVideo/aliyun-oss-sdk-6.13.0.min.js
vendored
Normal file
20
stdiet-ui/public/lib/aliyunVideo/aliyun-oss-sdk-6.13.0.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
7
stdiet-ui/public/lib/aliyunVideo/aliyun-upload-sdk-1.5.2.min.js
vendored
Normal file
7
stdiet-ui/public/lib/aliyunVideo/aliyun-upload-sdk-1.5.2.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
stdiet-ui/public/lib/aliyunVideo/es6-promise.min.js
vendored
Normal file
1
stdiet-ui/public/lib/aliyunVideo/es6-promise.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -60,3 +60,12 @@ export function getUploadVideoAuth(data) {
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改视频展示状态
|
||||
export function updateWxShow(data){
|
||||
return request({
|
||||
url: '/custom/nutritionalVideo/updateWxShow',
|
||||
method: 'get',
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
61
stdiet-ui/src/api/custom/videoClassify.js
Normal file
61
stdiet-ui/src/api/custom/videoClassify.js
Normal file
@ -0,0 +1,61 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询视频分类列表
|
||||
export function listVideoClassify(query) {
|
||||
return request({
|
||||
url: '/custom/videoClassify/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询视频分类详细
|
||||
export function getVideoClassify(id) {
|
||||
return request({
|
||||
url: '/custom/videoClassify/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增视频分类
|
||||
export function addVideoClassify(data) {
|
||||
return request({
|
||||
url: '/custom/videoClassify',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改视频分类
|
||||
export function updateVideoClassify(data) {
|
||||
return request({
|
||||
url: '/custom/videoClassify',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除视频分类
|
||||
export function delVideoClassify(id) {
|
||||
return request({
|
||||
url: '/custom/videoClassify/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 导出视频分类
|
||||
export function exportVideoClassify(query) {
|
||||
return request({
|
||||
url: '/custom/videoClassify/export',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
//获取所有分类
|
||||
export function getAllClassify(){
|
||||
return request({
|
||||
url: '/custom/videoClassify/getAllClassify',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
113
stdiet-ui/src/components/FileUpload/UploadFile.vue
Normal file
113
stdiet-ui/src/components/FileUpload/UploadFile.vue
Normal file
@ -0,0 +1,113 @@
|
||||
<template>
|
||||
<el-upload
|
||||
class="avatar-uploader"
|
||||
:headers="upload.headers"
|
||||
:action="upload.url"
|
||||
:show-file-list="false"
|
||||
:on-success="handleFileSuccess"
|
||||
:accept="'.png,.jpg'"
|
||||
:before-upload="beforeAvatarUpload">
|
||||
<img v-if="imageUrl || coverUrl" :src="imageUrl || coverUrl" class="avatar">
|
||||
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
||||
<div class="el-upload__tip" slot="tip">
|
||||
1、只能上传png、jpg文件,且每个文件不超过{{
|
||||
upload.fileSize / (1024 * 1024)
|
||||
}}M
|
||||
</div>
|
||||
</el-upload>
|
||||
</template>
|
||||
<script>
|
||||
import { getToken } from "@/utils/auth";
|
||||
export default {
|
||||
name: "DragUpload",
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
upload: {
|
||||
// 上传的地址
|
||||
url: process.env.VUE_APP_BASE_API + "/custom/fileUpload/" + this.prefix,
|
||||
// 设置上传的请求头部
|
||||
headers: { Authorization: "Bearer " + getToken() },
|
||||
// 其他需要携带的数据
|
||||
data: {},
|
||||
//每个文件大小(单位:byte)
|
||||
fileSize: 1024 * 1024 * 10,
|
||||
},
|
||||
//上传之后的路径
|
||||
imageUrl: null,
|
||||
fileUrl: null
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
resetUpload(){
|
||||
this.imageUrl = null;
|
||||
this.fileUrl = null
|
||||
},
|
||||
// 文件上传成功处理
|
||||
handleFileSuccess(response, file, fileList) {
|
||||
if (response != null && response.code === 200) {
|
||||
this.fileUrl = response.fileUrl;
|
||||
this.imageUrl = response.previewUrl;
|
||||
//this.imageUrl = URL.createObjectURL(file.raw);
|
||||
//文件全部上传成功,则调用回调方法
|
||||
this.$emit("callbackMethod", this.fileUrl);
|
||||
} else {
|
||||
this.$message.error("文件上传失败");
|
||||
}
|
||||
},
|
||||
// 文件上传失败处理
|
||||
handleFileFail(err, file, fileList) {
|
||||
this.$message.error("文件上传失败");
|
||||
},
|
||||
beforeAvatarUpload(file) {
|
||||
if(file.type != 'image/jpeg' && file.type != 'image/png') {
|
||||
this.$message.error('文件格式错误');
|
||||
return false;
|
||||
}
|
||||
if (file.size > this.upload.fileSize) {
|
||||
this.$message.error('文件大小超过最大限制');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
},
|
||||
props: {
|
||||
prefix: {
|
||||
type: String,
|
||||
default: "videoCover",
|
||||
},
|
||||
coverUrl:{
|
||||
type: String,
|
||||
default: ""
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
.avatar-uploader .el-upload {
|
||||
border: 1px dashed #d7e236;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
.avatar-uploader .el-upload:hover {
|
||||
border-color: #409EFF;
|
||||
}
|
||||
.avatar-uploader-icon {
|
||||
font-size: 28px;
|
||||
color: #8c939d;
|
||||
width: 200px;
|
||||
height: 120px;
|
||||
line-height: 120px;
|
||||
text-align: center;
|
||||
}
|
||||
.avatar {
|
||||
width: 200px;
|
||||
height: 120px;
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
|
@ -1,13 +1,13 @@
|
||||
<template>
|
||||
<el-dialog title="视频上传" v-if="open" :visible.sync="open" width="700px" :close-on-click-modal="false" :show-close="false" append-to-body>
|
||||
<el-form ref="videoFrom" :model="videoFrom" :rules="videoRules" label-width="80px">
|
||||
<el-form ref="videoFrom" :model="videoFrom" :rules="videoRules" label-width="80px" style="height: 650px; overflow: auto">
|
||||
<el-form-item label="视频标题" prop="title">
|
||||
<el-input
|
||||
type="textarea"
|
||||
placeholder="请输入视频标题"
|
||||
v-model="videoFrom.title"
|
||||
maxlength="50"
|
||||
rows="3"
|
||||
rows="1"
|
||||
show-word-limit
|
||||
/>
|
||||
</el-form-item>
|
||||
@ -16,11 +16,38 @@
|
||||
type="textarea"
|
||||
placeholder="请输入视频描述"
|
||||
v-model="videoFrom.description"
|
||||
maxlength="2000"
|
||||
rows="10"
|
||||
maxlength="1000"
|
||||
rows="3"
|
||||
show-word-limit
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="视频封面" prop="coverUrl">
|
||||
<UploadFile ref="uploadFile" :prefix="'videoCover'" @callbackMethod="handleCoverUrl"></UploadFile>
|
||||
</el-form-item>
|
||||
<div style="display:flex">
|
||||
<el-form-item label="视频类别" prop="cateId">
|
||||
<el-select v-model="videoFrom.cateId" clearable filterable placeholder="请选择类别">
|
||||
<el-option
|
||||
v-for="classify in classifyList"
|
||||
:key="classify.id"
|
||||
:label="classify.cateName"
|
||||
:value="classify.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="视频权限" prop="payLevel" style="margin-left:40px">
|
||||
<el-select v-model="videoFrom.payLevel" clearable filterable placeholder="请选择权限">
|
||||
<el-option
|
||||
v-for="dict in payVideoLevelList"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="parseInt(dict.dictValue)"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
<el-form-item label="视频文件" prop="file">
|
||||
<div>
|
||||
<input type="file" accept=".mp4" ref="videoFile" id="videoFile" @change="fileChange($event)">
|
||||
@ -28,7 +55,14 @@
|
||||
<div > 1、只能上传mp4文件,上传大文件时请使用客户端上传,防止上传超时</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="展示状态" prop="wxShow">
|
||||
<el-switch
|
||||
v-model="videoFrom.wxShow"
|
||||
active-text="小程序展示"
|
||||
inactive-text="小程序不展示">
|
||||
</el-switch>
|
||||
<div>提示:请保证内容正确再展示到小程序</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="authUpload" :disabled="uploadDisabled">开始上传</el-button>
|
||||
@ -39,17 +73,32 @@
|
||||
</template>
|
||||
<script>
|
||||
import axios from 'axios'
|
||||
import {getUploadVideoAuth } from "@/api/custom/nutritionalVideo";
|
||||
|
||||
import {getUploadVideoAuth,addNutritionalVideo } from "@/api/custom/nutritionalVideo";
|
||||
import {getAllClassify } from "@/api/custom/videoClassify";
|
||||
import UploadFile from "@/components/FileUpload/UploadFile";
|
||||
export default {
|
||||
name: "UploadVideo",
|
||||
data () {
|
||||
return {
|
||||
open: false,
|
||||
videoFrom:{},
|
||||
videoRules:{},
|
||||
videoRules:{
|
||||
title: [
|
||||
{ required: true, message: "标题不能为空", trigger: "blur" },
|
||||
],
|
||||
coverUrl: [
|
||||
{ required: true, message: "封面不能为空", trigger: "blur" },
|
||||
],
|
||||
cateId:[
|
||||
{ required: true, message: "视频类别不能为空", trigger: "blur" },
|
||||
],
|
||||
payLevel:[
|
||||
{ required: true, message: "视频权限不能为空", trigger: "blur" },
|
||||
]
|
||||
},
|
||||
callback: null,
|
||||
|
||||
classifyList: [],
|
||||
payVideoLevelList:[],
|
||||
uploadAuth:{
|
||||
|
||||
},
|
||||
@ -68,16 +117,33 @@
|
||||
pauseDisabled: true,
|
||||
uploader: null,
|
||||
statusText: '',
|
||||
fileType:['mp4'],
|
||||
fileType:['mp4','MP4'],
|
||||
uploading: false
|
||||
}
|
||||
},
|
||||
created(){
|
||||
getAllClassify().then(response => {
|
||||
if(response.code == 200){
|
||||
this.classifyList = response.data;
|
||||
}
|
||||
});
|
||||
this.getDicts("video_pay_level").then((response) => {
|
||||
this.payVideoLevelList = response.data;
|
||||
});
|
||||
|
||||
},
|
||||
components: {
|
||||
UploadFile
|
||||
},
|
||||
methods: {
|
||||
showDialog(callback){
|
||||
this.resetVideoFrom();
|
||||
this.open = true;
|
||||
this.callback = callback;
|
||||
},
|
||||
handleCoverUrl(url){
|
||||
this.videoFrom.coverUrl = url;
|
||||
},
|
||||
resetVideoFrom(){
|
||||
this.videoFrom = {
|
||||
cateId: null,
|
||||
@ -85,7 +151,13 @@
|
||||
title: null,
|
||||
description: null,
|
||||
tags: null,
|
||||
payLevel: 0,
|
||||
videoId: null,
|
||||
wxShow: false
|
||||
};
|
||||
if(this.$refs.uploadFile){
|
||||
this.$refs.uploadFile.resetUpload();
|
||||
}
|
||||
this.authProgress = 0;
|
||||
this.file = null;
|
||||
this.videoFileList = [];
|
||||
@ -112,55 +184,53 @@
|
||||
},
|
||||
|
||||
fileChange (e) {
|
||||
if(this.videoFrom.title == null || this.videoFrom.title.trim().length == 0){
|
||||
this.$message({
|
||||
message: "标题不能为空",
|
||||
type: "warning",
|
||||
});
|
||||
return;
|
||||
}
|
||||
if(this.uploading){
|
||||
this.$message({
|
||||
message: "文件正在上传,请勿取消",
|
||||
type: "warning",
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.file = e.target.files[0];
|
||||
var userData = '{"Vod":{}}'
|
||||
/**if (this.uploader) {
|
||||
this.uploader.stopUpload()
|
||||
this.authProgress = 0
|
||||
this.statusText = ""
|
||||
}**/
|
||||
this.videoFrom.fileName = this.file.name;
|
||||
if(this.videoFrom.fileName == null || this.videoFrom.fileName.length == 0 || this.videoFrom.fileName.lastIndexOf(".") == -1){
|
||||
this.$message({
|
||||
message: "当前文件名称错误",
|
||||
type: "warning",
|
||||
});
|
||||
return;
|
||||
}
|
||||
let fileType = this.videoFrom.fileName.substring(this.videoFrom.fileName.lastIndexOf(".")+1);
|
||||
if(this.fileType.indexOf(fileType) == -1){
|
||||
this.$message({
|
||||
message: "当前文件格式错误",
|
||||
type: "warning",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
getUploadVideoAuth(this.videoFrom).then(response => {
|
||||
if(response.code == 200){
|
||||
this.uploadAuth = response.uploadAuth;
|
||||
this.uploader = this.createUploader()
|
||||
this.uploader.addFile(this.file, null, null, null, userData)
|
||||
this.uploadDisabled = false
|
||||
this.pauseDisabled = true
|
||||
this.resumeDisabled = true
|
||||
}
|
||||
})
|
||||
this.$refs["videoFrom"].validate((valid) => {
|
||||
if (valid) {
|
||||
if(this.uploading){
|
||||
this.$message({
|
||||
message: "文件正在上传,请勿取消",
|
||||
type: "warning",
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.file = e.target.files[0];
|
||||
var userData = '{"Vod":{}}'
|
||||
/**if (this.uploader) {
|
||||
this.uploader.stopUpload()
|
||||
this.authProgress = 0
|
||||
this.statusText = ""
|
||||
}**/
|
||||
this.videoFrom.fileName = this.file.name;
|
||||
if(this.videoFrom.fileName == null || this.videoFrom.fileName.length == 0 || this.videoFrom.fileName.lastIndexOf(".") == -1){
|
||||
this.$message({
|
||||
message: "当前文件名称错误",
|
||||
type: "warning",
|
||||
});
|
||||
return;
|
||||
}
|
||||
let fileType = this.videoFrom.fileName.substring(this.videoFrom.fileName.lastIndexOf(".")+1);
|
||||
if(this.fileType.indexOf(fileType) == -1){
|
||||
this.$message({
|
||||
message: "当前文件格式错误",
|
||||
type: "warning",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
getUploadVideoAuth(this.videoFrom).then(response => {
|
||||
if(response.code == 200){
|
||||
this.uploadAuth = response.uploadAuth;
|
||||
console.log(this.uploadAuth);
|
||||
this.videoFrom.videoId = this.uploadAuth.videoId;
|
||||
this.uploader = this.createUploader()
|
||||
this.uploader.addFile(this.file, null, null, null, userData)
|
||||
this.uploadDisabled = false
|
||||
this.pauseDisabled = true
|
||||
this.resumeDisabled = true
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
authUpload () {
|
||||
// 然后调用 startUpload 方法, 开始上传
|
||||
@ -259,9 +329,15 @@
|
||||
onUploadEnd: function (uploadInfo) {
|
||||
self.statusText = '文件上传完毕'
|
||||
self.uploading = false;
|
||||
self.msgSuccess("上传成功");
|
||||
self.open = false;
|
||||
self.callback && self.callback();
|
||||
//self.msgSuccess("上传成功");
|
||||
self.videoFrom.showFlag = self.videoFrom.wxShow ? 1 : 0;
|
||||
addNutritionalVideo(self.videoFrom).then(response => {
|
||||
if (response.code === 200) {
|
||||
self.msgSuccess("视频上传成功");
|
||||
self.open = false;
|
||||
self.callback && self.callback();
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
return uploader
|
||||
|
@ -12,6 +12,7 @@
|
||||
v-model="queryParams.postId"
|
||||
placeholder="请选择岗位"
|
||||
clearable
|
||||
filterable
|
||||
size="small"
|
||||
@change="searchPostChange"
|
||||
>
|
||||
@ -28,6 +29,7 @@
|
||||
v-model="queryParams.userId"
|
||||
placeholder="请选择业务员"
|
||||
clearable
|
||||
filterable
|
||||
size="small"
|
||||
>
|
||||
<el-option
|
||||
@ -119,6 +121,7 @@
|
||||
{{ scope.row.rate + "%" }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="开始时间" align="center" prop="startTime"/>
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column
|
||||
label="操作"
|
||||
@ -196,6 +199,16 @@
|
||||
<el-input v-model="form.rate" placeholder="请输入比例" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="开始时间" prop="startTime">
|
||||
<el-date-picker
|
||||
v-model="form.startTime"
|
||||
value-format="yyyy-MM-dd"
|
||||
type="month"
|
||||
placeholder="选择开始时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input
|
||||
@ -240,7 +253,7 @@ export default {
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: false,
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 业务提成比例表格数据
|
||||
@ -282,6 +295,9 @@ export default {
|
||||
rate: [
|
||||
{ required: true, message: "分成比例不能为空", trigger: "blur" },
|
||||
],
|
||||
startTime: [
|
||||
{ required: true, message: "开始时间不能为空", trigger: "blur" },
|
||||
],
|
||||
},
|
||||
};
|
||||
},
|
||||
@ -396,6 +412,7 @@ export default {
|
||||
userName: null,
|
||||
amount: null,
|
||||
rate: null,
|
||||
startTime: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
|
@ -9,7 +9,7 @@
|
||||
size="small"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="展示状态" prop="showFlag">
|
||||
<el-form-item label="小程序展示状态" prop="showFlag" label-width="200">
|
||||
<el-select
|
||||
v-model="queryParams.showFlag"
|
||||
placeholder="请选择展示状态"
|
||||
|
@ -1,11 +1,50 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!--<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="关键词" prop="key">
|
||||
<el-input
|
||||
v-model="queryParams.key"
|
||||
placeholder="请输入关键词"
|
||||
clearable
|
||||
size="small"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="小程序展示状态" prop="showFlag" label-width="200">
|
||||
<el-select
|
||||
v-model="queryParams.showFlag"
|
||||
placeholder="请选示状态"
|
||||
clearable
|
||||
size="small"
|
||||
>
|
||||
<el-option key="0" label="不展示" value="0"/>
|
||||
<el-option key="1" label="展示" value="1"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="视频类别" prop="cateId">
|
||||
<el-select v-model="queryParams.cateId" clearable filterable placeholder="请选择类别">
|
||||
<el-option
|
||||
v-for="classify in classifyList"
|
||||
:key="classify.id"
|
||||
:label="classify.cateName"
|
||||
:value="classify.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="视频权限" prop="payLevel">
|
||||
<el-select v-model="queryParams.payLevel" clearable filterable placeholder="请选择权限">
|
||||
<el-option
|
||||
v-for="dict in payVideoLevelList"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="parseInt(dict.dictValue)"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>-->
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
@ -17,7 +56,7 @@
|
||||
v-hasPermi="['custom:nutritionalVideo:add']"
|
||||
>视频上传</el-button>
|
||||
</el-col>
|
||||
<!--<el-col :span="1.5">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
icon="el-icon-edit"
|
||||
@ -37,6 +76,7 @@
|
||||
v-hasPermi="['custom:nutritionalVideo:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<!--
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
@ -52,24 +92,32 @@
|
||||
<el-table v-loading="loading" :data="nutritionalVideoList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<!--<el-table-column label="视频分类ID" align="center" prop="cateId" />-->
|
||||
<el-table-column label="封面" align="center" prop="coverUrl">
|
||||
<el-table-column label="封面" align="center" prop="coverUrl" width="300">
|
||||
<template slot-scope="scope">
|
||||
<el-image title="点击大图预览"
|
||||
style="width: 200px; height: 200px"
|
||||
<el-image
|
||||
style="width: 300px; height: 200px"
|
||||
:src="scope.row.coverUrl"
|
||||
:preview-src-list="coverImageList">
|
||||
</el-image>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="标题" align="center" prop="title" />
|
||||
<el-table-column label="标题" align="center" prop="title" width="200"/>
|
||||
<el-table-column label="描述" align="center" prop="description" />
|
||||
<el-table-column label="标签" align="center" prop="tags" />
|
||||
<el-table-column label="显示状态" align="center" prop="showFlag">
|
||||
<template slot-scope="scope">
|
||||
{{scope.row.showFlag == 1 ? '正常' : '屏蔽'}}
|
||||
<!--<el-table-column label="标签" align="center" prop="tags" width="100"/>-->
|
||||
<el-table-column label="分类" align="center" prop="cateName" width="100"/>
|
||||
<el-table-column label="权限等级" align="center" prop="payLevelName" width="100"/>
|
||||
<el-table-column label="小程序展示状态" align="center" prop="showFlag" width="200">
|
||||
<template slot-scope="scope" >
|
||||
<el-switch
|
||||
v-model="scope.row.wxShow"
|
||||
active-text="展示"
|
||||
inactive-text="不展示"
|
||||
@change="handleWxShow($event, scope.row)"
|
||||
>
|
||||
</el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!--<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<el-table-column label="操作" align="center" width="200">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
@ -86,9 +134,11 @@
|
||||
v-hasPermi="['custom:nutritionalVideo:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>-->
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
@ -99,33 +149,61 @@
|
||||
/>
|
||||
|
||||
<!-- 添加或修改营养视频对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="视频分类ID" prop="cateId">
|
||||
<el-input v-model="form.cateId" placeholder="请输入视频分类ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="阿里云视频ID" prop="videoId">
|
||||
<el-input v-model="form.videoId" placeholder="请输入阿里云视频ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="视频封面URL" prop="coverUrl">
|
||||
<el-input v-model="form.coverUrl" placeholder="请输入视频封面URL" />
|
||||
</el-form-item>
|
||||
<el-form-item label="视频标题" prop="title">
|
||||
<el-input v-model="form.title" placeholder="请输入视频标题" />
|
||||
<el-input
|
||||
type="textarea"
|
||||
placeholder="请输入视频标题"
|
||||
v-model="form.title"
|
||||
maxlength="50"
|
||||
rows="1"
|
||||
show-word-limit
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="视频描述" prop="description">
|
||||
<el-input v-model="form.description" placeholder="请输入视频描述" />
|
||||
</el-form-item>
|
||||
<el-form-item label="视频大小,单位:字节" prop="videoSize">
|
||||
<el-input v-model="form.videoSize" placeholder="请输入视频大小,单位:字节" />
|
||||
</el-form-item>
|
||||
<el-form-item label="标签,使用 , 隔开" prop="tags">
|
||||
<el-input v-model="form.tags" placeholder="请输入标签,使用 , 隔开" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否显示,0不显示 1显示,默认0" prop="showFlag">
|
||||
<el-input v-model="form.showFlag" placeholder="请输入是否显示,0不显示 1显示,默认0" />
|
||||
<el-input
|
||||
type="textarea"
|
||||
placeholder="请输入视频描述"
|
||||
v-model="form.description"
|
||||
maxlength="1000"
|
||||
rows="2"
|
||||
show-word-limit
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="视频封面" prop="coverUrl">
|
||||
<UploadFile ref="uploadFile" :prefix="'videoCover'" :coverUrl="form.previewUrl" @callbackMethod="handleCoverUrl"></UploadFile>
|
||||
</el-form-item>
|
||||
<el-form-item label="视频类别" prop="cateId">
|
||||
<el-select v-model="form.cateId" clearable filterable placeholder="请选择类别">
|
||||
<el-option
|
||||
v-for="classify in classifyList"
|
||||
:key="classify.id"
|
||||
:label="classify.cateName"
|
||||
:value="classify.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="视频权限" prop="payLevel">
|
||||
<el-select v-model="form.payLevel" clearable filterable placeholder="请选择权限">
|
||||
<el-option
|
||||
v-for="dict in payVideoLevelList"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="parseInt(dict.dictValue)"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="展示状态" prop="wxShow">
|
||||
<el-switch
|
||||
v-model="form.wxShow"
|
||||
active-text="小程序展示"
|
||||
inactive-text="小程序不展示">
|
||||
</el-switch>
|
||||
<div>提示:请保证内容正确再展示到小程序</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
@ -137,9 +215,10 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listNutritionalVideo, getNutritionalVideo, delNutritionalVideo, addNutritionalVideo, updateNutritionalVideo, exportNutritionalVideo,getUploadVideoAuth } from "@/api/custom/nutritionalVideo";
|
||||
|
||||
import { listNutritionalVideo, getNutritionalVideo, delNutritionalVideo, addNutritionalVideo, updateNutritionalVideo, exportNutritionalVideo, updateWxShow } from "@/api/custom/nutritionalVideo";
|
||||
import {getAllClassify } from "@/api/custom/videoClassify";
|
||||
import UploadVideo from "@/components/UploadVideo";
|
||||
import UploadFile from "@/components/FileUpload/UploadFile";
|
||||
export default {
|
||||
name: "NutritionalVideo",
|
||||
data() {
|
||||
@ -166,29 +245,48 @@
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 5,
|
||||
key: null,
|
||||
showFlag: null,
|
||||
cateId: null,
|
||||
payLevel: null
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
},
|
||||
coverImageList:[]
|
||||
coverImageList:[],
|
||||
//分类列表
|
||||
classifyList:[],
|
||||
//权限等级列表
|
||||
payVideoLevelList:[]
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
getAllClassify().then(response => {
|
||||
if(response.code == 200){
|
||||
this.classifyList = response.data;
|
||||
}
|
||||
});
|
||||
this.getDicts("video_pay_level").then((response) => {
|
||||
this.payVideoLevelList = response.data;
|
||||
});
|
||||
},
|
||||
components: {
|
||||
UploadVideo
|
||||
UploadVideo,UploadFile
|
||||
},
|
||||
methods: {
|
||||
/** 查询营养视频列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listNutritionalVideo(this.queryParams).then(response => {
|
||||
response.rows.forEach(element => {
|
||||
element.wxShow = element.showFlag == 1 ? true : false;
|
||||
});
|
||||
this.nutritionalVideoList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
@ -201,18 +299,13 @@
|
||||
this.form = {
|
||||
id: null,
|
||||
cateId: null,
|
||||
videoId: null,
|
||||
coverUrl: null,
|
||||
title: null,
|
||||
description: null,
|
||||
videoSize: null,
|
||||
tags: null,
|
||||
payLevel:null,
|
||||
showFlag: null,
|
||||
createTime: null,
|
||||
createBy: null,
|
||||
updateTime: null,
|
||||
updateBy: null,
|
||||
delFlag: null
|
||||
wxShow: false
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
@ -248,15 +341,17 @@
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getNutritionalVideo(id).then(response => {
|
||||
response.data.wxShow = response.data.showFlag == 1 ? true : false;
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改营养视频";
|
||||
});
|
||||
this.open = true;
|
||||
this.title = "修改营养视频";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
this.form.showFlag = this.form.wxShow ? 1 : 0;
|
||||
if (this.form.id != null) {
|
||||
updateNutritionalVideo(this.form).then(response => {
|
||||
if (response.code === 200) {
|
||||
@ -277,6 +372,16 @@
|
||||
}
|
||||
});
|
||||
},
|
||||
handleWxShow(newWxshow, row){
|
||||
let param = {
|
||||
id: row.id,
|
||||
showFlag: newWxshow ? 1 : 0
|
||||
};
|
||||
updateWxShow(param);
|
||||
},
|
||||
handleCoverUrl(url){
|
||||
this.form.coverUrl = url;
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
|
Loading…
x
Reference in New Issue
Block a user