yumeng 4 лет назад
Родитель
Сommit
83cde96055

+ 4 - 4
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java

@@ -918,7 +918,7 @@ public class BatchController {
                                 failArr.add(failJson);
                             } else {
                                 //更新数据状态
-                                shouGroupDailyReportService.updateStatus(accountId,unitId,putStatus);
+                                shouGroupDailyReportService.updateStatus(accountId, unitId, putStatus);
                             }
                         }
                     }
@@ -2266,12 +2266,12 @@ public class BatchController {
         Result<Boolean> result = new Result<>();
         try {
             String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
-            String startDate = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -30);
+            String startDate = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -7);
             syncPullMaterialService.getSyncVideoList(accountId, startDate, nowDate);
-            Thread.sleep(5 * 1000L);
             result.setSuccess(true);
             result.setResult(true);
-        } catch (InterruptedException e) {
+        } catch (Exception e) {
+            result.setSuccess(false);
             e.printStackTrace();
         }
 

+ 3 - 22
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/SyncPullMaterialServiceImpl.java

@@ -2,15 +2,12 @@ package cn.com.ctop.kuaishou.modules.batch.service.impl;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
-import cn.com.ctop.common.module.utils.Check;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAdvertiserBaseInfo;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouAdvertiserBaseInfoService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
 import cn.com.ctop.kuaishou.modules.batch.service.ISyncPullMaterialService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.List;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
@@ -26,8 +23,7 @@ public class SyncPullMaterialServiceImpl implements ISyncPullMaterialService {
     private ICtopOauthTokenService oauthTokenService;
     @Autowired
     private IKuaishouInterfaceService iKuaishouInterfaceService;
-    static ExecutorService videoExecutorService = Executors.newFixedThreadPool(10);
-    static ExecutorService suZhaoExecutorService = Executors.newFixedThreadPool(10);
+
 
 
     /**
@@ -39,23 +35,8 @@ public class SyncPullMaterialServiceImpl implements ISyncPullMaterialService {
      */
     @Override
     public void getSyncVideoList(Long accountId, String startDate, String endDate) {
-        KuaiShouAdvertiserBaseInfo baseInfo = KuaiShouAdvertiserBaseInfoService.getBaseInfo(accountId);
-        if (!Check.isNull(baseInfo)) {
-            List<KuaiShouAdvertiserBaseInfo> baseInfoList = KuaiShouAdvertiserBaseInfoService.getAccountIdList(baseInfo.getUserId());
-            if (!Check.isNull(baseInfoList)) {
-                for (KuaiShouAdvertiserBaseInfo advertiserBaseInfo : baseInfoList) {
-                    CtopOauthToken token = oauthTokenService.getTokenByAccountId(advertiserBaseInfo.getAccountId());
-                    if (!Check.isNull(token)) {
-                        videoExecutorService.submit(new Runnable() {
-                            @Override
-                            public void run() {
-                                iKuaishouInterfaceService.getVideoList(token, startDate, endDate);
-                            }
-                        });
-                    }
-                }
-            }
-        }
+        CtopOauthToken token = oauthTokenService.getTokenByAccountId(accountId);
+        iKuaishouInterfaceService.getVideoList(token, startDate, endDate);
     }