Commit 17f29119 by tyfanchz

用户控制台总览统计

1 parent 7eb234b8
package com.glsx.controller; package com.glsx.controller;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.glsx.service.ApiCallMgrService; import com.glsx.service.ApiCallMgrService;
import com.glsx.service.AppDownloadMgrService; import com.glsx.service.AppDownloadMgrService;
...@@ -118,22 +117,22 @@ public class IndexController { ...@@ -118,22 +117,22 @@ public class IndexController {
@RequestMapping(value = "/getUcDeviceActivationStatistic", method = RequestMethod.GET) @RequestMapping(value = "/getUcDeviceActivationStatistic", method = RequestMethod.GET)
public R getUcDeviceActivationStatistic(String customerName) { public R getUcDeviceActivationStatistic(String customerName) {
List<Map<String, Integer>> statisticList = this.indexService Map<String, Integer> statisticMap = this.indexService
.getUcDeviceActivationStatistic(customerName); .getUcDeviceActivationStatistic(customerName);
return R.ok().data(statisticList); return R.ok().data(statisticMap);
} }
@RequestMapping(value = "/getUcUserActivityStatistic", method = RequestMethod.GET) @RequestMapping(value = "/getUcUserActivityStatistic", method = RequestMethod.GET)
public R getUcUserActivityStatistic(String customerName) { public R getUcUserActivityStatistic(String customerName) {
List<Map<String, Integer>> statisticList = this.indexService Map<String, Integer> statisticMap = this.indexService
.getUcUserActivityStatistic(customerName); .getUcUserActivityStatistic(customerName);
return R.ok().data(statisticList); return R.ok().data(statisticMap);
} }
@RequestMapping(value = "/getUcAppDownloadStatistic", method = RequestMethod.GET) @RequestMapping(value = "/getUcAppDownloadStatistic", method = RequestMethod.GET)
public R getUcAppDownloadStatistic(String customerName) { public R getUcAppDownloadStatistic(String customerName) {
List<Map<String, Integer>> statisticList = this.indexService Map<String, Integer> statisticMap = this.indexService
.getUcAppDownloadStatistic(customerName); .getUcAppDownloadStatistic(customerName);
return R.ok().data(statisticList); return R.ok().data(statisticMap);
} }
} }
package com.glsx.service; package com.glsx.service;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
...@@ -13,9 +12,9 @@ import java.util.Map; ...@@ -13,9 +12,9 @@ import java.util.Map;
public interface IndexService { public interface IndexService {
Map<String, Integer> getUcSummaryStatistic(String customerName); Map<String, Integer> getUcSummaryStatistic(String customerName);
List<Map<String, Integer>> getUcDeviceActivationStatistic(String customerName); Map<String, Integer> getUcDeviceActivationStatistic(String customerName);
List<Map<String, Integer>> getUcUserActivityStatistic(String customerName); Map<String, Integer> getUcUserActivityStatistic(String customerName);
List<Map<String, Integer>> getUcAppDownloadStatistic(String customerName); Map<String, Integer> getUcAppDownloadStatistic(String customerName);
} }
package com.glsx.service.impl; package com.glsx.service.impl;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -49,36 +48,36 @@ public class IndexServiceImpl implements IndexService { ...@@ -49,36 +48,36 @@ public class IndexServiceImpl implements IndexService {
} }
@Override @Override
public List<Map<String, Integer>> getUcDeviceActivationStatistic(String customerName) { public Map<String, Integer> getUcDeviceActivationStatistic(String customerName) {
List<Map<String, Integer>> statisticList; Map<String, Integer> statisticMap;
List<Map<String, Object>> columnList = this.deviceMapper.getDeviceActivationStatistic( List<Map<String, Object>> columnList = this.deviceMapper.getDeviceActivationStatistic(
this.getStatisticStartTime(), this.getStatisticEndTime(), this.getStatisticStartTime(), this.getStatisticEndTime(),
customerName); customerName);
statisticList = this.convertColumnToMap(columnList, "activateTime", "count"); statisticMap = this.convertColumnToMap(columnList);
return statisticList; return statisticMap;
} }
@Override @Override
public List<Map<String, Integer>> getUcUserActivityStatistic(String customerName) { public Map<String, Integer> getUcUserActivityStatistic(String customerName) {
List<Map<String, Integer>> statisticList; Map<String, Integer> statisticMap;
List<Map<String, Object>> columnList = this.userMapper.getUserActivityStatistic( List<Map<String, Object>> columnList = this.userMapper.getUserActivityStatistic(
this.getStatisticStartTime(), this.getStatisticEndTime(), this.getStatisticStartTime(), this.getStatisticEndTime(),
customerName); customerName);
statisticList = this.convertColumnToMap(columnList, "lastLoginTime", "count"); statisticMap = this.convertColumnToMap(columnList);
return statisticList; return statisticMap;
} }
@Override @Override
public List<Map<String, Integer>> getUcAppDownloadStatistic(String customerName) { public Map<String, Integer> getUcAppDownloadStatistic(String customerName) {
List<Map<String, Integer>> statisticList; Map<String, Integer> statisticMap;
List<Map<String, Object>> columnList = this.appDownloadMapper.getAppDownloadStatistic( List<Map<String, Object>> columnList = this.appDownloadMapper.getAppDownloadStatistic(
this.getStatisticStartTime(), this.getStatisticEndTime(), this.getStatisticStartTime(), this.getStatisticEndTime(),
customerName); customerName);
statisticList = this.convertColumnToMap(columnList, "appDownloadTime", "count"); statisticMap = this.convertColumnToMap(columnList);
return statisticList; return statisticMap;
} }
private Date getStatisticStartTime() { private Date getStatisticStartTime() {
...@@ -89,16 +88,13 @@ public class IndexServiceImpl implements IndexService { ...@@ -89,16 +88,13 @@ public class IndexServiceImpl implements IndexService {
return DateUtil.offsetDay(DateUtil.beginOfDay(new Date()), -31); return DateUtil.offsetDay(DateUtil.beginOfDay(new Date()), -31);
} }
private List<Map<String, Integer>> convertColumnToMap(List<Map<String, Object>> columnList, private Map<String, Integer> convertColumnToMap(List<Map<String, Object>> columnList) {
String key, String value) { Map<String, Integer> statisticMap = new HashMap<>();
List<Map<String, Integer>> statisticList = new ArrayList<>();
for (Map<String, Object> columnMap : columnList) { for (Map<String, Object> columnMap : columnList) {
Map<String, Integer> statisticMap = new HashMap<>(); statisticMap.put((String) columnMap.get("time"), (Integer) columnMap.get("count"));
statisticMap.put((String) columnMap.get(key), (Integer) columnMap.get(value));
statisticList.add(statisticMap);
} }
return statisticList; return statisticMap;
} }
} }
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
</select> </select>
<select id="getAppDownloadStatistic" resultType="map"> <select id="getAppDownloadStatistic" resultType="map">
select date_format(pad.create_time, '%Y-%m-%d') `appDownloadTime`, select date_format(pad.create_time, '%Y-%m-%d') `time`,
count(pad.create_time) `count` count(pad.create_time) `count`
from t_platform_app_download pad from t_platform_app_download pad
left join t_platform_customer pc on pc.id = pad.customer_id left join t_platform_customer pc on pc.id = pad.customer_id
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
and pc.customer_name = #{customerName,jdbcType=VARCHAR} and pc.customer_name = #{customerName,jdbcType=VARCHAR}
</if> </if>
</where> </where>
group by appDownloadTime group by time
</select> </select>
......
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
</select> </select>
<select id="getDeviceActivationStatistic" resultType="map"> <select id="getDeviceActivationStatistic" resultType="map">
select date_format(pd.activat_time, '%Y-%m-%d') `activateTime`, select date_format(pd.activat_time, '%Y-%m-%d') `time`,
count(pd.activat_time) `count` count(pd.activat_time) `count`
from t_platform_device pd from t_platform_device pd
left join t_platform_customer pc on pc.id = pd.customer_id left join t_platform_customer pc on pc.id = pd.customer_id
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
and pc.customer_name = #{customerName,jdbcType=VARCHAR} and pc.customer_name = #{customerName,jdbcType=VARCHAR}
</if> </if>
</where> </where>
group by activateTime group by time
</select> </select>
......
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
</select> </select>
<select id="getUserActivityStatistic" resultType="map"> <select id="getUserActivityStatistic" resultType="map">
select date_format(pu.last_login_time, '%Y-%m-%d') `lastLoginTime`, select date_format(pu.last_login_time, '%Y-%m-%d') `time`,
count(pu.last_login_time) `count` count(pu.last_login_time) `count`
from t_platform_user pu from t_platform_user pu
left join t_platform_customer pc on pc.id = pu.customer_id left join t_platform_customer pc on pc.id = pu.customer_id
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
and pc.customer_name = #{customerName,jdbcType=VARCHAR} and pc.customer_name = #{customerName,jdbcType=VARCHAR}
</if> </if>
</where> </where>
group by lastLoginTime group by time
</select> </select>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!