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

fixed

parent 09e04b77
......@@ -111,19 +111,29 @@ public class LogStatisticsController {
if (null != month){
param.put("yearMonth", month);
}
long all_auth = authLogService.count(param);
List<StatItem> browserResult = new ArrayList<>();
List<String> browserList = authLogService.distinct("browser", param);
long unknownBrowser = all_auth;
if (CollectionUtils.isNotEmpty(browserList)){
browserList.forEach(item -> {
for (String item : browserList) {
param.put("browser",item);
long count = authLogService.count(param);
StatItem statItem = new StatItem();
statItem.setName(item);
statItem.setCount(count);
unknownBrowser = unknownBrowser - count;
browserResult.add(statItem);
});
}
}
if (unknownBrowser > 0){
StatItem statItem = new StatItem();
statItem.setName("unknown");
statItem.setCount(unknownBrowser);
browserResult.add(statItem);
}
result.put("browser", browserResult);
......@@ -132,15 +142,25 @@ public class LogStatisticsController {
param.remove("browser");
List<String> osList = authLogService.distinct("os", param);
long unknownOs = all_auth;
if (CollectionUtils.isNotEmpty(osList)){
osList.forEach(item -> {
for (String item : osList) {
param.put("os",item);
long count = authLogService.count(param);
StatItem statItem = new StatItem();
statItem.setName(item);
statItem.setCount(count);
osResult.add(statItem);
});
unknownOs = unknownOs - count;
}
}
if (unknownOs > 0){
StatItem statItem = new StatItem();
statItem.setName("unknown");
statItem.setCount(unknownOs);
osResult.add(statItem);
}
result.put("os", osResult);
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