|
@@ -31,23 +31,23 @@ public class AlertServiceImpl extends AbstractCrudService<AlertMapper, Alert> im
|
|
|
public Map<String, List<AlertStatisticsVO>> getAlertStatisticsByHouse(Date startTime,Date endTime) {
|
|
|
Map<String, List<AlertStatisticsVO>> typeMap = enhanceList(baseMapper.getCountByHorse(startTime, endTime));
|
|
|
int distanceOfTwoDate = DateUtils.getDistanceOfTwoDateNew(startTime, endTime);
|
|
|
- perfect(typeMap,24,distanceOfTwoDate);
|
|
|
+ perfect(typeMap,24,distanceOfTwoDate,0);
|
|
|
return typeMap;
|
|
|
}
|
|
|
|
|
|
- public void perfect(Map<String, List<AlertStatisticsVO>> typeMap,Integer times,Integer subTime){
|
|
|
+ public void perfect(Map<String, List<AlertStatisticsVO>> typeMap,Integer times,Integer subTime,Integer defaultTime){
|
|
|
for (String type:ALERT_TYPE) {
|
|
|
if (!typeMap.containsKey(type)){
|
|
|
typeMap.put(type,new ArrayList<>());
|
|
|
}
|
|
|
- perfectDate(typeMap.get(type), times,subTime);
|
|
|
+ perfectDate(typeMap.get(type), times,subTime,defaultTime);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void perfectDate(List<AlertStatisticsVO> list,Integer times,Integer subTime){
|
|
|
- for (int i = 1; i <= times; i++) {
|
|
|
+ public void perfectDate(List<AlertStatisticsVO> list,Integer times,Integer subTime,Integer defaultTime){
|
|
|
+ for (int i = defaultTime; i < times; i++) {
|
|
|
int finalI = i;
|
|
|
- AlertStatisticsVO alertStatisticsVO = list.stream()
|
|
|
+ list.stream()
|
|
|
.filter(asv -> Integer.parseInt(asv.getMonth()) == finalI)
|
|
|
.findFirst()
|
|
|
.map(asv -> {
|
|
@@ -59,9 +59,9 @@ public class AlertServiceImpl extends AbstractCrudService<AlertMapper, Alert> im
|
|
|
asv.setMonth(Integer.toString(finalI));
|
|
|
asv.setNumber(0);
|
|
|
asv.setAvg(0.00);
|
|
|
+ list.add(asv);
|
|
|
return asv;
|
|
|
});
|
|
|
- list.add(alertStatisticsVO);
|
|
|
}
|
|
|
list.sort(Comparator.comparingInt(x -> Integer.parseInt(x.getMonth())));
|
|
|
}
|
|
@@ -86,7 +86,7 @@ public class AlertServiceImpl extends AbstractCrudService<AlertMapper, Alert> im
|
|
|
public Map<String, List<AlertStatisticsVO>> getAlertStatisticsByMonth(Date startTime,Date endTime) {
|
|
|
Map<String, List<AlertStatisticsVO>> typeMap = enhanceList(baseMapper.getCountByMonth(startTime, endTime));
|
|
|
int distanceOfTwoDate =Integer.parseInt(DateUtils.getYear(endTime)) - Integer.parseInt(DateUtils.getYear(startTime)) + 1;
|
|
|
- perfect(typeMap,12,distanceOfTwoDate);
|
|
|
+ perfect(typeMap,13,distanceOfTwoDate,1);
|
|
|
return typeMap;
|
|
|
}
|
|
|
|