Prechádzať zdrojové kódy

Merge branch 'master' into jiaoyang

yumeng 4 rokov pred
rodič
commit
7cf052dcb9
16 zmenil súbory, kde vykonal 274 pridanie a 41 odobranie
  1. 1 1
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/FileInfoServiceImpl.java
  2. 8 4
      module-common/src/main/java/cn/com/ctop/common/module/utils/KuaishouInterfaceConstant.java
  3. 18 0
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceAiCreateJob.java
  4. 11 0
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceEtlVideoJob.java
  5. 7 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/AiKuaishouCreateCreativeController.java
  6. 1 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouAdvertiserStrategy.java
  7. 56 29
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouCreateCreativeServiceImpl.java
  8. 35 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java
  9. 1 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaishouInterfaceService.java
  10. 7 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/BatchServiceImpl.java
  11. 31 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  12. 10 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/EtlBytedanceReportVideoDailyMapper.java
  13. 3 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceVideoReportMapper.xml
  14. 34 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/EtlBytedanceReportVideoDailyMapper.xml
  15. 5 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/IEtlBytedanceReportVideoDailyService.java
  16. 46 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/EtlBytedanceReportVideoDailyServiceImpl.java

+ 1 - 1
module-common/src/main/java/cn/com/ctop/common/module/service/impl/FileInfoServiceImpl.java

@@ -51,7 +51,7 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> i
     private String imageUploadPath;
     @Value("${jeecg.path.video-upload}")
     private String videoUploadPath;
-    @Autowired
+    @Resource
     FileInfoMapper fileInfoMapper;
     @Resource
     private ICtopOauthTokenService ctopOauthTokenService;

+ 8 - 4
module-common/src/main/java/cn/com/ctop/common/module/utils/KuaishouInterfaceConstant.java

@@ -104,6 +104,10 @@ public class KuaishouInterfaceConstant {
      * 创建广告获取应用列表(新版本)
      */
     public static final String APP_LIST_v2 = "/rest/openapi/v2/file/ad/app/list";
+    /**
+     * 获取app名称
+     */
+    public static final String APP_NAME = "/rest/openapi/v1/tool/keyword/query";
 
     /**
      * 账户日预算查询
@@ -322,19 +326,19 @@ public class KuaishouInterfaceConstant {
      * 频库-视频关联创意数查询
      */
     public static final String VIDEO_RELATE_CREATIVES = "/rest/openapi/v1/file/ad/video/relate/creatives";
-/**
+    /**
      * 查询加速探索信息接口
      */
     public static final String UNIT_EXPLORE_INFO_GET = "/rest/openapi/v1/ad_unit/explore/info/get";
-/**
+    /**
      * 广告组的加速探索预算设置
      */
     public static final String UNIT_EXPLORE_BUDGET_UPDATE = "/rest/openapi/v1/ad_unit/explore/budget/update";
-/**
+    /**
      * 暂停广告组的加速探索预算
      */
     public static final String UNIT_EXPLORE_STATUS_PAUSE = "/rest/openapi/v1/ad_unit/explore/status/pause";
-/**
+    /**
      * 查询广告组的加速探索报表接口
      */
     public static final String QUERY_SPEED_EXPLORE_REPORT = "/rest/openapi/v1/report/speed_explore";

+ 18 - 0
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceAiCreateJob.java

@@ -0,0 +1,18 @@
+package cn.com.ctop.job.bytedance.handler;
+
+import cn.com.ctop.common.module.utils.HttpUtils;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import org.jeecg.common.util.DateUtils;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+
+@Component
+public class BytedanceAiCreateJob {
+    private static final String URLPREFIX = "http://118.24.244.213:8080/bytedance-api//advertiser/aiBytedanceAdvertiserStrategy/autoCreateCreative?hour=";
+    @XxlJob("bytedanceAutoCreateJob")
+    public void execute() throws Exception {
+        String hour = DateUtils.getNowHour(new Date());
+        HttpUtils.httpGet(URLPREFIX + hour, null, null);
+    }
+}

+ 11 - 0
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceEtlVideoJob.java

@@ -1,6 +1,7 @@
 package cn.com.ctop.job.bytedance.handler;
 
 import cn.com.ctop.toutiao.modules.report.service.IBytedanceVideoEtlInfoService;
+import cn.com.ctop.toutiao.modules.report.service.IEtlBytedanceReportVideoDailyService;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -13,6 +14,10 @@ public class BytedanceEtlVideoJob {
 
     @Autowired
     private IBytedanceVideoEtlInfoService bytedanceVideoEtlInfoService;
+
+    @Autowired
+    private IEtlBytedanceReportVideoDailyService etlBytedanceReportVideoDailyService;
+
     @XxlJob("bytedanceEtlVideoJob")
     public void execute() throws Exception {
         Date startDate = DateUtils.addDay(new Date(),-2);
@@ -30,4 +35,10 @@ public class BytedanceEtlVideoJob {
             bytedanceVideoEtlInfoService.etlBytedanceVideoInfoByProjectId(getDate);
         }
     }
+
+
+    @XxlJob("updBytedanceVideoJob")
+    public void updBytedanceVideoJob() throws Exception {
+        etlBytedanceReportVideoDailyService.updBytedanceVideo();
+    }
 }

+ 7 - 3
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/AiKuaishouCreateCreativeController.java

@@ -155,9 +155,13 @@ public class AiKuaishouCreateCreativeController {
             if (Check.isNull(videoCnt)) {
                 throw new Exception("视频数量不能为空");
             }
-            kuaishouProgramTopCreativeAutoService.submit(() -> {
-                createCreativeService.autoCreateProgramCreative(strategy, 2, videoCnt);
-            });
+            if (strategy.getHistoryTop() == 0) {
+                kuaishouProgramTopCreativeAutoService.submit(() -> {
+                    createCreativeService.autoCreateProgramCreative(strategy, 2, videoCnt);
+                });
+            } else {
+                log.info("历史高质量暂停搭建,accountId:{}", strategy.getAccountId());
+            }
             returnJson.put("code", 0);
             returnJson.put("message", "异步创建中");
         } catch (Exception e) {

+ 1 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouAdvertiserStrategy.java

@@ -375,6 +375,7 @@ public class AiKuaishouAdvertiserStrategy {
     private Long customUnitCnt;
     private Long programUnitCnt;
     private String materialKeyword;
+    private Integer historyTop;
 
     @TableField(exist = false)
     private String authName;

+ 56 - 29
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouCreateCreativeServiceImpl.java

@@ -199,6 +199,12 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                 AiKuaishouUnitLevelOperationRecord unitLevelOperationRecord = new AiKuaishouUnitLevelOperationRecord();
                 BeanUtils.copyProperties(strategy, unitLevelOperationRecord);
                 unitLevelOperationRecord.setGroupName(unitName);
+                if (!Check.isNull(strategy.getCpaBid())) {
+                    unitLevelOperationRecord.setCpaBid(Integer.valueOf(strategy.getCpaBid() + ""));
+                }
+                if (!Check.isNull(strategy.getBid())) {
+                    unitLevelOperationRecord.setBid(Integer.valueOf(strategy.getBid() + ""));
+                }
                 unitLevelOperationRecord.setCreateTime(new Date());
                 unitLevelOperationRecord.setStatus(unitCode);
                 unitLevelOperationRecord.setMessage(unitMessage);
@@ -374,7 +380,6 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
 
     @Override
     public void customCreativeSupplement(AiKuaishouAdvertiserStrategy strategy, Integer hour) throws ParseException {
-
         Long customUnitCnt = strategy.getCustomUnitCnt();
         if (Check.isNull(customUnitCnt)) {
             Integer imageCnt = strategy.getImageCnt();
@@ -397,9 +402,11 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
             remindCnt = this.autoCreateCreative(strategy, 3, remindCnt);
         }
         if (remindCnt >= 1) {
-            log.info("{}组创建不足,剩余需要创建个数{},使用高质量素材创建", strategy.getAccountId(), remindCnt);
-            //高质量素材
-            remindCnt = this.autoCreateCreative(strategy, 2, remindCnt);
+            if (strategy.getHistoryTop() == 0) {
+                log.info("{}组创建不足,剩余需要创建个数{},使用高质量素材创建", strategy.getAccountId(), remindCnt);
+                //高质量素材
+                remindCnt = this.autoCreateCreative(strategy, 2, remindCnt);
+            }
         }
         if (remindCnt >= 1) {
             //历史打捞素材
@@ -674,8 +681,6 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         // 拼装创建组的入参 json
         JSONObject unitParams = new JSONObject();
         Integer unitType = strategy.getUnitType();
-
-
         //创意制作方式
         unitParams.put("unit_type", unitType);
         unitParams.put("advertiser_id", token.getAccountId());
@@ -737,6 +742,10 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
             if (!Check.isNull(appId)) {
                 unitParams.put("app_id", appId);
             }
+            // 直达链接
+            if (!Check.isNull(strategy.getSchemaUri())) {
+                unitParams.put("schema_uri", strategy.getSchemaUri());
+            }
             // 优先从系统应用商店下载
             if (null != strategy.getUseAppMarket()) {
                 unitParams.put("use_app_market", strategy.getUseAppMarket());
@@ -745,7 +754,6 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                 unitParams.put("app_store", JSON.parseArray(strategy.getAppStore()));
             }
         } else if (campaignType == 3) { //  获取电商下单
-
             //url类型
             if (!Check.isNull(strategy.getUrlType())) {
                 unitParams.put("url_type", strategy.getUrlType());
@@ -882,17 +890,36 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         if (null != strategy.getDevicePrice() && !"".equals(strategy.getDevicePrice()) && !"[]".equals(strategy.getDevicePrice())) {
             targetJsonObject.put("device_price", JSON.parseArray(strategy.getDevicePrice()));
         }
-        if (null != strategy.getPopulation() && !"".equals(strategy.getPopulation())) {
-            JSONArray population = JSON.parseArray(strategy.getPopulation());
-            targetJsonObject.put("population", population);
-        }
+
         if (null != strategy.getFilterConvertedLevel() && strategy.getFilterConvertedLevel() != 0) {
             targetJsonObject.put("filter_converted_level", strategy.getFilterConvertedLevel());
         }
-        if (null != strategy.getExcludePopulation() && !"".equals(strategy.getExcludePopulation())) {
-            JSONArray excludePopulation = JSON.parseArray(strategy.getExcludePopulation());
-            targetJsonObject.put("exclude_population", excludePopulation);
+
+        JSONArray appInterest = JSONArray.parseArray(strategy.getAppInterest());
+        if (!Check.isNull(appInterest)) {
+            targetJsonObject.put("app_interest", appInterest);
+        }
+        // APP行为-按APP名称
+        JSONArray appIds = JSONArray.parseArray(strategy.getAppIds());
+        if (!Check.isNull(appIds)) {
+            targetJsonObject.put("app_ids", appIds);
+        }
+        // 人群包定向
+        JSONArray populationString = JSONArray.parseArray(strategy.getPopulation());
+        if (!Check.isNull(populationString)) {
+            targetJsonObject.put("population", populationString);
         }
+        // 人群包排除
+        JSONArray excludePopulationString = JSONArray.parseArray(strategy.getExcludePopulation());
+        if (!Check.isNull(excludePopulationString)) {
+            targetJsonObject.put("exclude_population", excludePopulationString);
+        }
+        // 付费人群包id
+        JSONArray paidAudienceString = JSONArray.parseArray(strategy.getPaidAudience());
+        if (!Check.isNull(paidAudienceString)) {
+            targetJsonObject.put("paid_audience", paidAudienceString);
+        }
+
         //是否开启智能扩量
         if (null != strategy.getIsOpen() && strategy.getIsOpen().equals(1)) {
             JSONObject intelliExtend = new JSONObject();
@@ -1039,30 +1066,30 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
 
         }
         // APP行为-按分类
-        String appInterestString = strategy.getAppInterest();
-        if (null != appInterestString && !"".equals(appInterestString.trim())) {
-            target.put("app_interest", JSON.parseArray(appInterestString));
+        JSONArray appInterest = JSONArray.parseArray(strategy.getAppInterest());
+        if (!Check.isNull(appInterest)) {
+            target.put("app_interest", appInterest);
         }
         // APP行为-按APP名称
-        String appIdsString = strategy.getAppIds();
-        if (null != appIdsString && !"".equals(appIdsString.trim())) {
-            target.put("app_ids", JSON.parseArray(appIdsString));
+        JSONArray appIds = JSONArray.parseArray(strategy.getAppIds());
+        if (!Check.isNull(appIds)) {
+            target.put("app_ids", appIds);
         }
 
         // 人群包定向
-        String populationString = strategy.getPopulation();
-        if (null != populationString && !"".equals(populationString.trim())) {
-            target.put("population", JSON.parseArray(populationString));
+        JSONArray populationString = JSONArray.parseArray(strategy.getPopulation());
+        if (!Check.isNull(populationString)) {
+            target.put("population", populationString);
         }
         // 人群包排除
-        String excludePopulationString = strategy.getExcludePopulation();
-        if (null != excludePopulationString && !"".equals(excludePopulationString.trim())) {
-            target.put("exclude_population", JSON.parseArray(excludePopulationString));
+        JSONArray excludePopulationString = JSONArray.parseArray(strategy.getExcludePopulation());
+        if (!Check.isNull(excludePopulationString)) {
+            target.put("exclude_population", excludePopulationString);
         }
         // 付费人群包id
-        String paidAudienceString = strategy.getPaidAudience();
-        if (null != paidAudienceString && !"".equals(paidAudienceString.trim())) {
-            target.put("paid_audience", JSON.parseArray(paidAudienceString));
+        JSONArray paidAudienceString = JSONArray.parseArray(strategy.getPaidAudience());
+        if (!Check.isNull(paidAudienceString)) {
+            target.put("paid_audience", paidAudienceString);
         }
         if (Check.isNull(strategy.getBehaviorInterest())) {
             target.put("behavior_interest", JSON.parseObject(strategy.getBehaviorInterest()));

+ 35 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java

@@ -2418,4 +2418,39 @@ public class BatchController {
     }
 
 
+    /**
+     * 获取可选的深度类型
+     *
+     * @return
+     */
+    @PostMapping(value = "/getAppNames")
+    public Result<JSONArray> getAppNames(@RequestBody JSONObject requestJson) {
+        Result result = new Result<JSONArray>();
+        try {
+            Long accountId = requestJson.getLong("accountId");
+
+            CtopOauthToken token = oauthTokenService.getTokenByAccountId(accountId);
+            if (Check.isNull(token)) {
+                throw new Exception("未获取授权信息");
+            }
+            JSONArray appIds = requestJson.getJSONArray("appIds");
+
+            if (!Check.isNull(appIds)) {
+                JSONArray appNames = iKuaishouInterfaceService.getAppNames(accountId, token.getAccessToken(), appIds);
+                result.setResult(appNames);
+            } else {
+                result.setResult(new JSONArray());
+            }
+            result.setSuccess(true);
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+            result.setMessage(e.getMessage());
+        }
+
+        return result;
+
+    }
+
+
 }

+ 1 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaishouInterfaceService.java

@@ -468,6 +468,7 @@ public interface IKuaishouInterfaceService {
 
     void getCreativeByCreativeIds(String accessToken, Long advertiserId, JSONArray creativeIds);
 
+    JSONArray getAppNames(Long accountId, String accessToken, JSONArray appIds);
 }
 
 

+ 7 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/BatchServiceImpl.java

@@ -228,6 +228,9 @@ public class BatchServiceImpl implements IBatchService {
         if (!Check.isNull(requestJson.getString("url"))) {
             unitJson.put("url", requestJson.getString("url"));
         }
+        if (!Check.isNull(requestJson.getString("schemaUri"))) {
+            unitJson.put("schema_uri", requestJson.getString("schemaUri"));
+        }
         // appId
         if (!Check.isNull(requestJson.getLong("appId"))) {
             unitJson.put("app_id", requestJson.getLong("appId"));
@@ -820,6 +823,10 @@ public class BatchServiceImpl implements IBatchService {
                 if (!Check.isNull(group.getUrl())) {
                     unitJson.put("url", group.getUrl());
                 }
+                //  吊起链接
+                if (!Check.isNull(group.getSchemaUri())) {
+                    unitJson.put("schema_uri", group.getSchemaUri());
+                }
                 // appId
                 if (!Check.isNull(group.getAppId())) {
                     unitJson.put("app_id", group.getAppId());
@@ -848,8 +855,6 @@ public class BatchServiceImpl implements IBatchService {
                     // 自定义年龄段
                     Integer ageMin = groupTarget.getAgeMin();
                     Integer ageMax = groupTarget.getAgeMax();
-
-
                     JSONObject ageJson = new JSONObject();
                     if (!Check.isNull(ageMin)) {
                         ageJson.put("min", ageMin);

+ 31 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java

@@ -3208,4 +3208,35 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     }
 
 
+    @Override
+    public JSONArray getAppNames(Long accountId, String accessToken, JSONArray appIds) {
+        String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.APP_NAME;
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Access-Token", accessToken);
+        headers.put("Content-Type", " application/json");
+        JSONObject json = new JSONObject();
+        json.put("advertiser_id", accountId);
+        json.put("type", 1);
+        json.put("ids", appIds);
+        String result = HttpUtils.kuaiShouhttpPostRequest(url, json.toJSONString(), headers);
+        JSONObject resultJson = JSONObject.parseObject(result);
+        if (!Check.isNull(resultJson)) {
+            Integer code = resultJson.getInteger("code");
+            if (code == 0) {
+                JSONObject data = resultJson.getJSONObject("data");
+                if (!Check.isNull(data)) {
+                    JSONArray keyword = data.getJSONArray("keyword");
+                    if (!Check.isNull(keyword)) {
+                        return keyword;
+
+                    }
+                }
+            }
+
+        }
+        return new JSONArray();
+
+    }
+
+
 }

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

@@ -3,6 +3,9 @@ package cn.com.ctop.toutiao.modules.report.mapper;
 import cn.com.ctop.toutiao.modules.report.entity.EtlBytedanceReportVideoDaily;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
+import java.util.List;
+import java.util.Map;
+
 /**
  * 头条视频分日报表信息
  * @author: jeecg-boot
@@ -11,4 +14,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface EtlBytedanceReportVideoDailyMapper extends BaseMapper<EtlBytedanceReportVideoDaily> {
 
+    List<Map<String,Object>> getBytedanceVideoInfo();
+
+    void updBytedanceVideoByMd5(String md5,String coverUrl,String url);
+
+
+
+
 }

+ 3 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceVideoReportMapper.xml

@@ -5,7 +5,9 @@
     <select id="queryVideoReportBy" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
         t1.md5 signature,
-        IFNULL(t1.toutiao_url, '') AS url,
+        (case when t1.toutiao_url != ''  then t1.toutiao_url
+            when t1.url !='' then t1.url
+            else ''  end ) AS url,
         t1.cover_url AS converUrl,
         t1.clip_name AS clip,
         t1.shot_name AS shot,

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

@@ -2,4 +2,38 @@
 <!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="getBytedanceVideoInfo" resultType="java.util.Map">
+        SELECT
+            IF
+                ( poster_url = '素材所属主体与开发者主体不一致无法获取URL', '', poster_url ) AS posterUrl,
+            poster_url,
+            video_url AS videoUrl,
+            a.md5,
+            count( 1 ) AS total
+        FROM
+            etl_report_bytedance_video a
+                LEFT JOIN ( SELECT DISTINCT signature, poster_url, video_url FROM ctop_bytedance_video_info ) b ON b.signature = a.md5
+                LEFT JOIN ( SELECT DISTINCT CODE, url FROM ctop_material_info ) c ON c.CODE = a.md5
+        WHERE
+            a.url = ''
+          AND a.toutiao_url = ''
+          AND a.md5 != ''
+        GROUP BY
+            a.md5
+        ORDER BY
+            total DESC;
+    </select>
+
+
+    <update id="updBytedanceVideoByMd5">
+        UPDATE etl_report_bytedance_video
+        SET cover_url = #{coverUrl},
+            url = #{url}
+        WHERE
+            md5 = #{md5};
+    </update>
+
+
+
 </mapper>

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

@@ -2,6 +2,7 @@ package cn.com.ctop.toutiao.modules.report.service;
 
 import cn.com.ctop.toutiao.modules.report.entity.EtlBytedanceReportVideoDaily;
 import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.common.api.vo.Result;
 
 /**
  * @Description: 头条视频分日报表信息
@@ -11,4 +12,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface IEtlBytedanceReportVideoDailyService extends IService<EtlBytedanceReportVideoDaily> {
 
+
+    Result updBytedanceVideo() throws Exception;
+
+
 }

+ 46 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/EtlBytedanceReportVideoDailyServiceImpl.java

@@ -4,15 +4,60 @@ import cn.com.ctop.toutiao.modules.report.entity.EtlBytedanceReportVideoDaily;
 import cn.com.ctop.toutiao.modules.report.mapper.EtlBytedanceReportVideoDailyMapper;
 import cn.com.ctop.toutiao.modules.report.service.IEtlBytedanceReportVideoDailyService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.google.api.client.util.Data;
+import com.google.common.base.Function;
+import org.checkerframework.checker.nullness.qual.Nullable;
+import org.jeecg.common.api.vo.Result;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CompletableFuture;
+import java.util.function.BiFunction;
+
 /**
  * 头条视频分日报表信息
+ *
  * @author jeecg-boot
- * @date   2021-02-20
  * @version V1.0
+ * @date 2021-02-20
  */
 @Service
 public class EtlBytedanceReportVideoDailyServiceImpl extends ServiceImpl<EtlBytedanceReportVideoDailyMapper, EtlBytedanceReportVideoDaily> implements IEtlBytedanceReportVideoDailyService {
 
+
+    @Resource
+    private EtlBytedanceReportVideoDailyMapper etlBytedanceReportVideoDailyMapper;
+
+    @Override
+    public Result updBytedanceVideo() throws Exception{
+        CompletableFuture future = CompletableFuture.supplyAsync(()->{
+           return etlBytedanceReportVideoDailyMapper.getBytedanceVideoInfo();
+        }).handle(new BiFunction<List<Map<String, Object>>, Throwable, Object>() {
+            @Override
+            public Object apply(List<Map<String, Object>> list, Throwable throwable) {
+                if (throwable != null){
+                    return Result.error(throwable.getMessage());
+                }
+                list.forEach(map ->{
+                    String coverUrl = map.get("posterUrl")+"";
+                    String url = map.get("videoUrl")+"";
+                    String md5 = map.get("md5")+"";
+                    etlBytedanceReportVideoDailyMapper.updBytedanceVideoByMd5(md5,coverUrl,url);
+                });
+                return Result.ok("修改成功。");
+            }
+        });
+        return Result.ok(future.get());
+    }
+
+
+
+
+
+
 }