Commit 91ee7568 authored by lisong's avatar lisong

Merge remote-tracking branch 'origin/develop_dl_plan6' into develop_dl_plan6

parents aaca5b0b 882a223a
......@@ -14,6 +14,7 @@ import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
......@@ -22,6 +23,7 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.text.ParseException;
import java.util.*;
import java.util.stream.Collectors;
......@@ -173,7 +175,22 @@ public class ConfigureController extends AbstractBaseController {
return CommonResponseUtil.success(null);
}
Page page = new Page<>(commonPageable.getPageNumber(), commonPageable.getPageSize());
return CommonResponseUtil.success(fireFightingSystemMapper.getFireCarInfoByWL(page, bizOrgCode));
Page<Map<String, Object>> fireCarInfoByWL = fireFightingSystemMapper.getFireCarInfoByWL(page, bizOrgCode);
if (!CollectionUtils.isEmpty(fireCarInfoByWL.getRecords())) {
List<Map<String, Object>> records = fireCarInfoByWL.getRecords();
records.forEach(item -> {
if (item.containsKey("carStateDate") && !ObjectUtils.isEmpty(item.get("carStateDate"))) {
try {
Date carStateDate = DateUtils.dateParse(item.get("carStateDate").toString(), "yyyy-MM-dd'T'HH:mm:ss");
String s = DateUtils.dateFormat(carStateDate, DateUtils.DATE_TIME_PATTERN);
item.put("carStateDate", s);
} catch (ParseException e) {
e.printStackTrace();
}
}
});
}
return CommonResponseUtil.success(fireCarInfoByWL);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
......@@ -242,7 +259,7 @@ public class ConfigureController extends AbstractBaseController {
item.put("unNormalNum", (Integer) item.get("startAndStopNum") <= 1 ? 0 : 1);
Map<String, String> stateMap = fireFightingSystemMapper.queryPressureNowStateBySpecificId((Long) item.get("id"));
if (!ObjectUtils.isEmpty(stateMap) && stateMap.containsKey("update_date") && stateMap.containsKey("equipment_index_name")) {
item.put("update_time", stateMap.get("update"));
item.put("update_time", stateMap.get("update_date"));
item.put("equipment_index_name", stateMap.get("equipment_index_name"));
}
return item;
......@@ -303,7 +320,7 @@ public class ConfigureController extends AbstractBaseController {
item.put("unNormalNum", (Integer) item.get("startAndStopNum") <= 1 ? 0 : 1);
Map<String, String> stateMap = fireFightingSystemMapper.queryPressureNowStateBySpecificId((Long) item.get("id"));
if (!ObjectUtils.isEmpty(stateMap) && stateMap.containsKey("update_date") && stateMap.containsKey("equipment_index_name")) {
item.put("update_time", stateMap.get("update"));
item.put("update_time", stateMap.get("update_date"));
item.put("equipment_index_name", stateMap.get("equipment_index_name"));
}
return item;
......
......@@ -670,7 +670,7 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec
List<EquipAlarmLineVo> list = equipmentSpecificAlarmMapper.equipAlarmLine(hashMap);
if (!CollectionUtils.isEmpty(list)) {
LinkedHashSet<String> xAxis = new LinkedHashSet<>();
List<Map<String, LinkedList<Object>>> yAxis = new ArrayList<>();
List<Map<String, Object>> yAxis = new ArrayList<>();
// 取出所有非空indexName
Set<String> indexKNameSet = list.stream().map(EquipAlarmLineVo::getIndexName).filter(StringUtils::isNotBlank).collect(Collectors.toSet());
......@@ -681,7 +681,7 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec
// 迭代器倒序遍历map
String date = null;
for (String indexName : indexKNameSet) {
HashMap<String, LinkedList<Object>> dataMap = new HashMap<>();
HashMap<String, Object> dataMap = new HashMap<>();
LinkedList<Object> yData = new LinkedList<>();
// 解决迭代器遍历一次的问题
ListIterator<Map.Entry<String, List<EquipAlarmLineVo>>> i = new ArrayList<Map.Entry<String, List<EquipAlarmLineVo>>>(sortMap.entrySet()).listIterator(sortMap.size());
......@@ -693,7 +693,7 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec
for (EquipAlarmLineVo vo : value) {
String name = vo.getIndexName();
if (key.equals(date)) {
yData = yAxis.get(i.previousIndex()).get("data");
yData = (LinkedList<Object>) yAxis.get(i.previousIndex()).get("data");
}
if (indexName.equals(name)) {
yData.add(vo.getTotal());
......@@ -705,6 +705,7 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec
date = key;
}
dataMap.put("data", yData);
dataMap.put("name", indexName);
yAxis.add(dataMap);
}
resultMap.put("legend", indexKNameSet);
......
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