|
@@ -61,10 +61,16 @@ public class E63UploadFileService extends BaseUploadFileService {
|
|
|
|
|
|
private final InverterInfoRepository inverterInfoRepository;
|
|
private final InverterInfoRepository inverterInfoRepository;
|
|
|
|
|
|
|
|
+ private final WindTurbineStatusDataRepository windTurbineStatusDataRepository;
|
|
|
|
+
|
|
|
|
+ private final InverterStatusDataRepository inverterStatusDataRepository;
|
|
|
|
+
|
|
|
|
+ private final PowerStationStatusDataRepository powerStationStatusDataRepository;
|
|
|
|
+
|
|
@Autowired
|
|
@Autowired
|
|
private RedisUtils redisUtils;
|
|
private RedisUtils redisUtils;
|
|
|
|
|
|
- public E63UploadFileService(VelocityEngine velocityEngine, ForecastPowerShortTermService forecastPowerShortTermService, ForecastPowerUltraShortTermService forecastPowerUltraShortTermService, E63UploadFileRuleService e63UploadFileRuleService, WeatherStationInfoRepository weatherStationInfoRepository, WindTurbineInfoRepository windTurbineInfoRepository, WeatherStationStatusDataRepository weatherStationStatusDataRepository, WindTowerInfoRepository windTowerInfoRepository, WindTowerStatusDataRepository windTowerStatusDataRepository, NwpRepository nwpRepository, InverterInfoRepository inverterInfoRepository) {
|
|
|
|
|
|
+ public E63UploadFileService(VelocityEngine velocityEngine, ForecastPowerShortTermService forecastPowerShortTermService, ForecastPowerUltraShortTermService forecastPowerUltraShortTermService, E63UploadFileRuleService e63UploadFileRuleService, WeatherStationInfoRepository weatherStationInfoRepository, WindTurbineInfoRepository windTurbineInfoRepository, WeatherStationStatusDataRepository weatherStationStatusDataRepository, WindTowerInfoRepository windTowerInfoRepository, WindTowerStatusDataRepository windTowerStatusDataRepository, NwpRepository nwpRepository, InverterInfoRepository inverterInfoRepository, WindTurbineStatusDataRepository windTurbineStatusDataRepository, InverterStatusDataRepository inverterStatusDataRepository, PowerStationStatusDataRepository powerStationStatusDataRepository) {
|
|
this.velocityEngine = velocityEngine;
|
|
this.velocityEngine = velocityEngine;
|
|
this.forecastPowerShortTermService = forecastPowerShortTermService;
|
|
this.forecastPowerShortTermService = forecastPowerShortTermService;
|
|
this.forecastPowerUltraShortTermService = forecastPowerUltraShortTermService;
|
|
this.forecastPowerUltraShortTermService = forecastPowerUltraShortTermService;
|
|
@@ -76,6 +82,9 @@ public class E63UploadFileService extends BaseUploadFileService {
|
|
this.windTowerStatusDataRepository = windTowerStatusDataRepository;
|
|
this.windTowerStatusDataRepository = windTowerStatusDataRepository;
|
|
this.nwpRepository = nwpRepository;
|
|
this.nwpRepository = nwpRepository;
|
|
this.inverterInfoRepository = inverterInfoRepository;
|
|
this.inverterInfoRepository = inverterInfoRepository;
|
|
|
|
+ this.windTurbineStatusDataRepository = windTurbineStatusDataRepository;
|
|
|
|
+ this.inverterStatusDataRepository = inverterStatusDataRepository;
|
|
|
|
+ this.powerStationStatusDataRepository = powerStationStatusDataRepository;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -448,8 +457,10 @@ public class E63UploadFileService extends BaseUploadFileService {
|
|
// 将气象站信息过滤出上报
|
|
// 将气象站信息过滤出上报
|
|
List<WeatherStationInfo> weatherStationInfos = weatherStationInfoList.stream().filter(w -> w.getReport() == true).collect(Collectors.toList());
|
|
List<WeatherStationInfo> weatherStationInfos = weatherStationInfoList.stream().filter(w -> w.getReport() == true).collect(Collectors.toList());
|
|
if (!weatherStationInfos.isEmpty()) {
|
|
if (!weatherStationInfos.isEmpty()) {
|
|
- String id = String.valueOf(weatherStationInfos.get(0).getId());
|
|
|
|
- Map<String, String> qxzMap = redisUtils.hgetall("qxz-" + electricFieldInfo.getStationCode() + "-" + id);
|
|
|
|
|
|
+ String qxzId = String.valueOf(weatherStationInfos.get(0).getId());
|
|
|
|
+ // 设备编号
|
|
|
|
+ String equipmentNo = String.valueOf(weatherStationInfos.get(0).getEquipmentNo());
|
|
|
|
+ Map<String, String> qxzMap = redisUtils.hgetall("qxz-" + electricFieldInfo.getStationCode() + "-" + qxzId);
|
|
// 数据格式化
|
|
// 数据格式化
|
|
DecimalFormat df = new DecimalFormat("0.00");
|
|
DecimalFormat df = new DecimalFormat("0.00");
|
|
BigDecimal globalR = new BigDecimal(0);
|
|
BigDecimal globalR = new BigDecimal(0);
|
|
@@ -462,42 +473,58 @@ public class E63UploadFileService extends BaseUploadFileService {
|
|
BigDecimal rh = new BigDecimal(0);
|
|
BigDecimal rh = new BigDecimal(0);
|
|
BigDecimal cellT = new BigDecimal(0);
|
|
BigDecimal cellT = new BigDecimal(0);
|
|
|
|
|
|
- boolean isRedisData = false;
|
|
|
|
|
|
+ boolean isUseRedis = false;
|
|
if (!qxzMap.isEmpty()) {
|
|
if (!qxzMap.isEmpty()) {
|
|
String time = qxzMap.get("time");
|
|
String time = qxzMap.get("time");
|
|
if (StrUtil.isNotBlank(time)) {
|
|
if (StrUtil.isNotBlank(time)) {
|
|
if (Long.parseLong(time) >= startTime && Long.parseLong(time) <= endTime) {
|
|
if (Long.parseLong(time) >= startTime && Long.parseLong(time) <= endTime) {
|
|
- isRedisData = true;
|
|
|
|
|
|
+ // 从缓存里赋值
|
|
|
|
+ globalR = qxzMap.get("globalR") == null ? qxzRandomCreate("globalR") : new BigDecimal(qxzMap.get("globalR"));
|
|
|
|
+ directR = qxzMap.get("directR") == null ? qxzRandomCreate("directR") : new BigDecimal(qxzMap.get("directR"));
|
|
|
|
+ diffuseR = qxzMap.get("diffuseR") == null ? globalR.subtract(directR) : new BigDecimal(qxzMap.get("diffuseR"));
|
|
|
|
+ airT = qxzMap.get("airT") == null ? qxzRandomCreate("airT") : new BigDecimal(qxzMap.get("airT"));
|
|
|
|
+ p = qxzMap.get("p") == null ? qxzRandomCreate("p") : new BigDecimal(qxzMap.get("p"));
|
|
|
|
+ rh = qxzMap.get("rh") == null ? qxzRandomCreate("rh") : new BigDecimal(qxzMap.get("rh"));
|
|
|
|
+ cellT = qxzMap.get("cellT") == null ? qxzRandomCreate("cellT") : new BigDecimal(qxzMap.get("cellT"));
|
|
|
|
+ ws = qxzMap.get("ws") == null ? qxzRandomCreate("ws") : new BigDecimal(qxzMap.get("ws"));
|
|
|
|
+ wd = qxzMap.get("wd") == null ? qxzRandomCreate("wd") : new BigDecimal(qxzMap.get("wd"));
|
|
|
|
+ isUseRedis = true;
|
|
|
|
+ log.info(electricFieldInfo.getStationCode() + "生成气象站数据从redis获取:" + qxzMap.toString());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- if (isRedisData) {
|
|
|
|
- // 从缓存里赋值
|
|
|
|
- globalR = qxzMap.get("globalR") == null ? qxzRandomCreate("globalR") : new BigDecimal(qxzMap.get("globalR"));
|
|
|
|
- directR = qxzMap.get("directR") == null ? qxzRandomCreate("directR") : new BigDecimal(qxzMap.get("directR"));
|
|
|
|
- diffuseR = qxzMap.get("diffuseR") == null ? globalR.subtract(directR) : new BigDecimal(qxzMap.get("diffuseR"));
|
|
|
|
- airT = qxzMap.get("airT") == null ? qxzRandomCreate("airT") : new BigDecimal(qxzMap.get("airT"));
|
|
|
|
- p = qxzMap.get("p") == null ? qxzRandomCreate("p") : new BigDecimal(qxzMap.get("p"));
|
|
|
|
- rh = qxzMap.get("rh") == null ? qxzRandomCreate("rh") : new BigDecimal(qxzMap.get("rh"));
|
|
|
|
- cellT = qxzMap.get("cellT") == null ? qxzRandomCreate("cellT") : new BigDecimal(qxzMap.get("cellT"));
|
|
|
|
- ws = qxzMap.get("ws") == null ? qxzRandomCreate("ws") : new BigDecimal(qxzMap.get("ws"));
|
|
|
|
- wd = qxzMap.get("wd") == null ? qxzRandomCreate("wd") : new BigDecimal(qxzMap.get("wd"));
|
|
|
|
- log.info(electricFieldInfo.getStationCode() + "生成气象站数据从redis获取:" + qxzMap.toString());
|
|
|
|
- } else {
|
|
|
|
- // 总辐射产生500-1000随机数
|
|
|
|
- globalR = qxzRandomCreate("globalR");
|
|
|
|
- // 直辐射产生400-500随机数
|
|
|
|
- directR = qxzRandomCreate("directR");
|
|
|
|
- // 散辐射 = 总 - 直
|
|
|
|
- diffuseR = globalR.subtract(directR);
|
|
|
|
- airT = qxzRandomCreate("airT");
|
|
|
|
- p = qxzRandomCreate("p");
|
|
|
|
- rh = qxzRandomCreate("rh");
|
|
|
|
- cellT = qxzRandomCreate("cellT");
|
|
|
|
- ws = qxzRandomCreate("ws");
|
|
|
|
- wd = qxzRandomCreate("wd");
|
|
|
|
- log.info(electricFieldInfo.getStationCode() + "生成气象站数据用随机数");
|
|
|
|
|
|
+ if (!isUseRedis) {
|
|
|
|
+ List<WeatherStationStatusData> weatherStationStatusDataList = weatherStationStatusDataRepository.findByTimeBetweenAndEquipmentNo(new Date(startTime), new Date(endTime), equipmentNo);
|
|
|
|
+ if (weatherStationStatusDataList.isEmpty()){
|
|
|
|
+ // 总辐射产生500-1000随机数
|
|
|
|
+ globalR = qxzRandomCreate("globalR");
|
|
|
|
+ // 直辐射产生400-500随机数
|
|
|
|
+ directR = qxzRandomCreate("directR");
|
|
|
|
+ // 散辐射 = 总 - 直
|
|
|
|
+ diffuseR = globalR.subtract(directR);
|
|
|
|
+ airT = qxzRandomCreate("airT");
|
|
|
|
+ p = qxzRandomCreate("p");
|
|
|
|
+ rh = qxzRandomCreate("rh");
|
|
|
|
+ cellT = qxzRandomCreate("cellT");
|
|
|
|
+ ws = qxzRandomCreate("ws");
|
|
|
|
+ wd = qxzRandomCreate("wd");
|
|
|
|
+ log.info(electricFieldInfo.getStationCode() + "生成气象站数据用随机数");
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ weatherStationStatusDataList.stream().sorted(Comparator.comparing(WeatherStationStatusData::getTime).reversed()).collect(Collectors.toList());
|
|
|
|
+ WeatherStationStatusData weatherStationStatusData = weatherStationStatusDataList.get(0);
|
|
|
|
+ globalR = weatherStationStatusData.getGlobalR();
|
|
|
|
+ directR = weatherStationStatusData.getDirectR();
|
|
|
|
+ diffuseR = globalR.subtract(directR);
|
|
|
|
+ airT = weatherStationStatusData.getAirT();
|
|
|
|
+ p = weatherStationStatusData.getP();
|
|
|
|
+ rh = weatherStationStatusData.getRh();
|
|
|
|
+ cellT = weatherStationStatusData.getCellT();
|
|
|
|
+ ws = weatherStationStatusData.getWs();
|
|
|
|
+ wd = weatherStationStatusData.getWd();
|
|
|
|
+ log.info(electricFieldInfo.getStationCode() + "生成气象站数据从数据表获取");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
// 创建上报文件
|
|
// 创建上报文件
|
|
File file = super.createTempFile(fileName);
|
|
File file = super.createTempFile(fileName);
|
|
@@ -544,8 +571,9 @@ public class E63UploadFileService extends BaseUploadFileService {
|
|
// 将测风塔信息过滤出上报的塔
|
|
// 将测风塔信息过滤出上报的塔
|
|
List<WindTowerInfo> filterWindTowerInfoList = windTowerInfoList.stream().filter(w -> w.getReport() == true).collect(Collectors.toList());
|
|
List<WindTowerInfo> filterWindTowerInfoList = windTowerInfoList.stream().filter(w -> w.getReport() == true).collect(Collectors.toList());
|
|
if (!filterWindTowerInfoList.isEmpty()) {
|
|
if (!filterWindTowerInfoList.isEmpty()) {
|
|
- String id = String.valueOf(filterWindTowerInfoList.get(0).getId());
|
|
|
|
- Map<String, String> cftMap = redisUtils.hgetall("cft-" + electricFieldInfo.getStationCode() + "-" + id);
|
|
|
|
|
|
+ String cftId = String.valueOf(filterWindTowerInfoList.get(0).getId());
|
|
|
|
+ String equipmentNo = String.valueOf(filterWindTowerInfoList.get(0).getEquipmentNo());
|
|
|
|
+ Map<String, String> cftMap = redisUtils.hgetall("cft-" + electricFieldInfo.getStationCode() + "-" + cftId);
|
|
// 数据格式化
|
|
// 数据格式化
|
|
DecimalFormat df = new DecimalFormat("0.00");
|
|
DecimalFormat df = new DecimalFormat("0.00");
|
|
BigDecimal ws10 = new BigDecimal(0);
|
|
BigDecimal ws10 = new BigDecimal(0);
|
|
@@ -570,135 +598,203 @@ public class E63UploadFileService extends BaseUploadFileService {
|
|
BigDecimal p8 = new BigDecimal(0);
|
|
BigDecimal p8 = new BigDecimal(0);
|
|
BigDecimal rh8 = new BigDecimal(0);
|
|
BigDecimal rh8 = new BigDecimal(0);
|
|
|
|
|
|
- boolean isRedisData = false;
|
|
|
|
|
|
+ boolean isUseRedis = false;
|
|
if (!cftMap.isEmpty()) {
|
|
if (!cftMap.isEmpty()) {
|
|
String time = cftMap.get("time");
|
|
String time = cftMap.get("time");
|
|
if (StrUtil.isNotBlank(time)) {
|
|
if (StrUtil.isNotBlank(time)) {
|
|
if (Long.parseLong(time) >= startTime && Long.parseLong(time) <= endTime) {
|
|
if (Long.parseLong(time) >= startTime && Long.parseLong(time) <= endTime) {
|
|
- isRedisData = true;
|
|
|
|
|
|
+ // 从缓存里赋值
|
|
|
|
+ ws10 = cftMap.get("wsInst10") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wsInst10"));
|
|
|
|
+ wd10 = cftMap.get("wdInst10") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wdInst10"));
|
|
|
|
+ ws30 = cftMap.get("wsInst30") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wsInst30"));
|
|
|
|
+ wd30 = cftMap.get("wdInst30") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wdInst30"));
|
|
|
|
+ ws50 = cftMap.get("wsInst50") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wsInst50"));
|
|
|
|
+ wd50 = cftMap.get("wdInst50") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wdInst50"));
|
|
|
|
+ ws60 = cftMap.get("wsInst60") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wsInst60"));
|
|
|
|
+ wd60 = cftMap.get("wdInst60") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wdInst60"));
|
|
|
|
+ ws70 = cftMap.get("wsInst70") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wsInst70"));
|
|
|
|
+ wd70 = cftMap.get("wdInst70") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wdInst70"));
|
|
|
|
+ ws80 = cftMap.get("wsInst80") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wsInst80"));
|
|
|
|
+ wd80 = cftMap.get("wdInst80") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wdInst80"));
|
|
|
|
+ ws90 = cftMap.get("wsInst90") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wsInst90"));
|
|
|
|
+ wd90 = cftMap.get("wdInst90") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wdInst90"));
|
|
|
|
+ ws100 = cftMap.get("wsInst100") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wsInst100"));
|
|
|
|
+ wd100 = cftMap.get("wdInst100") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wdInst100"));
|
|
|
|
+ wsHubHeight = cftMap.get("wsInstHubHeight") == null ? cftRandomCreate("wsInstHubHeight") : new BigDecimal(cftMap.get("wsInstHubHeight"));
|
|
|
|
+ wdHubHeight = cftMap.get("wdInstHubHeight") == null ? cftRandomCreate("wdInstHubHeight") : new BigDecimal(cftMap.get("wdInstHubHeight"));
|
|
|
|
+ t8 = cftMap.get("tInst") == null ? cftRandomCreate("tInst") : new BigDecimal(cftMap.get("tInst"));
|
|
|
|
+ p8 = cftMap.get("paInst") == null ? cftRandomCreate("paInst") : new BigDecimal(cftMap.get("paInst"));
|
|
|
|
+ rh8 = cftMap.get("rhInst") == null ? cftRandomCreate("rhInst") : new BigDecimal(cftMap.get("rhInst"));
|
|
|
|
+ isUseRedis = true;
|
|
|
|
+ log.info(electricFieldInfo.getStationCode() + "生成测风塔数据从redis获取:" + cftMap.toString());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (isRedisData) {
|
|
|
|
- // 从缓存里赋值
|
|
|
|
- ws10 = cftMap.get("wsInst10") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wsInst10"));
|
|
|
|
- wd10 = cftMap.get("wdInst10") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wdInst10"));
|
|
|
|
- ws30 = cftMap.get("wsInst30") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wsInst30"));
|
|
|
|
- wd30 = cftMap.get("wdInst30") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wdInst30"));
|
|
|
|
- ws50 = cftMap.get("wsInst50") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wsInst50"));
|
|
|
|
- wd50 = cftMap.get("wdInst50") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wdInst50"));
|
|
|
|
- ws60 = cftMap.get("wsInst60") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wsInst60"));
|
|
|
|
- wd60 = cftMap.get("wdInst60") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wdInst60"));
|
|
|
|
- ws70 = cftMap.get("wsInst70") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wsInst70"));
|
|
|
|
- wd70 = cftMap.get("wdInst70") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wdInst70"));
|
|
|
|
- ws80 = cftMap.get("wsInst80") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wsInst80"));
|
|
|
|
- wd80 = cftMap.get("wdInst80") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wdInst80"));
|
|
|
|
- ws90 = cftMap.get("wsInst90") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wsInst90"));
|
|
|
|
- wd90 = cftMap.get("wdInst90") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wdInst90"));
|
|
|
|
- ws100 = cftMap.get("wsInst100") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wsInst100"));
|
|
|
|
- wd100 = cftMap.get("wdInst100") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wdInst100"));
|
|
|
|
- wsHubHeight = cftMap.get("wsInstHubHeight") == null ? cftRandomCreate("wsInstHubHeight") : new BigDecimal(cftMap.get("wsInstHubHeight"));
|
|
|
|
- wdHubHeight = cftMap.get("wdInstHubHeight") == null ? cftRandomCreate("wdInstHubHeight") : new BigDecimal(cftMap.get("wdInstHubHeight"));
|
|
|
|
- t8 = cftMap.get("tInst") == null ? cftRandomCreate("tInst") : new BigDecimal(cftMap.get("tInst"));
|
|
|
|
- p8 = cftMap.get("paInst") == null ? cftRandomCreate("paInst") : new BigDecimal(cftMap.get("paInst"));
|
|
|
|
- rh8 = cftMap.get("rhInst") == null ? cftRandomCreate("rhInst") : new BigDecimal(cftMap.get("rhInst"));
|
|
|
|
- log.info(electricFieldInfo.getStationCode() + "生成测风塔数据从redis获取:" + cftMap.toString());
|
|
|
|
- } else {
|
|
|
|
- // 没有测风塔数据用nwp数据补
|
|
|
|
- Long nwpTime;
|
|
|
|
- try {
|
|
|
|
- nwpTime = DateMomentUtil.getMomentTime(endTime, 1, 15 * 60 * 1000L);
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- log.error("获取nwp时刻步长错误", e);
|
|
|
|
- nwpTime = DateMomentUtil.getDayStartTime(new Date().getTime());
|
|
|
|
|
|
+ if (!isUseRedis) {
|
|
|
|
+ List<WindTowerStatusData> windTowerStatusDataList = windTowerStatusDataRepository.findByEquipmentNoAndTimeBetween(equipmentNo, new Date(startTime), new Date(endTime));
|
|
|
|
+ if (windTowerStatusDataList.isEmpty()){
|
|
|
|
+ // 没有测风塔数据用nwp数据补
|
|
|
|
+ Long nwpTime;
|
|
|
|
+ try {
|
|
|
|
+ nwpTime = DateMomentUtil.getMomentTime(endTime, 1, 15 * 60 * 1000L);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ log.error("获取nwp时刻步长错误", e);
|
|
|
|
+ nwpTime = DateMomentUtil.getDayStartTime(new Date().getTime());
|
|
|
|
+ }
|
|
|
|
+ List<Nwp> nwpList = nwpRepository.findByPreTimeBetween(nwpTime, nwpTime);
|
|
|
|
+
|
|
|
|
+ if (nwpList.size() > 0) {
|
|
|
|
+ Nwp nwpData = nwpList.get(0);
|
|
|
|
+ ws10 = nwpData.getWs10();
|
|
|
|
+ ws10 = ws10.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
+ wd10 = nwpData.getWd10();
|
|
|
|
+ wd10 = wd10.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
+ ws30 = nwpData.getWs30();
|
|
|
|
+ ws30 = ws30.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
+ wd30 = nwpData.getWd30();
|
|
|
|
+ wd30 = wd30.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
+ ws50 = nwpData.getWs50();
|
|
|
|
+ ws50 = ws50.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
+ wd50 = nwpData.getWd50();
|
|
|
|
+ wd50 = wd50.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
+ ws60 = ws50.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
+ wd60 = wd50.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
+ ws70 = nwpData.getWs70();
|
|
|
|
+ ws70 = ws70.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
+ wd70 = nwpData.getWd70();
|
|
|
|
+ wd70 = wd70.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
+ ws80 = nwpData.getWs80();
|
|
|
|
+ ws80 = ws80.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
+ wd80 = nwpData.getWd80();
|
|
|
|
+ wd80 = wd80.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
+ ws90 = nwpData.getWs90();
|
|
|
|
+ ws90 = ws90.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
+ wd90 = nwpData.getWd90();
|
|
|
|
+ wd90 = wd90.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
+ ws100 = nwpData.getWs100();
|
|
|
|
+ ws100 = ws100.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
+ wd100 = nwpData.getWd100();
|
|
|
|
+ wd100 = wd100.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
+ wsHubHeight = nwpData.getWs170();
|
|
|
|
+ wsHubHeight = wsHubHeight.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
+ wdHubHeight = nwpData.getWd170();
|
|
|
|
+ wdHubHeight = wdHubHeight.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
+ rh8 = nwpData.getRh();
|
|
|
|
+ rh8 = rh8.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
+ t8 = nwpData.getT();
|
|
|
|
+ t8 = t8.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
+ p8 = nwpData.getPressure();
|
|
|
|
+ p8 = p8.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
+ log.info(electricFieldInfo.getStationCode() + "生成测风塔数据用nwp+随机数");
|
|
|
|
+ } else {
|
|
|
|
+ // 10米风速产生1-5随机数
|
|
|
|
+ ws10 = cftRandomCreate("wsInst10");
|
|
|
|
+ // 10米风向产生40-60随机数
|
|
|
|
+ wd10 = cftRandomCreate("wdInst10");
|
|
|
|
+ // 30米风速产生6-10随机数
|
|
|
|
+ ws30 = cftRandomCreate("wsInst30");
|
|
|
|
+ // 30米风向产生70-90随机数
|
|
|
|
+ wd30 = cftRandomCreate("wdInst30");
|
|
|
|
+ // 50米风速产生16-20随机数
|
|
|
|
+ ws50 = cftRandomCreate("wsInst50");
|
|
|
|
+ // 50米风向产生130-150随机数
|
|
|
|
+ wd50 = cftRandomCreate("wdInst50");
|
|
|
|
+ // 60米风速产生16-20随机数
|
|
|
|
+ ws60 = cftRandomCreate("wsInst60");
|
|
|
|
+ // 60米风向产生130-150随机数
|
|
|
|
+ wd60 = cftRandomCreate("wdInst60");
|
|
|
|
+ // 70米风速产生31-35随机数
|
|
|
|
+ ws70 = cftRandomCreate("wsInst70");
|
|
|
|
+ // 70米风向产生220-240随机数
|
|
|
|
+ wd70 = cftRandomCreate("wdInst70");
|
|
|
|
+ // 80米风速产生35-40随机数
|
|
|
|
+ ws80 = cftRandomCreate("wsInst80");
|
|
|
|
+ // 80米风向产生240-250随机数
|
|
|
|
+ wd80 = cftRandomCreate("wdInst80");
|
|
|
|
+ // 90米风速产生45-50随机数
|
|
|
|
+ ws90 = cftRandomCreate("wsInst90");
|
|
|
|
+ // 90米风向产生260-270随机数
|
|
|
|
+ wd90 = cftRandomCreate("wdInst90");
|
|
|
|
+ // 100米风速产生60-70随机数
|
|
|
|
+ ws100 = cftRandomCreate("wsInst100");
|
|
|
|
+ // 100米风向产生280-290随机数
|
|
|
|
+ wd100 = cftRandomCreate("wdInst100");
|
|
|
|
+ wsHubHeight = cftRandomCreate("wsInstHubHeight");
|
|
|
|
+ wdHubHeight = cftRandomCreate("wdInstHubHeight");
|
|
|
|
+ // 湿度产生50-60随机数
|
|
|
|
+ rh8 = cftRandomCreate("rhInst");
|
|
|
|
+ // 温度产生20-35随机数
|
|
|
|
+ t8 = cftRandomCreate("tInst");
|
|
|
|
+ // 气压产生75-90随机数
|
|
|
|
+ p8 = cftRandomCreate("paInst");
|
|
|
|
+ log.info(electricFieldInfo.getStationCode() + "生成测风塔数据用随机数");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- List<Nwp> nwpList = nwpRepository.findByPreTimeBetween(nwpTime, nwpTime);
|
|
|
|
-
|
|
|
|
- if (nwpList.size() > 0) {
|
|
|
|
- Nwp nwpData = nwpList.get(0);
|
|
|
|
- ws10 = nwpData.getWs10();
|
|
|
|
- ws10 = ws10.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
- wd10 = nwpData.getWd10();
|
|
|
|
- wd10 = wd10.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
- ws30 = nwpData.getWs30();
|
|
|
|
- ws30 = ws30.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
- wd30 = nwpData.getWd30();
|
|
|
|
- wd30 = wd30.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
- ws50 = nwpData.getWs50();
|
|
|
|
- ws50 = ws50.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
- wd50 = nwpData.getWd50();
|
|
|
|
- wd50 = wd50.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
- ws60 = ws50.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
- wd60 = wd50.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
- ws70 = nwpData.getWs70();
|
|
|
|
- ws70 = ws70.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
- wd70 = nwpData.getWd70();
|
|
|
|
- wd70 = wd70.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
- ws80 = nwpData.getWs80();
|
|
|
|
- ws80 = ws80.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
- wd80 = nwpData.getWd80();
|
|
|
|
- wd80 = wd80.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
- ws90 = nwpData.getWs90();
|
|
|
|
- ws90 = ws90.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
- wd90 = nwpData.getWd90();
|
|
|
|
- wd90 = wd90.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
- ws100 = nwpData.getWs100();
|
|
|
|
- ws100 = ws100.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
- wd100 = nwpData.getWd100();
|
|
|
|
- wd100 = wd100.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
- wsHubHeight = nwpData.getWs170();
|
|
|
|
- wsHubHeight = wsHubHeight.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
- wdHubHeight = nwpData.getWd170();
|
|
|
|
- wdHubHeight = wdHubHeight.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
- rh8 = nwpData.getRh();
|
|
|
|
- rh8 = rh8.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
- t8 = nwpData.getT();
|
|
|
|
- t8 = t8.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
- p8 = nwpData.getPressure();
|
|
|
|
- p8 = p8.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
- log.info(electricFieldInfo.getStationCode() + "生成测风塔数据用nwp+随机数");
|
|
|
|
- } else {
|
|
|
|
- // 10米风速产生1-5随机数
|
|
|
|
- ws10 = cftRandomCreate("wsInst10");
|
|
|
|
- // 10米风向产生40-60随机数
|
|
|
|
- wd10 = cftRandomCreate("wdInst10");
|
|
|
|
- // 30米风速产生6-10随机数
|
|
|
|
- ws30 = cftRandomCreate("wsInst30");
|
|
|
|
- // 30米风向产生70-90随机数
|
|
|
|
- wd30 = cftRandomCreate("wdInst30");
|
|
|
|
- // 50米风速产生16-20随机数
|
|
|
|
- ws50 = cftRandomCreate("wsInst50");
|
|
|
|
- // 50米风向产生130-150随机数
|
|
|
|
- wd50 = cftRandomCreate("wdInst50");
|
|
|
|
- // 60米风速产生16-20随机数
|
|
|
|
- ws60 = cftRandomCreate("wsInst60");
|
|
|
|
- // 60米风向产生130-150随机数
|
|
|
|
- wd60 = cftRandomCreate("wdInst60");
|
|
|
|
- // 70米风速产生31-35随机数
|
|
|
|
- ws70 = cftRandomCreate("wsInst70");
|
|
|
|
- // 70米风向产生220-240随机数
|
|
|
|
- wd70 = cftRandomCreate("wdInst70");
|
|
|
|
- // 80米风速产生35-40随机数
|
|
|
|
- ws80 = cftRandomCreate("wsInst80");
|
|
|
|
- // 80米风向产生240-250随机数
|
|
|
|
- wd80 = cftRandomCreate("wdInst80");
|
|
|
|
- // 90米风速产生45-50随机数
|
|
|
|
- ws90 = cftRandomCreate("wsInst90");
|
|
|
|
- // 90米风向产生260-270随机数
|
|
|
|
- wd90 = cftRandomCreate("wdInst90");
|
|
|
|
- // 100米风速产生60-70随机数
|
|
|
|
- ws100 = cftRandomCreate("wsInst100");
|
|
|
|
- // 100米风向产生280-290随机数
|
|
|
|
- wd100 = cftRandomCreate("wdInst100");
|
|
|
|
- wsHubHeight = cftRandomCreate("wsInstHubHeight");
|
|
|
|
- wdHubHeight = cftRandomCreate("wdInstHubHeight");
|
|
|
|
- // 湿度产生50-60随机数
|
|
|
|
- rh8 = cftRandomCreate("rhInst");
|
|
|
|
- // 温度产生20-35随机数
|
|
|
|
- t8 = cftRandomCreate("tInst");
|
|
|
|
- // 气压产生75-90随机数
|
|
|
|
- p8 = cftRandomCreate("paInst");
|
|
|
|
- log.info(electricFieldInfo.getStationCode() + "生成测风塔数据用随机数");
|
|
|
|
|
|
+ else{
|
|
|
|
+ windTowerStatusDataList.stream().sorted(Comparator.comparing(WindTowerStatusData::getTime).reversed()).collect(Collectors.toList());
|
|
|
|
+ WindTowerStatusData windTowerStatusData = windTowerStatusDataList.get(0);
|
|
|
|
+ // 10米风速
|
|
|
|
+ if (windTowerStatusData.getWsInst10()!=null)
|
|
|
|
+ ws10 = windTowerStatusData.getWsInst10();
|
|
|
|
+ // 10米风向
|
|
|
|
+ if (windTowerStatusData.getWdInst10()!=null)
|
|
|
|
+ wd10 = windTowerStatusData.getWdInst10();
|
|
|
|
+ // 30米风速
|
|
|
|
+ if (windTowerStatusData.getWdInst30()!=null)
|
|
|
|
+ ws30 = windTowerStatusData.getWsInst30();
|
|
|
|
+ // 30米风向
|
|
|
|
+ if (windTowerStatusData.getWdInst30()!=null)
|
|
|
|
+ wd30 = windTowerStatusData.getWdInst30();
|
|
|
|
+ // 50米风速
|
|
|
|
+ if (windTowerStatusData.getWdInst50()!=null)
|
|
|
|
+ ws50 = windTowerStatusData.getWsInst50();
|
|
|
|
+ // 50米风向
|
|
|
|
+ if (windTowerStatusData.getWdInst50()!=null)
|
|
|
|
+ wd50 = windTowerStatusData.getWdInst50();
|
|
|
|
+ // 60米风速
|
|
|
|
+ if (windTowerStatusData.getWdInst60()!=null)
|
|
|
|
+ ws60 = windTowerStatusData.getWsInst60();
|
|
|
|
+ // 60米风向
|
|
|
|
+ if (windTowerStatusData.getWdInst60()!=null)
|
|
|
|
+ wd60 = windTowerStatusData.getWdInst60();
|
|
|
|
+ // 70米风速
|
|
|
|
+ if (windTowerStatusData.getWdInst70()!=null)
|
|
|
|
+ ws70 = windTowerStatusData.getWsInst70();
|
|
|
|
+ // 70米风向
|
|
|
|
+ if (windTowerStatusData.getWdInst70()!=null)
|
|
|
|
+ wd70 = windTowerStatusData.getWdInst70();
|
|
|
|
+ // 80米风速
|
|
|
|
+ if (windTowerStatusData.getWdInst80()!=null)
|
|
|
|
+ ws80 = windTowerStatusData.getWsInst80();
|
|
|
|
+ // 80米风向
|
|
|
|
+ if (windTowerStatusData.getWdInst80()!=null)
|
|
|
|
+ wd80 = windTowerStatusData.getWdInst80();
|
|
|
|
+ // 90米风速
|
|
|
|
+ if (windTowerStatusData.getWdInst90()!=null)
|
|
|
|
+ ws90 = windTowerStatusData.getWsInst90();
|
|
|
|
+ // 90米风向
|
|
|
|
+ if (windTowerStatusData.getWdInst90()!=null)
|
|
|
|
+ wd90 = windTowerStatusData.getWdInst90();
|
|
|
|
+ // 100米风速
|
|
|
|
+ if (windTowerStatusData.getWdInst100()!=null)
|
|
|
|
+ ws100 = windTowerStatusData.getWsInst100();
|
|
|
|
+ // 100米风向
|
|
|
|
+ if (windTowerStatusData.getWdInst100()!=null)
|
|
|
|
+ wd100 = windTowerStatusData.getWdInst100();
|
|
|
|
+ if (windTowerStatusData.getWsInstHubHeight()!=null)
|
|
|
|
+ wsHubHeight = windTowerStatusData.getWsInstHubHeight();
|
|
|
|
+ if (windTowerStatusData.getWdInstHubHeight()!=null)
|
|
|
|
+ wdHubHeight = windTowerStatusData.getWdInstHubHeight();
|
|
|
|
+ // 湿度产生
|
|
|
|
+ if (windTowerStatusData.getRhInst()!=null)
|
|
|
|
+ rh8 = windTowerStatusData.getRhInst();
|
|
|
|
+ // 温度产生
|
|
|
|
+ if (windTowerStatusData.getTInst()!=null)
|
|
|
|
+ t8 = windTowerStatusData.getTInst();
|
|
|
|
+ // 气压产生
|
|
|
|
+ if (windTowerStatusData.getPaInst()!=null)
|
|
|
|
+ p8 = windTowerStatusData.getPaInst();
|
|
|
|
+ log.info(electricFieldInfo.getStationCode() + "生成测风塔数据用数据表");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// 创建上报文件
|
|
// 创建上报文件
|
|
@@ -803,8 +899,9 @@ public class E63UploadFileService extends BaseUploadFileService {
|
|
map.put("elName",electricFieldInfo.getName());
|
|
map.put("elName",electricFieldInfo.getName());
|
|
map.put("collectorCircuit",windTurbineInfo.getCollectorCircuit());
|
|
map.put("collectorCircuit",windTurbineInfo.getCollectorCircuit());
|
|
|
|
|
|
- String id = String.valueOf(windTurbineInfo.getId());
|
|
|
|
- Map<String, String> fjMap = redisUtils.hgetall("fj-" + electricFieldInfo.getStationCode() + "-" + id);
|
|
|
|
|
|
+ String fjId = String.valueOf(windTurbineInfo.getId());
|
|
|
|
+ String equipmentNo = String.valueOf(windTurbineInfo.getEquipmentNo());
|
|
|
|
+ Map<String, String> fjMap = redisUtils.hgetall("fj-" + electricFieldInfo.getStationCode() + "-" + fjId);
|
|
DecimalFormat df = new DecimalFormat("0.00");
|
|
DecimalFormat df = new DecimalFormat("0.00");
|
|
|
|
|
|
// 状态
|
|
// 状态
|
|
@@ -833,7 +930,7 @@ public class E63UploadFileService extends BaseUploadFileService {
|
|
BigDecimal pitchAngle = new BigDecimal("0");
|
|
BigDecimal pitchAngle = new BigDecimal("0");
|
|
// 累积发电量
|
|
// 累积发电量
|
|
BigDecimal cumulativeGeneratedEnergy = new BigDecimal("0");
|
|
BigDecimal cumulativeGeneratedEnergy = new BigDecimal("0");
|
|
-
|
|
|
|
|
|
+ boolean isUseRedis = false;
|
|
if (!fjMap.isEmpty()) {
|
|
if (!fjMap.isEmpty()) {
|
|
String time = fjMap.get("time");
|
|
String time = fjMap.get("time");
|
|
if (StrUtil.isNotBlank(time)) {
|
|
if (StrUtil.isNotBlank(time)) {
|
|
@@ -877,9 +974,62 @@ public class E63UploadFileService extends BaseUploadFileService {
|
|
if (fjMap.get("pitchAngle") != null) {
|
|
if (fjMap.get("pitchAngle") != null) {
|
|
pitchAngle = new BigDecimal(fjMap.get("pitchAngle"));
|
|
pitchAngle = new BigDecimal(fjMap.get("pitchAngle"));
|
|
}
|
|
}
|
|
|
|
+ isUseRedis = true;
|
|
|
|
+ log.info(electricFieldInfo.getStationCode() + "生成风机数据用缓存");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (!isUseRedis){
|
|
|
|
+ List<WindTurbineStatusData> windTurbineStatusDataList = windTurbineStatusDataRepository.findByTimeBetweenAndEquipmentNo(new Date(startTime), new Date(endTime),equipmentNo);
|
|
|
|
+ if (!windTurbineStatusDataList.isEmpty()){
|
|
|
|
+ windTurbineStatusDataList.stream().sorted(Comparator.comparing(WindTurbineStatusData::getTime).reversed()).collect(Collectors.toList());
|
|
|
|
+ WindTurbineStatusData windTurbineStatusData = windTurbineStatusDataList.get(0);
|
|
|
|
+ if (windTurbineStatusData.getStatus() != null) {
|
|
|
|
+ status = String.valueOf(windTurbineStatusData.getStatus());
|
|
|
|
+ }
|
|
|
|
+ if (windTurbineStatusData.getActivePower() != null) {
|
|
|
|
+ activePower = windTurbineStatusData.getActivePower();
|
|
|
|
+ }
|
|
|
|
+ if (windTurbineStatusData.getReactivePower() != null) {
|
|
|
|
+ reactivePower = windTurbineStatusData.getReactivePower();
|
|
|
|
+ }
|
|
|
|
+ if (windTurbineStatusData.getPowerFactor() != null) {
|
|
|
|
+ powerFactor = windTurbineStatusData.getPowerFactor();
|
|
|
|
+ }
|
|
|
|
+ if (windTurbineStatusData.getVoltage() != null) {
|
|
|
|
+ voltage = windTurbineStatusData.getVoltage();
|
|
|
|
+ }
|
|
|
|
+ if (windTurbineStatusData.getElectricalCurrent() != null) {
|
|
|
|
+ electricalCurrent = windTurbineStatusData.getElectricalCurrent();
|
|
|
|
+ }
|
|
|
|
+ if (windTurbineStatusData.getDayElectricQuantity() != null) {
|
|
|
|
+ dayElectricQuantity = windTurbineStatusData.getDayElectricQuantity();
|
|
|
|
+ }
|
|
|
|
+ if (windTurbineStatusData.getCumulativeGeneratedEnergy() != null) {
|
|
|
|
+ cumulativeGeneratedEnergy = windTurbineStatusData.getCumulativeGeneratedEnergy();
|
|
|
|
+ }
|
|
|
|
+ if (windTurbineStatusData.getWindWheelRatedSpeed() != null) {
|
|
|
|
+ windWheelRatedSpeed = windTurbineStatusData.getWindWheelRatedSpeed();
|
|
|
|
+ }
|
|
|
|
+ if (windTurbineStatusData.getWs() != null) {
|
|
|
|
+ ws = windTurbineStatusData.getWs();
|
|
}
|
|
}
|
|
|
|
+ if (windTurbineStatusData.getWd() != null) {
|
|
|
|
+ wd = windTurbineStatusData.getWd();
|
|
|
|
+ }
|
|
|
|
+ if (windTurbineStatusData.getT() != null) {
|
|
|
|
+ t = windTurbineStatusData.getT();
|
|
|
|
+ }
|
|
|
|
+ if (windTurbineStatusData.getPitchAngle() != null) {
|
|
|
|
+ pitchAngle = windTurbineStatusData.getPitchAngle();
|
|
|
|
+ }
|
|
|
|
+ log.info(electricFieldInfo.getStationCode() + "生成风机数据用数据表");
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ log.info(electricFieldInfo.getStationCode() + "生成风机数据缓存和数据表都没有值,使用默认0");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
map.put("ActivePower", div(activePower, new BigDecimal("1000"), 2).toString());
|
|
map.put("ActivePower", div(activePower, new BigDecimal("1000"), 2).toString());
|
|
map.put("ReActivePower", div(reactivePower, new BigDecimal("1000"), 2).toString());
|
|
map.put("ReActivePower", div(reactivePower, new BigDecimal("1000"), 2).toString());
|
|
map.put("RotationlSpeed", df.format(windWheelRatedSpeed));
|
|
map.put("RotationlSpeed", df.format(windWheelRatedSpeed));
|
|
@@ -943,8 +1093,9 @@ public class E63UploadFileService extends BaseUploadFileService {
|
|
map.put("sample", inverterInfo.getSample() ? "1" : "0");
|
|
map.put("sample", inverterInfo.getSample() ? "1" : "0");
|
|
//是否组串
|
|
//是否组串
|
|
map.put("IsString", inverterInfo.getGroupSeries() ? "1" : "0");
|
|
map.put("IsString", inverterInfo.getGroupSeries() ? "1" : "0");
|
|
- String id = String.valueOf(inverterInfo.getId());
|
|
|
|
- Map<String, String> nbqMap = redisUtils.hgetall("nbq-" + electricFieldInfo.getStationCode() + "-" + id);
|
|
|
|
|
|
+ String nbqId = String.valueOf(inverterInfo.getId());
|
|
|
|
+ String equipmentNo = String.valueOf(inverterInfo.getEquipmentNo());
|
|
|
|
+ Map<String, String> nbqMap = redisUtils.hgetall("nbq-" + electricFieldInfo.getStationCode() + "-" + nbqId);
|
|
DecimalFormat df = new DecimalFormat("0.00");
|
|
DecimalFormat df = new DecimalFormat("0.00");
|
|
// 状态
|
|
// 状态
|
|
String status = "1";
|
|
String status = "1";
|
|
@@ -962,6 +1113,7 @@ public class E63UploadFileService extends BaseUploadFileService {
|
|
BigDecimal dayElectricQuantity = new BigDecimal("0");
|
|
BigDecimal dayElectricQuantity = new BigDecimal("0");
|
|
// 累积发电量
|
|
// 累积发电量
|
|
BigDecimal cumulativeGeneratedEnergy = new BigDecimal("0");
|
|
BigDecimal cumulativeGeneratedEnergy = new BigDecimal("0");
|
|
|
|
+ boolean isUseRedis = false;
|
|
if (!nbqMap.isEmpty()) {
|
|
if (!nbqMap.isEmpty()) {
|
|
String time = nbqMap.get("time");
|
|
String time = nbqMap.get("time");
|
|
if (StrUtil.isNotBlank(time)) {
|
|
if (StrUtil.isNotBlank(time)) {
|
|
@@ -990,7 +1142,52 @@ public class E63UploadFileService extends BaseUploadFileService {
|
|
if (nbqMap.get("cumulativeGeneratedEnergy") != null) {
|
|
if (nbqMap.get("cumulativeGeneratedEnergy") != null) {
|
|
cumulativeGeneratedEnergy = new BigDecimal(nbqMap.get("cumulativeGeneratedEnergy"));
|
|
cumulativeGeneratedEnergy = new BigDecimal(nbqMap.get("cumulativeGeneratedEnergy"));
|
|
}
|
|
}
|
|
|
|
+ isUseRedis = true;
|
|
|
|
+ log.info(electricFieldInfo.getStationCode() + "生成逆变器数据用缓存");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!isUseRedis){
|
|
|
|
+ List<InverterStatusData> inverterStatusDataList = inverterStatusDataRepository.findByTimeBetweenAndEquipmentNo(new Date(startTime), new Date(endTime),equipmentNo);
|
|
|
|
+ if (!inverterStatusDataList.isEmpty()){
|
|
|
|
+ inverterStatusDataList.stream().sorted(Comparator.comparing(InverterStatusData::getTime).reversed()).collect(Collectors.toList());
|
|
|
|
+ InverterStatusData inverterStatusData = inverterStatusDataList.get(0);
|
|
|
|
+ if (inverterStatusData.getStatus() != null) {
|
|
|
|
+ status = String.valueOf(inverterStatusData.getStatus());
|
|
|
|
+ }
|
|
|
|
+ // 有功
|
|
|
|
+ if (inverterStatusData.getActivePower() != null) {
|
|
|
|
+ activePower = inverterStatusData.getActivePower();
|
|
|
|
+ }
|
|
|
|
+ // 无功
|
|
|
|
+ if (inverterStatusData.getReactivePower() != null) {
|
|
|
|
+ reactivePower = inverterStatusData.getReactivePower();
|
|
|
|
+ }
|
|
|
|
+ // 电压
|
|
|
|
+ if (inverterStatusData.getVoltage() != null) {
|
|
|
|
+ voltage = inverterStatusData.getVoltage();
|
|
}
|
|
}
|
|
|
|
+ // 电流
|
|
|
|
+ if (inverterStatusData.getElectricalCurrent() != null) {
|
|
|
|
+ electricalCurrent = inverterStatusData.getElectricalCurrent();
|
|
|
|
+ }
|
|
|
|
+ // 功率因数
|
|
|
|
+ if (inverterStatusData.getPowerFactor() != null) {
|
|
|
|
+ powerFactor = inverterStatusData.getPowerFactor();
|
|
|
|
+ }
|
|
|
|
+ // 日发电量
|
|
|
|
+ if (inverterStatusData.getDayElectricQuantity() != null) {
|
|
|
|
+ dayElectricQuantity = inverterStatusData.getDayElectricQuantity();
|
|
|
|
+ }
|
|
|
|
+ // 累计发电量
|
|
|
|
+ if (inverterStatusData.getCumulativeGeneratedEnergy() != null) {
|
|
|
|
+ cumulativeGeneratedEnergy = inverterStatusData.getCumulativeGeneratedEnergy();
|
|
|
|
+ }
|
|
|
|
+ log.info(electricFieldInfo.getStationCode() + "生成逆变器数据用数据表");
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ log.info(electricFieldInfo.getStationCode() + "生成逆变器数据缓存和数据表都没有值,使用默认0");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
map.put("status", status);
|
|
map.put("status", status);
|
|
@@ -1083,6 +1280,7 @@ public class E63UploadFileService extends BaseUploadFileService {
|
|
// 辐照仪变量
|
|
// 辐照仪变量
|
|
float theoryValueAfter = 0f;
|
|
float theoryValueAfter = 0f;
|
|
Map<String, String> powerMap = redisUtils.hgetall("power-" + electricFieldInfo.getStationCode());
|
|
Map<String, String> powerMap = redisUtils.hgetall("power-" + electricFieldInfo.getStationCode());
|
|
|
|
+ boolean isUseRedis = false;
|
|
if (!powerMap.isEmpty()) {
|
|
if (!powerMap.isEmpty()) {
|
|
String time = powerMap.get("time");
|
|
String time = powerMap.get("time");
|
|
if (StrUtil.isNotBlank(time)) {
|
|
if (StrUtil.isNotBlank(time)) {
|
|
@@ -1095,9 +1293,26 @@ public class E63UploadFileService extends BaseUploadFileService {
|
|
if (powerMap.get("theoryValue") != null) {
|
|
if (powerMap.get("theoryValue") != null) {
|
|
theoryValueAfter = Float.parseFloat(powerMap.get("theoryValue"));
|
|
theoryValueAfter = Float.parseFloat(powerMap.get("theoryValue"));
|
|
}
|
|
}
|
|
|
|
+ isUseRedis = true;
|
|
|
|
+ log.info(electricFieldInfo.getStationCode() + "生成理论功率使用缓存");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if (!isUseRedis){
|
|
|
|
+ // 从数据表获取
|
|
|
|
+ List<PowerStationStatusData> powerStationStatusDataList = powerStationStatusDataRepository.findByTimeBetweenAndStationCode(new Date(startTime), new Date(endTime),electricFieldInfo.getStationCode());
|
|
|
|
+ if (!powerStationStatusDataList.isEmpty()) {
|
|
|
|
+ powerStationStatusDataList.stream().sorted(Comparator.comparing(PowerStationStatusData::getTime).reversed()).collect(Collectors.toList());
|
|
|
|
+ PowerStationStatusData powerStationStatusData = powerStationStatusDataList.get(0);
|
|
|
|
+ if (powerStationStatusData.getAbleValue()!=null)
|
|
|
|
+ ableValueAfter = powerStationStatusData.getAbleValue().floatValue();
|
|
|
|
+ if (powerStationStatusData.getTheoryValue()!=null)
|
|
|
|
+ theoryValueAfter = powerStationStatusData.getTheoryValue().floatValue();
|
|
|
|
+ log.info(electricFieldInfo.getStationCode() + "生成理论功率使用数据表");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
DecimalFormat df = new DecimalFormat("0.00");
|
|
DecimalFormat df = new DecimalFormat("0.00");
|
|
// 创建上报文件
|
|
// 创建上报文件
|
|
File file = super.createTempFile(fileName);
|
|
File file = super.createTempFile(fileName);
|
|
@@ -1122,8 +1337,6 @@ public class E63UploadFileService extends BaseUploadFileService {
|
|
* 生成理论功率风上报文件
|
|
* 生成理论功率风上报文件
|
|
*/
|
|
*/
|
|
private void generateWpTheroyFile(String fileName, Template template, ElectricField electricFieldInfo, Date date, Long startTime, Long endTime) {
|
|
private void generateWpTheroyFile(String fileName, Template template, ElectricField electricFieldInfo, Date date, Long startTime, Long endTime) {
|
|
- // powerStationStatusDataList需要从缓存获取
|
|
|
|
- List<PowerStationStatusData> powerStationStatusDataList = new ArrayList<>();
|
|
|
|
// 可用
|
|
// 可用
|
|
float ableValueAfter = 0f;
|
|
float ableValueAfter = 0f;
|
|
// 理论
|
|
// 理论
|
|
@@ -1133,6 +1346,7 @@ public class E63UploadFileService extends BaseUploadFileService {
|
|
//测风
|
|
//测风
|
|
float referencePowerByMeasuringAfter = 0f;
|
|
float referencePowerByMeasuringAfter = 0f;
|
|
Map<String, String> powerMap = redisUtils.hgetall("power-" + electricFieldInfo.getStationCode());
|
|
Map<String, String> powerMap = redisUtils.hgetall("power-" + electricFieldInfo.getStationCode());
|
|
|
|
+ boolean isUseRedis = false;
|
|
if (!powerMap.isEmpty()) {
|
|
if (!powerMap.isEmpty()) {
|
|
String time = powerMap.get("time");
|
|
String time = powerMap.get("time");
|
|
if (StrUtil.isNotBlank(time)) {
|
|
if (StrUtil.isNotBlank(time)) {
|
|
@@ -1149,9 +1363,29 @@ public class E63UploadFileService extends BaseUploadFileService {
|
|
if (powerMap.get("referencePowerByMeasuring") != null) {
|
|
if (powerMap.get("referencePowerByMeasuring") != null) {
|
|
referencePowerByMeasuringAfter = Float.parseFloat(powerMap.get("referencePowerByMeasuring"));
|
|
referencePowerByMeasuringAfter = Float.parseFloat(powerMap.get("referencePowerByMeasuring"));
|
|
}
|
|
}
|
|
|
|
+ isUseRedis = true;
|
|
|
|
+ log.info(electricFieldInfo.getStationCode() + "生成理论功率使用缓存");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if (!isUseRedis){
|
|
|
|
+ // 从数据表获取
|
|
|
|
+ List<PowerStationStatusData> powerStationStatusDataList = powerStationStatusDataRepository.findByTimeBetweenAndStationCode(new Date(startTime), new Date(endTime),electricFieldInfo.getStationCode());
|
|
|
|
+ if (!powerStationStatusDataList.isEmpty()) {
|
|
|
|
+ powerStationStatusDataList.stream().sorted(Comparator.comparing(PowerStationStatusData::getTime).reversed()).collect(Collectors.toList());
|
|
|
|
+ PowerStationStatusData powerStationStatusData = powerStationStatusDataList.get(0);
|
|
|
|
+ if (powerStationStatusData.getAbleValue()!=null)
|
|
|
|
+ ableValueAfter = powerStationStatusData.getAbleValue().floatValue();
|
|
|
|
+ if (powerStationStatusData.getTheoryValue()!=null)
|
|
|
|
+ theoryValueAfter = powerStationStatusData.getTheoryValue().floatValue();
|
|
|
|
+ if (powerStationStatusData.getReferencePowerBySample()!=null)
|
|
|
|
+ referencePowerBySampleAfter = powerStationStatusData.getReferencePowerBySample().floatValue();
|
|
|
|
+ if (powerStationStatusData.getReferencePowerByMeasuring()!=null)
|
|
|
|
+ referencePowerByMeasuringAfter = powerStationStatusData.getReferencePowerByMeasuring().floatValue();
|
|
|
|
+ log.info(electricFieldInfo.getStationCode() + "生成理论功率使用数据表");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
DecimalFormat df = new DecimalFormat("0.00");
|
|
DecimalFormat df = new DecimalFormat("0.00");
|
|
// 创建上报文件
|
|
// 创建上报文件
|
|
File file = super.createTempFile(fileName);
|
|
File file = super.createTempFile(fileName);
|