|
@@ -392,7 +392,13 @@ public class EbaSystemServiceImpl implements EbaSystemService {
|
|
|
List<String> collect = data.values().stream().map(x -> (String) x).distinct().collect(Collectors.toList());
|
|
|
if (data != null) {
|
|
|
for (String p : collect) {
|
|
|
+ String projectName = EbaUtils.project.getJSONObject(p) == null ? "" : EbaUtils.project.getJSONObject(p).getString("projectName");
|
|
|
if (obj.getJSONObject("data") != null && obj.getJSONObject("data").getJSONArray(p) != null) {
|
|
|
+ JSONArray xxx = obj.getJSONObject("data").getJSONArray(p);
|
|
|
+ xxx.stream().forEach(xx -> {
|
|
|
+ Map xObj = (Map) xx;
|
|
|
+ xObj.put("ProjectName", projectName);
|
|
|
+ });
|
|
|
array.addAll(obj.getJSONObject("data").getJSONArray(p));
|
|
|
}
|
|
|
}
|
|
@@ -737,4 +743,41 @@ public class EbaSystemServiceImpl implements EbaSystemService {
|
|
|
mongoTemplate.upsert(query, update, "realTimeList");
|
|
|
return ResponseBuilder.ok("累计修复" + count + "天成功");
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 清除某个项目所有实时火警历史数据
|
|
|
+ *
|
|
|
+ * @param name
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public ResponseBean delRealTimeByName(String name) {
|
|
|
+ List<Map> realTimeList = mongoTemplate.findAll(Map.class, "realTimeList");
|
|
|
+ List<Map> ids = realTimeList.stream().filter(x -> x.get("_id").toString().contains("1003_")).collect(Collectors.toList());
|
|
|
+ ids.forEach(monthMap -> {
|
|
|
+ Query query = new Query();
|
|
|
+ query.addCriteria(Criteria.where("_id").is(monthMap.get("_id").toString()));
|
|
|
+ Update update = new Update();
|
|
|
+ List<Map> dayList = (List<Map>) monthMap.get("data");
|
|
|
+ dayList.forEach(dayMap -> {
|
|
|
+ List<Map> hourList = (List<Map>) dayMap.get("data");
|
|
|
+ hourList.forEach(hourMap -> {
|
|
|
+ List<Map> dataList = (List<Map>) hourMap.get("data");
|
|
|
+ Iterator<Map> it = dataList.iterator();
|
|
|
+ while (it.hasNext()) {
|
|
|
+ Map x = it.next();
|
|
|
+ String projectId = x.get("ProjectId").toString();
|
|
|
+ String projectName = x.get("ProjectName").toString();
|
|
|
+ if (projectId.equals(name) || projectName.equals(name)) {
|
|
|
+ it.remove();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ update.set("data", monthMap.get("data"));
|
|
|
+ mongoTemplate.upsert(query, update, "realTimeList");
|
|
|
+ });
|
|
|
+ Map xxx = mongoTemplate.findById(name, Map.class, "realTimeList");
|
|
|
+ return ResponseBuilder.ok("删除完成", xxx);
|
|
|
+ }
|
|
|
}
|