瀏覽代碼

Merge #10 into master from pingkang

剧维度消耗拉取前删除

* pingkang: (3 commits)
  剧维度消耗拉取前删除
  Merge remote-tracking branch 'origin/master' into pingkang
  剧维度消耗拉取前删除

Signed-off-by: 1129979389@qq.com <accounts_6361eaad7b63b44dd7833e63@mail.teambition.com>
Merged-by: 1129979389@qq.com <accounts_6361eaad7b63b44dd7833e63@mail.teambition.com>

CR-link: https://codeup.aliyun.com/60c06368dbbed34fe0f0c263/job/hr_job-bytedance/change/10
huangpingkang 1 年之前
父節點
當前提交
1f34b506df

+ 3 - 2
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/controller/BytedanceController.java

@@ -53,7 +53,7 @@ public class BytedanceController {
     @GetMapping("/accountReport")
     @GetMapping("/accountReport")
     public void getChannel(String param) {
     public void getChannel(String param) {
 
 
-        List<JSONObject>  infos = adminAdvertiserListService.getAdvertiserInfos();
+        List<JSONObject> infos = adminAdvertiserListService.getAdvertiserInfos();
         System.err.println(infos);
         System.err.println(infos);
         adminAdvertiserListService.batchUpdateAdvertiserName(infos);
         adminAdvertiserListService.batchUpdateAdvertiserName(infos);
 
 
@@ -91,6 +91,7 @@ public class BytedanceController {
                 @Override
                 @Override
                 public void run() {
                 public void run() {
                     if (!Check.isNull(accessToken)) {
                     if (!Check.isNull(accessToken)) {
+                        productReportService.deleteBytedanceProductDailyReport(advertiserId, startDate, endDate);
                         productReportService.getBytedanceProductDailyReport(adverId, accessToken, startDate, endDate, 1, null, 1, null);
                         productReportService.getBytedanceProductDailyReport(adverId, accessToken, startDate, endDate, 1, null, 1, null);
                     }
                     }
                 }
                 }
@@ -127,7 +128,7 @@ public class BytedanceController {
 
 
                 @Override
                 @Override
                 public void run() {
                 public void run() {
-                    if(!Check.isNull(advertiserAccount.getAccessToken())){
+                    if (!Check.isNull(advertiserAccount.getAccessToken())) {
                         byteDanceFlowDetailsReportService.getBytedanceFlowDetailsDailyReport(advertiserAccount.getAdvertiserId(), advertiserAccount.getAccessToken(), AccountTypeEnum.AD.getValue(), startDate, endDate, 1, null);
                         byteDanceFlowDetailsReportService.getBytedanceFlowDetailsDailyReport(advertiserAccount.getAdvertiserId(), advertiserAccount.getAccessToken(), AccountTypeEnum.AD.getValue(), startDate, endDate, 1, null);
                     }
                     }
                 }
                 }

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

@@ -11,4 +11,6 @@ public interface BytedanceProductReportMapper {
     List<JSONObject> queryCostAccount(@Param("advertiserId") Long advertiserId, @Param("startDate") String startDate, @Param("endDate") String endDate);
     List<JSONObject> queryCostAccount(@Param("advertiserId") Long advertiserId, @Param("startDate") String startDate, @Param("endDate") String endDate);
 
 
     void replaceProductReportDailies(List<BytedanceProductReportDaily> reports);
     void replaceProductReportDailies(List<BytedanceProductReportDaily> reports);
+
+    void deleteProductReportDailies(@Param("advertiserId") Long advertiserId,@Param("startDate") Integer startDate,@Param("endDate")  Integer endDate);
 }
 }

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

@@ -57,4 +57,9 @@
         </foreach>
         </foreach>
     </insert>
     </insert>
 
 
+    <delete id="deleteProductReportDailies">
+        DELETE FROM media_api.bytedance_product_report_daily
+        WHERE advertiser_id = ${advertiserId} and stat_time_day >= ${startDate} and stat_time_day &lt;= ${endDate}
+    </delete>
+
 </mapper>
 </mapper>

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

@@ -9,4 +9,6 @@ public interface IBytedanceProductReportService {
                                         Long errorId, Integer isLog, Integer isSend);
                                         Long errorId, Integer isLog, Integer isSend);
 
 
     List<JSONObject> getCostAccount(Long advertiserId, String startDate, String endDate);
     List<JSONObject> getCostAccount(Long advertiserId, String startDate, String endDate);
+
+    void deleteBytedanceProductDailyReport(Long advertiserId, String startDate, String endDate);
 }
 }

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

@@ -30,6 +30,11 @@ public class BytedanceProductReportServiceImpl implements IBytedanceProductRepor
     private BytedanceProductReportMapper productReportMapper;
     private BytedanceProductReportMapper productReportMapper;
 
 
     @Override
     @Override
+    public void deleteBytedanceProductDailyReport(Long advertiserId, String startDate, String endDate) {
+        productReportMapper.deleteProductReportDailies(advertiserId, Integer.parseInt(startDate.replace("-", "")), Integer.parseInt(endDate.replace("-", "")));
+    }
+
+    @Override
     public void getBytedanceProductDailyReport(Long advertiserId, String accessToken, String startDate, String endDate, Integer page,
     public void getBytedanceProductDailyReport(Long advertiserId, String accessToken, String startDate, String endDate, Integer page,
                                                Long errorId, Integer isLog, Integer isSend) {
                                                Long errorId, Integer isLog, Integer isSend) {
         try {
         try {
@@ -98,7 +103,7 @@ public class BytedanceProductReportServiceImpl implements IBytedanceProductRepor
                     promoterReportMapper.deleteInfoByErrorId(errorId);
                     promoterReportMapper.deleteInfoByErrorId(errorId);
                 }
                 }
                 if (isSend != null && 1 == isSend) {
                 if (isSend != null && 1 == isSend) {
-                    AlertUtils.sendMessage(advertiserId, startDate, endDate, 1, "product_daily", 1,null);
+                    AlertUtils.sendMessage(advertiserId, startDate, endDate, 1, "product_daily", 1, null);
                 }
                 }
             }
             }
         } catch (Exception e) {
         } catch (Exception e) {

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

@@ -105,6 +105,7 @@ public class BytedancePromoterReportJob {
         productDailyExecutor.submit(new Runnable() {
         productDailyExecutor.submit(new Runnable() {
             @Override
             @Override
             public void run() {
             public void run() {
+                productReportService.deleteBytedanceProductDailyReport(advertiserId, data, data);
                 productReportService.getBytedanceProductDailyReport(advertiserId, accessToken, data, data, 1, null, 1, null);
                 productReportService.getBytedanceProductDailyReport(advertiserId, accessToken, data, data, 1, null, 1, null);
             }
             }
         });
         });