|
@@ -1,8 +1,11 @@
|
|
package cn.com.ctop.job.kuaishou.handler;
|
|
package cn.com.ctop.job.kuaishou.handler;
|
|
|
|
|
|
import cn.com.ctop.common.module.entity.BindAccountLogin;
|
|
import cn.com.ctop.common.module.entity.BindAccountLogin;
|
|
|
|
+import cn.com.ctop.common.module.entity.UserAllocation;
|
|
import cn.com.ctop.common.module.service.IBindAccountLoginService;
|
|
import cn.com.ctop.common.module.service.IBindAccountLoginService;
|
|
|
|
+import cn.com.ctop.common.module.service.IUserAllocationService;
|
|
import cn.com.ctop.common.module.utils.CtopAdConstant;
|
|
import cn.com.ctop.common.module.utils.CtopAdConstant;
|
|
|
|
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouCommentService;
|
|
import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
|
|
import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
|
|
import com.xxl.job.core.context.XxlJobHelper;
|
|
import com.xxl.job.core.context.XxlJobHelper;
|
|
import com.xxl.job.core.handler.annotation.XxlJob;
|
|
import com.xxl.job.core.handler.annotation.XxlJob;
|
|
@@ -23,7 +26,6 @@ public class DeleteKuaishouCommentJob {
|
|
private IKuaishouWebInterfaceService kuaishouWebInterfaceService;
|
|
private IKuaishouWebInterfaceService kuaishouWebInterfaceService;
|
|
static ExecutorService executorService = Executors.newFixedThreadPool(5);
|
|
static ExecutorService executorService = Executors.newFixedThreadPool(5);
|
|
static CountDownLatch countDownLatch = null;
|
|
static CountDownLatch countDownLatch = null;
|
|
- //TODO 待删除
|
|
|
|
@XxlJob("deleteKuaishouComment")
|
|
@XxlJob("deleteKuaishouComment")
|
|
public void deleteKuaishouComment(){
|
|
public void deleteKuaishouComment(){
|
|
Long start = System.currentTimeMillis();
|
|
Long start = System.currentTimeMillis();
|
|
@@ -48,4 +50,37 @@ public class DeleteKuaishouCommentJob {
|
|
XxlJobHelper.log("快手删评论所用时长:{}毫秒", end - start);
|
|
XxlJobHelper.log("快手删评论所用时长:{}毫秒", end - start);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private IUserAllocationService userAllocationService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private IKuaiShouCommentService kuaiShouCommentService;
|
|
|
|
+
|
|
|
|
+ @XxlJob("deleteComment")
|
|
|
|
+ public void deleteCommentV2(){
|
|
|
|
+ Long start = System.currentTimeMillis();
|
|
|
|
+ List<UserAllocation> allocations = userAllocationService.listByMediaId(CtopAdConstant.PLATFORM_TYPE_KUAISHOU, 0);
|
|
|
|
+ if (allocations != null && !allocations.isEmpty()) {
|
|
|
|
+ countDownLatch = new CountDownLatch(allocations.size());
|
|
|
|
+ allocations.forEach(allocation -> executorService.submit(() -> {
|
|
|
|
+ try {
|
|
|
|
+ Integer deleteComment = allocation.getDeleteComment();
|
|
|
|
+ if(deleteComment.equals(0)){
|
|
|
|
+ kuaiShouCommentService.deleteComment(allocation);
|
|
|
|
+ }
|
|
|
|
+ } 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);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|