|
@@ -54,7 +54,7 @@ public class EbaSystemServiceImpl implements EbaSystemService {
|
|
|
@Value("${comm.getProjectList}")
|
|
|
private String getProjectList;
|
|
|
|
|
|
- private final long SECOND_TIME = 3L;
|
|
|
+ private final long SECOND_TIME = 5L;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -456,10 +456,10 @@ public class EbaSystemServiceImpl implements EbaSystemService {
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
- Integer hjDayCount = (Integer) dayMap.get("hjCount");
|
|
|
- Integer hjMonthCount = (Integer) monthMap.get("hjCount");
|
|
|
- Integer gzDayCount = (Integer) dayMap.get("gzCount");
|
|
|
- Integer gzMonthCount = (Integer) monthMap.get("gzCount");
|
|
|
+ Integer hjDayCount = flag ? (Integer) dayMap.get("hjCount_" + projectId) : (Integer) dayMap.get("hjCount");
|
|
|
+ Integer hjMonthCount = flag ? (Integer) monthMap.get("hjCount_" + projectId) : (Integer) monthMap.get("hjCount");
|
|
|
+ Integer gzDayCount = flag ? (Integer) dayMap.get("gzCount_" + projectId) : (Integer) dayMap.get("gzCount");
|
|
|
+ Integer gzMonthCount = flag ? (Integer) monthMap.get("gzCount_" + projectId) : (Integer) monthMap.get("gzCount");
|
|
|
// 获取去年同时间数据
|
|
|
LocalDateTime previousYear = now.minus(1, ChronoUnit.YEARS);
|
|
|
Map oldMonthMap = mongoTemplate.findById(EbaMessageCode.D.getCode() + "_" + previousYear.getYear() + "_" + previousYear.getMonthValue(), Map.class, "realTimeList");
|
|
@@ -468,10 +468,10 @@ public class EbaSystemServiceImpl implements EbaSystemService {
|
|
|
}
|
|
|
List<Map> oldDayList = (List<Map>) oldMonthMap.get("data");
|
|
|
Map oldDayMap = oldDayList.get(day - 1);
|
|
|
- Integer hjDayCountOld = (Integer) oldDayMap.get("hjCount");
|
|
|
- Integer hjMonthCountOld = (Integer) oldMonthMap.get("hjCount");
|
|
|
- Integer gzDayCountOld = (Integer) oldDayMap.get("gzCount");
|
|
|
- Integer gzMonthCountOld = (Integer) oldMonthMap.get("gzCount");
|
|
|
+ Integer hjDayCountOld = flag ? (Integer) oldDayMap.get("hjCount_" + projectId) : (Integer) oldDayMap.get("hjCount");
|
|
|
+ Integer hjMonthCountOld = flag ? (Integer) oldMonthMap.get("hjCount_" + projectId) : (Integer) oldMonthMap.get("hjCount");
|
|
|
+ Integer gzDayCountOld = flag ? (Integer) oldDayMap.get("gzCount_" + projectId) : (Integer) oldDayMap.get("gzCount");
|
|
|
+ Integer gzMonthCountOld = flag ? (Integer) oldMonthMap.get("gzCount_" + projectId) : (Integer) oldMonthMap.get("gzCount");
|
|
|
return ResponseBuilder.ok(Levi.by("huojing", huojing).set("guzhang", guzhang).set("hjDayCount", hjDayCount).set("hjMonthCount", hjMonthCount).set("gzDayCount", gzDayCount).set("gzMonthCount", gzMonthCount).set("hjDayTb", EbaUtils.getTongBi(hjDayCountOld, hjDayCount)).set("hjMonthTb", EbaUtils.getTongBi(hjMonthCountOld, hjMonthCount)).set("gzDayTb", EbaUtils.getTongBi(gzDayCountOld, gzDayCount)).set("gzMonthTb", EbaUtils.getTongBi(gzMonthCountOld, gzMonthCount)));
|
|
|
}
|
|
|
|
|
@@ -643,4 +643,60 @@ public class EbaSystemServiceImpl implements EbaSystemService {
|
|
|
return ResponseBuilder.ok(PageBean.<Map>builder().total(gzStream.get().count()).row(gzResult).build());
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据文档名称修复火警故障数字
|
|
|
+ *
|
|
|
+ * @param name
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public ResponseBean fixDate(String name) {
|
|
|
+ Map monthMap = mongoTemplate.findById(name, Map.class, "realTimeList");
|
|
|
+ Query query = new Query();
|
|
|
+ query.addCriteria(Criteria.where("_id").is(name));
|
|
|
+ Update update = new Update();
|
|
|
+ List<Map> dayList = (List<Map>) monthMap.get("data");
|
|
|
+ Map<String, Integer> zzz = new HashMap<>(16);
|
|
|
+ dayList.forEach(dayMap -> {
|
|
|
+ List<Map> hourList = (List<Map>) dayMap.get("data");
|
|
|
+ Map<String, Integer> yyy = new HashMap<>(16);
|
|
|
+ hourList.forEach(hourMap -> {
|
|
|
+ List<Map> dataList = (List<Map>) hourMap.get("data");
|
|
|
+ Map<String, Integer> xxx = new HashMap<>(16);
|
|
|
+ for (Map x : dataList) {
|
|
|
+ String projectId = x.get("ProjectId").toString();
|
|
|
+ Integer alarmType = (Integer) x.get("AlarmType");
|
|
|
+ if (alarmType == 1 && xxx.get("hjCount_" + projectId) == null) {
|
|
|
+ xxx.put("hjCount_" + projectId, 1);
|
|
|
+ xxx.put("hjCount", xxx.get("hjCount") == null ? 1 : xxx.get("hjCount") + 1);
|
|
|
+ } else if (alarmType == 1 && xxx.get("hjCount_" + projectId) != null) {
|
|
|
+ xxx.put("hjCount_" + projectId, xxx.get("hjCount_" + projectId) + 1);
|
|
|
+ xxx.put("hjCount", xxx.get("hjCount") == null ? 1 : xxx.get("hjCount") + 1);
|
|
|
+ } else if (alarmType == 2 && xxx.get("gzCount_" + projectId) == null) {
|
|
|
+ xxx.put("gzCount_" + projectId, 1);
|
|
|
+ xxx.put("gzCount", xxx.get("gzCount") == null ? 1 : xxx.get("gzCount") + 1);
|
|
|
+ } else if (alarmType == 2 && xxx.get("gzCount_" + projectId) != null) {
|
|
|
+ xxx.put("gzCount_" + projectId, xxx.get("gzCount_" + projectId) + 1);
|
|
|
+ xxx.put("gzCount", xxx.get("gzCount") == null ? 1 : xxx.get("gzCount") + 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (String key : xxx.keySet()) {
|
|
|
+ hourMap.put(key, xxx.get(key));
|
|
|
+ yyy.put(key, yyy.get(key) == null ? xxx.get(key) : yyy.get(key) + xxx.get(key));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ for (String key : yyy.keySet()) {
|
|
|
+ dayMap.put(key, yyy.get(key));
|
|
|
+ zzz.put(key, zzz.get(key) == null ? yyy.get(key) : zzz.get(key) + yyy.get(key));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ for (String key : zzz.keySet()) {
|
|
|
+ update.set(key, zzz.get(key));
|
|
|
+ }
|
|
|
+ update.set("data", monthMap.get("data"));
|
|
|
+ mongoTemplate.upsert(query, update, "realTimeList");
|
|
|
+ Map xxx = mongoTemplate.findById(name, Map.class, "realTimeList");
|
|
|
+ return ResponseBuilder.ok("修复完成", xxx);
|
|
|
+ }
|
|
|
}
|