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

完善结构真实数据

parent dbaa4156
......@@ -14,10 +14,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
@Controller
@RequestMapping("logstatistics")
......@@ -106,6 +103,12 @@ public class LogStatisticsController {
if (clientId != null){
param.put("clientId",clientId);
}
if (null != year){
param.put("year", year);
}
if (null != month){
param.put("yearMonth", month);
}
List<StatItem> browserResult = new ArrayList<>();
List<String> browserList = authLogService.distinct("browser", param);
......@@ -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) {
Map<String, Object> result = new HashMap<>();
result.put("all_auth", 1500000);
result.put("cas_edu_auth", 100000);
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);
}
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<>();
StatItem item1 = new StatItem();
item1.setName("黄浦区");
item1.setCount(1000);
StatItem item2 = new StatItem();
item2.setName("青浦区");
item2.setCount(1000);
browserResult.add(item1);
browserResult.add(item2);
for (String area : areas) {
StatItem item = new StatItem();
item.setName(area);
if (area.equals("青浦")){
param.put("oauthType","qpjy");
long qpjy = authLogService.count(param);
item.setCount(qpjy);
}
browserResult.add(item);
}
result.put("area_auth", browserResult);
return MapMessage.successMessage().add("data", result);
}
......@@ -181,6 +203,21 @@ public class LogStatisticsController {
@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) {
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<>();
StatItem item1 = new StatItem();
item1.setName("2020-01");
......@@ -205,13 +242,30 @@ public class LogStatisticsController {
@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) {
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<>();
StatItem item1 = new StatItem();
item1.setName("老师");
item1.setCount(1000);
item1.setCount(teacherCount);
StatItem item2 = new StatItem();
item2.setName("学生");
item2.setCount(1000);
item2.setCount(studentCount);
result.add(item1);
result.add(item2);
return MapMessage.successMessage().add("data", result);
......@@ -228,16 +282,33 @@ public class LogStatisticsController {
@RequestMapping("auth_hot_org")
@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) {
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<>();
StatItem item1 = new StatItem();
item1.setName("A学校");
item1.setCount(1000);
StatItem item2 = new StatItem();
item2.setName("B学校");
item2.setCount(1000);
result.add(item1);
result.add(item2);
if (CollectionUtils.isNotEmpty(schoolNames)){
schoolNames.forEach(name -> {
param.put("logUserInfo.schoolName",name);
long count = authLogService.count(param);
StatItem item = new StatItem();
item.setCount(count);
item.setName(name);
result.add(item);
});
}
result.sort(Comparator.comparing(StatItem::getCount).reversed());
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