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

fixed

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