Ver Fonte

自动投放修改_关键字查询

zhaoxian há 3 anos atrás
pai
commit
9e8e5c0d75

+ 4 - 4
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/AiKuaishouAccountAutoVideoMapper.java

@@ -18,13 +18,13 @@ public interface AiKuaishouAccountAutoVideoMapper extends BaseMapper<AiKuaishouA
 
     void insertBatch(@Param("videoGetList") List<AiKuaishouAccountAutoVideo> videoGetList);
 
-    List<AiKuaishouAccountAutoVideo> getUpNewVideos(@Param("accountId") Long accountId, @Param("channelType") Integer channelType, @Param("keyword") String keyword, @Param("videoCnt") Integer videoCnt, @Param("statDate") String statDate, @Param("createType") String createType);
+    List<AiKuaishouAccountAutoVideo> getUpNewVideos(@Param("accountId") Long accountId, @Param("channelType") Integer channelType, @Param("keyword")  List<String>  keyword, @Param("videoCnt") Integer videoCnt, @Param("statDate") String statDate, @Param("createType") String createType);
 
-    List<AiKuaishouAccountAutoVideo> getHistoryTopVideos(@Param("accountId") Long accountId, @Param("channelType") Integer channelType, @Param("keyword") String keyword, @Param("videoCnt") Integer videoCnt, @Param("createType") String createType, @Param("statDate") String statDate);
+    List<AiKuaishouAccountAutoVideo> getHistoryTopVideos(@Param("accountId") Long accountId, @Param("channelType") Integer channelType, @Param("keyword")  List<String>  keyword, @Param("videoCnt") Integer videoCnt, @Param("createType") String createType, @Param("statDate") String statDate);
 
-    List<AiKuaishouAccountAutoVideo> getHistoryCatchVideos(@Param("accountId") Long accountId, @Param("channelType") Integer channelType, @Param("keyword") String keyword, @Param("videoCnt") Integer videoCnt, @Param("statDate") String statDate);
+    List<AiKuaishouAccountAutoVideo> getHistoryCatchVideos(@Param("accountId") Long accountId, @Param("channelType") Integer channelType, @Param("keyword")  List<String>  keyword, @Param("videoCnt") Integer videoCnt, @Param("statDate") String statDate);
 
-    List<AiKuaishouAccountAutoVideo> getZeroVideoByParams(Long accountId, Integer channelType, String keyword, Integer videoCnt, @Param("statDate") String date);
+    List<AiKuaishouAccountAutoVideo> getZeroVideoByParams(Long accountId, Integer channelType,  List<String>  keyword, Integer videoCnt, @Param("statDate") String date);
 
     Integer getAutoVideoUsed(@Param("accountId") Long accountId, @Param("signature") String signature, @Param("videoType") Integer videoType, @Param("createType") String createType);
 

+ 27 - 11
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/AiKuaishouAccountAutoVideoMapper.xml

@@ -22,7 +22,7 @@
             #{video.programStatus},
             #{video.photoId},
             #{video.photoName},
-           #{video.materialType},
+            #{video.materialType},
             #{video.channelType},
             #{video.statDate},
             #{video.signature}
@@ -46,8 +46,12 @@
         <if test="statDate!=null">
             AND stat_date = #{statDate}
         </if>
-        <if test="keyword != null and keyword != '' ">
-            AND photo_name LIKE concat(#{keyword},'%')
+        <if test="keyword != null and keyword.size>0 ">
+            AND
+            <foreach item="item" index="index" collection="keyword"
+                     open="(" separator="OR" close=")">
+                photo_name LIKE concat(#{keyword},'%')
+            </foreach>
         </if>
         LIMIT #{videoCnt}
     </select>
@@ -63,8 +67,12 @@
             AND stat_date &lt; #{statDate}
             AND stat_date &gt;= DATE_SUB(#{statDate},INTERVAL 7 day)
         </if>
-        <if test="keyword != null and keyword != '' ">
-            AND photo_name LIKE concat(#{keyword},'%')
+        <if test="keyword != null and keyword.size>0 ">
+            AND
+            <foreach item="item" index="index" collection="keyword"
+                     open="(" separator="OR" close=")">
+                photo_name LIKE concat(#{keyword},'%')
+            </foreach>
         </if>
         LIMIT #{videoCnt}
     </select>
@@ -94,8 +102,12 @@
         <if test="channelType!=null and channelType!=2">
             and channel_type = #{channelType}
         </if>
-        <if test="keyword != null and keyword != '' ">
-            and material_name like concat(#{keyword},'%')
+        <if test="keyword != null and keyword.size>0 ">
+            AND
+            <foreach item="item" index="index" collection="keyword"
+                     open="(" separator="OR" close=")">
+                photo_name LIKE concat(#{keyword},'%')
+            </foreach>
         </if>
         group by signature
         ORDER BY 7day_cost DESC
@@ -125,8 +137,12 @@
         <if test="channelType!=null and channelType!=2">
             and channel_type = #{channelType}
         </if>
-        <if test="keyword != null and keyword != '' ">
-            and material_name like concat(#{keyword},'%')
+        <if test="keyword != null and keyword.size>0 ">
+            AND
+            <foreach item="item" index="index" collection="keyword"
+                     open="(" separator="OR" close=")">
+                photo_name LIKE concat(#{keyword},'%')
+            </foreach>
         </if>
         group by signature
         ORDER BY sum_cost DESC
@@ -179,14 +195,14 @@
         SELECT photo_id
         FROM ctop_ai_kuaishou_account_auto_video
         WHERE account_id = #{accountId}
-          AND stat_date = #{statDate}
+        AND stat_date = #{statDate}
         <if test="details!=null">
             AND photo_id in
             <foreach item="item" collection="details"
                      open="(" separator="," close=")">
                 #{item.photo_id}
             </foreach>
-          </if>
+        </if>
     </select>
 
 </mapper>

+ 4 - 4
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IAiKuaishouAccountAutoVideoService.java

@@ -15,16 +15,16 @@ import java.util.List;
 public interface IAiKuaishouAccountAutoVideoService extends IService<AiKuaishouAccountAutoVideo> {
 
     // 获取上新素材(自动投放账户级重构)
-    List<AiKuaishouAccountAutoVideo> getUpNewVideos(Long accountId, Integer channelType, String keyword, Integer videoCnt, String statDate, String createType);
+    List<AiKuaishouAccountAutoVideo> getUpNewVideos(Long accountId, Integer channelType,  List<String>  keyword, Integer videoCnt, String statDate, String createType);
 
     //获取7天高质量 (自动投放账户级重构)
-    List<AiKuaishouAccountAutoVideo> getHistoryTopVideos(Long accountId, Integer channelType, String keyword, Integer videoCnt, String statDate, String createType);
+    List<AiKuaishouAccountAutoVideo> getHistoryTopVideos(Long accountId, Integer channelType,  List<String>  keyword, Integer videoCnt, String statDate, String createType);
 
     //获取遗漏素材:7天内未被创建过的素材(自动投放账户级重构)
-    List<AiKuaishouAccountAutoVideo> getMissVideoByParams(Long accountId, Integer channelType, String keyword, Integer videoCnt, String statDate);
+    List<AiKuaishouAccountAutoVideo> getMissVideoByParams(Long accountId, Integer channelType,  List<String>  keyword, Integer videoCnt, String statDate);
 
     //历史素材打捞(自动投放账户级重构)
-    List<AiKuaishouAccountAutoVideo> getHistoryCatchVideos(Long accountId, Integer channelType, String keyword, Integer videoCnt, String statDate);
+    List<AiKuaishouAccountAutoVideo> getHistoryCatchVideos(Long accountId, Integer channelType,  List<String>  keyword, Integer videoCnt, String statDate);
 
     void insertAutoVideo(Long accountId);
 

+ 10 - 6
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouAccountAutoDoServiceImpl.java

@@ -56,6 +56,7 @@ import org.springframework.stereotype.Service;
 import java.math.BigDecimal;
 import java.text.ParseException;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.Date;
 import java.util.HashMap;
@@ -1682,23 +1683,26 @@ public class AiKuaishouAccountAutoDoServiceImpl implements IAiKuaishouAccountAut
      */
     private List<AiKuaishouAccountAutoVideo> getVideosByParams(AiKuaishouAccountAutoStrategy strategy, String statDate, String appVersion, Integer videoType, String createType, Integer videoCnt) {
         //素材关键词
-        String keyword = null;
+        List<String> keyword = new ArrayList<>();
         if (Check.isNull(strategy.getMaterialKeyword()) && !Check.isNull(appVersion)) {
             String[] split = appVersion.split("-");
             if (split.length > 1) {
-                keyword = split[1];
+                keyword.add(split[1]);
             } else {
                 return null;
             }
         } else {
-            keyword = strategy.getMaterialKeyword();
+            String materialKeyword = strategy.getMaterialKeyword();
+            if(materialKeyword!=null&& materialKeyword.contains("-")){
+                keyword = Arrays.asList(materialKeyword.split("-"));
+            }
         }
         Long accountId = strategy.getAccountId();
         Integer channelType = strategy.getChannelType();
         if (videoType == 1) {
             //获取上新素材
-            List<AiKuaishouAccountAutoVideo> upNewVideos = autoVideoService.getUpNewVideos(accountId, channelType, keyword, videoCnt, statDate, createType);
-            if (!Check.isNull(appVersion)) {
+            return autoVideoService.getUpNewVideos(accountId, channelType, keyword, videoCnt, statDate, createType);
+            /*if (!Check.isNull(appVersion)) {
                 //多应用需要查询素材名包含“all"的素材
                 List<AiKuaishouAccountAutoVideo> videos = autoVideoService.getUpNewVideos(accountId, channelType, "all", videoCnt, statDate, createType);
                 if (null == upNewVideos || upNewVideos.isEmpty()) {
@@ -1711,7 +1715,7 @@ public class AiKuaishouAccountAutoDoServiceImpl implements IAiKuaishouAccountAut
                 }
             } else {
                 return upNewVideos;
-            }
+            }*/
         } else if (videoType == 2) {
             //历史高质量
             return autoVideoService.getHistoryTopVideos(accountId, channelType, keyword, videoCnt, statDate, createType);

+ 4 - 4
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouAccountAutoVideoServiceImpl.java

@@ -43,22 +43,22 @@ public class AiKuaishouAccountAutoVideoServiceImpl extends ServiceImpl<AiKuaisho
     private ICtopOauthTokenService tokenService;
 
     @Override
-    public List<AiKuaishouAccountAutoVideo> getUpNewVideos(Long accountId, Integer channelType, String keyword, Integer videoCnt, String statDate, String createType) {
+    public List<AiKuaishouAccountAutoVideo> getUpNewVideos(Long accountId, Integer channelType,  List<String>  keyword, Integer videoCnt, String statDate, String createType) {
         return autoVideoMapper.getUpNewVideos(accountId, channelType, keyword, videoCnt, statDate, createType);
     }
 
     @Override
-    public List<AiKuaishouAccountAutoVideo> getHistoryTopVideos(Long accountId, Integer channelType, String keyword, Integer videoCnt, String statDate, String createType) {
+    public List<AiKuaishouAccountAutoVideo> getHistoryTopVideos(Long accountId, Integer channelType,  List<String>  keyword, Integer videoCnt, String statDate, String createType) {
         return autoVideoMapper.getHistoryTopVideos(accountId, channelType, keyword, videoCnt, createType, statDate);
     }
 
     @Override
-    public List<AiKuaishouAccountAutoVideo> getMissVideoByParams(Long accountId, Integer channelType, String keyword, Integer videoCnt, String statDate) {
+    public List<AiKuaishouAccountAutoVideo> getMissVideoByParams(Long accountId, Integer channelType,  List<String>  keyword, Integer videoCnt, String statDate) {
         return autoVideoMapper.getZeroVideoByParams(accountId, channelType, keyword, videoCnt, statDate);
     }
 
     @Override
-    public List<AiKuaishouAccountAutoVideo> getHistoryCatchVideos(Long accountId, Integer channelType, String keyword, Integer videoCnt, String statDate) {
+    public List<AiKuaishouAccountAutoVideo> getHistoryCatchVideos(Long accountId, Integer channelType,  List<String>  keyword, Integer videoCnt, String statDate) {
         return autoVideoMapper.getHistoryCatchVideos(accountId, channelType, keyword, videoCnt, statDate);
     }
 

+ 2 - 2
jeecg-cloud-module/jeecg-cloud-system-start/src/main/resources/application-dev.yml

@@ -150,8 +150,8 @@ mybatis-plus:
       id-type: 4
       # 默认数据库表下划线命名
       table-underline: true
-#  configuration:
-#    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+  configuration:
+    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
 #jeecg专用配置
 jeecg:
   elasticsearch: