Commit 14566838 authored by zhangsen's avatar zhangsen

泰和升压站API接口、通用模拟量接口

parent 303ee419
......@@ -440,7 +440,11 @@ public class MonitorFanIdxController extends BaseController {
List<StationBasic> stationBasics = stationBasicMapper.selectList(wrapper);
for (StationBasic stationBasic : stationBasics) {
String gatewayId = stationBasic.getBoosterGatewayId();
monitorFanIndicator.getMajorAnalogQuantityByPage(gatewayId, stationBasic.getSequenceNbr().toString());
if ("夏造风电站".equals(stationBasic.getStationName())) {
monitorFanIndicator.getMajorAnalogQuantityByPage(gatewayId, stationBasic.getSequenceNbr().toString());
} else if ("泰和前进光伏站".equals(stationBasic.getStationName())) {
monitorFanIndicator.getMajorAnalogQuantityByPageByTHGF(gatewayId, stationBasic.getSequenceNbr().toString());
}
}
return CommonResponseUtil.success();
}
......
......@@ -982,18 +982,20 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
e.printStackTrace();
}
}
Map<String, String> finalZbGYC = zbGYC;
zbList.forEach(item -> item.put("grade2", finalZbGYC.getOrDefault(item.get("titleYuanShi"), "0.0")));
IPage<Map<String, String>> zbResult = new Page<>();
zbResult.setRecords(zbList);
zbResult.setCurrent(1);
zbResult.setTotal(zbList.size());
try {
log.info("主变消息内容:{}", JSON.toJSONString(zbResult));
emqKeeper.getMqttClient().publish(String.format("%s/%s/%s", stationId, 2, "mnl"), JSON.toJSONString(zbResult).getBytes(),2,false);
} catch (MqttException e) {
log.info("消息发送失败");
e.printStackTrace();
if (CollectionUtils.isNotEmpty(zbList)) {
Map<String, String> finalZbGYC = zbGYC;
zbList.forEach(item -> item.put("grade2", finalZbGYC.getOrDefault(item.get("titleYuanShi"), "0.0")));
IPage<Map<String, String>> zbResult = new Page<>();
zbResult.setRecords(zbList);
zbResult.setCurrent(1);
zbResult.setTotal(zbList.size());
try {
log.info("主变消息内容:{}", JSON.toJSONString(zbResult));
emqKeeper.getMqttClient().publish(String.format("%s/%s/%s", stationId, 2, "mnl"), JSON.toJSONString(zbResult).getBytes(), 2, false);
} catch (MqttException e) {
log.info("消息发送失败");
e.printStackTrace();
}
}
}
}
......@@ -1113,6 +1115,82 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
}
}
public void getMajorAnalogQuantityByPageByTHGF(String gatewayId, String stationId) {
if (StringUtils.isNotEmpty(gatewayId)) {
// 10kVⅡ段母线数据
String xianSql = String.format("SELECT equipmentIndexName, value, frontModule, unit, displayName FROM \"indicators_%s\" WHERE systemType = '模拟量' and frontModule = '10kVⅡ段母线'", gatewayId);
List<IndicatorsDto> xianData = influxDButils.getListData(xianSql, IndicatorsDto.class);
HashMap<String, Object> resultMap = new HashMap<>();
xianData.forEach(item -> resultMap.put(item.getDisplayName(), item.getValue()));
String xyxSql = String.format("SELECT value, displayName FROM \"indicators_%s\" WHERE systemType = '模拟量' and frontModule = '35kV前万线' and (displayName = 'Ia' or displayName = 'P' or displayName = 'Q' ", gatewayId);
List<IndicatorsDto> xyxSqlData = influxDButils.getListData(xyxSql, IndicatorsDto.class);
xyxSqlData.forEach(item -> resultMap.put("35qwx" + item.getDisplayName(), item.getValue()));
// 主线路图上各个路线名称
resultMap.put("35qwx", "35kV前万线");
resultMap.put("35qg1x", "35kV前光Ⅰ线");
resultMap.put("35qg2x", "35kV前光Ⅱ线");
resultMap.put("1svg", "1SVG");
resultMap.put("1zyb", "1站用变");
resultMap.put("35mxpt", "35kV母线PT");
resultMap.put("thsvg", "泰和SVG");
resultMap.put("thglyc", "泰和功率预测");
resultMap.put("thgyxh", "泰和公用信号");
resultMap.put("thjzlp", "泰和交直流屏");
//下方重复列表数据
List<Map<String, String>> boosterStationInfo = monitorFanIndicatorregionMapper.getMajorBoosterStationInfo(gatewayId, "ASC", 5);
ArrayList<Map<String, String>> resultList = new ArrayList<>();
for (Map<String, String> map : boosterStationInfo) {
String sql = String.format("SELECT equipmentIndexName, value, frontModule, unit, displayName FROM \"indicators_%s\" WHERE systemType = '%s' and frontModule =~/%s/ and (displayName = 'Ia' or displayName = 'P' or displayName = 'Q') ", gatewayId, "模拟量", map.get("boosterName"));
List<IndicatorsDto> listData = influxDButils.getListData(sql, IndicatorsDto.class);
HashMap<String, String> stringStringHashMap = new HashMap<>();
stringStringHashMap.put("value1", "0.0");
stringStringHashMap.put("value2", "0.0");
stringStringHashMap.put("value3", "0.0");
listData.forEach(item -> {
if (item.getDisplayName().equals("Ia")) {
stringStringHashMap.put("value1", item.getValue());
}
if (item.getDisplayName().equals("P")) {
stringStringHashMap.put("value2", item.getValue());
}
if (item.getDisplayName().equals("Q")) {
stringStringHashMap.put("value3", item.getValue());
}
});
resultList.add(stringStringHashMap);
}
resultMap.put("records", resultList);
resultMap.put("current", 1);
resultMap.put("size", resultList.size());
// 开关信息
Map<String, Object> switchUrl = getSwitchUrl(gatewayId, null);
resultMap.putAll(switchUrl);
List<Map<String, Object>> finallyResultList = Collections.singletonList(resultMap);
// 主屏下方重复列表数据
IPage<Map<String, Object>> resultPage = new Page<>();
resultPage.setRecords(finallyResultList);
resultPage.setCurrent(1);
resultPage.setTotal(finallyResultList.size());
try {
log.info("消息内容:{}", JSON.toJSONString(resultPage));
emqKeeper.getMqttClient().publish(String.format("%s/%s/%s", stationId, "major", "data"), JSON.toJSONString(resultPage).getBytes(),0,false);
} catch (MqttException e) {
log.info("消息发送失败");
e.printStackTrace();
}
}
}
public void getSwitchUrlAll(StationBasic stationBasic){
String gatewayId = stationBasic.getBoosterGatewayId();
......
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