|
@@ -58,6 +58,7 @@ public class AirDensityJob {
|
|
|
private final FanModelDataService fanModelDataService;
|
|
|
|
|
|
|
|
|
+
|
|
|
@Scheduled(cron = "0 0 19 * * ?")
|
|
|
public void AirDensityCalculation() {
|
|
|
List<WindTowerInfo> windTowerInfoList = windTowerInfoService.list();
|
|
@@ -234,15 +235,21 @@ public class AirDensityJob {
|
|
|
continue;
|
|
|
}
|
|
|
FanJsonInfo towerJsonInfo = jsonObject1.toBean(FanJsonInfo.class);
|
|
|
+ String[] strArr = new String[]{towerJsonInfo.getFdln(),towerJsonInfo.getFd1n(),towerJsonInfo.getFd2n(),towerJsonInfo.getFd3n(),towerJsonInfo.getFd4n()};
|
|
|
List<String> collect = new ArrayList<>();
|
|
|
if (stationInfo.getStationBasicInfo().getStationType().equals("风")) {
|
|
|
collect = stationInfo.getFanTowerList().stream().map(FanTower::getFanModel).distinct().collect(Collectors.toList());
|
|
|
} else {
|
|
|
collect = stationInfo.getInverterInfos().stream().map(InverterInfo::getModelNumber).distinct().collect(Collectors.toList());
|
|
|
}
|
|
|
-
|
|
|
- String fdn = new BigDecimal(towerJsonInfo.getFdln()).setScale(2, RoundingMode.HALF_UP).toString();
|
|
|
- for (String s1 : collect) {
|
|
|
+ String fdn = "";
|
|
|
+ for (int i = 0; i < collect.size(); i++) {
|
|
|
+ if(collect.size() == 1){
|
|
|
+ fdn = strArr[i];
|
|
|
+ }else{
|
|
|
+ fdn = strArr[i + 1];
|
|
|
+ }
|
|
|
+ String s1 = collect.get(i);
|
|
|
if (StrUtil.isBlank(s1)) {
|
|
|
continue;
|
|
|
}
|
|
@@ -253,8 +260,15 @@ public class AirDensityJob {
|
|
|
if (StrUtil.isBlank(s2)) {
|
|
|
continue;
|
|
|
}
|
|
|
- realTimeTotal = new BigDecimal(fdn).divide(new BigDecimal(s2), 2, BigDecimal.ROUND_HALF_UP);//满发小时数(年)
|
|
|
-
|
|
|
+ //根据风机类型分组
|
|
|
+ Map<String, List<FanTower>> modelMap = stationInfo.getFanTowerList().stream()
|
|
|
+ .collect(Collectors.groupingBy(FanTower::getFanModel));
|
|
|
+ int fanTotal;
|
|
|
+ if(stationInfo.getStationBasicInfo().getStationName().contains("七台河")){
|
|
|
+ fanTotal = 1;
|
|
|
+ }
|
|
|
+ fanTotal = modelMap.get(s1).size();
|
|
|
+ realTimeTotal = new BigDecimal(fdn).divide(new BigDecimal(s2).multiply(new BigDecimal(fanTotal)), 2, BigDecimal.ROUND_HALF_UP);//满发小时数(年)
|
|
|
|
|
|
//一期
|
|
|
FanModelData fanModelData = new FanModelData(UUID.randomUUID().toString(), stationInfo.getId(),
|
|
@@ -263,19 +277,20 @@ public class AirDensityJob {
|
|
|
fdn, realTimeTotal.toString());
|
|
|
//发电量(年)
|
|
|
fdn = new BigDecimal(towerJsonInfo.getFd2n()).setScale(2, RoundingMode.HALF_UP).toString();
|
|
|
- List<FanModelData> modelDataList = fanModelDataList.stream().filter(f -> f.getStationId().equals(stationInfo.getId()) && f.getModelName().equals(s1)).collect(Collectors.toList());
|
|
|
+ List<FanModelData> modelDataList = fanModelDataList.stream().filter(f -> f.getStationId().equals(stationInfo.getId())
|
|
|
+ && f.getModelName().equals(s1)).collect(Collectors.toList());
|
|
|
if (modelDataList.size() > 0) {
|
|
|
// System.out.println("删除");
|
|
|
fanModelDataService.deleteFanModelData(modelDataList.get(0).getId());
|
|
|
-
|
|
|
+//
|
|
|
}
|
|
|
// System.out.println("新增");
|
|
|
mongoTemplate.save(fanModelData);
|
|
|
-
|
|
|
-
|
|
|
+//
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|