|
@@ -1,8 +1,10 @@
|
|
package org.jeecg.modules.ctop.controller;
|
|
package org.jeecg.modules.ctop.controller;
|
|
|
|
|
|
|
|
|
|
|
|
+import cn.com.ctop.common.module.annotation.AutoLog;
|
|
import cn.com.ctop.common.module.constant.CtopRoleCodeConstant;
|
|
import cn.com.ctop.common.module.constant.CtopRoleCodeConstant;
|
|
import cn.com.ctop.common.module.entity.*;
|
|
import cn.com.ctop.common.module.entity.*;
|
|
|
|
+import cn.com.ctop.common.module.enums.MaterialSupplierEnum;
|
|
import cn.com.ctop.common.module.service.*;
|
|
import cn.com.ctop.common.module.service.*;
|
|
import cn.com.ctop.common.module.utils.Check;
|
|
import cn.com.ctop.common.module.utils.Check;
|
|
import cn.com.ctop.common.module.utils.JsonUtil;
|
|
import cn.com.ctop.common.module.utils.JsonUtil;
|
|
@@ -21,11 +23,9 @@ import io.swagger.annotations.ApiOperation;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.shiro.SecurityUtils;
|
|
import org.apache.shiro.SecurityUtils;
|
|
import org.jeecg.common.api.vo.Result;
|
|
import org.jeecg.common.api.vo.Result;
|
|
-import org.jeecg.common.aspect.annotation.AutoLog;
|
|
|
|
import org.jeecg.common.system.query.QueryGenerator;
|
|
import org.jeecg.common.system.query.QueryGenerator;
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
import org.jeecg.common.util.DateUtils;
|
|
import org.jeecg.common.util.DateUtils;
|
|
-import org.jeecg.modules.ctop.service.IKuaiShouUploadService;
|
|
|
|
import org.jeecg.modules.ctop.service.IProjectMemberService;
|
|
import org.jeecg.modules.ctop.service.IProjectMemberService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -67,7 +67,50 @@ public class MaterialInfoController {
|
|
@Autowired
|
|
@Autowired
|
|
private IVideoWatermarkTaskService watermarkTaskService;
|
|
private IVideoWatermarkTaskService watermarkTaskService;
|
|
@Autowired
|
|
@Autowired
|
|
- private IKuaiShouUploadService uploadService;
|
|
|
|
|
|
+ private IProjectMemberService memberService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private IMaterialImageInfoService iMaterialImageInfoService;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @GetMapping("/supplierWatermark")
|
|
|
|
+ public Result<String> supplierWatermark(String id) {
|
|
|
|
+ Result<String> result = new Result<>();
|
|
|
|
+ try {
|
|
|
|
+ if (Check.isNull(id)) {
|
|
|
|
+ throw new Exception("请选择素材");
|
|
|
|
+ }
|
|
|
|
+ MaterialInfo materialInfo = materialInfoService.getById(id);
|
|
|
|
+ if (Check.isNull(materialInfo)) {
|
|
|
|
+ throw new Exception("素材信息为空");
|
|
|
|
+ }
|
|
|
|
+ QueryWrapper<MaterialParameter> parameterQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ parameterQueryWrapper.eq("material_id", materialInfo.getCode());
|
|
|
|
+ parameterQueryWrapper.last("limit 1");
|
|
|
|
+ MaterialParameter parameter = materialParameterService.getOne(parameterQueryWrapper);
|
|
|
|
+ if (Check.isNull(parameter)) {
|
|
|
|
+ throw new Exception("素材基本信息为空");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Long templateId = MaterialSupplierEnum.getTemplateIdBySize(Integer.valueOf(parameter.getWidth()), Integer.valueOf(parameter.getHeight()));
|
|
|
|
+ String s = null;
|
|
|
|
+ if (!Check.isNull(templateId)) {
|
|
|
|
+ s = materialInfoService.watermarkVideoBySupplierCode(materialInfo.getCode(), materialInfo.getUrl(), templateId);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ if (Check.isNull(s)) {
|
|
|
|
+ result.setSuccess(false);
|
|
|
|
+ result.setMessage("水印生成失败");
|
|
|
|
+ } else {
|
|
|
|
+ result.setSuccess(true);
|
|
|
|
+ result.setResult(s);
|
|
|
|
+ }
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ result.setSuccess(false);
|
|
|
|
+ result.setMessage(e.getMessage());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
@PostMapping("/correlationUpload")
|
|
@PostMapping("/correlationUpload")
|
|
@@ -80,10 +123,10 @@ public class MaterialInfoController {
|
|
}
|
|
}
|
|
|
|
|
|
@PostMapping("/supplementFrameUrl")
|
|
@PostMapping("/supplementFrameUrl")
|
|
- public Result<Object> supplementFrameUrl(@RequestParam String videoMD5){
|
|
|
|
- Result<Object> result=new Result<>();
|
|
|
|
|
|
+ public Result<Object> supplementFrameUrl(@RequestParam String videoMD5) {
|
|
|
|
+ Result<Object> result = new Result<>();
|
|
boolean bool = materialCutFrameService.updateTencentCutFrame(videoMD5);
|
|
boolean bool = materialCutFrameService.updateTencentCutFrame(videoMD5);
|
|
- if(!bool){
|
|
|
|
|
|
+ if (!bool) {
|
|
result.setSuccess(false);
|
|
result.setSuccess(false);
|
|
result.error500("补全截帧url失败");
|
|
result.error500("补全截帧url失败");
|
|
return result;
|
|
return result;
|
|
@@ -126,18 +169,6 @@ public class MaterialInfoController {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- /**
|
|
|
|
- * 分页列表查询
|
|
|
|
- *
|
|
|
|
- * @param materialInfo
|
|
|
|
- * @param pageNo
|
|
|
|
- * @param pageSize
|
|
|
|
- * @param req
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
- @Autowired
|
|
|
|
- private IProjectMemberService memberService;
|
|
|
|
-
|
|
|
|
@GetMapping("/excellent/list")
|
|
@GetMapping("/excellent/list")
|
|
public Result<IPage<MaterialInfo>> excellentList(MaterialInfo materialInfo,
|
|
public Result<IPage<MaterialInfo>> excellentList(MaterialInfo materialInfo,
|
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
@@ -166,9 +197,6 @@ public class MaterialInfoController {
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
- @Autowired
|
|
|
|
- private IMaterialImageInfoService iMaterialImageInfoService;
|
|
|
|
-
|
|
|
|
@AutoLog(value = "素材信息-分页列表查询")
|
|
@AutoLog(value = "素材信息-分页列表查询")
|
|
@ApiOperation(value = "素材信息-分页列表查询", notes = "素材信息-分页列表查询")
|
|
@ApiOperation(value = "素材信息-分页列表查询", notes = "素材信息-分页列表查询")
|
|
@GetMapping(value = "/list")
|
|
@GetMapping(value = "/list")
|
|
@@ -177,6 +205,7 @@ public class MaterialInfoController {
|
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
|
HttpServletRequest req) {
|
|
HttpServletRequest req) {
|
|
|
|
|
|
|
|
+
|
|
Result<IPage<MaterialInfo>> result = new Result<>();
|
|
Result<IPage<MaterialInfo>> result = new Result<>();
|
|
String materialName = materialInfo.getMaterialName();
|
|
String materialName = materialInfo.getMaterialName();
|
|
materialInfo.setMaterialName(null);
|
|
materialInfo.setMaterialName(null);
|
|
@@ -285,6 +314,82 @@ public class MaterialInfoController {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+ @AutoLog(value = "素材信息-分页列表查询")
|
|
|
|
+ @ApiOperation(value = "素材信息-分页列表查询", notes = "素材信息-分页列表查询")
|
|
|
|
+ @GetMapping(value = "/supplierList")
|
|
|
|
+ public Result<IPage<MaterialInfo>> supplierList(MaterialInfo materialInfo,
|
|
|
|
+ @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
|
|
+ @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
|
|
|
+ HttpServletRequest req) {
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ Result<IPage<MaterialInfo>> result = new Result<>();
|
|
|
|
+ String materialName = materialInfo.getMaterialName();
|
|
|
|
+ materialInfo.setMaterialName(null);
|
|
|
|
+ QueryWrapper<MaterialInfo> queryWrapper = new QueryWrapper<>();
|
|
|
|
+ Object createTime = materialInfo.getCreateTime();
|
|
|
|
+ materialInfo.setCreateTime(null);
|
|
|
|
+ if (!Check.isNull(materialInfo.getUserId())) {
|
|
|
|
+ String roleCode = materialInfoService.getRoleCodeByUserId(materialInfo.getUserId());
|
|
|
|
+ if (CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode)) {
|
|
|
|
+ materialInfo.setUserId(null);
|
|
|
|
+ } else {
|
|
|
|
+ result.setResult(null);
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ queryWrapper = QueryGenerator.initQueryWrapper(materialInfo, req.getParameterMap());
|
|
|
|
+
|
|
|
|
+ if (!Check.isNull(createTime)) {
|
|
|
|
+ try {
|
|
|
|
+ String dateString = DateUtils.getDateString(String.valueOf(createTime));
|
|
|
|
+ Map<String, Object> map = DateUtils.getStartEndTime(dateString);
|
|
|
|
+ queryWrapper.ge("create_time", map.get("start"));
|
|
|
|
+ queryWrapper.lt("create_time", map.get("end"));
|
|
|
|
+ } catch (ParseException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ result.setResult(null);
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+ if (!Check.isNull(materialName)) {
|
|
|
|
+ queryWrapper.like("material_name", materialName);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ Page<MaterialInfo> page = new Page<>(pageNo, pageSize);
|
|
|
|
+ IPage<MaterialInfo> pageList = materialInfoService.page(page, queryWrapper);
|
|
|
|
+ List<MaterialInfo> materialInfoList = pageList.getRecords();
|
|
|
|
+ if (materialInfoList.size() != 0) {
|
|
|
|
+ for (MaterialInfo material : materialInfoList) {
|
|
|
|
+ Project project = projectService.getById(material.getProjectId());
|
|
|
|
+ if (!Check.isNull(project)) {
|
|
|
|
+ material.setMediaId(project.getMediaId());
|
|
|
|
+ material.setProjectName(project.getProjectName());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ QueryWrapper<MaterialImageInfo> imageInfoQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ imageInfoQueryWrapper.eq("video_id", material.getCode());
|
|
|
|
+ imageInfoQueryWrapper.eq("status", 0);
|
|
|
|
+ List<MaterialImageInfo> imageInfoList = iMaterialImageInfoService.list(imageInfoQueryWrapper);
|
|
|
|
+ if (Check.isNull(imageInfoList)) {
|
|
|
|
+ material.setWhetherUnaudited(false);
|
|
|
|
+ } else {
|
|
|
|
+ material.setWhetherUnaudited(true);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ result.setSuccess(true);
|
|
|
|
+ result.setResult(pageList);
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 添加
|
|
* 添加
|
|
*
|
|
*
|