Forráskód Böngészése

Merge remote-tracking branch 'origin/master' into pingkang

hpk 4 hónapja
szülő
commit
2ca2331cb5
23 módosított fájl, 814 hozzáadás és 257 törlés
  1. 18 0
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/FeishuSendObject.java
  2. 5 0
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/FeishuMapper.java
  3. 2 0
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/ReportsAdPushMapper.java
  4. 41 1
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/FeishuMapper.xml
  5. 326 138
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/ReportsAdPushMapper.xml
  6. 6 0
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/ICutGroupRankPushService.java
  7. 11 1
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/IDateReportsPushService.java
  8. 5 0
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/IFeishuService.java
  9. 6 0
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/IMovieRankPushService.java
  10. 6 0
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/IReportsAdPushService.java
  11. 6 0
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/IReportsByBusinessPushService.java
  12. 6 0
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/ITotalRankPushService.java
  13. 24 13
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/BytedanceProductUpdateServiceImpl.java
  14. 10 3
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/CutGroupRankPushServiceImpl.java
  15. 37 9
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/DateReportsPushServiceImpl.java
  16. 44 0
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/FeishuServiceImpl.java
  17. 48 10
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/MovieRankPushServiceImpl.java
  18. 1 1
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/OptimizerRankPushServiceImpl.java
  19. 66 16
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/ReportsAdPushServiceImpl.java
  20. 23 18
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/ReportsByBusinessPushServiceImpl.java
  21. 73 40
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/TotalRankPushServiceImpl.java
  22. 38 0
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/utils/FeishuSendObjectUtils.java
  23. 12 7
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/FeishuPushJob.java

+ 18 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/FeishuSendObject.java

@@ -0,0 +1,18 @@
+package cn.com.ctop.job.bytedance.data.entity;
+
+import lombok.Data;
+
+@Data
+public class FeishuSendObject {
+    public enum SendType {
+        USER, CHAT_GROUP
+    }
+    private SendType sendType;
+
+
+    private String fsUserId;
+    private String phonenumber;
+    private String nickname;
+
+    private String chatGroupId;
+}

+ 5 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/FeishuMapper.java

@@ -1,6 +1,7 @@
 package cn.com.ctop.job.bytedance.data.mapper;
 
 
+import cn.com.ctop.job.bytedance.data.entity.FeishuSendObject;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
@@ -12,4 +13,8 @@ public interface FeishuMapper {
     int updateAvatar1(@Param("phone") String phonenumber, @Param("avatar") String avatarUrl);
     int updateAvatar2(@Param("phone") String phonenumber, @Param("avatar") String avatarUrl);
     int updateAvatar3(@Param("phone") String phonenumber, @Param("avatar") String avatarUrl);
+
+    List<FeishuSendObject> getFeishuUserSendObjectList(@Param("jobName") String jobName);
+
+    List<FeishuSendObject> getFeishuChatGroupSendObjectList(@Param("jobName") String jobName);
 }

+ 2 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/ReportsAdPushMapper.java

@@ -23,6 +23,7 @@ public interface ReportsAdPushMapper {
     List<Map<String, String>> tmpTopMovie(@Param("date") Long date);
     //部门前后项数据排名
     List<Map<String, String>> deptRank2(@Param("date") Long date);
+    Map<String, String> deptRankTotal(@Param("date") Long date);
 
 
 
@@ -33,6 +34,7 @@ public interface ReportsAdPushMapper {
     List<JSONObject> todayTopMovie(@Param("date") Long date, @Param("hour") String hour, @Param("sort") String sort);
     //所有优化师消耗排名
     List<Map<String, String>> optimizerCostRank(@Param("date") Long date, @Param("hour") String hour);
+    List<Map<String, String>> optimizerCostRankV2(@Param("date") Long date, @Param("hour") String hour);
     //优化师当日数据
     List<Map<String, String>> optimizerDateData(@Param("date") Long date);
     //优化师小时数据

+ 41 - 1
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/FeishuMapper.xml

@@ -19,4 +19,44 @@
         union all
         select phone from thirtpart.ly_responsibility_person where phone is not null and phone != ''
     </select>
-</mapper>
+
+    <select id="getFeishuUserSendObjectList" resultType="cn.com.ctop.job.bytedance.data.entity.FeishuSendObject">
+        SELECT DISTINCT
+            CASE
+                WHEN r.recipient_type = 1 THEN u.phonenumber
+                WHEN r.recipient_type = 3 THEN r.mobile
+            END AS phonenumber,
+            CASE
+                WHEN r.recipient_type = 1 THEN u.nick_name
+                WHEN r.recipient_type = 3 THEN r.recipient_name
+            END AS nickname
+        FROM deepthink.dt_feishu_broadcast_config c
+        JOIN deepthink.dt_feishu_broadcast_recipient r ON r.config_id = c.id
+        LEFT JOIN deepthink.sys_user u
+            ON u.user_id = r.user_id
+            AND u.del_flag = '0'
+            AND u.status = '0'
+        WHERE c.job_name = #{jobName}
+            AND c.status = 1
+            AND c.del_flag = '0'
+            AND r.recipient_type IN (1, 3)
+            AND (
+                (r.recipient_type = 1 AND u.phonenumber IS NOT NULL AND u.phonenumber != '')
+                OR
+                (r.recipient_type = 3 AND r.mobile IS NOT NULL AND r.mobile != '')
+            )
+    </select>
+
+    <select id="getFeishuChatGroupSendObjectList" resultType="cn.com.ctop.job.bytedance.data.entity.FeishuSendObject">
+        SELECT DISTINCT
+            r.chat_id AS chatGroupId
+        FROM deepthink.dt_feishu_broadcast_config c
+        JOIN deepthink.dt_feishu_broadcast_recipient r ON r.config_id = c.id
+        WHERE c.job_name = #{jobName}
+            AND c.status = 1
+            AND c.del_flag = '0'
+            AND r.recipient_type = 2
+            AND r.chat_id IS NOT NULL
+            AND r.chat_id != ''
+    </select>
+</mapper>

+ 326 - 138
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/ReportsAdPushMapper.xml

@@ -2,7 +2,7 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
 <mapper namespace="cn.com.ctop.job.bytedance.data.mapper.ReportsAdPushMapper">
     <select id="updateTime" resultType="java.lang.String">
-        select date_format(max(update_time), '%Y-%m-%d %H:%i:%s') from application.media_ad_report_daily
+        select date_format(max(update_at), '%Y-%m-%d %H:%i:%s') from application.user_data_report_daily
         where stat_date = ${date} limit 1
     </select>
 
@@ -64,53 +64,112 @@
         round(ifnull(sum(iap_real_cost_amount), 0), 2) as iap_real_cost_amount
     </sql>
 
+    <sql id="coreIndicatorSqlPart">
+        round(ifnull(sum(cost_amount),0), 2) as cost_amount,
+        round(ifnull(sum(mj_cost_amount),0), 2) as mj_cost_amount,
+        round(ifnull(sum(dj_cost_amount),0), 2) as dj_cost_amount,
+        round(ifnull(sum(real_cost_amount), 0), 2) as real_cost_amount,
+        round(ifnull(sum(dj_real_cost_amount), 0), 2) as dj_real_cost_amount,
+        round(ifnull(sum(mj_real_cost_amount), 0), 2) as mj_real_cost_amount,
+        round(ifnull(sum(pay_amount), 0), 2) AS pay_amount,
+        round(ifnull(sum(dj_pay_amount), 0), 2) AS dj_pay_amount,
+        round(ifnull(sum(mj_pay_amount), 0), 2) AS mj_pay_amount,
+        round(ifnull(sum(share_iaa_amount), 0), 2) as share_iaa_amount,
+        round(ifnull(sum(dj_share_iaa_amount), 0), 2) as dj_share_iaa_amount,
+        round(ifnull(sum(mj_share_iaa_amount), 0), 2) as mj_share_iaa_amount,
+        round(ifnull(sum(share_iaa_amount_3), 0) + ifnull(sum(share_pay_amount), 0) - ifnull(sum(real_cost_amount), 0), 2) AS real_profit,
+        round(ifnull(sum(dj_share_iaa_amount_3), 0) + ifnull(sum(dj_share_pay_amount), 0) - ifnull(sum(dj_real_cost_amount), 0), 2) AS dj_real_profit,
+        round(ifnull(sum(mj_share_iaa_amount_3), 0) + ifnull(sum(mj_share_pay_amount), 0) - ifnull(sum(mj_real_cost_amount), 0), 2) AS mj_real_profit,
+        round(ifnull(sum(iaa_amount), 0) + ifnull(sum(pay_amount), 0) - ifnull(sum(cost_amount), 0), 2) AS water_profit,
+        round(ifnull(sum(dj_iaa_amount), 0) + ifnull(sum(dj_pay_amount), 0) - ifnull(sum(dj_cost_amount), 0), 2) AS dj_water_profit,
+        round(ifnull(sum(mj_iaa_amount), 0) + ifnull(sum(mj_pay_amount), 0) - ifnull(sum(mj_cost_amount), 0), 2) AS mj_water_profit,
+        concat(round(if(ifnull(sum(real_cost_amount),0)=0, 0, (ifnull(sum(share_iaa_amount_3),0)+ifnull(sum(share_pay_amount),0))/sum(real_cost_amount)*100), 2), '%') AS real_roi,
+        concat(round(if(ifnull(sum(dj_real_cost_amount),0)=0, 0, (ifnull(sum(dj_share_iaa_amount_3),0)+ifnull(sum(dj_share_pay_amount),0))/sum(dj_real_cost_amount)*100), 2), '%') AS dj_real_roi,
+        concat(round(if(ifnull(sum(mj_real_cost_amount),0)=0, 0, (ifnull(sum(mj_share_iaa_amount_3),0)+ifnull(sum(mj_share_pay_amount),0))/sum(mj_real_cost_amount)*100), 2), '%') AS mj_real_roi,
+        round(ifnull(sum(share_iaa_amount), 0) + ifnull(sum(share_pay_amount), 0), 2) as end_amount,
+        round(ifnull(sum(dj_share_iaa_amount), 0) + ifnull(sum(dj_share_pay_amount), 0), 2) as dj_end_amount,
+        round(ifnull(sum(mj_share_iaa_amount), 0) + ifnull(sum(mj_share_pay_amount), 0), 2) as mj_end_amount
+    </sql>
+
     <select id="tmpPushData" resultType="java.util.Map">
         select
-        <include refid="costAmount"/>,
-        <include refid="realCostAmount"/>,
-        <include refid="payAmount"/>,
-        <include refid="shareIaaAmount"/>,
-        <include refid="realProfit"/>,
-        <include refid="realRoi"/>,
-        <include refid="endAmount"/>
+        <include refid="coreIndicatorSqlPart"/>
         FROM
-            (select sum(cost_amount) as cost_amount, sum(real_cost_amount) as real_cost_amount, max(update_time) as update_time
-             from application.media_ad_report_daily
-             where stat_date = ${date} and ma_appid in (select app_id from tidb.deepthink.mini_app_info where business_line in (1,6,7,4,8,9,10))
-            ) tb1,
-            (select sum(pay_amount) as pay_amount,
-                    sum(iaa_amount) as iaa_amount,
-                    sum(share_iaa_amount_3) as share_iaa_amount_3,
-                    sum(share_pay_amount) as share_pay_amount,
-                    sum(share_iaa_amount) as share_iaa_amount
-             from application.user_data_report_daily
-             where stat_date = ${date} and ma_appid in (select app_id from tidb.deepthink.mini_app_info where business_line in (1,6,7,4,8,9,10))
-            ) tb2
+        (select sum(cost_amount) as cost_amount,
+        sum(case t3.movie_type when 'DJ' then ifnull(cost_amount, 0) else 0 end) as dj_cost_amount,
+        sum(case t3.movie_type when 'MJ' then ifnull(cost_amount, 0) else 0 end) as mj_cost_amount,
+        sum(real_cost_amount) as real_cost_amount,
+        sum(case t3.movie_type when 'DJ' then ifnull(real_cost_amount, 0) else 0 end) as dj_real_cost_amount,
+        sum(case t3.movie_type when 'MJ' then ifnull(real_cost_amount, 0) else 0 end) as mj_real_cost_amount,
+        max(t1.update_time) as update_time
+             from application.media_ad_report_daily t1
+        left join tidb.deepthink.mini_app_info t2 on t1.ma_appid = t2.app_id
+        join tidb.deepthink.all_moive t3 on t1.movie_id = t3.moive_id and find_in_set(t3.movie_source, t2.movie_sources) > 0
+        where stat_date = #{date}
+        and t2.business_line in (1,6,7,4,8,9,10)
+        ) tb1,
+        (select sum(pay_amount) as pay_amount,
+        sum(case t3.movie_type when 'DJ' then ifnull(pay_amount, 0) else 0 end) as dj_pay_amount,
+        sum(case t3.movie_type when 'MJ' then ifnull(pay_amount, 0) else 0 end) as mj_pay_amount,
+        sum(share_iaa_amount) as share_iaa_amount,
+        sum(case t3.movie_type when 'DJ' then ifnull(share_iaa_amount, 0) else 0 end) as dj_share_iaa_amount,
+        sum(case t3.movie_type when 'MJ' then ifnull(share_iaa_amount, 0) else 0 end) as mj_share_iaa_amount,
+        sum(share_iaa_amount_3) as share_iaa_amount_3,
+        sum(case t3.movie_type when 'DJ' then ifnull(share_iaa_amount_3, 0) else 0 end) as dj_share_iaa_amount_3,
+        sum(case t3.movie_type when 'MJ' then ifnull(share_iaa_amount_3, 0) else 0 end) as mj_share_iaa_amount_3,
+        sum(share_pay_amount) as share_pay_amount,
+        sum(case t3.movie_type when 'DJ' then ifnull(share_pay_amount, 0) else 0 end) as dj_share_pay_amount,
+        sum(case t3.movie_type when 'MJ' then ifnull(share_pay_amount, 0) else 0 end) as mj_share_pay_amount,
+        sum(iaa_amount) as iaa_amount,
+        sum(case t3.movie_type when 'DJ' then ifnull(iaa_amount, 0) else 0 end) as dj_iaa_amount,
+        sum(case t3.movie_type when 'MJ' then ifnull(iaa_amount, 0) else 0 end) as mj_iaa_amount
+        from application.user_data_report_daily t1
+        left join tidb.deepthink.mini_app_info t2 on t1.ma_appid = t2.app_id
+        join tidb.deepthink.all_moive t3 on t1.movie_id = t3.moive_id and find_in_set(t3.movie_source, t2.movie_sources) > 0
+        where stat_date = #{date}
+        and t2.business_line in (1,6,7,4,8,9,10)
+        ) tb2
     </select>
     <select id="adHourData" resultType="java.util.Map">
         select
-        <include refid="costAmount"/>,
-        <include refid="realCostAmount"/>,
-        <include refid="payAmount"/>,
-        <include refid="shareIaaAmount"/>,
-        <include refid="realProfit"/>,
-        <include refid="waterProfit"/>,
-        <include refid="realRoi"/>,
-        <include refid="endAmount"/>
+        <include refid="coreIndicatorSqlPart"/>
         from
-        (select sum(cost_amount) as cost_amount, sum(real_cost_amount) as real_cost_amount
-        from application.media_ad_report_hourly
-        where stat_date = #{date} and `hour`= #{hour} and ma_appid in (select app_id from tidb.deepthink.mini_app_info where business_line in (1,6,7,4,8,9,10))
+        (select sum(cost_amount) as cost_amount,
+        sum(case t3.movie_type when 'DJ' then ifnull(cost_amount, 0) else 0 end) as dj_cost_amount,
+        sum(case t3.movie_type when 'MJ' then ifnull(cost_amount, 0) else 0 end) as mj_cost_amount,
+        sum(real_cost_amount) as real_cost_amount,
+        sum(case t3.movie_type when 'DJ' then ifnull(real_cost_amount, 0) else 0 end) as dj_real_cost_amount,
+        sum(case t3.movie_type when 'MJ' then ifnull(real_cost_amount, 0) else 0 end) as mj_real_cost_amount
+        from application.media_ad_report_hourly t1
+        left join tidb.deepthink.mini_app_info t2 on t1.ma_appid = t2.app_id
+        join tidb.deepthink.all_moive t3 on t1.movie_id = t3.moive_id and find_in_set(t3.movie_source, t2.movie_sources) > 0
+        where stat_date = #{date} and `hour`= #{hour}
+        and t2.business_line in (1,6,7,4,8,9,10)
         ) tb1,
-        (select sum(pay_amount) as pay_amount, sum(iaa_amount) as iaa_amount,
+        (select sum(pay_amount) as pay_amount,
+        sum(case t3.movie_type when 'DJ' then ifnull(pay_amount, 0) else 0 end) as dj_pay_amount,
+        sum(case t3.movie_type when 'MJ' then ifnull(pay_amount, 0) else 0 end) as mj_pay_amount,
+        sum(share_iaa_amount) as share_iaa_amount,
+        sum(case t3.movie_type when 'DJ' then ifnull(share_iaa_amount, 0) else 0 end) as dj_share_iaa_amount,
+        sum(case t3.movie_type when 'MJ' then ifnull(share_iaa_amount, 0) else 0 end) as mj_share_iaa_amount,
         sum(share_iaa_amount_3) as share_iaa_amount_3,
-        sum(share_iaa_amount) as share_iaa_amount, sum(share_pay_amount) as share_pay_amount
-        from application.user_data_report_hourly
-        where stat_date = #{date} and `hour`= #{hour} and ma_appid in (select app_id from tidb.deepthink.mini_app_info where business_line in (1,6,7,4,8,9,10))
+        sum(case t3.movie_type when 'DJ' then ifnull(share_iaa_amount_3, 0) else 0 end) as dj_share_iaa_amount_3,
+        sum(case t3.movie_type when 'MJ' then ifnull(share_iaa_amount_3, 0) else 0 end) as mj_share_iaa_amount_3,
+        sum(share_pay_amount) as share_pay_amount,
+        sum(case t3.movie_type when 'DJ' then ifnull(share_pay_amount, 0) else 0 end) as dj_share_pay_amount,
+        sum(case t3.movie_type when 'MJ' then ifnull(share_pay_amount, 0) else 0 end) as mj_share_pay_amount,
+        sum(iaa_amount) as iaa_amount,
+        sum(case t3.movie_type when 'DJ' then ifnull(iaa_amount, 0) else 0 end) as dj_iaa_amount,
+        sum(case t3.movie_type when 'MJ' then ifnull(iaa_amount, 0) else 0 end) as mj_iaa_amount
+        from application.user_data_report_hourly t1
+        left join tidb.deepthink.mini_app_info t2 on t1.ma_appid = t2.app_id
+        join tidb.deepthink.all_moive t3 on t1.movie_id = t3.moive_id and find_in_set(t3.movie_source, t2.movie_sources) > 0
+        where stat_date = #{date} and `hour`= #{hour}
+        and t2.business_line in (1,6,7,4,8,9,10)
         ) tb2
     </select>
     <select id="tmpTopMovie" resultType="java.util.Map">
-        select tb4.ly_movie_name as movie_name, tb4.movie_project_source, tb5.dict_name as movie_project_source_name,
+        select tb4.ly_movie_name as movie_name, tb4.movie_project_source, tb5.dict_name as movie_project_source_name, tb4.movie_type,
         group_concat(distinct case tb4.movie_source when 2 then '2' else '1' end) as movie_source,
         rank() over (order by sum(iaa_amount)+sum(pay_amount) desc) as rk,
         <include refid="endAmount"/>,
@@ -150,52 +209,70 @@
         group by movie_id
         ) tb3 on tb1.movie_id=tb3.movie_id
         left join
-        (select moive_id, standard_movie_id, standard_movie_name, movie_source, movie_project_source,ly_movie_name from tidb.deepthink.all_moive
+        (select moive_id, standard_movie_id, standard_movie_name, movie_source, movie_project_source,project_ad_date, ly_movie_name, movie_type from tidb.deepthink.all_moive
         ) tb4 on tb1.movie_id=tb4.moive_id
         left join
         (select dict_key, dict_name from tidb.deepthink.dt_dictionary where select_key='movie_project_source'
         ) tb5 on tb4.movie_project_source=tb5.dict_key
         where 1=1 and tb1.movie_id!='-9999'
-        group by tb4.ly_movie_name, tb4.movie_project_source, tb5.dict_name
+        group by tb4.ly_movie_name, tb4.movie_project_source, tb5.dict_name, tb4.movie_type
         order by sum(iaa_amount)+sum(pay_amount) desc
         limit 20
     </select>
 
     <select id="adDailyData" resultType="java.util.Map">
         select
-        <include refid="costAmount"/>,
-        <include refid="realCostAmount"/>,
-        <include refid="payAmount"/>,
-        <include refid="shareIaaAmount"/>,
-        <include refid="realProfit"/>,
-        <include refid="waterProfit"/>,
-        <include refid="realRoi"/>,
-        <include refid="endAmount"/>,
+        <include refid="coreIndicatorSqlPart"/>
+        ,
         date_format(max(update_time), '%Y-%m-%d %H:%i:%s') as update_time
         from
-        (select sum(cost_amount) as cost_amount, sum(real_cost_amount) as real_cost_amount, max(update_time) as update_time
-        from application.media_ad_report_daily
-        where stat_date = #{date} and ma_appid in (select app_id from tidb.deepthink.mini_app_info where business_line in (1,6,7,4,8,9,10))
+        (select sum(cost_amount) as cost_amount,
+        sum(case t3.movie_type when 'DJ' then ifnull(cost_amount, 0) else 0 end) as dj_cost_amount,
+        sum(case t3.movie_type when 'MJ' then ifnull(cost_amount, 0) else 0 end) as mj_cost_amount,
+        sum(real_cost_amount) as real_cost_amount,
+        sum(case t3.movie_type when 'DJ' then ifnull(real_cost_amount, 0) else 0 end) as dj_real_cost_amount,
+        sum(case t3.movie_type when 'MJ' then ifnull(real_cost_amount, 0) else 0 end) as mj_real_cost_amount,
+                max(t1.update_time) as update_time
+        from application.media_ad_report_daily t1
+        left join tidb.deepthink.mini_app_info t2 on t1.ma_appid = t2.app_id
+        join tidb.deepthink.all_moive t3 on t1.movie_id = t3.moive_id and find_in_set(t3.movie_source, t2.movie_sources) > 0
+        where stat_date = #{date}
+        and t2.business_line in (1,6,7,4,8,9,10)
         ) tb1,
-        (select sum(pay_amount) as pay_amount, sum(iaa_amount) as iaa_amount,
-        sum(share_iaa_amount) as share_iaa_amount, sum(share_pay_amount) as share_pay_amount,
-        sum(share_iaa_amount_3) as share_iaa_amount_3
-        from application.user_data_report_daily
-        where stat_date = #{date} and ma_appid in (select app_id from tidb.deepthink.mini_app_info where business_line in (1,6,7,4,8,9,10))
+        (select sum(pay_amount) as pay_amount,
+                sum(case t3.movie_type when 'DJ' then ifnull(pay_amount, 0) else 0 end) as dj_pay_amount,
+                sum(case t3.movie_type when 'MJ' then ifnull(pay_amount, 0) else 0 end) as mj_pay_amount,
+                sum(share_iaa_amount) as share_iaa_amount,
+                sum(case t3.movie_type when 'DJ' then ifnull(share_iaa_amount, 0) else 0 end) as dj_share_iaa_amount,
+                sum(case t3.movie_type when 'MJ' then ifnull(share_iaa_amount, 0) else 0 end) as mj_share_iaa_amount,
+                sum(share_iaa_amount_3) as share_iaa_amount_3,
+                sum(case t3.movie_type when 'DJ' then ifnull(share_iaa_amount_3, 0) else 0 end) as dj_share_iaa_amount_3,
+                sum(case t3.movie_type when 'MJ' then ifnull(share_iaa_amount_3, 0) else 0 end) as mj_share_iaa_amount_3,
+                sum(share_pay_amount) as share_pay_amount,
+                sum(case t3.movie_type when 'DJ' then ifnull(share_pay_amount, 0) else 0 end) as dj_share_pay_amount,
+                sum(case t3.movie_type when 'MJ' then ifnull(share_pay_amount, 0) else 0 end) as mj_share_pay_amount,
+                sum(iaa_amount) as iaa_amount,
+                sum(case t3.movie_type when 'DJ' then ifnull(iaa_amount, 0) else 0 end) as dj_iaa_amount,
+                sum(case t3.movie_type when 'MJ' then ifnull(iaa_amount, 0) else 0 end) as mj_iaa_amount
+        from application.user_data_report_daily t1
+             left join tidb.deepthink.mini_app_info t2 on t1.ma_appid = t2.app_id
+             join tidb.deepthink.all_moive t3 on t1.movie_id = t3.moive_id and find_in_set(t3.movie_source, t2.movie_sources) > 0
+         where stat_date = #{date}
+           and t2.business_line in (1,6,7,4,8,9,10)
         ) tb2
     </select>
 
     <select id="todayTopMovie" resultType="com.alibaba.fastjson.JSONObject" >
         select
-        tb4.ly_movie_name as movie_name, tb4.movie_project_source, tb6.dict_name as movie_project_source_name,
+        tb4.movie_name as movie_name, tb4.movie_project_source, tb6.dict_name as movie_project_source_name, tb4.movie_type,
         case
-        when (DATEDIFF(STR_TO_DATE(tb1.stat_date, '%Y%m%d'), STR_TO_DATE(tb4.project_ad_date, '%Y%m%d')) + 1) between 1
+        when (DATEDIFF(STR_TO_DATE(${date}, '%Y%m%d'), STR_TO_DATE(tb4.project_ad_date, '%Y%m%d')) + 1) between 1
         and 3 then '新剧1阶'
-        when (DATEDIFF(STR_TO_DATE(tb1.stat_date, '%Y%m%d'), STR_TO_DATE(tb4.project_ad_date, '%Y%m%d')) + 1) between 4
+        when (DATEDIFF(STR_TO_DATE(${date}, '%Y%m%d'), STR_TO_DATE(tb4.project_ad_date, '%Y%m%d')) + 1) between 4
         and 7 then '新剧2阶'
-        when (DATEDIFF(STR_TO_DATE(tb1.stat_date, '%Y%m%d'), STR_TO_DATE(tb4.project_ad_date, '%Y%m%d')) + 1) between 8
+        when (DATEDIFF(STR_TO_DATE(${date}, '%Y%m%d'), STR_TO_DATE(tb4.project_ad_date, '%Y%m%d')) + 1) between 8
         and 15 then '次新剧'
-        when (DATEDIFF(STR_TO_DATE(tb1.stat_date, '%Y%m%d'), STR_TO_DATE(tb4.project_ad_date, '%Y%m%d')) + 1) >=15 then
+        when (DATEDIFF(STR_TO_DATE(${date}, '%Y%m%d'), STR_TO_DATE(tb4.project_ad_date, '%Y%m%d')) + 1) >=15 then
         '老剧'
         else 999 end as project_ad_step,
         <include refid="endAmount"/>,
@@ -210,44 +287,47 @@
         <include refid="iapCostAmount"/>,
         round(ifnull(sum(hour_cost_amount), 0), 2) as hour_cost_amount
         from
-        (select ${date} as stat_date, movie_id from application.media_ad_report_daily where stat_date=${date} and ma_appid in (select app_id from tidb.deepthink.mini_app_info where business_line in (1,6,7,4,8,9,10))
-        union select ${date} as stat_date, movie_id from application.user_data_report_daily where stat_date=${date} and ma_appid in (select app_id from tidb.deepthink.mini_app_info where business_line in (1,6,7,4,8,9,10))) tb1
-        left join
         (
-        select movie_id, sum(iaa_cost_amount) as iaa_cost_amount, sum(iaa_real_cost_amount) as iaa_real_cost_amount,
+        select ma_appid, movie_id, sum(iaa_cost_amount) as iaa_cost_amount, sum(iaa_real_cost_amount) as iaa_real_cost_amount,
         sum(iap_cost_amount) as iap_cost_amount, sum(iap_real_cost_amount) as iap_real_cost_amount,
         sum(iaa_cost_amount)+sum(iap_cost_amount) as cost_amount,
         sum(iaa_real_cost_amount)+sum(iap_real_cost_amount) as real_cost_amount
         from
-        (select movie_id, round(ifnull(sum(cost_amount),0),2) as iaa_cost_amount, sum(real_cost_amount) as iaa_real_cost_amount, 0 as iap_cost_amount, 0 as iap_real_cost_amount
-        from application.media_ad_report_daily where stat_date=${date} and ma_appid in (select app_id from tidb.deepthink.mini_app_info where business_line in (1,6,7,4,8,9,10) and business_method='IAA')
-        group by movie_id
+        (select ma_appid, movie_id, round(ifnull(sum(cost_amount),0),2) as iaa_cost_amount, sum(real_cost_amount) as iaa_real_cost_amount, 0 as iap_cost_amount, 0 as iap_real_cost_amount
+        from application.media_ad_report_daily where stat_date=${date}
+        and ma_appid in (select app_id from tidb.deepthink.mini_app_info where business_line in (1,6,7,4,8,9,10) and business_method='IAA')
+        group by ma_appid, movie_id
         union all
-        select movie_id, 0 as iaa_cost_amount, 0 as iaa_real_cost_amount,round(ifnull(sum(cost_amount),0),2) as cost_amount, sum(real_cost_amount) as real_cost_amount
-        from application.media_ad_report_daily where stat_date=${date} and ma_appid in (select app_id from tidb.deepthink.mini_app_info where business_line in (1,6,7,4,8,9,10) and business_method='IAP')
-        group by movie_id) subt2
-        group by movie_id
-        ) tb2 on tb1.movie_id=tb2.movie_id
-        left join
-        (select movie_id, sum(iaa_amount) as iaa_amount, sum(pay_amount) as pay_amount,
+        select ma_appid, movie_id, 0 as iaa_cost_amount, 0 as iaa_real_cost_amount,round(ifnull(sum(cost_amount),0),2) as cost_amount, sum(real_cost_amount) as real_cost_amount
+        from application.media_ad_report_daily where stat_date=${date}
+        and ma_appid in (select app_id from tidb.deepthink.mini_app_info where business_line in (1,6,7,4,8,9,10) and business_method='IAP')
+        group by ma_appid, movie_id) subt2
+        group by ma_appid, movie_id
+        ) tb2
+        full join
+        (select ma_appid, movie_id, sum(iaa_amount) as iaa_amount, sum(pay_amount) as pay_amount,
         sum(share_iaa_amount_3) as share_iaa_amount_3,
         ifnull(sum(share_iaa_amount), 0) as share_iaa_amount,
         ifnull(sum(share_pay_amount), 0) as share_pay_amount
         from application.user_data_report_daily where stat_date=${date} and ma_appid in (select app_id from tidb.deepthink.mini_app_info where business_line in (1,6,7,4,8,9,10))
-        group by movie_id
-        ) tb3 on tb1.movie_id=tb3.movie_id
+        group by ma_appid, movie_id
+        ) tb3 on tb2.movie_id=tb3.movie_id and tb2.ma_appid = tb3.ma_appid
+        left join tidb.deepthink.mini_app_info app on coalesce(tb2.ma_appid, tb3.ma_appid)=app.app_id
         left join
-        (select moive_id, standard_movie_id, standard_movie_name, movie_source, movie_project_source,project_ad_date, ly_movie_name from tidb.deepthink.all_moive
-        ) tb4 on tb1.movie_id=tb4.moive_id
+        (select moive_id as movie_id, movie_name, standard_movie_id, standard_movie_name, movie_source, movie_project_source,project_ad_date, ly_movie_name, movie_type from tidb.deepthink.all_moive
+        ) tb4
+        on coalesce(tb2.movie_id, tb3.movie_id)=tb4.movie_id and find_in_set(tb4.movie_source, app.movie_sources)> 0
         left join
-        (select movie_id, ifnull(sum(cost_amount), 0) as hour_cost_amount from application.media_ad_report_hourly
+        (select ma_appid, movie_id, ifnull(sum(cost_amount), 0) as hour_cost_amount
+        from application.media_ad_report_hourly
         where stat_date=${date} and `hour`=${hour}  and ma_appid in (select app_id from tidb.deepthink.mini_app_info where business_line in (1,6,7,4,8,9,10))
-        group by movie_id) tb5 on tb1.movie_id=tb5.movie_id
+        group by ma_appid, movie_id
+        ) tb5 on tb4.movie_id=tb5.movie_id and app.app_id = tb5.ma_appid
         left join
         (select dict_key, dict_name from tidb.deepthink.dt_dictionary where select_key='movie_project_source'
         ) tb6 on tb4.movie_project_source=tb6.dict_key
-        where 1=1 and tb1.movie_id != '-9999'
-        group by 1,2,3,4
+        where 1=1 and tb4.movie_id != '-9999'
+        group by 1,2,3,4,5
         order by ${sort}
         limit 20
     </select>
@@ -287,11 +367,69 @@
         left join (select user_id, nick_name, phonenumber, dept_id, status, del_flag from tidb.deepthink.sys_user) tb4
         on tb1.user_id=tb4.user_id
         left join (
-            select dp.dept_id, dp.dept_name, ifnull(subdp.dept_id, dp.dept_id) as sub_dept_id, ifnull(subdp.dept_name, dp.dept_name) as sub_dept_name from (select * from tidb.deepthink.sys_dept where parent_id in (select dept_id from tidb.deepthink.sys_dept where parent_id=300)) dp
+            select dp.dept_id, dp.dept_name, ifnull(subdp.dept_id, dp.dept_id) as sub_dept_id, ifnull(subdp.dept_name, dp.dept_name) as sub_dept_name from (select * from tidb.deepthink.sys_dept where parent_id in (300)) dp
             right join tidb.deepthink.sys_dept subdp on dp.dept_id=subdp.parent_id
             where dp.dept_id is not null
             union all
-            select dept_id, dept_name, dept_id as sub_dept_id, dept_name as sub_dept_name from tidb.deepthink.sys_dept where parent_id in (select dept_id from tidb.deepthink.sys_dept where parent_id=300)
+            select dept_id, dept_name, dept_id as sub_dept_id, dept_name as sub_dept_name from tidb.deepthink.sys_dept where parent_id in (300)
+        ) tb5
+        on tb4.dept_id = tb5.sub_dept_id
+        where tb1.user_id is not null and (tb4.nick_name not like '%IAP%' and tb4.nick_name not like '%IAA%')
+        and tb4.status = 0 and tb4.del_flag = 0
+        group by tb1.user_id, tb4.phonenumber, tb4.nick_name, tb5.dept_id, tb5.dept_name
+        having sum(cost_amount)>1
+        order by rk asc
+    </select>
+
+    <select id="optimizerCostRankV2" resultType="java.util.Map">
+        select tb1.user_id, tb4.phonenumber, tb4.nick_name, tb5.dept_id, tb5.dept_name,
+        rank() over (order by sum(cost_amount) desc) as rk,
+        <include refid="costAmount"/>,
+        <include refid="iaaRoi"/>,
+        <include refid="iapRoi"/>,
+        round(sum(dj_cost_amount), 2) as dj_cost_amount,
+        round(sum(mj_cost_amount), 2) as mj_cost_amount
+        from
+            (select cast(advertiser_id as char) advertiser_id, user_id from tidb.deepthink.advertiser_bind_info where user_id is not null) tb1
+            left join
+            (select advertiser_id, sum(iaa_cost_amount) as iaa_cost_amount, sum(iaa_real_cost_amount) as iaa_real_cost_amount,
+            sum(iap_cost_amount) as iap_cost_amount, sum(iap_real_cost_amount) as iap_real_cost_amount,
+            sum(iaa_cost_amount)+sum(iap_cost_amount) as cost_amount,
+            sum(iaa_real_cost_amount)+sum(iap_real_cost_amount) as real_cost_amount,
+            sum(dj_cost_amount) as dj_cost_amount,
+            sum(mj_cost_amount) as mj_cost_amount
+            FROM
+                (select advertiser_id,
+                round(ifnull(sum(case when t2.business_method='IAA' then cost_amount else 0 end), 0), 2) as iaa_cost_amount,
+                round(ifnull(sum(case when t2.business_method='IAA' then real_cost_amount else 0 end), 0), 2) as iaa_real_cost_amount,
+                round(ifnull(sum(case when t2.business_method='IAP' then cost_amount else 0 end), 0), 2) as iap_cost_amount,
+                round(ifnull(sum(case when t2.business_method='IAP' then real_cost_amount else 0 end), 0), 2) as iap_real_cost_amount,
+                sum(case t3.movie_type when 'DJ' then ifnull(cost_amount, 0) else 0 end) as dj_cost_amount,
+                sum(case t3.movie_type when 'MJ' then ifnull(cost_amount, 0) else 0 end) as mj_cost_amount
+                from application.media_ad_report_daily t1
+                join tidb.deepthink.mini_app_info t2 on t1.ma_appid = t2.app_id
+                join tidb.deepthink.all_moive t3 on t1.movie_id = t3.moive_id and find_in_set(t3.movie_source, t2.movie_sources) > 0
+                where stat_date=${date} and t2.business_line in (1,6,7,4,8,9,10)
+                group by advertiser_id
+            )subtb2
+            group by advertiser_id
+            ) tb2
+        on tb1.advertiser_id = tb2.advertiser_id
+        left join (select advertiser_id,
+        round(ifnull(sum(share_iaa_amount_3), 0),2) as share_iaa_amount_3,
+        sum(share_iaa_amount) as share_iaa_amount,
+        sum(share_pay_amount) as share_pay_amount
+        from application.user_data_report_daily where stat_date=${date}  and ma_appid in (select app_id from tidb.deepthink.mini_app_info where business_line in (1,6,7,4,8,9,10))
+        group by advertiser_id) tb3
+        on tb1.advertiser_id = tb3.advertiser_id
+        left join (select user_id, nick_name, phonenumber, dept_id, status, del_flag from tidb.deepthink.sys_user) tb4
+        on tb1.user_id=tb4.user_id
+        left join (
+        select dp.dept_id, dp.dept_name, ifnull(subdp.dept_id, dp.dept_id) as sub_dept_id, ifnull(subdp.dept_name, dp.dept_name) as sub_dept_name from (select * from tidb.deepthink.sys_dept where parent_id in (300)) dp
+        right join tidb.deepthink.sys_dept subdp on dp.dept_id=subdp.parent_id
+        where dp.dept_id is not null
+        union all
+        select dept_id, dept_name, dept_id as sub_dept_id, dept_name as sub_dept_name from tidb.deepthink.sys_dept where parent_id in (300)
         ) tb5
         on tb4.dept_id = tb5.sub_dept_id
         where tb1.user_id is not null and (tb4.nick_name not like '%IAP%' and tb4.nick_name not like '%IAA%')
@@ -300,6 +438,9 @@
         having sum(cost_amount)>1
         order by rk asc
     </select>
+
+
+
     <select id="optimizerDateData" resultType="java.util.Map">
         select tb1.user_id,tb4.phonenumber,tb4.nick_name, tb5.dept_id,
         <include refid="costAmount"/>,
@@ -320,16 +461,18 @@
         from application.user_data_report_daily
         where stat_date = #{date} and ma_appid in (select app_id from tidb.deepthink.mini_app_info where business_line in (1,6,7,4,8,9,10))
         group by advertiser_id) tb3 on tb1.advertiser_id = tb3.advertiser_id
-        left join (select user_id, nick_name, phonenumber, dept_id from tidb.deepthink.sys_user) tb4
+        left join (select user_id, nick_name, phonenumber, dept_id, status, del_flag from tidb.deepthink.sys_user) tb4
         on tb1.user_id=tb4.user_id
         left join (
-        select dp.dept_id, dp.dept_name, ifnull(subdp.dept_id, dp.dept_id) as sub_dept_id, ifnull(subdp.dept_name, dp.dept_name) as sub_dept_name from (select * from tidb.deepthink.sys_dept where parent_id in (select dept_id from tidb.deepthink.sys_dept where parent_id=300)) dp
+        select dp.dept_id, dp.dept_name, ifnull(subdp.dept_id, dp.dept_id) as sub_dept_id, ifnull(subdp.dept_name, dp.dept_name) as sub_dept_name from (select * from tidb.deepthink.sys_dept where parent_id in (300)) dp
         right join tidb.deepthink.sys_dept subdp on dp.dept_id=subdp.parent_id
         where dp.dept_id is not null
         union all
-        select dept_id, dept_name, dept_id as sub_dept_id, dept_name as sub_dept_name from tidb.deepthink.sys_dept where parent_id in (select dept_id from tidb.deepthink.sys_dept where parent_id=300)
+        select dept_id, dept_name, dept_id as sub_dept_id, dept_name as sub_dept_name from tidb.deepthink.sys_dept where parent_id in (300)
         ) tb5
         on tb4.dept_id = tb5.sub_dept_id
+        where tb1.user_id is not null and (tb4.nick_name not like '%IAP%' and tb4.nick_name not like '%IAA%')
+        and tb4.status = 0 and tb4.del_flag = 0
         group by tb1.user_id, tb4.phonenumber, tb4.nick_name, tb5.dept_id
         having sum(cost_amount)>0
     </select>
@@ -353,22 +496,31 @@
         from application.user_data_report_hourly
         where stat_date = #{date} and `hour`= #{hour} and ma_appid in (select app_id from tidb.deepthink.mini_app_info where business_line in (1,6,7,4,8,9,10))
         group by advertiser_id) tb3 on tb1.advertiser_id = tb3.advertiser_id
-        left join (select user_id, nick_name, phonenumber from tidb.deepthink.sys_user) tb4
+        left join (select user_id, nick_name, phonenumber, status, del_flag  from tidb.deepthink.sys_user) tb4
         on tb1.user_id=tb4.user_id
+        where tb1.user_id is not null and (tb4.nick_name not like '%IAP%' and tb4.nick_name not like '%IAA%')
+        and tb4.status = 0 and tb4.del_flag = 0
         group by tb1.user_id, tb4.phonenumber
     </select>
 
 
 
     <select id="deptCostRank" resultType="java.util.Map">
-        select tb5.dept_id, tb5.dept_name,
+        select tb5.sub_dept_id as dept_id, concat(tb5.dept_name, '-', tb5.sub_dept_name) as dept_name,
         rank() over (order by sum(cost_amount) desc) as rk,
         <include refid="costAmount"/>,
+        sum(dj_cost_amount) as dj_cost_amount,
+        sum(mj_cost_amount) as mj_cost_amount,
         ifnull(sum(cost_amount_hour), 0) as cost_amount_hour
         from
         (select cast(advertiser_id as char) advertiser_id, user_id from tidb.deepthink.advertiser_bind_info where user_id is not null) tb1
-        left join (select advertiser_id, sum(cost_amount) as cost_amount, sum(real_cost_amount) as real_cost_amount
-        from application.media_ad_report_daily where stat_date=#{date}  and ma_appid in (select app_id from tidb.deepthink.mini_app_info where business_line in (1,6,7,4,8,9,10))
+        left join (select advertiser_id, sum(cost_amount) as cost_amount, sum(real_cost_amount) as real_cost_amount,
+        sum(case t3.movie_type when 'DJ' then ifnull(cost_amount, 0) else 0 end) as dj_cost_amount,
+        sum(case t3.movie_type when 'MJ' then ifnull(cost_amount, 0) else 0 end) as mj_cost_amount
+        from application.media_ad_report_daily t1
+        join tidb.deepthink.mini_app_info t2 on t1.ma_appid = t2.app_id
+        join tidb.deepthink.all_moive t3 on t1.movie_id = t3.moive_id and find_in_set(t3.movie_source, t2.movie_sources) > 0
+        where stat_date=#{date} and ma_appid in (select app_id from tidb.deepthink.mini_app_info where t2.business_line in (1,6,7,4,8,9,10))
         group by advertiser_id) tb2
         on tb1.advertiser_id = tb2.advertiser_id
         left join (select advertiser_id, sum(cost_amount) as cost_amount_hour
@@ -378,14 +530,14 @@
         left join (select user_id, nick_name, phonenumber, dept_id from tidb.deepthink.sys_user) tb4
         on tb1.user_id=tb4.user_id
         left join (
-        select dp.dept_id, dp.dept_name, ifnull(subdp.dept_id, dp.dept_id) as sub_dept_id, ifnull(subdp.dept_name, dp.dept_name) as sub_dept_name from (select * from tidb.deepthink.sys_dept where parent_id in (select dept_id from tidb.deepthink.sys_dept where parent_id=300)) dp
+        select dp.dept_id, dp.dept_name, ifnull(subdp.dept_id, dp.dept_id) as sub_dept_id, ifnull(subdp.dept_name, dp.dept_name) as sub_dept_name from (select * from tidb.deepthink.sys_dept where parent_id in (300)) dp
         right join tidb.deepthink.sys_dept subdp on dp.dept_id=subdp.parent_id
         where dp.dept_id is not null
         union all
-        select dept_id, dept_name, dept_id as sub_dept_id, dept_name as sub_dept_name from tidb.deepthink.sys_dept where parent_id in (select dept_id from tidb.deepthink.sys_dept where parent_id=300)
+        select dept_id, dept_name, dept_id as sub_dept_id, dept_name as sub_dept_name from tidb.deepthink.sys_dept where parent_id in (300)
         ) tb5
         on tb4.dept_id = tb5.sub_dept_id
-        group by tb5.dept_id, tb5.dept_name
+        group by tb5.sub_dept_id, tb5.dept_name, tb5.sub_dept_name
         having sum(cost_amount)>1
         order by rk asc
         limit 10
@@ -456,15 +608,7 @@
         where tb1.ma_appid != tb2.ma_appid
         order by tb2.user_id
     </select>
-    <select id="deptRank2" resultType="java.util.Map">
-        select tb5.dept_id, tb5.dept_name,
-        rank() over (order by sum(cost_amount) desc) as rk,
-        <include refid="costAmount"/>,
-        <include refid="sharePayAmount"/>,
-        <include refid="shareIaaAmount3"/>,
-        <include refid="iaaRoi"/>,
-        <include refid="iapRoi"/>
-        from
+    <sql id="deptRankSqlPart">
         (select cast(advertiser_id as char) advertiser_id, user_id from tidb.deepthink.advertiser_bind_info where user_id is not null and user_id != -9999 ) tb1
         left join
         (select advertiser_id, sum(iaa_cost_amount) as iaa_cost_amount, sum(iaa_real_cost_amount) as iaa_real_cost_amount,
@@ -480,30 +624,51 @@
         from application.media_ad_report_daily where stat_date=${date} and ma_appid in (select app_id from tidb.deepthink.mini_app_info where business_line in (1,6,7,4,8,9,10) and business_method='IAP')
         group by advertiser_id)subtb2
         group by advertiser_id
-        ) tb2
+            ) tb2
         on tb1.advertiser_id = tb2.advertiser_id
-        left join (select advertiser_id,
-        round(ifnull(sum(share_iaa_amount_3), 0),2) as share_iaa_amount_3,
-        ifnull(sum(share_iaa_amount), 0) as share_iaa_amount,
-        sum(share_pay_amount) as share_pay_amount
-        from application.user_data_report_daily where stat_date=${date} and ma_appid in (select app_id from tidb.deepthink.mini_app_info where business_line in (1,6,7,4,8,9,10))
-        group by advertiser_id) tb3
-        on tb1.advertiser_id = tb3.advertiser_id
-        left join (select user_id, nick_name, phonenumber, dept_id from tidb.deepthink.sys_user) tb4
-        on tb1.user_id=tb4.user_id
-        left join (
-            select dp.dept_id, dp.dept_name, ifnull(subdp.dept_id, dp.dept_id) as sub_dept_id, ifnull(subdp.dept_name, dp.dept_name) as sub_dept_name from (select * from tidb.deepthink.sys_dept where parent_id in (select dept_id from tidb.deepthink.sys_dept where parent_id=300)) dp
+            left join (select advertiser_id,
+            round(ifnull(sum(share_iaa_amount_3), 0),2) as share_iaa_amount_3,
+            ifnull(sum(share_iaa_amount), 0) as share_iaa_amount,
+            sum(share_pay_amount) as share_pay_amount
+            from application.user_data_report_daily where stat_date=${date} and ma_appid in (select app_id from tidb.deepthink.mini_app_info where business_line in (1,6,7,4,8,9,10))
+            group by advertiser_id) tb3
+            on tb1.advertiser_id = tb3.advertiser_id
+            left join (select user_id, nick_name, phonenumber, dept_id from tidb.deepthink.sys_user) tb4
+            on tb1.user_id=tb4.user_id
+            left join (
+            select dp.dept_id, dp.dept_name, ifnull(subdp.dept_id, dp.dept_id) as sub_dept_id, ifnull(subdp.dept_name, dp.dept_name) as sub_dept_name from (select * from tidb.deepthink.sys_dept where parent_id in (300)) dp
             right join tidb.deepthink.sys_dept subdp on dp.dept_id=subdp.parent_id
             where dp.dept_id is not null
             union all
-            select dept_id, dept_name, dept_id as sub_dept_id, dept_name as sub_dept_name from tidb.deepthink.sys_dept where parent_id in (select dept_id from tidb.deepthink.sys_dept where parent_id=300)
-        ) tb5
-        on tb4.dept_id = tb5.sub_dept_id
-        where tb4.user_id is not null
-        group by tb5.dept_id, tb5.dept_name
+            select dept_id, dept_name, dept_id as sub_dept_id, dept_name as sub_dept_name from tidb.deepthink.sys_dept where parent_id in (300)
+            ) tb5
+            on tb4.dept_id = tb5.sub_dept_id
+        where tb4.user_id is not null and tb5.dept_id is not null
+    </sql>
+    <select id="deptRank2" resultType="java.util.Map">
+        select tb5.sub_dept_id as dept_id, concat(tb5.dept_name, '-', tb5.sub_dept_name) as dept_name,
+        rank() over (order by sum(cost_amount) desc) as rk,
+        <include refid="costAmount"/>,
+        <include refid="sharePayAmount"/>,
+        <include refid="shareIaaAmount3"/>,
+        <include refid="iaaRoi"/>,
+        <include refid="iapRoi"/>
+        from
+        <include refid="deptRankSqlPart"/>
+        group by tb5.sub_dept_id, tb5.sub_dept_name, tb5.dept_name
         having sum(cost_amount)>1
         order by rk
     </select>
+    <select id="deptRankTotal" resultType="java.util.Map">
+        select 0 as dept_id, '总计' as dept_name, '总计' as rk,
+        <include refid="costAmount"/>,
+        <include refid="sharePayAmount"/>,
+        <include refid="shareIaaAmount3"/>,
+        <include refid="iaaRoi"/>,
+        <include refid="iapRoi"/>
+        from
+        <include refid="deptRankSqlPart"/>
+    </select>
     <select id="cutDeptRank" resultType="java.util.Map">
         select row_number() over (order by sum(cost) desc) as ranks,
         dept_name as dept_name,
@@ -535,30 +700,53 @@
     </select>
     <select id="allBusinessPushData" resultType="java.util.Map">
         select
-        <include refid="costAmount"/>,
-        <include refid="realCostAmount"/>,
-        <include refid="payAmount"/>,
-        <include refid="iaaAmount"/>,
-        <include refid="shareIaaAmount"/>,
-        <include refid="realProfit"/>,
-        <include refid="waterProfit"/>,
-        <include refid="waterEndAmount"/>,
-        <include refid="endAmount"/>,
-        date_format(max(update_time), '%Y-%m-%d %H:%i:%s') as update_time
+        round(ifnull(sum(iaa_amount), 0) + ifnull(sum(pay_amount), 0), 2) AS water_end_amount,
+        round(ifnull(sum(dj_iaa_amount), 0) + ifnull(sum(dj_pay_amount), 0), 2) AS dj_water_end_amount,
+        round(ifnull(sum(mj_iaa_amount), 0) + ifnull(sum(mj_pay_amount), 0), 2) AS mj_water_end_amount,
+        round(ifnull(sum(share_iaa_amount), 0) + ifnull(sum(share_pay_amount), 0), 2) as end_amount,
+        round(ifnull(sum(dj_share_iaa_amount), 0) + ifnull(sum(dj_share_pay_amount), 0), 2) as dj_end_amount,
+        round(ifnull(sum(mj_share_iaa_amount), 0) + ifnull(sum(mj_share_pay_amount), 0), 2) as mj_end_amount,
+        round(ifnull(sum(share_iaa_amount_3), 0) + ifnull(sum(share_pay_amount), 0) - ifnull(sum(real_cost_amount), 0), 2) AS real_profit,
+        round(ifnull(sum(dj_share_iaa_amount_3), 0) + ifnull(sum(dj_share_pay_amount), 0) - ifnull(sum(dj_real_cost_amount), 0), 2) AS dj_real_profit,
+        round(ifnull(sum(mj_share_iaa_amount_3), 0) + ifnull(sum(mj_share_pay_amount), 0) - ifnull(sum(mj_real_cost_amount), 0), 2) AS mj_real_profit,
+        date_format(max(update_at), '%Y-%m-%d %H:%i:%s') as update_time
         from
-        (select sum(cost_amount) as cost_amount, sum(real_cost_amount) as real_cost_amount, max(update_time) as update_time
-        from application.media_ad_report_daily
+        (select sum(cost_amount) as cost_amount,
+        sum(case t3.movie_type when 'DJ' then ifnull(cost_amount, 0) else 0 end) as dj_cost_amount,
+        sum(case t3.movie_type when 'MJ' then ifnull(cost_amount, 0) else 0 end) as mj_cost_amount,
+        sum(real_cost_amount) as real_cost_amount,
+        sum(case t3.movie_type when 'DJ' then ifnull(real_cost_amount, 0) else 0 end) as dj_real_cost_amount,
+        sum(case t3.movie_type when 'MJ' then ifnull(real_cost_amount, 0) else 0 end) as mj_real_cost_amount,
+            max(t1.update_time) as update_time
+        from application.media_ad_report_daily t1
+        left join tidb.deepthink.mini_app_info t2 on t1.ma_appid = t2.app_id
+        left join tidb.deepthink.all_moive t3 on t1.movie_id = t3.moive_id and find_in_set(t3.movie_source, t2.movie_sources) > 0
         where stat_date = #{date}
         ) tb1,
-        (select sum(pay_amount) as pay_amount, sum(iaa_amount) as iaa_amount,
-        sum(share_iaa_amount) as share_iaa_amount, sum(share_pay_amount) as share_pay_amount,
-        sum(share_iaa_amount_3) as share_iaa_amount_3
-        from application.user_data_report_daily
+        (select sum(pay_amount) as pay_amount,
+        sum(case t3.movie_type when 'DJ' then ifnull(pay_amount, 0) else 0 end) as dj_pay_amount,
+        sum(case t3.movie_type when 'MJ' then ifnull(pay_amount, 0) else 0 end) as mj_pay_amount,
+        sum(share_iaa_amount) as share_iaa_amount,
+        sum(case t3.movie_type when 'DJ' then ifnull(share_iaa_amount, 0) else 0 end) as dj_share_iaa_amount,
+        sum(case t3.movie_type when 'MJ' then ifnull(share_iaa_amount, 0) else 0 end) as mj_share_iaa_amount,
+        sum(share_iaa_amount_3) as share_iaa_amount_3,
+        sum(case t3.movie_type when 'DJ' then ifnull(share_iaa_amount_3, 0) else 0 end) as dj_share_iaa_amount_3,
+        sum(case t3.movie_type when 'MJ' then ifnull(share_iaa_amount_3, 0) else 0 end) as mj_share_iaa_amount_3,
+        sum(share_pay_amount) as share_pay_amount,
+        sum(case t3.movie_type when 'DJ' then ifnull(share_pay_amount, 0) else 0 end) as dj_share_pay_amount,
+        sum(case t3.movie_type when 'MJ' then ifnull(share_pay_amount, 0) else 0 end) as mj_share_pay_amount,
+        sum(iaa_amount) as iaa_amount,
+        sum(case t3.movie_type when 'DJ' then ifnull(iaa_amount, 0) else 0 end) as dj_iaa_amount,
+        sum(case t3.movie_type when 'MJ' then ifnull(iaa_amount, 0) else 0 end) as mj_iaa_amount, max(update_at) as update_at
+        from application.user_data_report_daily t1
+        left join tidb.deepthink.mini_app_info t2 on t1.ma_appid = t2.app_id
+        left join tidb.deepthink.all_moive t3 on t1.movie_id = t3.moive_id and find_in_set(t3.movie_source, t2.movie_sources) > 0
         where stat_date = #{date}
+        and t2.business_line in (1,6,7,4,8,9,10)
         ) tb2
     </select>
     <select id="allBusinessTopMovie" resultType="java.util.Map">
-        select tb4.ly_movie_name as movie_name, tb4.movie_project_source, tb5.dict_name as movie_project_source_name,
+        select tb4.ly_movie_name as movie_name, tb4.movie_project_source, tb5.dict_name as movie_project_source_name, tb4.movie_type,
         group_concat(distinct case tb4.movie_source when 2 then '2' else '1' end) as movie_source,
         rank() over (order by sum(share_iaa_amount)+sum(share_pay_amount) desc) as rk,
         <include refid="endAmount"/>,
@@ -583,13 +771,13 @@
         group by movie_id
         ) tb3 on tb1.movie_id=tb3.movie_id
         left join
-        (select moive_id, standard_movie_id, standard_movie_name, movie_source, movie_project_source, ly_movie_name from tidb.deepthink.all_moive
+        (select moive_id, standard_movie_id, standard_movie_name, movie_source, movie_type, movie_project_source, ly_movie_name from tidb.deepthink.all_moive
         ) tb4 on tb1.movie_id=tb4.moive_id
         left join
         (select dict_key, dict_name from tidb.deepthink.dt_dictionary where select_key='movie_project_source'
         ) tb5 on tb4.movie_project_source=tb5.dict_key
         where 1=1 and tb1.movie_id!='-9999'
-        group by tb4.ly_movie_name, tb4.movie_project_source, tb5.dict_name
+        group by tb4.ly_movie_name, tb4.movie_project_source, tb5.dict_name, tb4.movie_type
         order by sum(share_iaa_amount)+sum(share_pay_amount) desc
         limit 20
     </select>

+ 6 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/ICutGroupRankPushService.java

@@ -1,6 +1,12 @@
 package cn.com.ctop.job.bytedance.data.service;
 
+import cn.com.ctop.job.bytedance.data.entity.FeishuSendObject;
+
+import java.util.List;
+
 public interface ICutGroupRankPushService
 {
     void send();
+
+    void send(List<FeishuSendObject> sendObjects);
 }

+ 11 - 1
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/IDateReportsPushService.java

@@ -1,12 +1,22 @@
 package cn.com.ctop.job.bytedance.data.service;
 
+import cn.com.ctop.job.bytedance.data.entity.FeishuSendObject;
+
+import java.util.List;
+
 public interface IDateReportsPushService {
     void send();
 
+    void send(List<FeishuSendObject> sendObjects);
+
     /**
      * 零点15执行的 比上一天多了个描述
      */
     void preSend();
 
-    public void send12hour();
+    void preSend(List<FeishuSendObject> sendObjects);
+
+    void send12hour();
+
+    void send12hour(List<FeishuSendObject> sendObjects);
 }

+ 5 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/IFeishuService.java

@@ -1,8 +1,13 @@
 package cn.com.ctop.job.bytedance.data.service;
 
+import cn.com.ctop.job.bytedance.data.entity.FeishuSendObject;
+
 import java.io.IOException;
+import java.util.List;
 
 public interface IFeishuService {
 
     void uploadAvatar() throws IOException;
+
+    List<FeishuSendObject> getFeishuSendObjectList(String jobName);
 }

+ 6 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/IMovieRankPushService.java

@@ -1,9 +1,15 @@
 package cn.com.ctop.job.bytedance.data.service;
 
+import cn.com.ctop.job.bytedance.data.entity.FeishuSendObject;
+
+import java.util.List;
+
 public interface IMovieRankPushService {
 
 
     void send();
 
+    void send(List<FeishuSendObject> sendObjects);
+
     void test();
 }

+ 6 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/IReportsAdPushService.java

@@ -1,8 +1,14 @@
 package cn.com.ctop.job.bytedance.data.service;
 
+import cn.com.ctop.job.bytedance.data.entity.FeishuSendObject;
+
+import java.util.List;
+
 public interface IReportsAdPushService {
 
     void send();
 
+    void send(List<FeishuSendObject> sendObjects);
+
     void test();
 }

+ 6 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/IReportsByBusinessPushService.java

@@ -1,9 +1,15 @@
 package cn.com.ctop.job.bytedance.data.service;
 
+import cn.com.ctop.job.bytedance.data.entity.FeishuSendObject;
+
+import java.util.List;
+
 public interface IReportsByBusinessPushService {
 
     void send();
 
+    void send(List<FeishuSendObject> sendObjects);
+
     void preSend();
     void test();
 }

+ 6 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/ITotalRankPushService.java

@@ -1,7 +1,13 @@
 package cn.com.ctop.job.bytedance.data.service;
 
+import cn.com.ctop.job.bytedance.data.entity.FeishuSendObject;
+
+import java.util.List;
+
 public interface ITotalRankPushService {
     void send();
 
+    void send(List<FeishuSendObject> sendObjects);
+
     void test();
 }

+ 24 - 13
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/BytedanceProductUpdateServiceImpl.java

@@ -261,9 +261,14 @@ public class BytedanceProductUpdateServiceImpl implements IBytedanceProductUpdat
             if (toUpload.isEmpty()){
                 continue;
             }
+
+
+
             //获取未上传剧目的推广链接
-            List<AigcProductAlbum> douyinUploadList = toUpload.stream().filter(o -> Objects.equals(o.getPlatformType(), "1")).collect(Collectors.toList());
-            Map<String, String> albumIdToLinkMap = getBytedancePlayletPromoteLink(platform.getMiniAppAdvertiserId(), platform.getAccessToken(), platform.getMiniInstanceId(), douyinUploadList, errors, platform.getPlatformId(), platform.getDevAppId());
+//            List<AigcProductAlbum> douyinUploadList = toUpload.stream().filter(o -> Objects.equals(o.getPlatformType(), "1")).collect(Collectors.toList());
+//            Map<String, String> albumIdToLinkMap = getBytedancePlayletPromoteLink(platform.getMiniAppAdvertiserId(), platform.getAccessToken(), platform.getMiniInstanceId(), douyinUploadList, errors, platform.getPlatformId(), platform.getDevAppId());
+
+
             //未上传剧目:对比平台类型;确定商品分类;获取推广链接
             for (AigcProductAlbum album : toUpload){
                 if (!Objects.equals(album.getPlatformType(), String.valueOf(platform.getPlatformType()))){
@@ -276,13 +281,13 @@ public class BytedanceProductUpdateServiceImpl implements IBytedanceProductUpdat
                 }
                 String schemaLink = null;
                 if (platform.getIsBytedance()==1){
-                    if (!albumIdToLinkMap.containsKey(album.getAlbumId())){
-                        System.out.println(">>>>没有找到对应的推广链接,无法上传商品,剧目ID:" + album.getAlbumId() + ", 剧目名称:" + album.getName());
-                        System.out.println("\n\n\n");
-                        continue;
-                    }else {
-                        schemaLink = albumIdToLinkMap.get(album.getAlbumId());
-                    }
+//                    if (!albumIdToLinkMap.containsKey(album.getAlbumId())){
+//                        System.out.println(">>>>没有找到对应的推广链接,无法上传商品,剧目ID:" + album.getAlbumId() + ", 剧目名称:" + album.getName());
+//                        System.out.println("\n\n\n");
+//                        continue;
+//                    }else {
+//                        schemaLink = albumIdToLinkMap.get(album.getAlbumId());
+//                    }
                 }
                 uploadProduct(platform, album, schemaLink, errors, productTypeMap.get(album.getTheme()), businessType);
             }
@@ -452,7 +457,8 @@ public class BytedanceProductUpdateServiceImpl implements IBytedanceProductUpdat
 //        uploadAlbum(31084L, 1742489802322972L, "d22b45ce9033303d22c5f34abcd4600811b18d88");
 //        uploadAlbum();
 //        Thread.sleep(1000);
-        refreshAlbumStatus();
+        runMp();
+//        refreshAlbumStatus();
 //        List<String> errors = new ArrayList<>();
 //        iapProductUpdate(errors);
 //        System.out.println(errors);
@@ -581,9 +587,14 @@ public class BytedanceProductUpdateServiceImpl implements IBytedanceProductUpdat
         if (platform.getIsDys() == 1){
             ad_carrier.add("端原生组件");
         }
-        if (platform.getIsBytedance() == 1){
-            profession.put("micro_app_link", schemaLink);
-        }else if (platform.getIsWechat() == 1){
+//        if (platform.getIsBytedance() == 1){
+//            profession.put("micro_app_link", schemaLink);
+//        }else if (platform.getIsWechat() == 1){
+//            profession.put("album_id", album_id);
+//        }else if (platform.getIsDys() == 1){
+//            profession.put("album_link", album.getAlbumLink());
+//        }
+        if (platform.getIsBytedance() == 1 || platform.getIsWechat() == 1){
             profession.put("album_id", album_id);
         }else if (platform.getIsDys() == 1){
             profession.put("album_link", album.getAlbumLink());

+ 10 - 3
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/CutGroupRankPushServiceImpl.java

@@ -1,8 +1,10 @@
 package cn.com.ctop.job.bytedance.data.service.impl;
 
+import cn.com.ctop.job.bytedance.data.entity.FeishuSendObject;
 import cn.com.ctop.job.bytedance.data.mapper.ReportsAdPushMapper;
 import cn.com.ctop.job.bytedance.data.service.ICutGroupRankPushService;
 import cn.com.ctop.job.bytedance.data.utils.DateUtils;
+import cn.com.ctop.job.bytedance.data.utils.FeishuSendObjectUtils;
 import cn.com.ctop.job.bytedance.utils.FeishuRobotUtil;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -40,14 +42,14 @@ public class CutGroupRankPushServiceImpl implements ICutGroupRankPushService {
         List<String> userIds = Arrays.asList(
                 "HR-00446"
                 ,"HR-00421" //yuyang
-                ,"HR-00433"  //xsq
                 ,"HR-00447" //yumeng
 //                ,"aca3ef75" //renyupeng
-                ,"HR-00420" //wangshu
                 ,"HR-00628"//xuweiwei
-                ,"HR-00574" //hemenghao
                 ,"HR-00617" //louzijun
                 ,"HR-00693" //maxiaodong
+                ,"HR-00713" //吴祚森
+                ,"HR-00704" //段鹏举
+                ,"HR-00642" //孟阳
         );
 
         List<String> chatids = Arrays.asList(
@@ -55,6 +57,11 @@ public class CutGroupRankPushServiceImpl implements ICutGroupRankPushService {
         send(userIds, chatids);
     }
 
+    @Override
+    public void send(List<FeishuSendObject> sendObjects) {
+        send(FeishuSendObjectUtils.userIds(sendObjects), FeishuSendObjectUtils.chatIds(sendObjects));
+    }
+
     /**
      *
      * @param userIds 单聊用户列表

+ 37 - 9
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/DateReportsPushServiceImpl.java

@@ -1,9 +1,11 @@
 package cn.com.ctop.job.bytedance.data.service.impl;
 
+import cn.com.ctop.job.bytedance.data.entity.FeishuSendObject;
 import cn.com.ctop.job.bytedance.data.mapper.ReportsAdPushMapper;
 import cn.com.ctop.job.bytedance.data.service.IDateReportsPushService;
 import cn.com.ctop.job.bytedance.data.utils.Check;
 import cn.com.ctop.job.bytedance.data.utils.DateUtils;
+import cn.com.ctop.job.bytedance.data.utils.FeishuSendObjectUtils;
 import cn.com.ctop.job.bytedance.utils.FeishuRobotUtil;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -24,6 +26,7 @@ import java.io.IOException;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.stream.Collectors;
 
 @Service
@@ -58,6 +61,11 @@ public class DateReportsPushServiceImpl implements IDateReportsPushService {
         sendParam("", userIds, chatid);
     }
 
+    @Override
+    public void send(List<FeishuSendObject> sendObjects) {
+        sendParam("", FeishuSendObjectUtils.userIds(sendObjects), FeishuSendObjectUtils.chatIds(sendObjects));
+    }
+
     /**
      * 12点推送
      */
@@ -78,6 +86,12 @@ public class DateReportsPushServiceImpl implements IDateReportsPushService {
         sendParam("注:当天ROI数据有微小1%-2%差异,以次日10点推送为准,番茄ROI数据需要次日9点左右获取;暂不包含广点通数据", userIds, chatid);
     }
 
+    @Override
+    public void send12hour(List<FeishuSendObject> sendObjects){
+        sendParam("注:当天ROI数据有微小1%-2%差异,以次日10点推送为准,番茄ROI数据需要次日9点左右获取;暂不包含广点通数据",
+                FeishuSendObjectUtils.userIds(sendObjects), FeishuSendObjectUtils.chatIds(sendObjects));
+    }
+
     /**
      * 9点预推送给开发人员
      */
@@ -95,6 +109,11 @@ public class DateReportsPushServiceImpl implements IDateReportsPushService {
         sendParam("", userIds, chatid);
     }
 
+    @Override
+    public void preSend(List<FeishuSendObject> sendObjects) {
+        sendParam("", FeishuSendObjectUtils.userIds(sendObjects), FeishuSendObjectUtils.chatIds(sendObjects));
+    }
+
 
     private void sendParam(String description, List<String> userIds, List<String> chatid){
         String token;
@@ -116,23 +135,24 @@ public class DateReportsPushServiceImpl implements IDateReportsPushService {
         String updateTime = reportsPushMapper.updateTime(todayLong);
         List<Pair<String, String>> columns = Arrays.asList(
                 new Pair<>("cost_amount", "消耗金额"),
-                new Pair<>("real_cost_amount", "折后消耗"),
+                new Pair<>("dj_cost_amount", "  真人剧"),
+                new Pair<>("mj_cost_amount", "  漫剧"),
                 new Pair<>("end_amount", "结算金额"),
-                new Pair<>("pay_amount", "充值金额"),
-                new Pair<>("share_iaa_amount", "广告预估收入"),
-//                new Pair<>("water_roi", "流水ROI"),
+                new Pair<>("dj_end_amount", "  真人剧"),
+                new Pair<>("mj_end_amount", "  漫剧"),
                 new Pair<>("real_roi", "投流真实ROI"),
-//                new Pair<>("water_profit", "流水利润"),
-                new Pair<>("real_profit", "真实利润")
-//                new Pair<>("iaa_roi", "广告-ROI"),
-//                new Pair<>("iap_roi", "付费-ROI")
+                new Pair<>("dj_real_roi", "  真人剧"),
+                new Pair<>("mj_real_roi", "  漫剧"),
+                new Pair<>("real_profit", "真实利润"),
+                new Pair<>("dj_real_profit", "  真人剧"),
+                new Pair<>("mj_real_profit", "  漫剧")
         );
         JSONArray dateIndicatorTable = new JSONArray();
         for (Pair<String, String> column : columns) {
             String key = column.getKey();
             String name = column.getValue();
             JSONObject obj = new JSONObject();
-            if (!name.contains("ROI")){
+            if (!key.toLowerCase().contains("roi")){
                 String todayDataValue = String.valueOf(todayData.getOrDefault(key, "0"));
                 String lastDayDataValue = String.valueOf(lastDayData.getOrDefault(key, "0"));
                 obj.put("indicatorName", name);
@@ -187,6 +207,11 @@ public class DateReportsPushServiceImpl implements IDateReportsPushService {
             }else {
                 ms.add(ImmutableMap.of("text", movieProjectSourceName, "color", "blue"));
             }
+            String movieType = String.valueOf(movie.get("movie_type"));
+            if (movieType != null){
+                movieType = Objects.equals(movieType, "MJ") ? "漫剧" : "真人剧";
+                ms.add(ImmutableMap.of("text", movieType, "color", "purple"));
+            }
             obj.put("movieProjectSource", ms);
             obj.put("rank", String.valueOf(movie.get("rk")));
             obj.put("movieName", movieName);
@@ -198,6 +223,9 @@ public class DateReportsPushServiceImpl implements IDateReportsPushService {
         }
 
         List<Map<String, String>> deptData = reportsPushMapper.deptRank2(todayLong);
+        Map<String, String> deptTotalData = reportsPushMapper.deptRankTotal(todayLong);
+        deptData.add(0, deptTotalData);
+
         JSONArray deptRank = new JSONArray();
         for (Map<String, String> dept : deptData){
             JSONObject obj = new JSONObject();

+ 44 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/FeishuServiceImpl.java

@@ -1,5 +1,6 @@
 package cn.com.ctop.job.bytedance.data.service.impl;
 
+import cn.com.ctop.job.bytedance.data.entity.FeishuSendObject;
 import cn.com.ctop.job.bytedance.data.mapper.FeishuMapper;
 import cn.com.ctop.job.bytedance.data.service.IFeishuService;
 import cn.com.ctop.job.bytedance.utils.FeishuRobotUtil;
@@ -11,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
@@ -73,7 +75,49 @@ public class FeishuServiceImpl implements IFeishuService {
 
     }
 
+    @Override
+    public List<FeishuSendObject> getFeishuSendObjectList(String jobName) {
+        List<FeishuSendObject> result = new ArrayList<>();
+        if (jobName == null || jobName.isEmpty()) {
+            log.warn("获取飞书发送对象失败, jobName为空");
+            return result;
+        }
+
+        List<FeishuSendObject> userSendObjects = feishuMapper.getFeishuUserSendObjectList(jobName);
+        if (userSendObjects != null && !userSendObjects.isEmpty()) {
+            List<String> mobiles = userSendObjects.stream()
+                    .map(FeishuSendObject::getPhonenumber)
+                    .filter(Objects::nonNull)
+                    .distinct()
+                    .collect(Collectors.toList());
+            try {
+                Map<String, String> mobileUserIdMap = FeishuRobotUtil.getFsUserIds(FeishuRobotUtil.getFsZtTenantToken(), mobiles);
+                if (mobileUserIdMap != null) {
+                    for (FeishuSendObject sendObject : userSendObjects) {
+                        String fsUserId = mobileUserIdMap.get(sendObject.getPhonenumber());
+                        if (fsUserId == null || fsUserId.isEmpty()) {
+                            log.warn("未找到飞书用户ID, jobName: {}, phone: {}, nickname: {}", jobName, sendObject.getPhonenumber(), sendObject.getNickname());
+                            continue;
+                        }
+                        sendObject.setSendType(FeishuSendObject.SendType.USER);
+                        sendObject.setFsUserId(fsUserId);
+                        result.add(sendObject);
+                    }
+                }
+            } catch (IOException e) {
+                log.error("获取飞书用户ID失败, jobName: {}", jobName, e);
+            }
+        }
 
+        List<FeishuSendObject> chatGroupSendObjects = feishuMapper.getFeishuChatGroupSendObjectList(jobName);
+        if (chatGroupSendObjects != null) {
+            for (FeishuSendObject sendObject : chatGroupSendObjects) {
+                sendObject.setSendType(FeishuSendObject.SendType.CHAT_GROUP);
+                result.add(sendObject);
+            }
+        }
+        return result;
+    }
 
 
     private String uploadToOss(String url, String fileName){

+ 48 - 10
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/MovieRankPushServiceImpl.java

@@ -1,9 +1,11 @@
 package cn.com.ctop.job.bytedance.data.service.impl;
 
+import cn.com.ctop.job.bytedance.data.entity.FeishuSendObject;
 import cn.com.ctop.job.bytedance.data.mapper.ReportsAdPushMapper;
 import cn.com.ctop.job.bytedance.data.service.IMovieRankPushService;
 import cn.com.ctop.job.bytedance.data.utils.Check;
 import cn.com.ctop.job.bytedance.data.utils.DateUtils;
+import cn.com.ctop.job.bytedance.data.utils.FeishuSendObjectUtils;
 import cn.com.ctop.job.bytedance.utils.FeishuRobotUtil;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -19,10 +21,7 @@ import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 
 @Service
@@ -32,21 +31,20 @@ public class MovieRankPushServiceImpl implements IMovieRankPushService {
     ReportsAdPushMapper reportsAdPushMapper;
 
     public static final String TEMPLATE_ID = "AAqhiuoh0Nohp";
-    public static final String TEMPLATE_VERSION = "1.0.17";
+    public static final String TEMPLATE_VERSION = "1.0.19";
 
     @Override
     public void send() {
         List<String> userIds = Arrays.asList(
                 "HR-00446"
                 , "HR-00447" //yumeng
-                , "HR-00420" //wangshu
                 , "HR-00421" //yuyang
-                , "HR-00433"  //xsq
                 , "HR-00372" //chenglitong
-                , "HR-00472" //anjuejia
                 , "HR-00628" //xuweiwei
-                , "HR-00419" //zhangxiaofeng
                 , "HR-00693" //maxiaodong
+                ,"HR-00713" //吴祚森
+                ,"HR-00704" //段鹏举
+                ,"HR-00642" //孟阳
         );
         List<String> chatIds = Arrays.asList(
 
@@ -55,6 +53,11 @@ public class MovieRankPushServiceImpl implements IMovieRankPushService {
     }
 
     @Override
+    public void send(List<FeishuSendObject> sendObjects) {
+        send(FeishuSendObjectUtils.userIds(sendObjects), FeishuSendObjectUtils.chatIds(sendObjects), true);
+    }
+
+    @Override
     public void test() {
         send(Arrays.asList("HR-00446"), Arrays.asList(), false);
     }
@@ -102,8 +105,13 @@ public class MovieRankPushServiceImpl implements IMovieRankPushService {
                 obj.put("iapCostAmount", m.getString("iap_cost_amount"));
                 String movieProjectSource = String.valueOf(m.get("movie_project_source_name"));
                 String projectAdStep = m.getString("project_ad_step");
+                String movieType = m.getString("movie_type");
+                if (movieType != null){
+                    movieType = Objects.equals(movieType, "MJ") ? "漫剧" : "短剧";
+                }
                 String sb = "<text_tag color='blue'>" + movieProjectSource + "</text_tag>" +
-                        "<text_tag color='green'>" + projectAdStep + "</text_tag>";
+                        "<text_tag color='green'>" + projectAdStep + "</text_tag>"
+                        + "<text_tag color='purple'>" + movieType + "</text_tag>";
                 obj.put("movieProjectSource", sb);
                 object_list.add(obj);
             }
@@ -130,6 +138,10 @@ public class MovieRankPushServiceImpl implements IMovieRankPushService {
                 sendToFeishu(token, template_variables, userId);
             }
 
+            for (String chatId : chatIds) {
+                sendToChatGroup(token, template_variables, chatId);
+            }
+
             //给所有优化师发
             if (sendToOptimizers){
                 for (String userId : mobileMap.values()) {
@@ -199,4 +211,30 @@ public class MovieRankPushServiceImpl implements IMovieRankPushService {
             log.error("发送飞书消息失败", e);
         }
     }
+
+    private void sendToChatGroup(String token, JSONObject template_variable, String chatId) {
+        JSONObject content = new JSONObject();
+        JSONObject contentData = new JSONObject();
+        contentData.put("template_id", TEMPLATE_ID);
+        contentData.put("template_version_name", TEMPLATE_VERSION);
+        contentData.put("template_variable", template_variable);
+        content.put("type", "template");
+        content.put("data", contentData);
+
+        JSONObject request = new JSONObject();
+        request.put("receive_id", chatId);
+        request.put("msg_type", "interactive");
+        request.put("content", content.toJSONString());
+        try (CloseableHttpClient client = HttpClients.createDefault()) {
+            HttpPost httpPost = new HttpPost("https://open.feishu.cn/open-apis/im/v1/messages?receive_id_type=chat_id");
+            httpPost.setHeader("Authorization", "Bearer " + token);
+            HttpEntity entity = new StringEntity(request.toJSONString(), "UTF-8");
+            httpPost.setEntity(entity);
+            httpPost.setHeader("Content-Type", "application/json; charset=utf-8");
+            CloseableHttpResponse respon = client.execute(httpPost);
+            log.info("剧单群聊发送结果:{}", EntityUtils.toString(respon.getEntity(), "UTF-8"));
+        } catch (IOException e) {
+            log.error("发送飞书消息失败", e);
+        }
+    }
 }

+ 1 - 1
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/OptimizerRankPushServiceImpl.java

@@ -76,7 +76,7 @@ public class OptimizerRankPushServiceImpl implements IOptimizerRankPushService {
 
         for (Map<String, String> optToday : todayData){
             String deptId = String.valueOf(optToday.get("dept_id"));
-            if (deptId.equals("30201")){
+            if (deptId.equals("300")){
                 continue;
             }
 

+ 66 - 16
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/ReportsAdPushServiceImpl.java

@@ -1,9 +1,10 @@
 package cn.com.ctop.job.bytedance.data.service.impl;
 
+import cn.com.ctop.job.bytedance.data.entity.FeishuSendObject;
 import cn.com.ctop.job.bytedance.data.mapper.ReportsAdPushMapper;
 import cn.com.ctop.job.bytedance.data.service.IReportsAdPushService;
-import cn.com.ctop.job.bytedance.data.utils.Check;
 import cn.com.ctop.job.bytedance.data.utils.DateUtils;
+import cn.com.ctop.job.bytedance.data.utils.FeishuSendObjectUtils;
 import cn.com.ctop.job.bytedance.utils.FeishuRobotUtil;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -32,7 +33,7 @@ public class ReportsAdPushServiceImpl implements IReportsAdPushService {
     public static final String APP_KEY = "OUlg7WTa6UWZItfTmJw2JdQvhVI4VcRj";
 
     public static final String TEMPLATE_ID = "AAqBGlVblKabY";
-    public static final String TEMPLATE_VERSION = "1.0.24";
+    public static final String TEMPLATE_VERSION = "1.0.27";
     @Autowired
     ReportsAdPushMapper reportsPushMapper;
 
@@ -40,21 +41,20 @@ public class ReportsAdPushServiceImpl implements IReportsAdPushService {
     public void send(){
         List<String> userIds = Arrays.asList(
                 "HR-00446" //zhaotx
-//                ,"aca3ef75" //renyupeng
+                ,"aca3ef75" //renyupeng
                 ,"HR-00447" //yumeng
-                ,"HR-00420" //wangshu
                 ,"HR-00200" //zhaozhicheng
                 ,"HR-00421" //yuyang
-                ,"HR-00574" //hemenghao
                 ,"HR-00617" //louzijun
-                ,"HR-00433"  //xsq
                 ,"HR-00459"  //angaoqi
-                ,"HR-00576" //yangcheng
                 ,"HR-00213" //qianjiayi
                 ,"HR-00372" //chenglitong
                 ,"HR-00693" //maxiaodong
+                ,"HR-00713" //吴祚森
+                ,"HR-00704" //段鹏举
+                ,"HR-00642" //孟阳
         );
-        send(userIds);
+        sendToUserIds(userIds);
     }
 
     @Override
@@ -66,11 +66,20 @@ public class ReportsAdPushServiceImpl implements IReportsAdPushService {
 //                ,"HR-00459" //angaoqi
 //                ,"HR-00439" //huangpingkang
         );
-        send(userIds);
+        sendToUserIds(userIds);
     }
 
 
-    public void send(List<String> userIds) {
+    @Override
+    public void send(List<FeishuSendObject> sendObjects) {
+        send(FeishuSendObjectUtils.userIds(sendObjects), FeishuSendObjectUtils.chatIds(sendObjects));
+    }
+
+    private void sendToUserIds(List<String> userIds) {
+        send(userIds, Arrays.asList());
+    }
+
+    private void send(List<String> userIds, List<String> chatIds) {
         String today = DateUtils.getNowDate("yyyy-MM-dd");
         Long todayLong = Long.parseLong(today.replaceAll("-", ""));
         int hour = Integer.parseInt(DateUtils.getNowDate("H"));
@@ -93,14 +102,26 @@ public class ReportsAdPushServiceImpl implements IReportsAdPushService {
 
         List<Pair<String, String>> columns = Arrays.asList(
                 new Pair<>("cost_amount", "消耗金额"),
-                new Pair<>("real_cost_amount", "折后消耗"),
+                new Pair<>("dj_cost_amount", "真人剧"),
+                new Pair<>("mj_cost_amount", "漫剧"),
+//                new Pair<>("real_cost_amount", "折后消耗"),
+//                new Pair<>("dj_real_cost_amount", "  真人剧折后消耗"),
+//                new Pair<>("mj_real_cost_amount", "  漫剧折后消耗"),
                 new Pair<>("end_amount", "结算金额"),
-                new Pair<>("pay_amount", "充值金额"),
-                new Pair<>("share_iaa_amount", "广告预估收入"),
-//                new Pair<>("water_roi", "流水ROI"),
+                new Pair<>("dj_end_amount", "  真人剧"),
+                new Pair<>("mj_end_amount", "  漫剧"),
+//                new Pair<>("pay_amount", "充值金额"),
+//                new Pair<>("dj_pay_amount", "  真人剧充值金额"),
+//                new Pair<>("mj_pay_amount", "  漫剧充值金额"),
+//                new Pair<>("share_iaa_amount", "广告预估收入"),
+//                new Pair<>("dj_share_iaa_amount", "  真人剧广告预估收入"),
+//                new Pair<>("mj_share_iaa_amount", "  漫剧广告预估收入"),
                 new Pair<>("real_roi", "投流真实ROI"),
-//                new Pair<>("water_profit", "流水利润"),
-                new Pair<>("real_profit", "真实利润")
+                new Pair<>("dj_real_roi", "  真人剧"),
+                new Pair<>("mj_real_roi", "  漫剧"),
+                new Pair<>("real_profit", "真实利润"),
+                new Pair<>("dj_real_profit", "  真人剧"),
+                new Pair<>("mj_real_profit", "  漫剧")
         );
 
         JSONArray object_list_1 = new JSONArray();
@@ -174,6 +195,9 @@ public class ReportsAdPushServiceImpl implements IReportsAdPushService {
         for (String userId : userIds){
             sendToFeishu(token, template_variables, userId);
         }
+        for (String chatId : chatIds){
+            sendToChatGroup(token, template_variables, chatId);
+        }
     }
 
     private void sendToFeishu(String token, JSONObject template_variable, String receive_id) {
@@ -202,4 +226,30 @@ public class ReportsAdPushServiceImpl implements IReportsAdPushService {
             log.error("发送飞书消息失败", e);
         }
     }
+
+    private void sendToChatGroup(String token, JSONObject template_variable, String chatId) {
+        JSONObject content = new JSONObject();
+        JSONObject contentData = new JSONObject();
+        contentData.put("template_id",TEMPLATE_ID);
+        contentData.put("template_version_name", TEMPLATE_VERSION);
+        contentData.put("template_variable", template_variable);
+        content.put("type", "template");
+        content.put("data", contentData);
+
+        JSONObject request = new JSONObject();
+        request.put("receive_id", chatId);
+        request.put("msg_type", "interactive");
+        request.put("content", content.toJSONString());
+        try (CloseableHttpClient client = HttpClients.createDefault()){
+            HttpPost httpPost = new HttpPost("https://open.feishu.cn/open-apis/im/v1/messages?receive_id_type=chat_id");
+            httpPost.setHeader("Authorization", "Bearer "+token);
+            HttpEntity entity = new StringEntity(request.toJSONString(), "UTF-8");
+            httpPost.setEntity(entity);
+            httpPost.setHeader("Content-Type", "application/json; charset=utf-8");
+            CloseableHttpResponse respon = client.execute(httpPost);
+            System.out.println("发送结果: "+ EntityUtils.toString(respon.getEntity(), "UTF-8"));
+        }catch (IOException e){
+            log.error("发送飞书消息失败", e);
+        }
+    }
 }

+ 23 - 18
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/ReportsByBusinessPushServiceImpl.java

@@ -1,9 +1,11 @@
 package cn.com.ctop.job.bytedance.data.service.impl;
 
+import cn.com.ctop.job.bytedance.data.entity.FeishuSendObject;
 import cn.com.ctop.job.bytedance.data.mapper.ReportsAdPushMapper;
 import cn.com.ctop.job.bytedance.data.service.IReportsByBusinessPushService;
 import cn.com.ctop.job.bytedance.data.utils.Check;
 import cn.com.ctop.job.bytedance.data.utils.DateUtils;
+import cn.com.ctop.job.bytedance.data.utils.FeishuSendObjectUtils;
 import cn.com.ctop.job.bytedance.utils.FeishuRobotUtil;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -21,10 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.io.IOException;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 @Service
 @Slf4j
@@ -54,6 +53,11 @@ public class ReportsByBusinessPushServiceImpl implements IReportsByBusinessPushS
         sendParam("", userIds, chatid);
     }
 
+    @Override
+    public void send(List<FeishuSendObject> sendObjects) {
+        sendParam("", FeishuSendObjectUtils.userIds(sendObjects), FeishuSendObjectUtils.chatIds(sendObjects));
+    }
+
     /**
      * 9点预推送给开发人员
      */
@@ -104,16 +108,15 @@ public class ReportsByBusinessPushServiceImpl implements IReportsByBusinessPushS
 
         String updateTime = String.valueOf(todayData.get("update_time"));
         List<Pair<String, String>> columns = Arrays.asList(
-//                new Pair<>("cost_amount", "消耗金额"),
-//                new Pair<>("real_cost_amount", "折后消耗"),
                 new Pair<>("water_end_amount", "流水总收入"),
+                new Pair<>("dj_water_end_amount", "  真人剧"),
+                new Pair<>("mj_water_end_amount", "  漫剧"),
                 new Pair<>("end_amount", "结算总收入"),
-//                new Pair<>("pay_amount", "充值金额"),
-//                new Pair<>("iaa_amount", "广告预估收入"),
-//                new Pair<>("water_roi", "流水ROI"),
-//                new Pair<>("real_roi", "真实ROI"),
-//                new Pair<>("water_profit", "流水利润"),
-                new Pair<>("real_profit", "真实利润")
+                new Pair<>("dj_end_amount", "  真人剧"),
+                new Pair<>("mj_end_amount", "  漫剧"),
+                new Pair<>("real_profit", "真实利润"),
+                new Pair<>("dj_real_profit", "  真人剧"),
+                new Pair<>("mj_real_profit", "  漫剧")
         );
         JSONArray dateIndicatorTable = new JSONArray();
         for (Pair<String, String> column : columns) {
@@ -157,13 +160,7 @@ public class ReportsByBusinessPushServiceImpl implements IReportsByBusinessPushS
         JSONArray movieRankTable = new JSONArray();
         for (Map<String, String> movie : movieData){
             JSONObject obj = new JSONObject();
-//            String movieSource = String.valueOf(movie.get("movie_source"));
             String movieName = String.valueOf(movie.get("movie_name"));
-//            if (!Check.isNull(movieSource) && movieSource.contains("1")){
-//                obj.put("movieNameColor", "blue");
-//            }else {
-//                obj.put("movieNameColor", "grey");
-//            }
             String movieProjectSource = String.valueOf(movie.get("movie_project_source"));
             String movieProjectSourceName = String.valueOf(movie.get("movie_project_source_name"));
             JSONArray ms = new JSONArray();
@@ -174,6 +171,11 @@ public class ReportsByBusinessPushServiceImpl implements IReportsByBusinessPushS
             }else {
                 ms.add(ImmutableMap.of("text", movieProjectSourceName, "color", "blue"));
             }
+            String movieType = String.valueOf(movie.get("movie_type"));
+            if (movieType != null){
+                movieType = Objects.equals(movieType, "MJ") ? "漫剧" : "真人剧";
+                ms.add(ImmutableMap.of("text", movieType, "color", "purple"));
+            }
             obj.put("movieProjectSource", ms);
             obj.put("rank", String.valueOf(movie.get("rk")));
             obj.put("movieName", movieName);
@@ -183,6 +185,9 @@ public class ReportsByBusinessPushServiceImpl implements IReportsByBusinessPushS
         }
 
         List<Map<String, String>> deptData = reportsPushMapper.deptRank2(todayLong);
+        Map<String, String> deptTotalData = reportsPushMapper.deptRankTotal(todayLong);
+        deptData.add(0, deptTotalData);
+
         JSONArray deptRank = new JSONArray();
         for (Map<String, String> dept : deptData){
             JSONObject obj = new JSONObject();

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 73 - 40
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/TotalRankPushServiceImpl.java


+ 38 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/utils/FeishuSendObjectUtils.java

@@ -0,0 +1,38 @@
+package cn.com.ctop.job.bytedance.data.utils;
+
+import cn.com.ctop.job.bytedance.data.entity.FeishuSendObject;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+public class FeishuSendObjectUtils {
+
+    private FeishuSendObjectUtils() {
+    }
+
+    public static List<String> userIds(List<FeishuSendObject> sendObjects) {
+        if (sendObjects == null || sendObjects.isEmpty()) {
+            return Collections.emptyList();
+        }
+        return sendObjects.stream()
+                .filter(sendObject -> sendObject.getSendType() == FeishuSendObject.SendType.USER)
+                .map(FeishuSendObject::getFsUserId)
+                .filter(Objects::nonNull)
+                .distinct()
+                .collect(Collectors.toList());
+    }
+
+    public static List<String> chatIds(List<FeishuSendObject> sendObjects) {
+        if (sendObjects == null || sendObjects.isEmpty()) {
+            return Collections.emptyList();
+        }
+        return sendObjects.stream()
+                .filter(sendObject -> sendObject.getSendType() == FeishuSendObject.SendType.CHAT_GROUP)
+                .map(FeishuSendObject::getChatGroupId)
+                .filter(Objects::nonNull)
+                .distinct()
+                .collect(Collectors.toList());
+    }
+}

+ 12 - 7
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/FeishuPushJob.java

@@ -1,12 +1,13 @@
 package cn.com.ctop.job.bytedance.handler;
 
+import cn.com.ctop.job.bytedance.data.entity.FeishuSendObject;
 import cn.com.ctop.job.bytedance.data.service.*;
-import cn.com.ctop.job.bytedance.utils.FeishuRobotUtil;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+import java.util.List;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
@@ -58,7 +59,7 @@ public class FeishuPushJob {
         reportsAdPushExecutor.submit(new Runnable() {
             @Override
             public void run() {
-                reportsAdPushService.send();
+                reportsAdPushService.send(getSendObjects("reportsAdPush"));
             }
         });
 
@@ -83,7 +84,7 @@ public class FeishuPushJob {
         totalRankPushExecutor.submit(new Runnable() {
             @Override
             public void run() {
-                totalRankPushService.send();
+                totalRankPushService.send(getSendObjects("totalRankPush"));
             }
         });
 
@@ -93,12 +94,12 @@ public class FeishuPushJob {
     //短剧业务概况(投放)
     @XxlJob("dateReportsPush")
     public void dateReportsPush() {
-        dateReportsPushService.send();
+        dateReportsPushService.send(getSendObjects("dateReportsPush"));
     }
 
     @XxlJob("reportsByBusinessPush")
     public void reportByBusinessPush() {
-        reportsByBusinessPushService.send();
+        reportsByBusinessPushService.send(getSendObjects("reportsByBusinessPush"));
     }
 
     //短剧业务概况预投放(12点)
@@ -116,7 +117,7 @@ public class FeishuPushJob {
     //剪辑排行榜
     @XxlJob("cutGroupRankPush")
     public void cutGroupRankPush() {
-        cutGroupRankPushService.send();
+        cutGroupRankPushService.send(getSendObjects("cutGroupRankPush"));
     }
 
     @XxlJob("loginRecordPush")
@@ -145,9 +146,13 @@ public class FeishuPushJob {
         movieRankExecutor.submit(new Runnable() {
             @Override
             public void run() {
-                movieRankPushService.send();
+                movieRankPushService.send(getSendObjects("movieTopPush"));
             }
         });
 
     }
+
+    private List<FeishuSendObject> getSendObjects(String jobName) {
+        return feishuService.getFeishuSendObjectList(jobName);
+    }
 }