Commit 17f29119 by tyfanchz

用户控制台总览统计

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