Pārlūkot izejas kodu

批量2.0 重新跑逻辑更新

zhaoxian 2 gadi atpakaļ
vecāks
revīzija
44cabf469a

+ 12 - 15
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouCreateCreativeJob.java

@@ -1,34 +1,39 @@
 package cn.com.ctop.job.kuaishou.handler;
 
-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.common.module.utils.HttpUtils2;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroupTemplate;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupTemplateService;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
 @Component
 public class KuaishouCreateCreativeJob {
 
-
     @Autowired
     private IKuaiShouGroupTemplateService groupTemplateService;
     @Autowired
     private ICtopOauthTokenService tokenService;
-    static ExecutorService executorService = Executors.newFixedThreadPool(5);
+
+    @Value("${xxl-job.requestUrl}")
+    private String jobUrl;
 
     /**
      * 组创建成功-创意待创建
      */
     @XxlJob("kuaihouCreateCreative")
     public void execute() {
+        String url = jobUrl + "/jeecg-boot/batch/kuaiShouGroupTemplate/createUnitAgain";
         QueryWrapper<KuaiShouGroupTemplate> templateQueryWrapper = new QueryWrapper<>();
         templateQueryWrapper.eq("task_status", 2);
         templateQueryWrapper.eq("creative_status", 0);
@@ -39,18 +44,10 @@ public class KuaishouCreateCreativeJob {
             return;
         }
         for (KuaiShouGroupTemplate template : list) {
-            executorService.submit(new Runnable() {
-                @Override
-                public void run() {
-                    CtopOauthToken token = tokenService.getTokenByAccountId(template.getAccountId());
-                    if (Check.isNull(token)) {
-                        return;
-                    }
-                    groupTemplateService.createCreative(token.getAccessToken(), template.getUnitId(), template);
-                }
-            });
-
-
+            Map<String, Object> requestMap = new HashMap<>();
+            requestMap.put("id", template.getId());
+            HttpUtils2.httpGet(url, requestMap, null);
         }
     }
+
 }