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

item:稳压泵冗余业务删除

parent 771b4c4c
......@@ -263,7 +263,6 @@ public class EmergencyServiceImpl implements IEmergencyService {
duration = pressurePumpService.getAllPressurePumpStartStopDuration(redisDataList, null, nowStrLong, bizOrgCode);
// 6. 管网压力状态
pressureDiff = pressurePumpService.getAllPressurePumpPipePressureDiff(redisDataList, redisDataPipeList, null, null, nowStrLong, PressurePumpRelateEnum.PRESSURE_PUMP_START_BEFORE_MINUTE.getValue());
} else {
String top = map.get("top").toString();
// 通过 equipmentCode 获取装备
......@@ -413,247 +412,6 @@ public class EmergencyServiceImpl implements IEmergencyService {
return map;
}
// @Override
// public Map<String, Object> getPressurePumpStatusChart(String equipmentCode, String startTime, String endTime, String bizOrgCode, String appKey, String product, String token) {
// Map<String, Object> map = new LinkedHashMap<>();
// // 获取稳压泵
// List<Map<String, Object>> list = equipmentSpecificSerivce.getListByEquipmentCode(equipmentCode, bizOrgCode);
// // 获取各稳压泵数据,及时间戳
// if (!CollectionUtils.isEmpty(list)) {
// // 获取查询时间范围内的时间戳
// List<String> timeHourList = DateUtils.getTimeStrListByStartAndEnd(startTime, endTime, "MM-dd HH:mm");
// Set<String> timeSet = new LinkedHashSet<>();
// List<Map<String, Object>> yData = new ArrayList<>();
// LinkedHashMap<String, List<Map<String, String>>> dataListMap = new LinkedHashMap<>();
// list.forEach(x -> {
// Object iotCode = x.get("iotCode");
// String prefix = null;
// String suffix = null;
// if (x.get("iotCode") != null && iotCode.toString().length() > 8) {
// prefix = iotCode.toString().substring(0, 8);
// suffix = iotCode.toString().substring(8);
// try {
// ResponseModel responseModel = iotFeign.selectListNew( prefix, suffix, startTime, endTime, null, pressurePumpStart);
// if (200 == responseModel.getStatus()) {
// String json = JSON.toJSONString(responseModel.getResult());
// List<Map<String, String>> dataList = (List<Map<String, String>>) JSONArray.parse(json);
// if (!CollectionUtils.isEmpty(dataList)) {
// dataList.stream().filter(y -> y.containsKey("createdTime")).forEach(z -> timeSet.add(z.get("createdTime")));
// dataListMap.put(iotCode.toString(), dataList);
// }
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
// });
// // 数据时间排序
// List<String> sortTimeList = new ArrayList<>(timeSet);
// Collections.sort(sortTimeList);
// // 数据时间截取,MM-dd HH:mm
// List<String> sortTimeCollectList = sortTimeList.stream().map(x -> x.substring(5, x.length() - 3)).collect(Collectors.toList());
// // 数据时间截取,MM-dd HH
// List<String> sortTimeTmpCollectList = sortTimeList.stream().map(x -> x.substring(5, x.length() - 6)).collect(Collectors.toList());
// // 组装x时间轴数据
// List<String> timeList = new ArrayList<>();
// timeHourList.forEach(t -> {
// String strTime = t.substring(0, t.length() - 3);
// if (sortTimeCollectList.contains(t)) {
// timeList.add(t);
// } else if (!sortTimeTmpCollectList.contains(strTime)) {
// timeList.add(strTime + ":00");
// sortTimeTmpCollectList.add(strTime);
// }
// });
//
// // 遍历稳压泵,dataListMap获取各稳压泵数据,没有数据的进行补0
// list.forEach(x -> {
// Map<String, Object> yMap = new HashMap<>();
// List<Integer> yList = new ArrayList<>();
// String name = x.get("name").toString();
// yMap.put("name", name);
// Object iotCode = x.get("iotCode");
// if (x.get("iotCode") != null) {
// List<Map<String, String>> dataList = dataListMap.get(iotCode.toString());
// if (!CollectionUtils.isEmpty(dataList)) {
// Collections.reverse(dataList);
// Map<String, List<Map<String, String>>> dataMap = dataList.stream().filter(y -> y.containsKey("createdTime")).collect(Collectors.groupingBy(e -> e.get("createdTime").substring(5, 16)));
// List<Map<String, String>> yDataList = null;
// String flag = "true";
// for (String t : timeList) {
// List<Map<String, String>> data = dataMap.get(t);
// if (!CollectionUtils.isEmpty(data)) {
// yDataList = data.stream().filter(o -> "true".equalsIgnoreCase(o.get(pressurePumpStart))).collect(Collectors.toList());
// yList.add(!CollectionUtils.isEmpty(yDataList) && "true".equalsIgnoreCase(flag) ? 1 : 0);
// //flag = data.get(data.size() - 1).get(pressurePumpStart);
// // 原有逻辑仅限第一次启停、第一次经历启停处理完后、flag 为 false(未恢复起始默认状态) 导致后续启动后状态判断失效数据异常
// flag = "true".equals(flag) ? "false" : "true";
// } else {
// yList.add(0);
// }
// }
// } else {
// timeList.forEach(t -> {
// yList.add(0);
// });
// }
// yMap.put("data", yList);
// yData.add(yMap);
// }
// });
// map.put("xData", timeList);
// map.put("yData", yData);
// }
// return map;
// }
//
// @Override
// public List<Map<String, Object>> getPressurePumpDiagnosticAnalysis(String equipmentCode, String nameKeys, String fieldKey, String bizOrgCode, String appKey, String product, String token) {
// List<Map<String, Object>> list = new ArrayList<>();
// // 1. 判断稳压泵整体是否故障
// List<EquipmentSpecificAlarmLog> alarmLogList = equipmentSpecificAlarmLogService.getAlarmLogInfoList(equipmentCode, nameKeys, "true", "false", bizOrgCode);
// HashMap<String, Object> isFaultMap = new HashMap<>();
// isFaultMap.put("key", 1);
// isFaultMap.put("code", 1);
// isFaultMap.put("name", "稳压泵是否故障");
// isFaultMap.put("value", CollectionUtils.isEmpty(alarmLogList) ? "无" : "有");
// isFaultMap.put("unit", "");
// list.add(isFaultMap);
// // 2. 最近一次启停间隔
// HashMap<String, Object> intervalMap = new HashMap<>();
// intervalMap.put("key", 2);
// intervalMap.put("code", 2);
// intervalMap.put("name", "最近一次启停间隔");
// intervalMap.put("unit", "分钟");
// // 3. 最近一次启动时长
// HashMap<String, Object> durationlMap = new HashMap<>();
// durationlMap.put("key", 3);
// durationlMap.put("code", 3);
// durationlMap.put("name", "最近一次启动时长");
// durationlMap.put("unit", "分钟");
// // 4. 半小时启动
// // 5. 2小时启动
// String nowStrLong = DateUtils.getDateNowString();
// Date halfHour = DateUtils.dateAddMinutes(null, -30);
// Date twoHour = DateUtils.dateAddHours(null, -2);
// String half = DateUtils.convertDateToString(halfHour, DateUtils.DATE_TIME_PATTERN);
// String two = DateUtils.convertDateToString(twoHour, DateUtils.DATE_TIME_PATTERN);
//
// HashMap<String, Object> pipeMap = new HashMap<>();
// pipeMap.put("key", 6);
// pipeMap.put("code", 6);
// pipeMap.put("name", "管网压力");
// pipeMap.put("value", "正常");
// pipeMap.put("unit", "");
//
// // 获取稳压泵
// List<Map<String, Object>> specificList = equipmentSpecificSerivce.getListByEquipmentCode(equipmentCode, bizOrgCode);
// AtomicInteger halfNum = new AtomicInteger();
// AtomicInteger twoNum = new AtomicInteger();
// if (!CollectionUtils.isEmpty(specificList)) {
// String prefix = null;
// String suffix = null;
// for (Map<String, Object> x : specificList) {
// Object iotCode = x.get("iotCode");
// if (x.get("iotCode") != null && iotCode.toString().length() > 8) {
// prefix = iotCode.toString().substring(0, 8);
// suffix = iotCode.toString().substring(8);
// try {
// ResponseModel halfResponseModel = iotFeign.selectList(appKey, product, token, half, nowStrLong, prefix, suffix, pressurePumpStart);
// ResponseModel twoResponseModel = iotFeign.selectList(appKey, product, token, two, nowStrLong, prefix, suffix, pressurePumpStart);
// if (200 == halfResponseModel.getStatus()) {
// String json = JSON.toJSONString(halfResponseModel.getResult());
// List<Map<String, String>> halfDataList = (List<Map<String, String>>) JSONArray.parse(json);
// List<Map<String, String>> halfCollect = halfDataList.stream().filter(o -> "true".equalsIgnoreCase(o.get(pressurePumpStart))).collect(Collectors.toList());
// halfNum.addAndGet(halfCollect.size());
// }
// if (200 == twoResponseModel.getStatus()) {
// String json = JSON.toJSONString(twoResponseModel.getResult());
// List<Map<String, String>> twoDataList = (List<Map<String, String>>) JSONArray.parse(json);
// List<Map<String, String>> twoCollect = twoDataList.stream().filter(o -> "true".equalsIgnoreCase(o.get(pressurePumpStart))).collect(Collectors.toList());
// twoNum.addAndGet(twoCollect.size());
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
// }
// ResponseModel intervalResponseModel = iotFeign.topSingleField(appKey, product, token, "100", 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);
// 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(trueDataList)) {
// intervalTime2 = trueDataList.get(0).get("createdTime");
// }
// if ("true".equalsIgnoreCase(value)) {
// if (!CollectionUtils.isEmpty(falseDataList)) {
// try {
// durationTime = intervalTime2;
// intervalTime1 = falseDataList.get(0).get("createdTime");
// String stop5BeforeTime = DateUtils.convertDateToString(DateUtils.dateAddMinutes(DateUtils.convertStrToDate(intervalTime1, "yyyy-MM-dd HH:mm:ss"), -5), "yyyy-MM-dd HH:mm:ss");
// ResponseModel pipeResponseModel = iotFeign.selectListNew( prefix, null, stop5BeforeTime, intervalTime2, 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)) {
// double val1 = Double.parseDouble(collect1.get(0).get("FHS_PipePressureDetector_PipePressure"));
// double val2 = Double.parseDouble(collect1.get(collect1.size() - 1).get("FHS_PipePressureDetector_PipePressure"));
// pipeMap.put("value", Math.abs(val1 - val2) > 0.05 ? "异常" : "正常");
// }
// }
// } catch (ParseException e) {
// throw new RuntimeException(e);
// }
// }
// } else {
// if (!CollectionUtils.isEmpty(falseDataList) && !CollectionUtils.isEmpty(trueDataList)) {
// durationTime = trueDataList.get(0).get("createdTime");
// nowStrLong = falseDataList.get(0).get("createdTime");
// // 获取最接近最新启动信号,且时间大于启动信号的停止信号时间值
// String finalIntervalTime = intervalTime2;
// List<Map<String, String>> timeList = falseDataList.stream().filter(x -> DateUtils.getDurationSeconds(finalIntervalTime, x.get("createdTime"), "yyyy-MM-dd HH:mm:ss") >= 0).collect(Collectors.toList());
// intervalTime1 = timeList.get(timeList.size() - 1).get("createdTime");
// }
// }
// }
// }
// intervalMap.put("value", Math.ceil((double) Math.abs(DateUtils.getDurationSeconds(intervalTime1, intervalTime2, "yyyy-MM-dd HH:mm:ss")) / 60));
// durationlMap.put("value", Math.ceil((double) Math.abs(DateUtils.getDurationSeconds(durationTime, nowStrLong, "yyyy-MM-dd HH:mm:ss")) / 60));
// } else {
// intervalMap.put("value", 0);
// durationlMap.put("value", 0);
// pipeMap.put("value", "正常");
// }
// list.add(intervalMap);
// list.add(durationlMap);
// HashMap<String, Object> halfMap = new HashMap<>();
// halfMap.put("key", 4);
// halfMap.put("code", 4);
// halfMap.put("name", "半小时启动");
// halfMap.put("value", halfNum);
// halfMap.put("unit", "次");
// list.add(halfMap);
//
// HashMap<String, Object> twoMap = new HashMap<>();
// twoMap.put("key", 5);
// twoMap.put("code", 5);
// twoMap.put("name", "2小时启动");
// twoMap.put("value", twoNum);
// twoMap.put("unit", "次");
// list.add(twoMap);
// // 6. 管网压力
// list.add(pipeMap);
// return list;
// }
@Override
public double getPressurePumpIntervalTime(String prefix, String appKey, String product, String token) {
Map<String, Object> map = new HashMap<>();
......
......@@ -309,7 +309,7 @@ public class PressurePumpServiceImpl implements IPressurePumpService {
private double getAllPressurePumpPipePressureDiffByIot(List<Map<String, String>> iotDataList, List<Map<String, String>> iotDataPipeList) {
if (CollectionUtils.isNotEmpty(iotDataList) && CollectionUtils.isNotEmpty(iotDataPipeList)) {
String value = iotDataList.get(0).get(pressurePumpStart);
if ("true".equalsIgnoreCase(value)) {
if (PressurePumpRelateEnum.IOT_INDEX_VALUE_TRUE.getValue().equalsIgnoreCase(value)) {
List<Map<String, String>> falseDataList = getIotDataFilterList(iotDataList, PressurePumpRelateEnum.IOT_INDEX_VALUE_FALSE.getValue());
if (CollectionUtils.isNotEmpty(falseDataList)) {
String createdTime = falseDataList.get(0).get(PressurePumpRelateEnum.CREATED_TIME.getValue());
......
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