Explorar el Código

添加测试用例

syh hace 5 años
padre
commit
756d601956

+ 9 - 0
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -1,5 +1,6 @@
 package org.jeecg;
 
+import cn.com.ctop.bytedance.service.IBytedanceReportService;
 import cn.com.ctop.bytedance.service.IReportService;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.mapper.CtopOauthTokenMapper;
@@ -268,6 +269,14 @@ public class SampleTest {
 
     }
 
+    @Test
+    public void testLoadMatData() {
+        CtopOauthToken token = tokenService.getTokenByAccountId(1647352267707396L);
+        bytedanceReportService.bytedanceMaterialReport(token, "", "");
+    }
+
+    @Autowired
+    private IBytedanceReportService bytedanceReportService;
 
 }
 

+ 0 - 12
module-report/src/main/java/cn/com/ctop/bytedance/controller/BytedanceReportController.java

@@ -4,7 +4,6 @@ import cn.com.ctop.bytedance.entity.BytedanceReportMaterialRetry;
 import cn.com.ctop.bytedance.service.IBytedanceReportService;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
-import cn.com.ctop.common.module.utils.CtopAdConstant;
 import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
@@ -13,8 +12,6 @@ import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.ArrayList;
-import java.util.Date;
 import java.util.List;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
@@ -147,15 +144,6 @@ public class BytedanceReportController {
                 return result;
             }
 
-            //非异步
-            //for (CtopOauthToken token : tokens) {
-            //    //if(token.getAccountId() == 1647352267707396L){
-            //    bytedanceReportService.bytedanceMaterialReport(token,startDate,endDate);
-            //    //}
-            //}
-            ////}
-
-            //多线程
             final ExecutorService executorService = Executors.newFixedThreadPool(8);
             tokens.forEach(token -> {
                 executorService.submit(new Runnable() {

+ 1 - 1
module-report/src/main/java/cn/com/ctop/bytedance/service/impl/BytedanceReportServiceImpl.java

@@ -24,7 +24,6 @@ import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.http.client.ClientProtocolException;
-import org.apache.http.client.config.RequestConfig;
 import org.apache.http.client.methods.CloseableHttpResponse;
 import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
 import org.apache.http.entity.ContentType;
@@ -995,6 +994,7 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
         }
     }
 
+    @Override
     public void bytedanceMaterialReport(CtopOauthToken token, String startDate, String endDate){
         //CtopOauthToken token = ctopOauthTokenService.getTokenByAccountId(accountId);
         Long accountId = token.getAccountId();