|
@@ -2,9 +2,15 @@ package org.jeecg.modules.ctop.controller;
|
|
|
|
|
|
import cn.com.ctop.common.module.annotation.AutoLog;
|
|
|
import cn.com.ctop.common.module.entity.MaterialAscription;
|
|
|
+import cn.com.ctop.common.module.entity.SysUser;
|
|
|
import cn.com.ctop.common.module.service.IMaterialAscriptionService;
|
|
|
+import cn.com.ctop.common.module.service.ISysUserService;
|
|
|
import cn.com.ctop.common.module.utils.Check;
|
|
|
import cn.com.ctop.common.module.utils.QueryGenerator;
|
|
|
+import cn.com.ctop.kuaishou.modules.material.entity.EtlKuaishouVideoInfo;
|
|
|
+import cn.com.ctop.kuaishou.modules.material.service.IEtlKuaishouVideoInfoService;
|
|
|
+import cn.com.ctop.toutiao.modules.link.entity.ETLReportBytedanceVideo;
|
|
|
+import cn.com.ctop.toutiao.modules.link.service.IETLReportBytedanceVideoService;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
@@ -114,13 +120,77 @@ public class MaterialAscriptionController {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ISysUserService sysUserService;
|
|
|
+ @Autowired
|
|
|
+ private IEtlKuaishouVideoInfoService etlKuaishouVideoInfoService;
|
|
|
+ @Autowired
|
|
|
+ private IETLReportBytedanceVideoService reportBytedanceVideoService;
|
|
|
+
|
|
|
@PutMapping(value = "/update")
|
|
|
public Result<MaterialAscription> update(@RequestBody MaterialAscription materialAscription) {
|
|
|
Result<MaterialAscription> result = new Result<>();
|
|
|
+ String shotName = "";
|
|
|
+ String shotId = materialAscription.getShotId();
|
|
|
+ if (!Check.isNull(shotId)) {
|
|
|
+ SysUser plan = sysUserService.getById(shotId);
|
|
|
+ if (!Check.isNull(plan)) {
|
|
|
+ shotName = plan.getRealname();
|
|
|
+ materialAscription.setShotName(shotName);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String planName = "";
|
|
|
+ String planId = materialAscription.getPlanId();
|
|
|
+ if (!Check.isNull(planId)) {
|
|
|
+ SysUser plan = sysUserService.getById(planId);
|
|
|
+ if (!Check.isNull(plan)) {
|
|
|
+ planName = plan.getRealname();
|
|
|
+ materialAscription.setPlanName(planName);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String clipName = "";
|
|
|
+ String clipId = materialAscription.getClipId();
|
|
|
+ if (!Check.isNull(clipId)) {
|
|
|
+ SysUser clip = sysUserService.getById(clipId);
|
|
|
+ if (!Check.isNull(clip)) {
|
|
|
+ clipName = clip.getRealname();
|
|
|
+ materialAscription.setClipName(clipName);
|
|
|
+ }
|
|
|
+ }
|
|
|
QueryWrapper<MaterialAscription> ascriptionQueryWrapper = new QueryWrapper<>();
|
|
|
ascriptionQueryWrapper.eq("material_id", materialAscription.getMaterialId());
|
|
|
ascriptionQueryWrapper.last("limit 1");
|
|
|
MaterialAscription one = materialAscriptionService.getOne(ascriptionQueryWrapper);
|
|
|
+ if (!Check.isNull(shotId) || !Check.isNull(planId) || !Check.isNull(clipId)) {
|
|
|
+ EtlKuaishouVideoInfo updateVideoInfo = new EtlKuaishouVideoInfo();
|
|
|
+ ETLReportBytedanceVideo updateByteDanceVideoInfo = new ETLReportBytedanceVideo();
|
|
|
+ if (!Check.isNull(clipId)) {
|
|
|
+ updateVideoInfo.setClipId(clipId);
|
|
|
+ updateVideoInfo.setClipName(clipName);
|
|
|
+ updateByteDanceVideoInfo.setClipId(clipId);
|
|
|
+ updateByteDanceVideoInfo.setClipName(clipName);
|
|
|
+ }
|
|
|
+ if (!Check.isNull(shotId)) {
|
|
|
+ updateVideoInfo.setShotId(shotId);
|
|
|
+ updateVideoInfo.setShotName(shotName);
|
|
|
+ updateByteDanceVideoInfo.setShotId(shotId);
|
|
|
+ updateByteDanceVideoInfo.setShotName(shotName);
|
|
|
+ }
|
|
|
+ if (!Check.isNull(planId)) {
|
|
|
+ updateVideoInfo.setPlanId(planId);
|
|
|
+ updateVideoInfo.setPlanName(planName);
|
|
|
+ updateByteDanceVideoInfo.setPlanId(planId);
|
|
|
+ updateByteDanceVideoInfo.setPlanName(planName);
|
|
|
+ }
|
|
|
+ QueryWrapper<EtlKuaishouVideoInfo> updateKuaiShouQueryWrapper = new QueryWrapper<>();
|
|
|
+ updateKuaiShouQueryWrapper.eq("video_code", materialAscription.getMaterialId());
|
|
|
+ etlKuaishouVideoInfoService.update(updateVideoInfo, updateKuaiShouQueryWrapper);
|
|
|
+ QueryWrapper<ETLReportBytedanceVideo> updateByteDanceQueryWrapper = new QueryWrapper<>();
|
|
|
+ updateByteDanceQueryWrapper.eq("md5", materialAscription.getMaterialId());
|
|
|
+ reportBytedanceVideoService.update(updateByteDanceVideoInfo, updateByteDanceQueryWrapper);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
boolean ok;
|
|
|
if (Check.isNull(one)) {
|
|
|
ok = materialAscriptionService.save(materialAscription);
|