Commit 541dc37a authored by maoying's avatar maoying

Merge branch 'develop_dl_plan6' of http://39.98.45.134:8090/moa/amos-boot-biz into develop_dl_plan6

parents 24ec5e40 ec6ec8ed
......@@ -312,7 +312,7 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
*
* @return
*/
Map<String, Object> getFireSystemInfo(HashMap<String, Object> hashMap);
List<Map<String, Object>> getFireSystemInfo(HashMap<String, Object> hashMap);
/**
* 获取系统近一月告警设备top5
......
......@@ -672,7 +672,7 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec
LinkedHashSet<String> xAxis = new LinkedHashSet<>();
List<Map<String, Object>> yAxis = new ArrayList<>();
// 取出所有非空indexName
// 取出所有非空indexNamesortMap = {TreeMap@15960} size = 7
Set<String> indexKNameSet = list.stream().map(EquipAlarmLineVo::getIndexName).filter(StringUtils::isNotBlank).collect(Collectors.toSet());
Map<String, List<EquipAlarmLineVo>> dateCollect = list.stream().collect(Collectors.groupingBy(EquipAlarmLineVo::getDate));
Map<String, List<EquipAlarmLineVo>> sortMap = new TreeMap<>((o1, o2) -> o2.compareTo(o1));
......@@ -680,33 +680,32 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec
// 迭代器倒序遍历map
String date = null;
for (String indexName : indexKNameSet) {
HashSet<String> dateSet = new HashSet<>();
for (int i = 0; i < indexKNameSet.size(); i++) {
HashMap<String, Object> dataMap = new HashMap<>();
LinkedList<Object> yData = new LinkedList<>();
dataMap.put("data", yData);
yAxis.add(dataMap);
}
int index = 0;
for (String indexName : indexKNameSet) {
HashMap<String, Object> dataMap = (HashMap<String, Object>) yAxis.get(index++);
LinkedList<Object> yData = (LinkedList<Object>) dataMap.get("data");
// 解决迭代器遍历一次的问题
ListIterator<Map.Entry<String, List<EquipAlarmLineVo>>> i = new ArrayList<Map.Entry<String, List<EquipAlarmLineVo>>>(sortMap.entrySet()).listIterator(sortMap.size());
while (i.hasPrevious()) {
Map.Entry<String, List<EquipAlarmLineVo>> entry = i.previous();
String key = entry.getKey();
List<EquipAlarmLineVo> value = entry.getValue();
for (EquipAlarmLineVo vo : value) {
String name = vo.getIndexName();
if (key.equals(date)) {
yData = (LinkedList<Object>) yAxis.get(i.previousIndex()).get("data");
}
if (indexName.equals(name)) {
yData.add(vo.getTotal());
List<EquipAlarmLineVo> collect = entry.getValue().stream().filter(x -> indexName.equals(x.getIndexName())).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(collect)) {
yData.add(collect.get(0).getTotal());
} else {
yData.add(0);
}
}
xAxis.add(key.substring(5));
date = key;
}
dataMap.put("data", yData);
dataMap.put("name", indexName);
yAxis.add(dataMap);
}
resultMap.put("legend", indexKNameSet);
resultMap.put("axisData", xAxis);
......
......@@ -1265,10 +1265,10 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
@Override
public Map<String, Object> getSystemStatus(HashMap<String, Object> hashMap) {
Map<String, Object> resultMap = new HashMap<>();
Map<String, Object> map = fireFightingSystemMapper.getFireSystemInfo(hashMap);
List<Map<String, Object>> map = fireFightingSystemMapper.getFireSystemInfo(hashMap);
if (!map.isEmpty()) {
ArrayList<Object> status = new ArrayList<>();
status.add(map.get("status"));
status.add(map.get(0).get("status"));
resultMap.put("values", status);
resultMap.put("labels", status);
}
......@@ -1278,9 +1278,9 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
@Override
public Map<String, Object> getSystemName(HashMap<String, Object> hashMap) {
Map<String, Object> resultMap = new HashMap<>();
Map<String, Object> map = fireFightingSystemMapper.getFireSystemInfo(hashMap);
List<Map<String, Object>> map = fireFightingSystemMapper.getFireSystemInfo(hashMap);
if (!map.isEmpty()) {
resultMap.put("name", map.get("name"));
resultMap.put("name", map.get(0).get("name"));
}
return resultMap;
}
......
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