Commit 37eeb4dd authored by KeYong's avatar KeYong

Merge branch 'developer' of http://36.40.66.175:5000/moa/amos-boot-biz into developer

parents 4ab95f48 ecfce0c2
...@@ -633,6 +633,8 @@ public class AlarmInfoDetailServiceImpl implements IAlarmInfoDetailService { ...@@ -633,6 +633,8 @@ public class AlarmInfoDetailServiceImpl implements IAlarmInfoDetailService {
* @return * @return
*/ */
public HashMap<String,Object> getWaringCycleAndMaxValueByWaring(String warningPeriod,String warningContenct,String pointName){ public HashMap<String,Object> getWaringCycleAndMaxValueByWaring(String warningPeriod,String warningContenct,String pointName){
// 汇流箱机内温度连续30分钟健康指数≤74.0
HashMap<String,Object> result = new HashMap<>(); HashMap<String,Object> result = new HashMap<>();
warningContenct=warningContenct.replace(pointName+"连续",""); warningContenct=warningContenct.replace(pointName+"连续","");
String spiltStr =CommonConstans.waringPeriodTowaringCycle.get(warningPeriod); String spiltStr =CommonConstans.waringPeriodTowaringCycle.get(warningPeriod);
...@@ -645,8 +647,8 @@ public class AlarmInfoDetailServiceImpl implements IAlarmInfoDetailService { ...@@ -645,8 +647,8 @@ public class AlarmInfoDetailServiceImpl implements IAlarmInfoDetailService {
}else { }else {
warningCycle=Integer.valueOf(strings[0].replace(".0", "")); warningCycle=Integer.valueOf(strings[0].replace(".0", ""));
} }
if(strings[1].contains("<")){ if(strings[1].contains("")){
maxValue = Double.valueOf(strings[1].split("<")[1]); maxValue = Double.valueOf(strings[1].split("")[1]);
} }
} }
result.put("maxValue",maxValue); result.put("maxValue",maxValue);
......
...@@ -249,7 +249,7 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -249,7 +249,7 @@ public class HealthStatusIndicatorServiceImpl {
// redisUtils.set(gateWayId+"_"+address+"_health_notice_minute","notice"); // redisUtils.set(gateWayId+"_"+address+"_health_notice_minute","notice");
level ="注意"; level ="注意";
num = ""+healthValueNotice; num = ""+healthValueNotice;
content = healthValueNotice*10 + "分钟"; content = healthValueNoticeCount*10 + "分钟";
}else if (warnNum == healthValueWarnCount ){ }else if (warnNum == healthValueWarnCount ){
// redisUtils.set(gateWayId+"_"+address+"_health_warn_minute","warn"); // redisUtils.set(gateWayId+"_"+address+"_health_warn_minute","warn");
level ="警告"; level ="警告";
...@@ -284,7 +284,7 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -284,7 +284,7 @@ public class HealthStatusIndicatorServiceImpl {
idxBizPvWarningRecord.setDisposotionState("待确认"); idxBizPvWarningRecord.setDisposotionState("待确认");
idxBizPvWarningRecord.setStatus("0"); idxBizPvWarningRecord.setStatus("0");
idxBizPvWarningRecord.setWarningName(level); idxBizPvWarningRecord.setWarningName(level);
idxBizPvWarningRecord.setCONTENT(idxBizPvHealthIndices.get(0).getPointName() + "连续"+content+"健康指数<"+num ); idxBizPvWarningRecord.setCONTENT(idxBizPvHealthIndices.get(0).getPointName() + "连续"+content+"健康指数"+num );
idxBizPvWarningRecord.setRecDate(time); idxBizPvWarningRecord.setRecDate(time);
idxBizPvWarningRecord.setWarningPeriod("按时刻"); idxBizPvWarningRecord.setWarningPeriod("按时刻");
idxBizPvWarningRecord.setManufacturer(idxBizPvHealthIndices.get(0).getManufacturer()); idxBizPvWarningRecord.setManufacturer(idxBizPvHealthIndices.get(0).getManufacturer());
...@@ -451,7 +451,7 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -451,7 +451,7 @@ public class HealthStatusIndicatorServiceImpl {
idxBizPvWarningRecord.setDisposotionState("待确认"); idxBizPvWarningRecord.setDisposotionState("待确认");
idxBizPvWarningRecord.setStatus("0"); idxBizPvWarningRecord.setStatus("0");
idxBizPvWarningRecord.setWarningName(level); idxBizPvWarningRecord.setWarningName(level);
idxBizPvWarningRecord.setCONTENT(idxBizPvHealthIndices.get(0).getPointName() + "连续"+content+"健康指数<"+num ); idxBizPvWarningRecord.setCONTENT(idxBizPvHealthIndices.get(0).getPointName() + "连续"+content+"健康指数"+num );
idxBizPvWarningRecord.setRecDate(time); idxBizPvWarningRecord.setRecDate(time);
idxBizPvWarningRecord.setWarningPeriod("按小时"); idxBizPvWarningRecord.setWarningPeriod("按小时");
idxBizPvWarningRecord.setManufacturer(idxBizPvHealthIndices.get(0).getManufacturer()); idxBizPvWarningRecord.setManufacturer(idxBizPvHealthIndices.get(0).getManufacturer());
...@@ -616,7 +616,7 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -616,7 +616,7 @@ public class HealthStatusIndicatorServiceImpl {
idxBizPvWarningRecord.setDisposotionState("待确认"); idxBizPvWarningRecord.setDisposotionState("待确认");
idxBizPvWarningRecord.setStatus("0"); idxBizPvWarningRecord.setStatus("0");
idxBizPvWarningRecord.setWarningName(level); idxBizPvWarningRecord.setWarningName(level);
idxBizPvWarningRecord.setCONTENT(idxBizPvHealthIndices.get(0).getPointName() + "连续"+content+"健康指数<"+num ); idxBizPvWarningRecord.setCONTENT(idxBizPvHealthIndices.get(0).getPointName() + "连续"+content+"健康指数"+num );
idxBizPvWarningRecord.setRecDate(time); idxBizPvWarningRecord.setRecDate(time);
idxBizPvWarningRecord.setWarningPeriod("按天"); idxBizPvWarningRecord.setWarningPeriod("按天");
idxBizPvWarningRecord.setManufacturer(idxBizPvHealthIndices.get(0).getManufacturer()); idxBizPvWarningRecord.setManufacturer(idxBizPvHealthIndices.get(0).getManufacturer());
...@@ -785,7 +785,7 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -785,7 +785,7 @@ public class HealthStatusIndicatorServiceImpl {
idxBizFanWarningRecord.setDisposotionState("待确认"); idxBizFanWarningRecord.setDisposotionState("待确认");
idxBizFanWarningRecord.setStatus("0"); idxBizFanWarningRecord.setStatus("0");
idxBizFanWarningRecord.setWarningName(level); idxBizFanWarningRecord.setWarningName(level);
idxBizFanWarningRecord.setCONTENT(idxBizFanHealthIndices.get(0).getPointName() + "连续"+content+"健康指数<"+num ); idxBizFanWarningRecord.setCONTENT(idxBizFanHealthIndices.get(0).getPointName() + "连续"+content+"健康指数"+num );
idxBizFanWarningRecord.setRecDate(time); idxBizFanWarningRecord.setRecDate(time);
idxBizFanWarningRecord.setWarningPeriod("按时刻"); idxBizFanWarningRecord.setWarningPeriod("按时刻");
idxBizFanWarningRecord.setNumber(idxBizFanHealthIndices.get(0).getNumber()); idxBizFanWarningRecord.setNumber(idxBizFanHealthIndices.get(0).getNumber());
...@@ -953,7 +953,7 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -953,7 +953,7 @@ public class HealthStatusIndicatorServiceImpl {
idxBizFanWarningRecord.setDisposotionState("待确认"); idxBizFanWarningRecord.setDisposotionState("待确认");
idxBizFanWarningRecord.setStatus("0"); idxBizFanWarningRecord.setStatus("0");
idxBizFanWarningRecord.setWarningName(level); idxBizFanWarningRecord.setWarningName(level);
idxBizFanWarningRecord.setCONTENT(idxBizFanHealthIndices.get(0).getPointName() + "连续"+content+"健康指数<"+num ); idxBizFanWarningRecord.setCONTENT(idxBizFanHealthIndices.get(0).getPointName() + "连续"+content+"健康指数"+num );
idxBizFanWarningRecord.setRecDate(time); idxBizFanWarningRecord.setRecDate(time);
idxBizFanWarningRecord.setWarningPeriod("按小时"); idxBizFanWarningRecord.setWarningPeriod("按小时");
idxBizFanWarningRecord.setNumber(idxBizFanHealthIndices.get(0).getNumber()); idxBizFanWarningRecord.setNumber(idxBizFanHealthIndices.get(0).getNumber());
...@@ -1124,7 +1124,7 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -1124,7 +1124,7 @@ public class HealthStatusIndicatorServiceImpl {
idxBizFanWarningRecord.setDisposotionState("待确认"); idxBizFanWarningRecord.setDisposotionState("待确认");
idxBizFanWarningRecord.setStatus("0"); idxBizFanWarningRecord.setStatus("0");
idxBizFanWarningRecord.setWarningName(level); idxBizFanWarningRecord.setWarningName(level);
idxBizFanWarningRecord.setCONTENT(idxBizFanHealthIndices.get(0).getPointName() + "连续"+content+"健康指数<"+num ); idxBizFanWarningRecord.setCONTENT(idxBizFanHealthIndices.get(0).getPointName() + "连续"+content+"健康指数"+num );
idxBizFanWarningRecord.setRecDate(time); idxBizFanWarningRecord.setRecDate(time);
idxBizFanWarningRecord.setWarningPeriod("按天"); idxBizFanWarningRecord.setWarningPeriod("按天");
idxBizFanWarningRecord.setNumber(idxBizFanHealthIndices.get(0).getNumber()); idxBizFanWarningRecord.setNumber(idxBizFanHealthIndices.get(0).getNumber());
......
...@@ -97,7 +97,9 @@ public class CommonServiceImpl { ...@@ -97,7 +97,9 @@ public class CommonServiceImpl {
public Double getAvagerByEquipmentIndxName(List<ESEquipments> equipments, String indexName) { public Double getAvagerByEquipmentIndxName(List<ESEquipments> equipments, String indexName) {
Double result = 0.00; Double result = 0.00;
result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).filter(esEquipments -> esEquipments.getValueF() != null).mapToDouble(ESEquipments::getValueF).average().getAsDouble(); if(!ObjectUtils.isEmpty(equipments)) {
result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).filter(esEquipments -> esEquipments.getValueF() != null).mapToDouble(ESEquipments::getValueF).average().getAsDouble();
}
return result; return result;
} }
...@@ -128,7 +130,9 @@ public class CommonServiceImpl { ...@@ -128,7 +130,9 @@ public class CommonServiceImpl {
// } // }
public Double getTotalByIndicatior(List<Map<String, Object>> mapList, String indicator) { public Double getTotalByIndicatior(List<Map<String, Object>> mapList, String indicator) {
Double totalvalue = 0.0; Double totalvalue = 0.0;
totalvalue = mapList.stream().filter(stringObjectMap -> stringObjectMap.get("equipmentIndexName").toString().contains(indicator) && !ObjectUtils.isEmpty(stringObjectMap.get("value"))).mapToDouble(l -> Double.parseDouble((String) l.get("value"))).sum(); if(!ObjectUtils.isEmpty(mapList)) {
totalvalue = mapList.stream().filter(stringObjectMap -> stringObjectMap.get("equipmentIndexName").toString().contains(indicator) && !ObjectUtils.isEmpty(stringObjectMap.get("value"))).mapToDouble(l -> Double.parseDouble((String) l.get("value"))).sum();
}
return Double.valueOf(String.format("%.2f", totalvalue)); return Double.valueOf(String.format("%.2f", totalvalue));
} }
...@@ -139,7 +143,9 @@ public class CommonServiceImpl { ...@@ -139,7 +143,9 @@ public class CommonServiceImpl {
*/ */
public Double getAvgvalueByIndicatior(List<Map<String, Object>> mapList, String indicator) { public Double getAvgvalueByIndicatior(List<Map<String, Object>> mapList, String indicator) {
Double avageValue = 0.0; Double avageValue = 0.0;
avageValue = mapList.stream().filter(stringObjectMap -> stringObjectMap.get("equipmentIndexName").toString().contains(indicator) && !ObjectUtils.isEmpty(stringObjectMap.get("value"))).mapToDouble(l -> Double.parseDouble((String) l.get("value"))).sum(); if(!ObjectUtils.isEmpty(mapList)) {
avageValue = mapList.stream().filter(stringObjectMap -> stringObjectMap.get("equipmentIndexName").toString().contains(indicator) && !ObjectUtils.isEmpty(stringObjectMap.get("value"))).mapToDouble(l -> Double.parseDouble((String) l.get("value"))).sum();
}
return Double.valueOf(String.format("%.2f", avageValue)); return Double.valueOf(String.format("%.2f", avageValue));
} }
...@@ -232,7 +238,11 @@ public class CommonServiceImpl { ...@@ -232,7 +238,11 @@ public class CommonServiceImpl {
stationCacheInfoDto.setStationType(stationBasic.getStationType()); stationCacheInfoDto.setStationType(stationBasic.getStationType());
stationCacheInfoDto.setBelongProvince(regionList.stream().filter(region -> region.getRegionCode().toString().equals(stationBasic.getBelongArea().replace("[", "").split(",")[0])).map(region -> region.getRegionName()).collect(Collectors.toList()).get(0)); stationCacheInfoDto.setBelongProvince(regionList.stream().filter(region -> region.getRegionCode().toString().equals(stationBasic.getBelongArea().replace("[", "").split(",")[0])).map(region -> region.getRegionName()).collect(Collectors.toList()).get(0));
stationCacheInfoDto.setBelongArea(mapRegionList.stream().filter(mapRegion -> mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0, 2)) || mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0, 3))).map(mapRegion -> mapRegion.getName()).collect(Collectors.toList()).get(0)); stationCacheInfoDto.setBelongArea(mapRegionList.stream().filter(mapRegion -> mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0, 2)) || mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0, 3))).map(mapRegion -> mapRegion.getName()).collect(Collectors.toList()).get(0));
stationCacheInfoDto.setInstalledCapacity(String.format("%.2f", sjglZsjZsbtzMapper.getStationCapactityByStationWerks(stationBasic.getStationNumber()))); Double installedCapacity = 0.0d;
if(!ObjectUtils.isEmpty(sjglZsjZsbtzMapper.getStationCapactityByStationWerks(stationBasic.getStationNumber()))){
installedCapacity =sjglZsjZsbtzMapper.getStationCapactityByStationWerks(stationBasic.getStationNumber());
}
stationCacheInfoDto.setInstalledCapacity(String.format("%.2f", installedCapacity));
stationCacheInfoDto.setFanGatewayId(stationBasic.getFanGatewayId()); stationCacheInfoDto.setFanGatewayId(stationBasic.getFanGatewayId());
stationCacheInfoDto.setAreaCode(mapRegionList.stream().filter(mapRegion -> mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0, 2)) || mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0, 3))).map(mapRegion -> mapRegion.getAreaCode()).collect(Collectors.toList()).get(0)); stationCacheInfoDto.setAreaCode(mapRegionList.stream().filter(mapRegion -> mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0, 2)) || mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0, 3))).map(mapRegion -> mapRegion.getAreaCode()).collect(Collectors.toList()).get(0));
stationCacheInfoDto.setBoosterGatewayId(stationBasic.getBoosterGatewayId()); stationCacheInfoDto.setBoosterGatewayId(stationBasic.getBoosterGatewayId());
...@@ -371,7 +381,10 @@ public class CommonServiceImpl { ...@@ -371,7 +381,10 @@ public class CommonServiceImpl {
public Double getSumByEquipmentIndxName(List<ESEquipments> equipments, String indexName) { public Double getSumByEquipmentIndxName(List<ESEquipments> equipments, String indexName) {
Double result = 0.00; Double result = 0.00;
result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).filter(esEquipments -> esEquipments.getValueF() != null).mapToDouble(ESEquipments::getValueF).sum(); if(equipments!=null)
{
result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).filter(esEquipments -> esEquipments.getValueF() != null).mapToDouble(ESEquipments::getValueF).sum();
}
return result; return result;
} }
......
...@@ -868,9 +868,8 @@ public Map<String,Object> gettimedateyfd( ){ ...@@ -868,9 +868,8 @@ public Map<String,Object> gettimedateyfd( ){
// List<String> fdGatewayId = stationBasicListfd.stream().map(StationBasic::getBoosterGatewayId).collect(Collectors.joining(",")); // List<String> fdGatewayId = stationBasicListfd.stream().map(StationBasic::getBoosterGatewayId).collect(Collectors.joining(","));
// List<String> gfGatewayId = stationBasicListgf.stream().map(StationBasic::getBoosterGatewayId).collect(Collectors.toList()); // List<String> gfGatewayId = stationBasicListgf.stream().map(StationBasic::getBoosterGatewayId).collect(Collectors.toList());
String fdGatewayIds= stationBasicListfd.stream().map(stationBasic -> "'"+stationBasic.getBoosterGatewayId()+"'").collect(Collectors.joining(","));
String fdGatewayIds= stationBasicListfd.stream().map(StationBasic::getBoosterGatewayId).collect(Collectors.joining(",")); String gfGatewayIds=stationBasicListgf.stream().map(stationBasic -> "'"+stationBasic.getBoosterGatewayId()+"'").collect(Collectors.joining(","));
String gfGatewayIds=stationBasicListgf.stream().map(StationBasic::getBoosterGatewayId).collect(Collectors.joining(","));
List<StationBasic> stationBasicListAll=new ArrayList<>(); List<StationBasic> stationBasicListAll=new ArrayList<>();
...@@ -891,22 +890,22 @@ public Map<String,Object> gettimedateyfd( ){ ...@@ -891,22 +890,22 @@ public Map<String,Object> gettimedateyfd( ){
List<IndicatorData> activePowerListGF = new ArrayList<>(); List<IndicatorData> activePowerListGF = new ArrayList<>();
// String startTime = cn.hutool.core.date.DateUtil.today() + " 00:00:00"; // String startTime = cn.hutool.core.date.DateUtil.today() + " 00:00:00";
// String endTime = cn.hutool.core.date.DateUtil.today() + " 23:59:59"; // String endTime = cn.hutool.core.date.DateUtil.today() + " 23:59:59";
Date currentDayStartTime = DateUtils.getCurrentDayStartTime(new Date()); // Date currentDayStartTime = DateUtils.getCurrentDayStartTime(new Date());
Date currentDayEndTime = DateUtils.getCurrentDayEndTime(new Date()); // Date currentDayEndTime = DateUtils.getCurrentDayEndTime(new Date());
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC")); // Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); // SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
sdf.setTimeZone(TimeZone.getTimeZone("UTC")); // sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
String startTime = sdf.format(currentDayStartTime); // String startTime = sdf.format(currentDayStartTime);
String endTime= sdf.format(currentDayEndTime); // String endTime= sdf.format(currentDayEndTime);
activePowerListFD = indicatorDataMapper.selectDataByequipmentIndexNameAndtimeqg(CommonConstans.xiazaoActivePowerPoint, startTime, endTime, fdGatewayIds); activePowerListFD = indicatorDataMapper.selectDataByequipmentIndexNameAndtimeqgNew(CommonConstans.xiazaoActivePowerPoint, fdGatewayIds);
activePowerListGF = indicatorDataMapper.selectDataByequipmentIndexNameAndtimeqg(CommonConstans.taiheActivePowerPoint, startTime, endTime, gfGatewayIds); activePowerListGF = indicatorDataMapper.selectDataByequipmentIndexNameAndtimeqgNew(CommonConstans.taiheActivePowerPoint, gfGatewayIds);
System.out.println(JSON.toJSONString(activePowerListFD)); System.out.println(JSON.toJSONString(activePowerListFD));
for (int i = 0; i < activePowerListFD.size(); i++) { for (int i = 0; i < activePowerListFD.size(); i++) {
IndicatorData indicatorData = activePowerListFD.get(i); IndicatorData indicatorData = activePowerListFD.get(i);
IndicatorData indicatorData2 = activePowerListGF.get(i); IndicatorData indicatorData2 = activePowerListGF.get(i);
time.add(indicatorData.getXtime()); time.add(cn.hutool.core.date.DateUtil.format(indicatorData.getCreatedTime(), "HH:mm"));
// Double vl= indicatorData.getValueF()+indicatorData2.getValueF() * CommonConstans.kwToMv; // Double vl= indicatorData.getValueF()+indicatorData2.getValueF() * CommonConstans.kwToMv;
Double vl= Double.valueOf(String.format(CommonConstans.Twodecimalplaces, indicatorData.getValueF()))+ Double vl= Double.valueOf(String.format(CommonConstans.Twodecimalplaces, indicatorData.getValueF()))+
Double.valueOf(String.format(CommonConstans.Twodecimalplaces, indicatorData2.getValueF() * CommonConstans.kwToMv)); Double.valueOf(String.format(CommonConstans.Twodecimalplaces, indicatorData2.getValueF() * CommonConstans.kwToMv));
......
...@@ -1936,17 +1936,20 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -1936,17 +1936,20 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
Double powerOfDay = 0.0000; Double powerOfDay = 0.0000;
Double powerOfMonth = 0.0000; Double powerOfMonth = 0.0000;
Double powerOfAnnual = 0.0000; Double powerOfAnnual = 0.0000;
if(ObjectUtils.isEmpty(query)){ if(result!=null)
powerOfDay = powerOfDay + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")); {
powerOfMonth = powerOfMonth + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")); if(ObjectUtils.isEmpty(query)){
powerOfAnnual = powerOfAnnual + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")); powerOfDay = powerOfDay + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量"));
}else { powerOfMonth = powerOfMonth + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量"));
powerOfDay = powerOfDay + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay)); powerOfAnnual = powerOfAnnual + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量"));
powerOfMonth = powerOfMonth + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth)); }else {
powerOfAnnual = powerOfAnnual + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)); powerOfDay = powerOfDay + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay));
} powerOfMonth = powerOfMonth + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth));
powerOfAnnual = powerOfAnnual + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear));
}
}
Map<String, Object> hashMap = new HashMap<>(); Map<String, Object> hashMap = new HashMap<>();
hashMap.put("日发电量",powerOfDay); hashMap.put("日发电量",powerOfDay);
hashMap.put("月发电量",powerOfMonth); hashMap.put("月发电量",powerOfMonth);
......
...@@ -30,114 +30,112 @@ import java.util.*; ...@@ -30,114 +30,112 @@ import java.util.*;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Service @Service
public class MonitoringServiceImpl { public class MonitoringServiceImpl {
Logger logger = LoggerFactory.getLogger(MonitoringServiceImpl.class); Logger logger = LoggerFactory.getLogger(MonitoringServiceImpl.class);
@Value("${plannedPowerGenerationTotal:10000}") @Value("${plannedPowerGenerationTotal:10000}")
Long plannedPowerGenerationTotal; Long plannedPowerGenerationTotal;
/** /**
* 区域mapper * 区域mapper
*/ */
@Autowired @Autowired
RegionMapper regionMapper; RegionMapper regionMapper;
@Autowired @Autowired
StationPlanMapper stationPlanMapper; StationPlanMapper stationPlanMapper;
@Autowired @Autowired
IndicatorDataMapper indicatorDataMapper; IndicatorDataMapper indicatorDataMapper;
/** /**
* 场站mapper * 场站mapper
*/ */
@Autowired @Autowired
StationBasicMapper stationBasicMapper; StationBasicMapper stationBasicMapper;
/** /**
* 场站坐标mapper * 场站坐标mapper
*/ */
@Autowired @Autowired
StationCoordinateMapper stationCoordinateMapper; StationCoordinateMapper stationCoordinateMapper;
/*** /***
* 设备基础信息中间表数据-热工院 * 设备基础信息中间表数据-热工院
*/ */
@Autowired @Autowired
SjglZsjZsbtzServiceImpl SjglZsjZsbtzServiceImpl; SjglZsjZsbtzServiceImpl SjglZsjZsbtzServiceImpl;
@Autowired
@Autowired CommonServiceImpl commonServiceImpl;
CommonServiceImpl commonServiceImpl;
// 维护的接口信息
//维护的接口信息 @Autowired
@Autowired MapRegionMapper mapRegionMapper;
MapRegionMapper mapRegionMapper;
@Autowired
@Autowired EmqKeeper emqKeeper;
EmqKeeper emqKeeper;
// @Autowired // @Autowired
// InfluxdbUtil influxdbUtil; // InfluxdbUtil influxdbUtil;
/**
/** * 根据场站编号获取该场站的装机容量
* 根据场站编号获取该场站的装机容量 *
* * @param werks
* @param werks * @return
* @return */
*/ public Double getStationCaPACITYL(String werks) {
public Double getStationCaPACITYL(String werks) { Double installCapacity = 0.0;
Double installCapacity = 0.0; installCapacity = this.SjglZsjZsbtzServiceImpl.getStationCapactityByStationWerks(werks);
installCapacity = this.SjglZsjZsbtzServiceImpl.getStationCapactityByStationWerks(werks); return ObjectUtils.isEmpty(installCapacity) ? 0.00 : installCapacity;
return ObjectUtils.isEmpty(installCapacity) ? 0.00 : installCapacity; }
}
/***
* 获取风站场站
/*** *
* 获取风站场站 */
* public Map<String, String> getStationfs(StationBasic stationBasic) {
* */ String value = "0";
public Map<String, String> getStationfs(StationBasic stationBasic) { Map<String, String> map = new HashMap<>();
String value = "0"; Map<String, List<String>> queryCondtion = new HashMap<>();
Map<String, String> map = new HashMap<>(); if (stationBasic.getStationType().equals("FDZ")) {
Map<String, List<String>> queryCondtion = new HashMap<>(); String gatewayId = stationBasic.getFanGatewayId();
if (stationBasic.getStationType().equals("FDZ")) { queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("30秒平均风速"));
String gatewayId = stationBasic.getFanGatewayId(); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId));
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("30秒平均风速")); List<ESEquipments> result2 = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId)); ESEquipments.class);
List<ESEquipments> result2 = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); value = String.format("%.2f", commonServiceImpl.getAvagerByEquipmentIndxName(result2, "30秒平均风速"));
value = String.format("%.2f", commonServiceImpl.getAvagerByEquipmentIndxName(result2, "30秒平均风速")); map.put("name", "风速/辐照度");
map.put("name", "风速/辐照度"); map.put("value", value + "m/s");
map.put("value", value + "m/s"); } else {
} else { queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("WTX-801_25_WTX-801_总辐射"));
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("WTX-801_25_WTX-801_总辐射")); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId())); List<ESEquipments> result1 = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
List<ESEquipments> result1 = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); ESEquipments.class);
value = String.format("%.2f", commonServiceImpl.getSumByEquipmentIndxName(result1, "WTX-801_25_WTX-801_总辐射")); value = String.format("%.2f",
map.put("name", "风速/辐照度"); commonServiceImpl.getSumByEquipmentIndxName(result1, "WTX-801_25_WTX-801_总辐射"));
map.put("value", value + "W/㎡"); map.put("name", "风速/辐照度");
} map.put("value", value + "W/㎡");
}
return map; return map;
} }
/*** /***
* 电站容量 * 电站容量
* */ */
public Map<String, String> getStationrl(StationBasic stationBasic) { public Map<String, String> getStationrl(StationBasic stationBasic) {
Double installCapacity = 0.0; Double installCapacity = 0.0;
installCapacity = this.SjglZsjZsbtzServiceImpl.getStationCapactityByStationWerks(stationBasic.getStationNumber()); installCapacity = this.SjglZsjZsbtzServiceImpl
String value = ObjectUtils.isEmpty(installCapacity) ? "0.00" : String.format("%.2f", installCapacity); .getStationCapactityByStationWerks(stationBasic.getStationNumber());
Map<String, String> map = new HashMap<>(); String value = ObjectUtils.isEmpty(installCapacity) ? "0.00" : String.format("%.2f", installCapacity);
map.put("name", "容量"); Map<String, String> map = new HashMap<>();
map.put("value", value + "MW"); map.put("name", "容量");
return map; map.put("value", value + "MW");
} return map;
}
/** /**
* 根据省份名称查询电站详情 * 根据省份名称查询电站详情
* *
* @param provinceName * @param provinceName
* @return * @return
*/ */
// public List<RegionNationWideDto> getNationWideInfo(String provinceName, String type) { // public List<RegionNationWideDto> getNationWideInfo(String provinceName, String type) {
// List<RegionNationWideDto> regionNationWideDtoList = new ArrayList<>(); // List<RegionNationWideDto> regionNationWideDtoList = new ArrayList<>();
// List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area").isNotNull("fan_gateway_id")); // List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area").isNotNull("fan_gateway_id"));
...@@ -226,7 +224,6 @@ public class MonitoringServiceImpl { ...@@ -226,7 +224,6 @@ public class MonitoringServiceImpl {
// return regionNationWideDtoList; // return regionNationWideDtoList;
// } // }
// public ResultsData getCompletionOfPowerIndicatorsByProvinceName(int current, int size, String provinceName) { // public ResultsData getCompletionOfPowerIndicatorsByProvinceName(int current, int size, String provinceName) {
// //
// List<ColModel> colModels = new ArrayList<>(); // List<ColModel> colModels = new ArrayList<>();
...@@ -368,82 +365,95 @@ public class MonitoringServiceImpl { ...@@ -368,82 +365,95 @@ public class MonitoringServiceImpl {
// logger.error("-----------------发送区域实时生产数据消息=================== 失败!"); // logger.error("-----------------发送区域实时生产数据消息=================== 失败!");
// } // }
// } // }
public List<TabDto> getTabsByStationBasicId(String stationBasicId) { public List<TabDto> getTabsByStationBasicId(String stationBasicId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationBasicId); StationBasic stationBasic = stationBasicMapper.selectById(stationBasicId);
List<TabDto> tabDtoList = new ArrayList<>(); List<TabDto> tabDtoList = new ArrayList<>();
if (stationBasic.getStationType().contains("FDZ") && stationBasic.getStationType().length() < 4) { if (stationBasic.getStationType().contains("FDZ") && stationBasic.getStationType().length() < 4) {
TabDto tab0 = new TabDto("风机布置图", "0"); TabDto tab0 = new TabDto("风机布置图", "0");
TabDto tab1 = new TabDto("集电线路图", "1"); TabDto tab1 = new TabDto("集电线路图", "1");
TabDto tab2 = new TabDto("运行列表", "2"); TabDto tab2 = new TabDto("运行列表", "2");
TabDto tab3 = new TabDto("升压站监控", "3"); TabDto tab3 = new TabDto("升压站监控", "3");
TabDto tab4 = new TabDto("电量表计", "4"); TabDto tab4 = new TabDto("电量表计", "4");
TabDto tab5 = new TabDto("故障信息", "5"); TabDto tab5 = new TabDto("故障信息", "5");
tabDtoList.add(tab0); tabDtoList.add(tab0);
tabDtoList.add(tab1); tabDtoList.add(tab1);
tabDtoList.add(tab2); tabDtoList.add(tab2);
tabDtoList.add(tab3); tabDtoList.add(tab3);
tabDtoList.add(tab4); tabDtoList.add(tab4);
tabDtoList.add(tab5); tabDtoList.add(tab5);
} else { } else {
TabDto tab6 = new TabDto("光伏区布置图", "6"); TabDto tab6 = new TabDto("光伏区布置图", "6");
TabDto tab7 = new TabDto("集电线路图", "7"); TabDto tab7 = new TabDto("集电线路图", "7");
TabDto tab8 = new TabDto("运行列表", "8"); TabDto tab8 = new TabDto("运行列表", "8");
TabDto tab9 = new TabDto("升压站监控", "9"); TabDto tab9 = new TabDto("升压站监控", "9");
TabDto tab10 = new TabDto("电量表计", "10"); TabDto tab10 = new TabDto("电量表计", "10");
TabDto tab11 = new TabDto("故障信息", "11"); TabDto tab11 = new TabDto("故障信息", "11");
// TabDto tab12 = new TabDto("集中式-离散率", "12"); // TabDto tab12 = new TabDto("集中式-离散率", "12");
// TabDto tab13 = new TabDto("组串式-离散率", "13"); // TabDto tab13 = new TabDto("组串式-离散率", "13");
TabDto tab14 = new TabDto("离散率", "14"); TabDto tab14 = new TabDto("离散率", "14");
tabDtoList.add(tab6); tabDtoList.add(tab6);
tabDtoList.add(tab7); tabDtoList.add(tab7);
tabDtoList.add(tab8); tabDtoList.add(tab8);
tabDtoList.add(tab9); tabDtoList.add(tab9);
tabDtoList.add(tab10); tabDtoList.add(tab10);
tabDtoList.add(tab11); tabDtoList.add(tab11);
// tabDtoList.add(tab12); // tabDtoList.add(tab12);
// tabDtoList.add(tab13); // tabDtoList.add(tab13);
tabDtoList.add(tab14); tabDtoList.add(tab14);
} }
return tabDtoList; return tabDtoList;
} }
public List<MapAreaInfoDto> getAreaInfo() { public List<MapAreaInfoDto> getAreaInfo() {
List<MapAreaInfoDto> mapAreaInfoDtoList = new ArrayList<>(); List<MapAreaInfoDto> mapAreaInfoDtoList = new ArrayList<>();
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area")); List<StationBasic> stationBasicList = stationBasicMapper
List<MapRegion> mapRegionList = mapRegionMapper.selectList(new QueryWrapper<MapRegion>().isNotNull("name")); .selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area"));
List<Region> regionList = regionMapper.selectList(new QueryWrapper<Region>().eq("LEVEL", 1)); List<MapRegion> mapRegionList = mapRegionMapper.selectList(new QueryWrapper<MapRegion>().isNotNull("name"));
mapRegionList.forEach(mapRegion -> { List<Region> regionList = regionMapper.selectList(new QueryWrapper<Region>().eq("LEVEL", 1));
MapAreaInfoDto mapAreaInfoDto = new MapAreaInfoDto(); mapRegionList.forEach(mapRegion -> {
//开始处理省份名称-三维与二维的名称有差异 MapAreaInfoDto mapAreaInfoDto = new MapAreaInfoDto();
ArrayList<String> stringArrayList = mapRegion.getProvince(); // 开始处理省份名称-三维与二维的名称有差异
List<Region> regions = regionList.stream().filter(region -> stringArrayList.contains(region.getRegionName().substring(0, 2)) || stringArrayList.contains(region.getRegionName().substring(0, 3))).collect(Collectors.toList()); ArrayList<String> stringArrayList = mapRegion.getProvince();
List<String> regionNames = regions.stream().map(region -> region.getRegionName()).collect(Collectors.toList()); List<Region> regions = regionList.stream()
List<String> regionCodes = regions.stream().map(region -> String.valueOf(region.getRegionCode())).collect(Collectors.toList()); .filter(region -> stringArrayList.contains(region.getRegionName().substring(0, 2))
List<StationBasic> stationBasicListAll = stationBasicList.stream().filter(stationBasic -> regionCodes.contains(stationBasic.getBelongArea().replace("[", "").replace("]", "").split(",")[0])).collect(Collectors.toList()); || stringArrayList.contains(region.getRegionName().substring(0, 3)))
mapAreaInfoDto.setProvince(regionNames); .collect(Collectors.toList());
// --------------------省份名称处理结束---------------------------- List<String> regionNames = regions.stream().map(region -> region.getRegionName())
//设置片区名称 .collect(Collectors.toList());
mapAreaInfoDto.setAreaName(mapRegion.getName()); List<String> regionCodes = regions.stream().map(region -> String.valueOf(region.getRegionCode()))
//设置片区code .collect(Collectors.toList());
mapAreaInfoDto.setAreaCode(mapRegion.getAreaCode()); List<StationBasic> stationBasicListAll = stationBasicList.stream()
//风电站数量 .filter(stationBasic -> regionCodes
mapAreaInfoDto.setWindPowerStationCount(String.valueOf(stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FDZ")).count())); .contains(stationBasic.getBelongArea().replace("[", "").replace("]", "").split(",")[0]))
//集中式光伏电站数量 .collect(Collectors.toList());
mapAreaInfoDto.setCentralizedPhotovoltaicStationCount(String.valueOf(stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("JZSGFDZ")).count())); mapAreaInfoDto.setProvince(regionNames);
//分布式光伏电站数量 // --------------------省份名称处理结束----------------------------
mapAreaInfoDto.setDistributedPhotovoltaicStationCount(String.valueOf(stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FBSGFDZ")).count())); // 设置片区名称
//储能光伏电站数量 mapAreaInfoDto.setAreaName(mapRegion.getName());
mapAreaInfoDto.setEnergyStorageStationCount(String.valueOf(stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("CNDZ")).count())); // 设置片区code
//获取装机容量 mapAreaInfoDto.setAreaCode(mapRegion.getAreaCode());
mapAreaInfoDto.setInstalledCapacity(getInstallCapity(stationBasicListAll)); // 风电站数量
//获取当日发电量 mapAreaInfoDto.setWindPowerStationCount(String.valueOf(stationBasicListAll.stream()
mapAreaInfoDto.setElectricityGenerationOfDay(getPowerOfDaily(stationBasicListAll)); .filter(stationBasic -> stationBasic.getStationType().equals("FDZ")).count()));
mapAreaInfoDto.setPosition(mapRegion.getPosition()); // 集中式光伏电站数量
mapAreaInfoDtoList.add(mapAreaInfoDto); mapAreaInfoDto.setCentralizedPhotovoltaicStationCount(String.valueOf(stationBasicListAll.stream()
}); .filter(stationBasic -> stationBasic.getStationType().equals("JZSGFDZ")).count()));
// 分布式光伏电站数量
return mapAreaInfoDtoList; mapAreaInfoDto.setDistributedPhotovoltaicStationCount(String.valueOf(stationBasicListAll.stream()
} .filter(stationBasic -> stationBasic.getStationType().equals("FBSGFDZ")).count()));
// 储能光伏电站数量
mapAreaInfoDto.setEnergyStorageStationCount(String.valueOf(stationBasicListAll.stream()
.filter(stationBasic -> stationBasic.getStationType().equals("CNDZ")).count()));
// 获取装机容量
mapAreaInfoDto.setInstalledCapacity(getInstallCapity(stationBasicListAll));
// 获取当日发电量
mapAreaInfoDto.setElectricityGenerationOfDay(getPowerOfDaily(stationBasicListAll));
mapAreaInfoDto.setPosition(mapRegion.getPosition());
mapAreaInfoDtoList.add(mapAreaInfoDto);
});
return mapAreaInfoDtoList;
}
// public List<HomeMapStationInfoDto> getStaitonListInfoByAreaName(String areaName) { // public List<HomeMapStationInfoDto> getStaitonListInfoByAreaName(String areaName) {
// List<HomeMapStationInfoDto> homeMapStationInfoDtoList = new ArrayList<>(); // List<HomeMapStationInfoDto> homeMapStationInfoDtoList = new ArrayList<>();
...@@ -488,160 +498,172 @@ public class MonitoringServiceImpl { ...@@ -488,160 +498,172 @@ public class MonitoringServiceImpl {
// return homeMapStationInfoDtoList; // return homeMapStationInfoDtoList;
// } // }
public Map<String, Object> getDetailsWindSpeedAlldata(StationBasic stationBasic) {
public Map<String, Object> getDetailsWindSpeedAlldata(StationBasic stationBasic) { Map<String, Object> map = new HashMap<>();
Map<String, Object> map = new HashMap<>(); List<String> values = new ArrayList<>();
List<String> values = new ArrayList<>(); Map<Date, Double> groupMap = new HashMap<>();
Map<Date, Double> groupMap = new HashMap<>(); List<String> time = new ArrayList<>();
List<String> time = new ArrayList<>(); Map<String, Object> activePowerInfo = new HashMap<>();
Map<String, Object> activePowerInfo = new HashMap<>(); List<IndicatorData> activePowerList = new ArrayList<>();
List<IndicatorData> activePowerList = new ArrayList<>();
// String startTime = DateUtil.today() + " 00:00:00"; // String startTime = DateUtil.today() + " 00:00:00";
// String endTime = DateUtil.today() + " 23:59:59"; // String endTime = DateUtil.today() + " 23:59:59";
Date currentDayStartTime = DateUtils.getCurrentDayStartTime(new Date()); Date currentDayStartTime = DateUtils.getCurrentDayStartTime(new Date());
Date currentDayEndTime = DateUtils.getCurrentDayEndTime(new Date()); Date currentDayEndTime = DateUtils.getCurrentDayEndTime(new Date());
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC")); Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
sdf.setTimeZone(TimeZone.getTimeZone("UTC")); sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
String startTime = sdf.format(currentDayStartTime); String startTime = sdf.format(currentDayStartTime);
String endTime = sdf.format(currentDayEndTime); String endTime = sdf.format(currentDayEndTime);
Double installedCapacity = commonServiceImpl.getStationCapactityByStationWerks(stationBasic.getStationNumber()); Double installedCapacity = commonServiceImpl.getStationCapactityByStationWerks(stationBasic.getStationNumber());
if ("FDZ".equals(stationBasic.getStationType())) { if ("FDZ".equals(stationBasic.getStationType())) {
activePowerList = indicatorDataMapper.selectDataByequipmentIndexNameAndtime(CommonConstans.xiazaoActivePowerPoint, startTime, endTime, stationBasic.getBoosterGatewayId()); activePowerList = indicatorDataMapper.selectDataByequipmentIndexNameAndtime(
} else { CommonConstans.xiazaoActivePowerPoint, startTime, endTime, stationBasic.getBoosterGatewayId());
activePowerList = indicatorDataMapper.selectDataByequipmentIndexNameAndtime(CommonConstans.taiheActivePowerPoint, startTime, endTime, stationBasic.getBoosterGatewayId()); } else {
} activePowerList = indicatorDataMapper.selectDataByequipmentIndexNameAndtime(
for (int i = 0; i < activePowerList.size(); i++) { CommonConstans.taiheActivePowerPoint, startTime, endTime, stationBasic.getBoosterGatewayId());
IndicatorData indicatorData = activePowerList.get(i); }
time.add(DateUtil.format(indicatorData.getCreatedTime(), "HH:mm")); for (int i = 0; i < activePowerList.size(); i++) {
if ("FDZ".equals(stationBasic.getStationType())) { IndicatorData indicatorData = activePowerList.get(i);
values.add(String.format(CommonConstans.Twodecimalplaces, indicatorData.getValueF())); time.add(DateUtil.format(indicatorData.getCreatedTime(), "HH:mm"));
} else { if ("FDZ".equals(stationBasic.getStationType())) {
values.add(String.format(CommonConstans.Twodecimalplaces, indicatorData.getValueF() * CommonConstans.kwToMv)); values.add(String.format(CommonConstans.Twodecimalplaces, indicatorData.getValueF()));
} } else {
} values.add(String.format(CommonConstans.Twodecimalplaces,
String max = String.format(CommonConstans.Twodecimalplaces, values.stream().mapToDouble(Double::parseDouble).max().getAsDouble()); indicatorData.getValueF() * CommonConstans.kwToMv));
String min = String.format(CommonConstans.Twodecimalplaces, values.stream().mapToDouble(Double::parseDouble).min().getAsDouble()); }
String mean = String.format(CommonConstans.Twodecimalplaces, values.stream().mapToDouble(Double::parseDouble).average().getAsDouble()); }
activePowerInfo.put("mean", mean); String max = String.format(CommonConstans.Twodecimalplaces,
activePowerInfo.put("max", max); values.stream().mapToDouble(Double::parseDouble).max().getAsDouble());
activePowerInfo.put("min", min); String min = String.format(CommonConstans.Twodecimalplaces,
activePowerInfo.put("maxTime", time.get(values.lastIndexOf(max))); values.stream().mapToDouble(Double::parseDouble).min().getAsDouble());
activePowerInfo.put("minTime", time.get(values.lastIndexOf(min))); String mean = String.format(CommonConstans.Twodecimalplaces,
activePowerInfo.put("load", String.format(CommonConstans.Twodecimalplaces, Double.valueOf(values.get(values.size() - 1)) / installedCapacity)); values.stream().mapToDouble(Double::parseDouble).average().getAsDouble());
activePowerInfo.put("mean", mean);
activePowerInfo.put("max", max);
List<Map<String, Object>> seriesData = new ArrayList<>(); activePowerInfo.put("min", min);
Map<String, Object> map3 = new HashMap<>(); activePowerInfo.put("maxTime", time.get(values.lastIndexOf(max)));
Map<String, Object> map1 = new HashMap<>(); activePowerInfo.put("minTime", time.get(values.lastIndexOf(min)));
Map<String, Object> map2 = new HashMap<>(); activePowerInfo.put("load", String.format(CommonConstans.Twodecimalplaces,
map1.put("data", values); Double.valueOf(values.get(values.size() - 1)) / installedCapacity));
seriesData.add(map1);
map.put("seriesData", seriesData); List<Map<String, Object>> seriesData = new ArrayList<>();
map.put("axisData", time); Map<String, Object> map3 = new HashMap<>();
try { Map<String, Object> map1 = new HashMap<>();
emqKeeper.getMqttClient().publish(stationBasic.getSequenceNbr() + "_Power_table", JSON.toJSON(map).toString().getBytes("UTF-8"), 1, true); Map<String, Object> map2 = new HashMap<>();
emqKeeper.getMqttClient().publish(stationBasic.getSequenceNbr() + "_Power_info", JSON.toJSON(activePowerInfo).toString().getBytes("UTF-8"), 1, true); map1.put("data", values);
} catch (Exception exception) { seriesData.add(map1);
exception.printStackTrace(); map.put("seriesData", seriesData);
} map.put("axisData", time);
return map; try {
} emqKeeper.getMqttClient().publish(stationBasic.getSequenceNbr() + "_Power_table",
JSON.toJSON(map).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish(stationBasic.getSequenceNbr() + "_Power_info",
public String getInstallCapity(List<StationBasic> stationBasicList) { JSON.toJSON(activePowerInfo).toString().getBytes("UTF-8"), 1, true);
AtomicReference<Double> total = new AtomicReference<>(0.0); } catch (Exception exception) {
stationBasicList.forEach(stationBasic -> { exception.printStackTrace();
if (stationBasic.getStationNumber() != null) { }
try { return map;
total.updateAndGet(v -> v + getStationCaPACITYL(stationBasic.getStationNumber())); }
} catch (Exception e) {
public String getInstallCapity(List<StationBasic> stationBasicList) {
} AtomicReference<Double> total = new AtomicReference<>(0.0);
} stationBasicList.forEach(stationBasic -> {
}); if (stationBasic.getStationNumber() != null) {
return String.format("%.2f", total.get()); try {
} total.updateAndGet(v -> v + getStationCaPACITYL(stationBasic.getStationNumber()));
} catch (Exception e) {
public String getPowerOfDaily(List<StationBasic> stationBasicList) {
}
AtomicReference<Double> total = new AtomicReference<>(0.0); }
stationBasicList.forEach(stationBasic -> { });
if (stationBasic.getFanGatewayId() != null) { return String.format("%.2f", total.get());
try { }
total.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), "日发电量"));
} catch (Exception e) { public String getPowerOfDaily(List<StationBasic> stationBasicList) {
} AtomicReference<Double> total = new AtomicReference<>(0.0);
} stationBasicList.forEach(stationBasic -> {
if (stationBasic.getFanGatewayId() != null) {
}); try {
return String.format("%.2f", total.get()); total.updateAndGet(
} v -> v + commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), "日发电量"));
} catch (Exception e) {
public List<Map<String, String>> getStaionCategoryInfo(String areaName) {
List<StationBasic> stationBasicListAll = new ArrayList<>(); }
List<Map<String, String>> result = new ArrayList<>(); }
if (!ObjectUtils.isEmpty(areaName)) {
stationBasicListAll = getListOfStationBasicByAreaName(areaName); });
} else { return String.format("%.2f", total.get());
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id")); }
}
Map<String, List<StationBasic>> listMap = stationBasicListAll.stream().collect(Collectors.groupingBy(stationBasic -> stationBasic.getStationTypeName())); public List<Map<String, String>> getStaionCategoryInfo(String areaName) {
listMap.keySet().forEach(key -> { List<StationBasic> stationBasicListAll = new ArrayList<>();
Map<String, String> stringStringMap = new HashMap<>(); List<Map<String, String>> result = new ArrayList<>();
stringStringMap.put("name", key); if (!ObjectUtils.isEmpty(areaName)) {
stringStringMap.put("value", String.valueOf(listMap.get(key).size())); stationBasicListAll = getListOfStationBasicByAreaName(areaName);
result.add(stringStringMap); } else {
}); stationBasicListAll = stationBasicMapper
return result; .selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
} }
Map<String, List<StationBasic>> listMap = stationBasicListAll.stream()
//获取装机容量 .collect(Collectors.groupingBy(stationBasic -> stationBasic.getStationTypeName()));
public HashMap<String, String> getInstallCapityByAreaName(String areaName) { listMap.keySet().forEach(key -> {
HashMap<String, String> hashMap = new HashMap<>(); Map<String, String> stringStringMap = new HashMap<>();
AtomicReference<Double> total = new AtomicReference<>(0.0); stringStringMap.put("name", key);
List<StationBasic> stationBasicListAll = new ArrayList<>(); stringStringMap.put("value", String.valueOf(listMap.get(key).size()));
if (!ObjectUtils.isEmpty(areaName)) { result.add(stringStringMap);
stationBasicListAll = getListOfStationBasicByAreaName(areaName); });
} else { return result;
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id")); }
}
stationBasicListAll.forEach(stationBasic -> { // 获取装机容量
total.updateAndGet(v -> v + getStationCaPACITYL(stationBasic.getStationNumber())); public HashMap<String, String> getInstallCapityByAreaName(String areaName) {
}); HashMap<String, String> hashMap = new HashMap<>();
hashMap.put("title", String.format("%.2f", total.get())); AtomicReference<Double> total = new AtomicReference<>(0.0);
return hashMap; List<StationBasic> stationBasicListAll = new ArrayList<>();
} if (!ObjectUtils.isEmpty(areaName)) {
stationBasicListAll = getListOfStationBasicByAreaName(areaName);
//获取有功功率 } else {
public HashMap<String, String> getActivePowerByAreaName(String areaName) { stationBasicListAll = stationBasicMapper
HashMap<String, String> hashMap = new HashMap<>(); .selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
AtomicReference<Double> total = new AtomicReference<>(0.0); }
List<StationBasic> stationBasicListAll = new ArrayList<>(); stationBasicListAll.forEach(stationBasic -> {
if (!ObjectUtils.isEmpty(areaName)) { total.updateAndGet(v -> v + getStationCaPACITYL(stationBasic.getStationNumber()));
stationBasicListAll = getListOfStationBasicByAreaName(areaName); });
} else { hashMap.put("title", String.format("%.2f", total.get()));
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id")); return hashMap;
} }
stationBasicListAll.forEach(stationBasic -> {
total.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), "有功功率")); // 获取有功功率
}); public HashMap<String, String> getActivePowerByAreaName(String areaName) {
//有功功率换算 HashMap<String, String> hashMap = new HashMap<>();
hashMap.put("title", String.format("%.2f", total.get() / 1000)); AtomicReference<Double> total = new AtomicReference<>(0.0);
return hashMap; List<StationBasic> stationBasicListAll = new ArrayList<>();
} if (!ObjectUtils.isEmpty(areaName)) {
stationBasicListAll = getListOfStationBasicByAreaName(areaName);
//获取社会贡献 } else {
stationBasicListAll = stationBasicMapper
/** .selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
* @param areaName 片区名称 }
* @param stationId 场站id stationBasicListAll.forEach(stationBasic -> {
* @return 社会贡献列表 total.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), "有功功率"));
* @deprecated 如果areaName 与 stationID 都不传 则查全国、如果areaName传了 staionID没有传则查片区 如果 areaName 与stationId都传 则取场站id });
*/ // 有功功率换算
hashMap.put("title", String.format("%.2f", total.get() / 1000));
return hashMap;
}
// 获取社会贡献
/**
* @param areaName 片区名称
* @param stationId 场站id
* @return 社会贡献列表
* @deprecated 如果areaName 与 stationID 都不传 则查全国、如果areaName传了 staionID没有传则查片区 如果
* areaName 与stationId都传 则取场站id
*/
// public Page<SocialContributionDto> getSocialContributionDtoList(String areaName, String stationId) { // public Page<SocialContributionDto> getSocialContributionDtoList(String areaName, String stationId) {
// AtomicReference<Double> total = new AtomicReference<>(0.0); // AtomicReference<Double> total = new AtomicReference<>(0.0);
// List<StationBasic> stationBasicListAll = new ArrayList<>(); // List<StationBasic> stationBasicListAll = new ArrayList<>();
...@@ -731,20 +753,21 @@ public class MonitoringServiceImpl { ...@@ -731,20 +753,21 @@ public class MonitoringServiceImpl {
// hashMapPage.setRecords(hashMapList); // hashMapPage.setRecords(hashMapList);
// return hashMapPage; // return hashMapPage;
// } // }
public List<StationBasic> getListOfStationBasicByAreaName(String areaName) { public List<StationBasic> getListOfStationBasicByAreaName(String areaName) {
List<StationBasic> stationBasicListAll = new ArrayList<>(); List<StationBasic> stationBasicListAll = new ArrayList<>();
MapRegion mapRegion = mapRegionMapper.selectOne(new QueryWrapper<MapRegion>().eq("name", areaName)); MapRegion mapRegion = mapRegionMapper.selectOne(new QueryWrapper<MapRegion>().eq("name", areaName));
//获取片区下的省份名称 // 获取片区下的省份名称
ArrayList<String> stringArrayList = mapRegion.getProvince(); ArrayList<String> stringArrayList = mapRegion.getProvince();
//变量获取所有的场站信息 // 变量获取所有的场站信息
for (int i = 0; i < stringArrayList.size(); i++) { for (int i = 0; i < stringArrayList.size(); i++) {
Region region = regionMapper.selectOne(new QueryWrapper<Region>().eq("LEVEL", 1).like("REGION_NAME", stringArrayList.get(i))); Region region = regionMapper
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().like("belong_area", region.getRegionCode())); .selectOne(new QueryWrapper<Region>().eq("LEVEL", 1).like("REGION_NAME", stringArrayList.get(i)));
stationBasicListAll.addAll(stationBasicList); List<StationBasic> stationBasicList = stationBasicMapper
} .selectList(new QueryWrapper<StationBasic>().like("belong_area", region.getRegionCode()));
return stationBasicListAll; stationBasicListAll.addAll(stationBasicList);
} }
return stationBasicListAll;
}
// public HashMap<String, List<String>> getPowerGenerationTrendsOfCompletionRate(String areaName) { // public HashMap<String, List<String>> getPowerGenerationTrendsOfCompletionRate(String areaName) {
// List<StationBasic> stationBasicListAll = new ArrayList<>(); // List<StationBasic> stationBasicListAll = new ArrayList<>();
...@@ -774,7 +797,6 @@ public class MonitoringServiceImpl { ...@@ -774,7 +797,6 @@ public class MonitoringServiceImpl {
// return hashMap; // return hashMap;
// } // }
// public Page<HashMap<String, String>> getPowerGenerationTrendsOfCompletionTopFive(String areaName) { // public Page<HashMap<String, String>> getPowerGenerationTrendsOfCompletionTopFive(String areaName) {
// Page<HashMap<String, String>> hashMapPage = new Page<>(1, 5); // Page<HashMap<String, String>> hashMapPage = new Page<>(1, 5);
// List<HashMap<String, String>> mapList = new ArrayList<>(); // List<HashMap<String, String>> mapList = new ArrayList<>();
...@@ -811,18 +833,17 @@ public class MonitoringServiceImpl { ...@@ -811,18 +833,17 @@ public class MonitoringServiceImpl {
// return hashMapPage; // return hashMapPage;
// } // }
public List<String> getXListofRecentOneYear() {
public List<String> getXListofRecentOneYear() { List<String> xList = new ArrayList<>();
List<String> xList = new ArrayList<>(); Calendar calendar = Calendar.getInstance();
Calendar calendar = Calendar.getInstance(); Date date = new Date();
Date date = new Date(); for (int i = 1; i < 13; i++) {
for (int i = 1; i < 13; i++) { calendar.setTime(date);
calendar.setTime(date); calendar.add(Calendar.MONTH, i - 12);
calendar.add(Calendar.MONTH, i - 12); xList.add(String.valueOf(calendar.get(Calendar.YEAR)).substring(2, 4) + "-" + calendar.get(Calendar.MONTH));
xList.add(String.valueOf(calendar.get(Calendar.YEAR)).substring(2, 4) + "-" + calendar.get(Calendar.MONTH)); }
} return xList;
return xList; }
}
// //
// public Page<HashMap<String, String>> getPowerGenerationTrendsOfCompletionTopThree(String tabValue, String areaName) { // public Page<HashMap<String, String>> getPowerGenerationTrendsOfCompletionTopThree(String tabValue, String areaName) {
...@@ -893,21 +914,23 @@ public class MonitoringServiceImpl { ...@@ -893,21 +914,23 @@ public class MonitoringServiceImpl {
// return page; // return page;
// } // }
@Scheduled(cron = "0/5 * * * * *") @Scheduled(cron = "0/5 * * * * *")
public void getTotalData() { public void getTotalData() {
//计算所有场站年计划完成量 // 计算所有场站年计划完成量
int year = Calendar.getInstance().get(Calendar.YEAR); int year = Calendar.getInstance().get(Calendar.YEAR);
int Moon = Calendar.getInstance().get(Calendar.MONTH) + 1; int Moon = Calendar.getInstance().get(Calendar.MONTH) + 1;
LambdaQueryWrapper<StationPlan> query = new LambdaQueryWrapper<>(); LambdaQueryWrapper<StationPlan> query = new LambdaQueryWrapper<>();
query.eq(StationPlan::getYear, String.valueOf(year)); query.eq(StationPlan::getYear, String.valueOf(year));
List<StationPlan> stationPlans = stationPlanMapper.selectList(query); List<StationPlan> stationPlans = stationPlanMapper.selectList(query);
double yearValue = stationPlans.stream().mapToDouble(StationPlan::getValue).sum(); double yearValue = stationPlans.stream().mapToDouble(StationPlan::getValue).sum();
double fdzValue = stationPlans.stream().filter(e -> e.getStationType().equals("FDZ")).mapToDouble(StationPlan::getValue).sum(); double fdzValue = stationPlans.stream().filter(e -> e.getStationType().equals("FDZ"))
double gfvalue = yearValue - fdzValue; .mapToDouble(StationPlan::getValue).sum();
double gfvalue = yearValue - fdzValue;
double moonValue = stationPlans.stream().filter(e -> e.getMonthly().equals(String.valueOf(Moon))).mapToDouble(StationPlan::getValue).sum();
double moonValue = stationPlans.stream().filter(e -> e.getMonthly().equals(String.valueOf(Moon)))
//查询风电站年计划完成量 .mapToDouble(StationPlan::getValue).sum();
// 查询风电站年计划完成量
// //
// List<StationCacheInfoDto> listStationCacheInfoDto = commonServiceImpl.getListStationCacheInfoDto(); // List<StationCacheInfoDto> listStationCacheInfoDto = commonServiceImpl.getListStationCacheInfoDto();
// List<String> fdz = listStationCacheInfoDto.stream().filter(e -> e.getStationType().equals("FDZ")).map(StationCacheInfoDto::getStationId).collect(Collectors.toList()); // List<String> fdz = listStationCacheInfoDto.stream().filter(e -> e.getStationType().equals("FDZ")).map(StationCacheInfoDto::getStationId).collect(Collectors.toList());
...@@ -917,142 +940,178 @@ public class MonitoringServiceImpl { ...@@ -917,142 +940,178 @@ public class MonitoringServiceImpl {
// List<StationPlan> fdzPlans = stationPlanMapper.selectList(queryWrapper); // List<StationPlan> fdzPlans = stationPlanMapper.selectList(queryWrapper);
// double fdzValue = fdzPlans.stream().mapToDouble(StationPlan::getValue).sum(); // double fdzValue = fdzPlans.stream().mapToDouble(StationPlan::getValue).sum();
List<StationBasic> stationBasicListAll = stationBasicMapper
List<StationBasic> stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id")); .selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
List<StationBasic> fdzList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FDZ")).collect(Collectors.toList()); List<StationBasic> fdzList = stationBasicListAll.stream()
List<StationBasic> jzsgfdzList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("JZSGFDZ")).collect(Collectors.toList()); .filter(stationBasic -> stationBasic.getStationType().equals("FDZ")).collect(Collectors.toList());
List<StationBasic> fbsgfdzList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FBSGFDZ")).collect(Collectors.toList()); List<StationBasic> jzsgfdzList = stationBasicListAll.stream()
List<StationBasic> gfList = stationBasicListAll.stream().filter(stationBasic -> !stationBasic.getStationType().equals("FDZ")).collect(Collectors.toList()); .filter(stationBasic -> stationBasic.getStationType().equals("JZSGFDZ")).collect(Collectors.toList());
Page<HashMap<String, String>> page = new Page<>(1, 10); List<StationBasic> fbsgfdzList = stationBasicListAll.stream()
Page<HashMap<String, String>> page1 = new Page<>(1, 10); .filter(stationBasic -> stationBasic.getStationType().equals("FBSGFDZ")).collect(Collectors.toList());
Page<HashMap<String, String>> page2 = new Page<>(1, 10); List<StationBasic> gfList = stationBasicListAll.stream()
Page<HashMap<String, String>> page3 = new Page<>(1, 10); .filter(stationBasic -> !stationBasic.getStationType().equals("FDZ")).collect(Collectors.toList());
Page<HashMap<String, String>> page = new Page<>(1, 10);
Page<HashMap<String, String>> page1 = new Page<>(1, 10);
Page<HashMap<String, String>> page2 = new Page<>(1, 10);
Page<HashMap<String, String>> page3 = new Page<>(1, 10);
// ----------------装机容量开始----------------------- // ----------------装机容量开始-----------------------
List<HashMap<String, String>> list = new ArrayList<>(); List<HashMap<String, String>> list = new ArrayList<>();
//装机容量 // 装机容量
HashMap<String, String> stringHashMap = new HashMap<>(); HashMap<String, String> stringHashMap = new HashMap<>();
BigDecimal totalInstall = new BigDecimal(getInstallCapity(stationBasicListAll)); BigDecimal totalInstall = new BigDecimal(getInstallCapity(stationBasicListAll));
// stringHashMap.put("title", totalInstall.toString()); // stringHashMap.put("title", totalInstall.toString());
//stringHashMap.put("data", ""); // stringHashMap.put("data", "");
// list.add(stringHashMap); // list.add(stringHashMap);
//风电站 // 风电站
HashMap<String, String> stringHashMap1 = new HashMap<>(); HashMap<String, String> stringHashMap1 = new HashMap<>();
BigDecimal fdzInstall = new BigDecimal(getInstallCapity(fdzList)); BigDecimal fdzInstall = new BigDecimal(getInstallCapity(fdzList));
stringHashMap1.put("title", fdzInstall.toString()); stringHashMap1.put("title", fdzInstall.toString());
stringHashMap1.put("data", String.valueOf(fdzList.size())); stringHashMap1.put("data", String.valueOf(fdzList.size()));
list.add(stringHashMap1); list.add(stringHashMap1);
//集中式光伏电站 // 集中式光伏电站
HashMap<String, String> stringHashMap2 = new HashMap<>(); HashMap<String, String> stringHashMap2 = new HashMap<>();
BigDecimal jzsInstall = new BigDecimal(getInstallCapity(jzsgfdzList)); BigDecimal jzsInstall = new BigDecimal(getInstallCapity(jzsgfdzList));
stringHashMap2.put("title", jzsInstall.toString()); stringHashMap2.put("title", jzsInstall.toString());
stringHashMap2.put("data", String.valueOf(jzsgfdzList.size())); stringHashMap2.put("data", String.valueOf(jzsgfdzList.size()));
list.add(stringHashMap2); list.add(stringHashMap2);
//分布式光伏电站 // 分布式光伏电站
HashMap<String, String> stringHashMap3 = new HashMap<>(); HashMap<String, String> stringHashMap3 = new HashMap<>();
BigDecimal fbsInstall = new BigDecimal(getInstallCapity(fbsgfdzList)); BigDecimal fbsInstall = new BigDecimal(getInstallCapity(fbsgfdzList));
stringHashMap3.put("title", fbsInstall.toString()); stringHashMap3.put("title", fbsInstall.toString());
stringHashMap3.put("data", String.valueOf(fbsgfdzList.size())); stringHashMap3.put("data", String.valueOf(fbsgfdzList.size()));
list.add(stringHashMap3); list.add(stringHashMap3);
page.setRecords(list); page.setRecords(list);
BigDecimal gfInstall = new BigDecimal(getInstallCapity(gfList)); BigDecimal gfInstall = new BigDecimal(getInstallCapity(gfList));
//----------------------装机容量结束---------------------------------------- //----------------------装机容量结束----------------------------------------
// ----------------装机容量开始----------------------- // ----------------装机容量开始-----------------------
List<HashMap<String, String>> list1 = new ArrayList<>(); List<HashMap<String, String>> list1 = new ArrayList<>();
List<HashMap<String, String>> list2 = new ArrayList<>(); List<HashMap<String, String>> list2 = new ArrayList<>();
List<HashMap<String, String>> list3 = new ArrayList<>(); List<HashMap<String, String>> list3 = new ArrayList<>();
AtomicReference<Double> powerOfDayFD = new AtomicReference<>(new Double(0.00)); AtomicReference<Double> powerOfDayFD = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> powerOfMonthFD = new AtomicReference<>(new Double(0.00)); AtomicReference<Double> powerOfMonthFD = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> powerOfAnnualFD = new AtomicReference<>(new Double(0.00)); AtomicReference<Double> powerOfAnnualFD = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> powerOfDayGF = new AtomicReference<>(new Double(0.00)); AtomicReference<Double> powerOfDayGF = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> powerOfMonthGF = new AtomicReference<>(new Double(0.00)); AtomicReference<Double> powerOfMonthGF = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> powerOfAnnualGF = new AtomicReference<>(new Double(0.00)); AtomicReference<Double> powerOfAnnualGF = new AtomicReference<>(new Double(0.00));
fdzList.forEach(stationBasic -> { fdzList.forEach(stationBasic -> {
Map<String, List<String>> queryCondtion = new HashMap<>(); Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("日发电量", "月发电量", "年发电量")); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("日发电量", "月发电量", "年发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
ESEquipments.class);
// powerOfDayFD.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")); // powerOfDayFD.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量"));
// powerOfMonthFD.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")); // powerOfMonthFD.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量"));
// powerOfAnnualFD.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")); // powerOfAnnualFD.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量"));
powerOfDayFD.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量"))); powerOfDayFD.updateAndGet(
powerOfMonthFD.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量"))); v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
powerOfAnnualFD.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量"))); powerOfMonthFD.updateAndGet(
v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
powerOfAnnualFD.updateAndGet(
}); v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
gfList.forEach(stationBasic -> {
Map<String, List<String>> queryCondtion = new HashMap<>(); });
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, CommonConstans.taiHeGenIndicator); gfList.forEach(stationBasic -> {
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId())); Map<String, List<String>> queryCondtion = new HashMap<>();
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, CommonConstans.taiHeGenIndicator);
powerOfDayGF.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay)); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
powerOfMonthGF.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth)); List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
powerOfAnnualGF.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)); ESEquipments.class);
}); powerOfDayGF.updateAndGet(
HashMap<String, String> stringHashMap4 = new HashMap<>(); v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay));
stringHashMap4.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfDayFD.get()) + "/" + String.format(CommonConstans.Twodecimalplaces, powerOfDayGF.get())); powerOfMonthGF.updateAndGet(v -> v
list1.add(stringHashMap4); + commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth));
HashMap<String, String> stringHashMap5 = new HashMap<>(); powerOfAnnualGF.updateAndGet(
stringHashMap5.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfMonthFD.get()) + "/" + String.format(CommonConstans.Twodecimalplaces, powerOfMonthGF.get())); v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear));
list1.add(stringHashMap5); });
HashMap<String, String> stringHashMap6 = new HashMap<>(); HashMap<String, String> stringHashMap4 = new HashMap<>();
stringHashMap6.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfAnnualFD.get()) + "/" + String.format(CommonConstans.Twodecimalplaces, powerOfAnnualGF.get())); stringHashMap4.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfDayFD.get()) + "/"
list1.add(stringHashMap6); + String.format(CommonConstans.Twodecimalplaces, powerOfDayGF.get()));
HashMap<String, String> stringHashMap7 = new HashMap<>(); list1.add(stringHashMap4);
stringHashMap7.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfAnnualFD.get() / fdzValue) + "/" + String.format(CommonConstans.Twodecimalplaces, powerOfAnnualGF.get() / gfvalue)); HashMap<String, String> stringHashMap5 = new HashMap<>();
list1.add(stringHashMap7); stringHashMap5.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfMonthFD.get()) + "/"
HashMap<String, String> stringHashMap8 = new HashMap<>(); + String.format(CommonConstans.Twodecimalplaces, powerOfMonthGF.get()));
stringHashMap8.put("title", String.format(CommonConstans.Twodecimalplaces, (powerOfAnnualFD.get() * CommonConstans.wkwhToMv) / fdzInstall.doubleValue()) + "/" + String.format(CommonConstans.Twodecimalplaces, (powerOfAnnualGF.get() * CommonConstans.wkwhToMv) / gfInstall.doubleValue())); list1.add(stringHashMap5);
list1.add(stringHashMap8); HashMap<String, String> stringHashMap6 = new HashMap<>();
page1.setRecords(list1); stringHashMap6.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfAnnualFD.get()) + "/"
HashMap<String, String> stringHashMap9 = new HashMap<>(); + String.format(CommonConstans.Twodecimalplaces, powerOfAnnualGF.get()));
stringHashMap9.put("title", String.format(CommonConstans.Fourdecimalplaces, powerOfDayFD.get() + powerOfDayGF.get())); list1.add(stringHashMap6);
HashMap<String, String> resultMap = new HashMap<>(); HashMap<String, String> stringHashMap7 = new HashMap<>();
resultMap.put("Day", String.format(CommonConstans.Fourdecimalplaces, powerOfDayFD.get() + powerOfDayGF.get())); stringHashMap7.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfAnnualFD.get() / fdzValue)
list2.add(stringHashMap9); + "/" + String.format(CommonConstans.Twodecimalplaces, powerOfAnnualGF.get() / gfvalue));
HashMap<String, String> stringHashMap10 = new HashMap<>(); list1.add(stringHashMap7);
stringHashMap10.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfMonthFD.get() + powerOfMonthGF.get())); HashMap<String, String> stringHashMap8 = new HashMap<>();
resultMap.put("Moon", String.format(CommonConstans.Fourdecimalplaces, powerOfMonthFD.get() + powerOfMonthGF.get())); stringHashMap8.put("title",
resultMap.put("YJHWC", String.format(CommonConstans.Twodecimalplaces, (powerOfMonthFD.get() + powerOfMonthGF.get()) / moonValue * 100)); String.format(CommonConstans.Twodecimalplaces,
list2.add(stringHashMap10); (powerOfAnnualFD.get() * CommonConstans.wkwhToMv) / fdzInstall.doubleValue()) + "/"
HashMap<String, String> stringHashMap11 = new HashMap<>(); + String.format(CommonConstans.Twodecimalplaces,
stringHashMap11.put("title", String.format(CommonConstans.Fourdecimalplaces, powerOfAnnualFD.get() + powerOfAnnualGF.get())); (powerOfAnnualGF.get() * CommonConstans.wkwhToMv) / gfInstall.doubleValue()));
resultMap.put("Year", String.format(CommonConstans.Fourdecimalplaces, powerOfAnnualFD.get() + powerOfAnnualGF.get())); list1.add(stringHashMap8);
list2.add(stringHashMap11); page1.setRecords(list1);
HashMap<String, String> stringHashMap12 = new HashMap<>(); HashMap<String, String> stringHashMap9 = new HashMap<>();
stringHashMap12.put("title", String.format(CommonConstans.Twodecimalplaces, (powerOfAnnualFD.get() + powerOfAnnualGF.get()) / yearValue * 100)); stringHashMap9.put("title",
resultMap.put("NJHWC", String.format(CommonConstans.Twodecimalplaces, (powerOfAnnualFD.get() + powerOfAnnualGF.get()) / yearValue * 100)); String.format(CommonConstans.Fourdecimalplaces, powerOfDayFD.get() + powerOfDayGF.get()));
list2.add(stringHashMap12); HashMap<String, String> resultMap = new HashMap<>();
page2.setRecords(list2); resultMap.put("Day", String.format(CommonConstans.Fourdecimalplaces, powerOfDayFD.get() + powerOfDayGF.get()));
Double totalAnnual = (powerOfAnnualFD.get() + powerOfAnnualGF.get()); list2.add(stringHashMap9);
HashMap<String, String> stringHashMap13 = new HashMap<>(); HashMap<String, String> stringHashMap10 = new HashMap<>();
stringHashMap13.put("title", String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.carbonDioxide))); stringHashMap10.put("title",
stringHashMap13.put("unit", "二氧化碳减排量(t)"); String.format(CommonConstans.Twodecimalplaces, powerOfMonthFD.get() + powerOfMonthGF.get()));
list3.add(stringHashMap13); resultMap.put("Moon",
HashMap<String, String> stringHashMap14 = new HashMap<>(); String.format(CommonConstans.Fourdecimalplaces, powerOfMonthFD.get() + powerOfMonthGF.get()));
stringHashMap14.put("title", String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.standardCoal))); resultMap.put("YJHWC", String.format(CommonConstans.Twodecimalplaces,
stringHashMap14.put("unit", "节约标准煤(t)"); (powerOfMonthFD.get() + powerOfMonthGF.get()) / moonValue * 100));
list3.add(stringHashMap14); list2.add(stringHashMap10);
HashMap<String, String> stringHashMap15 = new HashMap<>(); HashMap<String, String> stringHashMap11 = new HashMap<>();
stringHashMap15.put("title", String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.toner))); stringHashMap11.put("title",
stringHashMap15.put("unit", "碳粉尘减排量(t)"); String.format(CommonConstans.Fourdecimalplaces, powerOfAnnualFD.get() + powerOfAnnualGF.get()));
list3.add(stringHashMap15); resultMap.put("Year",
HashMap<String, String> stringHashMap16 = new HashMap<>(); String.format(CommonConstans.Fourdecimalplaces, powerOfAnnualFD.get() + powerOfAnnualGF.get()));
stringHashMap16.put("title", String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.sulfurDioxide))); list2.add(stringHashMap11);
stringHashMap16.put("unit", "二氧化硫减排量(t)"); HashMap<String, String> stringHashMap12 = new HashMap<>();
list3.add(stringHashMap16); stringHashMap12.put("title", String.format(CommonConstans.Twodecimalplaces,
page3.setRecords(list3); (powerOfAnnualFD.get() + powerOfAnnualGF.get()) / yearValue * 100));
try { resultMap.put("NJHWC", String.format(CommonConstans.Twodecimalplaces,
emqKeeper.getMqttClient().publish("bigscreen_zjrl_topic", JSON.toJSON(page).toString().getBytes("UTF-8"), 1, true); (powerOfAnnualFD.get() + powerOfAnnualGF.get()) / yearValue * 100));
emqKeeper.getMqttClient().publish("bigscreen_ssscsj_topic", JSON.toJSON(page1).toString().getBytes("UTF-8"), 1, true); list2.add(stringHashMap12);
emqKeeper.getMqttClient().publish("bigscreen_zssscsj_topic", JSON.toJSON(page2).toString().getBytes("UTF-8"), 1, true); page2.setRecords(list2);
emqKeeper.getMqttClient().publish("bigscreen_qgjrdz_topic", JSON.toJSON(resultMap).toString().getBytes("UTF-8"), 1, true); Double totalAnnual = (powerOfAnnualFD.get() + powerOfAnnualGF.get());
emqKeeper.getMqttClient().publish("bigscreen_zshgx_topic", JSON.toJSON(page3).toString().getBytes("UTF-8"), 1, true); HashMap<String, String> stringHashMap13 = new HashMap<>();
} catch (Exception ex) { stringHashMap13.put("title",
String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.carbonDioxide)));
} stringHashMap13.put("unit", "二氧化碳减排量(t)");
} list3.add(stringHashMap13);
HashMap<String, String> stringHashMap14 = new HashMap<>();
stringHashMap14.put("title",
String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.standardCoal)));
stringHashMap14.put("unit", "节约标准煤(t)");
list3.add(stringHashMap14);
HashMap<String, String> stringHashMap15 = new HashMap<>();
stringHashMap15.put("title",
String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.toner)));
stringHashMap15.put("unit", "碳粉尘减排量(t)");
list3.add(stringHashMap15);
HashMap<String, String> stringHashMap16 = new HashMap<>();
stringHashMap16.put("title",
String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.sulfurDioxide)));
stringHashMap16.put("unit", "二氧化硫减排量(t)");
list3.add(stringHashMap16);
page3.setRecords(list3);
try {
emqKeeper.getMqttClient().publish("bigscreen_zjrl_topic", JSON.toJSON(page).toString().getBytes("UTF-8"), 1,
true);
emqKeeper.getMqttClient().publish("bigscreen_ssscsj_topic", JSON.toJSON(page1).toString().getBytes("UTF-8"),
1, true);
emqKeeper.getMqttClient().publish("bigscreen_zssscsj_topic",
JSON.toJSON(page2).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish("bigscreen_qgjrdz_topic",
JSON.toJSON(resultMap).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish("bigscreen_zshgx_topic", JSON.toJSON(page3).toString().getBytes("UTF-8"),
1, true);
} catch (Exception ex) {
}
}
// public List<HashMap<String, Object>> getNationalPowerGenerationData() { // public List<HashMap<String, Object>> getNationalPowerGenerationData() {
// List<HashMap<String, Object>> resultHashMap = new ArrayList<>(); // List<HashMap<String, Object>> resultHashMap = new ArrayList<>();
...@@ -1076,40 +1135,44 @@ public class MonitoringServiceImpl { ...@@ -1076,40 +1135,44 @@ public class MonitoringServiceImpl {
// return resultHashMap; // return resultHashMap;
// } // }
public HashMap<String, Object> getTableByStationListAndTitle(String title, List<StationBasic> stationBasicList, String color) { public HashMap<String, Object> getTableByStationListAndTitle(String title, List<StationBasic> stationBasicList,
HashMap<String, Object> hashMap = new HashMap<>(); String color) {
List<String> xData = new ArrayList<>(); HashMap<String, Object> hashMap = new HashMap<>();
List<String> yData = new ArrayList<>(); List<String> xData = new ArrayList<>();
stationBasicList.forEach(stationBasic -> { List<String> yData = new ArrayList<>();
xData.add(stationBasic.getStationName()); stationBasicList.forEach(stationBasic -> {
yData.add(stationBasic.getAddress()); xData.add(stationBasic.getStationName());
}); yData.add(stationBasic.getAddress());
hashMap.put("title", title); });
hashMap.put("color", color); hashMap.put("title", title);
hashMap.put("xData", xData); hashMap.put("color", color);
hashMap.put("yData", yData); hashMap.put("xData", xData);
return hashMap; hashMap.put("yData", yData);
} return hashMap;
}
public List<HashMap<String, Object>> getSelectDataForNational() {
List<HashMap<String, Object>> hashMapList = new ArrayList<>(); public List<HashMap<String, Object>> getSelectDataForNational() {
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area").isNotNull("fan_gateway_id")); List<HashMap<String, Object>> hashMapList = new ArrayList<>();
List<Region> regionList = this.regionMapper.selectList(new QueryWrapper<Region>().eq("level", 1)); List<StationBasic> stationBasicList = stationBasicMapper
regionList.forEach(region -> { .selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area").isNotNull("fan_gateway_id"));
HashMap<String, Object> hashMap = new HashMap<>(); List<Region> regionList = this.regionMapper.selectList(new QueryWrapper<Region>().eq("level", 1));
hashMap.put("label", region.getRegionName()); regionList.forEach(region -> {
hashMap.put("value", region.getRegionCode()); HashMap<String, Object> hashMap = new HashMap<>();
List<HashMap<String, Object>> children = stationBasicList.stream().filter(stationBasic -> stationBasic.getBelongArea().contains(String.valueOf(region.getRegionCode()))).map(stationBasic -> { hashMap.put("label", region.getRegionName());
HashMap<String, Object> hashMap1 = new HashMap<>(); hashMap.put("value", region.getRegionCode());
hashMap1.put("label", stationBasic.getStationName()); List<HashMap<String, Object>> children = stationBasicList.stream().filter(
hashMap1.put("value", stationBasic.getSequenceNbr()); stationBasic -> stationBasic.getBelongArea().contains(String.valueOf(region.getRegionCode())))
return hashMap1; .map(stationBasic -> {
}).collect(Collectors.toList()); HashMap<String, Object> hashMap1 = new HashMap<>();
hashMap.put("children", children); hashMap1.put("label", stationBasic.getStationName());
hashMapList.add(hashMap); hashMap1.put("value", stationBasic.getSequenceNbr());
}); return hashMap1;
return hashMapList; }).collect(Collectors.toList());
} hashMap.put("children", children);
hashMapList.add(hashMap);
});
return hashMapList;
}
// const data = { // const data = {
// xData: [], // xData: [],
...@@ -1127,234 +1190,298 @@ public class MonitoringServiceImpl { ...@@ -1127,234 +1190,298 @@ public class MonitoringServiceImpl {
// ] // ]
// }; // };
public HashMap<String, Object> getTheStationPowerCurve(String stationId, String date) { public HashMap<String, Object> getTheStationPowerCurve(String stationId, String date) {
HashMap<String, Object> result = new HashMap<>(); HashMap<String, Object> result = new HashMap<>();
List<HashMap<String, Object>> hashMapList = new ArrayList<>(); List<HashMap<String, Object>> hashMapList = new ArrayList<>();
StationBasic stationBasic = stationBasicMapper.selectById(stationId); StationBasic stationBasic = stationBasicMapper.selectById(stationId);
//x轴数据 // x轴数据
List<String> xdata = new ArrayList<>(); List<String> xdata = new ArrayList<>();
//实时有功功率 // 实时有功功率
List<String> currentPowerYdata = new ArrayList<>(); List<String> currentPowerYdata = new ArrayList<>();
//短期功率预测 // 短期功率预测
List<String> shortPowerYdata = new ArrayList<>(); List<String> shortPowerYdata = new ArrayList<>();
//超短期功率预测 // 超短期功率预测
List<String> superPowerShortYdata = new ArrayList<>(); List<String> superPowerShortYdata = new ArrayList<>();
for (int i = 0; i < 25; i++) { for (int i = 0; i < 25; i++) {
xdata.add(String.format("%02d", i) + ":00"); xdata.add(String.format("%02d", i) + ":00");
currentPowerYdata.add(String.format("%.2f", Math.random() * 30.0)); currentPowerYdata.add(String.format("%.2f", Math.random() * 30.0));
shortPowerYdata.add(String.format("%.2f", Math.random() * 40.0)); shortPowerYdata.add(String.format("%.2f", Math.random() * 40.0));
superPowerShortYdata.add(String.format("%.2f", Math.random() * 35.0)); superPowerShortYdata.add(String.format("%.2f", Math.random() * 35.0));
} }
result.put("xData", xdata); result.put("xData", xdata);
HashMap<String, Object> currentPowerHashMap = new HashMap<>(); HashMap<String, Object> currentPowerHashMap = new HashMap<>();
currentPowerHashMap.put("title", "实时有功 " + date); currentPowerHashMap.put("title", "实时有功 " + date);
currentPowerHashMap.put("yData", currentPowerYdata); currentPowerHashMap.put("yData", currentPowerYdata);
result.put("currentPower", currentPowerHashMap); result.put("currentPower", currentPowerHashMap);
HashMap<String, Object> shortPowerHashMap = new HashMap<>(); HashMap<String, Object> shortPowerHashMap = new HashMap<>();
shortPowerHashMap.put("title", "短期功率预测 " + date); shortPowerHashMap.put("title", "短期功率预测 " + date);
shortPowerHashMap.put("yData", currentPowerYdata); shortPowerHashMap.put("yData", currentPowerYdata);
result.put("shortPower", shortPowerHashMap); result.put("shortPower", shortPowerHashMap);
HashMap<String, Object> superShortPowerHashMap = new HashMap<>(); HashMap<String, Object> superShortPowerHashMap = new HashMap<>();
superShortPowerHashMap.put("title", "超短期功率预测 " + date); superShortPowerHashMap.put("title", "超短期功率预测 " + date);
superShortPowerHashMap.put("yData", currentPowerYdata); superShortPowerHashMap.put("yData", currentPowerYdata);
result.put("superShortPower", superShortPowerHashMap); result.put("superShortPower", superShortPowerHashMap);
HashMap<String, Object> footerList = new HashMap<>(); HashMap<String, Object> footerList = new HashMap<>();
String currentMin = String.format("%.2f", currentPowerYdata.stream().mapToDouble(Double::parseDouble).min().getAsDouble()); String currentMin = String.format("%.2f",
String shortMin = String.format("%.2f", shortPowerYdata.stream().mapToDouble(Double::parseDouble).min().getAsDouble()); currentPowerYdata.stream().mapToDouble(Double::parseDouble).min().getAsDouble());
String supreMin = String.format("%.2f", superPowerShortYdata.stream().mapToDouble(Double::parseDouble).min().getAsDouble()); String shortMin = String.format("%.2f",
List<String> gz = new ArrayList<>(); shortPowerYdata.stream().mapToDouble(Double::parseDouble).min().getAsDouble());
List<String> sj1 = new ArrayList<>(); String supreMin = String.format("%.2f",
gz.add(currentMin); superPowerShortYdata.stream().mapToDouble(Double::parseDouble).min().getAsDouble());
sj1.add(xdata.get(currentPowerYdata.indexOf(currentMin))); List<String> gz = new ArrayList<>();
gz.add(shortMin); List<String> sj1 = new ArrayList<>();
sj1.add(xdata.get(shortPowerYdata.indexOf(shortMin))); gz.add(currentMin);
gz.add(supreMin); sj1.add(xdata.get(currentPowerYdata.indexOf(currentMin)));
sj1.add(xdata.get(superPowerShortYdata.indexOf(supreMin))); gz.add(shortMin);
sj1.add(xdata.get(shortPowerYdata.indexOf(shortMin)));
String currentMax = String.format("%.2f", currentPowerYdata.stream().mapToDouble(Double::parseDouble).max().getAsDouble()); gz.add(supreMin);
String shortMax = String.format("%.2f", shortPowerYdata.stream().mapToDouble(Double::parseDouble).max().getAsDouble()); sj1.add(xdata.get(superPowerShortYdata.indexOf(supreMin)));
String supreMax = String.format("%.2f", superPowerShortYdata.stream().mapToDouble(Double::parseDouble).max().getAsDouble());
List<String> zdz = new ArrayList<>(); String currentMax = String.format("%.2f",
List<String> sj2 = new ArrayList<>(); currentPowerYdata.stream().mapToDouble(Double::parseDouble).max().getAsDouble());
zdz.add(currentMax); String shortMax = String.format("%.2f",
zdz.add(shortMax); shortPowerYdata.stream().mapToDouble(Double::parseDouble).max().getAsDouble());
zdz.add(supreMax); String supreMax = String.format("%.2f",
sj2.add(xdata.get(currentPowerYdata.indexOf(currentMax))); superPowerShortYdata.stream().mapToDouble(Double::parseDouble).max().getAsDouble());
sj2.add(xdata.get(shortPowerYdata.indexOf(shortMax))); List<String> zdz = new ArrayList<>();
sj2.add(xdata.get(superPowerShortYdata.indexOf(supreMax))); List<String> sj2 = new ArrayList<>();
String currentAvg = currentPowerYdata.stream().mapToDouble(Double::parseDouble).average().toString(); zdz.add(currentMax);
String shortAvg = shortPowerYdata.stream().mapToDouble(Double::parseDouble).average().toString(); zdz.add(shortMax);
String supreAvg = superPowerShortYdata.stream().mapToDouble(Double::parseDouble).average().toString(); zdz.add(supreMax);
List<String> pjz = new ArrayList<>(); sj2.add(xdata.get(currentPowerYdata.indexOf(currentMax)));
List<String> fjl = new ArrayList<>(); sj2.add(xdata.get(shortPowerYdata.indexOf(shortMax)));
pjz.add(currentAvg); sj2.add(xdata.get(superPowerShortYdata.indexOf(supreMax)));
pjz.add(shortAvg); String currentAvg = currentPowerYdata.stream().mapToDouble(Double::parseDouble).average().toString();
pjz.add(supreAvg); String shortAvg = shortPowerYdata.stream().mapToDouble(Double::parseDouble).average().toString();
fjl = Arrays.asList("0.68", "0.89", "0.56"); String supreAvg = superPowerShortYdata.stream().mapToDouble(Double::parseDouble).average().toString();
List<String> pjz = new ArrayList<>();
footerList.put("gz", gz); List<String> fjl = new ArrayList<>();
footerList.put("sj1", sj1); pjz.add(currentAvg);
footerList.put("zdz", zdz); pjz.add(shortAvg);
footerList.put("sj2", sj2); pjz.add(supreAvg);
footerList.put("pjz", pjz); fjl = Arrays.asList("0.68", "0.89", "0.56");
footerList.put("fjl", fjl);
result.put("footerList", footerList); footerList.put("gz", gz);
return result; footerList.put("sj1", sj1);
} footerList.put("zdz", zdz);
footerList.put("sj2", sj2);
public Double keepFourdecimalPlaces(Double param) { footerList.put("pjz", pjz);
return Double.valueOf(String.format("%.4f", param)); footerList.put("fjl", fjl);
} result.put("footerList", footerList);
return result;
public Map<String, String> getGenPowerInfoForBuDun(String areaCode, String stationId) { }
HashMap<String, String> returnResult = new HashMap<>();
returnResult.put("monthCompleteRate", "0.00%"); public Double keepFourdecimalPlaces(Double param) {
returnResult.put("monthValue", "0.0000"); return Double.valueOf(String.format("%.4f", param));
returnResult.put("monthPlanValue", "0.0000"); }
returnResult.put("yearCompleteRate", "0.00%");
returnResult.put("yearValue", "0.0000"); public Map<String, String> getGenPowerInfoForBuDun(String areaCode, String stationId) {
returnResult.put("yearPlanValue", "0.0000"); HashMap<String, String> returnResult = new HashMap<>();
returnResult.put("monthCompleteRate", "0.00%");
List<StationCacheInfoDto> stationCacheInfoDtos = commonServiceImpl.getListStationCacheInfoDto(); returnResult.put("monthValue", "0.0000");
if (StringUtils.isNotBlank(areaCode)) { returnResult.put("monthPlanValue", "0.0000");
stationCacheInfoDtos = stationCacheInfoDtos.stream().filter(stationCacheInfoDto -> stationCacheInfoDto.getAreaCode().equals(areaCode)).collect(Collectors.toList()); returnResult.put("yearCompleteRate", "0.00%");
} returnResult.put("yearValue", "0.0000");
if (StringUtils.isNotBlank(stationId)) { returnResult.put("yearPlanValue", "0.0000");
stationCacheInfoDtos = stationCacheInfoDtos.stream().filter(stationCacheInfoDto -> stationCacheInfoDto.getStationId().equals(stationId)).collect(Collectors.toList());
} List<StationCacheInfoDto> stationCacheInfoDtos = commonServiceImpl.getListStationCacheInfoDto();
//月发电量 if (StringUtils.isNotBlank(areaCode)) {
AtomicReference<Double> monthlyPower = new AtomicReference<>(0.0); stationCacheInfoDtos = stationCacheInfoDtos.stream()
//年发电量 .filter(stationCacheInfoDto -> stationCacheInfoDto.getAreaCode().equals(areaCode))
AtomicReference<Double> annualPower = new AtomicReference<>(0.0); .collect(Collectors.toList());
for (StationCacheInfoDto stationCacheInfoDto : stationCacheInfoDtos) { }
if (StringUtils.isNotBlank(stationId)) {
if ("FDZ".equals(stationCacheInfoDto.getStationType())) { stationCacheInfoDtos = stationCacheInfoDtos.stream()
Map<String, List<String>> queryCondtion = new HashMap<>(); .filter(stationCacheInfoDto -> stationCacheInfoDto.getStationId().equals(stationId))
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("月发电量", "年发电量")); .collect(Collectors.toList());
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getFanGatewayId())); }
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); // 月发电量
monthlyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量"))); AtomicReference<Double> monthlyPower = new AtomicReference<>(0.0);
annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量"))); // 年发电量
} else { AtomicReference<Double> annualPower = new AtomicReference<>(0.0);
Map<String, List<String>> queryCondtion = new HashMap<>(); for (StationCacheInfoDto stationCacheInfoDto : stationCacheInfoDtos) {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, CommonConstans.taiHeGenIndicator);
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getBoosterGatewayId())); if ("FDZ".equals(stationCacheInfoDto.getStationType())) {
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); Map<String, List<String>> queryCondtion = new HashMap<>();
monthlyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth))); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("月发电量", "年发电量"));
annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear))); queryCondtion.put(CommonConstans.QueryStringGateWayId,
} Arrays.asList(stationCacheInfoDto.getFanGatewayId()));
} List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
List<String> stationIds = stationCacheInfoDtos.stream().map(StationCacheInfoDto::getStationId).collect(Collectors.toList()); ESEquipments.class);
List<StationPlan> stationPlans = stationPlanMapper.selectList(new QueryWrapper<StationPlan>().in("station_basic_id", stationIds)); monthlyPower.updateAndGet(
String currentYearAndMonth = DateUtil.format(new Date(), DatePattern.NORM_MONTH_PATTERN); v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
String currentYear = currentYearAndMonth.split("-")[0]; annualPower.updateAndGet(
Integer currentMonth = Integer.valueOf(currentYearAndMonth.split("-")[1]); v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
Double yearPlanValue = stationPlans.stream().filter(stationPlan -> stationPlan.getYear().equals(currentYear)).mapToDouble(i -> i.getValue()).sum(); } else {
Double monthPlanValue = stationPlans.stream().filter(stationPlan -> currentMonth == Integer.valueOf(stationPlan.getMonthly())).mapToDouble(i -> i.getValue()).sum(); Map<String, List<String>> queryCondtion = new HashMap<>();
if (monthlyPower.get() > 0 && monthPlanValue > 0) { queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, CommonConstans.taiHeGenIndicator);
returnResult.put("monthCompleteRate", String.format(CommonConstans.Twodecimalplaces, (monthlyPower.get() / monthPlanValue) * 100) + "%"); queryCondtion.put(CommonConstans.QueryStringGateWayId,
returnResult.put("monthValue", String.format(CommonConstans.Fourdecimalplaces, monthlyPower.get())); Arrays.asList(stationCacheInfoDto.getBoosterGatewayId()));
returnResult.put("monthPlanValue", String.format(CommonConstans.Fourdecimalplaces, monthPlanValue)); List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
} ESEquipments.class);
if (annualPower.get() > 0 && yearPlanValue > 0) { monthlyPower.updateAndGet(v -> v + keepFourdecimalPlaces(
returnResult.put("yearCompleteRate", String.format(CommonConstans.Twodecimalplaces, (annualPower.get() / yearPlanValue) * 100) + "%"); commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth)));
returnResult.put("yearValue", String.format(CommonConstans.Fourdecimalplaces, annualPower.get())); annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(
returnResult.put("yearPlanValue", String.format(CommonConstans.Fourdecimalplaces, yearPlanValue)); commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)));
} }
return returnResult; }
} List<String> stationIds = stationCacheInfoDtos.stream().map(StationCacheInfoDto::getStationId)
.collect(Collectors.toList());
public Map<String, Object> getGenPowerInfo(String areaCode) { List<StationPlan> stationPlans = stationPlanMapper
List<StationCacheInfoDto> stationCacheInfoDtos = commonServiceImpl.getListStationCacheInfoDto(); .selectList(new QueryWrapper<StationPlan>().in("station_basic_id", stationIds));
if (StringUtils.isNotBlank(areaCode)) { String currentYearAndMonth = DateUtil.format(new Date(), DatePattern.NORM_MONTH_PATTERN);
MapRegion mapRegion = mapRegionMapper.selectOne(new QueryWrapper<MapRegion>().eq("area_code",areaCode)); String currentYear = currentYearAndMonth.split("-")[0];
List<StationCacheInfoDto> filterData = stationCacheInfoDtos.stream().filter(stationCacheInfoDto -> stationCacheInfoDto.getAreaCode().equals(areaCode)).collect(Collectors.toList()); Integer currentMonth = Integer.valueOf(currentYearAndMonth.split("-")[1]);
stationCacheInfoDtos = filterData.size() > 0 ? filterData : stationCacheInfoDtos; Double yearPlanValue = stationPlans.stream().filter(stationPlan -> stationPlan.getYear().equals(currentYear))
if(!ObjectUtils.isEmpty(mapRegion)){ .mapToDouble(i -> i.getValue()).sum();
stationCacheInfoDtos =filterData; Double monthPlanValue = stationPlans.stream()
} .filter(stationPlan -> currentMonth == Integer.valueOf(stationPlan.getMonthly()))
} .mapToDouble(i -> i.getValue()).sum();
List<StationCacheInfoDto> fanStationList = stationCacheInfoDtos.stream().filter(stationCacheInfoDto -> stationCacheInfoDto.getStationType().equals("FDZ")).collect(Collectors.toList()); if (monthlyPower.get() > 0 && monthPlanValue > 0) {
List<StationCacheInfoDto> pvStationList = stationCacheInfoDtos.stream().filter(stationCacheInfoDto -> !stationCacheInfoDto.getStationType().equals("FDZ")).collect(Collectors.toList()); returnResult.put("monthCompleteRate",
Map<String, List<StationCacheInfoDto>> groupByProvince = stationCacheInfoDtos.stream().collect(Collectors.groupingBy(StationCacheInfoDto::getBelongProvince)); String.format(CommonConstans.Twodecimalplaces, (monthlyPower.get() / monthPlanValue) * 100) + "%");
HashMap<String, Object> returnResult = new HashMap<>(); returnResult.put("monthValue", String.format(CommonConstans.Fourdecimalplaces, monthlyPower.get()));
HashMap<String, Object> pv_interval = new HashMap<>(); returnResult.put("monthPlanValue", String.format(CommonConstans.Fourdecimalplaces, monthPlanValue));
HashMap<String, Object> fan_interval = new HashMap<>(); }
HashMap<String, Double> dayGenCache = new HashMap(); if (annualPower.get() > 0 && yearPlanValue > 0) {
HashMap<String, Double> monthGenCache = new HashMap(); returnResult.put("yearCompleteRate",
returnResult.put("pv_station_count", pvStationList.size()); String.format(CommonConstans.Twodecimalplaces, (annualPower.get() / yearPlanValue) * 100) + "%");
returnResult.put("fan_station_count", fanStationList.size()); returnResult.put("yearValue", String.format(CommonConstans.Fourdecimalplaces, annualPower.get()));
AtomicReference<Double> powerOfDayFD = new AtomicReference<>(new Double(0.00)); returnResult.put("yearPlanValue", String.format(CommonConstans.Fourdecimalplaces, yearPlanValue));
AtomicReference<Double> powerOfMonthFD = new AtomicReference<>(new Double(0.00)); }
AtomicReference<Double> powerOfDayGF = new AtomicReference<>(new Double(0.00)); return returnResult;
AtomicReference<Double> powerOfMonthGF = new AtomicReference<>(new Double(0.00)); }
AtomicReference<Double> planOfFD = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> planOfGF = new AtomicReference<>(new Double(0.00)); public Map<String, Object> getGenPowerInfo(String areaCode) {
fanStationList.forEach(stationBasic -> { List<StationCacheInfoDto> stationCacheInfoDtos = commonServiceImpl.getListStationCacheInfoDto();
Map<String, List<String>> queryCondtion = new HashMap<>(); if (StringUtils.isNotBlank(areaCode)) {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("日发电量", "月发电量")); MapRegion mapRegion = mapRegionMapper.selectOne(new QueryWrapper<MapRegion>().eq("area_code", areaCode));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId())); List<StationCacheInfoDto> filterData = stationCacheInfoDtos.stream()
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); .filter(stationCacheInfoDto -> stationCacheInfoDto.getAreaCode().equals(areaCode))
powerOfDayFD.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量"))); .collect(Collectors.toList());
powerOfMonthFD.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量"))); stationCacheInfoDtos = filterData.size() > 0 ? filterData : stationCacheInfoDtos;
dayGenCache.put(stationBasic.getStationId(), keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量"))); if (!ObjectUtils.isEmpty(mapRegion)) {
monthGenCache.put(stationBasic.getStationId(), keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量"))); stationCacheInfoDtos = filterData;
planOfFD.updateAndGet(v -> v + getPlanGenByStationIdAndMonth(stationBasic.getStationId())); }
}); }
pvStationList.forEach(stationBasic -> { List<StationCacheInfoDto> fanStationList = stationCacheInfoDtos.stream()
Map<String, List<String>> queryCondtion = new HashMap<>(); .filter(stationCacheInfoDto -> stationCacheInfoDto.getStationType().equals("FDZ"))
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, CommonConstans.taiHeGenIndicator); .collect(Collectors.toList());
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId())); List<StationCacheInfoDto> pvStationList = stationCacheInfoDtos.stream()
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); .filter(stationCacheInfoDto -> !stationCacheInfoDto.getStationType().equals("FDZ"))
powerOfDayGF.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay)); .collect(Collectors.toList());
powerOfMonthGF.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth)); Map<String, List<StationCacheInfoDto>> groupByProvince = stationCacheInfoDtos.stream()
dayGenCache.put(stationBasic.getStationId(), keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay))); .collect(Collectors.groupingBy(StationCacheInfoDto::getBelongProvince));
monthGenCache.put(stationBasic.getStationId(), keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth))); HashMap<String, Object> returnResult = new HashMap<>();
planOfGF.updateAndGet(v -> v + getPlanGenByStationIdAndMonth(stationBasic.getStationId())); HashMap<String, Object> pv_interval = new HashMap<>();
}); HashMap<String, Object> fan_interval = new HashMap<>();
returnResult.put("today_pv_power", String.format(CommonConstans.Twodecimalplaces, powerOfDayGF.get())); HashMap<String, Double> dayGenCache = new HashMap();
returnResult.put("today_fan_power", String.format(CommonConstans.Twodecimalplaces, powerOfDayFD.get())); HashMap<String, Double> monthGenCache = new HashMap();
returnResult.put("month_pv_power", String.format(CommonConstans.Twodecimalplaces, powerOfMonthGF.get())); returnResult.put("pv_station_count", pvStationList.size());
returnResult.put("month_fan_power", String.format(CommonConstans.Twodecimalplaces, powerOfMonthFD.get())); returnResult.put("fan_station_count", fanStationList.size());
returnResult.put("month_pv_quota_schedule", String.format(CommonConstans.Twodecimalplaces, (powerOfMonthGF.get() / planOfGF.get()) * 100)); AtomicReference<Double> powerOfDayFD = new AtomicReference<>(new Double(0.00));
if(returnResult.get("month_pv_quota_schedule").toString().equals("NaN")){ AtomicReference<Double> powerOfMonthFD = new AtomicReference<>(new Double(0.00));
returnResult.put("month_pv_quota_schedule",0.00f); AtomicReference<Double> powerOfDayGF = new AtomicReference<>(new Double(0.00));
} AtomicReference<Double> powerOfMonthGF = new AtomicReference<>(new Double(0.00));
returnResult.put("month_fan_quota_schedule", String.format(CommonConstans.Twodecimalplaces, (powerOfMonthFD.get() / planOfFD.get()) * 100)); AtomicReference<Double> planOfFD = new AtomicReference<>(new Double(0.00));
if(returnResult.get("month_fan_quota_schedule").toString().equals("NaN")){ AtomicReference<Double> planOfGF = new AtomicReference<>(new Double(0.00));
returnResult.put("month_fan_quota_schedule",0.00f); fanStationList.forEach(stationBasic -> {
} Map<String, List<String>> queryCondtion = new HashMap<>();
groupByProvince.keySet().forEach(s -> { queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("日发电量", "月发电量"));
HashMap<String, Object> fan = new HashMap<>(); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
HashMap<String, Object> pv = new HashMap<>(); List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
List<StationCacheInfoDto> list = groupByProvince.get(s); ESEquipments.class);
List<String> fanStationIds = list.stream().filter(stationCacheInfoDto -> stationCacheInfoDto.getStationType().equals("FDZ")).collect(Collectors.toList()).stream().map(stationCacheInfoDto -> stationCacheInfoDto.getStationId()).collect(Collectors.toList()); if (result != null) {
List<String> pvStationIds = list.stream().filter(stationCacheInfoDto -> !stationCacheInfoDto.getStationType().equals("FDZ")).collect(Collectors.toList()).stream().map(stationCacheInfoDto -> stationCacheInfoDto.getStationId()).collect(Collectors.toList()); powerOfDayFD.updateAndGet(
fan.put("station_count", fanStationIds.size()); v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
pv.put("station_count", pvStationIds.size()); powerOfMonthFD.updateAndGet(
fan.put("today_power", getTotalPowerFromCache(fanStationIds, dayGenCache)); v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
pv.put("today_power", getTotalPowerFromCache(pvStationIds, dayGenCache)); dayGenCache.put(stationBasic.getStationId(),
fan.put("month_power", getTotalPowerFromCache(fanStationIds, monthGenCache)); keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
pv.put("month_power", getTotalPowerFromCache(pvStationIds, monthGenCache)); monthGenCache.put(stationBasic.getStationId(),
pv_interval.put(s, pv); keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
fan_interval.put(s, fan); }
planOfFD.updateAndGet(v -> v + getPlanGenByStationIdAndMonth(stationBasic.getStationId()));
}); });
returnResult.put("pv_interval", pv_interval); pvStationList.forEach(stationBasic -> {
returnResult.put("fan_interval", fan_interval); Map<String, List<String>> queryCondtion = new HashMap<>();
return returnResult; queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, CommonConstans.taiHeGenIndicator);
} queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
public Double getPlanGenByStationIdAndMonth(String stationId) { ESEquipments.class);
String[] dates = DateUtil.today().split("-"); if (result != null) {
return stationPlanMapper.getPlanGenByStationIdAndMonth(stationId, dates[0], String.valueOf(Integer.valueOf(dates[1]))); powerOfDayGF.updateAndGet(v -> v
} + commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay));
powerOfMonthGF.updateAndGet(v -> v
public Double getTotalPowerFromCache(List<String> keys, HashMap<String, Double> cache) { + commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth));
AtomicReference<Double> result = new AtomicReference<>(0.0); dayGenCache.put(stationBasic.getStationId(), keepFourdecimalPlaces(
keys.forEach(s -> { commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay)));
result.set(result.get() + cache.get(s)); monthGenCache.put(stationBasic.getStationId(), keepFourdecimalPlaces(
}); commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth)));
return keepFourdecimalPlaces(result.get()); }
} planOfGF.updateAndGet(v -> v + getPlanGenByStationIdAndMonth(stationBasic.getStationId()));
});
returnResult.put("today_pv_power", String.format(CommonConstans.Twodecimalplaces, powerOfDayGF.get()));
returnResult.put("today_fan_power", String.format(CommonConstans.Twodecimalplaces, powerOfDayFD.get()));
returnResult.put("month_pv_power", String.format(CommonConstans.Twodecimalplaces, powerOfMonthGF.get()));
returnResult.put("month_fan_power", String.format(CommonConstans.Twodecimalplaces, powerOfMonthFD.get()));
returnResult.put("month_pv_quota_schedule",
String.format(CommonConstans.Twodecimalplaces, (powerOfMonthGF.get() / planOfGF.get()) * 100));
if (returnResult.get("month_pv_quota_schedule").toString().equals("NaN")) {
returnResult.put("month_pv_quota_schedule", 0.00f);
}
returnResult.put("month_fan_quota_schedule",
String.format(CommonConstans.Twodecimalplaces, (powerOfMonthFD.get() / planOfFD.get()) * 100));
if (returnResult.get("month_fan_quota_schedule").toString().equals("NaN")) {
returnResult.put("month_fan_quota_schedule", 0.00f);
}
groupByProvince.keySet().forEach(s -> {
HashMap<String, Object> fan = new HashMap<>();
HashMap<String, Object> pv = new HashMap<>();
List<StationCacheInfoDto> list = groupByProvince.get(s);
List<String> fanStationIds = list.stream()
.filter(stationCacheInfoDto -> stationCacheInfoDto.getStationType().equals("FDZ"))
.collect(Collectors.toList()).stream()
.map(stationCacheInfoDto -> stationCacheInfoDto.getStationId()).collect(Collectors.toList());
List<String> pvStationIds = list.stream()
.filter(stationCacheInfoDto -> !stationCacheInfoDto.getStationType().equals("FDZ"))
.collect(Collectors.toList()).stream()
.map(stationCacheInfoDto -> stationCacheInfoDto.getStationId()).collect(Collectors.toList());
fan.put("station_count", fanStationIds.size());
pv.put("station_count", pvStationIds.size());
fan.put("today_power", getTotalPowerFromCache(fanStationIds, dayGenCache));
pv.put("today_power", getTotalPowerFromCache(pvStationIds, dayGenCache));
fan.put("month_power", getTotalPowerFromCache(fanStationIds, monthGenCache));
pv.put("month_power", getTotalPowerFromCache(pvStationIds, monthGenCache));
pv_interval.put(s, pv);
fan_interval.put(s, fan);
});
returnResult.put("pv_interval", pv_interval);
returnResult.put("fan_interval", fan_interval);
return returnResult;
}
public Double getPlanGenByStationIdAndMonth(String stationId) {
String[] dates = DateUtil.today().split("-");
Double plan = stationPlanMapper.getPlanGenByStationIdAndMonth(stationId, dates[0],
String.valueOf(Integer.valueOf(dates[1])));
if (plan == null) {
plan = 0.0;
}
return plan;
}
public Double getTotalPowerFromCache(List<String> keys, HashMap<String, Double> cache) {
AtomicReference<Double> result = new AtomicReference<>(0.0);
if (keys != null && !keys.isEmpty() && cache != null && !cache.isEmpty()) {
keys.forEach(s -> {
if(cache.get(s)!=null)
{
result.set(result.get() + cache.get(s));
}
});
}
return keepFourdecimalPlaces(result.get());
}
} }
...@@ -25,7 +25,11 @@ public interface IndicatorDataMapper extends BaseMapper<IndicatorData> { ...@@ -25,7 +25,11 @@ public interface IndicatorDataMapper extends BaseMapper<IndicatorData> {
@Select("select sum(valueFs) valueF,xtime from (select SUBSTR(`created_time`, 11,6) xtime, `value_f` as valueFs from iot_data.indicator_data where equipment_index_name =#{equipmentIndexName} and ts >= #{startTime} and ts <= #{endTime} and gateway_id in (#{gatewayId})) group by xtime order by xtime ") @Select("select sum(valueFs) valueF,xtime from (select SUBSTR(`created_time`, 11,6) xtime, `value_f` as valueFs from iot_data.indicator_data where equipment_index_name =#{equipmentIndexName} and ts >= #{startTime} and ts <= #{endTime} and gateway_id in (#{gatewayId})) group by xtime order by xtime ")
List<IndicatorData> selectDataByequipmentIndexNameAndtimeqg(@Param("equipmentIndexName") String equipmentIndexName, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("gatewayId") String gatewayId); List<IndicatorData> selectDataByequipmentIndexNameAndtimeqg(@Param("equipmentIndexName") String equipmentIndexName, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("gatewayId") String gatewayId);
@Select("select `value`, created_time, `value_f` as valueF from iot_data.indicator_data where equipment_index_name =#{equipmentIndexName} and equipment_number = #{equipmentNumber} and ts >= #{startTime} and ts <= #{endTime} and gateway_id =#{gatewayId}") @Select("select `value`, created_time, `value_f` as valueF from iot_data.indicator_data where equipment_index_name =#{equipmentIndexName} and ts >= TODAY()-8h and gateway_id in ( ${gatewayId} )")
List<IndicatorData> selectDataByequipmentIndexNameAndtimeqgNew(@Param("equipmentIndexName") String equipmentIndexName, @Param("gatewayId") String gatewayId);
@Select("select `value`, created_time, `value_f` as valueF from iot_data.indicator_data where equipment_index_name =#{equipmentIndexName} and equipment_number = #{equipmentNumber} and ts >= #{startTime} and ts <= #{endTime} and gateway_id = #{gatewayId}")
List<IndicatorData> selectDataByequipmentIndexNameAndtimeAndEquipmentNumber(@Param("equipmentIndexName") String equipmentIndexName, @Param("equipmentNumber") String equipmentNumber, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("gatewayId") String gatewayId); List<IndicatorData> selectDataByequipmentIndexNameAndtimeAndEquipmentNumber(@Param("equipmentIndexName") String equipmentIndexName, @Param("equipmentNumber") String equipmentNumber, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("gatewayId") String gatewayId);
@Select("select `value`, created_time, `value_f` as valueF, equipment_index_name from iot_data.indicator_data where equipment_index_name like '%路电流%' and equipment_number = #{equipmentNumber} and ts >= #{startTime} and ts <= #{endTime} and gateway_id =#{gatewayId}") @Select("select `value`, created_time, `value_f` as valueF, equipment_index_name from iot_data.indicator_data where equipment_index_name like '%路电流%' and equipment_number = #{equipmentNumber} and ts >= #{startTime} and ts <= #{endTime} and gateway_id =#{gatewayId}")
......
...@@ -49,7 +49,7 @@ import java.util.stream.Collectors; ...@@ -49,7 +49,7 @@ import java.util.stream.Collectors;
@Slf4j @Slf4j
public class CommonServiceImpl { public class CommonServiceImpl {
// @Autowired // @Autowired
// InfluxdbUtil influxdbUtil; // InfluxdbUtil influxdbUtil;
@Autowired @Autowired
SjglZsjZsbtzMapper sjglZsjZsbtzMapper; SjglZsjZsbtzMapper sjglZsjZsbtzMapper;
...@@ -246,7 +246,7 @@ public class CommonServiceImpl { ...@@ -246,7 +246,7 @@ public class CommonServiceImpl {
} catch (Exception e) { } catch (Exception e) {
return totalvalue; return totalvalue;
} }
return Double.valueOf(String.format("%.4f", totalvalue )); return Double.valueOf(String.format("%.4f", totalvalue));
} }
// public Double getTotalByIndicatiorAndParams(String gatewayId, String indicator, String querySql) { // public Double getTotalByIndicatiorAndParams(String gatewayId, String indicator, String querySql) {
...@@ -371,10 +371,10 @@ public class CommonServiceImpl { ...@@ -371,10 +371,10 @@ public class CommonServiceImpl {
coal.setTitle(String.format("%.2f", (totalSocialContribution * CommonConstans.standardCoal))); coal.setTitle(String.format("%.2f", (totalSocialContribution * CommonConstans.standardCoal)));
socialContributionDtoList.add(coal); socialContributionDtoList.add(coal);
toner.setUnit(CommonConstans.TAN_FEN_CHEN_ZHUBIANDIYACE); toner.setUnit(CommonConstans.TAN_FEN_CHEN_ZHUBIANDIYACE);
toner.setTitle(String.format("%.2f", (totalSocialContribution * CommonConstans.toner ))); toner.setTitle(String.format("%.2f", (totalSocialContribution * CommonConstans.toner)));
socialContributionDtoList.add(toner); socialContributionDtoList.add(toner);
so2.setUnit(CommonConstans.ER_YANG_HUA_LIU_ZHUBIANDIYACE); so2.setUnit(CommonConstans.ER_YANG_HUA_LIU_ZHUBIANDIYACE);
so2.setTitle(String.format("%.2f", (totalSocialContribution * CommonConstans.sulfurDioxide ))); so2.setTitle(String.format("%.2f", (totalSocialContribution * CommonConstans.sulfurDioxide)));
socialContributionDtoList.add(so2); socialContributionDtoList.add(so2);
socialContributionDtoPage.setRecords(socialContributionDtoList); socialContributionDtoPage.setRecords(socialContributionDtoList);
socialContributionDtoPage.setTotal(100); socialContributionDtoPage.setTotal(100);
...@@ -390,11 +390,12 @@ public class CommonServiceImpl { ...@@ -390,11 +390,12 @@ public class CommonServiceImpl {
List<StationCacheInfoDto> stationCacheInfoDtos = new ArrayList<>(); List<StationCacheInfoDto> stationCacheInfoDtos = new ArrayList<>();
List<Region> regionList = regionMapper.selectList(new QueryWrapper<Region>().eq("LEVEL", 1)); List<Region> regionList = regionMapper.selectList(new QueryWrapper<Region>().eq("LEVEL", 1));
List<MapRegion> mapRegionList = mapRegionMapper.selectList(new QueryWrapper<MapRegion>().isNotNull("name")); List<MapRegion> mapRegionList = mapRegionMapper.selectList(new QueryWrapper<MapRegion>().isNotNull("name"));
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area").isNotNull("fan_gateway_id")); List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area"));
List<SjglZsjZsbtz> sjglZsjZsbtzList = sjglZsjZsbtzMapper.selectList(new QueryWrapper<SjglZsjZsbtz>().isNotNull("CAPACITYL").eq("is_del","0").isNotNull("WERKS")); //.isNotNull("fan_gateway_id"));
List<SjglZsjZsbtz> sjglZsjZsbtzList = sjglZsjZsbtzMapper.selectList(new QueryWrapper<SjglZsjZsbtz>().isNotNull("CAPACITYL").eq("is_del", "0").isNotNull("WERKS"));
for (int i = 0; i < stationBasicList.size(); i++) { for (int i = 0; i < stationBasicList.size(); i++) {
StationBasic stationBasic = stationBasicList.get(i); StationBasic stationBasic = stationBasicList.get(i);
Double StationCapactity = sjglZsjZsbtzList.stream().filter(sjglZsjZsbtz -> sjglZsjZsbtz.getWerks().equals(stationBasic.getStationNumber())&& !StringUtils.isEmpty(sjglZsjZsbtz.getCapacityl())).collect(Collectors.toList()).stream().mapToDouble(l->Double.valueOf(l.getCapacityl())).sum(); Double StationCapactity = sjglZsjZsbtzList.stream().filter(sjglZsjZsbtz -> sjglZsjZsbtz.getWerks().equals(stationBasic.getStationNumber()) && !StringUtils.isEmpty(sjglZsjZsbtz.getCapacityl())).collect(Collectors.toList()).stream().mapToDouble(l -> Double.valueOf(l.getCapacityl())).sum();
StationCacheInfoDto stationCacheInfoDto = new StationCacheInfoDto(); StationCacheInfoDto stationCacheInfoDto = new StationCacheInfoDto();
stationCacheInfoDto.setStationId(stationBasic.getSequenceNbr().toString()); stationCacheInfoDto.setStationId(stationBasic.getSequenceNbr().toString());
stationCacheInfoDto.setStationName(stationBasic.getStationName()); stationCacheInfoDto.setStationName(stationBasic.getStationName());
...@@ -560,13 +561,17 @@ public class CommonServiceImpl { ...@@ -560,13 +561,17 @@ public class CommonServiceImpl {
public Double getAvagerByEquipmentIndxName(List<ESEquipments> equipments, String indexName) { public Double getAvagerByEquipmentIndxName(List<ESEquipments> equipments, String indexName) {
Double result = 0.00; Double result = 0.00;
result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).filter(esEquipments -> esEquipments.getValueF() != null).mapToDouble(ESEquipments::getValueF).average().getAsDouble(); if (!ObjectUtils.isEmpty(equipments)) {
result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).filter(esEquipments -> esEquipments.getValueF() != null).mapToDouble(ESEquipments::getValueF).average().getAsDouble();
}
return result; return result;
} }
public Double getSumByEquipmentIndxName(List<ESEquipments> equipments, String indexName) { public Double getSumByEquipmentIndxName(List<ESEquipments> equipments, String indexName) {
Double result = 0.00; Double result = 0.00;
result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).filter(esEquipments -> esEquipments.getValueF() != null).mapToDouble(ESEquipments::getValueF).sum(); if (equipments != null) {
result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).filter(esEquipments -> esEquipments.getValueF() != null).mapToDouble(ESEquipments::getValueF).sum();
}
return result; return result;
} }
......
...@@ -149,7 +149,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -149,7 +149,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
private EquipmentSpecificIndexMapper equipmentSpecificIndexMapper; private EquipmentSpecificIndexMapper equipmentSpecificIndexMapper;
@Autowired @Autowired
private UserEmpowerMapper userEmpowerMapper; private UserEmpowerMapper userEmpowerMapper;
public ResultsData getNationWideInfo(int current, int size, String gateway, String equipmentNumber) { public ResultsData getNationWideInfo(int current, int size, String gateway, String equipmentNumber) {
String table = gateway; String table = gateway;
Map<String, List<String>> queryCodntion = new HashMap<>(); Map<String, List<String>> queryCodntion = new HashMap<>();
...@@ -301,14 +301,15 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -301,14 +301,15 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
public TreeDto getTreeInfo(String sequenceNbr, ReginParams reginParams) { public TreeDto getTreeInfo(String sequenceNbr, ReginParams reginParams) {
String userId = reginParams.getUserModel().getUserId(); String userId = reginParams.getUserModel().getUserId();
String companyLevel =""; String companyLevel = "";
StdUserEmpower stdUserEmpower = userEmpowerMapper.selectOne(new QueryWrapper<StdUserEmpower>().eq("amos_user_id", userId).eq("permission_type", "YTH")); StdUserEmpower stdUserEmpower = userEmpowerMapper
.selectOne(new QueryWrapper<StdUserEmpower>().eq("amos_user_id", userId).eq("permission_type", "YTH"));
if (ObjectUtils.isEmpty(stdUserEmpower)) { if (ObjectUtils.isEmpty(stdUserEmpower)) {
// throw new BadRequest("您当前未配置数据权限!"); // throw new BadRequest("您当前未配置数据权限!");
}else{ } else {
String permissionOrgCode = stdUserEmpower.getAmosOrgCode().get(0); String permissionOrgCode = stdUserEmpower.getAmosOrgCode().get(0);
Map<String,String> companyInfo= userEmpowerMapper.getCompanyInfoByOrgCode(permissionOrgCode); Map<String, String> companyInfo = userEmpowerMapper.getCompanyInfoByOrgCode(permissionOrgCode);
companyLevel = companyInfo.get("level").toString(); companyLevel = companyInfo.get("level").toString();
} }
StationBasic stationBasic = stationBasicMapper.selectById(sequenceNbr); StationBasic stationBasic = stationBasicMapper.selectById(sequenceNbr);
List<Integer> integers = JSON.parseArray(stationBasic.getBelongArea(), Integer.class); List<Integer> integers = JSON.parseArray(stationBasic.getBelongArea(), Integer.class);
...@@ -350,11 +351,12 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -350,11 +351,12 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
gfzTreeDto.setChildren(gfz); gfzTreeDto.setChildren(gfz);
List<TreeDto> treeDtos = Arrays.asList(fdzTreeDto, gfzTreeDto); List<TreeDto> treeDtos = Arrays.asList(fdzTreeDto, gfzTreeDto);
treeDto.setChildren(treeDtos); treeDto.setChildren(treeDtos);
if(companyLevel.equals("station")){ if (companyLevel.equals("station")) {
List<TreeDto> children = stationListByRegionCode.stream().filter(t->t.getCode().equals(sequenceNbr)).collect(Collectors.toList()); List<TreeDto> children = stationListByRegionCode.stream().filter(t -> t.getCode().equals(sequenceNbr))
if(stationBasic.getStationType().equals("FDZ")){ .collect(Collectors.toList());
treeDto = fdzTreeDto; if (stationBasic.getStationType().equals("FDZ")) {
}else { treeDto = fdzTreeDto;
} else {
treeDto = gfzTreeDto; treeDto = gfzTreeDto;
} }
treeDto.setChildren(children); treeDto.setChildren(children);
...@@ -372,8 +374,8 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -372,8 +374,8 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
return new ArrayList<ESEquipmentsDTO>(); return new ArrayList<ESEquipmentsDTO>();
} }
Map<String, List<String>> queryCondtion = new HashMap<>(); Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("风机状态", "有功功率", "发电状态", "报警状态",
Arrays.asList("风机状态", "有功功率", "发电状态", "报警状态", "停机状态", "故障状态", "待机状态", "维护状态", "发电机转速", "正常发电状态","30秒平均风速")); "停机状态", "故障状态", "待机状态", "维护状态", "发电机转速", "正常发电状态", "30秒平均风速"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
Map<String, List<String>> queryCondtion1 = new HashMap<>(); Map<String, List<String>> queryCondtion1 = new HashMap<>();
...@@ -2398,6 +2400,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -2398,6 +2400,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
@Override @Override
public Map<String, Object> partofWaring3D(String stationId, String equipNum) { public Map<String, Object> partofWaring3D(String stationId, String equipNum) {
Map<String, Object> resultMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
if (stationId == null || equipNum == null || "null".equals(stationId) || "equipNum".equals(equipNum)) {
return resultMap;
}
StationBasic stationBasic = stationBasicMapper.selectById(stationId); StationBasic stationBasic = stationBasicMapper.selectById(stationId);
Map<String, List<String>> queryCondtion = new HashMap<>(); Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
......
...@@ -252,16 +252,22 @@ public class MonitoringServiceImpl { ...@@ -252,16 +252,22 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("30秒平均风速", "日发电量", "月发电量", "年发电量")); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("30秒平均风速", "日发电量", "月发电量", "年发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getFanGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
completionOfPowerIndicatorsDto.setWindSpeedOrIrradiance(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getAvagerByEquipmentIndxName(result, "30秒平均风速"))); if(result!=null)
completionOfPowerIndicatorsDto.setActivePower(String.format(CommonConstans.Twodecimalplaces, (commonServiceImpl.getSumByEquipmentIndxName(result1, "220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值")))); {
completionOfPowerIndicatorsDto.setDailyPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量"))); completionOfPowerIndicatorsDto.setWindSpeedOrIrradiance(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getAvagerByEquipmentIndxName(result, "30秒平均风速")));
completionOfPowerIndicatorsDto.setMonthlyPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量"))); completionOfPowerIndicatorsDto.setDailyPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
completionOfPowerIndicatorsDto.setAnnualPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量"))); completionOfPowerIndicatorsDto.setMonthlyPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
dailyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量"))); completionOfPowerIndicatorsDto.setAnnualPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
monthlyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量"))); dailyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量"))); monthlyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
fdzannualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量"))); annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
fdzInstallCapacity.updateAndGet(v -> v + Double.parseDouble(stationCacheInfoDto.getInstalledCapacity())); fdzannualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
}
if(result1!=null)
{
completionOfPowerIndicatorsDto.setActivePower(String.format(CommonConstans.Twodecimalplaces, (commonServiceImpl.getSumByEquipmentIndxName(result1, "220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值"))));
}
fdzInstallCapacity.updateAndGet(v -> v + Double.parseDouble(stationCacheInfoDto.getInstalledCapacity()));
} else { } else {
Map<String, List<String>> queryCondtion = new HashMap<>(); Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, CommonConstans.taiHeGenIndicator); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, CommonConstans.taiHeGenIndicator);
...@@ -271,15 +277,21 @@ public class MonitoringServiceImpl { ...@@ -271,15 +277,21 @@ public class MonitoringServiceImpl {
queryCondtion1.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getBoosterGatewayId())); queryCondtion1.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class, null); List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class, null);
List<ESEquipments> result1 = commonServiceImpl.getListDataByCondtions(queryCondtion1, null, ESEquipments.class); List<ESEquipments> result1 = commonServiceImpl.getListDataByCondtions(queryCondtion1, null, ESEquipments.class);
completionOfPowerIndicatorsDto.setWindSpeedOrIrradiance(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result1, "WTX-801_25_WTX-801_总辐射"))); if(result!=null)
completionOfPowerIndicatorsDto.setActivePower(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result1, "南瑞光差保护_313P") * CommonConstans.kwToMv)); {
completionOfPowerIndicatorsDto.setDailyPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay))); completionOfPowerIndicatorsDto.setDailyPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay)));
completionOfPowerIndicatorsDto.setMonthlyPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth))); completionOfPowerIndicatorsDto.setMonthlyPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth)));
completionOfPowerIndicatorsDto.setAnnualPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear))); completionOfPowerIndicatorsDto.setAnnualPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)));
dailyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay))); dailyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay)));
monthlyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth))); monthlyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth)));
annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear))); annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)));
gfzannualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear))); gfzannualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)));
}
if(result1!=null)
{
completionOfPowerIndicatorsDto.setWindSpeedOrIrradiance(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result1, "WTX-801_25_WTX-801_总辐射")));
completionOfPowerIndicatorsDto.setActivePower(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result1, "南瑞光差保护_313P") * CommonConstans.kwToMv));
}
gfzinstallCapacity.updateAndGet(v -> v + Double.parseDouble(stationCacheInfoDto.getInstalledCapacity())); gfzinstallCapacity.updateAndGet(v -> v + Double.parseDouble(stationCacheInfoDto.getInstalledCapacity()));
} }
} catch (Exception exception) { } catch (Exception exception) {
...@@ -539,17 +551,20 @@ public class MonitoringServiceImpl { ...@@ -539,17 +551,20 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("30秒平均风速")); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("30秒平均风速"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
homeMapStationInfoDto.setSpeendOrirradiate(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getAvagerByEquipmentIndxName(result, "30秒平均风速"))); if(result!=null)
//homeMapStationInfoDto.setCurrentPower(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "有功功率"))); {
homeMapStationInfoDto.setSpeendOrirradiate(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getAvagerByEquipmentIndxName(result, "30秒平均风速")));
//homeMapStationInfoDto.setCurrentPower(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "有功功率")));
}
Map<String, List<String>> queryCondtion1 = new HashMap<>(); Map<String, List<String>> queryCondtion1 = new HashMap<>();
queryCondtion1.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId())); queryCondtion1.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
queryCondtion1.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值")); queryCondtion1.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值"));
List<ESEquipments> esEquipmentsList = commonServiceImpl.getListDataByCondtions(queryCondtion1, null, ESEquipments.class); List<ESEquipments> esEquipmentsList = commonServiceImpl.getListDataByCondtions(queryCondtion1, null, ESEquipments.class);
if(esEquipmentsList!=null)
homeMapStationInfoDto.setCurrentPower(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(esEquipmentsList, "220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值"))); {
homeMapStationInfoDto.setCurrentPower(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(esEquipmentsList, "220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值")));
}
} else { } else {
// Map<String, List<String>> queryCondtion = new HashMap<>(); // Map<String, List<String>> queryCondtion = new HashMap<>();
// queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("有功功率")); // queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("有功功率"));
...@@ -565,14 +580,19 @@ public class MonitoringServiceImpl { ...@@ -565,14 +580,19 @@ public class MonitoringServiceImpl {
queryCondtion2.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId())); queryCondtion2.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
queryCondtion2.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("南瑞光差保护_313P")); queryCondtion2.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("南瑞光差保护_313P"));
List<ESEquipments> esEquipmentsList = commonServiceImpl.getListDataByCondtions(queryCondtion2, null, ESEquipments.class); List<ESEquipments> esEquipmentsList = commonServiceImpl.getListDataByCondtions(queryCondtion2, null, ESEquipments.class);
homeMapStationInfoDto.setCurrentPower(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(esEquipmentsList, "南瑞光差保护_313P"))); if(esEquipmentsList!=null)
{
homeMapStationInfoDto.setCurrentPower(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(esEquipmentsList, "南瑞光差保护_313P")));
}
Map<String, List<String>> queryCondtion1 = new HashMap<>(); Map<String, List<String>> queryCondtion1 = new HashMap<>();
queryCondtion1.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("WTX-801_25_WTX-801_总辐射")); queryCondtion1.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("WTX-801_25_WTX-801_总辐射"));
queryCondtion1.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId())); queryCondtion1.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result1 = commonServiceImpl.getListDataByCondtions(queryCondtion1, null, ESEquipments.class); List<ESEquipments> result1 = commonServiceImpl.getListDataByCondtions(queryCondtion1, null, ESEquipments.class);
homeMapStationInfoDto.setSpeendOrirradiate(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result1, "WTX-801_25_WTX-801_总辐射"))); if(result1!=null)
{
homeMapStationInfoDto.setSpeendOrirradiate(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result1, "WTX-801_25_WTX-801_总辐射")));
}
} }
StationCoordinate stationCoordinate = stationCoordinateList.stream().filter(stationCoordinate1 -> stationCoordinate1.getStationId().equals(stationBasic.getSequenceNbr())).collect(Collectors.toList()).get(0); StationCoordinate stationCoordinate = stationCoordinateList.stream().filter(stationCoordinate1 -> stationCoordinate1.getStationId().equals(stationBasic.getSequenceNbr())).collect(Collectors.toList()).get(0);
//获取场站经纬度 //获取场站经纬度
...@@ -610,13 +630,19 @@ public class MonitoringServiceImpl { ...@@ -610,13 +630,19 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("日发电量")); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("日发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
total.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量"))); if(result!=null)
{
total.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
}
} else { } else {
Map<String, List<String>> queryCondtion = new HashMap<>(); Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(CommonConstans.taiHeGenIndicatorDay)); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(CommonConstans.taiHeGenIndicatorDay));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
total.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay))); if(result!=null)
{
total.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay)));
}
} }
} catch (Exception e) { } catch (Exception e) {
...@@ -652,13 +678,19 @@ public class MonitoringServiceImpl { ...@@ -652,13 +678,19 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(CommonConstans.taiHeGenIndicatorYear)); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(CommonConstans.taiHeGenIndicatorYear));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
total1 = commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear); if(result!=null)
{
total1 = commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear);
}
} else { } else {
Map<String, List<String>> queryCondtion = new HashMap<>(); Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(finalIndicator)); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(finalIndicator));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
total1 = commonServiceImpl.getSumByEquipmentIndxName(result, finalIndicator); if(result!=null)
{
total1 = commonServiceImpl.getSumByEquipmentIndxName(result, finalIndicator);
}
} }
Double finalTotal = total1; Double finalTotal = total1;
total.updateAndGet(v -> v + finalTotal); total.updateAndGet(v -> v + finalTotal);
...@@ -684,13 +716,19 @@ public class MonitoringServiceImpl { ...@@ -684,13 +716,19 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(finalIndicator)); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(finalIndicator));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
total = commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth); if(result!=null)
{
total = commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth);
}
} else { } else {
Map<String, List<String>> queryCondtion = new HashMap<>(); Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(finalIndicator)); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(finalIndicator));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
total = commonServiceImpl.getSumByEquipmentIndxName(result, finalIndicator); if(result!=null)
{
total = commonServiceImpl.getSumByEquipmentIndxName(result, finalIndicator);
}
} }
Double finalTotal = total; Double finalTotal = total;
monthlyPower.updateAndGet(v -> v + finalTotal); monthlyPower.updateAndGet(v -> v + finalTotal);
...@@ -725,17 +763,23 @@ public class MonitoringServiceImpl { ...@@ -725,17 +763,23 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("日发电量", "月发电量", "年发电量")); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("日发电量", "月发电量", "年发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getFanGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
dailyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量"))); if(result!=null)
monthlyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量"))); {
annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量"))); dailyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
monthlyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
}
} else { } else {
Map<String, List<String>> queryCondtion = new HashMap<>(); Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, CommonConstans.taiHeGenIndicator); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, CommonConstans.taiHeGenIndicator);
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getBoosterGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
dailyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay))); if(result!=null)
monthlyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth))); {
annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear))); dailyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay)));
monthlyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth)));
annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)));
}
} }
}); });
HashMap<String, String> dayHashMap = new HashMap<>(); HashMap<String, String> dayHashMap = new HashMap<>();
...@@ -787,13 +831,19 @@ public class MonitoringServiceImpl { ...@@ -787,13 +831,19 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(finalIndicator)); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(finalIndicator));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
total = commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth); if(result!=null)
{
total = commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth);
}
} else { } else {
Map<String, List<String>> queryCondtion = new HashMap<>(); Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(finalIndicator)); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(finalIndicator));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
total = commonServiceImpl.getSumByEquipmentIndxName(result, finalIndicator); if(result!=null)
{
total = commonServiceImpl.getSumByEquipmentIndxName(result, finalIndicator);
}
} }
Double finalTotal = total; Double finalTotal = total;
monthlyPower.updateAndGet(v -> v + finalTotal); monthlyPower.updateAndGet(v -> v + finalTotal);
...@@ -829,15 +879,28 @@ public class MonitoringServiceImpl { ...@@ -829,15 +879,28 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(CommonConstans.taiHeGenIndicatorMonth)); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(CommonConstans.taiHeGenIndicatorMonth));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getBoosterGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
total.set(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth)); if(result!=null)
{
total.set(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth));
}
} else { } else {
Map<String, List<String>> queryCondtion = new HashMap<>(); Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(finalIndicator)); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(finalIndicator));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getFanGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
total.set(commonServiceImpl.getSumByEquipmentIndxName(result, finalIndicator)); if(result!=null)
{
total.set(commonServiceImpl.getSumByEquipmentIndxName(result, finalIndicator));
}
}
Double PlanGen = getPlanGenByStationIdAndMonth(stationCacheInfoDto.getStationId());
if(PlanGen!=null)
{
stationCacheInfoDto.setAddress(String.format(CommonConstans.Twodecimalplaces, (total.get()) * 100 /PlanGen));
}else
{
stationCacheInfoDto.setAddress("0.0");
} }
stationCacheInfoDto.setAddress(String.format(CommonConstans.Twodecimalplaces, (total.get()) * 100 / getPlanGenByStationIdAndMonth(stationCacheInfoDto.getStationId())));
}); });
List<StationCacheInfoDto> sorted = stationCacheInfoDtoList.stream().sorted(Comparator.comparing(StationCacheInfoDto::getAddress, Comparator.comparingDouble(Double::parseDouble)).reversed()).collect(Collectors.toList()); List<StationCacheInfoDto> sorted = stationCacheInfoDtoList.stream().sorted(Comparator.comparing(StationCacheInfoDto::getAddress, Comparator.comparingDouble(Double::parseDouble)).reversed()).collect(Collectors.toList());
sorted.forEach(stationBasic -> { sorted.forEach(stationBasic -> {
...@@ -899,14 +962,19 @@ public class MonitoringServiceImpl { ...@@ -899,14 +962,19 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(indicator.get())); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(indicator.get()));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
total = commonServiceImpl.getSumByEquipmentIndxName(result, indicator.get()); if(result!=null)
{
total = commonServiceImpl.getSumByEquipmentIndxName(result, indicator.get());
}
} else { } else {
Map<String, List<String>> queryCondtion = new HashMap<>(); Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(indicator.get())); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(indicator.get()));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
total = commonServiceImpl.getSumByEquipmentIndxName(result, indicator.get()); if(result!=null)
{
total = commonServiceImpl.getSumByEquipmentIndxName(result, indicator.get());
}
} }
stationBasic.setAddress(String.format(CommonConstans.Twodecimalplaces, (total * 10) / gfInstall.doubleValue())); stationBasic.setAddress(String.format(CommonConstans.Twodecimalplaces, (total * 10) / gfInstall.doubleValue()));
if (stationBasic.getAddress().equals("NaN")) { if (stationBasic.getAddress().equals("NaN")) {
...@@ -1017,9 +1085,12 @@ public class MonitoringServiceImpl { ...@@ -1017,9 +1085,12 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("日发电量", "月发电量", "年发电量")); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("日发电量", "月发电量", "年发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
powerOfDayFD = powerOfDayFD + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")); if(result!=null)
powerOfMonthFD = powerOfMonthFD + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")); {
powerOfAnnualFD = powerOfAnnualFD + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")); powerOfDayFD = powerOfDayFD + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量"));
powerOfMonthFD = powerOfMonthFD + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量"));
powerOfAnnualFD = powerOfAnnualFD + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量"));
}
} }
for (int i = 0; i < gfList.size(); i++) { for (int i = 0; i < gfList.size(); i++) {
StationBasic stationBasic = gfList.get(i); StationBasic stationBasic = gfList.get(i);
...@@ -1027,10 +1098,12 @@ public class MonitoringServiceImpl { ...@@ -1027,10 +1098,12 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, CommonConstans.taiHeGenIndicator); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, CommonConstans.taiHeGenIndicator);
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
powerOfDayGF = powerOfDayGF + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay)); if(result!=null)
powerOfMonthGF = powerOfMonthGF + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth)); {
powerOfAnnualGF = powerOfAnnualGF + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)); powerOfDayGF = powerOfDayGF + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay));
powerOfMonthGF = powerOfMonthGF + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth));
powerOfAnnualGF = powerOfAnnualGF + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear));
}
} }
HashMap<String, String> stringHashMap4 = new HashMap<>(); HashMap<String, String> stringHashMap4 = new HashMap<>();
stringHashMap4.put("title", String.format(CommonConstans.Fourdecimalplaces, powerOfDayFD) + "/" + String.format(CommonConstans.Fourdecimalplaces, powerOfDayGF)); stringHashMap4.put("title", String.format(CommonConstans.Fourdecimalplaces, powerOfDayFD) + "/" + String.format(CommonConstans.Fourdecimalplaces, powerOfDayGF));
...@@ -1099,14 +1172,19 @@ public class MonitoringServiceImpl { ...@@ -1099,14 +1172,19 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("年发电量")); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("年发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
stationBasic.setAddress(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量"))); if(result!=null)
{
stationBasic.setAddress(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
}
} else { } else {
Map<String, List<String>> queryCondtion = new HashMap<>(); Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(CommonConstans.taiHeGenIndicatorYear)); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(CommonConstans.taiHeGenIndicatorYear));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
stationBasic.setAddress(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear))); if(result!=null)
{
stationBasic.setAddress(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)));
}
} }
}); });
List<StationBasic> fdzList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FDZ")).collect(Collectors.toList()); List<StationBasic> fdzList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FDZ")).collect(Collectors.toList());
...@@ -1320,18 +1398,22 @@ public class MonitoringServiceImpl { ...@@ -1320,18 +1398,22 @@ public class MonitoringServiceImpl {
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id")); stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
} }
stationBasicListAll.forEach(stationBasic -> { stationBasicListAll.forEach(stationBasic -> {
if (stationBasic.getStationType().equals("FDZ")) { if (stationBasic.getStationType().equals("FDZ")) {
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值")); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值"));
List<ESEquipments> esEquipmentsList = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); List<ESEquipments> esEquipmentsList = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
total.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(esEquipmentsList, "220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值")); if(esEquipmentsList!=null)
{
total.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(esEquipmentsList, "220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值"));
}
} else { } else {
queryCondtion1.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId())); queryCondtion1.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
queryCondtion1.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("南瑞光差保护_313P")); queryCondtion1.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("南瑞光差保护_313P"));
List<ESEquipments> esEquipmentsList = commonServiceImpl.getListDataByCondtions(queryCondtion1, null, ESEquipments.class); List<ESEquipments> esEquipmentsList = commonServiceImpl.getListDataByCondtions(queryCondtion1, null, ESEquipments.class);
total.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(esEquipmentsList, "南瑞光差保护_313P") * CommonConstans.kwToMv); if(esEquipmentsList!=null)
{
total.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(esEquipmentsList, "南瑞光差保护_313P") * CommonConstans.kwToMv);
}
} }
}); });
//有功功率换算 //有功功率换算
......
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