Commit 4b32b581 authored by chenzhao's avatar chenzhao

监盘接口 字段替换 非空验证

parent 8df1dbcb
......@@ -40,7 +40,7 @@ public class ESEquipments {
@Field(type = FieldType.Text)
private String value;
@Field(type = FieldType.Float, index = false)
private Float valueF;
private Float valueF ;
@Field(type = FieldType.Text)
private String valueLabel;
@Field(type = FieldType.Text , index = false)
......
......@@ -172,7 +172,7 @@ public class DemoController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "初始化influxdb-风电、光伏、升压站")
@GetMapping("/test4")
@GetMapping("doc/test4")
public ResponseModel<Integer> demoTest3() {
//数据说明 夏造风电、泰和光伏、夏造升压站、泰和升压站
String [] strings = {"1668801435891929089","1669524885619085313","1668801570352926721","1669525017559306241"};
......@@ -360,7 +360,7 @@ public class DemoController extends BaseController {
public ResponseModel<Object> demoTest8() {
QueryBuilder queryBuilder = QueryBuilders.matchQuery("equipmentIndexName", "有功功率");
SumAggregationBuilder buyCountSum = AggregationBuilders.sum("buyCountSum").field("valueDouble");
SumAggregationBuilder buyCountSum = AggregationBuilders.sum("buyCountSum").field("valueF");
Query query = new NativeSearchQueryBuilder()
.withQuery(queryBuilder)
.addAggregation(buyCountSum)
......@@ -377,7 +377,7 @@ public class DemoController extends BaseController {
public ResponseModel<Object> demoTest9() {
QueryBuilder queryBuilder = QueryBuilders.matchQuery("equipmentIndexName", "有功功率");
AvgAggregationBuilder buyCountAvg = AggregationBuilders.avg("buyCountAvg").field("valueDouble");
AvgAggregationBuilder buyCountAvg = AggregationBuilders.avg("buyCountAvg").field("valueF");
Query query = new NativeSearchQueryBuilder()
.withQuery(queryBuilder)
.addAggregation(buyCountAvg)
......@@ -402,7 +402,7 @@ public class DemoController extends BaseController {
// 如果只对一个字段进行分组写一个就好
TermsAggregationBuilder tb1 = AggregationBuilders.terms("group_gatewayId").field("gatewayId.keyword");//gatewayId 是分组字段名,group_gatewayId是查询结果的别名
// TermsAggregationBuilder tb2 = AggregationBuilders.terms("group_equipmentNumber").field("equipmentNumber.keyword");//equipmentNumber 是分组字段名,group_equipmentNumber是查询结果的别名
SumAggregationBuilder sb = AggregationBuilders.sum("sum_valueDouble").field("valueDouble");//valueDouble是求和字段名称,sun_valueDouble是结果别名
SumAggregationBuilder sb = AggregationBuilders.sum("sum_valueDouble").field("valueF");//valueF是求和字段名称,sun_valueDouble是结果别名
// 注意顺序,决定先通过谁分组
tb1.subAggregation(sb); // 通过typeId字段分组统计总数
......@@ -432,8 +432,8 @@ public class DemoController extends BaseController {
QueryDto ff2=new QueryDto("equipmentIndexName.keyword","有功功率");
queryDto.add(ff1);
queryDto.add(ff2);
Double avg= commonServiceImpl.getavg(queryDto,"valueDouble",ESEquipments.class);
Double sum= commonServiceImpl.getsum(queryDto,"valueDouble",ESEquipments.class);
Double avg= commonServiceImpl.getavg(queryDto,"valueF",ESEquipments.class);
Double sum= commonServiceImpl.getsum(queryDto,"valueF",ESEquipments.class);
Map<String,Double> map=new HashMap();
map.put("1668801435891929089_avg",avg);
......@@ -466,7 +466,7 @@ public class DemoController extends BaseController {
// value1.add("1668801435891929089");
// map.put("gatewayId.keyword",value1);
List<? extends Terms.Bucket> lidate= commonServiceImpl.getgroupavg(map,"valueDouble" ,"equipmentIndexName.keyword",ESEquipments.class);
List<? extends Terms.Bucket> lidate= commonServiceImpl.getgroupavg(map,"valueF" ,"equipmentIndexName.keyword",ESEquipments.class);
Map<String,Object> mapdta=new HashMap<>();
DecimalFormat format2 = new DecimalFormat("#.0000");
......@@ -498,7 +498,7 @@ public class DemoController extends BaseController {
value1.add("1668801435891929089");
map.put("gatewayId.keyword",value1);
List<? extends Terms.Bucket> lidate= commonServiceImpl.getgroupsum(map,"valueDouble" ,"equipmentIndexName.keyword",ESEquipments.class);
List<? extends Terms.Bucket> lidate= commonServiceImpl.getgroupsum(map,"valueF" ,"equipmentIndexName.keyword",ESEquipments.class);
Map<String,Object> mapdta=new HashMap<>();
DecimalFormat format2 = new DecimalFormat("#.0000");
......@@ -556,7 +556,7 @@ public class DemoController extends BaseController {
@GetMapping("/test17")
public ResponseModel<Integer> demoTest17() {
//数据说明 夏造风电、泰和光伏、夏造升压站、泰和升压站
String [] strings = {"1668801435891929089","1669524885619085313","1668801570352926721","1669525017559306241"};
String [] strings = {"1668801570352926721","1669525017559306241"};
// Object o=this.monitorFanIndicatorImpl.getIndicatoralueAvage("1668801435891929089","60秒平均风速");
// System.out.println(o.toString());
......@@ -568,6 +568,8 @@ public class DemoController extends BaseController {
// QueryWrapper.eq("gateway", "1668801435891929089");
// 泰和光伏
QueryWrapper.eq("gateway", strings[i]);
QueryWrapper.eq("front_module","电量表计");
QueryWrapper.eq("system_type","模拟量");
long DATE = new Date().getTime();
System.out.println(DATE);
List<MonitorFanIndicator> list = monitorFanIndicatorregionMapper.selectList(QueryWrapper);
......@@ -575,29 +577,26 @@ public class DemoController extends BaseController {
List<ESEquipments> listit =new ArrayList<>();
for (MonitorFanIndicator monitorFanIndicator : list) {
Map<String, String> tag = new HashMap<>();
Map<String, Object> maps2 = new HashMap<>();
tag.put("equipmentsIdx", monitorFanIndicator.getAddressGateway());
maps2.put("address", monitorFanIndicator.getIndexAddress());
maps2.put("dataType", monitorFanIndicator.getDataType());
maps2.put("equipmentSpecificName", monitorFanIndicator.getFanCode());
maps2.put("gatewayId", monitorFanIndicator.getGateway());
maps2.put("isAlarm", monitorFanIndicator.getIsAlarm());
maps2.put("createdTime", "2023-07-05 18:30:26");
maps2.put("unit", monitorFanIndicator.getUnit());
maps2.put("value", "");
maps2.put("traceId", "");
maps2.put("equipmentIndexName", monitorFanIndicator.getIndicator());
maps2.put("equipmentNumber", monitorFanIndicator.getEquipmentNumber());
maps2.put("frontModule", monitorFanIndicator.getFrontModule());
maps2.put("systemType", monitorFanIndicator.getSystemType());
maps2.put("pictureName", monitorFanIndicator.getPictureName());
// maps2.put("address", monitorFanIndicator.getIndexAddress());
// maps2.put("dataType", monitorFanIndicator.getDataType());
// maps2.put("equipmentSpecificName", monitorFanIndicator.getFanCode());
// maps2.put("gatewayId", monitorFanIndicator.getGateway());
// maps2.put("isAlarm", monitorFanIndicator.getIsAlarm());
// maps2.put("createdTime", "2023-07-05 18:30:26");
// maps2.put("unit", monitorFanIndicator.getUnit());
// maps2.put("value", "");
// maps2.put("traceId", "");
// maps2.put("equipmentIndexName", monitorFanIndicator.getIndicator());
// maps2.put("equipmentNumber", monitorFanIndicator.getEquipmentNumber());
maps2.put("frontModule","模拟量");
// maps2.put("systemType", monitorFanIndicator.getSystemType());
// maps2.put("pictureName", monitorFanIndicator.getPictureName());
//升压站的字段显示名称
maps2.put("displayName", monitorFanIndicator.getEquipmentNumber());
// maps2.put("displayName", monitorFanIndicator.getEquipmentNumber());
influxDbConnection.insert("indicators_" + monitorFanIndicator.getGateway(), tag, maps2,1688558007051L, TimeUnit.MILLISECONDS);
}
}
......
......@@ -643,7 +643,7 @@ public class MonitorFanIdxController extends BaseController {
data3.put("title",columnMap.get("月发电量").toString());
objects.add(data3);
Map<String, Object> data4 = new HashMap<>();
data4.put("title",commonService.getSumByEquipmentIndxName(result1,"WTX-801_25_WTX-801_总辐射"));
data4.put("title",String.format("%.2f",commonService.getSumByEquipmentIndxName(result1,"WTX-801_25_WTX-801_总辐射")));
objects.add(data4);
Map<String, Object> data5 = new HashMap<>();
data5.put("title",columnMap.get("年发电量").toString());
......@@ -652,10 +652,10 @@ public class MonitorFanIdxController extends BaseController {
data6.put("title", columnMap.get("有功功率").toString()) ;
objects.add(data6);
Map<String, Object> data7 = new HashMap<>();
data7.put("title",columnMap.get("日照时数").toString());
data7.put("title",String.format("%.2f",((Double.parseDouble(columnMap.get("日发电量").toString())/10)/ (Double.parseDouble(columnMap.get("装机容量").toString())))));
objects.add(data7);
Map<String, Object> data8 = new HashMap<>();
data8.put("title",commonService.getSumByEquipmentIndxName(result1,"WTX-801_25_WTX-801_总辐射累计"));
data8.put("title",String.format("%.2f",commonService.getSumByEquipmentIndxName(result1,"WTX-801_25_WTX-801_总辐射累计")));
objects.add(data8);
Map<String, Object> data9 = new HashMap<>();
data9.put("title","0.00%");//综合效率
......
......@@ -247,7 +247,7 @@ public class CommonServiceImpl {
} catch (Exception e) {
return totalvalue;
}
return Double.valueOf(String.format("%.2f", totalvalue));
return Double.valueOf(String.format("%.2f", totalvalue*CommonConstans.pvGenPoweActor));
}
public Double getTotalByIndicatiorAndParams(String gatewayId, String indicator, String querySql) {
......@@ -573,13 +573,13 @@ public class CommonServiceImpl {
}
public Double getAvagerByEquipmentIndxName(List<ESEquipments> equipments, String indexName) {
Double result = 0.00;
result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).mapToDouble(ESEquipments::getValueF).average().getAsDouble();
result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).filter(esEquipments -> esEquipments.getValueF()!= null).mapToDouble(ESEquipments::getValueF).average().getAsDouble();
return result;
}
public Double getSumByEquipmentIndxName(List<ESEquipments> equipments, String indexName) {
Double result = 0.00;
result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).mapToDouble(ESEquipments::getValueF).sum();
result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).filter(esEquipments -> esEquipments.getValueF()!= null).mapToDouble(ESEquipments::getValueF).sum();
return result;
}
......
......@@ -156,15 +156,18 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
HashMap<String, String> notMustMap = new HashMap<>();
notMustMap.put(CommonConstans.QueryStringValueKeyword, "0.0");
notMustMap.put(CommonConstans.QueryStringValueLabelKeyword, "0.0");
Integer newSize = size;
List<ESEquipments> lisSort= new ArrayList<>();
List<ESEquipments> waringData = commonServiceImpl.getListDataByCondtionsByValueNotEqValueLabel(queryCodntion,null, notMustMap, ESEquipments.class);
if (StringUtils.isNotEmpty(equipmentNumber)) {
if (StringUtils.isNotEmpty(equipmentNumber) && CollectionUtils.isNotEmpty(waringData)) {
waringData= waringData.stream().filter(esEquipments -> esEquipments.getEquipmentNumber().equals(equipmentNumber)&&esEquipments.getEquipmentSpecificName().contains("风机")).collect(Collectors.toList());
newSize = waringData.size() >= size ? size : waringData.size();
lisSort = waringData.stream().sorted(Comparator.comparing(ESEquipments::getCreatedTime).reversed()).collect(Collectors.toList()).subList(((current - 1) * newSize),(current*newSize));
}
Integer newSize = waringData.size() >= size ? size : waringData.size();
List<ESEquipments> lisSort=waringData.stream().sorted(Comparator.comparing(ESEquipments::getCreatedTime).reversed()).collect(Collectors.toList()).subList(((current - 1) * newSize),(current*newSize));
//对于查询到的告警信息进行按照时间顺序进行排序
//构建平台数据
DataGridMock DataGridMock = new DataGridMock(current, !waringData.isEmpty() ? waringData.size(): 0, false, current, lisSort);
DataGridMock DataGridMock = new DataGridMock(current, CollectionUtils.isNotEmpty(waringData)? waringData.size(): 0, false, current, lisSort);
ColModel colModelequipmentNumber = new ColModel("equipmentNumber", "equipmentSpecificName", "风机号", "风机号", "dataGrid", "equipmentNumber");
ColModel colModelvalueLabel = new ColModel("valueLabel", "valueLabel", "事件描述", "事件描述", "dataGrid", "valueLabel");
ColModel colModelcreatedTime = new ColModel("createdTime", "createdTime", "发生时间", "发生时间", "dataGrid", "createdTime");
......@@ -292,14 +295,15 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
HashMap<String, String> colorMap = new HashMap<>();
colorMap.put("正常运行", "#00aa00");
colorMap.put("报警运行", "#ffc400");
colorMap.put("停机状态", "#0055ff");
colorMap.put("停机状态", "#a3f5aa");
colorMap.put("故障状态", "#ff0000");
colorMap.put("限功率", "#a3f5aa");
colorMap.put("限功率", "#0055ff");
colorMap.put("待机状态", "#00aaff");
colorMap.put("维护状态", "#ff00ff");
colorMap.put("通讯中断", "#7d8e95");
List<ESEquipmentsDTO> resultList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(equipNumList)){
equipNumList.forEach(item -> {
String status = ObjectUtils.isEmpty(CommonConstans.fanStatus.get(collect.get(item.getEquipmentNumber()))) ? "通讯中断" : CommonConstans.fanStatus.get(collect.get(item.getEquipmentNumber()));
item.setAddress(status);
......@@ -310,6 +314,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
esEquipmentsDTO.setColor(color);
resultList.add(esEquipmentsDTO);
});
}
return resultList;
......@@ -323,9 +328,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
HashMap<String, String> colorMap = new HashMap<>();
colorMap.put("正常运行", "#00aa00");
colorMap.put("报警运行", "#ffc400");
colorMap.put("停机状态", "#0055ff");
colorMap.put("停机状态", "#a3f5aa");
colorMap.put("故障状态", "#ff0000");
colorMap.put("限功率", "#a3f5aa");
colorMap.put("限功率", "#0055ff");
colorMap.put("待机状态", "#00aaff");
colorMap.put("维护状态", "#ff00ff");
colorMap.put("通讯中断", "#7d8e95");
......@@ -389,7 +394,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
ESEquipments esEquipments = result.get(i);
if (esEquipments.getEquipmentIndexName().contains("温度")) {
xList.add(esEquipments.getEquipmentIndexName());
yList.add(esEquipments.getValueF().toString());
yList.add(null == esEquipments.getValueF()?"0": esEquipments.getValueF().toString());
}
}
realTimeTemperatureResult.put("axisData", xList);
......@@ -415,7 +420,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
queryCondtion.put(CommonConstans.QueryStringEquipmentNumberKeyword, Arrays.asList(equipNum));
List<ESEquipments> equipNumList = commonServiceImpl.getListDataByCondtionsAndLike(queryCondtion, null, ESEquipments.class, likeMap);
if (CollectionUtils.isNotEmpty(equipNumList) && StringUtils.isNotEmpty(equipNumList.get(0).getValueF().toString())) {
if (CollectionUtils.isNotEmpty(equipNumList) && !ObjectUtils.isEmpty(equipNumList.get(0).getValueF())) {
return equipNumList.get(0).getValueF().toString();
} else {
return "0";
......@@ -544,10 +549,10 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
for (StationBasic stationBasic : stationBasics) {
if (stationBasic.getStationType().equals("FDZ")) {
timingTemporarysSorageData(stationBasic.getFanGatewayId(), timeInMillis);
timingTemporarysSorageData(stationBasic, timeInMillis);
}
if (stationBasic.getStationType().equals("JZSGFDZ")) {
schedSolarPower(stationBasic.getBoosterGatewayId(), timeInMillis);
schedSolarPower(stationBasic, timeInMillis);
}
}
}
......@@ -630,13 +635,15 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
}
public void timingTemporarysSorageData(String gatewayId, long timeInMillis) {
public void timingTemporarysSorageData(StationBasic stationBasic, long timeInMillis) {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("瞬时风速"));
List<ESEquipments> indicatorsDtoList = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值"));
List<ESEquipments> indicatorsDtoLists = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
Map<String, List<String>> queryCondtion1 = new HashMap<>();
queryCondtion1.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
queryCondtion1.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值"));
List<ESEquipments> indicatorsDtoLists = commonServiceImpl.getListDataByCondtions(queryCondtion1, null, ESEquipments.class);
List<TemporaryData> temporaryDatas = new ArrayList<>();
List<TemporaryData> temporaryDatass = new ArrayList<>();
String time = "";
......@@ -652,8 +659,8 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
temporaryData.setBatchNo(timeInMillis);
temporaryData.setCreatedTime(time.split(" ")[1]);
temporaryData.setEquipmentIndexName(indicatorsDto.getEquipmentIndexName());
temporaryData.setGatewayId(indicatorsDto.getGatewayId());
temporaryData.setValue(indicatorsDto.getValueF());
temporaryData.setGatewayId(stationBasic.getFanGatewayId());
temporaryData.setValue(null ==indicatorsDto.getValueF()?0:indicatorsDto.getValueF());
temporaryData.setEquipmentNumber(indicatorsDto.getEquipmentNumber());
temporaryDatas.add(temporaryData);
} catch (Exception e) {
......@@ -665,9 +672,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
TemporaryData temporaryData = new TemporaryData();
temporaryData.setBatchNo(timeInMillis);
temporaryData.setCreatedTime(time.split(" ")[1]);
temporaryData.setEquipmentIndexName(indicatorsDto.getEquipmentIndexName());
temporaryData.setGatewayId(indicatorsDto.getGatewayId());
temporaryData.setValue(indicatorsDto.getValueF());
temporaryData.setEquipmentIndexName("有功功率");
temporaryData.setGatewayId(stationBasic.getFanGatewayId());
temporaryData.setValue(null ==indicatorsDto.getValueF()?0:indicatorsDto.getValueF());
temporaryData.setEquipmentNumber(indicatorsDto.getEquipmentNumber());
temporaryDatass.add(temporaryData);
} catch (Exception e) {
......@@ -678,13 +685,15 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
temporaryDataService.saveBatch(temporaryDatass);
}
public void schedSolarPower(String gatewayId, long timeInMillis) {
public void schedSolarPower(StationBasic stationBasic, long timeInMillis) {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId));
queryCondtion.put(CommonConstans.QueryStringDisplayNameKeyword, Arrays.asList("WTX-801_25_WTX-801_总辐射"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("WTX-801_25_WTX-801_总辐射"));
List<ESEquipments> indicatorsDtoList = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
queryCondtion.put(CommonConstans.QueryStringDisplayNameKeyword, Arrays.asList("南瑞光差保护_313P"));
List<ESEquipments> indicatorsDtoLists = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
Map<String, List<String>> queryCondtion1 = new HashMap<>();
queryCondtion1.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
queryCondtion1.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("南瑞光差保护_313P"));
List<ESEquipments> indicatorsDtoLists = commonServiceImpl.getListDataByCondtions(queryCondtion1, null, ESEquipments.class);
List<TemporaryData> temporaryDatas = new ArrayList<>();
List<TemporaryData> temporaryDatass = new ArrayList<>();
String time = "";
......@@ -702,7 +711,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
temporaryData.setGatewayId(indicatorsDto.getGatewayId());
temporaryData.setValue(Float.valueOf(indicatorsDto.getValue()));
temporaryData.setEquipmentNumber(indicatorsDto.getEquipmentNumber());
temporaryData.setEquipmentIndexName(indicatorsDto.getEquipmentNumber());
temporaryData.setEquipmentIndexName("总辐射累计");
temporaryDatas.add(temporaryData);
} catch (Exception e) {
e.printStackTrace();
......@@ -714,9 +723,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
temporaryData.setBatchNo(timeInMillis);
temporaryData.setCreatedTime(time.split(" ")[1]);
temporaryData.setGatewayId(indicatorsDto.getGatewayId());
temporaryData.setValue(Float.valueOf(indicatorsDto.getValue()));
temporaryData.setValue(indicatorsDto.getValueF()/1000);
temporaryData.setEquipmentNumber(indicatorsDto.getEquipmentNumber());
temporaryData.setEquipmentIndexName(indicatorsDto.getEquipmentNumber());
temporaryData.setEquipmentIndexName("有功功率");
temporaryDatass.add(temporaryData);
} catch (Exception e) {
e.printStackTrace();
......@@ -894,9 +903,12 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
List<String> numList = Arrays.asList(dataMap.get("equipNum").toString().split(","));
List<Map<String, Object>> statusMaps = new ArrayList<>();
for (ESEquipments listDatum : listData) {
if (null == listDatum.getValueF()){
listDatum.setValueF(0F);
}
for (ESEquipments indicatorsDto : listData1) {
if (listDatum.getEquipmentNumber().equals(indicatorsDto.getEquipmentNumber())) {
listDatum.setValueLabel(String.valueOf(indicatorsDto.getValueF()/1000));
listDatum.setValueLabel(String.valueOf(indicatorsDto.getValueF() == null?0:indicatorsDto.getValueF()/1000));
}
}
......@@ -979,7 +991,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
stringStringHashMap.put("wind", ObjectUtils.isEmpty(item.getValue()) ? "0.0" : item.getValue());
stringStringHashMap.put("power", powerSqlMap.get(item.getEquipmentNumber()));
stringStringHashMap.put("windSpeed", windSpeedSqlMap.get(item.getEquipmentNumber()));
stringStringHashMap.put("electricity", String.format(CommonConstans.Fourdecimalplaces, ObjectUtils.isEmpty(item.getEquipmentNumber()) ? 0.0000 : Double.valueOf(electricitySqlMap.get(item.getEquipmentNumber()))));
stringStringHashMap.put("electricity", String.format(CommonConstans.Fourdecimalplaces, ObjectUtils.isEmpty(electricitySqlMap.get(item.getEquipmentNumber())) ? 0.0000 : Double.valueOf(electricitySqlMap.get(item.getEquipmentNumber()))));
resultList.add(stringStringHashMap);
});
......@@ -1147,9 +1159,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
HashMap<String, Object> resultMap = new HashMap<>();
xianData.forEach(item -> {
if ("220kVⅠ母PT".equals(item.getFrontModule())) {
resultMap.put("220" + item.getDisplayName(), keepTwoDecimalPlaces(item.getValueF().toString()));
resultMap.put("220" + item.getDisplayName(), item.getValueF() ==null?"0":keepTwoDecimalPlaces(item.getValueF().toString()));
} else if ("35kVⅠ母PT".equals(item.getFrontModule())) {
resultMap.put("35" + item.getDisplayName(), keepTwoDecimalPlaces(item.getValueF().toString()));
resultMap.put("35" + item.getDisplayName(),item.getValueF() ==null?"0": keepTwoDecimalPlaces(item.getValueF().toString()));
}
});
List<String> xyxDisplayNameList = Arrays.asList("Ia", "P", "Q", "Ux");
......@@ -1159,9 +1171,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
// 正向总有功正向总无功需要计算
dlbjSqlData.forEach(item -> {
if ("正向总有功".equals(item.getDisplayName())) {
resultMap.put("2000S1", keepTwoDecimalPlaces(String.valueOf((Double.parseDouble(item.getValueF().toString()) / 1000))));
resultMap.put("2000S1",item.getValueF() ==null?"0": keepTwoDecimalPlaces(String.valueOf((Double.parseDouble(item.getValueF().toString()) / 1000))));
} else if ("正向总无功".equals(item.getDisplayName())) {
resultMap.put("2000S2", keepTwoDecimalPlaces(String.valueOf((Double.parseDouble(item.getValueF().toString()) / 1000))));
resultMap.put("2000S2",item.getValueF() ==null?"0": keepTwoDecimalPlaces(String.valueOf((Double.parseDouble(item.getValueF().toString()) / 1000))));
}
});
......@@ -1173,13 +1185,13 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
resultMap.put("value4", "0.0");
zb1SqlData.forEach(item -> {
if ("档位".equals(item.getDisplayName())) {
resultMap.put("value4", ObjectUtils.isEmpty(item.getValueF().toString()) ? "0" : String.format("%.0f", Double.parseDouble(item.getValueF().toString())));
resultMap.put("value4", ObjectUtils.isEmpty(item.getValueF()) ? "0" : String.format("%.0f", Double.parseDouble(item.getValueF().toString())));
} else if ("油面温1".equals(item.getDisplayName())) {
resultMap.put("value1", ObjectUtils.isEmpty(item.getValueF().toString()) ? "0.0" : String.format("%.1f", Double.parseDouble(item.getValueF().toString())));
resultMap.put("value1", ObjectUtils.isEmpty(item.getValueF()) ? "0.0" : String.format("%.1f", Double.parseDouble(item.getValueF().toString())));
} else if ("油面温2".equals(item.getDisplayName())) {
resultMap.put("value2", ObjectUtils.isEmpty(item.getValueF().toString()) ? "0.0" : String.format("%.1f", Double.parseDouble(item.getValueF().toString())));
resultMap.put("value2", ObjectUtils.isEmpty(item.getValueF()) ? "0.0" : String.format("%.1f", Double.parseDouble(item.getValueF().toString())));
} else if ("绕组温度".equals(item.getDisplayName())) {
resultMap.put("value3", ObjectUtils.isEmpty(item.getValueF().toString()) ? "0.0" : String.format("%.1f", Double.parseDouble(item.getValueF().toString())));
resultMap.put("value3", ObjectUtils.isEmpty(item.getValueF()) ? "0.0" : String.format("%.1f", Double.parseDouble(item.getValueF().toString())));
}
});
......@@ -1215,13 +1227,13 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
stringStringHashMap.put("value3", "0.0");
listData.forEach(item -> {
if (item.getDisplayName().equals("Ia")) {
stringStringHashMap.put("value1", keepTwoDecimalPlaces(item.getValueF().toString()));
stringStringHashMap.put("value1",item.getValueF() ==null?"0": keepTwoDecimalPlaces(item.getValueF().toString()));
}
if (item.getDisplayName().equals("P")) {
stringStringHashMap.put("value2", keepTwoDecimalPlaces(item.getValueF().toString()));
stringStringHashMap.put("value2",item.getValueF() ==null?"0": keepTwoDecimalPlaces(item.getValueF().toString()));
}
if (item.getDisplayName().equals("Q")) {
stringStringHashMap.put("value3", keepTwoDecimalPlaces(item.getValueF().toString()));
stringStringHashMap.put("value3",item.getValueF() ==null?"0":keepTwoDecimalPlaces(item.getValueF().toString()));
}
});
resultList.add(stringStringHashMap);
......@@ -1505,12 +1517,12 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
Map<String,Object> map = new HashMap<>();
List<String> values = new ArrayList<>();
Set<String> time = new TreeSet<>();
String v = list.get(0).get("value").toString();
String v = null ==list ?"":list.get(0).get("value").toString();
double min = Double.parseDouble(v);
double max = Double.parseDouble(v);
double mean = 0.0;
String minTime =list.get(0).get("createdTime").toString();
String maxTime =list.get(0).get("createdTime").toString();
String minTime =null ==list?"":list.get(0).get("createdTime").toString();
String maxTime =null ==list?"":list.get(0).get("createdTime").toString();
for (Map<String, Object> stringStringMap : list) {
double value = Double.parseDouble(stringStringMap.get("value").toString());
......@@ -1595,9 +1607,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
queryConditon.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId));
Map<String, String> shouldConditon = new HashMap<>();
shouldConditon.put(CommonConstans.QueryStringEquipmentIndexName, "合闸");
List<ESEquipments> list = commonServiceImpl.getListDataByCondtions(queryConditon, shouldConditon, ESEquipments.class);
List<ESEquipments> list = commonServiceImpl.getListDataByCondtions(queryConditon, null, ESEquipments.class,shouldConditon);
if (!ValidationUtil.isEmpty(list)) {
Map<String, List<ESEquipments>> collect = list.stream().collect(Collectors.groupingBy(ESEquipments::getEquipmentNumber));
Map<String, List<ESEquipments>> collect = list.stream().filter(e->StringUtils.isNotBlank(e.getEquipmentNumber())).collect(Collectors.groupingBy(ESEquipments::getEquipmentNumber));
for (String s : collect.keySet()) {
HashMap<String, Object> resultMap = new HashMap<>();
collect.get(s).stream().forEach(e -> {
......
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