Преглед изворни кода

Merge remote-tracking branch 'origin/test' into test

songyh пре 4 година
родитељ
комит
9423f03c65

+ 21 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java

@@ -20,6 +20,7 @@ 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.constant.CommonConstant;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.DateUtils;
 import org.jeecg.modules.ctop.service.IProjectMemberService;
@@ -540,6 +541,26 @@ public class MaterialInfoController {
         return result;
 
     }
+
+    /**
+     * 头条素材信息编辑 -- 批量通过审核
+     * @param materialInfo
+     * @return
+     */
+    @PutMapping(value = "/bytedance/batchedit")
+    public Result<MaterialInfo> bytedanceBatchEdit(@RequestBody MaterialInfo materialInfo) {
+        Result<MaterialInfo> result = new Result<>();
+        String[] ids = materialInfo.getIds();
+        int successNum = 0;
+        for (String id : ids) {
+            materialInfo.setId(id);
+            Result<MaterialInfo> materialInfoResult = bytedanceEdit(materialInfo);
+            if(materialInfoResult.getCode().equals(CommonConstant.SC_OK_200)){ successNum++;}
+        }
+        return result.success("批量修改成功"+successNum+"个");
+
+    }
+
     /**
      * 通过id删除
      *

+ 5 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialInfo.java

@@ -38,6 +38,11 @@ public class MaterialInfo {
     @ApiModelProperty(value = "id")
     private String id;
     /**
+     * 存放id的数组
+     */
+    @TableField(exist = false)
+    private String[] ids;
+    /**
      * code
      */
     @Excel(name = "code", width = 15)

+ 34 - 0
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceVideoETLReportReloadJob.java

@@ -0,0 +1,34 @@
+package cn.com.ctop.job.bytedance.handler;
+
+import cn.com.ctop.toutiao.modules.link.entity.ETLReportBytedanceVideo;
+import cn.com.ctop.toutiao.modules.material.service.IEtlBytedanceVideoInfoService;
+import com.xxl.job.core.context.XxlJobHelper;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+/**
+ * 头条视频报表etl剪辑员信息二次再刷新
+ * @author 黄学超
+ */
+public class BytedanceVideoETLReportReloadJob {
+    static ExecutorService executorService = Executors.newFixedThreadPool(5);
+    @Autowired
+    private IEtlBytedanceVideoInfoService iEtlBytedanceVideoInfoService;
+
+    @XxlJob("bytedanceETLReportData")
+    public void execute() throws Exception {
+        //查询素材归属表所有的信息md5,clip_id,clip_name,shot_id,shot_name,plan_id,plan_name
+        List<ETLReportBytedanceVideo> etlReportBytedanceVideoList = iEtlBytedanceVideoInfoService.selectAllETLReportBytedanceVideo();
+        if (null == etlReportBytedanceVideoList || etlReportBytedanceVideoList.isEmpty()) {
+            XxlJobHelper.log("定时获取头条报表数据异常:未获取到素材归属信息");
+            XxlJobHelper.handleFail();
+            return ;
+        }
+        //动态sql更新md5,clip_id,clip_name,shot_id,shot_name,plan_id,plan_name不为空的数据
+        etlReportBytedanceVideoList.forEach(etlReportBytedanceVideo -> executorService.submit(() -> iEtlBytedanceVideoInfoService.updateETLReportNameIsNull(etlReportBytedanceVideo)));
+    }
+}

+ 5 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/IEtlBytedanceVideoInfoService.java

@@ -1,8 +1,11 @@
 package cn.com.ctop.toutiao.modules.material.service;
 
+import cn.com.ctop.toutiao.modules.link.entity.ETLReportBytedanceVideo;
 import cn.com.ctop.toutiao.modules.material.entity.EtlBytedanceVideoInfo;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.List;
+
 /**
  * @Description: 头条视频报表信息
  * @Author: jeecg-boot
@@ -10,5 +13,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
  * @Version: V1.0
  */
 public interface IEtlBytedanceVideoInfoService extends IService<EtlBytedanceVideoInfo> {
+    List<ETLReportBytedanceVideo> selectAllETLReportBytedanceVideo();
 
+    void updateETLReportNameIsNull(ETLReportBytedanceVideo etlReportBytedanceVideo);
 }

+ 17 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/EtlBytedanceVideoInfoServiceImpl.java

@@ -1,11 +1,16 @@
 package cn.com.ctop.toutiao.modules.material.service.impl;
 
+import cn.com.ctop.toutiao.modules.link.entity.ETLReportBytedanceVideo;
 import cn.com.ctop.toutiao.modules.material.entity.EtlBytedanceVideoInfo;
 import cn.com.ctop.toutiao.modules.material.mapper.EtlBytedanceVideoInfoMapper;
 import cn.com.ctop.toutiao.modules.material.service.IEtlBytedanceVideoInfoService;
+import cn.com.ctop.toutiao.modules.report.mapper.EtlBytedanceReportVideoDailyMapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * 头条视频报表信息
  * @author jeecg-boot
@@ -15,4 +20,16 @@ import org.springframework.stereotype.Service;
 @Service
 public class EtlBytedanceVideoInfoServiceImpl extends ServiceImpl<EtlBytedanceVideoInfoMapper, EtlBytedanceVideoInfo> implements IEtlBytedanceVideoInfoService {
 
+    @Autowired
+    EtlBytedanceReportVideoDailyMapper etlBytedanceReportVideoDailyMapper;
+
+    @Override
+    public List<ETLReportBytedanceVideo> selectAllETLReportBytedanceVideo(){
+        List<ETLReportBytedanceVideo> etlReportBytedanceVideoList = etlBytedanceReportVideoDailyMapper.getCtopMaterialAscriptionInfo();
+        return etlReportBytedanceVideoList;
+    }
+    @Override
+    public void updateETLReportNameIsNull(ETLReportBytedanceVideo etlReportBytedanceVideo){
+        etlBytedanceReportVideoDailyMapper.updateOneBytedanceVideoInfo(etlReportBytedanceVideo);
+    }
 }

+ 4 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/EtlBytedanceReportVideoDailyMapper.java

@@ -25,4 +25,8 @@ public interface EtlBytedanceReportVideoDailyMapper extends BaseMapper<EtlByteda
     List<ETLReportBytedanceVideo> etlBytedanceVideoInfo(@Param(value = "date") String date);
 
     void replaceEtlVideoInfo(@Param(value = "videoInfo") ETLReportBytedanceVideo videoInfo);
+
+    List<ETLReportBytedanceVideo> getCtopMaterialAscriptionInfo();
+
+    void updateOneBytedanceVideoInfo(@Param(value = "etlReportBytedanceVideo") ETLReportBytedanceVideo etlReportBytedanceVideo);
 }

+ 34 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/EtlBytedanceReportVideoDailyMapper.xml

@@ -2,6 +2,40 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.com.ctop.toutiao.modules.report.mapper.EtlBytedanceReportVideoDailyMapper">
 
+    <select id="getCtopMaterialAscriptionInfo" resultType="cn.com.ctop.toutiao.modules.link.entity.ETLReportBytedanceVideo">
+        SELECT DISTINCT
+            md5,
+            cma.clip_id,
+            cma.clip_name,
+            cma.shot_id,
+            cma.shot_name,
+            cma.plan_id,
+            cma.plan_name
+        FROM
+            etl_report_bytedance_video video
+        LEFT JOIN ctop_material_ascription cma ON cma. CODE = video.md5
+        where
+		cma.clip_id is not null or
+		cma.clip_name is not null or
+		cma.shot_id is not null or
+		cma.shot_name is not null or
+		cma.plan_id is not null or
+		cma.plan_name is not null;
+    </select>
+
+    <update id="updateOneBytedanceVideoInfo"  parameterType="cn.com.ctop.toutiao.modules.link.entity.ETLReportBytedanceVideo">
+        UPDATE etl_report_bytedance_video
+        <trim prefix="set" suffixOverrides=",">
+            <if test="etlReportBytedanceVideo.clipId!=null">clip_id=#{etlReportBytedanceVideo.clipId},</if>
+            <if test="etlReportBytedanceVideo.clipName!=null">clip_name=#{etlReportBytedanceVideo.clipName},</if>
+            <if test="etlReportBytedanceVideo.shotId!=null">shot_id=#{etlReportBytedanceVideo.shotId},</if>
+            <if test="etlReportBytedanceVideo.shotName!=null">shot_name=#{etlReportBytedanceVideo.shotName},</if>
+            <if test="etlReportBytedanceVideo.planId!=null">plan_id=#{etlReportBytedanceVideo.planId},</if>
+            <if test="etlReportBytedanceVideo.planName!=null">plan_name=#{etlReportBytedanceVideo.planName},</if>
+        </trim>
+        WHERE md5=#{etlReportBytedanceVideo.md5}
+    </update>
+
 
     <select id="getBytedanceVideoInfo" resultType="java.util.Map">
         SELECT