Commit ef192cbc authored by 喻春霖's avatar 喻春霖

完善结构真实数据

parent dbaa4156
...@@ -14,10 +14,7 @@ import org.springframework.web.bind.annotation.RequestParam; ...@@ -14,10 +14,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller @Controller
@RequestMapping("logstatistics") @RequestMapping("logstatistics")
...@@ -106,6 +103,12 @@ public class LogStatisticsController { ...@@ -106,6 +103,12 @@ public class LogStatisticsController {
if (clientId != null){ if (clientId != null){
param.put("clientId",clientId); param.put("clientId",clientId);
} }
if (null != year){
param.put("year", year);
}
if (null != month){
param.put("yearMonth", month);
}
List<StatItem> browserResult = new ArrayList<>(); List<StatItem> browserResult = new ArrayList<>();
List<String> browserList = authLogService.distinct("browser", param); List<String> browserList = authLogService.distinct("browser", param);
...@@ -154,18 +157,37 @@ public class LogStatisticsController { ...@@ -154,18 +157,37 @@ public class LogStatisticsController {
public MapMessage auths(@RequestParam(value = "clientId", required = false) String clientId, @RequestParam(value = "year", required = false) Integer year, @RequestParam(value = "month", required = false) Integer month) { public MapMessage auths(@RequestParam(value = "clientId", required = false) String clientId, @RequestParam(value = "year", required = false) Integer year, @RequestParam(value = "month", required = false) Integer month) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
result.put("all_auth", 1500000); Map<String,Object> param = new HashMap<>();
result.put("cas_edu_auth", 100000); param.put("getUserInfoSuccessFlag", true);
if (clientId != null){
param.put("clientId",clientId);
}
if (null != year){
param.put("year", year);
}
if (null != month){
param.put("yearMonth", month);
}
long all_auth = authLogService.count(param);
result.put("all_auth", all_auth);
param.put("oauthType","dianjiaoguan");
long cas_edu_auth = authLogService.count(param);
result.put("cas_edu_auth", cas_edu_auth);
List<StatItem> browserResult = new ArrayList<>(); List<StatItem> browserResult = new ArrayList<>();
StatItem item1 = new StatItem(); for (String area : areas) {
item1.setName("黄浦区"); StatItem item = new StatItem();
item1.setCount(1000); item.setName(area);
StatItem item2 = new StatItem(); if (area.equals("青浦")){
item2.setName("青浦区"); param.put("oauthType","qpjy");
item2.setCount(1000); long qpjy = authLogService.count(param);
browserResult.add(item1); item.setCount(qpjy);
browserResult.add(item2); }
browserResult.add(item);
}
result.put("area_auth", browserResult); result.put("area_auth", browserResult);
return MapMessage.successMessage().add("data", result); return MapMessage.successMessage().add("data", result);
} }
...@@ -181,6 +203,21 @@ public class LogStatisticsController { ...@@ -181,6 +203,21 @@ public class LogStatisticsController {
@ResponseBody @ResponseBody
public MapMessage authPickTimes(@RequestParam(value = "clientId", required = false) String clientId, @RequestParam(value = "year", required = false) Integer year, @RequestParam(value = "month", required = false) Integer month) { public MapMessage authPickTimes(@RequestParam(value = "clientId", required = false) String clientId, @RequestParam(value = "year", required = false) Integer year, @RequestParam(value = "month", required = false) Integer month) {
Map<String,Object> param = new HashMap<>();
param.put("getUserInfoSuccessFlag", true);
if (clientId != null){
param.put("clientId",clientId);
}
if (null != year){
param.put("year", year);
}
if (null != month){
param.put("yearMonth", month);
}
List<StatItem> result = new ArrayList<>(); List<StatItem> result = new ArrayList<>();
StatItem item1 = new StatItem(); StatItem item1 = new StatItem();
item1.setName("2020-01"); item1.setName("2020-01");
...@@ -205,13 +242,30 @@ public class LogStatisticsController { ...@@ -205,13 +242,30 @@ public class LogStatisticsController {
@ResponseBody @ResponseBody
public MapMessage authUserTypes(@RequestParam(value = "clientId", required = false) String clientId, @RequestParam(value = "year", required = false) Integer year, @RequestParam(value = "month", required = false) Integer month) { public MapMessage authUserTypes(@RequestParam(value = "clientId", required = false) String clientId, @RequestParam(value = "year", required = false) Integer year, @RequestParam(value = "month", required = false) Integer month) {
Map<String,Object> param = new HashMap<>();
param.put("getUserInfoSuccessFlag", true);
if (clientId != null){
param.put("clientId",clientId);
}
if (null != year){
param.put("year", year);
}
if (null != month){
param.put("yearMonth", month);
}
param.put("logUserInfo.userType","TEACHER");
long teacherCount = authLogService.count(param);
param.put("logUserInfo.userType","STUDENT");
long studentCount = authLogService.count(param);
List<StatItem> result = new ArrayList<>(); List<StatItem> result = new ArrayList<>();
StatItem item1 = new StatItem(); StatItem item1 = new StatItem();
item1.setName("老师"); item1.setName("老师");
item1.setCount(1000); item1.setCount(teacherCount);
StatItem item2 = new StatItem(); StatItem item2 = new StatItem();
item2.setName("学生"); item2.setName("学生");
item2.setCount(1000); item2.setCount(studentCount);
result.add(item1); result.add(item1);
result.add(item2); result.add(item2);
return MapMessage.successMessage().add("data", result); return MapMessage.successMessage().add("data", result);
...@@ -228,16 +282,33 @@ public class LogStatisticsController { ...@@ -228,16 +282,33 @@ public class LogStatisticsController {
@RequestMapping("auth_hot_org") @RequestMapping("auth_hot_org")
@ResponseBody @ResponseBody
public MapMessage authHotOrgs(@RequestParam(value = "clientId", required = false) String clientId, @RequestParam(value = "year", required = false) Integer year, @RequestParam(value = "month", required = false) Integer month) { public MapMessage authHotOrgs(@RequestParam(value = "clientId", required = false) String clientId, @RequestParam(value = "year", required = false) Integer year, @RequestParam(value = "month", required = false) Integer month) {
Map<String,Object> param = new HashMap<>();
param.put("getUserInfoSuccessFlag", true);
if (clientId != null){
param.put("clientId",clientId);
}
if (null != year){
param.put("year", year);
}
if (null != month){
param.put("yearMonth", month);
}
List<String> schoolNames = authLogService.distinct("logUserInfo.schoolName", param);
List<StatItem> result = new ArrayList<>(); List<StatItem> result = new ArrayList<>();
StatItem item1 = new StatItem(); if (CollectionUtils.isNotEmpty(schoolNames)){
item1.setName("A学校"); schoolNames.forEach(name -> {
item1.setCount(1000); param.put("logUserInfo.schoolName",name);
StatItem item2 = new StatItem(); long count = authLogService.count(param);
item2.setName("B学校");
item2.setCount(1000); StatItem item = new StatItem();
result.add(item1); item.setCount(count);
result.add(item2); item.setName(name);
result.add(item);
});
}
result.sort(Comparator.comparing(StatItem::getCount).reversed());
return MapMessage.successMessage().add("data", result); return MapMessage.successMessage().add("data", result);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment