yumeng 3 years ago
parent
commit
de78773d0f

+ 15 - 8
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java

@@ -130,6 +130,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     private IKuaishouAppPackageService appPackageService;
     @Autowired
     private UserAllocationMapper allocationMapper;
+    private static ExecutorService cutExecutorService = Executors.newFixedThreadPool(10);
 
     @Override
     public void getAdvertiserReportHourly(CtopOauthToken token, Date startDate, Date endDate) {
@@ -260,13 +261,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                     videoGet.setMaterialType(type);
                 }
                 videoGetList.add(videoGet);
-                Thread thread = new Thread() {
-                    @Override
-                    public void run() {
-                        videoGetService.getKeyFrame(token.getAccessToken(), token.getAccountId(), signature, photo_id);
-                    }
-                };
-                thread.start();
+                getCut(token.getAccessToken(), token.getAccountId(), signature, photo_id);
             }
             if (!Check.isNull(videoGetList)) {
                 videoGetService.replaceBatch(videoGetList);
@@ -281,6 +276,18 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
 
     }
 
+
+    private void getCut(String token, Long accountId, String signature, String photo_id) {
+        cutExecutorService.submit(new Runnable() {
+            @Override
+            public void run() {
+                videoGetService.getKeyFrame(token, accountId, signature, photo_id);
+            }
+        });
+
+    }
+
+
     @Override
     public void getAdvertiserReportDaily(CtopOauthToken token, Date startDate, Date endDate, String reportDims) {
         try {
@@ -1221,7 +1228,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
             return;
         }
         addGroup(token.getAccountId(), details);
-     //   ruleKuaiShouPlanService.insertTarget(token.getAccountId(), details);
+        //   ruleKuaiShouPlanService.insertTarget(token.getAccountId(), details);
         getGroupListByPage(token, startDate, endDate, page + 1);
     }