|
@@ -6,7 +6,10 @@ 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.*;
|
|
|
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouReportDailyMaterialService;
|
|
|
+
|
|
|
+import cn.com.ctop.toutiao.modules.material.entity.BytedanceVideoSlogenInfo;
|
|
|
+import cn.com.ctop.toutiao.modules.material.service.IBytedanceVideoSlogenInfoService;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
@@ -61,7 +64,15 @@ public class MaterialInfoController {
|
|
|
@Autowired
|
|
|
private IMaterialImageInfoService iMaterialImageInfoService;
|
|
|
@Autowired
|
|
|
- private IKuaiShouReportDailyMaterialService kuaiShouReportDailyMaterialService;
|
|
|
+ private IProjectService projectService;
|
|
|
+ @Autowired
|
|
|
+ private IMessageTemplate messageTemplate;
|
|
|
+ @Autowired
|
|
|
+ private ISysRoleService roleService;
|
|
|
+ @Autowired
|
|
|
+ private ISendMessageService sendMessageService;
|
|
|
+ @Autowired
|
|
|
+ private IBytedanceVideoSlogenInfoService slogenInfoService;
|
|
|
|
|
|
|
|
|
@GetMapping("/supplierWatermark")
|
|
@@ -104,12 +115,9 @@ public class MaterialInfoController {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
@PostMapping("/correlationUpload")
|
|
|
public Map<String, Object> insertFile(@RequestBody JSONObject json) {
|
|
|
- LoginUser user = (LoginUser) SecurityUtils.getSubject()
|
|
|
- .getPrincipal();
|
|
|
-
|
|
|
+ LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
json.put("userId", user.getId());
|
|
|
return materialInfoService.correlationUpload(json);
|
|
|
}
|
|
@@ -132,11 +140,9 @@ public class MaterialInfoController {
|
|
|
return materialInfoService.report(userId);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
@GetMapping(value = "/getDetail")
|
|
|
public JSONObject getDetail(String materialId) {
|
|
|
return materialInfoService.getDetail(materialId);
|
|
|
-
|
|
|
}
|
|
|
|
|
|
@PostMapping("watermark")
|
|
@@ -160,7 +166,6 @@ public class MaterialInfoController {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
@GetMapping("/excellent/list")
|
|
|
public Result<IPage<MaterialInfo>> excellentList(MaterialInfo materialInfo,
|
|
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
@@ -189,23 +194,18 @@ public class MaterialInfoController {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- @Autowired
|
|
|
- private ISysRoleService roleService;
|
|
|
-
|
|
|
+ @Deprecated
|
|
|
@GetMapping(value = "/list")
|
|
|
public Result<IPage<MaterialInfo>> queryPageList(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();
|
|
|
String startDate = materialInfo.getStartDate();
|
|
|
String endDate = materialInfo.getEndDate();
|
|
|
materialInfo.setStartDate(null);
|
|
|
materialInfo.setEndDate(null);
|
|
|
-
|
|
|
-
|
|
|
materialInfo.setMaterialName(null);
|
|
|
QueryWrapper<MaterialInfo> queryWrapper = new QueryWrapper<>();
|
|
|
materialInfo.setCreateTime(null);
|
|
@@ -272,7 +272,6 @@ public class MaterialInfoController {
|
|
|
material.setByteDance(JSONObject.parseObject(byteDanceString));
|
|
|
}
|
|
|
|
|
|
-
|
|
|
Project project = projectService.getById(material.getProjectId());
|
|
|
if (!Check.isNull(project)) {
|
|
|
material.setMediaId(project.getMediaId());
|
|
@@ -283,17 +282,9 @@ public class MaterialInfoController {
|
|
|
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);
|
|
|
- }
|
|
|
-
|
|
|
+ material.setWhetherUnaudited(!Check.isNull(imageInfoList));
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
result.setSuccess(true);
|
|
|
result.setResult(pageList);
|
|
|
return result;
|
|
@@ -337,7 +328,6 @@ public class MaterialInfoController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
@AutoLog(value = "素材信息-分页列表查询")
|
|
|
@ApiOperation(value = "素材信息-分页列表查询", notes = "素材信息-分页列表查询")
|
|
|
@GetMapping(value = "/supplierList")
|
|
@@ -345,8 +335,6 @@ public class MaterialInfoController {
|
|
|
@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);
|
|
@@ -356,7 +344,6 @@ public class MaterialInfoController {
|
|
|
materialInfo.setEndDate(null);
|
|
|
|
|
|
QueryWrapper<MaterialInfo> queryWrapper = new QueryWrapper<>();
|
|
|
-
|
|
|
if (!Check.isNull(materialInfo.getUserId())) {
|
|
|
String roleCode = roleService.getRoleCodeByUserId(materialInfo.getUserId());
|
|
|
if (CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode)) {
|
|
@@ -408,7 +395,6 @@ public class MaterialInfoController {
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
}
|
|
|
|
|
|
result.setSuccess(true);
|
|
@@ -468,22 +454,12 @@ public class MaterialInfoController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 编辑
|
|
|
- *
|
|
|
+ * 头条素材信息编辑
|
|
|
* @param materialInfo
|
|
|
* @return
|
|
|
*/
|
|
|
- @Autowired
|
|
|
- private IProjectService projectService;
|
|
|
- @Autowired
|
|
|
- private IMessageTemplate messageTemplate;
|
|
|
- @Autowired
|
|
|
- private ISendMessageService sendMessageService;
|
|
|
-
|
|
|
- @AutoLog(value = "素材信息-编辑")
|
|
|
- @ApiOperation(value = "素材信息-编辑", notes = "素材信息-编辑")
|
|
|
- @PutMapping(value = "/edit")
|
|
|
- public Result<MaterialInfo> edit(@RequestBody MaterialInfo materialInfo) {
|
|
|
+ @PutMapping(value = "/bytedance/edit")
|
|
|
+ public Result<MaterialInfo> bytedanceEdit(@RequestBody MaterialInfo materialInfo) {
|
|
|
Result<MaterialInfo> result = new Result<>();
|
|
|
MaterialInfo materialInfoEntity = materialInfoService.getById(materialInfo.getId());
|
|
|
if (materialInfoEntity == null) {
|
|
@@ -517,7 +493,6 @@ public class MaterialInfoController {
|
|
|
} else {
|
|
|
materialInfo.setCoverUrl(cutFrame.getUrl());
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
// 修改素材库 相关联code
|
|
@@ -541,29 +516,14 @@ public class MaterialInfoController {
|
|
|
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();
|
|
|
- }
|
|
|
- }
|
|
|
+ //添加视频文案信息
|
|
|
+ if(!Check.isNull(materialInfo.getSlogans())){
|
|
|
+ JSONArray slogans = materialInfo.getSlogans();
|
|
|
+ if(null!=slogans&&!slogans.isEmpty()){
|
|
|
+ LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
+ slogenInfoService.insertSlogans(materialInfoEntity.getCode(),slogans,user.getId());
|
|
|
}
|
|
|
-
|
|
|
- }*/
|
|
|
-
|
|
|
+ }
|
|
|
boolean ok = materialInfoService.updateById(materialInfo);
|
|
|
if (ok) {
|
|
|
result.success("修改成功!");
|
|
@@ -579,8 +539,6 @@ public class MaterialInfoController {
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* 通过id删除
|
|
|
*
|
|
@@ -640,12 +598,19 @@ public class MaterialInfoController {
|
|
|
@AutoLog(value = "素材信息-通过id查询")
|
|
|
@ApiOperation(value = "素材信息-通过id查询", notes = "素材信息-通过id查询")
|
|
|
@GetMapping(value = "/queryById")
|
|
|
- public Result<MaterialInfo> queryById(@RequestParam(name = "id", required = true) String id) {
|
|
|
+ public Result<MaterialInfo> queryById(@RequestParam(name = "id") String id) {
|
|
|
Result<MaterialInfo> result = new Result<>();
|
|
|
MaterialInfo materialInfo = materialInfoService.getById(id);
|
|
|
if (materialInfo == null) {
|
|
|
result.error500("未找到对应实体");
|
|
|
} else {
|
|
|
+ //查询素材下关联的头条文案信息
|
|
|
+ List<BytedanceVideoSlogenInfo>slogenInfos = slogenInfoService.listByParams(materialInfo.getCode(),1);
|
|
|
+ JSONArray slogenArray = new JSONArray();
|
|
|
+ if(null!=slogenInfos&&!slogenInfos.isEmpty()){
|
|
|
+ slogenArray.addAll(slogenInfos);
|
|
|
+ }
|
|
|
+ materialInfo.setSlogans(slogenArray);
|
|
|
result.setResult(materialInfo);
|
|
|
result.setSuccess(true);
|
|
|
}
|
|
@@ -696,6 +661,105 @@ public class MaterialInfoController {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ @AutoLog(value = "素材信息-编辑")
|
|
|
+ @ApiOperation(value = "素材信息-编辑", notes = "素材信息-编辑")
|
|
|
+ @PutMapping(value = "/edit")
|
|
|
+ public Result<MaterialInfo> edit(@RequestBody MaterialInfo materialInfo) {
|
|
|
+ Result<MaterialInfo> result = new Result<>();
|
|
|
+ MaterialInfo materialInfoEntity = materialInfoService.getById(materialInfo.getId());
|
|
|
+ if (materialInfoEntity == null) {
|
|
|
+ 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);
|
|
|
+ materialInfo.setCreateTime(new Date());
|
|
|
+ MaterialCutFrame cutFrame = materialCutFrameService.getCutFrameByCode(materialInfo.getCode());
|
|
|
+ if (Check.isNull(cutFrame)) {
|
|
|
+ String videoUrl = URLDecoder.decode(url).replace("https://media-1301855440.cos.ap-chongqing.myqcloud.com/", "");
|
|
|
+ String loadImage = "cutFrame/" + materialInfo.getCode() + "/zero.jpg";
|
|
|
+ String coverUrl = CloudVideoProcessUtil.videoCutPictureHandle(videoUrl, loadImage);
|
|
|
+ materialInfo.setCoverUrl(coverUrl);
|
|
|
+ Thread thread = new Thread() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ try {
|
|
|
+ log.info("开始抽帧,code:{}", materialInfo.getCode());
|
|
|
+ materialCutFrameService.getTencentCutFrame(videoUrl, materialInfo.getCode(), coverUrl);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+ thread.start();
|
|
|
+ } else {
|
|
|
+ materialInfo.setCoverUrl(cutFrame.getUrl());
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ // 修改素材库 相关联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();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }*/
|
|
|
+
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* adlab 新加查询素材库接口
|
|
|
*/
|