Browse Source

人群报表接口

zhaoxian 4 years ago
parent
commit
cc3588b605
16 changed files with 384 additions and 47 deletions
  1. 20 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KuaishouAudienceReportDailyController.java
  2. 13 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouAudienceReportDaily.java
  3. 4 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouAudienceReportDailyAgeMapper.java
  4. 4 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouAudienceReportDailyBusinessMapper.java
  5. 4 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouAudienceReportDailyCityMapper.java
  6. 4 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouAudienceReportDailyClientMapper.java
  7. 4 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouAudienceReportDailyGenderMapper.java
  8. 3 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouAudienceReportDailyProvinceMapper.java
  9. 46 5
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouAudienceReportDailyAgeMapper.xml
  10. 46 6
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouAudienceReportDailyBusinessMapper.xml
  11. 45 6
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouAudienceReportDailyCityMapper.xml
  12. 45 6
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouAudienceReportDailyClientMapper.xml
  13. 45 6
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouAudienceReportDailyGenderMapper.xml
  14. 45 6
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouAudienceReportDailyProvinceMapper.xml
  15. 13 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouAudienceReportDailyService.java
  16. 43 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouAudienceReportDailyServiceImpl.java

+ 20 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KuaishouAudienceReportDailyController.java

@@ -4,7 +4,6 @@ import cn.com.ctop.common.module.annotation.AutoLog;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouAudienceReportDaily;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouAudienceReportDailyService;
 import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -104,6 +103,26 @@ public class KuaishouAudienceReportDailyController {
     }
 
     /**
+     * 首页报表数据接口
+     *
+     * @param
+     * @return org.jeecg.common.api.vo.Result<java.lang.Object>
+     * @throws
+     * @author ZHAOXA
+     */
+    @AutoLog(value = "首页报表数据接口")
+    @ApiOperation(value = "首页报表数据接口", notes = "首页报表数据接口")
+    @GetMapping(value = "/queryAllReportForm")
+    public Result<Object> queryAllReportForm(KuaishouAudienceReportDaily audienceReport) {
+        try {
+            return kuaishouAudienceReportDailyService.queryAllReportForm(audienceReport);
+        } catch (Exception e) {
+            log.error("首页报表数据接口", e);
+        }
+        return Result.error("首页报表数据接口失败");
+    }
+
+    /**
      * 添加
      *
      * @param kuaishouAudienceReportDaily

+ 13 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouAudienceReportDaily.java

@@ -1,6 +1,7 @@
 package cn.com.ctop.kuaishou.modules.report.entity;
 
 import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModel;
@@ -724,6 +725,18 @@ public class KuaishouAudienceReportDaily {
     @Excel(name = "eventAdWatchTimes", width = 15)
     @ApiModelProperty(value = "eventAdWatchTimes")
     private java.lang.String eventAdWatchTimes;
+
+    @TableField(exist = false)
+    private java.lang.String startTime;
+
+    @TableField(exist = false)
+    private java.lang.String endTime;
+
+    @TableField(exist = false)
+    private java.lang.String orderType;
+
+    @TableField(exist = false)
+    private java.lang.String upOrDown;
     /**
      * 评论数
      */

+ 4 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouAudienceReportDailyAgeMapper.java

@@ -2,6 +2,7 @@ package cn.com.ctop.kuaishou.modules.report.mapper;
 
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouAudienceReportDaily;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouAudienceReportDailyAge;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
 import java.util.List;
@@ -15,5 +16,7 @@ import java.util.List;
  */
 public interface KuaishouAudienceReportDailyAgeMapper extends BaseMapper<KuaishouAudienceReportDailyAge> {
 
-    List<KuaishouAudienceReportDaily> queryPageLists(KuaishouAudienceReportDaily audienceReport);
+    List<JSONObject> queryPageLists(KuaishouAudienceReportDaily audienceReport);
+
+    List<JSONObject> queryAllReportForm(KuaishouAudienceReportDaily audienceReport);
 }

+ 4 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouAudienceReportDailyBusinessMapper.java

@@ -2,6 +2,7 @@ package cn.com.ctop.kuaishou.modules.report.mapper;
 
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouAudienceReportDaily;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouAudienceReportDailyBussiness;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
 import java.util.List;
@@ -15,5 +16,7 @@ import java.util.List;
  */
 public interface KuaishouAudienceReportDailyBusinessMapper extends BaseMapper<KuaishouAudienceReportDailyBussiness> {
 
-    List<KuaishouAudienceReportDaily> queryPageLists(KuaishouAudienceReportDaily audienceReport);
+    List<JSONObject> queryPageLists(KuaishouAudienceReportDaily audienceReport);
+
+    List<JSONObject> queryAllReportForm(KuaishouAudienceReportDaily audienceReport);
 }

+ 4 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouAudienceReportDailyCityMapper.java

@@ -2,6 +2,7 @@ package cn.com.ctop.kuaishou.modules.report.mapper;
 
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouAudienceReportDaily;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouAudienceReportDailyCity;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
 import java.util.List;
@@ -15,5 +16,7 @@ import java.util.List;
  */
 public interface KuaishouAudienceReportDailyCityMapper extends BaseMapper<KuaishouAudienceReportDailyCity> {
 
-    List<KuaishouAudienceReportDaily> queryPageLists(KuaishouAudienceReportDaily audienceReport);
+    List<JSONObject> queryPageLists(KuaishouAudienceReportDaily audienceReport);
+
+    List<JSONObject> queryAllReportForm(KuaishouAudienceReportDaily audienceReport);
 }

+ 4 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouAudienceReportDailyClientMapper.java

@@ -2,6 +2,7 @@ package cn.com.ctop.kuaishou.modules.report.mapper;
 
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouAudienceReportDaily;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouAudienceReportDailyClient;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
 import java.util.List;
@@ -15,5 +16,7 @@ import java.util.List;
  */
 public interface KuaishouAudienceReportDailyClientMapper extends BaseMapper<KuaishouAudienceReportDailyClient> {
 
-    List<KuaishouAudienceReportDaily> queryPageLists(KuaishouAudienceReportDaily audienceReport);
+    List<JSONObject> queryPageLists(KuaishouAudienceReportDaily audienceReport);
+
+    List<JSONObject> queryAllReportForm(KuaishouAudienceReportDaily audienceReport);
 }

+ 4 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouAudienceReportDailyGenderMapper.java

@@ -2,6 +2,7 @@ package cn.com.ctop.kuaishou.modules.report.mapper;
 
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouAudienceReportDaily;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouAudienceReportDailyGender;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
 import java.util.List;
@@ -15,5 +16,7 @@ import java.util.List;
  */
 public interface KuaishouAudienceReportDailyGenderMapper extends BaseMapper<KuaishouAudienceReportDailyGender> {
 
-    List<KuaishouAudienceReportDaily> queryPageLists(KuaishouAudienceReportDaily audienceReport);
+    List<JSONObject> queryPageLists(KuaishouAudienceReportDaily audienceReport);
+
+    List<JSONObject> queryAllReportForm(KuaishouAudienceReportDaily audienceReport);
 }

+ 3 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouAudienceReportDailyProvinceMapper.java

@@ -16,5 +16,7 @@ import java.util.List;
  */
 public interface KuaishouAudienceReportDailyProvinceMapper extends BaseMapper<KuaishouAudienceReportDailyProvince> {
 
-    List<KuaishouAudienceReportDaily> queryPageLists(KuaishouAudienceReportDaily audienceReport);
+    List<JSONObject> queryPageLists(KuaishouAudienceReportDaily audienceReport);
+
+    List<JSONObject> queryAllReportForm(KuaishouAudienceReportDaily audienceReport);
 }

+ 46 - 5
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouAudienceReportDailyAgeMapper.xml

@@ -1,11 +1,52 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.com.ctop.kuaishou.modules.report.mapper.KuaishouAudienceReportDailyAgeMapper">
-    <select id="queryPageLists" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouAudienceReportDaily">
+    <select id="queryPageLists" resultType="com.alibaba.fastjson.JSONObject">
         select
-        *
-       from
-        ctop_kuaishou_audience_report_daily_province
+        SELECT
+        account_id,
+        age_segment,
+        SUM(charge) as charge,
+        SUM(activation) as activation,
+        SUM(event_next_day_stay) as eventNextDayStay,
+        ROUND(SUM(event_next_day_stay)/SUM(activation)*100,2)as eventNextDayStayRatio
+        FROM ctop_kuaishou_audience_report_daily_age t1
         where account_id = #{accountId}
-      </select>
+        <if test="startTime != null">
+            AND stat_date &gt;= #{startTime}
+        </if>
+        <if test="endTime != null">
+            AND stat_date &lt;= #{endTime}
+        </if>
+        GROUP BY age_segment
+        <if test="orderType!= null">
+            ORDER BY #{orderType}
+        </if>
+        <if test="upOrDown == 'desc' || upOrDown == 'DESC'">
+            DESC
+        </if>
+    </select>
+
+
+    <select id="queryAllReportForm" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        stat_date,
+        account_id,
+        age_segment,
+        SUM(photo_show) as photoShow,
+        SUM(photo_click) as photoClick,
+        SUM(aclick) as aclick,
+        SUM(bclick) as bclick,
+        ROUND(SUM(photo_click)/SUM(photo_show)*100,2) as photoClickRatio,
+        ROUND(SUM(bclick)/SUM(aclick)*100,2) as actionRatio
+        FROM ctop_kuaishou_audience_report_daily_age t1
+        where account_id = #{accountId}
+        <if test="startTime != null">
+            AND stat_date &gt;= #{startTime}
+        </if>
+        <if test="endTime != null">
+            AND stat_date &lt;= #{endTime}
+        </if>
+        GROUP BY age_segment
+    </select>
 </mapper>

+ 46 - 6
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouAudienceReportDailyBusinessMapper.xml

@@ -1,11 +1,51 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.com.ctop.kuaishou.modules.report.mapper.KuaishouAudienceReportDailyBusinessMapper">
-    <select id="queryPageLists" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouAudienceReportDaily">
-        select
-        *
-       from
-        ctop_kuaishou_audience_report_daily_province
+    <select id="queryPageLists" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        account_id,
+        business_interest_tags,
+        SUM(charge) as charge,
+        SUM(activation) as activation,
+        SUM(event_next_day_stay) as eventNextDayStay,
+        ROUND(SUM(event_next_day_stay)/SUM(activation)*100,2)as eventNextDayStayRatio
+        FROM ctop_kuaishou_audience_report_daily_business t1
         where account_id = #{accountId}
-      </select>
+        <if test="startTime != null">
+            AND stat_date &gt;= #{startTime}
+        </if>
+        <if test="endTime != null">
+            AND stat_date &lt;= #{endTime}
+        </if>
+        GROUP BY business_interest_tags
+        <if test="orderType!= null">
+            ORDER BY #{orderType}
+        </if>
+        <if test="upOrDown == 'desc' || upOrDown == 'DESC'">
+            DESC
+        </if>
+    </select>
+
+
+    <select id="queryAllReportForm" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        stat_date,
+        account_id,
+        business_interest_tags,
+        SUM(photo_show) as photoShow,
+        SUM(photo_click) as photoClick,
+        SUM(aclick) as aclick,
+        SUM(bclick) as bclick,
+        ROUND(SUM(photo_click)/SUM(photo_show)*100,2) as photoClickRatio,
+        ROUND(SUM(bclick)/SUM(aclick)*100,2) as actionRatio
+        FROM ctop_kuaishou_audience_report_daily_business t1
+        where account_id = #{accountId}
+        <if test="startTime != null">
+            AND stat_date &gt;= #{startTime}
+        </if>
+        <if test="endTime != null">
+            AND stat_date &lt;= #{endTime}
+        </if>
+        GROUP BY business_interest_tags
+    </select>
 </mapper>

+ 45 - 6
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouAudienceReportDailyCityMapper.xml

@@ -1,11 +1,50 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.com.ctop.kuaishou.modules.report.mapper.KuaishouAudienceReportDailyCityMapper">
-    <select id="queryPageLists" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouAudienceReportDaily">
-        select
-        *
-       from
-        ctop_kuaishou_audience_report_daily_province
+    <select id="queryPageLists" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        account_id,
+        city,
+        SUM(charge) as charge,
+        SUM(activation) as activation,
+        SUM(event_next_day_stay) as eventNextDayStay,
+        ROUND(SUM(event_next_day_stay)/SUM(activation)*100,2)as eventNextDayStayRatio
+        FROM ctop_kuaishou_audience_report_daily_city t1
         where account_id = #{accountId}
-      </select>
+        <if test="startTime != null">
+            AND stat_date &gt;= #{startTime}
+        </if>
+        <if test="endTime != null">
+            AND stat_date &lt;= #{endTime}
+        </if>
+        GROUP BY city
+        <if test="orderType!= null">
+            ORDER BY #{orderType}
+        </if>
+        <if test="upOrDown == 'desc' || upOrDown == 'DESC'">
+            DESC
+        </if>
+    </select>
+
+    <select id="queryAllReportForm" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        stat_date,
+        account_id,
+        city,
+        SUM(photo_show) as photoShow,
+        SUM(photo_click) as photoClick,
+        SUM(aclick) as aclick,
+        SUM(bclick) as bclick,
+        ROUND(SUM(photo_click)/SUM(photo_show)*100,2) as photoClickRatio,
+        ROUND(SUM(bclick)/SUM(aclick)*100,2) as actionRatio
+        FROM ctop_kuaishou_audience_report_daily_city t1
+        where account_id = #{accountId}
+        <if test="startTime != null">
+            AND stat_date &gt;= #{startTime}
+        </if>
+        <if test="endTime != null">
+            AND stat_date &lt;= #{endTime}
+        </if>
+        GROUP BY city
+    </select>
 </mapper>

+ 45 - 6
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouAudienceReportDailyClientMapper.xml

@@ -1,11 +1,50 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.com.ctop.kuaishou.modules.report.mapper.KuaishouAudienceReportDailyClientMapper">
-    <select id="queryPageLists" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouAudienceReportDaily">
-        select
-        *
-       from
-        ctop_kuaishou_audience_report_daily_province
+    <select id="queryPageLists" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        account_id,
+        client,
+        SUM(charge) as charge,
+        SUM(activation) as activation,
+        SUM(event_next_day_stay) as eventNextDayStay,
+        ROUND(SUM(event_next_day_stay)/SUM(activation)*100,2)as eventNextDayStayRatio
+        FROM ctop_kuaishou_audience_report_daily_client t1
         where account_id = #{accountId}
-      </select>
+        <if test="startTime != null">
+            AND stat_date &gt;= #{startTime}
+        </if>
+        <if test="endTime != null">
+            AND stat_date &lt;= #{endTime}
+        </if>
+        GROUP BY client
+        <if test="orderType!= null">
+            ORDER BY #{orderType}
+        </if>
+        <if test="upOrDown == 'desc' || upOrDown == 'DESC'">
+            DESC
+        </if>
+    </select>
+
+    <select id="queryAllReportForm" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        stat_date,
+        account_id,
+        client,
+        SUM(photo_show) as photoShow,
+        SUM(photo_click) as photoClick,
+        SUM(aclick) as aclick,
+        SUM(bclick) as bclick,
+        ROUND(SUM(photo_click)/SUM(photo_show)*100,2) as photoClickRatio,
+        ROUND(SUM(bclick)/SUM(aclick)*100,2) as actionRatio
+        FROM ctop_kuaishou_audience_report_daily_client t1
+        where account_id = #{accountId}
+        <if test="startTime != null">
+            AND stat_date &gt;= #{startTime}
+        </if>
+        <if test="endTime != null">
+            AND stat_date &lt;= #{endTime}
+        </if>
+        GROUP BY client
+    </select>
 </mapper>

+ 45 - 6
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouAudienceReportDailyGenderMapper.xml

@@ -1,11 +1,50 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.com.ctop.kuaishou.modules.report.mapper.KuaishouAudienceReportDailyGenderMapper">
-    <select id="queryPageLists" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouAudienceReportDaily">
-        select
-        *
-       from
-        ctop_kuaishou_audience_report_daily_province
+    <select id="queryPageLists" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        account_id,
+        gender,
+        SUM(charge) as charge,
+        SUM(activation) as activation,
+        SUM(event_next_day_stay) as eventNextDayStay,
+        ROUND(SUM(event_next_day_stay)/SUM(activation)*100,2)as eventNextDayStayRatio
+        FROM ctop_kuaishou_audience_report_daily_gender t1
         where account_id = #{accountId}
-      </select>
+        <if test="startTime != null">
+            AND stat_date &gt;= #{startTime}
+        </if>
+        <if test="endTime != null">
+            AND stat_date &lt;= #{endTime}
+        </if>
+        GROUP BY gender
+        <if test="orderType!= null">
+            ORDER BY #{orderType}
+        </if>
+        <if test="upOrDown == 'desc' || upOrDown == 'DESC'">
+            DESC
+        </if>
+    </select>
+
+    <select id="queryAllReportForm" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        stat_date,
+        account_id,
+        gender,
+        SUM(photo_show) as photoShow,
+        SUM(photo_click) as photoClick,
+        SUM(aclick) as aclick,
+        SUM(bclick) as bclick,
+        ROUND(SUM(photo_click)/SUM(photo_show)*100,2) as photoClickRatio,
+        ROUND(SUM(bclick)/SUM(aclick)*100,2) as actionRatio
+        FROM ctop_kuaishou_audience_report_daily_gender t1
+        where account_id = #{accountId}
+        <if test="startTime != null">
+            AND stat_date &gt;= #{startTime}
+        </if>
+        <if test="endTime != null">
+            AND stat_date &lt;= #{endTime}
+        </if>
+        GROUP BY gender
+    </select>
 </mapper>

+ 45 - 6
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouAudienceReportDailyProvinceMapper.xml

@@ -2,11 +2,50 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.com.ctop.kuaishou.modules.report.mapper.KuaishouAudienceReportDailyProvinceMapper">
 
-    <select id="queryPageLists" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouAudienceReportDaily">
-        select
-        *
-       from
-        ctop_kuaishou_audience_report_daily_province
+    <select id="queryPageLists" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        account_id,
+        province,
+        SUM(charge) as charge,
+        SUM(activation) as activation,
+        SUM(event_next_day_stay) as eventNextDayStay,
+        ROUND(SUM(event_next_day_stay)/SUM(activation)*100,2)as eventNextDayStayRatio
+        FROM ctop_kuaishou_audience_report_daily_province t1
         where account_id = #{accountId}
-      </select>
+        <if test="startTime != null">
+            AND stat_date &gt;= #{startTime}
+        </if>
+        <if test="endTime != null">
+            AND stat_date &lt;= #{endTime}
+        </if>
+        GROUP BY province
+        <if test="orderType!= null">
+            ORDER BY #{orderType}
+        </if>
+        <if test="upOrDown == 'desc' || upOrDown == 'DESC'">
+            DESC
+        </if>
+    </select>
+
+    <select id="queryAllReportForm" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        stat_date,
+        account_id,
+        province,
+        SUM(photo_show) as photoShow,
+        SUM(photo_click) as photoClick,
+        SUM(aclick) as aclick,
+        SUM(bclick) as bclick,
+        ROUND(SUM(photo_click)/SUM(photo_show)*100,2) as photoClickRatio,
+        ROUND(SUM(bclick)/SUM(aclick)*100,2) as actionRatio
+        FROM ctop_kuaishou_audience_report_daily_province t1
+        where account_id = #{accountId}
+        <if test="startTime != null">
+            AND stat_date &gt;= #{startTime}
+        </if>
+        <if test="endTime != null">
+            AND stat_date &lt;= #{endTime}
+        </if>
+        GROUP BY province
+    </select>
 </mapper>

+ 13 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouAudienceReportDailyService.java

@@ -2,7 +2,6 @@ package cn.com.ctop.kuaishou.modules.report.service;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouAudienceReportDaily;
-import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.common.api.vo.Result;
 
@@ -24,12 +23,24 @@ public interface IKuaishouAudienceReportDailyService extends IService<KuaishouAu
     void crowdAnalysisReport(CtopOauthToken token, String date, String type, Long plan, Long unit, Integer page, Integer pageSize);
 
     /**
-     * 人群分析报表
+     * 查询人群分析报表
      *
      * @param
+     * @param no
+     * @param type
      * @return java.lang.Long
      * @throws
      * @author ZHAOXA
      */
     Result<Object> queryPageLists(KuaishouAudienceReportDaily audienceReport, Integer pageNo, Integer pageSize, String type);
+
+    /**
+     * 首页报表数据
+     *
+     * @param
+     * @return org.jeecg.common.api.vo.Result<java.lang.Object>
+     * @throws
+     * @author ZHAOXA
+     */
+    Result<Object> queryAllReportForm(KuaishouAudienceReportDaily audienceReport);
 }

+ 43 - 3
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouAudienceReportDailyServiceImpl.java

@@ -65,7 +65,7 @@ public class KuaishouAudienceReportDailyServiceImpl extends ServiceImpl<Kuaishou
     private String urlPath = PropertiesUtils.getConfig("kuaishou_api_url");
 
     /**
-     * 报表分页查询
+     * 报表分页分页查询
      *
      * @param type province: 省级地域分布, city: 地级地域分布,gender: 性别分布,ageSegment: 年龄分布clientId: 系统分布 businessInterestTags: 商业兴趣分布
      * @return org.jeecg.common.api.vo.Result<java.lang.Object>
@@ -80,7 +80,7 @@ public class KuaishouAudienceReportDailyServiceImpl extends ServiceImpl<Kuaishou
         if (null == pageSize || pageSize == 0) {
             pageSize = 10;
         }
-        List<KuaishouAudienceReportDaily> list = null;
+        List<JSONObject> list = null;
         PageHelper.startPage(pageNo, pageSize);
         if ("province".equals(type)) {
             list = provinceMapper.queryPageLists(audienceReport);
@@ -97,11 +97,51 @@ public class KuaishouAudienceReportDailyServiceImpl extends ServiceImpl<Kuaishou
         } else {
             return Result.error("请选择人群报表类型");
         }
-        PageInfo<KuaishouAudienceReportDaily> pageInfo = new PageInfo<>(list);
+        if (Check.isNull(list)) {
+            return Result.error("只能获取到两天前的数据,请正确选择时间");
+        }
+        PageInfo<JSONObject> pageInfo = new PageInfo<>(list);
         return Result.ok(pageInfo);
     }
 
     /**
+     * 首页报表数据
+     *
+     * @param type province: 省级地域分布, city: 地级地域分布,gender: 性别分布,ageSegment: 年龄分布clientId: 系统分布 businessInterestTags: 商业兴趣分布
+     * @return org.jeecg.common.api.vo.Result<java.lang.Object>
+     * @throws
+     * @author ZHAOXA
+     */
+    @Override
+    public Result<Object> queryAllReportForm(KuaishouAudienceReportDaily audienceReport) {
+        JSONObject data = new JSONObject();
+        List<JSONObject> provinces = provinceMapper.queryAllReportForm(audienceReport);
+        if (!Check.isNull(provinces)) {
+            data.put("province", provinces);
+        }
+        List<JSONObject> genders = genderMapper.queryAllReportForm(audienceReport);
+        if (!Check.isNull(genders)) {
+            data.put("gender", genders);
+        }
+        List<JSONObject> ages = ageMapper.queryAllReportForm(audienceReport);
+        if (!Check.isNull(ages)) {
+            data.put("ageSegment", ages);
+        }
+        List<JSONObject> clients = clientMapper.queryAllReportForm(audienceReport);
+        if (!Check.isNull(clients)) {
+            data.put("client", clients);
+        }
+        List<JSONObject> bussiness = bussinessMapper.queryAllReportForm(audienceReport);
+        if (!Check.isNull(bussiness)) {
+            data.put("businessInterestTags", bussiness);
+        }
+        if (data.size() == 0) {
+            return Result.error("只能获取到两天前的数据,请正确选择时间");
+        }
+        return Result.ok(data);
+    }
+
+    /**
      * 人群分析报表入库
      *
      * @param type      province: 省级地域分布, city: 地级地域分布,gender: 性别分布,ageSegment: 年龄分布clientId: 系统分布 businessInterestTags: 商业兴趣分布