Browse Source

素材大盘

zhouzeyu@c-top.com.cn 3 years ago
parent
commit
7df23585ed

+ 62 - 91
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/MaterialReportOverViewMapper.xml

@@ -425,14 +425,15 @@
     <select id="queryBytedanceTopMaterial" resultType="com.alibaba.fastjson.JSONObject">
     <select id="queryBytedanceTopMaterial" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
         SELECT
         t1.*,
         t1.*,
-        IFNULL((SELECT GROUP_CONCAT(tag_name) from ctop_material_tag_info where code=signature and status=1),"造") as
+        IFNULL((SELECT GROUP_CONCAT(tag_name) from ctop_material_tag_info where code=signature and status=1),"造") as
         tag
         tag
         FROM
         FROM
         (SELECT md5 signature,
         (SELECT md5 signature,
-        case when toutiao_url = '' or toutiao_url is null then url end url,
-        cover_url AS coverUrl,
-        material_name AS materialName,
-        sum(cost) AS cost from etl_report_bytedance_video
+        case when toutiao_url = '' or toutiao_url is null then t.url end url,
+        t.cover_url AS coverUrl,
+        t.material_name AS materialName,
+        sum(cost) AS cost from etl_report_bytedance_video t
+        LEFT JOIN ctop_material_info t1 on t.md5=t1.`code`
         where 1=1
         where 1=1
         <if test="projects !=null">
         <if test="projects !=null">
             AND project_id IN
             AND project_id IN
@@ -441,6 +442,7 @@
                 #{item}
                 #{item}
             </foreach>
             </foreach>
         </if>
         </if>
+        AND t1.`code` is not null
         AND stat_datetime &gt; #{startDate}
         AND stat_datetime &gt; #{startDate}
         AND stat_datetime &lt;= #{endDate}
         AND stat_datetime &lt;= #{endDate}
         AND md5!=''
         AND md5!=''
@@ -811,7 +813,7 @@
                t.material_name                                                                       as materialName,
                t.material_name                                                                       as materialName,
                t2.`second`,
                t2.`second`,
                '快手'                                                                                  as madia,
                '快手'                                                                                  as madia,
-               GROUP_CONCAT((SELECT project_name from ctop_project where id = t.project_id limit 1)) as projectName,
+               GROUP_CONCAT(DISTINCT (SELECT project_name from ctop_project where id = t.project_id limit 1)) as projectName,
                t.create_time                                                                         as createTime,
                t.create_time                                                                         as createTime,
                t2.size,
                t2.size,
                t1.channel_name                                                                       as channelType,
                t1.channel_name                                                                       as channelType,
@@ -832,9 +834,9 @@
     </select>
     </select>
 
 
     <select id="queryBytedanceVideoChat" resultType="com.alibaba.fastjson.JSONObject">
     <select id="queryBytedanceVideoChat" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT sum(cost)                           AS cost,
-            					SUM(material_show) as aclick,
-	                        SUM(active) as activation,
+        SELECT ifnull(sum(cost),0)                           AS cost,
+            		ifnull(SUM(material_show),0)			 as aclick,
+	                        ifnull(SUM(active),0) as activation,
                DATE_FORMAT(stat_datetime, '%Y-%m') AS statDate
                DATE_FORMAT(stat_datetime, '%Y-%m') AS statDate
         FROM etl_report_bytedance_video
         FROM etl_report_bytedance_video
         WHERE md5 = #{md5}
         WHERE md5 = #{md5}
@@ -843,9 +845,9 @@
     </select>
     </select>
 
 
     <select id="queryKuaishouVideoChat" resultType="com.alibaba.fastjson.JSONObject">
     <select id="queryKuaishouVideoChat" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT sum(charge)                     AS cost,
-        					SUM(aclick) as aclick,
-	                        SUM(activation) as activation,
+        SELECT ifnull(sum(charge) ,0)                    AS cost,
+        					ifnull(SUM(aclick),0) as aclick,
+	                        ifnull(SUM(activation),0) as activation,
                DATE_FORMAT(stat_date, '%Y-%m') AS statDate
                DATE_FORMAT(stat_date, '%Y-%m') AS statDate
         FROM ctop_etl_kuaishou_account_material_report_daily
         FROM ctop_etl_kuaishou_account_material_report_daily
         WHERE signature = #{md5}
         WHERE signature = #{md5}
@@ -857,9 +859,9 @@
         SELECT
         SELECT
             project_id
             project_id
         FROM
         FROM
-            etl_report_bytedance_video
+            ctop_material_info
         WHERE
         WHERE
-            md5 = #{md5}
+            code = #{md5}
           AND project_id IS NOT NULL
           AND project_id IS NOT NULL
         LIMIT 1
         LIMIT 1
     </select>
     </select>
@@ -878,24 +880,20 @@
     <select id="queryBytedanceCostByMd5" resultType="com.alibaba.fastjson.JSONObject">
     <select id="queryBytedanceCostByMd5" resultType="com.alibaba.fastjson.JSONObject">
         select cost
         select cost
         from (
         from (
-                 SELECT ROUND(sum(cost), 2) cost,
+                 SELECT ifnull(ROUND(sum(cost), 2),0) cost,
                         1 as                num
                         1 as                num
                  FROM etl_report_bytedance_video
                  FROM etl_report_bytedance_video
                  WHERE md5 = #{md5}
                  WHERE md5 = #{md5}
                  union all
                  union all
-                 SELECT ROUND(MAX(cost), 2) top,
+                 SELECT ifnull(ROUND(MAX(cost), 2),2) top,
                         2 as                num
                         2 as                num
                  FROM (
                  FROM (
                           SELECT sum(cost) cost
                           SELECT sum(cost) cost
-                          FROM etl_report_bytedance_video
-                          WHERE project_id = #{project}
+                          FROM etl_report_bytedance_video t
+                          LEFT JOIN ctop_material_info t1 on t.md5=t1.code
+                            WHERE t1.project_id =#{project}
                           GROUP BY md5
                           GROUP BY md5
                       ) t
                       ) t
-                 union all
-                 SELECT ROUND(AVG(cost), 2) average,
-                        3 as                num
-                 FROM etl_report_bytedance_video
-                 WHERE project_id = #{project}
              ) t
              ) t
         order by num
         order by num
     </select>
     </select>
@@ -903,24 +901,20 @@
     <select id="queryBytedanceClickByMd5" resultType="com.alibaba.fastjson.JSONObject">
     <select id="queryBytedanceClickByMd5" resultType="com.alibaba.fastjson.JSONObject">
         select click
         select click
         from (
         from (
-                 SELECT sum(click) click,
+                 SELECT ifnull(ROUND(sum(click),2),0) click,
                         1 as       num
                         1 as       num
                  FROM etl_report_bytedance_video
                  FROM etl_report_bytedance_video
                  WHERE md5 = #{md5}
                  WHERE md5 = #{md5}
                  union all
                  union all
-                 SELECT MAX(click) top,
+                 SELECT ifnull(ROUND(MAX(click),2),0)  top,
                         2 as       num
                         2 as       num
                  FROM (
                  FROM (
                           SELECT sum(click) click
                           SELECT sum(click) click
-                          FROM etl_report_bytedance_video
-                          WHERE project_id = #{project}
+                          FROM etl_report_bytedance_video t
+                          LEFT JOIN ctop_material_info t1 on t.md5=t1.code
+                            WHERE t1.project_id =#{project}
                           GROUP BY md5
                           GROUP BY md5
                       ) t
                       ) t
-                 union all
-                 SELECT ROUND(AVG(click), 0) average,
-                        3 as                 num
-                 FROM etl_report_bytedance_video
-                 WHERE project_id = #{project}
              ) t
              ) t
         order by num
         order by num
     </select>
     </select>
@@ -928,24 +922,21 @@
     <select id="queryBytedanceMaterialShowByMd5" resultType="com.alibaba.fastjson.JSONObject">
     <select id="queryBytedanceMaterialShowByMd5" resultType="com.alibaba.fastjson.JSONObject">
         select materialShow
         select materialShow
         from (
         from (
-                 SELECT sum(material_show) materialShow,
+                 SELECT ifnull(sum(material_show),0) materialShow,
                      1 as num
                      1 as num
                  FROM etl_report_bytedance_video
                  FROM etl_report_bytedance_video
                  WHERE md5 = #{md5}
                  WHERE md5 = #{md5}
                  union all
                  union all
-                 SELECT MAX(materialShow) top,
+                 SELECT ifnull(MAX(materialShow),0) top,
                      2 as num
                      2 as num
                  FROM (
                  FROM (
                           SELECT sum(material_show) materialShow
                           SELECT sum(material_show) materialShow
-                          FROM etl_report_bytedance_video
-                          WHERE project_id = #{project}
+                          FROM etl_report_bytedance_video t
+                          LEFT JOIN ctop_material_info t1 on t.md5=t1.code
+                            WHERE t1.project_id =#{project}
                           GROUP BY md5
                           GROUP BY md5
                       ) t
                       ) t
-                 union all
-                 SELECT ROUND(AVG(material_show), 0) average,
-                     3 as num
-                 FROM etl_report_bytedance_video
-                 WHERE project_id = #{project}
+
              ) t
              ) t
         order by num
         order by num
 
 
@@ -963,15 +954,11 @@
             2 as num
             2 as num
         FROM (
         FROM (
                  SELECT round(sum(play100_feed_break) / sum(material_show), 2) play100Rate
                  SELECT round(sum(play100_feed_break) / sum(material_show), 2) play100Rate
-                 FROM etl_report_bytedance_video
-                 WHERE project_id = #{project}
+                 FROM etl_report_bytedance_video t
+                   LEFT JOIN ctop_material_info t1 on t.md5=t1.code
+                   WHERE t1.project_id =#{project}
                  GROUP BY md5
                  GROUP BY md5
              ) t
              ) t
-        union all
-        SELECT ifnull(ROUND(sum(play100_feed_break) / sum(material_show), 2),0) average,
-            3 as num
-        FROM etl_report_bytedance_video
-        WHERE project_id = #{project}
              ) t
              ) t
         order by num
         order by num
     </select>
     </select>
@@ -979,24 +966,20 @@
     <select id="queryBytedanceLikeMaterialByMd5" resultType="com.alibaba.fastjson.JSONObject">
     <select id="queryBytedanceLikeMaterialByMd5" resultType="com.alibaba.fastjson.JSONObject">
         select likeMaterial
         select likeMaterial
         from (
         from (
-        SELECT sum(like_material) likeMaterial,
+        SELECT ifnull(sum(like_material),0) likeMaterial,
             1 as num
             1 as num
         FROM etl_report_bytedance_video
         FROM etl_report_bytedance_video
         WHERE md5 = #{md5}
         WHERE md5 = #{md5}
         union all
         union all
-        SELECT MAX(likeMaterial) top,
+        SELECT ifnull(MAX(likeMaterial),0) top,
             2 as num
             2 as num
         FROM (
         FROM (
                  SELECT sum(like_material) likeMaterial
                  SELECT sum(like_material) likeMaterial
-                 FROM etl_report_bytedance_video
-                 WHERE project_id = #{project}
+                 FROM etl_report_bytedance_video t
+                          LEFT JOIN ctop_material_info t1 on t.md5=t1.code
+                            WHERE t1.project_id =#{project}
                  GROUP BY md5
                  GROUP BY md5
              ) t
              ) t
-        union all
-        SELECT ROUND(AVG(like_material), 0) average,
-            3 as num
-        FROM etl_report_bytedance_video
-        WHERE project_id = #{project}
              ) t
              ) t
         order by num
         order by num
     </select>
     </select>
@@ -1004,24 +987,20 @@
     <select id="queryBytedanceCommentMaterialByMd5" resultType="com.alibaba.fastjson.JSONObject">
     <select id="queryBytedanceCommentMaterialByMd5" resultType="com.alibaba.fastjson.JSONObject">
         select commentMaterial
         select commentMaterial
         from (
         from (
-        SELECT sum(comment_material) commentMaterial,
+        SELECT ifnull(sum(comment_material),0) commentMaterial,
             1 as num
             1 as num
         FROM etl_report_bytedance_video
         FROM etl_report_bytedance_video
         WHERE md5 = #{md5}
         WHERE md5 = #{md5}
         union all
         union all
-        SELECT MAX(commentMaterial) top,
+        SELECT ifnull(MAX(commentMaterial),0) top,
             2 as num
             2 as num
         FROM (
         FROM (
                  SELECT sum(comment_material) commentMaterial
                  SELECT sum(comment_material) commentMaterial
-                 FROM etl_report_bytedance_video
-                 WHERE project_id = #{project}
+                 FROM etl_report_bytedance_video t
+                          LEFT JOIN ctop_material_info t1 on t.md5=t1.code
+                            WHERE t1.project_id =#{project}
                  GROUP BY md5
                  GROUP BY md5
              ) t
              ) t
-        union all
-        SELECT ROUND(AVG(comment_material), 0) average,
-            3 as num
-        FROM etl_report_bytedance_video
-        WHERE project_id = #{project}
              ) t
              ) t
         order by num
         order by num
     </select>
     </select>
@@ -1029,24 +1008,20 @@
     <select id="queryBytedanceShareMaterialByMd5" resultType="com.alibaba.fastjson.JSONObject">
     <select id="queryBytedanceShareMaterialByMd5" resultType="com.alibaba.fastjson.JSONObject">
         select shareMaterial
         select shareMaterial
         from (
         from (
-        SELECT sum(share_material) shareMaterial,
+        SELECT ifnull(sum(share_material),0) shareMaterial,
             1 as num
             1 as num
         FROM etl_report_bytedance_video
         FROM etl_report_bytedance_video
         WHERE md5 = #{md5}
         WHERE md5 = #{md5}
         union all
         union all
-        SELECT MAX(shareMaterial) top,
+        SELECT ifnull(MAX(shareMaterial),0) top,
             2 as num
             2 as num
         FROM (
         FROM (
                  SELECT sum(share_material) shareMaterial
                  SELECT sum(share_material) shareMaterial
-                 FROM etl_report_bytedance_video
-                 WHERE project_id = #{project}
+                 FROM etl_report_bytedance_video t
+                          LEFT JOIN ctop_material_info t1 on t.md5=t1.code
+                            WHERE t1.project_id =#{project}
                  GROUP BY md5
                  GROUP BY md5
              ) t
              ) t
-        union all
-        SELECT ROUND(AVG(share_material), 0) average,
-            3 as num
-        FROM etl_report_bytedance_video
-        WHERE project_id = #{project}
              ) t
              ) t
         order by num
         order by num
     </select>
     </select>
@@ -1054,24 +1029,20 @@
     <select id="queryBytedanceFollowByMd5" resultType="com.alibaba.fastjson.JSONObject">
     <select id="queryBytedanceFollowByMd5" resultType="com.alibaba.fastjson.JSONObject">
         select follow
         select follow
         from (
         from (
-        SELECT sum(follow) follow,
+        SELECT ifnull(sum(follow),0) follow,
             1 as num
             1 as num
         FROM etl_report_bytedance_video
         FROM etl_report_bytedance_video
         WHERE md5 = #{md5}
         WHERE md5 = #{md5}
         union all
         union all
-        SELECT MAX(follow) top,
+        SELECT ifnull(MAX(follow),0) top,
             2 as num
             2 as num
         FROM (
         FROM (
                  SELECT sum(follow) follow
                  SELECT sum(follow) follow
-                 FROM etl_report_bytedance_video
-                 WHERE project_id = #{project}
+                 FROM etl_report_bytedance_video t
+                          LEFT JOIN ctop_material_info t1 on t.md5=t1.code
+                            WHERE t1.project_id =#{project}
                  GROUP BY md5
                  GROUP BY md5
              ) t
              ) t
-        union all
-        SELECT ROUND(AVG(follow), 0) average,
-            3 as num
-        FROM etl_report_bytedance_video
-        WHERE project_id = #{project}
              ) t
              ) t
         order by num
         order by num
     </select>
     </select>
@@ -1235,7 +1206,7 @@
 	select 	t2.gender,
 	select 	t2.gender,
 		CASE t2.age WHEN '18-23岁|24-30岁|31-40岁' THEN '18-40'
 		CASE t2.age WHEN '18-23岁|24-30岁|31-40岁' THEN '18-40'
     WHEN '24-30岁|31-40岁|41-49岁' THEN '24-49'
     WHEN '24-30岁|31-40岁|41-49岁' THEN '24-49'
-   WHEN '31-40岁|41-49岁|50+岁' THEN '大于等于31岁'
+   WHEN '31-40岁|41-49岁|50+岁' THEN '31+'
     WHEN '不限' THEN '不限' ELSE null END as age,
     WHEN '不限' THEN '不限' ELSE null END as age,
             case t2.target_type when 'convert_ratio' then CONCAT(IFNULL(ROUND(t2.combine_estimate_prob*100,2),0),'%') else 0 end 'convertRatio',
             case t2.target_type when 'convert_ratio' then CONCAT(IFNULL(ROUND(t2.combine_estimate_prob*100,2),0),'%') else 0 end 'convertRatio',
             ( SELECT
             ( SELECT
@@ -1249,8 +1220,8 @@
     </select>
     </select>
 
 
     <select id="getActualProb" resultType="String">
     <select id="getActualProb" resultType="String">
-     SELECT  CONCAT(ROUND(max(actual_prob)*100,2),'%') from ctop_ai_kuaishou_signature_recommended_target_combine t
-      where t.signature=#{signature}  and target_type=#{targetType}
+     SELECT  DISTINCT CONCAT(ROUND(actual_prob*100,2),'%') from ctop_ai_kuaishou_signature_recommended_target_combine t
+      where t.signature=#{signature}  and target_type=#{targetType} ORDER BY stat_date DESC LIMIT 0,1
     </select>
     </select>
 
 
     <select id="populationAnalysisChart" resultType="java.util.Map">
     <select id="populationAnalysisChart" resultType="java.util.Map">
@@ -1260,7 +1231,7 @@
 		t2.gender,
 		t2.gender,
 		CASE t2.age WHEN '18-23岁|24-30岁|31-40岁' THEN '18-40'
 		CASE t2.age WHEN '18-23岁|24-30岁|31-40岁' THEN '18-40'
             WHEN '24-30岁|31-40岁|41-49岁' THEN '24-49'
             WHEN '24-30岁|31-40岁|41-49岁' THEN '24-49'
-        WHEN '31-40岁|41-49岁|50+岁' THEN '大于等于31岁'
+        WHEN '31-40岁|41-49岁|50+岁' THEN '31+'
          WHEN '不限' THEN '不限' ELSE null END as age,
          WHEN '不限' THEN '不限' ELSE null END as age,
             case t2.target_type when 'convert_ratio' then CONCAT(IFNULL(ROUND(t2.combine_estimate_prob*100,2),0),'%') else 0 end 'convertRatio',
             case t2.target_type when 'convert_ratio' then CONCAT(IFNULL(ROUND(t2.combine_estimate_prob*100,2),0),'%') else 0 end 'convertRatio',
             ( SELECT
             ( SELECT
@@ -1276,9 +1247,9 @@
     <select id="optimalCombination" resultType="java.util.Map">
     <select id="optimalCombination" resultType="java.util.Map">
         SELECT * from (
         SELECT * from (
     select	t2.gender,
     select	t2.gender,
-		CASE t2.age WHEN '18-23岁|24-30岁|31-40岁' THEN '18-40'
-    WHEN '24-30岁|31-40岁|41-49岁' THEN '24-49'
-   WHEN '31-40岁|41-49岁|50+岁' THEN '大于等于31岁'
+		CASE t2.age WHEN '18-23岁|24-30岁|31-40岁' THEN '18-40'
+    WHEN '24-30岁|31-40岁|41-49岁' THEN '24-49'
+   WHEN '31-40岁|41-49岁|50+岁' THEN '31+岁'
     WHEN '不限' THEN '不限' ELSE null END as age,
     WHEN '不限' THEN '不限' ELSE null END as age,
     <if test='targetType=="convert_ratio"'>
     <if test='targetType=="convert_ratio"'>
         case t2.target_type when 'convert_ratio' then t2.combine_estimate_prob else 0 end 'convertRatio'
         case t2.target_type when 'convert_ratio' then t2.combine_estimate_prob else 0 end 'convertRatio'

+ 87 - 28
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/MaterialReportOverViewServiceImpl.java

@@ -10,10 +10,8 @@ import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
-import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.constant.AccountReportConstants;
 import org.jeecg.common.constant.AccountReportConstants;
-import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.DateUtils;
 import org.jeecg.common.util.DateUtils;
 import org.jeecg.common.utils.JsonResourceUtil;
 import org.jeecg.common.utils.JsonResourceUtil;
 import org.jeecg.modules.ctop.mapper.MaterialReportOverViewMapper;
 import org.jeecg.modules.ctop.mapper.MaterialReportOverViewMapper;
@@ -30,6 +28,7 @@ import java.io.OutputStream;
 import java.math.BigDecimal;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.math.RoundingMode;
 import java.text.ParseException;
 import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.*;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
 
 
@@ -458,11 +457,71 @@ public class MaterialReportOverViewServiceImpl implements IMaterialReportOverVie
     @Override
     @Override
     public List<JSONObject> getMaterialDetailChat(int mediaId, String md5) {
     public List<JSONObject> getMaterialDetailChat(int mediaId, String md5) {
         List<JSONObject> result = new ArrayList<>();
         List<JSONObject> result = new ArrayList<>();
-        if (mediaId == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
-            result = materialReportOverViewMapper.queryBytedanceVideoChat(md5);
-        } else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
-            result = materialReportOverViewMapper.queryKuaishouVideoChat(md5);
+        List<JSONObject> data = new ArrayList<>();
+        List<String> monthBetween = new ArrayList<>();
+        Map<String, JSONObject> map = new HashMap<>();
+        try {
+            if (mediaId == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
+                result = materialReportOverViewMapper.queryBytedanceVideoChat(md5);
+            } else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
+                result = materialReportOverViewMapper.queryKuaishouVideoChat(md5);
+            }
+            //获取最小日期和最大日期 计算中间无数据日期 填充0
+            if (result != null && result.size() > 0) {
+                JSONObject first = result.get(0);
+                JSONObject last = result.get(result.size() - 1);
+                String startDate = first.get("statDate") == null ? null : (String) first.get("statDate");
+                String endDate = last.get("statDate") == null ? null : (String) last.get("statDate");
+                if (startDate != null && endDate != null) {
+                    monthBetween = getMonthBetween(startDate, endDate);
+                    log.info(":{}", monthBetween.size());
+                }
+                for (JSONObject jsonObject : result) {
+                    String date = jsonObject.get("statDate") == null ? null : (String) jsonObject.get("statDate");
+                    if (date != null) {
+                        map.put(date, jsonObject);
+                    }
+                }
+                for (String date : monthBetween) {
+                    if (map.get(date) != null) {
+                        data.add(map.get(date));
+                    } else {
+                        JSONObject dataMap = new JSONObject();
+                        dataMap.put("statDate", date);
+                        dataMap.put("cost", 0);
+                        dataMap.put("aclick", 0);
+                        dataMap.put("activation", 0);
+                        data.add(dataMap);
+                    }
+                }
+            }
+
+
+        } catch (Exception e) {
+            log.info("查询数据错误:{}", e.toString());
+        }
+        return data;
+    }
+
+    private static List<String> getMonthBetween(String minDate, String maxDate) throws ParseException {
+        ArrayList<String> result = new ArrayList<String>();
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");//格式化为年月
+
+        Calendar min = Calendar.getInstance();
+        Calendar max = Calendar.getInstance();
+
+        min.setTime(sdf.parse(minDate));
+        min.set(min.get(Calendar.YEAR), min.get(Calendar.MONTH), 1);
+
+        max.setTime(sdf.parse(maxDate));
+        max.set(max.get(Calendar.YEAR), max.get(Calendar.MONTH), 2);
+
+        Calendar curr = min;
+        while (curr.before(max)) {
+            result.add(sdf.format(curr.getTime()));
+            curr.add(Calendar.MONTH, 1);
         }
         }
+
         return result;
         return result;
     }
     }
 
 
@@ -529,12 +588,12 @@ public class MaterialReportOverViewServiceImpl implements IMaterialReportOverVie
             //最优点击率组合
             //最优点击率组合
             Map<String, String> actionRatio = materialReportOverViewMapper.optimalCombination(signature, "action_ratio");
             Map<String, String> actionRatio = materialReportOverViewMapper.optimalCombination(signature, "action_ratio");
             if (convertRatio != null) {
             if (convertRatio != null) {
-                map.put("convertRatio", convertRatio.get("gender") + convertRatio.get("age"));
+                map.put("convertRatio", convertRatio.get("gender") + "/" + convertRatio.get("age"));
             } else {
             } else {
                 map.put("convertRatio", null);
                 map.put("convertRatio", null);
             }
             }
             if (actionRatio != null) {
             if (actionRatio != null) {
-                map.put("actionRatio", actionRatio.get("gender") + convertRatio.get("age"));
+                map.put("actionRatio", actionRatio.get("gender") + "/" + actionRatio.get("age"));
             } else {
             } else {
                 map.put("actionRatio", null);
                 map.put("actionRatio", null);
             }
             }
@@ -556,41 +615,41 @@ public class MaterialReportOverViewServiceImpl implements IMaterialReportOverVie
     @Override
     @Override
     public Result similarMaterial(String signature) {
     public Result similarMaterial(String signature) {
         Result result = new Result<>();
         Result result = new Result<>();
-        List<Map> resultMap=new ArrayList<>();
-        Map<String,String> map = materialReportOverViewMapper.getSimilarMaterialList(signature);
-        if(map!=null){
+        List<Map> resultMap = new ArrayList<>();
+        Map<String, String> map = materialReportOverViewMapper.getSimilarMaterialList(signature);
+        if (map != null) {
             String signature1 = map.get("s1");
             String signature1 = map.get("s1");
             String signature2 = map.get("s2");
             String signature2 = map.get("s2");
             String signature3 = map.get("s3");
             String signature3 = map.get("s3");
             String signature4 = map.get("s4");
             String signature4 = map.get("s4");
             String signature5 = map.get("s5");
             String signature5 = map.get("s5");
-            if(signature1!=null&& !signature1.equals("")){
-                Map info= materialReportOverViewMapper.similarMaterialInfo(signature1);
-                if(info.get("signature")!=null && !info.get("signature").equals("")){
+            if (signature1 != null && !signature1.equals("")) {
+                Map info = materialReportOverViewMapper.similarMaterialInfo(signature1);
+                if (info.get("signature") != null && !info.get("signature").equals("")) {
                     resultMap.add(info);
                     resultMap.add(info);
                 }
                 }
             }
             }
-            if(signature2!=null&& !signature2.equals("")){
-                Map info= materialReportOverViewMapper.similarMaterialInfo(signature2);
-                if(info.get("signature")!=null && !info.get("signature").equals("")){
+            if (signature2 != null && !signature2.equals("")) {
+                Map info = materialReportOverViewMapper.similarMaterialInfo(signature2);
+                if (info.get("signature") != null && !info.get("signature").equals("")) {
                     resultMap.add(info);
                     resultMap.add(info);
                 }
                 }
             }
             }
-            if(signature3!=null&& !signature3.equals("")){
-                Map info= materialReportOverViewMapper.similarMaterialInfo(signature3);
-                if(info.get("signature")!=null && !info.get("signature").equals("")){
+            if (signature3 != null && !signature3.equals("")) {
+                Map info = materialReportOverViewMapper.similarMaterialInfo(signature3);
+                if (info.get("signature") != null && !info.get("signature").equals("")) {
                     resultMap.add(info);
                     resultMap.add(info);
                 }
                 }
             }
             }
-            if(signature4!=null&& !signature4.equals("")){
-                Map info= materialReportOverViewMapper.similarMaterialInfo(signature4);
-                if(info.get("signature")!=null && !info.get("signature").equals("")){
+            if (signature4 != null && !signature4.equals("")) {
+                Map info = materialReportOverViewMapper.similarMaterialInfo(signature4);
+                if (info.get("signature") != null && !info.get("signature").equals("")) {
                     resultMap.add(info);
                     resultMap.add(info);
                 }
                 }
             }
             }
-            if(signature5!=null&& !signature5.equals("")){
-                Map info= materialReportOverViewMapper.similarMaterialInfo(signature5);
-                if(info.get("signature")!=null && !info.get("signature").equals("")){
+            if (signature5 != null && !signature5.equals("")) {
+                Map info = materialReportOverViewMapper.similarMaterialInfo(signature5);
+                if (info.get("signature") != null && !info.get("signature").equals("")) {
                     resultMap.add(info);
                     resultMap.add(info);
                 }
                 }
             }
             }
@@ -613,8 +672,8 @@ public class MaterialReportOverViewServiceImpl implements IMaterialReportOverVie
 
 
     //当项目为空的时候,根据当前登录人查询可查看的所有项目集合
     //当项目为空的时候,根据当前登录人查询可查看的所有项目集合
     private JSONArray getProjectsByCurrentUser(int mediaId) {
     private JSONArray getProjectsByCurrentUser(int mediaId) {
-        String currentUser = ((LoginUser) SecurityUtils.getSubject().getPrincipal()).getId();
-        //String currentUser = "e9ca23d68d884d4ebb19d07889727dae";
+        //String currentUser = ((LoginUser) SecurityUtils.getSubject().getPrincipal()).getId();
+        String currentUser = "e9ca23d68d884d4ebb19d07889727dae";
         //TODO 为了解决管理员等角色初始化查全部项目查询效率慢的问题判断角色,待优化
         //TODO 为了解决管理员等角色初始化查全部项目查询效率慢的问题判断角色,待优化
         String roleCode = roleService.getRoleCodeByUserId(currentUser);
         String roleCode = roleService.getRoleCodeByUserId(currentUser);
         if ("admin".equals(roleCode)) {
         if ("admin".equals(roleCode)) {