Commit 8b8ed8fd authored by zhangsen's avatar zhangsen

逆变器统计bug

parent a85fdf0f
...@@ -1883,9 +1883,17 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -1883,9 +1883,17 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
// //
// return numMap; // return numMap;
String sql = " SELECT * FROM indicators_" + gatewayId + " WHERE (equipmentIndexName ='待机' or equipmentIndexName ='故障停机' or equipmentIndexName ='告警运行' or equipmentIndexName ='限额运行' or equipmentIndexName ='停机') and value = 'true'"; String totalSql = "SELECT * FROM indicators_" + gatewayId + " WHERE frontModule = '逆变器' and equipmentIndexName = '运行'";
List<IndicatorsDto> indicatorsDtoList = influxDButils.getListData(sql, IndicatorsDto.class); List<IndicatorsDto> totalEquipmentList = influxDButils.getListData(totalSql, IndicatorsDto.class);
// 逆变器总数量
Integer totalNumber = totalEquipmentList.size();
List<String> zcEquipmentNumberList = totalEquipmentList.stream().filter(t -> "true".equals(t.getValue())).map(IndicatorsDto::getEquipmentNumber).collect(Collectors.toList());
// List<String> equipmentNumberList = totalEquipmentList.stream().map(IndicatorsDto::getEquipmentNumber).collect(Collectors.toList());
String sql = " SELECT * FROM indicators_" + gatewayId + " WHERE (equipmentIndexName ='待机' or equipmentIndexName ='故障停机' or equipmentIndexName ='告警运行' or equipmentIndexName ='限额运行' or equipmentIndexName ='停机' or equipmentIndexName = '通讯故障' or equipmentIndexName = '降额运行') and value = 'true'";
List<IndicatorsDto> indicatorsDtoList = influxDButils.getListData(sql, IndicatorsDto.class);
List<String> equipmentNumberList = indicatorsDtoList.stream().map(IndicatorsDto::getEquipmentNumber).distinct().collect(Collectors.toList());
int djNum = 0; int djNum = 0;
int gzNum = 0; int gzNum = 0;
int gjNum = 0; int gjNum = 0;
...@@ -1894,55 +1902,45 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -1894,55 +1902,45 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
int txNum = 0; int txNum = 0;
int tjNum = 0; int tjNum = 0;
int zcNum = 0; int zcNum = 0;
Map<String, Object> numMap = new HashMap<>();
Set<String> equipNum = new HashSet<>(); Set<String> equipNum = new HashSet<>();
for (IndicatorsDto indicatorsDto : indicatorsDtoList) { for (IndicatorsDto indicatorsDto : indicatorsDtoList) {
switch (indicatorsDto.getEquipmentIndexName()) { if (equipmentNumberList.contains(indicatorsDto.getEquipmentNumber()) && !zcEquipmentNumberList.contains(indicatorsDto.getEquipmentNumber())) {
case "待机": switch (indicatorsDto.getEquipmentIndexName()) {
djNum += 1; case "待机":
break; djNum += 1;
case "故障停机": equipmentNumberList.remove(indicatorsDto.getEquipmentNumber());
gzNum += 1; break;
break; case "故障停机":
case "告警运行": gzNum += 1;
gjNum += 1; equipmentNumberList.remove(indicatorsDto.getEquipmentNumber());
break; break;
case "限额运行": case "告警运行":
xeNum += 1; gjNum += 1;
equipNum.add(indicatorsDto.getEquipmentNumber()); equipmentNumberList.remove(indicatorsDto.getEquipmentNumber());
break; break;
case "停机": case "限额运行":
tjNum += 1; xeNum += 1;
break; equipmentNumberList.remove(indicatorsDto.getEquipmentNumber());
} equipNum.add(indicatorsDto.getEquipmentNumber());
} break;
case "停机":
String xesql = " SELECT * FROM indicators_" + gatewayId + " WHERE equipmentIndexName ='限电运行' and frontModule = '逆变器' and value = 'true'"; tjNum += 1;
List<IndicatorsDto> xeList = influxDButils.getListData(xesql, IndicatorsDto.class); equipmentNumberList.remove(indicatorsDto.getEquipmentNumber());
for (IndicatorsDto dto : xeList) { break;
if (!ValidationUtil.isEmpty(equipNum) && equipNum.contains(dto.getEquipmentNumber())) { case "通讯故障":
xdNum += 1; xdNum += 1;
equipmentNumberList.remove(indicatorsDto.getEquipmentNumber());
break;
case "降额运行":
txNum += 1;
equipmentNumberList.remove(indicatorsDto.getEquipmentNumber());
break;
}
} }
} }
zcNum = totalNumber - djNum - gzNum - gjNum - xeNum - xdNum - txNum - tjNum;
String querySql = " SELECT * FROM indicators_" + gatewayId + " where equipmentIndexName ='运行' and value = 'true'";
List<IndicatorsDto> queryList = influxDButils.getListData(querySql, IndicatorsDto.class);
if (!ValidationUtil.isEmpty(queryList)) {
List<String> collect = queryList.stream().map(IndicatorsDto::getEquipmentNumber).collect(Collectors.toList());
Set<String> strings = new HashSet<>(collect);
zcNum = collect.size() - strings.size();
}
String querySql1 = " SELECT * FROM indicators_" + gatewayId + " where equipmentIndexName ='通讯异常' and value = 'true'";
List<IndicatorsDto> queryList1 = influxDButils.getListData(querySql1, IndicatorsDto.class);
if (!ValidationUtil.isEmpty(queryList1)) {
List<String> collect1 = queryList.stream().map(IndicatorsDto::getEquipmentNumber).collect(Collectors.toList());
Set<String> strings1 = new HashSet<>(collect1);
txNum = collect1.size() - strings1.size();
}
Page<Map<String, Object>> mapPage = new Page<>(); Page<Map<String, Object>> mapPage = new Page<>();
ArrayList<Map<String, Object>> resultList = new ArrayList<>(); ArrayList<Map<String, Object>> resultList = new ArrayList<>();
HashMap<String, Object> map = new HashMap<>(); HashMap<String, Object> map = new HashMap<>();
......
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