Commit e99660e2 authored by 高建强's avatar 高建强

item:消防资源概览bug修改

parent a03458d2
......@@ -528,8 +528,8 @@ public class FireFightingSystemController extends AbstractBaseController {
equipmentCategory = equipmentCategoryService.getById(equipmentCategory.getParentId());
}
}
return fireFightingSystemService.getColaCategoryAmountEquList(inhierarchy, equipTypeAmountPage.getEquipmentClassificationCode().replaceAll("0+$", ""), equipTypeAmountPage);
String classificationCode = equipTypeAmountPage.getEquipmentClassificationCode().replaceAll("0+$", "");
return fireFightingSystemService.getColaCategoryAmountEquList(inhierarchy, classificationCode.length() % 2 == 0 ? classificationCode : classificationCode + "0", equipTypeAmountPage);
} else {
if (null != equipTypeAmountPage.getIsDefect() && 1 == equipTypeAmountPage.getIsDefect()) {
ReginParams reginParams = getSelectedOrgInfo();
......
......@@ -51,6 +51,17 @@ public interface IotFeign {
@RequestParam("FHS_PressurePump_Start") String key,
@RequestParam(required = false, value = "fieldKey") String fieldKey);
@RequestMapping(value = "v1/livedata/common/top/single-field", method = RequestMethod.GET, consumes = "application/json")
ResponseModel topSingleField(
@RequestHeader("appKey") String appKey,
@RequestHeader("product") String product,
@RequestHeader("token") String token,
@RequestParam(value = "top") String top,
@RequestParam(value = "productKey") String productKey,
@RequestParam( required = false, value = "deviceName") String deviceName,
@RequestParam("FHS_PressurePump_Start") String key,
@RequestParam(required = false, value = "fieldKey") String fieldKey);
@RequestMapping(value = "v1/livedata/common/list", method = RequestMethod.GET, consumes = "application/json")
ResponseModel selectListNew(
@RequestHeader("appKey") String appKey,
......
......@@ -341,66 +341,35 @@ public class EmergencyServiceImpl implements IEmergencyService {
}
}
}
ResponseModel intervalResponseModel = iotFeign.selectOne(appKey, product, token, "1", prefix, null, null, pressurePumpStart);
String intervalTime = nowStrLong;
ResponseModel intervalResponseModel = iotFeign.topSingleField(appKey, product, token, "10", prefix, null, null, pressurePumpStart);
String intervalTime1 = nowStrLong;
String intervalTime2 = nowStrLong;
String durationTime = nowStrLong;
if (200 == intervalResponseModel.getStatus()) {
String json = JSON.toJSONString(intervalResponseModel.getResult());
List<Map<String, String>> intervalDataList = (List<Map<String, String>>) JSONArray.parse(json);
if (!CollectionUtils.isEmpty(intervalDataList)) {
String value = intervalDataList.get(0).get(pressurePumpStart);
if ("true".equalsIgnoreCase(value)) {
ResponseModel stopResponseModel = iotFeign.selectOne(appKey, product, token, "1", prefix, null, "false", pressurePumpStart);
if (200 == stopResponseModel.getStatus()) {
String stopJson = JSON.toJSONString(stopResponseModel.getResult());
List<Map<String, String>> stopDataList = (List<Map<String, String>>) JSONArray.parse(stopJson);
List<Map<String, String>> collect = stopDataList.stream().filter(o -> o.containsKey("createdTime")).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(collect)) {
intervalTime = collect.get(0).get("createdTime").substring(0, 19);
// 停泵前的前5分钟,判断管网压力状态
try {
String stop5BeforeTime = DateUtils.convertDateToString(DateUtils.dateAddMinutes(DateUtils.convertStrToDate(intervalTime, "yyyy-MM-dd HH:mm:ss"), -5), "yyyy-MM-dd HH:mm:ss");
ResponseModel pipeResponseModel = iotFeign.selectListNew(appKey, product, token, prefix, null, stop5BeforeTime, intervalTime, null, "FHS_PipePressureDetector_PipePressure");
if (200 == pipeResponseModel.getStatus()) {
String pipeJson = JSON.toJSONString(pipeResponseModel.getResult());
List<Map<String, String>> pipeDataList = (List<Map<String, String>>) JSONArray.parse(pipeJson);
List<Map<String, String>> collect1 = pipeDataList.stream().filter(o -> o.containsKey("FHS_PipePressureDetector_PipePressure")).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(collect1)) {
int val1 = Integer.parseInt(collect1.get(0).get("FHS_PipePressureDetector_PipePressure"));
int val2 = Integer.parseInt(collect1.get(pipeDataList.size() - 1).get("FHS_PipePressureDetector_PipePressure"));
pipeMap.put("value", (val1 - val2) > 0.05 ? "异常" : "正常");
}
}
} catch (ParseException e) {
throw new RuntimeException(e);
}
}
}
ResponseModel startResponseModel = iotFeign.selectOne(appKey, product, token, "2", prefix, null, "true", pressurePumpStart);
if (200 == startResponseModel.getStatus()) {
String startJson = JSON.toJSONString(startResponseModel.getResult());
List<Map<String, String>> startDataList = (List<Map<String, String>>) JSONArray.parse(startJson);
List<Map<String, String>> collect = startDataList.stream().filter(o -> o.containsKey("createdTime")).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(collect) && collect.size() > 1) {
durationTime = collect.get(1).get("createdTime").substring(0, 19).replace("T", " ");
List<Map<String, String>> falseDataList = intervalDataList.stream().filter(x -> x.containsKey("createdTime") && "false".equalsIgnoreCase(x.get(pressurePumpStart))).collect(Collectors.toList());
List<Map<String, String>> trueDataList = intervalDataList.stream().filter(x -> x.containsKey("createdTime") && "true".equalsIgnoreCase(x.get(pressurePumpStart))).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(falseDataList) && !CollectionUtils.isEmpty(trueDataList)) {
intervalTime1 = falseDataList.get(0).get("createdTime");
intervalTime2 = trueDataList.get(0).get("createdTime");
}
if ("true".equalsIgnoreCase(value)) {
if (!CollectionUtils.isEmpty(trueDataList)) {
durationTime = intervalTime2;
}
} else {
ResponseModel startResponseModel = iotFeign.selectOne(appKey, product, token, "1", prefix, null, "true", pressurePumpStart);
if (200 == startResponseModel.getStatus()) {
String startJson = JSON.toJSONString(startResponseModel.getResult());
List<Map<String, String>> startDataList = (List<Map<String, String>>) JSONArray.parse(startJson);
List<Map<String, String>> collect = startDataList.stream().filter(o -> o.containsKey("createdTime")).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(collect)) {
intervalTime = collect.get(0).get("createdTime").substring(0, 19);
durationTime = intervalTime;
}
if (!CollectionUtils.isEmpty(falseDataList) && !CollectionUtils.isEmpty(trueDataList)) {
durationTime = trueDataList.get(0).get("createdTime");
nowStrLong = falseDataList.get(0).get("createdTime");
}
}
}
}
intervalMap.put("value", DateUtils.getDurationMinutes(intervalTime, nowStrLong, "yyyy-MM-dd HH:mm:ss"));
durationlMap.put("value", DateUtils.getDurationMinutes(durationTime, nowStrLong, "yyyy-MM-dd HH:mm:ss"));
intervalMap.put("value", Math.abs(DateUtils.getDurationMinutes(intervalTime1, intervalTime2, "yyyy-MM-dd HH:mm:ss")));
durationlMap.put("value", Math.abs(DateUtils.getDurationMinutes(durationTime, nowStrLong, "yyyy-MM-dd HH:mm:ss")));
} else {
intervalMap.put("value", 0);
durationlMap.put("value", 0);
......
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