hpk 1 рік тому
батько
коміт
dda8804418

+ 2 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/BytedancePromoterReportMapper.java

@@ -19,6 +19,8 @@ public interface BytedancePromoterReportMapper {
 
 
     void deleteInfoByErrorId(@Param("errorId") Long errorId);
     void deleteInfoByErrorId(@Param("errorId") Long errorId);
 
 
+    void updateStatusByErrorId(@Param("errorId") Long errorId);
+
     void replacePromoterReportDailies(@Param("list") List<BytedancePromoterReportDaily> promoterReportDailies);
     void replacePromoterReportDailies(@Param("list") List<BytedancePromoterReportDaily> promoterReportDailies);
     @DS("sd_group_commit")
     @DS("sd_group_commit")
     void replacePromoterReportDailiesSD(@Param("list") List<BytedancePromoterReportDaily> promoterReportDailies);
     void replacePromoterReportDailiesSD(@Param("list") List<BytedancePromoterReportDaily> promoterReportDailies);

+ 6 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/BytedancePromoterReportMapper.xml

@@ -1,6 +1,11 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
 <mapper namespace="cn.com.ctop.job.bytedance.data.mapper.BytedancePromoterReportMapper">
 <mapper namespace="cn.com.ctop.job.bytedance.data.mapper.BytedancePromoterReportMapper">
+    <update id="updateStatusByErrorId">
+        update bytedance_error_log
+        set error_status = 1
+        WHERE id = #{errorId}
+    </update>
     <delete id="deleteInfoByErrorId">
     <delete id="deleteInfoByErrorId">
         DELETE
         DELETE
         FROM bytedance_error_log
         FROM bytedance_error_log
@@ -12,6 +17,7 @@
         FROM bytedance_error_log t1
         FROM bytedance_error_log t1
                  LEFT JOIN deepthink.bytedance_advertiser_list t2 ON t1.advertiser_id = t2.advertiser_id
                  LEFT JOIN deepthink.bytedance_advertiser_list t2 ON t1.advertiser_id = t2.advertiser_id
                  LEFT JOIN deepthink.bytedance_auth_list t3 ON t2.admin_advertiser_id = t3.admin_advertiser_id
                  LEFT JOIN deepthink.bytedance_auth_list t3 ON t2.admin_advertiser_id = t3.admin_advertiser_id
+        where t1.error_status = 0 or t1.update_time &lt;= date_add(now(),interval -1 hour )
     </select>
     </select>
 
 
     <select id="getListBydate" resultType="com.alibaba.fastjson.JSONObject" parameterType="java.lang.Integer">
     <select id="getListBydate" resultType="com.alibaba.fastjson.JSONObject" parameterType="java.lang.Integer">

+ 17 - 2
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceReportRetryJob.java

@@ -3,6 +3,7 @@ package cn.com.ctop.job.bytedance.handler;
 
 
 import cn.com.ctop.job.bytedance.config.DianZhongConfig;
 import cn.com.ctop.job.bytedance.config.DianZhongConfig;
 import cn.com.ctop.job.bytedance.data.enums.AccountTypeEnum;
 import cn.com.ctop.job.bytedance.data.enums.AccountTypeEnum;
+import cn.com.ctop.job.bytedance.data.mapper.BytedancePromoterReportMapper;
 import cn.com.ctop.job.bytedance.data.service.*;
 import cn.com.ctop.job.bytedance.data.service.*;
 import cn.com.ctop.job.bytedance.data.utils.Check;
 import cn.com.ctop.job.bytedance.data.utils.Check;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
@@ -59,6 +60,9 @@ public class BytedanceReportRetryJob {
     @Resource
     @Resource
     private DianZhongConfig dianZhongConfig;
     private DianZhongConfig dianZhongConfig;
 
 
+    @Autowired
+    private BytedancePromoterReportMapper promoterReportMapper;
+
 
 
     private static ExecutorService hourAccountRetrExecutorService = Executors.newFixedThreadPool(2);
     private static ExecutorService hourAccountRetrExecutorService = Executors.newFixedThreadPool(2);
     private static ExecutorService dailyAccountRetrExecutorService = Executors.newFixedThreadPool(2);
     private static ExecutorService dailyAccountRetrExecutorService = Executors.newFixedThreadPool(2);
@@ -67,6 +71,7 @@ public class BytedanceReportRetryJob {
     private static ExecutorService hourPromoterRetrExecutorService = Executors.newFixedThreadPool(2);
     private static ExecutorService hourPromoterRetrExecutorService = Executors.newFixedThreadPool(2);
 
 
     private static ExecutorService productDailyRetrExecutor = Executors.newFixedThreadPool(2);
     private static ExecutorService productDailyRetrExecutor = Executors.newFixedThreadPool(2);
+    private static ExecutorService materialRetrExecutor = Executors.newFixedThreadPool(3);
 
 
     private static ExecutorService flowDailyRetrExecutor = Executors.newFixedThreadPool(2);
     private static ExecutorService flowDailyRetrExecutor = Executors.newFixedThreadPool(2);
     private static ExecutorService changduExecutorService = Executors.newFixedThreadPool(1);
     private static ExecutorService changduExecutorService = Executors.newFixedThreadPool(1);
@@ -93,6 +98,7 @@ public class BytedanceReportRetryJob {
                             @Override
                             @Override
                             public void run() {
                             public void run() {
                                 if (!Check.isNull(accessToken)) {
                                 if (!Check.isNull(accessToken)) {
+                                    promoterReportMapper.updateStatusByErrorId(id);
                                     promoterReportService.getBytedanceRetryPromoterHourReport(id, advertiserId, accessToken, startDate, endDate, 1, isSend);
                                     promoterReportService.getBytedanceRetryPromoterHourReport(id, advertiserId, accessToken, startDate, endDate, 1, isSend);
                                 }
                                 }
                             }
                             }
@@ -103,6 +109,7 @@ public class BytedanceReportRetryJob {
                             @Override
                             @Override
                             public void run() {
                             public void run() {
                                 if (!Check.isNull(accessToken)) {
                                 if (!Check.isNull(accessToken)) {
+                                    promoterReportMapper.updateStatusByErrorId(id);
                                     promoterReportService.getBytedancePromoterRetryDailyReport(id, advertiserId, accessToken, startDate, endDate, 1, isSend);
                                     promoterReportService.getBytedancePromoterRetryDailyReport(id, advertiserId, accessToken, startDate, endDate, 1, isSend);
 
 
                                 }
                                 }
@@ -114,6 +121,7 @@ public class BytedanceReportRetryJob {
                         @Override
                         @Override
                         public void run() {
                         public void run() {
                             if (!Check.isNull(accessToken)) {
                             if (!Check.isNull(accessToken)) {
+                                promoterReportMapper.updateStatusByErrorId(id);
                                 productReportService.getBytedanceProductDailyReport(advertiserId, accessToken, startDate, endDate, 1, id, null, isSend);
                                 productReportService.getBytedanceProductDailyReport(advertiserId, accessToken, startDate, endDate, 1, id, null, isSend);
                             }
                             }
                         }
                         }
@@ -124,6 +132,7 @@ public class BytedanceReportRetryJob {
                             @Override
                             @Override
                             public void run() {
                             public void run() {
                                 if (!Check.isNull(accessToken)) {
                                 if (!Check.isNull(accessToken)) {
+                                    promoterReportMapper.updateStatusByErrorId(id);
                                     accountReportService.getBytedanceRetryAccountHourReport(id, advertiserId, accessToken, startDate, endDate, 1, isSend);
                                     accountReportService.getBytedanceRetryAccountHourReport(id, advertiserId, accessToken, startDate, endDate, 1, isSend);
                                 }
                                 }
                             }
                             }
@@ -135,6 +144,7 @@ public class BytedanceReportRetryJob {
                             @Override
                             @Override
                             public void run() {
                             public void run() {
                                 if (!Check.isNull(accessToken)) {
                                 if (!Check.isNull(accessToken)) {
+                                    promoterReportMapper.updateStatusByErrorId(id);
                                     accountReportService.getBytedanceRetryAccountDailyReport(id, advertiserId, accessToken, startDate, endDate, 1, isSend);
                                     accountReportService.getBytedanceRetryAccountDailyReport(id, advertiserId, accessToken, startDate, endDate, 1, isSend);
                                 }
                                 }
                             }
                             }
@@ -146,14 +156,16 @@ public class BytedanceReportRetryJob {
 
 
                         @Override
                         @Override
                         public void run() {
                         public void run() {
+                            promoterReportMapper.updateStatusByErrorId(id);
                             byteDanceFlowDetailsReportService.getBytedanceFlowDetailsDailyReport(advertiserId, accessToken, AccountTypeEnum.AD.getValue(), startDate, endDate, 1, id);
                             byteDanceFlowDetailsReportService.getBytedanceFlowDetailsDailyReport(advertiserId, accessToken, AccountTypeEnum.AD.getValue(), startDate, endDate, 1, id);
                         }
                         }
                     });
                     });
                 } else if ("material".equals(dataDimension)) {
                 } else if ("material".equals(dataDimension)) {
-                    productDailyRetrExecutor.submit(new Runnable() {
+                    materialRetrExecutor.submit(new Runnable() {
                         @Override
                         @Override
                         public void run() {
                         public void run() {
                             if (!Check.isNull(accessToken)) {
                             if (!Check.isNull(accessToken)) {
+                                promoterReportMapper.updateStatusByErrorId(id);
                                 bytedanceMaterialReportService.getBytedanceMaterialDailyReport(advertiserId, accessToken, startDate, endDate, 1, id, null, isSend, 1);
                                 bytedanceMaterialReportService.getBytedanceMaterialDailyReport(advertiserId, accessToken, startDate, endDate, 1, id, null, isSend, 1);
                             }
                             }
                         }
                         }
@@ -164,10 +176,11 @@ public class BytedanceReportRetryJob {
                     if (msgObject != null && msgObject.getJSONArray("material_ids") != null) {
                     if (msgObject != null && msgObject.getJSONArray("material_ids") != null) {
                         materialIds.addAll(msgObject.getJSONArray("material_ids").toJavaList(Long.class));
                         materialIds.addAll(msgObject.getJSONArray("material_ids").toJavaList(Long.class));
                     }
                     }
-                    productDailyRetrExecutor.submit(new Runnable() {
+                    materialRetrExecutor.submit(new Runnable() {
                         @Override
                         @Override
                         public void run() {
                         public void run() {
                             if (!Check.isNull(accessToken)) {
                             if (!Check.isNull(accessToken)) {
+                                promoterReportMapper.updateStatusByErrorId(id);
                                 bytedanceMaterialReportService.getBytedanceMaterialVideo(advertiserId, materialIds, accessToken, startDate, endDate, 1, id, null, isSend, 1);
                                 bytedanceMaterialReportService.getBytedanceMaterialVideo(advertiserId, materialIds, accessToken, startDate, endDate, 1, id, null, isSend, 1);
                             }
                             }
                         }
                         }
@@ -177,6 +190,7 @@ public class BytedanceReportRetryJob {
                         @Override
                         @Override
                         public void run() {
                         public void run() {
                             if (!Check.isNull(accessToken)) {
                             if (!Check.isNull(accessToken)) {
+                                promoterReportMapper.updateStatusByErrorId(id);
                                 cdpProjectService.getPromotionList(advertiserId, null, null, id, null);
                                 cdpProjectService.getPromotionList(advertiserId, null, null, id, null);
                             }
                             }
                         }
                         }
@@ -186,6 +200,7 @@ public class BytedanceReportRetryJob {
                         @Override
                         @Override
                         public void run() {
                         public void run() {
                             if (!Check.isNull(accessToken)) {
                             if (!Check.isNull(accessToken)) {
+                                promoterReportMapper.updateStatusByErrorId(id);
                                 cdpProjectService.getProjectList(advertiserId, null, null, null, id, null);
                                 cdpProjectService.getProjectList(advertiserId, null, null, null, id, null);
                                 cdpProjectService.getProjectList(advertiserId, null, "del", null, id, null);
                                 cdpProjectService.getProjectList(advertiserId, null, "del", null, id, null);
                             }
                             }