Sfoglia il codice sorgente

添加快手删评论job

syh 4 anni fa
parent
commit
a51ea97899

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

@@ -12,7 +12,6 @@ import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouDailyReportTaskServic
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouHistoryReportTaskService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
 import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
-import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyAccountMapper;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouCostGroupService;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyAgentService;
 import cn.com.ctop.oa.modules.service.IWechatCheckinDataService;
@@ -22,7 +21,6 @@ import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataServ
 import cn.com.ctop.toutiao.modules.report.service.IBytedanceFundDailyService;
 import cn.com.ctop.toutiao.modules.report.service.IReportService;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.xxl.job.core.context.XxlJobHelper;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
 import org.junit.Test;
@@ -58,8 +56,6 @@ public class SampleTest {
     private IKuaiShouHistoryReportTaskService kuaiShouHistoryReportTaskService;
     @Autowired
     private ICtopOauthTokenService tokenService;
-    @Autowired
-    private KuaishouReportDailyAccountMapper reportDailyAccountMapper;
 
     @Test
     public void loadBytedanceCreativeData() {

+ 50 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/DeleteKuaishouCommentJob.java

@@ -0,0 +1,50 @@
+package cn.com.ctop.job.kuaishou.handler;
+
+import cn.com.ctop.common.module.entity.BindAccountLogin;
+import cn.com.ctop.common.module.service.IBindAccountLoginService;
+import cn.com.ctop.common.module.utils.CtopAdConstant;
+import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
+import com.xxl.job.core.context.XxlJobHelper;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+@Component
+public class DeleteKuaishouCommentJob {
+    @Autowired
+    private IBindAccountLoginService bindAccountLoginService;
+    @Autowired
+    private IKuaishouWebInterfaceService kuaishouWebInterfaceService;
+    static ExecutorService executorService = Executors.newFixedThreadPool(5);
+    static CountDownLatch countDownLatch = null;
+    @XxlJob("deleteKuaishouComment")
+    public void deleteKuaishouComment(){
+        Long start = System.currentTimeMillis();
+        List<BindAccountLogin> loginList = bindAccountLoginService.getListByParams(CtopAdConstant.PLATFORM_TYPE_KUAISHOU_PY, 1);
+        if (loginList != null && !loginList.isEmpty()) {
+            countDownLatch = new CountDownLatch(loginList.size());
+            loginList.forEach(login -> executorService.submit(() -> {
+                try {
+                    kuaishouWebInterfaceService.deleteAllComment(new HashMap<>(), login);
+                } catch (Exception e) {
+                    XxlJobHelper.log(e.getMessage(), e);
+                } finally {
+                    countDownLatch.countDown();
+                }
+            }));
+            try {
+                countDownLatch.await();
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+            Long end = System.currentTimeMillis();
+            XxlJobHelper.log("快手删评论所用时长:{}毫秒", end - start);
+        }
+    }
+}

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

@@ -184,8 +184,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
             kuaishouReportHourlyAccount.setUpdateTime(new Date());
             hourlyAccountService.saveOrUpdate(kuaishouReportHourlyAccount);
         }
-
-
     }