yumeng 4 rokov pred
rodič
commit
99bf8ff5ee

+ 35 - 41
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -127,20 +127,20 @@ public class SampleTest {
 
 
     @Test
     @Test
     public void testLoadBytedanceData() {
     public void testLoadBytedanceData() {
-        List<UserAllocation>allocations = allocationService.getByParams(633L,null,0);
-        if(null!=allocations&&!allocations.isEmpty()){
-            for(UserAllocation allocation:allocations){
+        List<UserAllocation> allocations = allocationService.getByParams(633L, null, 0);
+        if (null != allocations && !allocations.isEmpty()) {
+            for (UserAllocation allocation : allocations) {
                 CtopOauthToken token = tokenService.getTokenByAccountId(allocation.getAccountId());
                 CtopOauthToken token = tokenService.getTokenByAccountId(allocation.getAccountId());
                 String startDate = "2020-11-10";
                 String startDate = "2020-11-10";
                 String endDate = "2020-11-10";
                 String endDate = "2020-11-10";
-                reportService.getAdvertiserReport(token, DateUtils.parseDate(startDate,"yyyy-MM-dd"), DateUtils.parseDate(endDate,"yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
+                reportService.getAdvertiserReport(token, DateUtils.parseDate(startDate, "yyyy-MM-dd"), DateUtils.parseDate(endDate, "yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
             }
             }
         }
         }
         System.out.println("任务结束");
         System.out.println("任务结束");
     }
     }
 
 
     @Test
     @Test
-    public void loadBytedancePlanData(){
+    public void loadBytedancePlanData() {
         CtopOauthToken token = tokenService.getTokenByAccountId(100198696723L);
         CtopOauthToken token = tokenService.getTokenByAccountId(100198696723L);
 //        advertiserDataService.getAdvertiserPlan(token, "", null, null);
 //        advertiserDataService.getAdvertiserPlan(token, "", null, null);
         Date getDate = DateUtils.addDay(new Date(), 0);
         Date getDate = DateUtils.addDay(new Date(), 0);
@@ -149,15 +149,16 @@ public class SampleTest {
 
 
     @Autowired
     @Autowired
     private IBytedanceFundDailyService bytedanceFundDailyService;
     private IBytedanceFundDailyService bytedanceFundDailyService;
+
     @Test
     @Test
     public void loadFoudData() {
     public void loadFoudData() {
         List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
         List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
         for (CtopOauthToken token : tokens) {
         for (CtopOauthToken token : tokens) {
-            System.out.println(token.getAccountId()+"############################");
-            for(int i=20;i<130;i++){
-                Date date = DateUtils.addDay(new Date(),-i);
-                bytedanceFundDailyService.loadFundDataByPage(token, DateUtils.formatDate(date), DateUtils.formatDate(date),1);
-                System.out.println(i+"############################");
+            System.out.println(token.getAccountId() + "############################");
+            for (int i = 20; i < 130; i++) {
+                Date date = DateUtils.addDay(new Date(), -i);
+                bytedanceFundDailyService.loadFundDataByPage(token, DateUtils.formatDate(date), DateUtils.formatDate(date), 1);
+                System.out.println(i + "############################");
             }
             }
         }
         }
     }
     }
@@ -169,9 +170,9 @@ public class SampleTest {
      * 测试获取快手图片消耗数据任务
      * 测试获取快手图片消耗数据任务
      */
      */
     @Test
     @Test
-    public void loadKuaishouImageTask(){
+    public void loadKuaishouImageTask() {
         List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
         List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
-        for(int i=1;i<130;i++) {
+        for (int i = 1; i < 130; i++) {
             Date getDate = DateUtils.addDay(new Date(), -i);
             Date getDate = DateUtils.addDay(new Date(), -i);
             String getDateStr = DateUtils.formatDate(getDate);
             String getDateStr = DateUtils.formatDate(getDate);
             tokens.forEach(token -> reportTaskService.createTask(token.getAccountId(), token.getAccessToken(), getDateStr, getDateStr, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_DAILY));
             tokens.forEach(token -> reportTaskService.createTask(token.getAccountId(), token.getAccessToken(), getDateStr, getDateStr, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_DAILY));
@@ -180,14 +181,15 @@ public class SampleTest {
 
 
     @Autowired
     @Autowired
     private IKuaiShouDailyReportTaskService dailyReportTaskService;
     private IKuaiShouDailyReportTaskService dailyReportTaskService;
+
     /**
     /**
      * 测试获取快手图片消耗数据入库
      * 测试获取快手图片消耗数据入库
      */
      */
     @Test
     @Test
-    public void loadKuaishouImageTaskFile(){
+    public void loadKuaishouImageTaskFile() {
         String nowDate = DateUtils.getDate("yyyy-MM-dd");
         String nowDate = DateUtils.getDate("yyyy-MM-dd");
         List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
         List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
-        for(int i=1;i<15;i++){
+        for (int i = 1; i < 15; i++) {
             String statDate = getAnotherDay("yyyy-MM-dd", nowDate, -i);
             String statDate = getAnotherDay("yyyy-MM-dd", nowDate, -i);
             tokens.forEach(token -> dailyReportTaskService.getTaskList(token.getAccountId(), token.getAccessToken(), statDate));
             tokens.forEach(token -> dailyReportTaskService.getTaskList(token.getAccountId(), token.getAccessToken(), statDate));
         }
         }
@@ -195,15 +197,15 @@ public class SampleTest {
     }
     }
 
 
     @Test
     @Test
-    public void testLoadBytedanceImageData(){
-        List<CtopOauthToken>tokens = tokenService.selectToutiaoToken();
+    public void testLoadBytedanceImageData() {
+        List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
         countDownLatch = new CountDownLatch(tokens.size());
         countDownLatch = new CountDownLatch(tokens.size());
         executorService = Executors.newFixedThreadPool(8);
         executorService = Executors.newFixedThreadPool(8);
-        tokens.forEach(token->executorService.submit(()->{
+        tokens.forEach(token -> executorService.submit(() -> {
             try {
             try {
                 advertiserDataService.getMaterialList(token);
                 advertiserDataService.getMaterialList(token);
-            }catch (Exception e){
-            }finally {
+            } catch (Exception e) {
+            } finally {
                 countDownLatch.countDown();
                 countDownLatch.countDown();
             }
             }
         }));
         }));
@@ -215,12 +217,14 @@ public class SampleTest {
         System.out.println("素材数据获取完成");
         System.out.println("素材数据获取完成");
 
 
     }
     }
+
     @Autowired
     @Autowired
     private KuaishouAgentAccountMapper kuaishouAgentAccountMapper;
     private KuaishouAgentAccountMapper kuaishouAgentAccountMapper;
     @Autowired
     @Autowired
     private IKuaishouReportDailyAgentService kuaishouReportDailyAgentService;
     private IKuaishouReportDailyAgentService kuaishouReportDailyAgentService;
+
     @Test
     @Test
-    public void loadKuaishouAgentData() throws Exception{
+    public void loadKuaishouAgentData() throws Exception {
         kuaishouReportDailyAgentService.loginAgent();
         kuaishouReportDailyAgentService.loginAgent();
 //        for (int i = 0; i < 20; i++) {
 //        for (int i = 0; i < 20; i++) {
 //            String currentDate = DateUtils.formatDate(DateUtils.addDay(new Date(), -i));
 //            String currentDate = DateUtils.formatDate(DateUtils.addDay(new Date(), -i));
@@ -242,12 +246,13 @@ public class SampleTest {
 
 
     @Autowired
     @Autowired
     private ISendMessageService sendMessageService;
     private ISendMessageService sendMessageService;
+
     @Test
     @Test
-    public void testSendMessage(){
-        sendMessageService.sendMessage("c445fec9a80347aea54e8db66692ec03","测试信息发送!");
+    public void testSendMessage() {
+        sendMessageService.sendMessage("c445fec9a80347aea54e8db66692ec03", "测试信息发送!");
     }
     }
 
 
-    private void loadData(String result)throws Exception{
+    private void loadData(String result) throws Exception {
         ObjectMapper mapper = new ObjectMapper();
         ObjectMapper mapper = new ObjectMapper();
         mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
         mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
         JsonNode resultNode = mapper.readTree(result);
         JsonNode resultNode = mapper.readTree(result);
@@ -276,6 +281,7 @@ public class SampleTest {
             }
             }
         }
         }
     }
     }
+
     @Autowired
     @Autowired
     private IKuaishouInterfaceService kuaishouInterfaceService;
     private IKuaishouInterfaceService kuaishouInterfaceService;
 
 
@@ -290,16 +296,15 @@ public class SampleTest {
     }
     }
 
 
 
 
-
     @Test
     @Test
     public void loadAccountData() {
     public void loadAccountData() {
 //        List<UserAllocation> allocations = allocationService.getByParams(776L,null,0);
 //        List<UserAllocation> allocations = allocationService.getByParams(776L,null,0);
 //        for (UserAllocation allocation:allocations) {
 //        for (UserAllocation allocation:allocations) {
-            CtopOauthToken token = tokenService.getTokenByAccountId(93238965516L);
-            for(int i=92;i<100;i++){
-                Date getDate = DateUtils.addDay(new Date(),-i);
-                reportService.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
-            }
+        CtopOauthToken token = tokenService.getTokenByAccountId(93238965516L);
+        for (int i = 92; i < 100; i++) {
+            Date getDate = DateUtils.addDay(new Date(), -i);
+            reportService.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+        }
 //        }
 //        }
     }
     }
 
 
@@ -327,16 +332,5 @@ public class SampleTest {
     @Autowired
     @Autowired
     private IWechatNoListService wechatNoListService;
     private IWechatNoListService wechatNoListService;
 
 
-    @Test
-    public void checkinData() {
-        //更新员工打卡明细表 1604160000
-//        wechatCheckinDataService.getCheckinData("1600531200", "1601136000");
-//        XxlJobLogger.log("--------考勤数据入库 end ");
-//        //更新人员信息表oa/wechatNoList
-////        wechatUserInfoService.getUserList();
-////        XxlJobLogger.log("--------人员数据入库 end ");
-
-        wechatNoListService.getNoDateByNo("1601481600", "1604160000");
-        XxlJobLogger.log("--------异常考勤审批数据入库 end ");
-    }
+
 }
 }