zhaotx 1 год назад
Родитель
Сommit
4ba12c5964

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

@@ -93,7 +93,7 @@
         ) tb2
     </select>
     <select id="tmpTopMovie" resultType="java.util.Map">
-        select tb4.standard_movie_name as movie_name,
+        select tb4.standard_movie_name as movie_name, tb4.movie_project_source, tb5.dict_name as movie_project_source_name,
         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"/>,
@@ -131,12 +131,15 @@
         group by movie_id
         ) tb3 on tb1.product_id=tb3.movie_id
         left join
-        (select moive_id, standard_movie_id, standard_movie_name, movie_source from tidb.deepthink.all_moive
+        (select moive_id, standard_movie_id, standard_movie_name, movie_source, movie_project_source from tidb.deepthink.all_moive
         ) tb4 on tb1.product_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.product_id!='-9999'
-        group by tb4.standard_movie_name
+        group by tb4.standard_movie_name, tb4.movie_project_source, tb5.dict_name
         order by sum(iaa_amount)+sum(pay_amount) desc
-        limit 10
+        limit 20
     </select>
 
     <select id="adDailyData" resultType="java.util.Map">
@@ -164,7 +167,7 @@
 
     <select id="todayTopMovie" resultType="com.alibaba.fastjson.JSONObject" >
         select
-        tb4.standard_movie_name as movie_name,
+        tb4.standard_movie_name as movie_name, tb4.movie_project_source, tb6.dict_name as movie_project_source_name,
         group_concat(distinct case tb4.movie_source when 2 then '2' else '1' end) as movie_source,
         <include refid="endAmount"/>,
         <include refid="waterEndAmount"/>,
@@ -201,16 +204,19 @@
         group by movie_id
         ) tb3 on tb1.product_id=tb3.movie_id
         left join
-        (select moive_id, standard_movie_id, standard_movie_name, movie_source from tidb.deepthink.all_moive
+        (select moive_id, standard_movie_id, standard_movie_name, movie_source, movie_project_source from tidb.deepthink.all_moive
         ) tb4 on tb1.product_id=tb4.moive_id
         left join
         (select product_id, ifnull(sum(cost_amount), 0) as hour_cost_amount from application.media_product_report_hourly
         where stat_date=${date} and `hour`=${hour}  and ma_appid in (select app_id from tidb.deepthink.mini_app_info where business_type not in (2,4,6))
         group by product_id) tb5 on tb1.product_id=tb5.product_id
+        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.product_id != '-9999'
-        group by tb4.standard_movie_name
+        group by tb4.standard_movie_name, tb4.movie_project_source, tb6.dict_name
         order by end_amount desc
-        limit 10
+        limit 20
     </select>
 
 
@@ -510,7 +516,8 @@
         ) tb2
     </select>
     <select id="allBusinessTopMovie" resultType="java.util.Map">
-        select tb4.standard_movie_name as movie_name, group_concat(distinct case tb4.movie_source when 2 then '2' else '1' end) as movie_source,
+        select tb4.standard_movie_name as movie_name, tb4.movie_project_source, tb5.dict_name as movie_project_source_name,
+        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"/>,
         <include refid="costAmount"/>
@@ -533,12 +540,15 @@
         group by movie_id
         ) tb3 on tb1.product_id=tb3.movie_id
         left join
-        (select moive_id, standard_movie_id, standard_movie_name, movie_source from tidb.deepthink.all_moive
+        (select moive_id, standard_movie_id, standard_movie_name, movie_source, movie_project_source from tidb.deepthink.all_moive
         ) tb4 on tb1.product_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.product_id!='-9999'
-        group by tb4.standard_movie_name
+        group by tb4.standard_movie_name, tb4.movie_project_source, tb5.dict_name
         order by sum(share_iaa_amount)+sum(share_pay_amount) desc
-        limit 10
+        limit 20
     </select>
     <select id="businessTypeData" resultType="com.alibaba.fastjson.JSONObject">
         select

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

@@ -7,6 +7,7 @@ import cn.com.ctop.job.bytedance.data.utils.DateUtils;
 import cn.com.ctop.job.bytedance.utils.FeishuRobotUtil;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.google.common.collect.ImmutableMap;
 import javafx.util.Pair;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.http.HttpEntity;
@@ -33,7 +34,7 @@ public class DateReportsPushServiceImpl implements IDateReportsPushService {
     @Autowired
     ReportsAdPushMapper reportsPushMapper;
 
-    private static final String TEMPLATE_VERSION = "1.0.13";
+    private static final String TEMPLATE_VERSION = "1.0.17";
     private static final String TEMPLATE_ID = "AAqRhJzMBoO0E";
 
     /**
@@ -168,17 +169,29 @@ public class DateReportsPushServiceImpl implements IDateReportsPushService {
         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");
+//            String movieSource = String.valueOf(movie.get("movie_source"));
+//            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();
+            if (!Check.isNull(movieProjectSource) && movieProjectSource.equals("1")){
+                ms.add(ImmutableMap.of("text", movieProjectSourceName, "color", "grey"));
+            }else if (!Check.isNull(movieProjectSource) && movieProjectSource.equals("2")){
+                ms.add(ImmutableMap.of("text", movieProjectSourceName, "color", "green"));
             }else {
-                obj.put("movieNameColor", "grey");
+                ms.add(ImmutableMap.of("text", movieProjectSourceName, "color", "blue"));
             }
+            obj.put("movieProjectSource", ms);
             obj.put("rank", String.valueOf(movie.get("rk")));
             obj.put("movieName", movieName);
             obj.put("endAmount", String.valueOf(movie.get("end_amount")));
-            obj.put("realROI", String.valueOf(movie.get("real_roi")));
+//            obj.put("realROI", String.valueOf(movie.get("real_roi")));
             obj.put("iapRoi", String.valueOf(movie.get("iap_roi")));
             obj.put("iaaRoi", String.valueOf(movie.get("iaa_roi")));
             movieRankTable.add(obj);
@@ -202,7 +215,7 @@ public class DateReportsPushServiceImpl implements IDateReportsPushService {
         template_variable.put("todayDate", today);
         template_variable.put("lastDayDate", lastDay);
         template_variable.put("dateIndicatorTable", dateIndicatorTable);
-        template_variable.put("movieRankTable", movieRankTable);
+        template_variable.put("table_raw_array_2", movieRankTable);
         template_variable.put("deptRank", deptRank);
         template_variable.put("description", description);
 

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

@@ -2,10 +2,12 @@ package cn.com.ctop.job.bytedance.data.service.impl;
 
 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.utils.FeishuRobotUtil;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.google.common.collect.ImmutableMap;
 import javafx.util.Pair;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.http.HttpEntity;
@@ -30,7 +32,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.13";
+    public static final String TEMPLATE_VERSION = "1.0.15";
     @Autowired
     ReportsAdPushMapper reportsPushMapper;
 
@@ -117,19 +119,30 @@ public class ReportsAdPushServiceImpl implements IReportsAdPushService {
         List<JSONObject> topMovies = reportsPushMapper.todayTopMovie(todayLong, String.valueOf(lastHour));
         JSONArray object_list_2 = new JSONArray();
         for (JSONObject m : topMovies){
-            int movieSource = m.getIntValue("movie_source");
-            String movieNameColor = movieSource==2?"grey":"blue";
+//            int movieSource = m.getIntValue("movie_source");
+//            String movieNameColor = movieSource==2?"grey":"blue";
             JSONObject obj = new JSONObject();
             obj.put("movieName", m.getString("movie_name"));
-            obj.put("movieNameColor", movieNameColor);
-            obj.put("movieEndAmount", m.get("water_end_amount"));
-            obj.put("movieRealRoi", m.get("real_roi"));
+//            obj.put("movieNameColor", movieNameColor);
+            obj.put("endAmount", m.get("water_end_amount"));
+//            obj.put("movieRealRoi", m.get("real_roi"));
             obj.put("hourCostAmount", m.get("hour_cost_amount"));
             obj.put("iaaRoi", m.get("iaa_roi"));
             obj.put("iapRoi", m.get("iap_roi"));
+            String movieProjectSource = String.valueOf(m.get("movie_project_source"));
+            String movieProjectSourceName = String.valueOf(m.get("movie_project_source_name"));
+            JSONArray ms = new JSONArray();
+            if (!Check.isNull(movieProjectSource) && movieProjectSource.equals("1")){
+                ms.add(ImmutableMap.of("text", movieProjectSourceName, "color", "grey"));
+            }else if (!Check.isNull(movieProjectSource) && movieProjectSource.equals("2")){
+                ms.add(ImmutableMap.of("text", movieProjectSourceName, "color", "green"));
+            }else {
+                ms.add(ImmutableMap.of("text", movieProjectSourceName, "color", "blue"));
+            }
+            obj.put("movieProjectSource", ms);
             object_list_2.add(obj);
         }
-        template_variables.put("object_list_2", object_list_2);
+        template_variables.put("table_raw_array_1", object_list_2);
 
         String token;
         try {

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

@@ -7,6 +7,7 @@ import cn.com.ctop.job.bytedance.data.utils.DateUtils;
 import cn.com.ctop.job.bytedance.utils.FeishuRobotUtil;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.google.common.collect.ImmutableMap;
 import javafx.util.Pair;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.http.HttpEntity;
@@ -35,7 +36,7 @@ public class ReportsByBusinessPushServiceImpl implements IReportsByBusinessPushS
     @Autowired
     ReportsAdPushMapper reportsPushMapper;
 
-    private static final String TEMPLATE_VERSION = "1.0.3";
+    private static final String TEMPLATE_VERSION = "1.0.5";
     private static final String TEMPLATE_ID = "AAq4oeDXECopo";
 
 
@@ -154,13 +155,24 @@ 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 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");
+//            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();
+            if (!Check.isNull(movieProjectSource) && movieProjectSource.equals("1")){
+                ms.add(ImmutableMap.of("text", movieProjectSourceName, "color", "grey"));
+            }else if (!Check.isNull(movieProjectSource) && movieProjectSource.equals("2")){
+                ms.add(ImmutableMap.of("text", movieProjectSourceName, "color", "green"));
             }else {
-                obj.put("movieNameColor", "grey");
+                ms.add(ImmutableMap.of("text", movieProjectSourceName, "color", "blue"));
             }
+            obj.put("movieProjectSource", ms);
             obj.put("rank", String.valueOf(movie.get("rk")));
             obj.put("movieName", movieName);
             obj.put("endAmount", String.valueOf(movie.get("end_amount")));
@@ -213,7 +225,7 @@ public class ReportsByBusinessPushServiceImpl implements IReportsByBusinessPushS
         template_variable.put("todayDate", today);
         template_variable.put("lastDayDate", lastDay);
         template_variable.put("dateIndicatorTable", dateIndicatorTable);
-        template_variable.put("movieRankTable", movieRankTable);
+        template_variable.put("table_raw_array_1", movieRankTable);
         template_variable.put("deptRank", deptRank);
         template_variable.put("description", description);
         template_variable.put("businessTypeList", businessTypeTable);