|
@@ -8,6 +8,7 @@ import com.jiayue.ipfcst.common.data.entity.*;
|
|
|
import com.jiayue.ipfcst.common.data.repository.*;
|
|
|
import com.jiayue.ipfcst.common.data.service.uploadfilerule.E41UploadFileRuleService;
|
|
|
import com.jiayue.ipfcst.console.service.*;
|
|
|
+import com.jiayue.ipfcst.dataexchange.service.equipmentstatusdata.WindTowerStatusDataService;
|
|
|
import com.jiayue.ipfcst.fileupload.service.BaseUploadFileService;
|
|
|
import com.jiayue.ipfcst.fileupload.service.IUploadFileService;
|
|
|
import com.jiayue.ipfcst.fileupload.util.FileUtil;
|
|
@@ -72,6 +73,8 @@ public class E41UploadFileService extends BaseUploadFileService implements IUplo
|
|
|
|
|
|
private final NwpRepository nwpRepository;
|
|
|
|
|
|
+ private final WindTowerStatusDataService windTowerStatusDataService;
|
|
|
+
|
|
|
public E41UploadFileService(VelocityEngine velocityEngine, E41UploadFileRuleService e41UploadFileRuleService,
|
|
|
ForecastPowerShortTermService forecastPowerShortTermService, ForecastPowerUltraShortTermService forecastPowerUltraShortTermService,
|
|
|
InverterInfoService inverterInfoService, InverterStatusDataRepository inverterStatusDataRepository,
|
|
@@ -79,7 +82,10 @@ public class E41UploadFileService extends BaseUploadFileService implements IUplo
|
|
|
WindTurbineInfoService windTurbineInfoService, WindTowerInfoRepository windTowerInfoRepository,
|
|
|
WindTowerStatusDataRepository windTowerStatusDataRepository, WeatherStationInfoRepository weatherStationInfoRepository,
|
|
|
WindTurbineStatusDataRepository windTurbineStatusDataRepository,
|
|
|
- WeatherStationStatusDataRepository weatherStationStatusDataRepository, NwpRepository nwpRepository) {
|
|
|
+ WeatherStationStatusDataRepository weatherStationStatusDataRepository,
|
|
|
+ NwpRepository nwpRepository,
|
|
|
+ WindTowerStatusDataService windTowerStatusDataService
|
|
|
+ ) {
|
|
|
this.velocityEngine = velocityEngine;
|
|
|
this.e41UploadFileRuleService = e41UploadFileRuleService;
|
|
|
this.forecastPowerShortTermService = forecastPowerShortTermService;
|
|
@@ -96,6 +102,7 @@ public class E41UploadFileService extends BaseUploadFileService implements IUplo
|
|
|
this.weatherStationInfoRepository = weatherStationInfoRepository;
|
|
|
this.weatherStationStatusDataRepository = weatherStationStatusDataRepository;
|
|
|
this.nwpRepository = nwpRepository;
|
|
|
+ this.windTowerStatusDataService = windTowerStatusDataService;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -806,6 +813,13 @@ public class E41UploadFileService extends BaseUploadFileService implements IUplo
|
|
|
List<WindTowerInfo> windTowerInfoList = windTowerInfoRepository.findAll();
|
|
|
// 将测风塔信息过滤出上报的塔
|
|
|
List<WindTowerInfo> filterWindTowerInfoList = windTowerInfoList.stream().filter(w -> w.getReport() == true).collect(Collectors.toList());
|
|
|
+
|
|
|
+ // 所有风机数据
|
|
|
+ List<WindTurbineStatusData> windTurbineStatusDataRepositoryAll = windTurbineStatusDataRepository.findAll();
|
|
|
+
|
|
|
+ // 上报第一个风机
|
|
|
+ Integer windTurbineEquipmentNo = windTurbineStatusDataRepositoryAll.get(0).getEquipmentNo();
|
|
|
+
|
|
|
if (!filterWindTowerInfoList.isEmpty()) {
|
|
|
// 给测风塔信息按id升序排列
|
|
|
filterWindTowerInfoList.sort(Comparator.comparing(WindTowerInfo::getId));
|
|
@@ -813,6 +827,10 @@ public class E41UploadFileService extends BaseUploadFileService implements IUplo
|
|
|
Integer uploadWindTowerId = filterWindTowerInfoList.get(0).getId();
|
|
|
// 获取测风塔遥测数据
|
|
|
List<WindTowerStatusData> windTowerStatusDataList = windTowerStatusDataRepository.findByEquipmentNoAndTimeBetween(uploadWindTowerId, new Date(startTime), new Date(endTime));
|
|
|
+
|
|
|
+ // 风机数据
|
|
|
+ List<WindTurbineStatusData> byTimeBetweenAndEquipmentNo = windTurbineStatusDataRepository.findByTimeBetweenAndEquipmentNo(new Date(startTime), new Date(endTime), windTurbineEquipmentNo);
|
|
|
+
|
|
|
// 数据格式化
|
|
|
DecimalFormat df = new DecimalFormat("0.00");
|
|
|
BigDecimal ws10 = new BigDecimal(0);
|
|
@@ -878,20 +896,39 @@ public class E41UploadFileService extends BaseUploadFileService implements IUplo
|
|
|
BigDecimal rhRandomValue = new BigDecimal(df.format(Math.random() * 10 + 50));
|
|
|
rh = rh.add(rhRandomValue).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
} else {
|
|
|
- WindTowerStatusData windTowerStatusData = windTowerStatusDataList.get(0);
|
|
|
- ws10 = windTowerStatusData.getWsInst10();
|
|
|
- wd10 = windTowerStatusData.getWdInst10();
|
|
|
- ws30 = windTowerStatusData.getWsInst30();
|
|
|
- wd30 = windTowerStatusData.getWdInst30();
|
|
|
- ws50 = windTowerStatusData.getWsInst50();
|
|
|
- wd50 = windTowerStatusData.getWdInst50();
|
|
|
- ws70 = windTowerStatusData.getWsInst70();
|
|
|
- wd70 = windTowerStatusData.getWdInst70();
|
|
|
- wsHubHeight = windTowerStatusData.getWsInstHubHeight();
|
|
|
- wdHubHeight = windTowerStatusData.getWdInstHubHeight();
|
|
|
- t = windTowerStatusData.getTInst();
|
|
|
- p = windTowerStatusData.getPaInst();
|
|
|
- rh = windTowerStatusData.getRhInst();
|
|
|
+ Boolean isAbnormalData = windTowerStatusDataService.getIsAbnormalData();
|
|
|
+ if(isAbnormalData){
|
|
|
+ WindTowerStatusData windTowerStatusData = windTowerStatusDataList.get(0);
|
|
|
+ ws10 = windTowerStatusData.getWsInst10();
|
|
|
+ wd10 = windTowerStatusData.getWdInst10();
|
|
|
+ ws30 = windTowerStatusData.getWsInst30();
|
|
|
+ wd30 = windTowerStatusData.getWdInst30();
|
|
|
+ ws50 = windTowerStatusData.getWsInst50();
|
|
|
+ wd50 = windTowerStatusData.getWdInst50();
|
|
|
+ ws70 = windTowerStatusData.getWsInst70();
|
|
|
+ wd70 = windTowerStatusData.getWdInst70();
|
|
|
+ wsHubHeight = windTowerStatusData.getWsInstHubHeight();
|
|
|
+ wdHubHeight = windTowerStatusData.getWdInstHubHeight();
|
|
|
+ t = windTowerStatusData.getTInst();
|
|
|
+ p = windTowerStatusData.getPaInst();
|
|
|
+ rh = windTowerStatusData.getRhInst();
|
|
|
+ }else {
|
|
|
+ // 如果信息异常 则取风机数据
|
|
|
+ ws10 = byTimeBetweenAndEquipmentNo.get(0).getWs();
|
|
|
+ wd10 = byTimeBetweenAndEquipmentNo.get(0).getWs();
|
|
|
+ ws30 = byTimeBetweenAndEquipmentNo.get(0).getWs();
|
|
|
+ wd30 = byTimeBetweenAndEquipmentNo.get(0).getWs();
|
|
|
+ ws50 = byTimeBetweenAndEquipmentNo.get(0).getWs();
|
|
|
+ wd50 = byTimeBetweenAndEquipmentNo.get(0).getWs();
|
|
|
+ ws70 = byTimeBetweenAndEquipmentNo.get(0).getWs();
|
|
|
+ wd70 = byTimeBetweenAndEquipmentNo.get(0).getWs();
|
|
|
+ wsHubHeight = byTimeBetweenAndEquipmentNo.get(0).getWs();
|
|
|
+ wdHubHeight = byTimeBetweenAndEquipmentNo.get(0).getWs();
|
|
|
+ t = byTimeBetweenAndEquipmentNo.get(0).getWs();
|
|
|
+ p = byTimeBetweenAndEquipmentNo.get(0).getWs();
|
|
|
+ rh = byTimeBetweenAndEquipmentNo.get(0).getWs();
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
//存入上报短期中
|