Browse Source

修改定时

yumeng 4 years ago
parent
commit
16da7b995c

+ 2 - 0
job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/data/constant/KuaishouConstant.java

@@ -9,4 +9,6 @@ public class KuaishouConstant {
   public static final String CREATIVE_REPORT = "/rest/openapi/v1/report/creative_report";
   public static final String PROGRAM_CREATIVE_REPORT = "/rest/openapi/v1/report/program_creative_report";
   public static final String MATERIAL_REPORT = "/rest/openapi/v1/report/material_report";
+  public static final String SEND_URL = "http://192.168.0.202:8765/webhook/account_report";
+
 }

+ 1 - 1
job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/data/mapper/xml/OauthTokenMapper.xml

@@ -3,6 +3,6 @@
 <mapper namespace="cn.com.ctop.job.kuaishou.data.mapper.OauthTokenMapper">
 
     <select id="getByAccountId" resultType="java.lang.String">
-       SELECT access_token  from  `business_operation`.ctop_oauth_token WHERE account_id = #{accountId}
+       SELECT access_token  from  `jeecg-boot`.ctop_oauth_token WHERE account_id = #{accountId}
     </select>
 </mapper>

+ 1 - 0
job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/data/service/IKuaishouAccountReportDailyService.java

@@ -11,4 +11,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface IKuaishouAccountReportDailyService extends IService<KuaishouAccountReportDaily> {
   void getAdvertiserReportDaily(Long advertiserId, String accessToken, String startDate, String endDate, int page);
+  void sendMessage(Long accountId, String startDate, String endDate, String date_type);
 }

+ 12 - 0
job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/data/service/impl/KuaishouAccountReportDailyServiceImpl.java

@@ -197,6 +197,18 @@ public class KuaishouAccountReportDailyServiceImpl
       addList.add(reportDaily);
     }
     accountReportDailyMapper.replaceBatch(addList);
+    sendMessage(advertiserId, startDate, endDate, "daily");
     log.info("账户日报数据获取完成:accountId:{}",advertiserId);
   }
+  @Override
+  public void sendMessage(Long accountId, String startDate, String endDate, String date_type) {
+    String url = KuaishouConstant.SEND_URL;
+    Map<String, Object> param = new HashMap<>();
+    param.put("start_date", DateUtils.getDateInteger(startDate));
+    param.put("end_date", DateUtils.getDateInteger(endDate));
+    param.put("account_id", accountId);
+    param.put("date_type", date_type);
+    String result = HttpUtils.httpPostRequest(url, param, null);
+    System.err.println(result);
+  }
 }

+ 5 - 1
job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/data/service/impl/KuaishouAccountReportHourlyServiceImpl.java

@@ -3,6 +3,7 @@ package cn.com.ctop.job.kuaishou.data.service.impl;
 import cn.com.ctop.job.kuaishou.data.constant.KuaishouConstant;
 import cn.com.ctop.job.kuaishou.data.entity.KuaishouAccountReportHourly;
 import cn.com.ctop.job.kuaishou.data.mapper.KuaishouAccountReportHourlyMapper;
+import cn.com.ctop.job.kuaishou.data.service.IKuaishouAccountReportDailyService;
 import cn.com.ctop.job.kuaishou.data.service.IKuaishouAccountReportHourlyService;
 import cn.com.ctop.job.kuaishou.data.utils.DateUtils;
 import cn.com.ctop.job.kuaishou.data.utils.HttpUtils;
@@ -33,6 +34,8 @@ public class KuaishouAccountReportHourlyServiceImpl extends ServiceImpl<Kuaishou
   private String postUrl;
   @Autowired
   private KuaishouAccountReportHourlyMapper accountReportHourlyMapper;
+  @Autowired
+  private IKuaishouAccountReportDailyService reportDailyService;
   
 
   @Override
@@ -196,7 +199,8 @@ public class KuaishouAccountReportHourlyServiceImpl extends ServiceImpl<Kuaishou
       reportHourly.setEventAdWatchTimes(returnJson.getLong("event_ad_watch_times"));
       addList.add(reportHourly);
     }
-      accountReportHourlyMapper.replaceBatch(addList);
+    accountReportHourlyMapper.replaceBatch(addList);
     log.info("账户时报数据获取完成:accountId:{}", advertiserId);
+    reportDailyService.sendMessage(advertiserId, startDate, endDate, "hourly");
   }
 }

+ 3 - 3
job-kuaishou/src/main/resources/application.yml

@@ -80,9 +80,9 @@ spring:
         connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
       datasource:
         master:
-          url: jdbc:mysql://192.168.1.187:4000/media_api?characterEncoding=UTF-8&useUnicode=true
-          username: root
-          password: hcst2021
+          url: jdbc:mysql://192.168.0.184:3390/media_api?characterEncoding=UTF-8&useUnicode=true
+          username: hcst
+          password: hcst@2021
           driver-class-name: com.mysql.jdbc.Driver
 
 #mybatis plus 设置