Selaa lähdekoodia

素材上新逻辑修改

songyh 4 vuotta sitten
vanhempi
commit
bda868c42a

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

@@ -28,4 +28,6 @@ public interface ByteDanceVideoInfoMapper extends BaseMapper<ByteDanceVideoInfo>
     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> 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,@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,@Param(value = "now") String now);
+
+    List<ByteDanceVideoInfo>historyMatByParams(@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);
 }
 }

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

@@ -110,4 +110,32 @@
         order by a.material_id desc
         order by a.material_id desc
         limit #{videoCnt}
         limit #{videoCnt}
     </select>
     </select>
+
+    <select id="historyMatByParams" resultType="org.jeecg.modules.bytedance.advertise.entity.ByteDanceVideoInfo">
+        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 (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 &lt;= 100
+        having creativeCnt &lt; 20
+           and creativeNum = 0
+           and slogens >0
+        order by a.material_id desc
+            limit #{videoCnt}
+    </select>
 </mapper>
 </mapper>

+ 2 - 0
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/service/IByteDanceVideoInfoService.java

@@ -22,4 +22,6 @@ public interface IByteDanceVideoInfoService extends IService<ByteDanceVideoInfo>
     List<ByteDanceVideoInfo> listByParams(Long accountId, String startTime, String endTime, Long videoCnt,long creativeCnt);
     List<ByteDanceVideoInfo> listByParams(Long accountId, String startTime, String endTime, Long videoCnt,long creativeCnt);
 
 
     List<ByteDanceVideoInfo> topMatByParams(Long projectId, Long accountId, String startTime, String endTime, Long videoCnt);
     List<ByteDanceVideoInfo> topMatByParams(Long projectId, Long accountId, String startTime, String endTime, Long videoCnt);
+
+    List<ByteDanceVideoInfo> historyMatByParams(Long projectId, Long accountId, String startTime, String endTime, Long videoCnt);
 }
 }

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

@@ -54,4 +54,10 @@ public class ByteDanceVideoInfoServiceImpl extends ServiceImpl<ByteDanceVideoInf
         String now = DateUtils.formatDate();
         String now = DateUtils.formatDate();
         return videoInfoMapper.topMatByParams(projectId,accountId,startTime,endTime,videoCnt,now);
         return videoInfoMapper.topMatByParams(projectId,accountId,startTime,endTime,videoCnt,now);
     }
     }
+
+    @Override
+    public List<ByteDanceVideoInfo> historyMatByParams(Long projectId, Long accountId, String startTime, String endTime, Long videoCnt) {
+        String now = DateUtils.formatDate();
+        return videoInfoMapper.historyMatByParams(projectId,accountId,startTime,endTime,videoCnt,now);
+    }
 }
 }