Переглянути джерело

Merge remote-tracking branch 'origin/V1.1.3' into V1.1.3

syh 4 роки тому
батько
коміт
37e328ff04
16 змінених файлів з 176 додано та 127 видалено
  1. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java
  2. 10 11
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/mapper/xml/PlatformScriptMapper.xml
  3. 24 11
      jeecg-boot-module-system/src/main/resources/application-jiaoyang.yml
  4. 21 21
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  5. 1 1
      module-common/src/main/java/cn/com/ctop/common/module/controller/OauthConfigController.java
  6. 1 1
      module-common/src/main/java/cn/com/ctop/common/module/entity/OauthConfig.java
  7. 1 1
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/CtopOauthTokenMapper.xml
  8. 4 0
      module-job-kuaishou/src/main/resources/application-jiaoyang.yml
  9. 27 19
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/KuaiShouCreativeRefusalController.java
  10. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouInterfaceController.java
  11. 1 58
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/MaterialRefuseController.java
  12. 2 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouCreativeMapper.java
  13. 7 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouCreativeMapper.xml
  14. 5 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouCreativeService.java
  15. 63 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouCreativeServiceImpl.java
  16. 7 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java

+ 1 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java

@@ -186,6 +186,7 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/template/**", "anon");
         filterChainDefinitionMap.put("/batch/kuaiShouGroupTemplate/*", "anon");
         filterChainDefinitionMap.put("/kuaishouBatch/**", "anon");
+        filterChainDefinitionMap.put("/kuaishou/creative/*", "anon");
 
         // 添加自己的过滤器并且取名为jwt
         Map<String, Filter> filterMap = new HashMap<>(1);

+ 10 - 11
jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/mapper/xml/PlatformScriptMapper.xml

@@ -4,18 +4,17 @@
 
     <select id="pageQuery" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
-            t1.id,
-            t1.`name`,
-            t1.size,
-            t1.create_time,
-            FROM_UNIXTIME(CAST(t1.create_time/1000 AS INT)) as createTime,
-            (SELECT realname from sys_user where id=t1.creator limit 1) as creatorName,
-            (SELECT project_name from ctop_project where id=t1.project_id limit 1) as projectName,
-            t2.material_name as materialName
-
+        t1.id,
+        t1.`name`,
+        t1.size,
+        t1.create_time,
+        FROM_UNIXTIME(ROUND((t1.create_time/1000),0)) as createTime,
+        (SELECT realname from sys_user where id=t1.creator limit 1) as creatorName,
+        (SELECT project_name from ctop_project where id=t1.project_id limit 1) as projectName,
+        t2.material_name as materialName
         FROM
-            ctop_platform_script t1
-                LEFT JOIN ctop_platform_material t2 ON t1.id = t2.script_id
+        ctop_platform_script t1
+        LEFT JOIN ctop_platform_material t2 ON t1.id = t2.script_id
         where t2.material_code is not null
         <if test="projectId != null">
             AND t1.project_id= #{projectId}

+ 24 - 11
jeecg-boot-module-system/src/main/resources/application-jiaoyang.yml

@@ -1,5 +1,5 @@
 server:
-  port: 8804
+  port: 8805
   ip: 39.97.120.42
   servlet:
     context-path: /jeecg-boot
@@ -28,8 +28,8 @@ spring:
           starttls:
             enable: true
             required: true
-  ## quartz定时任务,采用数据库方式
-  #quartz:
+    ## quartz定时任务,采用数据库方式
+    #quartz:
     #job-store-type: jdbc
   #json 时间戳统一转换
   jackson:
@@ -67,14 +67,14 @@ spring:
   autoconfigure:
     exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
   datasource:
-    url: jdbc:mysql://172.30.0.4:4000/jiaoyang?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+    url: jdbc:mysql://172.30.0.4:4000/jiaoyang?characterEncoding=UTF-8&useUnicode=true&allowMultiQueries=true&useSSL=false
     username: hcst
     password: hcst@2020
     driver-class-name: com.mysql.jdbc.Driver
     druid:
       stat-view-servlet:
         loginUsername: admin
-        loginPassword: hcst20161
+        loginPassword: hcst2016
         enabled: true
       web-stat-filter:
         enabled: true
@@ -106,10 +106,16 @@ spring:
         connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
       datasource:
         master:
-          url: jdbc:mysql://172.30.0.4:4000/jiaoyang?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+          url: jdbc:mysql://172.30.0.4:4000/jiaoyang?characterEncoding=UTF-8&useUnicode=true&allowMultiQueries=true&useSSL=false
           username: hcst
           password: hcst@2020
           driver-class-name: com.mysql.jdbc.Driver
+          # 多数据源配置
+          #multi-datasource1:
+          #url: jdbc:mysql://localhost:3306/jeecg-boot2?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true
+          #username: root
+          #password: root
+          #driver-class-name: com.mysql.jdbc.Driver
   #redis 配置
   redis:
     database: 0
@@ -138,6 +144,13 @@ mybatis-plus:
 #    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
 #jeecg专用配置
 jeecg:
+  #积木报表设置
+  jmreport:
+    mode: dev
+    #是否需要校验token
+    is_verify_token: false
+    #必须校验方法
+    verify_methods: remove,delete,save,add,update
   elasticsearch:
     cluster-nodes:
     check-enabled: false
@@ -175,12 +188,12 @@ jeecg:
 kuaishou:
   api-url: https://ad.e.kuaishou.com
   auth-url: https://ad.e.kuaishou.com
-  appid: 328
+  appid: 27
   third-appid: 328
   oauth-type: agent
-  secret: 1iFTBiMdohkyEQQs
+  secret: QovprB1tNhXptgDc
   third-secret: 1iFTBiMdohkyEQQs
-  callback-url: http://callback.shyouteng.com.cn/kuaishou
+  callback-url: http://adsp.c-top.com.cn:8080/jeecg-boot/kuaishou
   third-callback-url: http://callback.shyouteng.com.cn/kuaishou
   apk-sava-path: /mnt/file/apk
   image-sava-path: /mnt/file/image
@@ -246,5 +259,5 @@ bytedance:
     advertiser-fund-daily-stat: /2/advertiser/fund/daily_stat/
 ai:
   callback:
-    callback-unit-url: http://192.168.1.193:31012/ai_callback_add_group
-    callback-creative-url: http://192.168.1.193:31012/ai_callback_add_creative
+    callback-unit-url: http://139.186.27.96:31012/ai_callback_add_group
+    callback-creative-url: http://139.186.27.96:31012/ai_callback_add_creative

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

@@ -4,16 +4,11 @@ import cn.com.ctop.common.module.entity.BindAccountLogin;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.mapper.CtopOauthTokenMapper;
-import cn.com.ctop.common.module.service.IBindAccountLoginService;
-import cn.com.ctop.common.module.service.ICtopOauthTokenService;
-import cn.com.ctop.common.module.service.IOauthConfigService;
-import cn.com.ctop.common.module.service.IUserAllocationService;
-import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.service.*;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
 import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAccountTargetTemplate;
 import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouAccountTargetTemplateService;
 import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouNewCreateCampaign;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet;
 import cn.com.ctop.kuaishou.modules.batch.service.*;
 import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyAgentService;
@@ -26,14 +21,10 @@ import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataServ
 import cn.com.ctop.toutiao.modules.report.entity.BytedanceAccountReportTaskRecord;
 import cn.com.ctop.toutiao.modules.report.mapper.BytedanceReportMaterialDailyMapper;
 import cn.com.ctop.toutiao.modules.report.service.*;
-import com.alibaba.fastjson.JSONArray;
-import com.xxl.job.core.context.XxlJobHelper;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.catalina.User;
 import org.jeecg.common.util.DateUtils;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.openqa.selenium.By;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.test.context.ActiveProfiles;
@@ -45,7 +36,6 @@ import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
@@ -77,13 +67,22 @@ public class SampleTest {
     private IOauthConfigService configService;
     @Autowired
     private CtopOauthTokenMapper oauthTokenMapper;
+    @Autowired
+    private IKuaishouInterfaceService iKuaishouInterfaceService;
+    @Autowired
+    private IRefreshTokenService refreshTokenService;
 
 
     @Test
     public void loadBytedanceCreativeData() throws ParseException {
+        CtopOauthToken token = oauthTokenMapper.selectByAccountId(9784689L);
+
+        refreshTokenService.getKuaiShouRefresh();
+
 
+     //   iKuaishouInterfaceService.getVideoList(token, null, null);
 
-        List<CtopOauthToken> oauthTokens = oauthTokenMapper.selectKuaiShouTokens(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
+      /*  List<CtopOauthToken> oauthTokens = oauthTokenMapper.selectKuaiShouTokens(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
         if (!Check.isNull(oauthTokens)) {
             Map<Long, String> configMap = configService.getConfigMapByMediaId(CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT);
             for (CtopOauthToken oauthToken : oauthTokens) {
@@ -97,7 +96,7 @@ public class SampleTest {
             }
         } else {
             XxlJobHelper.log("----------------------刷新token获取数据返回结果为空----------------------------------");
-        }
+        }*/
 
 
       /*  Map<Long, String> configMap = configService.getConfigMapByMediaId(CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT);
@@ -423,15 +422,16 @@ public class SampleTest {
 
     @Autowired
     private IBytedanceAccountReportTaskRecordService reportTaskRecordService;
+
     @Test
     public void execute() {
-        List<UserAllocation>  allocations = allocationService.listByMediaId("3",0);
-        for (UserAllocation allocation:allocations) {
-            BytedanceAccountReportTaskRecord reportTaskRecord1 = new BytedanceAccountReportTaskRecord(allocation.getAccountId(),"2020-10-01","2020-10-31");
+        List<UserAllocation> allocations = allocationService.listByMediaId("3", 0);
+        for (UserAllocation allocation : allocations) {
+            BytedanceAccountReportTaskRecord reportTaskRecord1 = new BytedanceAccountReportTaskRecord(allocation.getAccountId(), "2020-10-01", "2020-10-31");
             reportTaskRecordService.save(reportTaskRecord1);
-            BytedanceAccountReportTaskRecord reportTaskRecord2 = new BytedanceAccountReportTaskRecord(allocation.getAccountId(),"2020-11-01","2020-11-30");
+            BytedanceAccountReportTaskRecord reportTaskRecord2 = new BytedanceAccountReportTaskRecord(allocation.getAccountId(), "2020-11-01", "2020-11-30");
             reportTaskRecordService.save(reportTaskRecord2);
-            BytedanceAccountReportTaskRecord reportTaskRecord3 = new BytedanceAccountReportTaskRecord(allocation.getAccountId(),"2020-12-01","2020-12-31");
+            BytedanceAccountReportTaskRecord reportTaskRecord3 = new BytedanceAccountReportTaskRecord(allocation.getAccountId(), "2020-12-01", "2020-12-31");
             reportTaskRecordService.save(reportTaskRecord3);
         }
     }
@@ -538,15 +538,15 @@ public class SampleTest {
 //        }
 
         AiKuaishouAccountTargetTemplate accountTargetTemplate2 = aiKuaishouAccountTargetTemplateService.getById(120001);
-        aiKuaishouNewCreateCampaign.kuaishouAiAddNewMaterialCreativity(accountTargetTemplate2,1);
+        aiKuaishouNewCreateCampaign.kuaishouAiAddNewMaterialCreativity(accountTargetTemplate2, 1);
     }
 
     @Autowired
     private IBytedancePlanDailyReportService planDailyReportService;
 
     @Test
-    public void etlKuaishouProjectData(){
+    public void etlKuaishouProjectData() {
         CtopOauthToken token = tokenService.getTokenByAccountId(1660666858777607L);
-        reportService.getAdvertiserPlanReport(token,DateUtils.parseDate("2021-01-25","yyyy-MM-dd"),DateUtils.parseDate("2021-01-25","yyyy-MM-dd"),CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+        reportService.getAdvertiserPlanReport(token, DateUtils.parseDate("2021-01-25", "yyyy-MM-dd"), DateUtils.parseDate("2021-01-25", "yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
     }
 }

+ 1 - 1
module-common/src/main/java/cn/com/ctop/common/module/controller/OauthConfigController.java

@@ -64,7 +64,7 @@ public class OauthConfigController {
                                                    HttpServletRequest req) {
         Result<List<OauthConfig>> result = new Result<>();
         QueryWrapper<OauthConfig> queryWrapper = QueryGenerator.initQueryWrapper(oauthConfig, req.getParameterMap());
-        queryWrapper.orderByAsc("rank");
+        queryWrapper.orderByAsc("agent_rank");
         List<OauthConfig> pageList = oauthConfigService.list(queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);

+ 1 - 1
module-common/src/main/java/cn/com/ctop/common/module/entity/OauthConfig.java

@@ -72,7 +72,7 @@ public class OauthConfig {
      */
     @Excel(name = "排序", width = 15)
     @ApiModelProperty(value = "排序")
-    private Integer rank;
+    private Integer agentRank;
 
     String callbackUrl;
     /**

+ 1 - 1
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/CtopOauthTokenMapper.xml

@@ -12,7 +12,7 @@
         <result column="access_token_expires_in" property="accessTokenExpiresIn" jdbcType="TIMESTAMP"/>
         <result column="refresh_token_expires_in" property="refreshTokenExpiresIn" jdbcType="TIMESTAMP"/>
         <result column="agent_type" property="agentType" jdbcType="INTEGER"/>
-        <result column="app_id" property="appId" jdbcType="INTEGER"/>
+        <result column="app_id" property="appId" jdbcType="BIGINT"/>
         <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
         <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
     </resultMap>

+ 4 - 0
module-job-kuaishou/src/main/resources/application-jiaoyang.yml

@@ -228,3 +228,7 @@ xxl:
       logretentiondays: 30
     admin:
       addresses: http://129.28.150.229:8090/xxl-job-admin
+ai:
+  callback:
+    callback-unit-url: http://192.168.1.193:31012/ai_callback_add_group
+    callback-creative-url: http://192.168.1.193:31012/ai_callback_add_creative

+ 27 - 19
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/KuaiShouCreativeRefusalController.java

@@ -42,7 +42,7 @@ public class KuaiShouCreativeRefusalController {
     private IKuaiShouImageGetService imageGetService;
     @Autowired
     private IKuaiShouMaterialUploadService uploadService;
-    static ExecutorService executorService = Executors.newFixedThreadPool(50);
+    static ExecutorService executorService = Executors.newFixedThreadPool(100);
 
     /**
      * 吃创意拒审重提
@@ -65,9 +65,13 @@ public class KuaiShouCreativeRefusalController {
             if (Check.isNull(oauthToken)) {
                 throw new Exception("未获取到账户信息");
             }
+            Integer updateType = requestJson.getInteger("updateType"); //  0 更换封面 1 修改广告语
+            if (Check.isNull(updateType)) {
+                throw new Exception("请输入修改类型");
+            }
             JSONArray creativeIds = requestJson.getJSONArray("creativeIds");
             if (Check.isNull(creativeIds)) {
-                throw new Exception("请传入需要重提的创意id列表");
+                creativeIds = creativeService.getCreativeIds(accountId);
             }
             for (int i = 0; i < creativeIds.size(); i++) {
                 Long creativeId = creativeIds.getLong(i);
@@ -76,23 +80,29 @@ public class KuaiShouCreativeRefusalController {
                     public void run() {
                         KuaiShouCreative creative = creativeService.getCreativeByCreativeId(creativeId);
                         if (!Check.isNull(creative)) {
-                            JSONObject cutJson = cutFrameService.getCutFrameByVideoMd5(creative.getPhotoId(), creative.getImageToken());
-                            if (!Check.isNull(cutJson)) {
-                                String signature = cutJson.getString("signature");
-                                String url = cutJson.getString("url");
-                                String imageToken = getImageToken(signature, accountId, oauthToken.getAccessToken(), url);
-                                if (!Check.isNull(imageToken)) {
-                                    JSONObject updateJson = new JSONObject();
-                                    updateJson.put("creativeId", creativeId);
-                                    updateJson.put("imageToken", imageToken);
-                                    Map<String, Object> creativeMap = updateService.updateCreative(oauthToken.getAccessToken(), accountId, requestJson);
-                                    Integer code = (Integer) creativeMap.get("code");
-                                    if (code == 0) {
-                                        log.info("自动投放拒审重提成功,accountId:{},creativeId:{}", accountId, creativeId);
-                                    } else {
-                                        log.info("自动投放拒审重提失败,accountId:{},creativeId:{}", accountId, creativeId);
+                            JSONObject updateJson = new JSONObject();
+                            updateJson.put("creativeId", creativeId);
+                            if (updateType == 0) {  //  更换封面
+                                JSONObject cutJson = cutFrameService.getCutFrameByVideoMd5(creative.getPhotoId(), creative.getImageToken());
+                                if (!Check.isNull(cutJson)) {
+                                    String signature = cutJson.getString("signature");
+                                    String url = cutJson.getString("url");
+                                    String imageToken = getImageToken(signature, accountId, oauthToken.getAccessToken(), url);
+                                    if (!Check.isNull(imageToken)) {
+                                        updateJson.put("imageToken", imageToken);
+
                                     }
                                 }
+                            } else if (updateType == 1) { // 修改广告语
+                                String updateDescription = creativeService.convertMoString(creative.getDescription());
+                                updateJson.put("description", updateDescription);
+                            }
+                            Map<String, Object> creativeMap = updateService.updateCreative(oauthToken.getAccessToken(), accountId, updateJson);
+                            Integer code = (Integer) creativeMap.get("code");
+                            if (code == 0) {
+                                log.info("自动投放拒审重提成功,accountId:{},creativeId:{}", accountId, creativeId);
+                            } else {
+                                log.info("自动投放拒审重提失败,accountId:{},creativeId:{}", accountId, creativeId);
                             }
                         }
                     }
@@ -121,8 +131,6 @@ public class KuaiShouCreativeRefusalController {
         } else {
             imageToken = uploadService.kuauiShouImageUpload(url, md5, accountId, accessToken);
         }
-
-
         return imageToken;
 
     }

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouInterfaceController.java

@@ -38,6 +38,7 @@ public class KuaiShouInterfaceController {
                 result.setSuccess(false);
                 result.setMessage("时间参数不能为空");
                 return result;
+
             }
 
             if(operationTarget == null){
@@ -45,7 +46,6 @@ public class KuaiShouInterfaceController {
                 result.setMessage("类型不能为空");
                 return result;
             }
-
             if(accountId == null){
                 //1:查询当日数据
                 QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();

+ 1 - 58
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/MaterialRefuseController.java

@@ -192,7 +192,7 @@ public class MaterialRefuseController {
                 requestJson.put("creativeId", creativeId);
                 if (type == 0) {  // 替换修改广告语
                     String description = creativeJson.getString("description");
-                    requestJson.put("description", convertMoString(description));
+                    requestJson.put("description", creativeService.convertMoString(description));
                 } else if (type == 1) { // 替换广告语
                     String updateDescription = jsonObject.getString("updateDescription");
                     String updateActionBarText = jsonObject.getString("updateActionBarText");
@@ -234,61 +234,4 @@ public class MaterialRefuseController {
     }
 
 
-    public static synchronized String convertMoString(String sMo) {
-
-        if (Check.isNull(sMo)) {
-            return null;
-        }
-        String newString = null;
-        try {
-            if (sMo.contains(",")) {
-                return sMo.replace(',', ',');
-            } else if (sMo.contains("~")) {
-                newString = sMo.replace('~', '~');
-            } else if (sMo.contains("。")) {
-                newString = sMo.replace('。', '.');
-            } else if (sMo.contains(";")) {
-                newString = sMo.replace(';', ';');
-            } else if (sMo.contains("!")) {
-                newString = sMo.replace("!", "!");
-            } else if (sMo.contains("?")) {
-                newString = sMo.replace('?', '?');
-            } else if (sMo.contains(":")) {
-                newString = sMo.replace(':', ':');
-            } else if (sMo.contains("“")) {
-                newString = sMo.replace('“', '"');
-            } else if (sMo.contains("”")) {
-                newString = sMo.replace('”', '"');
-            } else if (sMo.contains("<")) {
-                newString = sMo.replace('>', '》').replace('<', '《');
-            } else if (sMo.contains(",")) {
-                newString = sMo.replace(',', ',');
-            } else if (sMo.contains(".")) {
-                newString = sMo.replace('.', '。');
-            } else if (sMo.contains(";")) {
-                newString = sMo.replace(';', ';');
-            } else if (sMo.contains("!")) {
-                newString = sMo.replace("!", "!");
-            } else if (sMo.contains("?")) {
-                newString = sMo.replace('?', '?');
-            } else if (sMo.contains(":")) {
-                newString = sMo.replace(':', ':');
-            } else if (sMo.contains(""")) {
-                newString = sMo.replace('"', '“');
-            } else if (sMo.contains(""")) {
-                newString = sMo.replace('"', '”');
-            } else if (sMo.contains("《")) {
-                newString = sMo.replace('》', '>').replace('《', '<');
-            } else if (sMo.contains("~")) {
-                newString = sMo.replace('~', '~');
-            } else {
-                newString = sMo;
-            }
-
-        } catch (Exception ex) {
-            return sMo;
-        }
-        return newString;
-    }
-
 }

+ 2 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouCreativeMapper.java

@@ -26,4 +26,6 @@ public interface KuaiShouCreativeMapper extends BaseMapper<KuaiShouCreative> {
     void delAllCreativesByCampaignId(@Param("accountId") Long accountId, @Param("campaignId") Long campaignId);
 
     List<KuaiShouCreative> queryCreativeInfoByCampaignId(@Param("accountId") Long accountId, @Param("campaignId") Long campaignId);
+
+    List<Long> getCreativeIds(@Param("accountId") Long accountId);
 }

+ 7 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouCreativeMapper.xml

@@ -141,4 +141,11 @@
          AND campaign_id = #{campaignId}
     </select>
 
+    <select id="getCreativeIds" resultType="java.lang.Long">
+     select  creative_id
+     from ctop_kuaishou_creative
+     where  account_id = #{accountId}
+     and  status = 42
+    </select>
+
 </mapper>

+ 5 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouCreativeService.java

@@ -1,6 +1,7 @@
 package cn.com.ctop.kuaishou.modules.batch.service;
 
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCreative;
+import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.extension.service.IService;
 
 import java.util.List;
@@ -57,4 +58,8 @@ public interface IKuaiShouCreativeService extends IService<KuaiShouCreative> {
     List<KuaiShouCreative> queryCreativeInfoByCampaignId(Long accountId, Long campaignId);
 
     KuaiShouCreative getCreativeByCreativeId(Long creativeId);
+
+    JSONArray getCreativeIds(Long accountId);
+
+    public String convertMoString(String sMo);
 }

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

@@ -207,5 +207,68 @@ public class KuaiShouCreativeServiceImpl extends ServiceImpl<KuaiShouCreativeMap
         return creative;
     }
 
+    @Override
+    public JSONArray getCreativeIds(Long accountId) {
+        List<Long> creativeIds = kuaiShouCreativeMapper.getCreativeIds(accountId);
+        return JSONArray.parseArray(creativeIds.toString());
+    }
+
+    @Override
+    public synchronized String convertMoString(String sMo) {
+        if (Check.isNull(sMo)) {
+            return null;
+        }
+        String newString = null;
+        try {
+            if (sMo.contains(",")) {
+                return sMo.replace(',', ',');
+            } else if (sMo.contains("~")) {
+                newString = sMo.replace('~', '~');
+            } else if (sMo.contains("。")) {
+                newString = sMo.replace('。', '.');
+            } else if (sMo.contains(";")) {
+                newString = sMo.replace(';', ';');
+            } else if (sMo.contains("!")) {
+                newString = sMo.replace("!", "!");
+            } else if (sMo.contains("?")) {
+                newString = sMo.replace('?', '?');
+            } else if (sMo.contains(":")) {
+                newString = sMo.replace(':', ':');
+            } else if (sMo.contains("“")) {
+                newString = sMo.replace('“', '"');
+            } else if (sMo.contains("”")) {
+                newString = sMo.replace('”', '"');
+            } else if (sMo.contains("<")) {
+                newString = sMo.replace('>', '》').replace('<', '《');
+            } else if (sMo.contains(",")) {
+                newString = sMo.replace(',', ',');
+            } else if (sMo.contains(".")) {
+                newString = sMo.replace('.', '。');
+            } else if (sMo.contains(";")) {
+                newString = sMo.replace(';', ';');
+            } else if (sMo.contains("!")) {
+                newString = sMo.replace("!", "!");
+            } else if (sMo.contains("?")) {
+                newString = sMo.replace('?', '?');
+            } else if (sMo.contains(":")) {
+                newString = sMo.replace(':', ':');
+            } else if (sMo.contains(""")) {
+                newString = sMo.replace('"', '“');
+            } else if (sMo.contains(""")) {
+                newString = sMo.replace('"', '”');
+            } else if (sMo.contains("《")) {
+                newString = sMo.replace('》', '>').replace('《', '<');
+            } else if (sMo.contains("~")) {
+                newString = sMo.replace('~', '~');
+            } else {
+                newString = sMo;
+            }
+
+        } catch (Exception ex) {
+            return sMo;
+        }
+        return newString;
+    }
+
 
 }

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

@@ -200,7 +200,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
             JSONObject resultJson = JSONObject.parseObject(result);
             if (Check.isNull(resultJson)) {
                 return;
-
             }
             Integer code = resultJson.getInteger("code");
             String message = resultJson.getString("message");
@@ -1022,8 +1021,13 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                     JSONObject dataJson = resultJson.getJSONObject("data");
                     if (!Check.isNull(dataJson)) {
                         Long unitId = dataJson.getLong("unit_id");
-                        Thread.sleep(100);
-                        getKuaiShouGroupService.getGroupByUnitId(accessToken, advertiserId, unitId);
+                        Thread.sleep(100);Thread thread = new Thread(){
+                            @Override
+                            public void run(){
+                                getKuaiShouGroupService.getGroupByUnitId(accessToken, advertiserId, unitId);
+                            }
+                        };
+                        thread.start();
                         returnMap.put("code", 0);
                         returnMap.put("message", "success");
                         returnMap.put("unitId", unitId);