|
@@ -1,8 +1,10 @@
|
|
|
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.entity.*;
|
|
|
+import cn.com.ctop.common.module.enums.MaterialSupplierEnum;
|
|
|
import cn.com.ctop.common.module.service.*;
|
|
|
import cn.com.ctop.common.module.utils.Check;
|
|
|
import cn.com.ctop.common.module.utils.JsonUtil;
|
|
@@ -21,15 +23,14 @@ import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.shiro.SecurityUtils;
|
|
|
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.vo.LoginUser;
|
|
|
import org.jeecg.common.util.DateUtils;
|
|
|
-import org.jeecg.modules.ctop.service.IKuaiShouUploadService;
|
|
|
import org.jeecg.modules.ctop.service.IProjectMemberService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.text.ParseException;
|
|
|
import java.util.Arrays;
|
|
@@ -51,6 +52,8 @@ import java.util.Map;
|
|
|
public class MaterialInfoController {
|
|
|
@Autowired
|
|
|
private IMaterialInfoService materialInfoService;
|
|
|
+ @Resource
|
|
|
+ private IMaterialCutFrameService materialCutFrameService;
|
|
|
@Autowired
|
|
|
private IMaterialAscriptionService materialAscriptionService;
|
|
|
@Autowired
|
|
@@ -64,7 +67,50 @@ public class MaterialInfoController {
|
|
|
@Autowired
|
|
|
private IVideoWatermarkTaskService watermarkTaskService;
|
|
|
@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")
|
|
@@ -76,6 +122,18 @@ public class MaterialInfoController {
|
|
|
return materialInfoService.correlationUpload(json);
|
|
|
}
|
|
|
|
|
|
+ @PostMapping("/supplementFrameUrl")
|
|
|
+ public Result<Object> supplementFrameUrl(@RequestParam String videoMD5) {
|
|
|
+ Result<Object> result = new Result<>();
|
|
|
+ boolean bool = materialCutFrameService.updateTencentCutFrame(videoMD5);
|
|
|
+ if (!bool) {
|
|
|
+ result.setSuccess(false);
|
|
|
+ result.error500("补全截帧url失败");
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ result.setSuccess(true);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
|
|
|
@GetMapping(value = "/report")
|
|
|
public JSONObject report(String userId) {
|
|
@@ -111,18 +169,6 @@ public class MaterialInfoController {
|
|
|
}
|
|
|
|
|
|
|
|
|
- /**
|
|
|
- * 分页列表查询
|
|
|
- *
|
|
|
- * @param materialInfo
|
|
|
- * @param pageNo
|
|
|
- * @param pageSize
|
|
|
- * @param req
|
|
|
- * @return
|
|
|
- */
|
|
|
- @Autowired
|
|
|
- private IProjectMemberService memberService;
|
|
|
-
|
|
|
@GetMapping("/excellent/list")
|
|
|
public Result<IPage<MaterialInfo>> excellentList(MaterialInfo materialInfo,
|
|
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
@@ -151,9 +197,6 @@ public class MaterialInfoController {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- @Autowired
|
|
|
- private IMaterialImageInfoService iMaterialImageInfoService;
|
|
|
-
|
|
|
@AutoLog(value = "素材信息-分页列表查询")
|
|
|
@ApiOperation(value = "素材信息-分页列表查询", notes = "素材信息-分页列表查询")
|
|
|
@GetMapping(value = "/list")
|
|
@@ -162,7 +205,10 @@ public class MaterialInfoController {
|
|
|
@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);
|
|
@@ -199,6 +245,10 @@ public class MaterialInfoController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ 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();
|
|
@@ -264,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;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 添加
|
|
|
*
|
|
@@ -334,74 +460,72 @@ public class MaterialInfoController {
|
|
|
Result<MaterialInfo> result = new Result<>();
|
|
|
MaterialInfo materialInfoEntity = materialInfoService.getById(materialInfo.getId());
|
|
|
if (materialInfoEntity == null) {
|
|
|
- result.error500("未找到对应实体");
|
|
|
- } else {
|
|
|
- String url = materialInfo.getUrl();
|
|
|
- if (!Check.isNull(url)) {
|
|
|
- if (!url.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
|
|
|
- url = KuaishouInterfaceConstant.HTTPS_PREFIX + url;
|
|
|
- }
|
|
|
- materialInfo.setUrl(url);
|
|
|
+ return result.error500("未找到对应实体");
|
|
|
+ }
|
|
|
+ String url = materialInfo.getUrl();
|
|
|
+ if (!Check.isNull(url)) {
|
|
|
+ if (!url.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
|
|
|
+ url = KuaishouInterfaceConstant.HTTPS_PREFIX + url;
|
|
|
}
|
|
|
+ materialInfo.setUrl(url);
|
|
|
+ }
|
|
|
|
|
|
- // 修改素材库 相关联code
|
|
|
- if (!Check.isNull(materialInfo.getCode())) {
|
|
|
- String code = materialInfoEntity.getCode();
|
|
|
- if (!Check.isNull(code)) {
|
|
|
- MaterialTag updateMaterialTag = new MaterialTag();
|
|
|
- updateMaterialTag.setMaterialId(materialInfo.getCode());
|
|
|
- QueryWrapper<MaterialTag> tagQueryWrapper = new QueryWrapper<>();
|
|
|
- tagQueryWrapper.eq("material_id", code);
|
|
|
- materialTagService.update(updateMaterialTag, tagQueryWrapper);
|
|
|
- MaterialParameter updateParameter = new MaterialParameter();
|
|
|
- updateParameter.setMaterialId(materialInfo.getCode());
|
|
|
- QueryWrapper<MaterialParameter> parameterQueryWrapper = new QueryWrapper<>();
|
|
|
- parameterQueryWrapper.eq("material_id", code);
|
|
|
- materialParameterService.update(updateParameter, parameterQueryWrapper);
|
|
|
- MaterialAscription updateMaterialAscription = new MaterialAscription();
|
|
|
- updateMaterialAscription.setMaterialId(materialInfo.getCode());
|
|
|
- QueryWrapper<MaterialAscription> ascriptionQueryWrapper = new QueryWrapper<>();
|
|
|
- ascriptionQueryWrapper.eq("material_id", code);
|
|
|
- materialAscriptionService.update(updateMaterialAscription, ascriptionQueryWrapper);
|
|
|
- }
|
|
|
+ // 修改素材库 相关联code
|
|
|
+ if (!Check.isNull(materialInfo.getCode())) {
|
|
|
+ String code = materialInfoEntity.getCode();
|
|
|
+ if (!Check.isNull(code)) {
|
|
|
+ MaterialTag updateMaterialTag = new MaterialTag();
|
|
|
+ updateMaterialTag.setMaterialId(materialInfo.getCode());
|
|
|
+ QueryWrapper<MaterialTag> tagQueryWrapper = new QueryWrapper<>();
|
|
|
+ tagQueryWrapper.eq("material_id", code);
|
|
|
+ materialTagService.update(updateMaterialTag, tagQueryWrapper);
|
|
|
+ MaterialParameter updateParameter = new MaterialParameter();
|
|
|
+ updateParameter.setMaterialId(materialInfo.getCode());
|
|
|
+ QueryWrapper<MaterialParameter> parameterQueryWrapper = new QueryWrapper<>();
|
|
|
+ parameterQueryWrapper.eq("material_id", code);
|
|
|
+ materialParameterService.update(updateParameter, parameterQueryWrapper);
|
|
|
+ MaterialAscription updateMaterialAscription = new MaterialAscription();
|
|
|
+ updateMaterialAscription.setMaterialId(materialInfo.getCode());
|
|
|
+ QueryWrapper<MaterialAscription> ascriptionQueryWrapper = new QueryWrapper<>();
|
|
|
+ ascriptionQueryWrapper.eq("material_id", code);
|
|
|
+ materialAscriptionService.update(updateMaterialAscription, ascriptionQueryWrapper);
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- // 审核通过自动同步到到媒体后台
|
|
|
- /* Long projectId = materialInfoEntity.getProjectId();
|
|
|
- Project project = projectService.getById(projectId);
|
|
|
- if (!Check.isNull(projectId)) {
|
|
|
- if ("2".equals(project.getMediaId())) {
|
|
|
- if (!Check.isNull(materialInfo.getStatus())) {
|
|
|
- Integer status = materialInfo.getStatus();
|
|
|
- if (status == 1) {
|
|
|
- Thread thread = new Thread() {
|
|
|
- @Override
|
|
|
- public void run() {
|
|
|
- log.info("开始自动同步素材,code:{}", materialInfoEntity.getCode());
|
|
|
- uploadService.upload(materialInfoEntity);
|
|
|
- }
|
|
|
- };
|
|
|
- thread.start();
|
|
|
- }
|
|
|
+ // 审核通过自动同步到到媒体后台
|
|
|
+ /* Long projectId = materialInfoEntity.getProjectId();
|
|
|
+ Project project = projectService.getById(projectId);
|
|
|
+ if (!Check.isNull(projectId)) {
|
|
|
+ if ("2".equals(project.getMediaId())) {
|
|
|
+ if (!Check.isNull(materialInfo.getStatus())) {
|
|
|
+ Integer status = materialInfo.getStatus();
|
|
|
+ if (status == 1) {
|
|
|
+ Thread thread = new Thread() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ log.info("开始自动同步素材,code:{}", materialInfoEntity.getCode());
|
|
|
+ uploadService.upload(materialInfoEntity);
|
|
|
+ }
|
|
|
+ };
|
|
|
+ thread.start();
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- }*/
|
|
|
-
|
|
|
- boolean ok = materialInfoService.updateById(materialInfo);
|
|
|
- if (ok) {
|
|
|
- result.success("修改成功!");
|
|
|
}
|
|
|
|
|
|
- Integer status = materialInfo.getStatus();
|
|
|
- // 如果状态为2 审核拒绝 给上传人发送消息
|
|
|
- if (status == 2) {
|
|
|
- Project project = projectService.getById(materialInfoEntity.getProjectId());
|
|
|
- String text = messageTemplate.getMaterialRejectTemplate(project.getProjectName(), materialInfoEntity.getMaterialName(), materialInfo.getRefuseReason());
|
|
|
- sendMessageService.sendMessage(materialInfoEntity.getUserId(), text);
|
|
|
- }
|
|
|
+ }*/
|
|
|
+
|
|
|
+ boolean ok = materialInfoService.updateById(materialInfo);
|
|
|
+ if (ok) {
|
|
|
+ result.success("修改成功!");
|
|
|
}
|
|
|
|
|
|
+ Integer status = materialInfo.getStatus();
|
|
|
+ // 如果状态为2 审核拒绝 给上传人发送消息
|
|
|
+ if (status == 2) {
|
|
|
+ Project project = projectService.getById(materialInfoEntity.getProjectId());
|
|
|
+ String text = messageTemplate.getMaterialRejectTemplate(project.getProjectName(), materialInfoEntity.getMaterialName(), materialInfo.getRefuseReason());
|
|
|
+ sendMessageService.sendMessage(materialInfoEntity.getUserId(), text);
|
|
|
+ }
|
|
|
return result;
|
|
|
|
|
|
}
|