|
@@ -1,16 +1,26 @@
|
|
|
package cn.com.ctop.job.bytedance;
|
|
|
|
|
|
+import cn.com.ctop.job.bytedance.data.service.IBytedanceReportNewService;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.boot.CommandLineRunner;
|
|
|
import org.springframework.boot.SpringApplication;
|
|
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
|
+import org.springframework.context.annotation.Bean;
|
|
|
import org.springframework.context.annotation.ComponentScan;
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
+import org.springframework.web.client.RestTemplate;
|
|
|
+
|
|
|
@Slf4j
|
|
|
@SpringBootApplication
|
|
|
@ComponentScan(basePackages = {"cn.com.ctop"})
|
|
|
@Configuration
|
|
|
public class BytedanceJobApplication {
|
|
|
- public static void main(String[] args){
|
|
|
+ @Autowired
|
|
|
+ private IBytedanceReportNewService bytedanceReportNewService;
|
|
|
+
|
|
|
+ public static void main(String[] args) {
|
|
|
|
|
|
SpringApplication.run(BytedanceJobApplication.class, args);
|
|
|
|
|
@@ -19,4 +29,15 @@ public class BytedanceJobApplication {
|
|
|
"----------------------------------------------------------");
|
|
|
}
|
|
|
|
|
|
+ @Bean
|
|
|
+ CommandLineRunner runAtStartup() {
|
|
|
+ return args -> {
|
|
|
+ System.out.println("初始化数据....");
|
|
|
+ JSONObject tokenJson = bytedanceReportNewService.getTokenInfo();
|
|
|
+ bytedanceReportNewService.getMetrics(tokenJson.getLong("accountId"), tokenJson.getString("accessToken"));
|
|
|
+ System.out.println("初始化数据完成....");
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|