Browse Source

Merge branch 'master' into test

songyh 4 years ago
parent
commit
67ed6d3211

+ 2 - 2
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/mapper/ByteDanceVideoInfoMapper.java

@@ -25,7 +25,7 @@ public interface ByteDanceVideoInfoMapper extends BaseMapper<ByteDanceVideoInfo>
      * @param videoCnt
      * @return
      */
-    List<ByteDanceVideoInfo> getNewVideoByParams(@Param(value = "accountId") Long accountId, @Param(value = "startTime")String startTime, @Param(value = "endTime")String endTime, @Param(value = "videoCnt")Long videoCnt,@Param(value = "creativeCnt")Long creativeCnt);
+    List<ByteDanceVideoInfo> getNewVideoByParams(@Param(value = "accountId") Long accountId, @Param(value = "startTime")String startTime, @Param(value = "endTime")String endTime, @Param(value = "videoCnt")Long videoCnt,@Param(value = "creativeCnt")Long creativeCnt,@Param(value = "now") String now);
 
-    List<ByteDanceVideoInfo> topMatByParams(@Param(value = "projectId")Long projectId, @Param(value = "accountId")Long accountId, @Param(value = "startTime")String startTime, @Param(value = "endTime")String endTime, @Param(value = "videoCnt")Long videoCnt);
+    List<ByteDanceVideoInfo> topMatByParams(@Param(value = "projectId")Long projectId, @Param(value = "accountId")Long accountId, @Param(value = "startTime")String startTime, @Param(value = "endTime")String endTime, @Param(value = "videoCnt")Long videoCnt,@Param(value = "now") String now);
 }

+ 25 - 12
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/mapper/xml/ByteDanceVideoInfoMapper.xml

@@ -69,32 +69,45 @@
     <select id="getNewVideoByParams"
             resultType="org.jeecg.modules.bytedance.advertise.entity.ByteDanceVideoInfo">
         select video.*,
-        (select count(1)
-        from ctop_bytedance_creative c
-        where c.video_id = video.vid and c.account_id = '${accountId}') as creativeCnt
+        (select count(1) from ctop_bytedance_ai_video_creative_log l where l.video_code = video.signature and l.state_date = #{now}) as creativeNum,
+        (select count(1) from ctop_bytedance_creative c where c.video_id = video.vid and c.account_id = '${accountId}') as creativeCnt,
+        (select count(1) from ctop_bytedance_video_slogen_info s where s.video_code = video.signature) as slogens
         from ctop_bytedance_video_info video
+        left join ctop_material_info cmi on video.signature = cmi.code
         where account_id = #{accountId}
+        and cmi.code is not null
+        and cmi.offline_flag = 0
         and material_upload_time &gt;= #{startTime}
         and material_upload_time &lt;= #{endTime}
-        having creativeCnt &lt;= #{creativeCnt}
+        having creativeCnt &lt;= #{creativeCnt} and slogens >0 and creativeNum = 0
         order by material_upload_time desc
         limit #{videoCnt}
     </select>
     <select id="topMatByParams" resultType="org.jeecg.modules.bytedance.advertise.entity.ByteDanceVideoInfo">
-        select video.*
-        from (select report.material_id, sum(cost) as totalCost, report.account_id
+        select video.*,
+        a.totalCost,
+        (select count(1) from ctop_bytedance_ai_video_creative_log l where l.video_code = video.signature and l.state_date = #{now}) as creativeNum,
+        (select count(1) from ctop_bytedance_creative c where c.video_id = video.vid and c.account_id = '${accountId}') as creativeCnt,
+        (select count(1) from ctop_bytedance_video_slogen_info s where s.video_code = video.signature) as slogens
+        from (select report.material_id, sum(cost) as totalCost
         from ctop_bytedance_report_material_daily report
         left join ctop_user_allocation cua on report.account_id = cua.account_id
         where cua.project_id = #{projectId}
         and report.stat_datetime &gt;= #{startTime}
         and report.stat_datetime &lt;= #{endTime}
         group by report.material_id
-        order by sum(report.cost) desc) a
-        left join ctop_bytedance_video_info video
-        on a.material_id = video.material_id and video.account_id = a.account_id
-        left join ctop_material_info cmi on cmi.code = video.signature
-        where video.account_id = #{accountId}
-        and cmi.id is not null
+        order by sum(report.cost) desc ) a
+        left join (select distinct a.* from ctop_bytedance_video_info a where a.account_id = #{accountId})as video
+        on a.material_id = video.material_id
+        left join ctop_material_info cmi on cmi.code = video.signature and cmi.project_id = #{projectId}
+        where cmi.id is not null
+          and video.id is not null
+          and cmi.offline_flag = 0
+        and a.totalCost &gt;= 500
+        having creativeCnt &lt;= 100
+           and creativeNum = 0
+        and slogens >0
+        order by a.material_id desc
         limit #{videoCnt}
     </select>
 </mapper>

+ 2 - 6
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/service/impl/AiBytedanceAdvertiserStrategyServiceImpl.java

@@ -722,14 +722,10 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
                 }
             }
         }
-        if(!Check.isNull(strategy.getAdDeviceType())){
+        if(!Check.isNull(strategy.getAdDeviceType())&&!strategy.getAdDeviceType().trim().equals("NONE")){
             String[] deviceType = strategy.getAdDeviceType().split(",");
             if(deviceType.length>0){
-                JSONArray deviceTypeArray = new JSONArray();
-                for(int i=0;i<deviceType.length;i++){
-                    deviceTypeArray.add(deviceType[i]);
-                }
-                params.put("device_type",deviceTypeArray);
+                params.put("device_type",deviceType);
             }
         }
 

+ 5 - 2
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/service/impl/ByteDanceVideoInfoServiceImpl.java

@@ -2,6 +2,7 @@ package org.jeecg.modules.bytedance.advertise.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.jeecg.common.util.DateUtils;
 import org.jeecg.modules.bytedance.advertise.entity.ByteDanceVideoInfo;
 import org.jeecg.modules.bytedance.advertise.mapper.ByteDanceVideoInfoMapper;
 import org.jeecg.modules.bytedance.advertise.service.IByteDanceVideoInfoService;
@@ -44,11 +45,13 @@ public class ByteDanceVideoInfoServiceImpl extends ServiceImpl<ByteDanceVideoInf
 
     @Override
     public List<ByteDanceVideoInfo> listByParams(Long accountId, String startTime, String endTime, Long videoCnt,long creativeCnt) {
-        return videoInfoMapper.getNewVideoByParams(accountId,startTime,endTime,videoCnt,creativeCnt);
+        String now = DateUtils.formatDate();
+        return videoInfoMapper.getNewVideoByParams(accountId,startTime,endTime,videoCnt,creativeCnt,now);
     }
 
     @Override
     public List<ByteDanceVideoInfo> topMatByParams(Long projectId, Long accountId, String startTime, String endTime, Long videoCnt) {
-        return videoInfoMapper.topMatByParams(projectId,accountId,startTime,endTime,videoCnt);
+        String now = DateUtils.formatDate();
+        return videoInfoMapper.topMatByParams(projectId,accountId,startTime,endTime,videoCnt,now);
     }
 }