Commit 7b6da3fa authored by caotao's avatar caotao

升压站问题修改

parent cee8a900
...@@ -61,7 +61,7 @@ import static com.alibaba.fastjson.JSON.parseArray; ...@@ -61,7 +61,7 @@ import static com.alibaba.fastjson.JSON.parseArray;
@EnableScheduling @EnableScheduling
@Slf4j @Slf4j
public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
private final static List<String> fanStatesList = Arrays.asList("报警状态","停机状态","故障状态","待机状态","维护状态","正常发电状态"); private final static List<String> fanStatesList = Arrays.asList("报警状态", "停机状态", "故障状态", "待机状态", "维护状态", "正常发电状态");
@Autowired @Autowired
private MonitorFanIndicatorMapper monitorFanIndicatorregionMapper; private MonitorFanIndicatorMapper monitorFanIndicatorregionMapper;
...@@ -1001,7 +1001,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -1001,7 +1001,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
DataGridMock DataGridMock = new DataGridMock(current, resultList.size(), false, current, resultList); DataGridMock DataGridMock = new DataGridMock(current, resultList.size(), false, current, resultList);
ColModel colModelStationName = new ColModel("stationName", "stationName", "名称", "名称", "dataGrid", "stationName"); ColModel colModelStationName = new ColModel("stationName", "stationName", "名称", "名称", "dataGrid", "stationName");
ColModel colModelEventDesc = new ColModel("eventDesc", "eventDesc", "事件描述", "事件描述", "dataGrid", "eventDesc"); ColModel colModelEventDesc = new ColModel("eventDesc", "eventDesc", "事件描述", "事件描述", "dataGrid", "eventDesc");
ColModel colModelAlarmGroupName= new ColModel("alarmGroupName", "alarmGroupName", "事件告警组", "事件告警组", "dataGrid", "alarmGroupName"); ColModel colModelAlarmGroupName = new ColModel("alarmGroupName", "alarmGroupName", "事件告警组", "事件告警组", "dataGrid", "alarmGroupName");
ColModel colModelEventTime = new ColModel("eventTime", "eventTime", "事件发生时间", "事件发生时间", "dataGrid", "eventTime"); ColModel colModelEventTime = new ColModel("eventTime", "eventTime", "事件发生时间", "事件发生时间", "dataGrid", "eventTime");
ColModel colModelEventMovement = new ColModel("eventMovement", "eventMovement", "事件动作描述", "事件动作描述", "dataGrid", "eventMovement"); ColModel colModelEventMovement = new ColModel("eventMovement", "eventMovement", "事件动作描述", "事件动作描述", "dataGrid", "eventMovement");
List<ColModel> listColModel = Arrays.asList(colModelStationName, colModelEventDesc, colModelAlarmGroupName, colModelEventTime, colModelEventMovement); List<ColModel> listColModel = Arrays.asList(colModelStationName, colModelEventDesc, colModelAlarmGroupName, colModelEventTime, colModelEventMovement);
...@@ -1113,23 +1113,24 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -1113,23 +1113,24 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
HashMap<String, Object> resultMap = new HashMap<>(); HashMap<String, Object> resultMap = new HashMap<>();
xianData.forEach(item -> { xianData.forEach(item -> {
if ("220kVⅠ母PT".equals(item.getFrontModule())) { if ("220kVⅠ母PT".equals(item.getFrontModule())) {
resultMap.put("220" + item.getDisplayName(), item.getValue()); resultMap.put("220" + item.getDisplayName(), keepTwoDecimalPlaces(item.getValue()));
} else if ("35kVⅠ母PT".equals(item.getFrontModule())) { } else if ("35kVⅠ母PT".equals(item.getFrontModule())) {
resultMap.put("35" + item.getDisplayName(), item.getValue()); resultMap.put("35" + item.getDisplayName(), keepTwoDecimalPlaces(item.getValue()));
} }
}); });
String xyxSql = String.format("SELECT value, displayName FROM \"indicators_%s\" WHERE systemType = '模拟量' and frontModule = '夏雩线' and (displayName = 'Ia' or displayName = 'P' or displayName = 'Q' or displayName = 'Ux' ", gatewayId); String xyxSql = String.format("SELECT value, displayName FROM \"indicators_%s\" WHERE systemType = '模拟量' and frontModule = '夏雩线' and (displayName = 'Ia' or displayName = 'P' or displayName = 'Q' or displayName = 'Ux')", gatewayId);
List<IndicatorsDto> xyxSqlData = influxDButils.getListData(xyxSql, IndicatorsDto.class); List<IndicatorsDto> xyxSqlData = influxDButils.getListData(xyxSql, IndicatorsDto.class);
xyxSqlData.forEach(item -> resultMap.put("xyx" + item.getDisplayName(), item.getValue())); xyxSqlData.forEach(item -> resultMap.put("xyx" + item.getDisplayName(), keepTwoDecimalPlaces(item.getValue())));
String dlbjSql = String.format("SELECT value, displayName FROM \"indicators_%s\" WHERE systemType = '模拟量' and frontModule = '电量表计'", gatewayId); String dlbjSql = String.format("SELECT value, displayName FROM \"indicators_%s\" WHERE systemType = '模拟量' and frontModule = '电量表计'", gatewayId);
List<IndicatorsDto> dlbjSqlData = influxDButils.getListData(dlbjSql, IndicatorsDto.class); List<IndicatorsDto> dlbjSqlData = influxDButils.getListData(dlbjSql, IndicatorsDto.class);
// 正向总有功正向总无功需要计算
dlbjSqlData.forEach(item -> { dlbjSqlData.forEach(item -> {
if ("正向总有功".equals(item.getDisplayName())) { if ("正向总有功".equals(item.getDisplayName())) {
resultMap.put("2000S1", item.getValue()); resultMap.put("2000S1", keepTwoDecimalPlaces(String.valueOf((Double.parseDouble(item.getValue())/1000))));
} else if ("正向总无功".equals(item.getDisplayName())) { } else if ("正向总无功".equals(item.getDisplayName())) {
resultMap.put("2000S2", item.getValue()); resultMap.put("2000S2", keepTwoDecimalPlaces(String.valueOf((Double.parseDouble(item.getValue())/1000))));
} }
}); });
...@@ -1141,13 +1142,13 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -1141,13 +1142,13 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
resultMap.put("value4", "0.0"); resultMap.put("value4", "0.0");
zb1SqlData.forEach(item -> { zb1SqlData.forEach(item -> {
if ("档位".equals(item.getDisplayName())) { if ("档位".equals(item.getDisplayName())) {
resultMap.put("value4", item.getValue()); resultMap.put("value4", ObjectUtils.isEmpty(item.getValue())?"0":String.format("%.0f",Double.parseDouble(item.getValue())));
} else if ("油面温1".equals(item.getDisplayName())) { } else if ("油面温1".equals(item.getDisplayName())) {
resultMap.put("value1", item.getValue()); resultMap.put("value1", ObjectUtils.isEmpty(item.getValue())?"0.0":String.format("%.1f",Double.parseDouble(item.getValue())));
} else if ("油面温2".equals(item.getDisplayName())) { } else if ("油面温2".equals(item.getDisplayName())) {
resultMap.put("value2", item.getValue()); resultMap.put("value2", ObjectUtils.isEmpty(item.getValue())?"0.0":String.format("%.1f",Double.parseDouble(item.getValue())));
} else if ("绕组温度".equals(item.getDisplayName())) { } else if ("绕组温度".equals(item.getDisplayName())) {
resultMap.put("value3", item.getValue()); resultMap.put("value3", ObjectUtils.isEmpty(item.getValue())?"0.0":String.format("%.1f",Double.parseDouble(item.getValue())));
} }
}); });
...@@ -1184,13 +1185,13 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -1184,13 +1185,13 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
stringStringHashMap.put("value3", "0.0"); stringStringHashMap.put("value3", "0.0");
listData.forEach(item -> { listData.forEach(item -> {
if (item.getDisplayName().equals("Ia")) { if (item.getDisplayName().equals("Ia")) {
stringStringHashMap.put("value1", item.getValue()); stringStringHashMap.put("value1", keepTwoDecimalPlaces(item.getValue()));
} }
if (item.getDisplayName().equals("P")) { if (item.getDisplayName().equals("P")) {
stringStringHashMap.put("value2", item.getValue()); stringStringHashMap.put("value2", keepTwoDecimalPlaces(item.getValue()));
} }
if (item.getDisplayName().equals("Q")) { if (item.getDisplayName().equals("Q")) {
stringStringHashMap.put("value3", item.getValue()); stringStringHashMap.put("value3", keepTwoDecimalPlaces(item.getValue()));
} }
}); });
resultList.add(stringStringHashMap); resultList.add(stringStringHashMap);
...@@ -1211,7 +1212,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -1211,7 +1212,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
resultPage.setTotal(finallyResultList.size()); resultPage.setTotal(finallyResultList.size());
try { try {
log.info("消息内容:{}", JSON.toJSONString(resultPage)); log.info("消息内容:{}", JSON.toJSONString(resultPage));
emqKeeper.getMqttClient().publish(String.format("%s/%s/%s", stationId, "major", "data"), JSON.toJSONString(resultPage).getBytes(),0,false); emqKeeper.getMqttClient().publish(String.format("%s/%s/%s", stationId, "major", "data"), JSON.toJSONString(resultPage).getBytes(), 0, false);
} catch (MqttException e) { } catch (MqttException e) {
log.info("消息发送失败"); log.info("消息发送失败");
e.printStackTrace(); e.printStackTrace();
...@@ -1435,6 +1436,17 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -1435,6 +1436,17 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
return statusMaps; return statusMaps;
} }
public String keepTwoDecimalPlaces(String value) {
String s = "0.00";
if (!ObjectUtils.isEmpty(value)) {
try {
s = String.format("%.2f", Double.parseDouble(value));
} catch (Exception ex) {
}
}
return s;
}
} }
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