|
|
@@ -95,7 +95,7 @@ public class DataService implements IDataService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<SceneTrendVoList> sceneTrend(SceneTotalParam param) {
|
|
|
+ public List<SceneTrendVo> sceneTrend(SceneTotalParam param) {
|
|
|
commonSetParam(param);
|
|
|
|
|
|
List<String> datesStr = new ArrayList<>();
|
|
|
@@ -106,33 +106,23 @@ public class DataService implements IDataService {
|
|
|
}
|
|
|
HashMap<String,Long> sceneMap = new HashMap<>();
|
|
|
HashMap<String,Long> userMap = new HashMap<>();
|
|
|
- datesStr.forEach(e ->sceneMap.put(e,0L));
|
|
|
- datesStr.forEach(e ->userMap.put(e,0L));
|
|
|
|
|
|
List<GroupByCountVo> groupByCounts = dataMapper.getSceneGroupByDay(param);
|
|
|
groupByCounts.forEach(e ->sceneMap.put(e.getGroupKey(),e.getTotalCount()));
|
|
|
|
|
|
List<GroupByCountVo> userCount = dataMapper.getUserGroupByDay(param);
|
|
|
- userCount.forEach(e ->userMap.put(e.getGroupKey(),userMap.get(e.getGroupKey() +1)));
|
|
|
-
|
|
|
- List<GroupByCountVo> sceneList = new ArrayList<>();
|
|
|
- for (String key : sceneMap.keySet()) {
|
|
|
- sceneList.add(new GroupByCountVo(key,sceneMap.get(key)));
|
|
|
+ for (GroupByCountVo groupByCountVo : userCount) {
|
|
|
+ if(userMap.get(groupByCountVo.getGroupKey()) != null){
|
|
|
+ userMap.put(groupByCountVo.getGroupKey(), userMap.get(groupByCountVo.getGroupKey()) +1);
|
|
|
+ }else {
|
|
|
+ userMap.put(groupByCountVo.getGroupKey(),1L);
|
|
|
+ }
|
|
|
}
|
|
|
- List<GroupByCountVo> userList = new ArrayList<>();
|
|
|
- for (String key : userMap.keySet()) {
|
|
|
- userList.add(new GroupByCountVo(key,userMap.get(key)));
|
|
|
+ List<SceneTrendVo> reList = new ArrayList<>();
|
|
|
+ for (String key : datesStr) {
|
|
|
+ reList.add(new SceneTrendVo(key,userMap.get(key),sceneMap.get(key)));
|
|
|
}
|
|
|
|
|
|
- List<SceneTrendVoList> reList = new ArrayList<>();
|
|
|
- SceneTrendVoList sceneTrendVoList = new SceneTrendVoList();
|
|
|
- sceneTrendVoList.setType("scene");
|
|
|
- sceneTrendVoList.setList(sceneList);
|
|
|
- reList.add(sceneTrendVoList);
|
|
|
- SceneTrendVoList sceneTrendVoList2 = new SceneTrendVoList();
|
|
|
- sceneTrendVoList2.setType("user");
|
|
|
- sceneTrendVoList2.setList(userList);
|
|
|
- reList.add(sceneTrendVoList2);
|
|
|
return reList;
|
|
|
}
|
|
|
|