Browse Source

调整数据同步代码

yumeng 4 years ago
parent
commit
ad7d3ceba4

+ 24 - 28
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouHistoryReportTaskServiceImpl.java

@@ -289,44 +289,40 @@ public class KuaiShouHistoryReportTaskServiceImpl extends ServiceImpl<KuaiShouHi
     }
 
 
-    static ExecutorService executorService = Executors.newFixedThreadPool(20);
+    static ExecutorService executorService = Executors.newFixedThreadPool(30);
 
     @Autowired
     private ICtopOauthTokenService oauthTokenService;
 
     @Override
     public void getMd5(String statDate, Long accountId) {
-        QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("media_id", 2);
-        List<CtopOauthToken> list = oauthTokenService.list(queryWrapper);
-        for (CtopOauthToken token : list) {
-            List<KuaiShouReportDailyMaterialVo> photoList = kuaishouReportDailyMaterialMapper.getPhotoList(token.getAccountId(), statDate);
-            if (!Check.isNull(photoList)) {
-                for (KuaiShouReportDailyMaterialVo materialVo : photoList) {
-                    executorService.submit(new Runnable() {
-                        @Override
-                        public void run() {
-                            Long photoId = materialVo.getPhotoId();
-                            VideoGetvo videoGetvo = kuaishouReportDailyMaterialMapper.getVideoGetByPhotoId(photoId);
-                            if (!Check.isNull(videoGetvo)) {
-                                QueryWrapper<KuaiShouReportDailyMaterial> updateQueryWrapper = new QueryWrapper<>();
-                                updateQueryWrapper.eq("photo_id", photoId);
-                                updateQueryWrapper.isNull("signature");
-                                KuaiShouReportDailyMaterial material = new KuaiShouReportDailyMaterial();
-                                material.setSignature(videoGetvo.getSignature());
-                                material.setChannelType(videoGetvo.getChannelType());
-                                kuaishouReportDailyMaterialMapper.update(material, updateQueryWrapper);
-                                log.info("修改成功:photoId:{},accountId", photoId, token.getAccountId());
+        executorService.submit(new Runnable() {
+            @Override
+            public void run() {
+                List<KuaiShouReportDailyMaterialVo> photoList = kuaishouReportDailyMaterialMapper.getPhotoList(accountId, statDate);
+                if (!Check.isNull(photoList)) {
+                    for (KuaiShouReportDailyMaterialVo materialVo : photoList) {
+                        Long photoId = materialVo.getPhotoId();
+                        VideoGetvo videoGetvo = kuaishouReportDailyMaterialMapper.getVideoGetByPhotoId(photoId);
+                        if (!Check.isNull(videoGetvo)) {
+                            QueryWrapper<KuaiShouReportDailyMaterial> updateQueryWrapper = new QueryWrapper<>();
+                            updateQueryWrapper.eq("photo_id", photoId);
+                            if (!Check.isNull(statDate)) {
+                                updateQueryWrapper.eq("stat_date", statDate);
                             }
+
+                            updateQueryWrapper.isNull("signature");
+                            KuaiShouReportDailyMaterial material = new KuaiShouReportDailyMaterial();
+                            material.setSignature(videoGetvo.getSignature());
+                            material.setChannelType(videoGetvo.getChannelType());
+                            kuaishouReportDailyMaterialMapper.update(material, updateQueryWrapper);
+                            log.info("修改成功:photoId:{},accountId:{}", photoId, accountId);
                         }
-                    });
-                }
 
+                    }
+                }
             }
-
-
-        }
-
+        });
 
     }