yumeng 1 год назад
Родитель
Сommit
b28d735e99

+ 4 - 3
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/BytedanceAccountReportServiceImpl.java

@@ -25,6 +25,7 @@ import java.util.Map;
 public class BytedanceAccountReportServiceImpl implements IBytedanceAccountReportService {
     @Autowired
     private BytedanceAccountReportMapper accountReportMapper;
+
     @Override
     public void getBytedanceRetryAccountHourReport(Long errorId, Long advertiserId, String accessToken, String startDate, String endDate, Integer page, Integer isSend) {
         try {
@@ -71,7 +72,7 @@ public class BytedanceAccountReportServiceImpl implements IBytedanceAccountRepor
                     }
                 }
             } else {
-                log.info("账户id:{},日期:{}广告时报(账户粒度)请求结果为空,result:{}", advertiserId, startDate,result.getString("message"));
+                log.info("账户id:{},日期:{}广告时报(账户粒度)请求结果为空,result:{}", advertiserId, startDate, result.getString("message"));
                 return;
 
             }
@@ -89,7 +90,7 @@ public class BytedanceAccountReportServiceImpl implements IBytedanceAccountRepor
                 log.info("账户ID:{},日期:{},广告时报(账户粒度)数据请求成功", advertiserId, startDate);
                 accountReportMapper.deleteInfoByErrorId(errorId);
                 if (isSend == 1) {
-                    AlertUtils.sendMessage(advertiserId, startDate, endDate, 1, "hour", 1);
+                    AlertUtils.sendMessage(advertiserId, startDate, endDate, 1, "hour", 1, "account");
                 }
             }
         } catch (Exception e) {
@@ -159,7 +160,7 @@ public class BytedanceAccountReportServiceImpl implements IBytedanceAccountRepor
                 log.info("账户ID:{},日期:{},广告时报(账户粒度)数据请求成功", advertiserId, startDate);
                 accountReportMapper.deleteInfoByErrorId(errorId);
                 if (isSend == 1) {
-                    AlertUtils.sendMessage(advertiserId, startDate, endDate, 1, "hour", 1);
+                    AlertUtils.sendMessage(advertiserId, startDate, endDate, 1, "hour", 1,"account");
                 }
             }
         } catch (Exception e) {

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

@@ -98,7 +98,7 @@ public class BytedanceProductReportServiceImpl implements IBytedanceProductRepor
                     promoterReportMapper.deleteInfoByErrorId(errorId);
                 }
                 if (isSend != null && 1 == isSend) {
-                    AlertUtils.sendMessage(advertiserId, startDate, endDate, 1, "product_daily", 1);
+                    AlertUtils.sendMessage(advertiserId, startDate, endDate, 1, "product_daily", 1,null);
                 }
             }
         } catch (Exception e) {

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

@@ -103,7 +103,7 @@ public class BytedancePromoterReportServiceImpl implements IBytedancePromoterRep
                 log.info("账户ID:{},日期:{},广告时报(最细粒度)数据请求成功", advertiserId, startDate);
                 promoterReportMapper.deleteInfoByErrorId(errorId);
                 if (isSend == 1) {
-                    AlertUtils.sendMessage(advertiserId, startDate, endDate, 1, "hour", 1);
+                    AlertUtils.sendMessage(advertiserId, startDate, endDate, 1, "hour", 1, "promoter");
                 }
             }
         } catch (Exception e) {
@@ -183,7 +183,7 @@ public class BytedancePromoterReportServiceImpl implements IBytedancePromoterRep
                 log.info("账户ID:{},日期:{},广告日报(最细粒度)数据请求成功", advertiserId, startDate);
                 promoterReportMapper.deleteInfoByErrorId(errorId);
                 if (isSend == 1) {
-                    AlertUtils.sendMessage(advertiserId, startDate, endDate, 1, "daily", 1);
+                    AlertUtils.sendMessage(advertiserId, startDate, endDate, 1, "daily", 1, "promoter");
                 }
             }
         } catch (Exception e) {

+ 5 - 2
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/utils/AlertUtils.java

@@ -13,7 +13,7 @@ public class AlertUtils {
     private static final String sendUrl = "http://172.16.0.108:8765/webhook/media_report";
     private static final ExecutorService sendExecutorService = Executors.newFixedThreadPool(5);
 
-    public static void sendMessage(Long account_id, String start_date, String end_date, Integer media_type, String type, Integer count) {
+    public static void sendMessage(Long account_id, String start_date, String end_date, Integer media_type, String type, Integer count, String dimension) {
         if (count > 5) {
             log.error("超过最大次数,account_id:{}", count);
             return;
@@ -27,6 +27,9 @@ public class AlertUtils {
                 param.put("end_date", end_date);
                 param.put("media_type", media_type);
                 param.put("type", type);
+                if (!Check.isNull(dimension)) {
+                    param.put("dimension", dimension);
+                }
                 String s = HttpUtils.httpPostRequest(sendUrl, param, new HashMap<>());
                 JSONObject jsonObject = JSONObject.parseObject(s);
                 if (!Check.isNull(jsonObject)) {
@@ -34,7 +37,7 @@ public class AlertUtils {
                     if (code == 200) {
                         log.info("请求数据清洗服务成功,account_id:{}", account_id);
                     } else {
-                        sendMessage(account_id, start_date, end_date, media_type, type, count + 1);
+                        sendMessage(account_id, start_date, end_date, media_type, type, count + 1, dimension);
                     }
                 }
             }