Ver código fonte

Merge branch 'master' into dimension

# Conflicts:
#	jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java
#	jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
#	module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceVideoReportMapper.xml
yumeng 3 anos atrás
pai
commit
8d2794ad98

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

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

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/MaterialReportOverViewMapper.xml

@@ -433,7 +433,7 @@
                 #{item}
             </foreach>
         </if>
-        AND stat_datetime &gt; #{startDate}
+        AND stat_datetime &gt;= #{startDate}
         AND stat_datetime &lt;= #{endDate}
         AND md5!=''
         GROUP BY md5

+ 15 - 8
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/MaterialReportOverViewServiceImpl.java

@@ -29,6 +29,7 @@ import java.io.OutputStream;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -85,6 +86,10 @@ public class MaterialReportOverViewServiceImpl implements IMaterialReportOverVie
 
     @Override
     public Map<String, Object> getTotalModule(int mediaId, String startDate, String endDate, JSONArray projects) {
+
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        String nowData = sdf.format(new Date());
+
         Map<String, Object> result = new HashMap<>();
         if (projects.isEmpty()) {
             projects = getProjectsByCurrentUser(mediaId);
@@ -98,9 +103,9 @@ public class MaterialReportOverViewServiceImpl implements IMaterialReportOverVie
             //同比 (本阶段截止昨天消耗-上一个阶段截止和昨天对应日期的消耗)/上一个阶段截止和昨天对应日期的消耗 X 100%
             result.put("yearOnYearCompare", countLink(cost,lastCost));
             //昨日消耗
-            BigDecimal yesterdayCost = materialReportOverViewMapper.queryBytedanceCost(endDate, endDate, projects);
+            BigDecimal yesterdayCost = materialReportOverViewMapper.queryBytedanceCost(DateUtils.addDay(nowData, -1), DateUtils.addDay(nowData, -1), projects);
             //前天消耗
-            BigDecimal beforeYesterdayCost = materialReportOverViewMapper.queryBytedanceCost(DateUtils.addDay(endDate, -1), DateUtils.addDay(endDate, -1), projects);
+            BigDecimal beforeYesterdayCost = materialReportOverViewMapper.queryBytedanceCost(DateUtils.addDay(nowData, -2), DateUtils.addDay(nowData, -2), projects);
             result.put("yesterdayCost", yesterdayCost);
             //环比 (昨日消耗-前日消耗)/前日消耗 X 100%
             result.put("chainCompare", countLink(yesterdayCost,beforeYesterdayCost));
@@ -114,9 +119,9 @@ public class MaterialReportOverViewServiceImpl implements IMaterialReportOverVie
             //同比 (本阶段截止昨天消耗-上一个阶段截止和昨天对应日期的消耗)/上一个阶段截止和昨天对应日期的消耗 X 100%
             result.put("yearOnYearCompare", countLink(cost,lastCost));
             //昨日消耗
-            BigDecimal yesterdayCost = materialReportOverViewMapper.queryKuaishouCost(endDate, endDate, projects);
+            BigDecimal yesterdayCost = materialReportOverViewMapper.queryKuaishouCost(DateUtils.addDay(nowData, -1), DateUtils.addDay(nowData, -1), projects);
             //前天消耗
-            BigDecimal beforeYesterdayCost = materialReportOverViewMapper.queryKuaishouCost(DateUtils.addDay(endDate, -1), DateUtils.addDay(endDate, -1), projects);
+            BigDecimal beforeYesterdayCost = materialReportOverViewMapper.queryKuaishouCost(DateUtils.addDay(nowData, -2), DateUtils.addDay(nowData, -2), projects);
             result.put("yesterdayCost", yesterdayCost);
             //环比 (昨日消耗-前日消耗)/前日消耗 X 100%
             result.put("chainCompare", countLink(yesterdayCost,beforeYesterdayCost));
@@ -178,6 +183,8 @@ public class MaterialReportOverViewServiceImpl implements IMaterialReportOverVie
     //爆款视频
     @Override
     public Map<String, Object> sumDataVideoHot(int mediaId, String startDate, String endDate, JSONArray projects) {
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        String nowData = sdf.format(new Date());
         Map<String, Object> result = new HashMap<>();
         if (projects.isEmpty()) {
             projects = getProjectsByCurrentUser(mediaId);
@@ -195,9 +202,9 @@ public class MaterialReportOverViewServiceImpl implements IMaterialReportOverVie
             //同比 (本阶段截止昨天的爆款视频数量-上一个阶段截止和昨天对应日期的爆款视频数量)/上一个阶段截止和昨天对应日期的爆款视频数量X 100%
             result.put("hotYearOnYearCompare", countLink(new BigDecimal(hotTotal),new BigDecimal(lastHotTotal)));
             //昨日消耗
-            List<Map<String, String>> yesterdayHost = materialReportOverViewMapper.selectHotMaterialVideoBytedance(endDate,endDate, projects);
+            List<Map<String, String>> yesterdayHost = materialReportOverViewMapper.selectHotMaterialVideoBytedance(DateUtils.addDay(nowData, -1),DateUtils.addDay(nowData, -1), projects);
             //前天消耗
-            List<Map<String, String>> beforeYesterdayHost = materialReportOverViewMapper.selectHotMaterialVideoBytedance(DateUtils.addDay(endDate, -1), DateUtils.addDay(endDate, -1), projects);
+            List<Map<String, String>> beforeYesterdayHost = materialReportOverViewMapper.selectHotMaterialVideoBytedance(DateUtils.addDay(nowData, -2), DateUtils.addDay(nowData, -2), projects);
             long yesterday = yesterdayHost.stream().collect(Collectors.summarizingInt(s->Integer.valueOf(String.valueOf(s.get("count"))))).getSum();
             long before = beforeYesterdayHost.stream().collect(Collectors.summarizingInt(s->Integer.valueOf(String.valueOf(s.get("count"))))).getSum();
             //环比 (昨日-前日)/前日消耗 X 100%
@@ -216,9 +223,9 @@ public class MaterialReportOverViewServiceImpl implements IMaterialReportOverVie
             //同比 (本阶段截止昨天的爆款视频数量-上一个阶段截止和昨天对应日期的爆款视频数量)/上一个阶段截止和昨天对应日期的爆款视频数量X 100%
             result.put("hotYearOnYearCompare", countLink(new BigDecimal(hotTotal),new BigDecimal(lastHotTotal)));
             //昨日消耗
-            List<Map<String, String>> yesterdayHost = materialReportOverViewMapper.selectHotMaterialVideoKs(endDate,endDate, projects);
+            List<Map<String, String>> yesterdayHost = materialReportOverViewMapper.selectHotMaterialVideoKs(DateUtils.addDay(nowData, -1),DateUtils.addDay(nowData, -1), projects);
             //前天消耗
-            List<Map<String, String>> beforeYesterdayHost = materialReportOverViewMapper.selectHotMaterialVideoKs(DateUtils.addDay(endDate, -1), DateUtils.addDay(endDate, -1), projects);
+            List<Map<String, String>> beforeYesterdayHost = materialReportOverViewMapper.selectHotMaterialVideoKs(DateUtils.addDay(nowData, -2), DateUtils.addDay(nowData, -2), projects);
             long yesterday = yesterdayHost.stream().collect(Collectors.summarizingInt(s->Integer.valueOf(String.valueOf(s.get("count"))))).getSum();
             long before = beforeYesterdayHost.stream().collect(Collectors.summarizingInt(s->Integer.valueOf(String.valueOf(s.get("count"))))).getSum();
             //环比 (昨日-前日)/前日消耗 X 100%

+ 67 - 48
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouAiProjectCreativeJob.java

@@ -41,21 +41,27 @@ public class KuaishouAiProjectCreativeJob {
             return;
         }
         String url = jobUrl + "/jeecg-boot/ai/projectCreate/projectCreative";
-        for (KuaishouProjectStrategy strategy : strategies) {
-            Map<String, Object> requestMap = new HashMap<>();
-            requestMap.put("id", strategy.getId());
-            String result = HttpUtils2.httpGet(url, requestMap, null);
-            JSONObject jsonObject = JSONObject.parseObject(result);
-            if (!Check.isNull(jsonObject)) {
-                Integer code = jsonObject.getInteger("code");
-                if (code == 200) {
-                    log.info("快手自动上新异步执行中,accountId:{}", strategy.getProjectId());
+        JSONObject jsonObject = null;
+        try {
+            for (KuaishouProjectStrategy strategy : strategies) {
+                Map<String, Object> requestMap = new HashMap<>();
+                requestMap.put("id", strategy.getId());
+                String result = HttpUtils2.httpGet(url, requestMap, null);
+                jsonObject = JSONObject.parseObject(result);
+                if (!Check.isNull(jsonObject)) {
+                    Integer code = jsonObject.getInteger("code");
+                    if (!Check.isNull(code) && code == 0) {
+                        log.info("快手自动上新异步执行中,accountId:{}", strategy.getProjectId());
+                    } else {
+                        log.error("快手自动上新异步执行失败,accountId:{},结果:{}", strategy.getProjectId(), jsonObject);
+                    }
                 } else {
-                    log.error("快手自动上新异执行失败,accountId:{}", strategy.getProjectId());
+                    log.info("快手自动上新返回结果为空,accountId:{},结果:{}", strategy.getProjectId(), jsonObject);
                 }
-            } else {
-                log.error("快手自动上新返回结果为空,accountId:{}", strategy.getProjectId());
             }
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("自定义上新异常,返回结果:{}", jsonObject);
         }
     }
 
@@ -68,6 +74,7 @@ public class KuaishouAiProjectCreativeJob {
         if (null == strategies || strategies.isEmpty()) {
             return;
         }
+        JSONObject jsonObject = null;
         try {
             String url = jobUrl + "/jeecg-boot/ai/projectCreate/projectCreativeSupplement";
             int hour = DateUtils.getNowHour();
@@ -76,20 +83,21 @@ public class KuaishouAiProjectCreativeJob {
                 requestMap.put("id", strategy.getId());
                 requestMap.put("hour", hour);
                 String result = HttpUtils2.httpGet(url, requestMap, null);
-                JSONObject jsonObject = JSONObject.parseObject(result);
+                jsonObject = JSONObject.parseObject(result);
                 if (!Check.isNull(jsonObject)) {
                     Integer code = jsonObject.getInteger("code");
-                    if (code == 0) {
+                    if (!Check.isNull(code) && code == 0) {
                         log.info("快手创意补充异步执行中,accountId:{}", strategy.getAccountId());
                     } else {
-                        log.error("快手创意补充异步执行失败,accountId:{}", strategy.getAccountId());
+                        log.error("快手创意补充异步执行失败,accountId:{},结果:{}", strategy.getAccountId(), jsonObject);
                     }
                 } else {
-                    log.error("快手创意补充返回结果为空,accountId:{}", strategy.getAccountId());
+                    log.error("快手创意补充返回结果为空,accountId:{},结果:{}", strategy.getAccountId(), jsonObject);
                 }
             }
         } catch (ParseException e) {
             e.printStackTrace();
+            log.error("自定义创意补充异常,返回结果:{}", jsonObject);
         }
     }
 
@@ -102,27 +110,31 @@ public class KuaishouAiProjectCreativeJob {
         if (null == strategies || strategies.isEmpty()) {
             return;
         }
-        String url = jobUrl + "/jeecg-boot/ai/projectCreate/projectProgramAutomaticCreates";
-        for (KuaishouProjectStrategy strategy : strategies) {
-            long videoCnt = strategy.getProgramUnitCnt() * 5 / 2;
-            Map<String, Object> requestMap = new HashMap<>();
-            requestMap.put("id", strategy.getId());
-            requestMap.put("videoCnt", videoCnt);
-            String result = HttpUtils2.httpGet(url, requestMap, null);
-            JSONObject jsonObject = JSONObject.parseObject(result);
-            if (!Check.isNull(jsonObject)) {
-                Integer code = jsonObject.getInteger("code");
-                if (code == 0) {
-                    log.info("快手上新程序化创意补充异步执行中,accountId:{}", strategy.getAccountId());
+        JSONObject jsonObject = null;
+        try {
+            String url = jobUrl + "/jeecg-boot/ai/projectCreate/projectProgramAutomaticCreates";
+            for (KuaishouProjectStrategy strategy : strategies) {
+                long videoCnt = strategy.getProgramUnitCnt() * 5 / 2;
+                Map<String, Object> requestMap = new HashMap<>();
+                requestMap.put("id", strategy.getId());
+                requestMap.put("videoCnt", videoCnt);
+                String result = HttpUtils2.httpGet(url, requestMap, null);
+                jsonObject = JSONObject.parseObject(result);
+                if (!Check.isNull(jsonObject)) {
+                    Integer code = jsonObject.getInteger("code");
+                    if (!Check.isNull(code) && code == 0) {
+                        log.info("程序化创意上新异步执行中,accountId:{}", strategy.getAccountId());
+                    } else {
+                        log.error("程序化创意上新异步执行失败,accountId:{},结果:{}", strategy.getAccountId(), jsonObject);
+                    }
                 } else {
-                    log.error("快手上新程序化异步执行失败,accountId:{}", strategy.getAccountId());
+                    log.error("程序化创意上新返回结果为空,accountId:{},结果:{}", strategy.getAccountId(), jsonObject);
                 }
-            } else {
-                log.error("快手上新程序化充返回结果为空,accountId:{}", strategy.getAccountId());
             }
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("程序化创意上新异常,返回结果:{}", jsonObject);
         }
-
-
     }
 
     /**
@@ -134,24 +146,31 @@ public class KuaishouAiProjectCreativeJob {
         if (null == strategies || strategies.isEmpty()) {
             return;
         }
-        String url = jobUrl + "/jeecg-boot/ai/projectCreate/projectProgramCreativeTop";
-        for (KuaishouProjectStrategy strategy : strategies) {
-            long videoCnt = strategy.getProgramUnitCnt() * 5 / 2;
-            Map<String, Object> requestMap = new HashMap<>();
-            requestMap.put("id", strategy.getId());
-            requestMap.put("videoCnt", videoCnt);
-            String result = HttpUtils2.httpGet(url, requestMap, null);
-            JSONObject jsonObject = JSONObject.parseObject(result);
-            if (!Check.isNull(jsonObject)) {
-                Integer code = jsonObject.getInteger("code");
-                if (code == 0) {
-                    log.info("快手历史高质量程序化创意补充异步执行中,accountId:{}", strategy.getAccountId());
+        JSONObject jsonObject = null;
+
+        try {
+            String url = jobUrl + "/jeecg-boot/ai/projectCreate/projectProgramCreativeTop";
+            for (KuaishouProjectStrategy strategy : strategies) {
+                long videoCnt = strategy.getProgramUnitCnt() * 5 / 2;
+                Map<String, Object> requestMap = new HashMap<>();
+                requestMap.put("id", strategy.getId());
+                requestMap.put("videoCnt", videoCnt);
+                String result = HttpUtils2.httpGet(url, requestMap, null);
+                jsonObject = JSONObject.parseObject(result);
+                if (!Check.isNull(jsonObject)) {
+                    Integer code = jsonObject.getInteger("code");
+                    if (!Check.isNull(code) && code == 0) {
+                        log.info("程序化高质量创建异步执行中,accountId:{}", strategy.getAccountId());
+                    } else {
+                        log.error("程序化高质量创建异步执行失败,accountId:{},结果:{}", strategy.getAccountId(), jsonObject);
+                    }
                 } else {
-                    log.error("快手历史高质量程序化异步执行失败,accountId:{}", strategy.getAccountId());
+                    log.error("程序化高质量创建返回结果为空,accountId:{},结果:{}", strategy.getAccountId(), jsonObject);
                 }
-            } else {
-                log.error("快手历史高质量程序化充返回结果为空,accountId:{}", strategy.getAccountId());
             }
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("程序化高质量创建异常,返回结果:{}", jsonObject);
         }
 
     }

+ 5 - 2
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouVideoRelateCreativesJob.java

@@ -40,6 +40,7 @@ public class KuaishouVideoRelateCreativesJob {
 
     /**
      * 视频库-更新视频关联创意数
+     *
      * @throws Exception
      */
     @XxlJob("kuaishouVideoRelateCreativesJob")
@@ -90,7 +91,7 @@ public class KuaishouVideoRelateCreativesJob {
             int count = 0;
             for (KuaiShouVideoGet video : KuaiShouVideoGets) {
                 count++;
-                if (count < 20) {
+                if (count < 19) {
                     photoIds.add(video.getPhotoId());
                     statdateMap.put(video.getPhotoId(), video);
                 } else {
@@ -101,7 +102,9 @@ public class KuaishouVideoRelateCreativesJob {
                     count = 0;
                 }
             }
-            dateList.add(photoIds);
+            if (photoIds.size() > 0) {
+                dateList.add(photoIds);
+            }
             kuaishouVideoRelateCreativesService.videoRelateCreatives(accountId, dateList, statdateMap);
         }
     }

+ 7 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/KuaishouVideoDirectionalPackageController.java

@@ -101,6 +101,13 @@ public class KuaishouVideoDirectionalPackageController {
             if (!Check.isNull(requestJson.getJSONArray("keyword"))) {
                 directionalPackage.setKeyword(JSONObject.toJSONString(requestJson.getJSONArray("keyword")));
             }
+            if("0".equals(requestJson.getJSONObject("allForm").getString("behaviorInterest"))){
+                directionalPackage.setSceneType("[]");
+                directionalPackage.setTimeType(-1);
+                directionalPackage.setStrengthType(0);
+                directionalPackage.setLabel("[]");
+                directionalPackage.setInterestLabel("[]");
+            }
             kuaishouVideoDirectionalPackageService.saveOrUpdate(directionalPackage);
             String id = "";
             if (!Check.isNull(directionalPackage.getId())) {

+ 1 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/KuaishouAppPackageMapper.xml

@@ -144,6 +144,7 @@
         WHERE t1.data_status = 1
           AND t1.project_id = #{projectId}
           and t2.data_status = 1
+        GROUP BY t1.id
     </select>
 
 </mapper>

+ 21 - 10
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/KuaishouProjectStrategyMapper.xml

@@ -5,7 +5,7 @@
     <select id="queryProjectList" resultType="com.alibaba.fastjson.JSONObject">
         SELECT t1.*,
                (SELECT COUNT(1) FROM ctop_user_allocation WHERE account_status = 0 and t1.projectId = project_id) as 'allAccountCount',
-               (SELECT COUNT(1) FROM ctop_user_allocation WHERE account_status = 0 and t1.projectId = project_id and project_strategy = 1) as 'successCount',
+               (SELECT COUNT(1) FROM ctop_user_allocation WHERE account_status = 0 and t1.projectId = project_id and auto_delivery = 1) as 'successCount',
                IFNULL(SUM(t2.charge),0) as 'charge',
                IFNULL(SUM(t2.photo_show),0) as 'photoShow',
                IFNULL(SUM(t2.photo_click),0) as 'photoClick',
@@ -23,7 +23,7 @@
                     k1.data_status as 'dataStatus',
                     k1.project_id as 'projectId',
                     k3.project_name as 'projectName',
-                    k3.responsible_name as 'responsibleName',
+                    (SELECT realname FROM sys_user WHERE k3.responsible_id = id) as 'responsibleName',
                     k1.stat_date as 'statDate',
                     k2.account_id as 'accountId',
                     k1.create_time as 'createTime'
@@ -48,7 +48,6 @@
         <if test="sortCode != '' and sortCode != null ">
             ORDER BY ${sortCode} ${sortType}
         </if>
-
     </select>
 
     <select id="queryAccountList" resultType="com.alibaba.fastjson.JSONObject">
@@ -74,8 +73,12 @@
                 and t2.stat_date &lt;=#{endTime}
                  LEFT JOIN ctop_project t3 ON t1.project_id = t3.id
         where t1.auto_delivery != 3 AND account_status = 0
-        <if test="projectId != null ">
-            and t1.project_id = #{projectId}
+        <if test="projectIds != null and projectIds.size()>0 ">
+            AND t1.project_id in
+            <foreach collection="projectIds" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
         </if>
           <if test="authName != null ">
               and  t1.auth_name LIKE CONCAT('%',#{authName},'%')
@@ -108,8 +111,12 @@
         where t1.auto_delivery != 3
           and t2.stat_date &gt;=#{startTime}
           and t2.stat_date &lt;=#{endTime}
-        <if test="projectId != null ">
-            and t1.project_id = #{projectId}
+        <if test="projectIds != null and projectIds.size()>0 ">
+            AND t1.project_id in
+            <foreach collection="projectIds" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
         </if>
           <if test="authName != null ">
               and  t1.auth_name LIKE CONCAT('%',#{authName},'%')
@@ -132,7 +139,7 @@
             IFNULL(ROUND(SUM(t2.charge)/SUM(t2.aclick)*1000,2),0) as 'impression1kCost',
             IFNULL(ROUND(SUM(t2.charge)/SUM(t2.photo_click),2),0) as 'photoClickCost',
             IFNULL(ROUND(SUM(t2.charge)/SUM(t2.bclick),2),0) as 'actionCost',
-            (SELECT COUNT(1) FROM ctop_user_allocation where project_strategy = 1 AND account_status = 0
+            (SELECT COUNT(1) FROM ctop_user_allocation where auto_delivery = 1 AND account_status = 0
             <if test="projectIds != null and projectIds.size()>0 ">
                  AND project_id in
                 <foreach collection="projectIds" item="item" separator=","
@@ -155,8 +162,12 @@
                  and t2.stat_date &lt;=#{endTime}
                  LEFT JOIN ctop_project t3 ON t1.project_id = t3.id
         where t1.auto_delivery != 3
-        <if test="projectId != null ">
-            and t1.project_id = #{projectId}
+        <if test="projectIds != null and projectIds.size()>0 ">
+            and t1.project_id in
+            <foreach collection="projectIds" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
         </if>
           <if test="userId != null ">
               and  t3.responsible_id =#{userId}

+ 11 - 10
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouProjectCreateCreativeServiceImpl.java

@@ -124,6 +124,8 @@ public class AiKuaishouProjectCreateCreativeServiceImpl implements IAiKuaishouPr
     private IKuaiShouCampaignService campaignService;
     @Autowired
     private IKuaiShouGroupService groupService;
+
+
     static ExecutorService executorService = Executors.newFixedThreadPool(2);
 
     /**
@@ -254,8 +256,6 @@ public class AiKuaishouProjectCreateCreativeServiceImpl implements IAiKuaishouPr
 
     /**
      * 创建自定义创意
-
-
      *
      * @param strategy   账户配置信息
      * @param createType 创意创建类型 1:素材上新 2:历史高质量 3:历史遗漏素材 4:历史打捞
@@ -273,8 +273,10 @@ public class AiKuaishouProjectCreateCreativeServiceImpl implements IAiKuaishouPr
                 insertAccountOperationRecord(strategy, "获取token失败", operationType, 0);
                 return videoCnt;
             }
-            //1:获取视频信息
+            //1:获取账户视频信息
             kuaishouInterfaceService.getVideoList(token, DateUtils.date2Str(), DateUtils.date2Str());
+            //2:同步项目视频信息
+            projectVideoGetService.clearProjectVideo(strategy.getProjectId(), 1, null);
             Long timeStart = KuaishouProjectCreativeMatTypeEnum.getStartTimeByType(strategy.getUnitType().toString() + createType.toString());
             Long timeEnd = KuaishouProjectCreativeMatTypeEnum.getEndTimeByType(strategy.getUnitType().toString() + createType.toString());
             Long now = System.currentTimeMillis();
@@ -295,7 +297,7 @@ public class AiKuaishouProjectCreateCreativeServiceImpl implements IAiKuaishouPr
                 List<KuaiShouVideoGet> newVideos = new ArrayList<>();
                 for (KuaiShouVideoGet newVideo : newVideoList) {
                     if (!Check.isNull(newVideo.getPutEndTime()) && !Check.isNull(newVideo.getPutStartTime())) {
-                        boolean b = DateUtils.checkTimeLimit(new Date(), DateUtils.parseDate(newVideo.getPutStartTime()+" 00:00:01", "yyyy-MM-dd HH:mm:ss"), DateUtils.parseDate(newVideo.getPutEndTime()+" 23:59:59", "yyyy-MM-dd HH:mm:ss"));
+                        boolean b = DateUtils.checkTimeLimit(new Date(), DateUtils.parseDate(newVideo.getPutStartTime() + " 00:00:01", "yyyy-MM-dd HH:mm:ss"), DateUtils.parseDate(newVideo.getPutEndTime() + " 23:59:59", "yyyy-MM-dd HH:mm:ss"));
                         if (b) {
                             newVideos.add(newVideo);
                         }
@@ -431,7 +433,9 @@ public class AiKuaishouProjectCreateCreativeServiceImpl implements IAiKuaishouPr
             }
             //1:获取视频信息
             kuaishouInterfaceService.getVideoList(token, DateUtils.date2Str(), DateUtils.date2Str());
-            //2:判定账户是否单一应用
+            //2:同步项目视频信息
+            projectVideoGetService.clearProjectVideo(strategy.getProjectId(), 1, null);
+            //3:判定账户是否单一应用
             Long timeStart = null;
             Long timeEnd = null;
             Integer singleAppid = strategy.getSingleAppid();
@@ -462,7 +466,7 @@ public class AiKuaishouProjectCreateCreativeServiceImpl implements IAiKuaishouPr
                 List<KuaiShouVideoGet> allVideos = new ArrayList<>();
                 for (KuaiShouVideoGet newVideo : allVideoList) {
                     if (!Check.isNull(newVideo.getPutEndTime()) && !Check.isNull(newVideo.getPutStartTime())) {
-                        boolean b = DateUtils.checkTimeLimit(new Date(), DateUtils.parseDate(newVideo.getPutStartTime()+" 00:00:01", "yyyy-MM-dd HH:mm:ss"), DateUtils.parseDate(newVideo.getPutEndTime()+" 23:59:59", "yyyy-MM-dd HH:mm:ss"));
+                        boolean b = DateUtils.checkTimeLimit(new Date(), DateUtils.parseDate(newVideo.getPutStartTime() + " 00:00:01", "yyyy-MM-dd HH:mm:ss"), DateUtils.parseDate(newVideo.getPutEndTime() + " 23:59:59", "yyyy-MM-dd HH:mm:ss"));
                         if (b) {
                             allVideos.add(newVideo);
                         }
@@ -1200,13 +1204,10 @@ public class AiKuaishouProjectCreateCreativeServiceImpl implements IAiKuaishouPr
                     if (!checkList(dir.getInterestLabel(), target.getInterestLabel())) {
                         continue;
                     }
-                    if (!checkList(dir.getInterestLabel(), target.getInterestLabel())) {
-                        continue;
-                    }
                     if (!checkList(dir.getSceneType(), target.getSceneType())) {
                         continue;
                     }
-                    if (!Check.isNull(dir.getTimeType())) {
+                    if (!Check.isNull(dir.getTimeType()) && dir.getTimeType() != -1) {
                         if (dir.getTimeType() != target.getTimeType()) {
                             continue;
                         }

+ 7 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/KuaishouProjectStrategyServiceImpl.java

@@ -54,6 +54,13 @@ public class KuaishouProjectStrategyServiceImpl extends ServiceImpl<KuaishouProj
 
     @Override
     public Result<Object> queryAccountList(JSONObject data) {
+        List<Long> projectIds = new ArrayList<>();
+        if (Check.isNull(data.getLong("projectId"))) {
+            projectIds = kuaishouProjectStrategyMapper.queryProjectId();
+        } else {
+            projectIds.add(data.getLong("projectId"));
+        }
+        data.put("projectIds", projectIds);
         JSONObject result = new JSONObject();
         JSONObject allInfo = kuaishouProjectStrategyMapper.queryAccountAll(data);
         Integer pageNo = Check.isNull(data.getInteger("pageNo")) ? 1 : data.getInteger("pageNo");

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

@@ -94,7 +94,7 @@
 
     <select id="selectPhotoIdsByAccountId" parameterType="java.lang.Long"
             resultType="cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet">
-        select *
+        select photo_id,stat_date,channel_type
         from ctop_kuaishou_video_get
         where account_id = #{accountId}
           and status = 0

+ 12 - 10
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouVideoRelateCreativesServiceImpl.java

@@ -136,7 +136,7 @@ public class KuaishouVideoRelateCreativesServiceImpl extends ServiceImpl<Kuaisho
                             kuaishouVideoRelateCreativesMapper.insertBatch(videolist);
                         }
                     } else {
-                        log.info("频库-视频关联创意数查询失败,accountId:{},返回信息:{}", accountId, resultJson);
+                        log.info("频库-视频关联创意数查询失败,入参:{},返回结果:{}", params, resultJson);
                     }
                 }
             }
@@ -151,17 +151,17 @@ public class KuaishouVideoRelateCreativesServiceImpl extends ServiceImpl<Kuaisho
     }
 
     @Override
-    public List<KuaishouVideoRelateCreatives> listByParams(Long accountId,Integer matNum) {
+    public List<KuaishouVideoRelateCreatives> listByParams(Long accountId, Integer matNum) {
         QueryWrapper<KuaishouVideoRelateCreatives> queryWrapper = new QueryWrapper<>();
-        if(null!=accountId&&accountId!=0){
-            queryWrapper.eq("account_id",accountId);
+        if (null != accountId && accountId != 0) {
+            queryWrapper.eq("account_id", accountId);
         }
-        if(null == matNum||matNum == 0){
+        if (null == matNum || matNum == 0) {
             matNum = 10;
         }
-        queryWrapper.le("creative_count",30);
+        queryWrapper.le("creative_count", 30);
         queryWrapper.orderByDesc("stat_date");
-        queryWrapper.last("limit "+matNum);
+        queryWrapper.last("limit " + matNum);
         return this.list(queryWrapper);
     }
 
@@ -188,18 +188,20 @@ public class KuaishouVideoRelateCreativesServiceImpl extends ServiceImpl<Kuaisho
             int count = 0;
             for (KuaiShouVideoGet video : KuaiShouVideoGets) {
                 count++;
-                if (count < 20) {
+                if (count < 19) {
                     photoIds.add(video.getPhotoId());
                     statdateMap.put(video.getPhotoId(), video);
                 } else {
                     photoIds.add(video.getPhotoId());
-                    statdateMap.put(video.getPhotoId(),video);
+                    statdateMap.put(video.getPhotoId(), video);
                     dateList.add(photoIds);
                     photoIds = new JSONArray();
                     count = 0;
                 }
             }
-            dateList.add(photoIds);
+            if (photoIds.size() > 0) {
+                dateList.add(photoIds);
+            }
             this.videoRelateCreatives(accountId, dateList, statdateMap);
         }
     }