yumeng 4 rokov pred
rodič
commit
4679c11f92

+ 19 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouCreateUnitJob.java

@@ -0,0 +1,19 @@
+package cn.com.ctop.job.kuaishou.handler;
+
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupTemplateService;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class KuaishouCreateUnitJob {
+
+
+    @Autowired
+    private IKuaiShouGroupTemplateService groupTemplateService;
+
+    @XxlJob("kuaihouCreateUnit")
+    public void execute() {
+        groupTemplateService.createUnit();
+    }
+}

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouGroupTemplateMapper.xml

@@ -4,7 +4,7 @@
 
     <select id="getMd5ByPhotoId" resultType="com.alibaba.fastjson.JSONObject">
     select
-    signature  as 'md5'
+    signature  as 'md5',
     material_type as 'materialType'
     from ctop_kuaishou_video_get
     where  photo_id = #{photoId}

+ 14 - 16
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouGroupTemplateServiceImpl.java

@@ -45,7 +45,7 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
     @Autowired
     private IKuaiShouMaterialUploadService uploadService;
 
-    static ExecutorService executorService = Executors.newFixedThreadPool(10);
+    static ExecutorService executorService = Executors.newFixedThreadPool(5);
 
 
     @Override
@@ -94,14 +94,14 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
         Long app_id = requestJson.getLong("appId");
         Integer show_mode = requestJson.getInteger("showMode");
         Integer speed = requestJson.getInteger("speed");
-        String click_track_url = requestJson.getString("click_track_url");
-        String actionbar_click_url = requestJson.getString("actionbar_click_url");
-        Integer creative_category = requestJson.getInteger("creative_category");
-        JSONArray creative_tag = requestJson.getJSONArray("creative_tag");
-        String creative_name = requestJson.getString("creative_name");
-        String action_bar_text = requestJson.getString("action_bar_text");
+        String click_track_url = requestJson.getString("clickTrackUrl");
+        String actionbar_click_url = requestJson.getString("actionbarClickUrl");
+        Integer creative_category = requestJson.getInteger("creativeCategory");
+        JSONArray creative_tag = requestJson.getJSONArray("creativeTag");
+        String creative_name = requestJson.getString("creativeName");
+        String action_bar_text = requestJson.getString("actionBarText");
         String description = requestJson.getString("description");
-        Long site_id = requestJson.getLong("site_id");
+        Long site_id = requestJson.getLong("siteId");
 
         List<KuaiShouGroupTemplate> templates = new ArrayList<>();
         for (int i = 0; i < createCount; i++) {
@@ -144,7 +144,7 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
                 template.setSceneId(scene_id.toJSONString());
             }
             if (!Check.isNull(unit_type)) {
-                template.setUrlType(unit_type);
+                template.setUnitType(unit_type);
             }
             if (!Check.isNull(begin_time)) {
                 template.setBeginTime(begin_time);
@@ -222,7 +222,7 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
     public void createUnit() {
         QueryWrapper<KuaiShouGroupTemplate> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("task_status", 0);
-        queryWrapper.orderByDesc("create_time");
+        queryWrapper.orderByAsc("create_time");
         queryWrapper.last("limit 30");
         List<KuaiShouGroupTemplate> list = this.list(queryWrapper);
         if (Check.isNull(list)) {
@@ -256,7 +256,7 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
                         createUnitJson.put("use_app_market", template.getUseAppMarket()); //优先从系统应用商店下载
                     }
                     if (!Check.isNull(template.getAppStore())) {
-                        createUnitJson.put("app_store", template.getAppStore()); //应用商店列表
+                        createUnitJson.put("app_store", JSONArray.parseArray(template.getAppStore())); //应用商店列表
                     }
                     if (!Check.isNull(template.getBid())) {
                         createUnitJson.put("bid", template.getBid()); //出价
@@ -274,7 +274,7 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
                         createUnitJson.put("deep_conversion_bid", template.getDeepConversionBid()); //深度转化目标出价
                     }
                     if (!Check.isNull(template.getSceneId())) {
-                        createUnitJson.put("scene_id", template.getSceneId()); //资源位置
+                        createUnitJson.put("scene_id", JSONArray.parseArray(template.getSceneId())); //资源位置
                     }
                     if (!Check.isNull(template.getUnitType())) {
                         createUnitJson.put("unit_type", template.getUnitType()); //创意制作方式
@@ -325,15 +325,13 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
                             }
                         };
                         thread.start();
-
-
                     } else {
                         updateTemplate.setTaskStatus(3);
                         updateTemplate.setReviewDetail((String) groupMap.get("message"));
                     }
                     updateById(updateTemplate);
                     try {
-                        Thread.sleep(1 * 1000);
+                        Thread.sleep(2 * 1000);
                     } catch (InterruptedException e) {
                         e.printStackTrace();
                     }
@@ -375,7 +373,7 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
             createJson.put("creative_category", template.getCreativeCategory());
         }
         if (!Check.isNull(template.getCreativeTag())) {
-            createJson.put("creative_tag", template.getCreativeTag());
+            createJson.put("creative_tag", JSONArray.parseArray(template.getCreativeTag()));
         }
         Integer materialType = md5Json.getInteger("materialType");
         JSONArray creatives = new JSONArray();

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

@@ -1091,8 +1091,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
 
                         };
                         thread.start();
-
-
                         returnMap.put("code", 0);
                         returnMap.put("message", "success");
                         returnMap.put("unitId", unitId);