Przeglądaj źródła

Merge branch 'refs/heads/master' into zhaotx

zhaotx 1 rok temu
rodzic
commit
2b359e463b
47 zmienionych plików z 1814 dodań i 139 usunięć
  1. 18 12
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/controller/BytedanceController.java
  2. 65 0
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/controller/BytedanceXingTuController.java
  3. 10 0
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/BytedanceAdvertiserReportDaily.java
  4. 10 0
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/BytedanceAdvertiserReportHour.java
  5. 10 0
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/BytedancePromoterReportDaily.java
  6. 10 0
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/BytedancePromoterReportHour.java
  7. 56 0
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/BytedanceXingTuReport.java
  8. 20 0
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/BytedanceXingTuReportDaily.java
  9. 41 0
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/BytedanceXingTuTask.java
  10. 2 0
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/AdminAdvertiserListMapper.java
  11. 28 0
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/BytedanceXingTuMapper.java
  12. 10 0
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/CPSReportMapper.java
  13. 17 4
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/ReportsAdPushMapper.java
  14. 13 0
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/AdminAdvertiserListMapper.xml
  15. 8 4
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/BytedanceAccountReportMapper.xml
  16. 6 2
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/BytedanceCdpProjectListMapper.xml
  17. 1 0
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/BytedanceProductUpdateMapper.xml
  18. 8 5
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/BytedancePromoterReportMapper.xml
  19. 138 0
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/BytedanceXingTuMapper.xml
  20. 175 0
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/CPSReportMapper.xml
  21. 146 19
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/ReportsAdPushMapper.xml
  22. 2 0
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/IAdminAdvertiserListService.java
  23. 16 0
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/IBytedanceXingTuService.java
  24. 6 0
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/ICPSReportService.java
  25. 2 0
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/IDateReportsPushService.java
  26. 1 1
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/IReportsAdPushService.java
  27. 9 0
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/IReportsByBusinessPushService.java
  28. 5 0
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/AdminAdvertiserListServiceImpl.java
  29. 5 2
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/BytedanceCdpProjectServiceImpl.java
  30. 12 10
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/BytedanceProductUpdateServiceImpl.java
  31. 1 2
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/BytedancePromoterReportServiceImpl.java
  32. 306 0
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/BytedanceXingTuServiceImpl.java
  33. 26 0
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/CPSReportServiceImpl.java
  34. 10 2
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/DateReportsPushServiceImpl.java
  35. 2 2
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/OptimizerRankPushServiceImpl.java
  36. 70 49
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/ReportsAdPushServiceImpl.java
  37. 282 0
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/ReportsByBusinessPushServiceImpl.java
  38. 26 11
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/TotalRankPushServiceImpl.java
  39. 1 0
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/utils/FieldsConfig.java
  40. 24 0
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedancePromoterReportJob.java
  41. 58 3
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceReportRetryJob.java
  42. 73 0
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceXingTuJob.java
  43. 54 0
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/CPSReportJob.java
  44. 18 5
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/FeishuPushJob.java
  45. 7 0
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/ToolsSiteJob.java
  46. 5 5
      job-bytedance/src/main/resources/application.yml
  47. 1 1
      job-bytedance/src/main/resources/logback-dev.xml

+ 18 - 12
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/controller/BytedanceController.java

@@ -49,17 +49,19 @@ public class BytedanceController {
     @Autowired
     private IBytedanceMiniAppService bytedanceMiniAppService;
 
+    @Autowired
+    private IBytedanceCdpProjectService cdpProjectService;
 
     @GetMapping("/accountReport")
-    public void getChannel(String param) {
+    public void getChannel() {
+
+        List<JSONObject> infos = adminAdvertiserListService.getAdvertiserInfosByAdminIds();
+
 
-        List<JSONObject> infos = adminAdvertiserListService.getAdvertiserInfos();
-        System.err.println(infos);
-        adminAdvertiserListService.batchUpdateAdvertiserName(infos);
 
-      /*  List<JSONObject> allList = promoterReportService.getAllList();
-        for (int i = 0; i < allList.size(); i++) {
-            JSONObject jsonObject = allList.get(i);
+
+        for (int i = 0; i < infos.size(); i++) {
+            JSONObject jsonObject = infos.get(i);
             Long advertiserId = jsonObject.getLong("advertiserId");
             String accessToken = jsonObject.getString("accessToken");
 
@@ -67,15 +69,19 @@ public class BytedanceController {
                 @Override
                 public void run() {
                     if (!Check.isNull(accessToken)) {
-                        accountReportService.getBytedanceAccountDaily(advertiserId, accessToken, "2025-01-01", "2025-03-25", 1, 1);
-                    //    accountReportService.getBytedanceAccountHour(advertiserId, accessToken, "2025-01-01", "2025-03-25", 1, 1);
-                      //  promoterReportService.getBytedancePromoterHour(advertiserId, accessToken, "2025-01-01", "2025-03-25", 1, 1);
-                        promoterReportService.getBytedancePromoterDaily(advertiserId, accessToken, "2025-01-01", "2025-03-25", 1, 1);
+
+                        /*cdpProjectService.getProjectList(advertiserId, null);
+                        cdpProjectService.getpromotionList(advertiserId, null);*/
+
+                   //     accountReportService.getBytedanceAccountDaily(advertiserId,accessToken,"2025-06-01","2025-06-03",1,1);
+                        promoterReportService.getBytedancePromoterDaily(advertiserId,accessToken,"2025-06-01","2025-06-03",1,1);
+
+
                     }
                 }
             });
 
-        }*/
+        }
 
 
     }

+ 65 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/controller/BytedanceXingTuController.java

@@ -0,0 +1,65 @@
+package cn.com.ctop.job.bytedance.controller;
+
+import cn.com.ctop.job.bytedance.data.service.IBytedanceXingTuService;
+import cn.com.ctop.job.bytedance.data.utils.DateUtils;
+import com.alibaba.fastjson.JSONObject;
+import io.swagger.annotations.Api;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+@RestController
+@RequestMapping("/bytedance/bytedanceXingTu")
+@Api(tags = "头条星图")
+@Slf4j
+public class BytedanceXingTuController {
+    @Autowired
+    private IBytedanceXingTuService bytedanceXingTuService;
+
+
+    @GetMapping("/taskList")
+    public void taskList(@RequestParam(required = false) Long advertiserId,
+                         @RequestParam(required = false) String startDate,
+                         @RequestParam(required = false) String endDate) {
+        startDate = startDate == null ? DateUtils.getNowAddDate("yyyy-MM-dd", -1) : startDate;
+        endDate = endDate == null ? DateUtils.getNowDate("yyyy-MM-dd") : endDate;
+        List<JSONObject> xingTuAccount = bytedanceXingTuService.getXingTuAccount(advertiserId);
+        for (JSONObject jsonObject : xingTuAccount) {
+            Long advId = jsonObject.getLong("advertiser_id");
+            String accessToken = jsonObject.getString("access_token");
+            bytedanceXingTuService.getXingTuTaskList(advId, accessToken, startDate, endDate, 1, null, 1, null);
+        }
+
+    }
+
+    @GetMapping("/taskInfo")
+    public void taskInfo() {
+        List<JSONObject> xingTuTasks = bytedanceXingTuService.getXingTuActiveTask(null);
+        for (JSONObject taskJson : xingTuTasks) {
+            Long advId = taskJson.getLong("advertiser_id");
+            Long taskId = taskJson.getLong("task_id");
+            String accessToken = taskJson.getString("access_token");
+            bytedanceXingTuService.getXingTuTaskInfo(advId, taskId, accessToken, null, 1, null);
+        }
+
+    }
+
+    @GetMapping("/taskReport")
+    public void taskReport() {
+        List<JSONObject> xingTuTasks = bytedanceXingTuService.getXingTuReportTask(null);
+        for (JSONObject taskJson : xingTuTasks) {
+            Integer taskStatus = taskJson.getInteger("task_status");
+            Long advId = taskJson.getLong("advertiser_id");
+            Long taskId = taskJson.getLong("task_id");
+            String accessToken = taskJson.getString("access_token");
+            bytedanceXingTuService.getXingTuTaskReport(advId, taskId, accessToken, 1, null, 1, null);
+        }
+
+    }
+
+}

+ 10 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/BytedanceAdvertiserReportDaily.java

@@ -132,6 +132,7 @@ public class BytedanceAdvertiserReportDaily {
      * 3日LTV
      */
     private BigDecimal attributionMicroGame3dLtv;
+    private BigDecimal statMicroGame0dAmount;
 
     public Long getAdvertiserId() {
         return advertiserId;
@@ -325,6 +326,14 @@ public class BytedanceAdvertiserReportDaily {
         this.attributionMicroGame3dLtv = attributionMicroGame3dLtv;
     }
 
+    public BigDecimal getStatMicroGame0dAmount() {
+        return statMicroGame0dAmount;
+    }
+
+    public void setStatMicroGame0dAmount(BigDecimal statMicroGame0dAmount) {
+        this.statMicroGame0dAmount = statMicroGame0dAmount;
+    }
+
     @Override
     public String toString() {
         return "BytedanceAdvertiserReportDaily{" +
@@ -352,6 +361,7 @@ public class BytedanceAdvertiserReportDaily {
                 ", attributionMicroGame0dLtv=" + attributionMicroGame0dLtv +
                 ", attributionMicroGame7dLtv=" + attributionMicroGame7dLtv +
                 ", attributionMicroGame3dLtv=" + attributionMicroGame3dLtv +
+                ", statMicroGame0dAmount=" + statMicroGame0dAmount +
                 '}';
     }
 }

+ 10 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/BytedanceAdvertiserReportHour.java

@@ -136,6 +136,7 @@ public class BytedanceAdvertiserReportHour {
      * 3日LTV
      */
     private BigDecimal attributionMicroGame3dLtv;
+    private BigDecimal statMicroGame0dAmount;
 
     public Long getAdvertiserId() {
         return advertiserId;
@@ -337,6 +338,14 @@ public class BytedanceAdvertiserReportHour {
         this.attributionMicroGame3dLtv = attributionMicroGame3dLtv;
     }
 
+    public BigDecimal getStatMicroGame0dAmount() {
+        return statMicroGame0dAmount;
+    }
+
+    public void setStatMicroGame0dAmount(BigDecimal statMicroGame0dAmount) {
+        this.statMicroGame0dAmount = statMicroGame0dAmount;
+    }
+
     @Override
     public String toString() {
         return "BytedanceAdvertiserReportHour{" +
@@ -365,6 +374,7 @@ public class BytedanceAdvertiserReportHour {
                 ", attributionMicroGame0dLtv=" + attributionMicroGame0dLtv +
                 ", attributionMicroGame7dLtv=" + attributionMicroGame7dLtv +
                 ", attributionMicroGame3dLtv=" + attributionMicroGame3dLtv +
+                ", statMicroGame0dAmount=" + statMicroGame0dAmount +
                 '}';
     }
 }

+ 10 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/BytedancePromoterReportDaily.java

@@ -142,6 +142,7 @@ public class BytedancePromoterReportDaily {
     private BigDecimal attributionMicroGame0dLtv;
     private BigDecimal attributionMicroGame3dLtv;
     private BigDecimal attributionMicroGame7dLtv;
+    private BigDecimal statMicroGame0dAmount;
 
     public Long getAdvertiserId() {
         return advertiserId;
@@ -367,6 +368,14 @@ public class BytedancePromoterReportDaily {
         this.attributionMicroGame7dLtv = attributionMicroGame7dLtv;
     }
 
+    public BigDecimal getStatMicroGame0dAmount() {
+        return statMicroGame0dAmount;
+    }
+
+    public void setStatMicroGame0dAmount(BigDecimal statMicroGame0dAmount) {
+        this.statMicroGame0dAmount = statMicroGame0dAmount;
+    }
+
     @Override
     public String toString() {
         return "BytedancePromoterReportDaily{" +
@@ -398,6 +407,7 @@ public class BytedancePromoterReportDaily {
                 ", attributionMicroGame0dLtv=" + attributionMicroGame0dLtv +
                 ", attributionMicroGame3dLtv=" + attributionMicroGame3dLtv +
                 ", attributionMicroGame7dLtv=" + attributionMicroGame7dLtv +
+                ", statMicroGame0dAmount=" + statMicroGame0dAmount +
                 '}';
     }
 }

+ 10 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/BytedancePromoterReportHour.java

@@ -148,6 +148,7 @@ public class BytedancePromoterReportHour {
     private BigDecimal attributionMicroGame0dLtv;
     private BigDecimal attributionMicroGame3dLtv;
     private BigDecimal attributionMicroGame7dLtv;
+    private BigDecimal statMicroGame0dAmount;
 
 
     public Long getAdvertiserId() {
@@ -382,6 +383,14 @@ public class BytedancePromoterReportHour {
         this.attributionMicroGame7dLtv = attributionMicroGame7dLtv;
     }
 
+    public BigDecimal getStatMicroGame0dAmount() {
+        return statMicroGame0dAmount;
+    }
+
+    public void setStatMicroGame0dAmount(BigDecimal statMicroGame0dAmount) {
+        this.statMicroGame0dAmount = statMicroGame0dAmount;
+    }
+
     @Override
     public String toString() {
         return "BytedancePromoterReportHour{" +
@@ -414,6 +423,7 @@ public class BytedancePromoterReportHour {
                 ", attributionMicroGame0dLtv=" + attributionMicroGame0dLtv +
                 ", attributionMicroGame3dLtv=" + attributionMicroGame3dLtv +
                 ", attributionMicroGame7dLtv=" + attributionMicroGame7dLtv +
+                ", statMicroGame0dAmount=" + statMicroGame0dAmount +
                 '}';
     }
 }

+ 56 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/BytedanceXingTuReport.java

@@ -0,0 +1,56 @@
+package cn.com.ctop.job.bytedance.data.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class BytedanceXingTuReport {
+    private Long challengeTaskId;
+    private Long advertiserId;
+    private Long authorId;
+    private Long itemId;
+
+    private Long androidActivateCnt;
+    private String authorNickname;
+    private Long commentCnt;
+    private Long componentClickCnt;
+    private Long estAdCostValue;
+    private Long estAdCostTime;
+    private Long estSalesValue;
+    private Long estSalesTime;
+    private Long iaaCostHour;
+    private Long iapCostHour;
+    private Long iosActivateCnt;
+    private Long likeCnt;
+    private String link;
+
+    private Long playValue;
+    private Long playTime;
+
+    private Long playVv;
+    private Long promoteCnt;
+    private Long providerId;
+    private Long releaseTime;
+    private Long relevanceAuditResult;
+    private Long rewardAmount;
+    private Long rewardLevel;
+
+    private Long settleAdShareValue;
+    private Long settleAdShareTime;
+
+    private Long settleCpsValue;
+    private Long settleCpsTime;
+
+    private Long shareCnt;
+    private String title;
+    private Long uid;
+    private Long validLikeCnt;
+    private Long validPlayVv;
+
+    private List<BytedanceXingTuReportDaily> itemInfoDailyList;
+}

+ 20 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/BytedanceXingTuReportDaily.java

@@ -0,0 +1,20 @@
+package cn.com.ctop.job.bytedance.data.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class BytedanceXingTuReportDaily {
+    private Long challengeTaskId;
+    private Long advertiserId;
+    private Long authorId;
+    private Long itemId;
+    private Integer pDate;
+    private Long estSales;
+    private Long settleCps;
+    private Long estAdCost;
+    private Long settleAdShare;
+}

+ 41 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/BytedanceXingTuTask.java

@@ -0,0 +1,41 @@
+package cn.com.ctop.job.bytedance.data.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class BytedanceXingTuTask {
+    private Long challengeTaskId;
+    private Long advertiserId;
+    // challenge_info fields
+    private Integer accountDivideDay;
+    private String anchorTitle;
+    private String authorList; // JSON string
+    private Integer authorScope;
+    private String authorTaskName;
+    private Integer budget;
+    private String commissionInfo; // JSON string
+    private Integer commissionRate;
+    private Integer commissionType;
+    private String demandDesc;
+    private Long endTime;
+    private Integer maxUploadItemCnt;
+    private String microAppId;
+    private Integer omTaskStatus;
+    private String omTaskTag; // JSON string (array)
+    private String participateAuthorRange; // JSON string
+    private Integer providerScope;
+    private Integer sampleDelivery;
+    private String settlementInfo; // JSON string
+    private String startPage;
+    private Long startTime;
+    private String taskHeadImage;
+    private String taskIcon;
+
+    // demand_info fields
+    private String demandName;
+    private String attachments; // JSON string
+}

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

@@ -12,4 +12,6 @@ public interface AdminAdvertiserListMapper {
     List<JSONObject> getAdvertiserInfos();
 
     void batchUpdateAdvertiserName(@Param("infos") List<JSONObject> infos);
+
+    List<JSONObject> getAdvertiserInfosByAdminIds();
 }

+ 28 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/BytedanceXingTuMapper.java

@@ -0,0 +1,28 @@
+package cn.com.ctop.job.bytedance.data.mapper;
+
+
+import cn.com.ctop.job.bytedance.data.entity.BytedanceXingTuReport;
+import cn.com.ctop.job.bytedance.data.entity.BytedanceXingTuReportDaily;
+import cn.com.ctop.job.bytedance.data.entity.BytedanceXingTuTask;
+import com.alibaba.fastjson.JSONObject;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface BytedanceXingTuMapper {
+    List<JSONObject> queryXingTuAccount(@Param("advertiserId") Long advertiserId);
+
+    List<JSONObject> queryXingTuActiveTask(@Param("advertiserId") Long advertiserId);
+
+    List<JSONObject> queryXingTuReportTask(@Param("advertiserId") Long advertiserId);
+
+    List<JSONObject> queryXingTuRetryJob();
+
+    void insertTaskId(List<BytedanceXingTuTask> tasks);
+
+    void updateTaskInfo(BytedanceXingTuTask task);
+
+    void insertReport(List<BytedanceXingTuReport> reports);
+
+    void insertReportDaily(List<BytedanceXingTuReportDaily> dailyReports);
+}

+ 10 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/CPSReportMapper.java

@@ -0,0 +1,10 @@
+package cn.com.ctop.job.bytedance.data.mapper;
+
+import org.apache.ibatis.annotations.Param;
+
+public interface CPSReportMapper {
+
+    boolean cleanCPSPayDailyReports(@Param("nowDate") Integer nowDate);
+
+    boolean cleanCPSIaaDailyReports(@Param("nowDate") Integer nowDate);
+}

+ 17 - 4
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/ReportsAdPushMapper.java

@@ -9,11 +9,24 @@ import java.util.Map;
 public interface ReportsAdPushMapper {
 
     List<JSONObject> selectUserList();
+    Map<String, String> allBusinessPushData(@Param("date") Long date);
+    List<Map<String, String>> allBusinessTopMovie(@Param("date") Long date);
+    JSONObject businessTypeData(@Param("date") Long date, @Param("businessTypes") List<Integer> businessTypes);
 
+
+    //给老板的
     Map<String, String> tmpPushData(@Param("date") Long date);
-    Map<String, String> tmpPushHourData(@Param("date") Long date, @Param("hour") String hour);
     List<Map<String, String>> tmpTopMovie(@Param("date") Long date);
+    //部门前后项数据排名
+    List<Map<String, String>> deptRank2(@Param("date") Long date);
+
+
+
+    //给投手的
+    Map<String, String> adDailyData(@Param("date") Long date);
+    Map<String, String> adHourData(@Param("date") Long date, @Param("hour") String hour);
 
+    List<JSONObject> todayTopMovie(@Param("date") Long date, @Param("hour") String hour);
     //所有优化师消耗排名
     List<Map<String, String>> optimizerCostRank(@Param("date") Long date, @Param("hour") String hour);
     //优化师当日数据
@@ -23,16 +36,16 @@ public interface ReportsAdPushMapper {
     //全部部门排行
     List<Map<String, String>> deptCostRank(@Param("date") Long date, @Param("hour") String hour);
 
+
+
     //漏绑账户预警
     List<Map<String, String>> unbindData(@Param("date") Long date, @Param("last90Day") Long last90Day,
                                          @Param("list") List<String> list);
-
     //错绑账户预警
     List<Map<String, String>> bindAppErrorData(@Param("last30Day") Long last30Day);
-    //部门前后项数据排名
-    List<Map<String, String>> deptRank2(@Param("date") Long date);
 
 
+    //剪辑
     List<Map<String, String>> cutDeptRank(@Param("date") Long date);
     List<Map<String, String>> cutUserRank(@Param("date") Long date, @Param("deptId") Long deptId);
     String updateTime(@Param("date") Long date);

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

@@ -39,4 +39,17 @@
         WHERE t1.media_type = 1
           AND t1.advertiser_name != t2.advertiser_name
     </select>
+    <select id="getAdvertiserInfosByAdminIds" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT *
+        FROM (SELECT t1.advertiser_id AS 'advertiserId', t3.access_token AS 'accessToken'
+              FROM (SELECT advertiser_id
+                    FROM media_api.bytedance_advertiser_report_hour
+                    WHERE stat_time_day >= 20250601
+                      AND stat_time_day &lt;= 20250603
+                    GROUP BY advertiser_id) t1
+                       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) t
+        WHERE t.advertiserId IS NOT NULL
+
+    </select>
 </mapper>

+ 8 - 4
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/BytedanceAccountReportMapper.xml

@@ -28,7 +28,8 @@
         attribution_billing_game_in_app_ltv_1day,
         attribution_micro_game_0d_ltv,
         attribution_micro_game_3d_ltv,
-        attribution_micro_game_7d_ltv
+        attribution_micro_game_7d_ltv,
+        stat_micro_game_0d_amount
         )
         values
         <foreach collection="list" item="item" separator=",">
@@ -57,7 +58,8 @@
             #{item.attributionBillingGameInAppLtv1day},
             #{item.attributionMicroGame0dLtv},
             #{item.attributionMicroGame3dLtv},
-            #{item.attributionMicroGame7dLtv}
+            #{item.attributionMicroGame7dLtv},
+            #{item.statMicroGame0dAmount}
             )
         </foreach>
     </insert>
@@ -86,7 +88,8 @@
         attribution_billing_game_in_app_ltv_1day,
         attribution_micro_game_0d_ltv,
         attribution_micro_game_3d_ltv,
-        attribution_micro_game_7d_ltv
+        attribution_micro_game_7d_ltv,
+        stat_micro_game_0d_amount
         )
         values
         <foreach collection="list" item="item" separator=",">
@@ -114,7 +117,8 @@
             #{item.attributionBillingGameInAppLtv1day},
             #{item.attributionMicroGame0dLtv},
             #{item.attributionMicroGame3dLtv},
-            #{item.attributionMicroGame7dLtv}
+            #{item.attributionMicroGame7dLtv},
+            #{item.statMicroGame0dAmount}
             )
         </foreach>
 

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

@@ -78,7 +78,9 @@
         params,
         url,
         promotion_create_time,
-        promotion_modify_time
+        promotion_modify_time,
+        playlet_series_url_list,
+        status_first
         )
         values
         <foreach collection="list" item="item" separator=",">
@@ -91,7 +93,9 @@
             #{item.params},
             #{item.url},
             #{item.promotion_create_time},
-            #{item.promotion_modify_time}
+            #{item.promotion_modify_time},
+            #{item.playlet_series_url_list},
+            #{item.status_first}
             )
         </foreach>
     </insert>

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

@@ -91,6 +91,7 @@
         (select video_id from thirtpart.ly_third_videos where platform=2 and submission_status=2
         and video_id in (select video_id from thirtpart.ly_video_audit_records where audit_status=2))
         and id in (select video_id from thirtpart.ly_third_videos where platform=1)
+        and id not in (select ly_video_id from deepthink.bytedance_upload_album)
     </select>
     <select id="getDeveloperAccount" resultType="com.alibaba.fastjson.JSONObject">
         select app_id, secret as app_secret from deepthink.bytedance_auth_config where auth_status=1 limit 1

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

@@ -63,8 +63,8 @@
         attribution_billing_game_in_app_ltv_1day,
         attribution_micro_game_0d_ltv,
         attribution_micro_game_3d_ltv,
-        attribution_micro_game_7d_ltv
-
+        attribution_micro_game_7d_ltv,
+        stat_micro_game_0d_amount
         )
         values
         <foreach collection="list" item="item" separator=",">
@@ -97,7 +97,8 @@
             #{item.attributionBillingGameInAppLtv1day},
             #{item.attributionMicroGame0dLtv},
             #{item.attributionMicroGame3dLtv},
-            #{item.attributionMicroGame7dLtv}
+            #{item.attributionMicroGame7dLtv},
+            #{item.statMicroGame0dAmount}
             )
         </foreach>
     </insert>
@@ -132,7 +133,8 @@
         attribution_billing_game_in_app_ltv_1day,
         attribution_micro_game_0d_ltv,
         attribution_micro_game_3d_ltv,
-        attribution_micro_game_7d_ltv
+        attribution_micro_game_7d_ltv,
+        stat_micro_game_0d_amount
         )
         values
         <foreach collection="list" item="item" separator=",">
@@ -164,7 +166,8 @@
             #{item.attributionBillingGameInAppLtv1day},
             #{item.attributionMicroGame0dLtv},
             #{item.attributionMicroGame3dLtv},
-            #{item.attributionMicroGame7dLtv}
+            #{item.attributionMicroGame7dLtv},
+            #{item.statMicroGame0dAmount}
             )
         </foreach>
     </insert>

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

@@ -0,0 +1,138 @@
+<?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" >
+<mapper namespace="cn.com.ctop.job.bytedance.data.mapper.BytedanceXingTuMapper">
+    <insert id="insertTaskId" parameterType="java.util.List">
+        INSERT ignore INTO media_api.bytedance_xingtu_task_list (challenge_task_id,advertiser_id)
+        VALUES
+        <foreach collection="list" item="item" separator=",">
+            (#{item.challengeTaskId},#{item.advertiserId})
+        </foreach>
+    </insert>
+
+    <insert id="insertReport"  parameterType="java.util.List">
+        replace INTO media_api.bytedance_xingtu_task_report (
+        challenge_task_id,advertiser_id,
+        android_activate_cnt, author_id, author_nickname, comment_cnt, component_click_cnt,
+        est_ad_cost_value, est_ad_cost_time, est_sales_value, est_sales_time,
+        iaa_cost_hour, iap_cost_hour, ios_activate_cnt, item_id,
+        like_cnt, link, play_value, play_time, play_vv, promote_cnt,
+        provider_id, release_time, relevance_audit_result, reward_amount, reward_level,
+        settle_ad_share_value, settle_ad_share_time, settle_cps_value, settle_cps_time,
+        share_cnt, title, uid, valid_like_cnt, valid_play_vv
+        )
+        VALUES
+        <foreach collection="list" item="item" separator=",">
+            (
+            #{item.challengeTaskId}, #{item.advertiserId},
+            #{item.androidActivateCnt}, #{item.authorId}, #{item.authorNickname},
+            #{item.commentCnt}, #{item.componentClickCnt},
+            #{item.estAdCostValue}, #{item.estAdCostTime},
+            #{item.estSalesValue}, #{item.estSalesTime},
+            #{item.iaaCostHour}, #{item.iapCostHour}, #{item.iosActivateCnt}, #{item.itemId},
+            #{item.likeCnt}, #{item.link}, #{item.playValue}, #{item.playTime}, #{item.playVv},
+            #{item.promoteCnt}, #{item.providerId}, #{item.releaseTime}, #{item.relevanceAuditResult},
+            #{item.rewardAmount}, #{item.rewardLevel},
+            #{item.settleAdShareValue}, #{item.settleAdShareTime},
+            #{item.settleCpsValue}, #{item.settleCpsTime},
+            #{item.shareCnt}, #{item.title}, #{item.uid},
+            #{item.validLikeCnt}, #{item.validPlayVv}
+            )
+        </foreach>
+    </insert>
+
+    <insert id="insertReportDaily" parameterType="java.util.List">
+        replace INTO media_api.bytedance_xingtu_task_report_daily (
+        challenge_task_id,advertiser_id,author_id,
+        item_id, p_date, est_sales, settle_cps, est_ad_cost, settle_ad_share
+        )
+        VALUES
+        <foreach collection="list" item="daily" separator=",">
+            (
+            #{daily.challengeTaskId}, #{daily.advertiserId}, #{daily.authorId},
+            #{daily.itemId}, #{daily.pDate}, #{daily.estSales},
+            #{daily.settleCps}, #{daily.estAdCost}, #{daily.settleAdShare}
+            )
+        </foreach>
+    </insert>
+
+    <update id="updateTaskInfo" parameterType="cn.com.ctop.job.bytedance.data.entity.BytedanceXingTuTask">
+        UPDATE media_api.bytedance_xingtu_task_list
+        <set>
+            <if test="accountDivideDay != null">account_divide_day = #{accountDivideDay},</if>
+            <if test="anchorTitle != null">anchor_title = #{anchorTitle},</if>
+            <if test="authorList != null">author_list = #{authorList},</if>
+            <if test="authorScope != null">author_scope = #{authorScope},</if>
+            <if test="authorTaskName != null">author_task_name = #{authorTaskName},</if>
+            <if test="budget != null">budget = #{budget},</if>
+            <if test="commissionInfo != null">commission_info = #{commissionInfo},</if>
+            <if test="commissionRate != null">commission_rate = #{commissionRate},</if>
+            <if test="commissionType != null">commission_type = #{commissionType},</if>
+            <if test="demandDesc != null">demand_desc = #{demandDesc},</if>
+            <if test="endTime != null">end_time = #{endTime},</if>
+            <if test="maxUploadItemCnt != null">max_upload_item_cnt = #{maxUploadItemCnt},</if>
+            <if test="microAppId != null">micro_app_id = #{microAppId},</if>
+            <if test="omTaskStatus != null">om_task_status = #{omTaskStatus},</if>
+            <if test="omTaskTag != null">om_task_tag = #{omTaskTag},</if>
+            <if test="participateAuthorRange != null">participate_author_range = #{participateAuthorRange},</if>
+            <if test="providerScope != null">provider_scope = #{providerScope},</if>
+            <if test="sampleDelivery != null">sample_delivery = #{sampleDelivery},</if>
+            <if test="settlementInfo != null">settlement_info = #{settlementInfo},</if>
+            <if test="startPage != null">start_page = #{startPage},</if>
+            <if test="startTime != null">start_time = #{startTime},</if>
+            <if test="taskHeadImage != null">task_head_image = #{taskHeadImage},</if>
+            <if test="taskIcon != null">task_icon = #{taskIcon},</if>
+            <if test="demandName != null">demand_name = #{demandName},</if>
+            <if test="attachments != null">attachments = #{attachments},</if>
+        </set>
+        WHERE challenge_task_id = #{challengeTaskId}
+        and advertiser_id = #{advertiserId}
+    </update>
+
+    <select id="queryXingTuAccount" resultType="com.alibaba.fastjson.JSONObject">
+        select x.advertiser_id, access_token
+        from deepthink.bytedance_xingtu_advertiser_list x
+        join deepthink.bytedance_auth_list a on x.admin_advertiser_id = a.admin_advertiser_id
+        <if test="advertiserId != null">
+            where x.advertiser_id = ${advertiserId}
+        </if>
+    </select>
+
+    <select id="queryXingTuActiveTask" resultType="com.alibaba.fastjson.JSONObject">
+        select t.advertiser_id,challenge_task_id task_id,access_token
+        from media_api.bytedance_xingtu_task_list t
+        join deepthink.bytedance_xingtu_advertiser_list x
+        on t.advertiser_id = x.advertiser_id
+        join deepthink.bytedance_auth_list a
+        on x.admin_advertiser_id = a.admin_advertiser_id
+        where (t.om_task_status is null or t.om_task_status not in (6,7,8))
+        <if test="advertiserId != null">
+            and t.advertiser_id = ${advertiserId}
+        </if>
+    </select>
+
+    <select id="queryXingTuReportTask" resultType="com.alibaba.fastjson.JSONObject">
+        select t.advertiser_id,challenge_task_id task_id,access_token
+        from media_api.bytedance_xingtu_task_list t
+        join deepthink.bytedance_xingtu_advertiser_list x
+        on t.advertiser_id = x.advertiser_id
+        join deepthink.bytedance_auth_list a
+        on x.admin_advertiser_id = a.admin_advertiser_id
+        where (t.om_task_status not in (1,2,4) or t.om_task_status is null)
+        and (t.end_time is null or t.end_time >= unix_timestamp(date_add(now(),Interval -65 day)))
+        <if test="advertiserId != null">
+            and t.advertiser_id = ${advertiserId}
+        </if>
+    </select>
+
+
+    <select id="queryXingTuRetryJob" resultType="com.alibaba.fastjson.JSONObject">
+        select is_send AS 'isSend', id AS 'id', start_date AS 'startDate', end_date AS 'endDate',l.msg,
+                l.advertiser_id AS 'advertiserId',data_dimension AS 'dataDimension', data_type AS 'dataType',access_token AS 'accessToken'
+        from media_api.bytedance_error_log l
+         join deepthink.bytedance_xingtu_advertiser_list x
+              on l.advertiser_id = x.advertiser_id
+         join deepthink.bytedance_auth_list a
+              on x.admin_advertiser_id = a.admin_advertiser_id
+        where data_dimension like 'xingtu_task_%'
+    </select>
+</mapper>

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

@@ -0,0 +1,175 @@
+<?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" >
+<mapper namespace="cn.com.ctop.job.bytedance.data.mapper.CPSReportMapper">
+
+    <insert id="cleanCPSPayDailyReports">
+        replace
+        into thirtpart.cps_link_data_report
+        (stat_date,
+        official_account_id,
+        responsibility_person_id,
+        ma_appid,
+        link_id,
+        new_users,
+        new_pay_users,
+        new_pay_counts,
+        new_order_counts,
+        new_pay_amount,
+        new_xn_pay_amount,
+        pay_amount,
+        xn_pay_amount,
+        pay_users,
+        pay_counts,
+        order_counts
+        )
+        SELECT t3.date,
+               t0.official_account_id,
+               t0.responsibility_person_id,
+               t2.app_id,
+               t0.id,
+               t3.new_users,
+               t1.new_pay_users,
+               t1.new_pay_counts,
+               t1.new_order_counts,
+               t1.new_pay_amount,
+               t1.new_xn_pay_amount,
+               t1.pay_amount,
+               t1.xn_pay_amount,
+               t1.pay_users,
+               t1.pay_counts,
+               t1.order_counts
+        FROM (SELECT DATE_FORMAT(activation_time, '%Y%m%d') as 'date', link_id,
+                     count(DISTINCT uid) AS 'new_users'
+              FROM thirtpart.ly_user_activation_info
+              WHERE DATE_FORMAT(activation_time, '%Y%m%d') = #{nowDate}
+              GROUP BY link_id) t3
+                 LEFT JOIN thirtpart.ly_link t0 ON t0.id = t3.link_id
+                 LEFT JOIN (SELECT consume_date,
+
+                                   link_id,
+
+                                   count(DISTINCT CASE
+                                                      WHEN t1.consume_date =
+                                                           DATE_FORMAT(t1.activation_time, '%Y%m%d') AND t1.STATUS = 1
+                                                          THEN t1.uid END) AS 'new_pay_users', SUM(IF(
+                        t1.consume_date = DATE_FORMAT(t1.activation_time, '%Y%m%d') AND t1.STATUS = 1, 1,
+                        0)) AS 'new_pay_counts', SUM(IF(t1.consume_date = DATE_FORMAT(t1.activation_time, '%Y%m%d'), 1,
+                                                        0)) AS 'new_order_counts', IFNULL( ROUND(
+                        SUM(IF(t1.consume_date = DATE_FORMAT(t1.activation_time, '%Y%m%d') AND t1.STATUS = 1,
+                               t1.total_fee, 0)), 2),0.00 ) AS 'new_pay_amount', IFNULL(ROUND(SUM(IF(
+                        t1.consume_date = DATE_FORMAT(t1.activation_time, '%Y%m%d') AND t1.STATUS = 1 AND
+                        (t1.pay_merchant = 15 OR pay_type = 20), total_fee, 0)),
+                                                                                              2),0.00 ) AS 'new_xn_pay_amount', IFNULL( ROUND(SUM(if(t1.STATUS = 1, t1.total_fee, 0)), 2), 0.00 ) AS 'pay_amount', IFNULL( ROUND(
+                        SUM(IF(t1.STATUS = 1 AND (t1.pay_merchant = 15 OR pay_type = 20), total_fee, 0)),
+                        2), 0.00 ) AS 'xn_pay_amount', count(DISTINCT CASE WHEN t1.STATUS = 1 THEN t1.uid END ) AS 'pay_users', SUM(IF(t1.STATUS = 1, 1, 0)) AS 'pay_counts', count( t1.order_no ) AS 'order_counts'
+
+                            FROM thirtpart.ly_pay_record t1
+                            WHERE consume_date = #{nowDate}
+                            GROUP BY link_id) t1 ON t3.link_id = t1.link_id
+                 LEFT JOIN thirtpart.ly_official_accounts t2 ON t0.official_account_id = t2.id
+        WHERE official_account_id is not null
+        GROUP BY t3.link_id
+    </insert>
+
+    <insert id="cleanCPSIaaDailyReports">
+        replace
+        into thirtpart.cps_link_data_report
+        (
+                stat_date,
+                official_account_id,
+                responsibility_person_id,
+                ma_appid,
+                link_id,
+                new_users,
+                new_pay_users,
+                new_pay_counts,
+                new_order_counts,
+                new_pay_amount,
+                new_xn_pay_amount,
+                pay_amount,
+                xn_pay_amount,
+                pay_users,pay_counts,
+                order_counts,
+                new_iaa_users,
+                new_iaa_counts,
+                new_iaa_amount,
+                iaa_users,
+                iaa_counts,
+                iaa_amount,
+				active_users
+                )
+        SELECT IFNULL(t.date, t0.date),
+               tt.official_account_id,
+               tt.responsibility_person_id,
+               tt.app_id,
+               tt.id,
+               t1.new_users,
+               t3.new_pay_users,
+               t3.new_pay_counts,
+               t3.new_order_counts,
+               t3.new_pay_amount,
+               t3.new_xn_pay_amount,
+               t3.pay_amount,
+               t3.xn_pay_amount,
+               t3.pay_users,
+               t3.pay_counts,
+               t3.order_counts,
+               t0.new_iaa_users,
+               t0.new_iaa_counts,
+               t0.new_iaa_amount,
+               t0.iaa_users,
+               t0.iaa_counts,
+               t0.iaa_amount,
+               t.active_users
+        FROM (SELECT t0.id,
+                     t0.responsibility_person_id,
+                     t0.official_account_id,
+                     t2.app_id
+              FROM thirtpart.ly_link t0
+                       LEFT JOIN thirtpart.ly_official_accounts t2 ON t0.official_account_id = t2.id) tt
+                 LEFT JOIN
+             (SELECT t.date, t.link_id, COUNT(DISTINCT t.uid) as 'active_users'
+              FROM thirtpart.ly_user_login_record t
+              where date = #{nowDate}
+                AND link_id
+                  >0
+              GROUP BY link_id) t ON tt.id = t.link_id
+                 LEFT JOIN
+             (SELECT t.stat_date as 'date', t.link_id,
+                     count(distinct case
+                                        when SUBSTR(dying_time, 1, 10) = SUBSTR(event_time, 1, 10)
+                                            then uid end) 'new_iaa_users', sum(if(SUBSTR(dying_time, 1, 10) = SUBSTR(event_time, 1, 10), 1, 0)) 'new_iaa_counts', IFNULL(ROUND(
+                             sum(if(SUBSTR(dying_time, 1, 10) = SUBSTR(event_time, 1, 10), cost / 100000, 0)),
+                             2),0.00) 'new_iaa_amount', count(distinct uid) 'iaa_users', sum(1) 'iaa_counts', IFNULL(ROUND(sum(cost / 100000), 2),0.00) 'iaa_amount'
+              FROM media_api.bytedance_webhook_ma_ecpm t
+                       LEFT JOIN thirtpart.ly_link t0 ON t.link_id = t0.id
+              where t.stat_date = #{nowDate}
+              GROUP BY t.link_id
+              ORDER BY t.link_id) t0 ON tt.id = t0.link_id
+                 LEFT JOIN (SELECT t0.id,
+                                   DATE_FORMAT(t.activation_time, '%Y%m%d') as 'date', t0.official_account_id,
+                                   t0.responsibility_person_id,
+                                   count(DISTINCT t.uid) AS 'new_users'
+                            FROM thirtpart.ly_user_activation_info t
+                                     LEFT JOIN thirtpart.ly_link t0 ON t.link_id = t0.id
+                            WHERE DATE_FORMAT(t.activation_time, '%Y%m%d') = #{nowDate}
+                            GROUP BY t0.id) t1 ON tt.id = t1.id
+                 LEFT JOIN
+             (SELECT link_id,
+                     new_pay_users,
+                     new_pay_counts,
+                     new_order_counts,
+                     new_pay_amount,
+                     new_xn_pay_amount,
+                     pay_amount,
+                     xn_pay_amount,
+                     pay_users,
+                     pay_counts,
+                     order_counts
+              FROM thirtpart.cps_link_data_report
+              WHERE stat_date = #{nowDate}) t3 ON t3.link_id = tt.id
+        WHERE t0.iaa_amount is not null
+        GROUP BY tt.id
+    </insert>
+
+</mapper>

+ 146 - 19
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/ReportsAdPushMapper.xml

@@ -18,15 +18,15 @@
         from
         (select sum(cost_amount) as cost_amount, sum(real_cost_amount) as real_cost_amount, max(update_time) as update_time
         from application.media_ad_report_daily
-        where stat_date = #{date}
+        where stat_date = #{date} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
         ) tb1,
         (select sum(pay_amount) as pay_amount, sum(iaa_amount) as iaa_amount,
         sum(share_iaa_amount) as share_iaa_amount, sum(share_pay_amount) as share_pay_amount
         from application.user_data_report_daily
-        where stat_date = #{date}
+        where stat_date = #{date} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
         ) tb2
     </select>
-    <select id="tmpPushHourData" resultType="java.util.Map">
+    <select id="adHourData" resultType="java.util.Map">
         select concat(round(if(ifnull(sum(cost_amount),0)=0, 0, (ifnull(sum(iaa_amount),0)+ifnull(sum(pay_amount), 0))/sum(cost_amount)*100 ), 2), '%') AS water_roi,
         concat(round(if(ifnull(sum(real_cost_amount),0)=0, 0, (ifnull(sum(share_iaa_amount),0)+ifnull(sum(share_pay_amount),0))/sum(real_cost_amount)*100), 2), '%') AS real_roi,
         ifnull(sum(cost_amount),0) AS cost_amount,
@@ -38,12 +38,12 @@
         from
         (select sum(cost_amount) as cost_amount, sum(real_cost_amount) as real_cost_amount
         from application.media_ad_report_hourly
-        where stat_date = #{date} and `hour`= #{hour}
+        where stat_date = #{date} and `hour`= #{hour} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
         ) tb1,
         (select sum(pay_amount) as pay_amount, sum(iaa_amount) as iaa_amount,
         sum(share_iaa_amount) as share_iaa_amount, sum(share_pay_amount) as share_pay_amount
         from application.user_data_report_hourly
-        where stat_date = #{date} and `hour`= #{hour}
+        where stat_date = #{date} and `hour`= #{hour} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
         ) tb2
     </select>
     <select id="tmpTopMovie" resultType="java.util.Map">
@@ -53,17 +53,18 @@
         concat(round(if(ifnull(sum(cost_amount),0)=0, 0, sum(end_amount)/sum(cost_amount)*100), 2), '%') AS water_roi,
         concat(round(if(ifnull(sum(real_cost_amount),0)=0, 0, sum(share_end_amount)/sum(real_cost_amount)*100), 2), '%') AS real_roi
         from
-        (select product_id from application.media_product_report_daily where stat_date=${date}
-        union select movie_id from application.user_data_report_daily where stat_date=${date}) tb1
+        (select product_id from application.media_product_report_daily where stat_date=${date} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
+        union select movie_id from application.user_data_report_daily where stat_date=${date} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
+        ) tb1
         left join
         (select product_id, round(ifnull(sum(cost_amount),0),2) as cost_amount, sum(real_cost_amount) as real_cost_amount
-        from application.media_product_report_daily where stat_date=${date}
+        from application.media_product_report_daily where stat_date=${date} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
         group by product_id
         ) tb2 on tb1.product_id=tb2.product_id
         left join
         (select movie_id, ifnull(sum(iaa_amount), 0) + ifnull(sum(pay_amount), 0) as end_amount,
         ifnull(sum(share_iaa_amount), 0) + ifnull(sum(share_pay_amount), 0) as share_end_amount
-        from application.user_data_report_daily where stat_date=${date}
+        from application.user_data_report_daily where stat_date=${date} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
         group by movie_id
         ) tb3 on tb1.product_id=tb3.movie_id
         left join
@@ -75,6 +76,64 @@
         limit 10
     </select>
 
+    <select id="adDailyData" resultType="java.util.Map">
+        select concat(round(if(ifnull(sum(cost_amount),0)=0, 0, (ifnull(sum(iaa_amount),0)+ifnull(sum(pay_amount), 0))/sum(cost_amount)*100 ), 2), '%') AS water_roi,
+        concat(round(if(ifnull(sum(real_cost_amount),0)=0, 0, (ifnull(sum(share_iaa_amount),0)+ifnull(sum(share_pay_amount),0))/sum(real_cost_amount)*100), 2), '%') AS real_roi,
+        ifnull(sum(cost_amount),0) AS cost_amount,
+        round(ifnull(sum(pay_amount), 0), 2) AS pay_amount,
+        ifnull(sum(share_iaa_amount), 0) as share_iaa_amount,
+        ifnull(sum(share_iaa_amount), 0) + ifnull(sum(share_pay_amount), 0) - ifnull(round(sum(real_cost_amount), 2), 0) AS real_profit,
+        ifnull(sum(iaa_amount), 0) + ifnull(sum(pay_amount), 0) - ifnull(sum(cost_amount), 0) AS water_profit,
+        ifnull(sum(share_iaa_amount), 0) + ifnull(sum(share_pay_amount), 0) as end_amount,
+        date_format(update_time, '%Y-%m-%d %H:%i:%s') as update_time
+        from
+        (select sum(cost_amount) as cost_amount, sum(real_cost_amount) as real_cost_amount, max(update_time) as update_time
+        from application.media_ad_report_daily
+        where stat_date = #{date} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
+        ) tb1,
+        (select sum(pay_amount) as pay_amount, sum(iaa_amount) as iaa_amount,
+        sum(share_iaa_amount) as share_iaa_amount, sum(share_pay_amount) as share_pay_amount
+        from application.user_data_report_daily
+        where stat_date = #{date} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
+        ) tb2
+    </select>
+
+    <select id="todayTopMovie" resultType="com.alibaba.fastjson.JSONObject" >
+        select tb4.standard_movie_id,
+        tb4.standard_movie_name as movie_name,
+        group_concat(distinct case tb4.movie_source when 2 then 2 else 1 end) as movie_source,
+        sum(share_end_amount) as share_end_amount, sum(end_amount) as end_amount,
+        sum(cost_amount) as cost_amount, sum(real_cost_amount) as real_cost_amount,
+        concat(round(if(ifnull(sum(cost_amount),0)=0, 0, sum(end_amount)/sum(cost_amount)*100), 2), '%') AS water_roi,
+        concat(round(if(ifnull(sum(real_cost_amount),0)=0, 0, sum(share_end_amount)/sum(real_cost_amount)*100), 2), '%') AS real_roi,
+        round(ifnull(sum(hour_cost_amount), 0), 2) as hour_cost_amount
+        from
+        (select product_id from application.media_product_report_daily where stat_date=${date} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
+        union select movie_id from application.user_data_report_daily where stat_date=${date} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))) tb1
+        left join
+        (select product_id, round(ifnull(sum(cost_amount),0),2) as cost_amount, sum(real_cost_amount) as real_cost_amount
+        from application.media_product_report_daily where stat_date=${date} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
+        group by product_id
+        ) tb2 on tb1.product_id=tb2.product_id
+        left join
+        (select movie_id, ifnull(sum(iaa_amount), 0) + ifnull(sum(pay_amount), 0) as end_amount,
+        ifnull(sum(share_iaa_amount), 0) + ifnull(sum(share_pay_amount), 0) as share_end_amount
+        from application.user_data_report_daily where stat_date=${date} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
+        group by movie_id
+        ) tb3 on tb1.product_id=tb3.movie_id
+        left join
+        (select moive_id, standard_movie_id, standard_movie_name, movie_source from deepthink.all_moive
+        ) tb4 on tb1.product_id=tb4.moive_id
+        left join
+        (select product_id, ifnull(sum(cost_amount), 0) as hour_cost_amount from application.media_product_report_hourly
+        where stat_date=${date} and `hour`=${hour}  and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
+        group by product_id) tb5 on tb1.product_id=tb5.product_id
+        where 1=1 and tb1.product_id != '-9999'
+        group by tb4.standard_movie_name
+        order by sum(end_amount) desc
+        limit 10
+    </select>
+
 
     <select id="optimizerCostRank" resultType="java.util.Map">
         select tb1.user_id, tb4.phonenumber, tb4.nick_name, tb4.dept_id, tb5.dept_name,
@@ -84,10 +143,12 @@
         from
         (select cast(advertiser_id as char) advertiser_id, user_id from deepthink.advertiser_bind_info) tb1
         left join (select advertiser_id, sum(cost_amount) as cost_amount, sum(real_cost_amount) as real_cost_amount
-        from application.media_ad_report_daily where stat_date=#{date} group by advertiser_id) tb2
+        from application.media_ad_report_daily where stat_date=#{date}  and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
+        group by advertiser_id) tb2
         on tb1.advertiser_id = tb2.advertiser_id
         left join (select advertiser_id, sum(share_iaa_amount) as share_iaa_amount, sum(share_pay_amount) as share_pay_amount
-        from application.user_data_report_daily where stat_date=#{date} group by advertiser_id) tb3
+        from application.user_data_report_daily where stat_date=#{date}  and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
+        group by advertiser_id) tb3
         on tb1.advertiser_id = tb3.advertiser_id
         left join (select user_id, nick_name, phonenumber, dept_id from deepthink.sys_user) tb4
         on tb1.user_id=tb4.user_id
@@ -110,13 +171,13 @@
         left join
         (select advertiser_id, sum(cost_amount) as cost_amount, sum(real_cost_amount) as real_cost_amount, max(update_time) as update_time
         from application.media_ad_report_daily
-        where stat_date = #{date}
+        where stat_date = #{date} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
         group by advertiser_id) tb2 on tb1.advertiser_id = tb2.advertiser_id
         left join
         (select advertiser_id, sum(pay_amount) as pay_amount, sum(iaa_amount) as iaa_amount,
         sum(share_iaa_amount) as share_iaa_amount, sum(share_pay_amount) as share_pay_amount
         from application.user_data_report_daily
-        where stat_date = #{date}
+        where stat_date = #{date} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
         group by advertiser_id) tb3 on tb1.advertiser_id = tb3.advertiser_id
         left join (select user_id, nick_name, phonenumber, dept_id from deepthink.sys_user) tb4
         on tb1.user_id=tb4.user_id
@@ -135,13 +196,13 @@
         left join
         (select advertiser_id, sum(cost_amount) as cost_amount, sum(real_cost_amount) as real_cost_amount, max(update_time) as update_time
         from application.media_ad_report_hourly
-        where stat_date = #{date} and `hour`= #{hour}
+        where stat_date = #{date} and `hour`= #{hour} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
         group by advertiser_id) tb2 on tb1.advertiser_id = tb2.advertiser_id
         left join
         (select advertiser_id, sum(pay_amount) as pay_amount, sum(iaa_amount) as iaa_amount,
         sum(share_iaa_amount) as share_iaa_amount, sum(share_pay_amount) as share_pay_amount
         from application.user_data_report_hourly
-        where stat_date = #{date} and `hour`= #{hour}
+        where stat_date = #{date} and `hour`= #{hour} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
         group by advertiser_id) tb3 on tb1.advertiser_id = tb3.advertiser_id
         left join (select user_id, nick_name, phonenumber from deepthink.sys_user) tb4
         on tb1.user_id=tb4.user_id
@@ -158,10 +219,12 @@
         from
         (select cast(advertiser_id as char) advertiser_id, user_id from deepthink.advertiser_bind_info) tb1
         left join (select advertiser_id, sum(cost_amount) as cost_amount, sum(real_cost_amount) as real_cost_amount
-        from application.media_ad_report_daily where stat_date=#{date} group by advertiser_id) tb2
+        from application.media_ad_report_daily where stat_date=#{date}  and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
+        group by advertiser_id) tb2
         on tb1.advertiser_id = tb2.advertiser_id
         left join (select advertiser_id, sum(cost_amount) as cost_amount_hour
-        from application.media_ad_report_hourly where stat_date=#{date} and `hour`= ${hour} group by advertiser_id) tb3
+        from application.media_ad_report_hourly where stat_date=#{date} and `hour`= ${hour}  and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
+        group by advertiser_id) tb3
         on tb1.advertiser_id = tb3.advertiser_id
         left join (select user_id, nick_name, phonenumber, dept_id from deepthink.sys_user) tb4
         on tb1.user_id=tb4.user_id
@@ -244,10 +307,12 @@
         from
         (select cast(advertiser_id as char) advertiser_id, user_id from deepthink.advertiser_bind_info) tb1
         left join (select advertiser_id, sum(cost_amount) as cost_amount, sum(real_cost_amount) as real_cost_amount
-        from application.media_ad_report_daily where stat_date=${date} group by advertiser_id) tb2
+        from application.media_ad_report_daily where stat_date=${date} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
+        group by advertiser_id) tb2
         on tb1.advertiser_id = tb2.advertiser_id
         left join (select advertiser_id, sum(share_iaa_amount) as share_iaa_amount, sum(share_pay_amount) as share_pay_amount
-        from application.user_data_report_daily where stat_date=${date} group by advertiser_id) tb3
+        from application.user_data_report_daily where stat_date=${date} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
+        group by advertiser_id) tb3
         on tb1.advertiser_id = tb3.advertiser_id
         left join (select user_id, nick_name, phonenumber, dept_id from deepthink.sys_user) tb4
         on tb1.user_id=tb4.user_id
@@ -286,4 +351,66 @@
         on b.dept_id=c.dept_id
         where stat_datetime=${date} and b.dept_id=${deptId}
     </select>
+    <select id="allBusinessPushData" resultType="java.util.Map">
+        select concat(round(if(ifnull(sum(cost_amount),0)=0, 0, (ifnull(sum(iaa_amount),0)+ifnull(sum(pay_amount), 0))/sum(cost_amount)*100 ), 2), '%') AS water_roi,
+        concat(round(if(ifnull(sum(real_cost_amount),0)=0, 0, (ifnull(sum(share_iaa_amount),0)+ifnull(sum(share_pay_amount),0))/sum(real_cost_amount)*100), 2), '%') AS real_roi,
+        ifnull(sum(cost_amount),0) AS cost_amount,
+        round(ifnull(sum(pay_amount), 0), 2) AS pay_amount,
+        ifnull(sum(share_iaa_amount), 0) as share_iaa_amount,
+        ifnull(sum(share_iaa_amount), 0) + ifnull(sum(share_pay_amount), 0) - ifnull(round(sum(real_cost_amount), 2), 0) AS real_profit,
+        ifnull(sum(iaa_amount), 0) + ifnull(sum(pay_amount), 0) - ifnull(sum(cost_amount), 0) AS water_profit,
+        ifnull(sum(share_iaa_amount), 0) + ifnull(sum(share_pay_amount), 0) as end_amount,
+        date_format(update_time, '%Y-%m-%d %H:%i:%s') as update_time
+        from
+        (select sum(cost_amount) as cost_amount, sum(real_cost_amount) as real_cost_amount, max(update_time) as update_time
+        from application.media_ad_report_daily
+        where stat_date = #{date}
+        ) tb1,
+        (select sum(pay_amount) as pay_amount, sum(iaa_amount) as iaa_amount,
+        sum(share_iaa_amount) as share_iaa_amount, sum(share_pay_amount) as share_pay_amount
+        from application.user_data_report_daily
+        where stat_date = #{date}
+        ) tb2
+    </select>
+    <select id="allBusinessTopMovie" resultType="java.util.Map">
+        select tb4.standard_movie_id, tb4.standard_movie_name as movie_name, group_concat(distinct case tb4.movie_source when 2 then 2 else 1 end) as movie_source,
+        rank() over (order by sum(end_amount) desc) as rk,
+        sum(share_end_amount) as share_end_amount, sum(end_amount) as end_amount,  sum(cost_amount) as cost_amount, sum(real_cost_amount) as real_cost_amount,
+        concat(round(if(ifnull(sum(cost_amount),0)=0, 0, sum(end_amount)/sum(cost_amount)*100), 2), '%') AS water_roi,
+        concat(round(if(ifnull(sum(real_cost_amount),0)=0, 0, sum(share_end_amount)/sum(real_cost_amount)*100), 2), '%') AS real_roi
+        from
+        (select product_id from application.media_product_report_daily where stat_date=${date}
+        union select movie_id from application.user_data_report_daily where stat_date=${date}
+        ) tb1
+        left join
+        (select product_id, round(ifnull(sum(cost_amount),0),2) as cost_amount, sum(real_cost_amount) as real_cost_amount
+        from application.media_product_report_daily where stat_date=${date}
+        group by product_id
+        ) tb2 on tb1.product_id=tb2.product_id
+        left join
+        (select movie_id, ifnull(sum(iaa_amount), 0) + ifnull(sum(pay_amount), 0) as end_amount,
+        ifnull(sum(share_iaa_amount), 0) + ifnull(sum(share_pay_amount), 0) as share_end_amount
+        from application.user_data_report_daily where stat_date=${date}
+        group by movie_id
+        ) tb3 on tb1.product_id=tb3.movie_id
+        left join
+        (select moive_id, standard_movie_id, standard_movie_name, movie_source from deepthink.all_moive
+        ) tb4 on tb1.product_id=tb4.moive_id
+        where 1=1 and tb1.product_id!='-9999'
+        group by tb4.standard_movie_name
+        order by sum(end_amount) desc
+        limit 10
+    </select>
+    <select id="businessTypeData" resultType="com.alibaba.fastjson.JSONObject">
+        select ifnull(sum(share_pay_amount),0) as iap_end_amount,
+        ifnull(sum(share_iaa_amount),0) as iaa_end_amount
+        from application.user_data_report_daily where stat_date=${date}
+        and ma_appid in
+        (select app_id from deepthink.mini_app_info where business_type in
+        <if test="businessTypes != null and businessTypes.size > 0">
+            <foreach item="item" index="index" collection="businessTypes" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>)
+    </select>
 </mapper>

+ 2 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/IAdminAdvertiserListService.java

@@ -12,4 +12,6 @@ public interface IAdminAdvertiserListService {
     List<JSONObject> getAdvertiserInfos();
 
     void batchUpdateAdvertiserName(List<JSONObject> infos);
+
+    List<JSONObject> getAdvertiserInfosByAdminIds();
 }

+ 16 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/IBytedanceXingTuService.java

@@ -0,0 +1,16 @@
+package cn.com.ctop.job.bytedance.data.service;
+
+import com.alibaba.fastjson.JSONObject;
+
+import java.util.List;
+
+public interface IBytedanceXingTuService {
+    List<JSONObject> getXingTuAccount(Long advertiserId);
+    List<JSONObject> getXingTuActiveTask(Long advertiserId);
+    List<JSONObject> getXingTuReportTask(Long advertiserId);
+    List<JSONObject> getXingTuRetryJob();
+    void getXingTuTaskList(Long advertiserId, String accessToken, String startDate, String endDate, Integer page,
+                           Long errorId, Integer isLog, Integer isSend);
+    void getXingTuTaskInfo(Long advertiserId, Long taskId, String accessToken, Long errorId, Integer isLog, Integer isSend);
+    void getXingTuTaskReport(Long advertiserId, Long taskId, String accessToken, Integer page, Long errorId, Integer isLog, Integer isSend);
+}

+ 6 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/ICPSReportService.java

@@ -0,0 +1,6 @@
+package cn.com.ctop.job.bytedance.data.service;
+
+public interface ICPSReportService {
+
+    void cleanCPSDailyReports(Integer nowDate);
+}

+ 2 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/IDateReportsPushService.java

@@ -9,4 +9,6 @@ public interface IDateReportsPushService {
     void preSend();
 
     public void send12hour();
+
+    void test();
 }

+ 1 - 1
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/IReportsAdPushService.java

@@ -4,5 +4,5 @@ public interface IReportsAdPushService {
 
     void send();
 
-    void preSend();
+    void test();
 }

+ 9 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/IReportsByBusinessPushService.java

@@ -0,0 +1,9 @@
+package cn.com.ctop.job.bytedance.data.service;
+
+public interface IReportsByBusinessPushService {
+
+    void send();
+
+    void preSend();
+    void test();
+}

+ 5 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/AdminAdvertiserListServiceImpl.java

@@ -111,6 +111,11 @@ public class AdminAdvertiserListServiceImpl implements IAdminAdvertiserListServi
         adminAdvertiserListMapper.batchUpdateAdvertiserName(infos);
     }
 
+    @Override
+    public List<JSONObject> getAdvertiserInfosByAdminIds() {
+        return adminAdvertiserListMapper.getAdvertiserInfosByAdminIds();
+    }
+
     // 分页结果包装类
     static class PageResult {
         private final int pageNumber;

+ 5 - 2
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/BytedanceCdpProjectServiceImpl.java

@@ -97,7 +97,6 @@ public class BytedanceCdpProjectServiceImpl implements IBytedanceCdpProjectServi
                 filtering.put("promotion_modify_time", date);
             }
             filtering.put("status_first", "PROMOTION_STATUS_ALL");
-
             params.put("filtering", filtering);
             params.put("page", page);
             params.put("page_size", 20);//最大20
@@ -142,6 +141,7 @@ public class BytedanceCdpProjectServiceImpl implements IBytedanceCdpProjectServi
     private void checkPromotionInfo(JSONObject entity) {
         JSONObject promotionMaterials = entity.getJSONObject("promotion_materials");
         if (!Check.isNull(promotionMaterials)) {
+            entity.put("playlet_series_url_list", promotionMaterials.getString("playlet_series_url_list"));
             JSONObject miniProgramInfo = promotionMaterials.getJSONObject("mini_program_info");
             if (!Check.isNull(miniProgramInfo)) {
                 entity.put("params", miniProgramInfo.getString("params"));
@@ -172,7 +172,10 @@ public class BytedanceCdpProjectServiceImpl implements IBytedanceCdpProjectServi
                 //不传默认返回不限(不含已删除)
                 filtering.put("status_first", "PROJECT_STATUS_DELETE");
             }
-            filtering.put("project_modify_time", date);
+            if(!Check.isNull(date)){
+                filtering.put("project_modify_time", date);
+            }
+
             params.put("filtering", filtering);
             params.put("page", page);
             params.put("page_size", 100);//最大100

+ 12 - 10
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/BytedanceProductUpdateServiceImpl.java

@@ -33,7 +33,7 @@ public class BytedanceProductUpdateServiceImpl implements IBytedanceProductUpdat
 
     @Override
     public void run() throws Exception {
-        List<String> errors = new ArrayList<>();
+        Set<String> errors = new HashSet<>();
         log.info("付费商品库更新中...");
         iapProductUpdate(errors);
         log.info("付费商品库更新完成");
@@ -41,8 +41,10 @@ public class BytedanceProductUpdateServiceImpl implements IBytedanceProductUpdat
         iaaProductUpdate(errors);
         log.info("免费商品库更新完成");
         if (!Check.isNull(errors)){
-            errors.add(0, "商品上传报错通知");
-            FeishuRobotUtil.sendTextToWebhook(StringUtils.join(errors, "\n"), HOOK_URL);
+            List<String> info = new ArrayList<>();
+            info.add("商品上传报错通知");
+            info.addAll(errors);
+            FeishuRobotUtil.sendTextToWebhook(StringUtils.join(info, "\n"), HOOK_URL);
         }
     }
 
@@ -153,7 +155,7 @@ public class BytedanceProductUpdateServiceImpl implements IBytedanceProductUpdat
      * 付费短剧更新
      * @param errorBlanket
      */
-    private void iapProductUpdate(List<String> errorBlanket){
+    private void iapProductUpdate(Set<String> errorBlanket){
         //IAP
         List<JSONObject> iapPlatformList = bytedanceProductUpdateMapper.getIAPPlatformList(); //商品库列表
         List<JSONObject> iapVideoList = bytedanceProductUpdateMapper.getIAPVideoList(); //剧目列表
@@ -213,7 +215,7 @@ public class BytedanceProductUpdateServiceImpl implements IBytedanceProductUpdat
      */
     private int uploadIapProduct(JSONObject platform, JSONObject album,
                                   Map<String, Map<String, String>> advertiserToLinkMap,
-                                  List<String> errorBlanket,
+                                  Set<String> errorBlanket,
                                   JSONObject productType){
         String url = "https://ad.oceanengine.com/open_api/2/dpa/product/update/";
         Map<String, String> headers = new HashMap<>();
@@ -289,7 +291,7 @@ public class BytedanceProductUpdateServiceImpl implements IBytedanceProductUpdat
         return code;
     }
 
-    private void iaaProductUpdate(List<String> errorBlanket){
+    private void iaaProductUpdate(Set<String> errorBlanket){
         //IAA
         List<JSONObject> iaaPlatformList = bytedanceProductUpdateMapper.getIAAPlatformList();
         List<JSONObject> iaaVideoList = bytedanceProductUpdateMapper.getIAAVideoList();
@@ -343,7 +345,7 @@ public class BytedanceProductUpdateServiceImpl implements IBytedanceProductUpdat
 
     private int uploadIaaProduct(JSONObject platform, JSONObject album, Map<String,
             Map<String, String>> advertiserToLinkMap,
-                                  List<String> errorBlanket,
+                                  Set<String> errorBlanket,
                                   JSONObject productType){
         String url = "https://ad.oceanengine.com/open_api/2/dpa/product/update/";
         Map<String, String> headers = new HashMap<>();
@@ -411,7 +413,7 @@ public class BytedanceProductUpdateServiceImpl implements IBytedanceProductUpdat
      * @param instanceId 字节小程序的实例ID
      * @return map key: album_id, value: 对应的字节小程序推广链接,sslocal开头
      */
-    private Map<String, String> getBytedancePlayletPromoteLink(String advertiserId, String accessToken, String instanceId, List<JSONObject> requests, List<String> errorBlanket){
+    private Map<String, String> getBytedancePlayletPromoteLink(String advertiserId, String accessToken, String instanceId, List<JSONObject> requests, Set<String> errorBlanket){
         JSONArray playletDetailInfo = getPlayletDetail(advertiserId, accessToken, instanceId, errorBlanket);
         if (playletDetailInfo == null || playletDetailInfo.isEmpty()){
             return null;
@@ -499,7 +501,7 @@ public class BytedanceProductUpdateServiceImpl implements IBytedanceProductUpdat
 
     }
 
-    private JSONArray getPlayletDetail(String advertiserId, String accessToken, String instanceId, List<String> errorBlanket) {
+    private JSONArray getPlayletDetail(String advertiserId, String accessToken, String instanceId, Set<String> errorBlanket) {
         String getPlayletDetailUrl = "https://api.oceanengine.com/open_api/v3.0/tools/asset_link/list/";
         getPlayletDetailUrl = getPlayletDetailUrl.replace("${ADVERTISER_ID}", advertiserId);
         getPlayletDetailUrl = getPlayletDetailUrl.replace("${INSTANCE_ID}", instanceId);
@@ -543,7 +545,7 @@ public class BytedanceProductUpdateServiceImpl implements IBytedanceProductUpdat
             return;
         }
         for (JSONObject vi : wxVideoInfos){
-            Long videoId = vi.getLong("video_id");
+            Long videoId = vi.getLong("id");
             String albumId = uploadAlbum(videoId, appId, appAccessToken);
             if (albumId == null){
                 info.add("上传短剧失败,videoId: " + videoId + ", 剧目名称: " + vi.getString("name"));

+ 1 - 2
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/BytedancePromoterReportServiceImpl.java

@@ -193,7 +193,6 @@ public class BytedancePromoterReportServiceImpl implements IBytedancePromoterRep
     }
 
 
-
     @Override
     public void getBytedancePromoterHour(Long advertiserId, String accessToken, String startDate, String endDate, Integer page, Integer isLog) {
         try {
@@ -373,7 +372,7 @@ public class BytedancePromoterReportServiceImpl implements IBytedancePromoterRep
                 }
                 getBytedancePromoterDaily(advertiserId, accessToken, startDate, endDate, page + 1, 1);
             } else {
-                log.info("账户ID:{},日期:{},广告日报(最细粒度)数据请求成功", advertiserId, startDate);
+                log.info("账户ID:{},开始日期:{},结束日期:{},广告日报(最细粒度)数据请求成功", advertiserId, startDate, endDate);
 
             }
         } catch (Exception e) {

+ 306 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/BytedanceXingTuServiceImpl.java

@@ -0,0 +1,306 @@
+package cn.com.ctop.job.bytedance.data.service.impl;
+
+import cn.com.ctop.job.bytedance.data.entity.BytedanceErrorLog;
+import cn.com.ctop.job.bytedance.data.entity.BytedanceXingTuReport;
+import cn.com.ctop.job.bytedance.data.entity.BytedanceXingTuReportDaily;
+import cn.com.ctop.job.bytedance.data.entity.BytedanceXingTuTask;
+import cn.com.ctop.job.bytedance.data.mapper.BytedancePromoterReportMapper;
+import cn.com.ctop.job.bytedance.data.mapper.BytedanceXingTuMapper;
+import cn.com.ctop.job.bytedance.data.service.IBytedanceXingTuService;
+import cn.com.ctop.job.bytedance.data.utils.AlertUtils;
+import cn.com.ctop.job.bytedance.data.utils.Check;
+import cn.com.ctop.job.bytedance.data.utils.DateUtils;
+import cn.com.ctop.job.bytedance.data.utils.HttpUtils;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * https://bytedance.larkoffice.com/docx/Jr8bdA6yvocOqRxRL1LcBDi8nJb
+ */
+@Service
+@Slf4j
+public class BytedanceXingTuServiceImpl implements IBytedanceXingTuService {
+    @Autowired
+    private BytedanceXingTuMapper bytedanceXingTuMapper;
+
+    @Autowired
+    private BytedancePromoterReportMapper promoterReportMapper;
+
+    @Override
+    public List<JSONObject> getXingTuAccount(Long advertiserId) {
+        return bytedanceXingTuMapper.queryXingTuAccount(advertiserId);
+    }
+
+    public List<JSONObject> getXingTuActiveTask(Long advertiserId) {
+        return bytedanceXingTuMapper.queryXingTuActiveTask(advertiserId);
+    }
+
+    public List<JSONObject> getXingTuReportTask(Long advertiserId) {
+        return bytedanceXingTuMapper.queryXingTuReportTask(advertiserId);
+    }
+
+    public List<JSONObject> getXingTuRetryJob() {
+        return bytedanceXingTuMapper.queryXingTuRetryJob();
+    }
+
+    public void getXingTuTaskList(Long advertiserId, String accessToken, String startDate, String endDate, Integer page,
+                                  Long errorId, Integer isLog, Integer isSend) {
+        try {
+            String url = "https://api.oceanengine.com/open_api/2/star/demand/om_get_demand_list/";
+            Map<String, Object> paramsMap = new HashMap<>();
+            paramsMap.put("star_id", advertiserId);
+            paramsMap.put("page_no", page);
+            int pageSize = 100;
+            paramsMap.put("page_size", pageSize);
+            Long startT = DateUtils.getTimestampFormat("yyyy-MM-dd HH:mm:ss", startDate + " 00:00:00");
+            Long endT = DateUtils.getTimestampFormat("yyyy-MM-dd HH:mm:ss", endDate + " 23:59:59");
+            paramsMap.put("create_start_time", startT);
+            paramsMap.put("create_end_time", endT);
+            Map<String, String> headers = new HashMap<>();
+            headers.put("Access-Token", accessToken);
+            headers.put("Content-Type", "application/json");
+            String s = HttpUtils.httpGet(url, paramsMap, headers);
+            JSONObject result = JSONObject.parseObject(s);
+            if (Check.isNull(result)) {
+                log.info("账户id:{},星图任务列表请求结果返回为空", advertiserId);
+                insertErrorLog(isLog, advertiserId, startDate, endDate, "xingtu_task_list", "请求结果返回为空");
+                return;
+            }
+            List<BytedanceXingTuTask> tasks = new ArrayList<>();
+            Integer code = result.getInteger("code");
+            boolean hasMore = false;
+            if (code == 0) {
+                JSONObject data = result.getJSONObject("data");
+                if (!Check.isNull(data)) {
+                    JSONArray rows = data.getJSONArray("demands");
+                    if (!Check.isNull(rows)) {
+                        hasMore = rows.size() == pageSize;
+                        for (int i = 0; i < rows.size(); i++) {
+                            JSONObject rowJson = rows.getJSONObject(i);
+                            Long demandId = rowJson.getLong("demand_id");
+                            BytedanceXingTuTask task = new BytedanceXingTuTask();
+                            task.setChallengeTaskId(demandId);
+                            task.setAdvertiserId(advertiserId);
+                            tasks.add(task);
+                        }
+                    }
+                }
+            } else {
+                log.info("账户id:{},日期:{}星图任务列表请求结果失败,返回数据:{}", advertiserId, startDate, result);
+                insertErrorLog(isLog, advertiserId, startDate, endDate, "xingtu_task_list", result.getString("message"));
+                return;
+            }
+            if (!Check.isNull(tasks)) {
+                bytedanceXingTuMapper.insertTaskId(tasks);
+                log.info("账户ID:{},星图任务列表请求成功,开始日期:{},结束日期:{},page:{}", advertiserId, startDate, endDate, page);
+            }
+            if (hasMore) {
+                getXingTuTaskList(advertiserId, accessToken, startDate, endDate, page + 1, errorId, isLog, isSend);
+            } else {
+                log.info("账户ID:{},日期:{}~{},星图任务列表请求成功", advertiserId, startDate, endDate);
+                if (errorId != null) {
+                    promoterReportMapper.deleteInfoByErrorId(errorId);
+                }
+                if (isSend != null && 1 == isSend) {
+                    AlertUtils.sendMessage(advertiserId, startDate, endDate, 1, "xingtu_task_list", 1, null);
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public void getXingTuTaskInfo(Long advertiserId, Long taskId, String accessToken, Long errorId, Integer isLog, Integer isSend) {
+        try {
+            String url = "https://api.oceanengine.com/open_api/2/star/demand/om_get_challenge/";
+            Map<String, Object> paramsMap = new HashMap<>();
+            paramsMap.put("star_id", advertiserId);
+            paramsMap.put("challenge_task_id", taskId);
+            Map<String, String> headers = new HashMap<>();
+            headers.put("Access-Token", accessToken);
+            headers.put("Content-Type", "application/json");
+            String s = HttpUtils.httpGet(url, paramsMap, headers);
+            JSONObject result = JSONObject.parseObject(s);
+            if (Check.isNull(result)) {
+                log.info("账户id:{} {},星图任务详情请求结果返回为空", advertiserId, taskId);
+                insertErrorLog(isLog, advertiserId, DateUtils.getNowDate("yyyy-MM-dd"), DateUtils.getNowDate("yyyy-MM-dd"), "xingtu_task_info",
+                        new JSONObject().fluentPut("msg", "请求结果返回为空").fluentPut("taskId", taskId).toJSONString());
+                return;
+            }
+            Integer code = result.getInteger("code");
+            if (code == 0) {
+                JSONObject data = result.getJSONObject("data");
+                if (!Check.isNull(data)) {
+                    JSONObject taskInfo = data.getJSONObject("task_info");
+                    if (!Check.isNull(taskInfo)) {
+                        JSONObject challengeInfo = taskInfo.getJSONObject("challenge_info");
+                        JSONObject demandInfo = taskInfo.getJSONObject("demand_info");
+                        String challengeTaskId = taskInfo.getString("challenge_task_id");
+                        JSONObject taskJson = new JSONObject();
+                        taskJson.put("challenge_task_id", challengeTaskId);
+                        taskJson.put("advertiser_id", advertiserId);
+                        taskJson.putAll(challengeInfo);
+                        taskJson.putAll(demandInfo);
+                        BytedanceXingTuTask task = taskJson.toJavaObject(BytedanceXingTuTask.class);
+                        bytedanceXingTuMapper.updateTaskInfo(task);
+                    }
+                }
+            } else {
+                log.info("账户id:{} {},星图任务详情请求结果失败,返回数据:{}", advertiserId, taskId, result);
+                insertErrorLog(isLog, advertiserId, DateUtils.getNowDate("yyyy-MM-dd"), DateUtils.getNowDate("yyyy-MM-dd"), "xingtu_task_info",
+                        new JSONObject().fluentPut("msg", result.getString("message")).fluentPut("taskId", taskId).toJSONString()
+                );
+                return;
+            }
+
+            log.info("账户ID:{} {},星图任务详情请求成功", advertiserId, taskId);
+            if (errorId != null) {
+                promoterReportMapper.deleteInfoByErrorId(errorId);
+            }
+            if (isSend != null && 1 == isSend) {
+                AlertUtils.sendMessage(advertiserId, DateUtils.getNowDate("yyyy-MM-dd"), DateUtils.getNowDate("yyyy-MM-dd"), 1, "xingtu_task_info", 1, null);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public void getXingTuTaskReport(Long advertiserId, Long taskId, String accessToken, Integer page, Long errorId, Integer isLog, Integer isSend) {
+        try {
+            String url = "https://api.oceanengine.com/open_api/2/star/demand/om_get_challenge_items_data/";
+            Map<String, Object> paramsMap = new HashMap<>();
+            paramsMap.put("star_id", advertiserId);
+            paramsMap.put("challenge_task_id", taskId);
+            paramsMap.put("page", page);
+            int limit = 30;
+            paramsMap.put("limit", limit);
+            Map<String, String> headers = new HashMap<>();
+            headers.put("Access-Token", accessToken);
+            headers.put("Content-Type", "application/json");
+            String s = HttpUtils.httpGet(url, paramsMap, headers);
+            JSONObject result = JSONObject.parseObject(s);
+            if (Check.isNull(result)) {
+                log.info("账户id:{} {},星图任务结算数据请求结果返回为空", advertiserId, taskId);
+                insertErrorLog(isLog, advertiserId, DateUtils.getNowDate("yyyy-MM-dd"), DateUtils.getNowDate("yyyy-MM-dd"), "xingtu_task_report",
+                        new JSONObject().fluentPut("msg", "请求结果返回为空").fluentPut("taskId", taskId).toJSONString());
+                return;
+            }
+            Integer code = result.getInteger("code");
+            boolean hasMore = false;
+            List<BytedanceXingTuReport> reports = new ArrayList<>();
+            List<BytedanceXingTuReportDaily> dailyReports = new ArrayList<>();
+            if (code == 0) {
+                JSONObject data = result.getJSONObject("data");
+                if (!Check.isNull(data)) {
+                    JSONArray dataList = data.getJSONArray("data_list");
+                    JSONObject pageInfo = data.getJSONObject("page_info");
+                    if (!Check.isNull(pageInfo)) {
+                        hasMore = pageInfo.getBoolean("has_more");
+                    }
+                    if (!Check.isNull(dataList)) {
+                        for (Object o : dataList) {
+                            JSONObject item = (JSONObject) o;
+                            item.put("challenge_task_id", taskId);
+                            item.put("advertiser_id", advertiserId);
+                            BytedanceXingTuReport report = item.toJavaObject(BytedanceXingTuReport.class);
+                            JSONObject estAdCost = item.getJSONObject("est_ad_cost");
+                            if (!Check.isNull(estAdCost)) {
+                                Long value = estAdCost.getLong("value");
+                                Long time = estAdCost.getLong("time");
+                                report.setEstAdCostValue(value);
+                                report.setEstAdCostTime(time);
+                            }
+                            JSONObject estSales = item.getJSONObject("est_sales");
+                            if (!Check.isNull(estSales)) {
+                                Long value = estSales.getLong("value");
+                                Long time = estSales.getLong("time");
+                                report.setEstSalesValue(value);
+                                report.setEstSalesTime(time);
+                            }
+                            JSONObject play = item.getJSONObject("play");
+                            if (!Check.isNull(play)) {
+                                Long value = play.getLong("value");
+                                Long time = play.getLong("time");
+                                report.setPlayValue(value);
+                                report.setPlayTime(time);
+                            }
+                            JSONObject settleAdShare = item.getJSONObject("settle_ad_share");
+                            if (!Check.isNull(settleAdShare)) {
+                                Long value = settleAdShare.getLong("value");
+                                Long time = settleAdShare.getLong("time");
+                                report.setSettleAdShareValue(value);
+                                report.setSettleAdShareTime(time);
+                            }
+                            JSONObject settleCps = item.getJSONObject("settle_cps");
+                            if (!Check.isNull(settleCps)) {
+                                Long value = settleCps.getLong("value");
+                                Long time = settleCps.getLong("time");
+                                report.setSettleCpsValue(value);
+                                report.setSettleCpsTime(time);
+                            }
+                            List<BytedanceXingTuReportDaily> itemInfoDailyList = report.getItemInfoDailyList();
+                            if (!Check.isNull(itemInfoDailyList)) {
+                                itemInfoDailyList.forEach(daily -> {
+                                    daily.setAdvertiserId(advertiserId);
+                                    daily.setChallengeTaskId(taskId);
+                                    daily.setAuthorId(report.getAuthorId());
+                                    daily.setItemId(report.getItemId());
+                                });
+                                dailyReports.addAll(itemInfoDailyList);
+                            }
+                            reports.add(report);
+                        }
+                    }
+                }
+            } else {
+                log.info("账户id:{} {},星图任务结算数据请求结果失败,返回数据:{}", advertiserId, taskId, result);
+                insertErrorLog(isLog, advertiserId, DateUtils.getNowDate("yyyy-MM-dd"), DateUtils.getNowDate("yyyy-MM-dd"), "xingtu_task_report",
+                        new JSONObject().fluentPut("msg", result.getString("message")).fluentPut("taskId", taskId).toJSONString()
+                );
+                return;
+            }
+
+            if (!Check.isNull(reports)) {
+                bytedanceXingTuMapper.insertReport(reports);
+            }
+            if (!Check.isNull(dailyReports)) {
+                bytedanceXingTuMapper.insertReportDaily(dailyReports);
+            }
+
+            if (hasMore) {
+                getXingTuTaskReport(advertiserId, taskId, accessToken, page + 1, errorId, isLog, isSend);
+            }
+
+            log.info("账户ID:{} {},星图任务结算数据请求成功", advertiserId, taskId);
+            if (errorId != null) {
+                promoterReportMapper.deleteInfoByErrorId(errorId);
+            }
+            if (isSend != null && 1 == isSend) {
+                AlertUtils.sendMessage(advertiserId, DateUtils.getNowDate("yyyy-MM-dd"), DateUtils.getNowDate("yyyy-MM-dd"), 1, "xingtu_task_report", 1, null);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    private void insertErrorLog(Integer isLog, Long advertiserId, String startDate, String endDate, String dataDimension, String msg) {
+        if (isLog != null && 1 == isLog) {
+            BytedanceErrorLog errorInfo = new BytedanceErrorLog();
+            errorInfo.setAdvertiserId(advertiserId);
+            errorInfo.setStartDate(startDate);
+            errorInfo.setEndDate(endDate);
+            errorInfo.setMsg(msg);
+            errorInfo.setDataDimension(dataDimension);
+            errorInfo.setDataType("daily");
+            promoterReportMapper.replaceErrorInfo(errorInfo);
+        }
+    }
+}

+ 26 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/CPSReportServiceImpl.java

@@ -0,0 +1,26 @@
+package cn.com.ctop.job.bytedance.data.service.impl;
+
+import cn.com.ctop.job.bytedance.data.mapper.CPSReportMapper;
+import cn.com.ctop.job.bytedance.data.service.ICPSReportService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+@Slf4j
+public class CPSReportServiceImpl implements ICPSReportService {
+    @Autowired
+    private CPSReportMapper cpsReportMapper;
+
+    @Override
+    public void cleanCPSDailyReports(Integer nowDate) {
+        try {
+            if (cpsReportMapper.cleanCPSPayDailyReports(nowDate))
+                if (cpsReportMapper.cleanCPSIaaDailyReports(nowDate))
+                    log.info("CPS数据清洗完成-:{}", nowDate);
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("CPS数据清洗完成");
+        }
+    }
+}

+ 10 - 2
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/DateReportsPushServiceImpl.java

@@ -21,6 +21,7 @@ import org.springframework.stereotype.Service;
 
 import java.io.IOException;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
@@ -33,7 +34,7 @@ public class DateReportsPushServiceImpl implements IDateReportsPushService {
     @Autowired
     ReportsAdPushMapper reportsPushMapper;
 
-    private static final String TEMPLATE_VERSION = "1.0.3";
+    private static final String TEMPLATE_VERSION = "1.0.9";
     private static final String TEMPLATE_ID = "AAqRhJzMBoO0E";
 
     /**
@@ -94,6 +95,11 @@ public class DateReportsPushServiceImpl implements IDateReportsPushService {
         sendParam("暂不包含广点通当日数据", userIds, chatid);
     }
 
+    @Override
+    public void test(){
+        sendParam("", Arrays.asList("44fbaed6"), Collections.EMPTY_LIST);
+    }
+
 
     private void sendParam(String description, List<String> userIds, List<String> chatid){
         String token;
@@ -168,7 +174,9 @@ public class DateReportsPushServiceImpl implements IDateReportsPushService {
             String movieSource = String.valueOf(movie.get("movie_source"));
             String movieName = String.valueOf(movie.get("movie_name"));
             if (!Check.isNull(movieSource) && movieSource.contains("1")){
-                movieName = "欢瑞自制-"+movieName;
+                obj.put("movieNameColor", "blue");
+            }else {
+                obj.put("movieNameColor", "grey");
             }
             obj.put("rank", String.valueOf(movie.get("rk")));
             obj.put("movieName", movieName);

+ 2 - 2
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/OptimizerRankPushServiceImpl.java

@@ -32,7 +32,7 @@ public class OptimizerRankPushServiceImpl implements IOptimizerRankPushService {
     @Autowired
     ReportsAdPushMapper reportsPushMapper;
 
-    private static final String TEMPLATE_VERSION = "1.0.5";
+    private static final String TEMPLATE_VERSION = "1.0.7";
     private static final String TEMPLATE_ID = "AAqRUxrkkWuZf";
 
     public void send() {
@@ -124,7 +124,7 @@ public class OptimizerRankPushServiceImpl implements IOptimizerRankPushService {
             template_variable.put("object_list_5", object_list_5);
             System.out.println("发送目标: nickName: "+nickName+", userId: "+ userId + ", feishuUserId: "+mobileMap.get(phoneNumber)+", rank: "+rank+", costAmount: "+costAmount);
             sendToFeishu(token, template_variable, mobileMap.get(phoneNumber));
-//            sendToFeishu(token, template_variable, "44fbaed6");
+            sendToFeishu(token, template_variable, "44fbaed6");
             //clear
         }
     }

Plik diff jest za duży
+ 70 - 49
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/ReportsAdPushServiceImpl.java


+ 282 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/ReportsByBusinessPushServiceImpl.java

@@ -0,0 +1,282 @@
+package cn.com.ctop.job.bytedance.data.service.impl;
+
+import cn.com.ctop.job.bytedance.data.mapper.ReportsAdPushMapper;
+import cn.com.ctop.job.bytedance.data.service.IReportsByBusinessPushService;
+import cn.com.ctop.job.bytedance.data.utils.Check;
+import cn.com.ctop.job.bytedance.data.utils.DateUtils;
+import cn.com.ctop.job.bytedance.utils.FeishuRobotUtil;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import javafx.util.Pair;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.http.HttpEntity;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.util.EntityUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+@Service
+@Slf4j
+public class ReportsByBusinessPushServiceImpl implements IReportsByBusinessPushService {
+
+
+    public static final String APP_ID = "cli_a772633aaeff5013";
+    public static final String APP_KEY = "lEHaMdEoBVrrLNc5RtC11f8XsANnKgB4";
+    @Autowired
+    ReportsAdPushMapper reportsPushMapper;
+
+    private static final String TEMPLATE_VERSION = "1.0.0";
+    private static final String TEMPLATE_ID = "AAq4oeDXECopo";
+
+
+    /**
+     * 10点正式推送
+     */
+    @Override
+    public void send() {
+        List<String> userIds = Arrays.asList(
+                "44fbaed6" //zhaotx
+//                ,"ebeeced9" //yumeng
+//                ,"265g9ef1" //wangshu
+//                ,"ee518161" //zhaozhicheng
+//                ,"c5f6b59d" //yuyang
+//                ,"d834552b" //hemenghao
+//                ,"a3235a61" //louzijun
+//                ,"58e7a98a"  //xsq
+        );
+        List<String> chatid = Arrays.asList(
+                "oc_275f17aa4bf8fae649ef281a2b9250f6"
+        );
+        sendParam("", userIds, chatid);
+    }
+
+    /**
+     * 9点预推送给开发人员
+     */
+    @Override
+    public void preSend() {
+        List<String> userIds = Arrays.asList(
+                "44fbaed6" //zhaotx
+                ,"ebeeced9" //yumeng
+                ,"58e7a98a"  //xsq
+                ,"2ga9669f" //angaoqi
+                ,"43gb7fbc" //huangpingkang
+        );
+        List<String> chatid = Arrays.asList(
+        );
+        sendParam("暂不包含广点通当日数据", userIds, chatid);
+    }
+
+    @Override
+    public void test(){
+        sendParam("", Arrays.asList("44fbaed6"), Collections.EMPTY_LIST);
+    }
+
+
+    private void sendParam(String description, List<String> userIds, List<String> chatid){
+        String token;
+        try {
+            token = FeishuRobotUtil.getTenantToken(APP_ID, APP_KEY);
+        }catch (IOException e){
+            log.error("获取飞书token失败", e);
+            return;
+        }
+        //日期时间 - 统统以昨日为准
+        String today = DateUtils.getNowAddDate("yyyy-MM-dd", -1);
+        String lastDay = DateUtils.getNowAddDate("yyyy-MM-dd", -2);
+        Long todayLong = Long.parseLong(today.replaceAll("-", ""));
+        Long lastDayLong = Long.parseLong(lastDay.replaceAll("-", ""));
+
+        Map<String, String> todayData = reportsPushMapper.allBusinessPushData(todayLong);
+        Map<String, String> lastDayData = reportsPushMapper.allBusinessPushData(lastDayLong);
+
+        String updateTime = String.valueOf(todayData.get("update_time"));
+        List<Pair<String, String>> columns = Arrays.asList(
+                new Pair<>("cost_amount", "消耗金额"),
+                new Pair<>("end_amount", "结算金额"),
+                new Pair<>("pay_amount", "充值金额"),
+                new Pair<>("share_iaa_amount", "广告预估收入"),
+//                new Pair<>("water_roi", "流水ROI"),
+                new Pair<>("real_roi", "真实ROI"),
+//                new Pair<>("water_profit", "流水利润"),
+                new Pair<>("real_profit", "真实利润")
+        );
+        JSONArray dateIndicatorTable = new JSONArray();
+        for (Pair<String, String> column : columns) {
+            String key = column.getKey();
+            String name = column.getValue();
+            JSONObject obj = new JSONObject();
+            if (!name.contains("ROI")){
+                String todayDataValue = String.valueOf(todayData.getOrDefault(key, "0"));
+                String lastDayDataValue = String.valueOf(lastDayData.getOrDefault(key, "0"));
+                obj.put("indicatorName", name);
+                obj.put("todayData", todayDataValue);
+                obj.put("lastDayData", lastDayDataValue);
+                double todayDataDouble = Double.parseDouble(todayDataValue);
+                double lastDayDataDouble = Double.parseDouble(lastDayDataValue);
+                if (lastDayDataDouble != 0) {
+                    double rate = (todayDataDouble - lastDayDataDouble) / lastDayDataDouble * 100;
+                    String rateStr = String.format("%.2f%%", rate);
+                    obj.put("roundRate", rateStr);
+                    if (rate > 0.0){
+                        obj.put("rateColor", "red");
+                    }else if (rate < 0.0){
+                        obj.put("rateColor", "green");
+                    }
+                } else {
+                    obj.put("roundRate", "0.00%");
+                    obj.put("rateColor", "black");
+                }
+            }else {
+                String todayDataValue = String.valueOf(todayData.get(key));
+                String lastDayDataValue = String.valueOf(lastDayData.get(key));
+                obj.put("indicatorName", name);
+                obj.put("todayData", todayDataValue);
+                obj.put("lastDayData", lastDayDataValue);
+                obj.put("roundRate", "-");
+                obj.put("rateColor", "black");
+            }
+            dateIndicatorTable.add(obj);
+        }
+
+        List<Map<String, String>> movieData = reportsPushMapper.allBusinessTopMovie(todayLong);
+        JSONArray movieRankTable = new JSONArray();
+        for (Map<String, String> movie : movieData){
+            JSONObject obj = new JSONObject();
+            String movieSource = String.valueOf(movie.get("movie_source"));
+            String movieName = String.valueOf(movie.get("movie_name"));
+            if (!Check.isNull(movieSource) && movieSource.contains("1")){
+                obj.put("movieNameColor", "blue");
+            }else {
+                obj.put("movieNameColor", "grey");
+            }
+            obj.put("rank", String.valueOf(movie.get("rk")));
+            obj.put("movieName", movieName);
+            obj.put("endAmount", String.valueOf(movie.get("share_end_amount")));
+            obj.put("realROI", String.valueOf(movie.get("real_roi")));
+            movieRankTable.add(obj);
+        }
+
+        List<Map<String, String>> deptData = reportsPushMapper.deptRank2(todayLong);
+        JSONArray deptRank = new JSONArray();
+        for (Map<String, String> dept : deptData){
+            JSONObject obj = new JSONObject();
+            obj.put("rank", String.valueOf(dept.get("rk")));
+            obj.put("deptName", String.valueOf(dept.get("dept_name")));
+            obj.put("todayCost", String.valueOf(dept.get("cost_amount")));
+            obj.put("ROI", String.valueOf(dept.get("real_roi")));
+            deptRank.add(obj);
+        }
+
+        JSONObject allBusinessData = reportsPushMapper.businessTypeData(todayLong, Arrays.asList(2,4,6));
+        JSONObject b6 = reportsPushMapper.businessTypeData(todayLong, Arrays.asList(6));
+        JSONObject b4 = reportsPushMapper.businessTypeData(todayLong, Arrays.asList(4));
+        JSONObject b2 = reportsPushMapper.businessTypeData(todayLong, Arrays.asList(2));
+        JSONArray businessTypeTable = new JSONArray();
+        JSONObject allObj = new JSONObject();
+        allObj.put("type", "整体");
+        allObj.put("iap_end_amount", allBusinessData.getString("iap_end_amount"));
+        allObj.put("iaa_end_amount", allBusinessData.getString("iaa_end_amount"));
+        businessTypeTable.add(allObj);
+        JSONObject b6Obj = new JSONObject();
+        b6Obj.put("type", "达人");
+        b6Obj.put("iap_end_amount", b6.getString("iap_end_amount"));
+        b6Obj.put("iaa_end_amount", b6.getString("iaa_end_amount"));
+        businessTypeTable.add(b6Obj);
+        JSONObject b4Obj = new JSONObject();
+        b4Obj.put("type", "端原生");
+        b4Obj.put("iap_end_amount", b4.getString("iap_end_amount"));
+        b4Obj.put("iaa_end_amount", b4.getString("iaa_end_amount"));
+        businessTypeTable.add(b4Obj);
+        JSONObject b2Obj = new JSONObject();
+        b2Obj.put("type", "自分销");
+        b2Obj.put("iap_end_amount", b2.getString("iap_end_amount"));
+        b2Obj.put("iaa_end_amount", b2.getString("iaa_end_amount"));
+        businessTypeTable.add(b2Obj);
+
+
+
+        JSONObject template_variable = new JSONObject();
+        template_variable.put("updateTime", updateTime);
+        template_variable.put("todayDate", today);
+        template_variable.put("lastDayDate", lastDay);
+        template_variable.put("dateIndicatorTable", dateIndicatorTable);
+        template_variable.put("movieRankTable", movieRankTable);
+        template_variable.put("deptRank", deptRank);
+        template_variable.put("description", description);
+        template_variable.put("businessTypeList", businessTypeTable);
+
+
+        for (String userId : userIds) {
+            sendToFeishu(token, template_variable, userId);
+        }
+
+        for (String chat : chatid) {
+            sendToChatGroup(token, template_variable, chat);
+        }
+    }
+
+    private void sendToFeishu(String token, JSONObject template_variable, String receive_id) {
+        JSONObject content = new JSONObject();
+        JSONObject contentData = new JSONObject();
+        contentData.put("template_id",TEMPLATE_ID);
+        contentData.put("template_version_name", TEMPLATE_VERSION);
+        contentData.put("template_variable", template_variable);
+        content.put("type", "template");
+        content.put("data", contentData);
+
+        JSONObject request = new JSONObject();
+        request.put("receive_id", receive_id);
+        request.put("msg_type", "interactive");
+        request.put("content", content.toJSONString());
+        //发送
+        try (CloseableHttpClient client = HttpClients.createDefault()){
+            HttpPost httpPost = new HttpPost("https://open.feishu.cn/open-apis/im/v1/messages?receive_id_type=user_id");
+            httpPost.setHeader("Authorization", "Bearer "+token);
+            HttpEntity entity = new StringEntity(request.toJSONString(), "UTF-8");
+            httpPost.setEntity(entity);
+            httpPost.setHeader("Content-Type", "application/json; charset=utf-8");
+            CloseableHttpResponse respon = client.execute(httpPost);
+            System.out.println("发送结果: "+ EntityUtils.toString(respon.getEntity(), "UTF-8"));
+        }catch (IOException e){
+            log.error("发送飞书消息失败", e);
+        }
+    }
+
+    private void sendToChatGroup(String token, JSONObject template_variable, String chatid) {
+        JSONObject content = new JSONObject();
+        JSONObject contentData = new JSONObject();
+        contentData.put("template_id",TEMPLATE_ID);
+        contentData.put("template_version_name", TEMPLATE_VERSION);
+        contentData.put("template_variable", template_variable);
+        content.put("type", "template");
+        content.put("data", contentData);
+
+        JSONObject request = new JSONObject();
+        request.put("receive_id", chatid);
+        request.put("msg_type", "interactive");
+        request.put("content", content.toJSONString());
+        //发送
+        try (CloseableHttpClient client = HttpClients.createDefault()){
+            HttpPost httpPost = new HttpPost("https://open.feishu.cn/open-apis/im/v1/messages?receive_id_type=chat_id");
+            httpPost.setHeader("Authorization", "Bearer "+token);
+            HttpEntity entity = new StringEntity(request.toJSONString(), "UTF-8");
+            httpPost.setEntity(entity);
+            httpPost.setHeader("Content-Type", "application/json; charset=utf-8");
+            CloseableHttpResponse respon = client.execute(httpPost);
+            System.out.println("发送结果: "+ EntityUtils.toString(respon.getEntity(), "UTF-8"));
+        }catch (IOException e){
+            log.error("发送飞书消息失败", e);
+        }
+    }
+}

+ 26 - 11
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/TotalRankPushServiceImpl.java

@@ -38,6 +38,29 @@ public class TotalRankPushServiceImpl implements ITotalRankPushService {
 
     @Override
     public void send() {
+        List<String> userIds = Arrays.asList(
+        "44fbaed6",//zhaotx
+        "ebeeced9",//yumeng
+        "c5f6b59d",//余洋
+        "a3235a61",//楼子君
+        "265g9ef1",//王舒
+        "d834552b",//何梦豪
+        "59g6d358",//陈秋灵
+        "13dfc1gg",//刘恩麟
+        "58e7a98a",//xsq
+        "2ga9669f",//angaoqi
+        "b9e2ac3e",//wangdan
+        "bg5dcf61",//wangxuedi
+        "ga91e5d5",//yangcheng
+        "e1db71eb",//maojun
+        "dc653318",//zhangkaiwen
+        "ce65d5c1",//zhoutong
+        "ae982dg9"//lijinhua
+        );
+        send(userIds);
+    }
+    private void send(List<String> userIds)
+    {
         List<JSONObject> users = reportsPushMapper.selectUserList();
         List<String> mobiles = users.stream().map(user -> user.getString("phonenumber"))
                 .filter(s -> s != null && s.length() == 11)
@@ -117,17 +140,9 @@ public class TotalRankPushServiceImpl implements ITotalRankPushService {
         p3p4List.forEach(sb::append);
         sb.append(p5);
 
-        sendToFeishu(token, sb.toString(), "44fbaed6");//zhaotx
-        sendToFeishu(token, sb.toString(), "c5f6b59d");//余洋
-        sendToFeishu(token, sb.toString(), "a3235a61");//楼子君
-        sendToFeishu(token, sb.toString(), "265g9ef1");//王舒
-        sendToFeishu(token, sb.toString(), "d834552b");//何梦豪
-        sendToFeishu(token, sb.toString(), "59g6d358");//陈秋灵
-        sendToFeishu(token, sb.toString(), "13dfc1gg");//刘恩麟
-        sendToFeishu(token, sb.toString(), "58e7a98a");//xsq
-        sendToFeishu(token, sb.toString(), "2ga9669f");//angaoqi
-        sendToFeishu(token, sb.toString(), "b9e2ac3e");//wangdan
-        sendToFeishu(token, sb.toString(), "bg5dcf61");//wangxuedi
+        for (String userId : userIds){
+            sendToFeishu(token, sb.toString(), userId);
+        }
 
     }
 

+ 1 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/utils/FieldsConfig.java

@@ -67,6 +67,7 @@ public class FieldsConfig {
         metricslds.add("attribution_micro_game_0d_ltv");
         metricslds.add("attribution_micro_game_3d_ltv");
         metricslds.add("attribution_micro_game_7d_ltv");
+        metricslds.add("stat_micro_game_0d_amount");
         return metricslds;
 
     }

+ 24 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedancePromoterReportJob.java

@@ -112,4 +112,28 @@ public class BytedancePromoterReportJob {
     }
 
 
+
+    @XxlJob("ltv3ReportPromoterReport")
+    public void ltv3ReportPromoterReport() throws Exception {
+        String param = XxlJobHelper.getJobParam(); // 执行参数
+        if (Check.isNull(param)) {
+            log.error("入参为空");
+            return;
+        }
+        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+        String end = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
+        String start = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -4);
+        String[] s = param.split("_");
+        Long advertiserId = Long.valueOf(s[0]);
+        String accessToken = s[1];
+        dailyExecutorService.submit(new Runnable() {
+            @Override
+            public void run() {
+                promoterReportService.getBytedancePromoterDaily(advertiserId, accessToken, start, end, 1, 1);
+            }
+        });
+    }
+
+
+
 }

+ 58 - 3
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceReportRetryJob.java

@@ -1,7 +1,6 @@
 package cn.com.ctop.job.bytedance.handler;
 
 
-import cn.com.ctop.job.bytedance.data.service.*;
 import cn.com.ctop.job.bytedance.data.enums.AccountTypeEnum;
 import cn.com.ctop.job.bytedance.data.service.*;
 import cn.com.ctop.job.bytedance.data.utils.Check;
@@ -42,6 +41,9 @@ public class BytedanceReportRetryJob {
     @Autowired
     private IByteDanceFlowDetailsReportService byteDanceFlowDetailsReportService;
 
+    @Autowired
+    private IBytedanceXingTuService bytedanceXingTuService;
+
 
     private static ExecutorService hourAccountRetrExecutorService = Executors.newFixedThreadPool(2);
     private static ExecutorService dailyAccountRetrExecutorService = Executors.newFixedThreadPool(2);
@@ -142,6 +144,7 @@ public class BytedanceReportRetryJob {
 
         List<JSONObject> changDuRetry = channelService.getChangDuRetry();
         if (!Check.isNull(changDuRetry)) {
+            ExecutorService executorService = Executors.newFixedThreadPool(1);
             for (int i = 0; i < changDuRetry.size(); i++) {
                 JSONObject jsonObject = changDuRetry.get(i);
                 Long id = jsonObject.getLong("id");
@@ -155,7 +158,12 @@ public class BytedanceReportRetryJob {
                 String appId = jsonObject.getString("channelAppId");
                 String appName = jsonObject.getString("channelAppName");
                 if ("changdu_order".equals(dataDimension)) {
-                    channelService.getOrderList(startDate, endDate, appId, appName, channelAccountId, secretKey, 1, id, isSend);
+                    executorService.submit(new Runnable() {
+                        @Override
+                        public void run() {
+                            channelService.getOrderList(startDate, endDate, appId, appName, channelAccountId, secretKey, 1, id, isSend);
+                        }
+                    });
                 }
             }
         } else {
@@ -164,6 +172,7 @@ public class BytedanceReportRetryJob {
 
         List<JSONObject> maEcpmRetryJob = miniAppService.getMaEcpmRetryJob();
         if (!Check.isNull(maEcpmRetryJob)) {
+            ExecutorService executorService = Executors.newFixedThreadPool(1);
             for (int i = 0; i < maEcpmRetryJob.size(); i++) {
                 JSONObject jsonObject = maEcpmRetryJob.get(i);
                 Long id = jsonObject.getLong("id");
@@ -173,13 +182,59 @@ public class BytedanceReportRetryJob {
                 Integer isSend = jsonObject.getInteger("isSend");
                 if (dataDimension != null && dataDimension.startsWith("ma_ecpm:")) {
                     String appId = dataDimension.split(":")[1];
-                    miniAppService.getMaEcpm(startDate, endDate, appId, 1, id, isSend);
+                    executorService.submit(new Runnable() {
+                        @Override
+                        public void run() {
+                            miniAppService.getMaEcpm(startDate, endDate, appId, 1, id, isSend);
+                        }
+                    });
                 }
             }
         } else {
             log.info("抖小IAA重试列表为空");
         }
 
+        List<JSONObject> xingTuRetryJob = bytedanceXingTuService.getXingTuRetryJob();
+        if (!Check.isNull(xingTuRetryJob)) {
+            ExecutorService executorService = Executors.newFixedThreadPool(2);
+            for (int i = 0; i < xingTuRetryJob.size(); i++) {
+                JSONObject jsonObject = xingTuRetryJob.get(i);
+                Long id = jsonObject.getLong("id");
+                Long advertiserId = jsonObject.getLong("advertiserId");
+                String startDate = jsonObject.getString("startDate");
+                String endDate = jsonObject.getString("endDate");
+                String dataDimension = jsonObject.getString("dataDimension");
+                Integer isSend = jsonObject.getInteger("isSend");
+                String accessToken = jsonObject.getString("accessToken");
+                Long taskId = jsonObject.getJSONObject("msg").getLong("taskId");
+
+                if ("xingtu_task_list".equalsIgnoreCase(dataDimension)) {
+                    executorService.submit(new Runnable() {
+                        @Override
+                        public void run() {
+                            bytedanceXingTuService.getXingTuTaskList(advertiserId, accessToken, startDate, endDate, 1, id, null, isSend);
+                        }
+                    });
+                } else if ("xingtu_task_info".equalsIgnoreCase(dataDimension)) {
+                    executorService.submit(new Runnable() {
+                        @Override
+                        public void run() {
+                            bytedanceXingTuService.getXingTuTaskInfo(advertiserId, taskId, accessToken, id, null, isSend);
+                        }
+                    });
+                } else if ("xingtu_task_report".equalsIgnoreCase(dataDimension)) {
+                    executorService.submit(new Runnable() {
+                        @Override
+                        public void run() {
+                            bytedanceXingTuService.getXingTuTaskReport(advertiserId, taskId, accessToken, 1, id, null, isSend);
+                        }
+                    });
+                }
+            }
+        } else {
+            log.info("巨量星图重试列表为空");
+        }
+
     }
 
 

+ 73 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceXingTuJob.java

@@ -0,0 +1,73 @@
+package cn.com.ctop.job.bytedance.handler;
+
+
+import cn.com.ctop.job.bytedance.data.service.IBytedanceXingTuService;
+import cn.com.ctop.job.bytedance.data.utils.DateUtils;
+import com.alibaba.fastjson.JSONObject;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+
+@Slf4j
+@Component
+public class BytedanceXingTuJob {
+    @Autowired
+    private IBytedanceXingTuService bytedanceXingTuService;
+
+    @XxlJob("xingTuTaskList")
+    public void taskList() {
+        String startDate = DateUtils.getNowAddDate("yyyy-MM-dd", -1);
+        String endDate = DateUtils.getNowDate("yyyy-MM-dd");
+        List<JSONObject> xingTuAccount = bytedanceXingTuService.getXingTuAccount(null);
+        for (JSONObject jsonObject : xingTuAccount) {
+            Long advId = jsonObject.getLong("advertiser_id");
+            String accessToken = jsonObject.getString("access_token");
+            bytedanceXingTuService.getXingTuTaskList(advId, accessToken, startDate, endDate, 1, null, 1, null);
+        }
+
+    }
+
+    @XxlJob("xingTuTaskInfo")
+    public void taskInfo() {
+        ExecutorService executorService = Executors.newFixedThreadPool(4);
+        List<JSONObject> xingTuTasks = bytedanceXingTuService.getXingTuActiveTask(null);
+        for (JSONObject taskJson : xingTuTasks) {
+            Long advId = taskJson.getLong("advertiser_id");
+            Long taskId = taskJson.getLong("task_id");
+            String accessToken = taskJson.getString("access_token");
+            executorService.submit(new Runnable() {
+                @Override
+                public void run() {
+                    bytedanceXingTuService.getXingTuTaskInfo(advId, taskId, accessToken, null, 1, null);
+                }
+            });
+        }
+
+    }
+
+    @XxlJob("xingTuTaskReport")
+    public void taskReport() {
+        ExecutorService executorService = Executors.newFixedThreadPool(4);
+        List<JSONObject> xingTuTasks = bytedanceXingTuService.getXingTuReportTask(null);
+        for (JSONObject taskJson : xingTuTasks) {
+            Long advId = taskJson.getLong("advertiser_id");
+            Long taskId = taskJson.getLong("task_id");
+            String accessToken = taskJson.getString("access_token");
+            executorService.submit(new Runnable() {
+                @Override
+                public void run() {
+                    bytedanceXingTuService.getXingTuTaskReport(advId, taskId, accessToken, 1, null, 1, null);
+                }
+            });
+        }
+
+    }
+
+
+}

+ 54 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/CPSReportJob.java

@@ -0,0 +1,54 @@
+package cn.com.ctop.job.bytedance.handler;
+
+
+import cn.com.ctop.job.bytedance.data.service.ICPSReportService;
+import cn.com.ctop.job.bytedance.data.utils.DateUtils;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+
+/**
+ * thirtpart.cps_link_data_report
+ */
+@Slf4j
+@Component
+public class CPSReportJob {
+    @Autowired
+    private ICPSReportService cpsReportService;
+
+    /**
+     * 清洗CPS报表
+     */
+    @XxlJob("dayCleanCPSDailyReports")
+    public void dayCleanCPSDailyReports() throws Exception {
+        log.info("[dayCleanCPSDailyReports] 任务启动...");
+        try {
+            String nowDate = DateUtils.getNowDate("yyyyMMdd");
+            cpsReportService.cleanCPSDailyReports(Integer.valueOf(nowDate));
+            log.info("[dayCleanCPSDailyReports] 任务完成");
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error(e.getMessage());
+        }
+    }
+
+    /**
+     * 清洗CPS报表
+     */
+    @XxlJob("yesCleanCPSDailyReports")
+    public void yesCleanCPSDailyReports() throws Exception {
+        log.info("[yesCleanCPSDailyReports] 任务启动...");
+        try {
+            String nowDate = DateUtils.getNowDate("yyyyMMdd");
+            String yesterday = DateUtils.getNowAddDate("yyyyMMdd", -1);
+            cpsReportService.cleanCPSDailyReports(Integer.valueOf(yesterday));
+            log.info("[yesCleanCPSDailyReports] 任务完成");
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error(e.getMessage());
+        }
+    }
+
+}

+ 18 - 5
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/FeishuPushJob.java

@@ -25,6 +25,8 @@ public class FeishuPushJob {
     IUserLoginRecordService userLoginRecordService;
     @Autowired
     ICutGroupRankPushService cutGroupRankPushService;
+    @Autowired
+    IReportsByBusinessPushService reportsByBusinessPushService;
 
     @XxlJob("unbindWarnPush")
     public void unbindWarnPush(){
@@ -34,40 +36,51 @@ public class FeishuPushJob {
     public void bindAppErrorWarnPush(){
         bindAppErrorWarnService.send();
     }
+
+    //投放战报
     @XxlJob("reportsAdPush")
     public void reportsAdPush(){
         reportsAdPushService.send();
     }
+
+    //优化师实时战报(小组排行榜)
     @XxlJob("optimizerRankPush")
     public void optimizerRankPush(){
         optimizerRankPushService.send();
     }
+
+    //优化师实时战绩
     @XxlJob("totalRankPush")
     public void totalRankPush(){
         totalRankPushService.send();
     }
+
+    //短剧业务概况(投放)
     @XxlJob("dateReportsPush")
     public void dateReportsPush(){
         dateReportsPushService.send();
     }
 
-    @XxlJob("loginRecordPush")
-    public void loginRecordPush(){
-        userLoginRecordService.queryUserLoginRecord();
-    }
-
+    //短剧业务概况预投放(12点)
     @XxlJob("preDateReportsPush")
     public void preDataReportsPush(){
         dateReportsPushService.send12hour();
     }
 
+    //短剧业务概况预投放-给开发
     @XxlJob("dataReportsToDeveloper")
     public void dataReportsToDeveloper(){
         dateReportsPushService.preSend();
     }
 
+    //剪辑排行榜
     @XxlJob("cutGroupRankPush")
     public void cutGroupRankPush(){
         cutGroupRankPushService.send();
     }
+
+    @XxlJob("loginRecordPush")
+    public void loginRecordPush(){
+        userLoginRecordService.queryUserLoginRecord();
+    }
 }

+ 7 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/ToolsSiteJob.java

@@ -3,6 +3,7 @@ package cn.com.ctop.job.bytedance.handler;
 
 import cn.com.ctop.job.bytedance.data.service.IToolsSiteService;
 import cn.com.ctop.job.bytedance.data.utils.Check;
+import cn.com.ctop.job.bytedance.data.utils.HttpUtils;
 import com.alibaba.fastjson.JSONObject;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import lombok.extern.slf4j.Slf4j;
@@ -92,6 +93,12 @@ public class ToolsSiteJob {
                 toolsSiteService.publishSiteStatus(o.getLong("advertiser_id"), o.getString("task_id"));
             }));
         }
+
+        //更新短剧剧集时长字段
+        String url = "https://api.deepthink.artlinkworld.cn/hrJava/videos/getVideosInfo";
+        HttpUtils.httpPostRequest(url, null, null);
+
+
     }
 
 }

+ 5 - 5
job-bytedance/src/main/resources/application.yml

@@ -136,10 +136,10 @@ mybatis-plus:
       # 这个配置会将执行的sql打印出来,在开发或测试的时候可以用
     #log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
 
-logging:
-  level:
-    root: info
-  config: classpath:logback-dev.xml
+#logging:
+#  level:
+#    root: info
+#  config: classpath:logback-dev.xml
 
 xxl:
   job:
@@ -150,7 +150,7 @@ xxl:
       port: 9004
       ip:
       logpath: /data/webapp/hr_job-bytedance/log
-      logretentiondays: 30
+      logretentiondays: 3
     admin:
       addresses: http://172.16.0.108:9003/xxl-job-admin
 api:

+ 1 - 1
job-bytedance/src/main/resources/logback-dev.xml

@@ -33,7 +33,7 @@
             <fileNamePattern>${FILE_PATH}</fileNamePattern>
 
             <!-- keep 15 days' worth of history -->
-            <maxHistory>30</maxHistory>
+            <maxHistory>3</maxHistory>
 
             <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                 <!-- 日志文件的最大大小 -->