|
@@ -1,12 +1,11 @@
|
|
|
package com.jiayue.ipfcst.fileupload.service;
|
|
|
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import com.jiayue.ipfcst.common.core.exception.BusinessException;
|
|
|
import com.jiayue.ipfcst.common.core.util.DateMomentUtil;
|
|
|
import com.jiayue.ipfcst.common.data.constant.enums.FileTypeEnum;
|
|
|
import com.jiayue.ipfcst.common.data.entity.*;
|
|
|
-import com.jiayue.ipfcst.common.data.repository.WeatherStationInfoRepository;
|
|
|
-import com.jiayue.ipfcst.common.data.repository.WeatherStationStatusDataRepository;
|
|
|
-import com.jiayue.ipfcst.common.data.repository.WindTurbineInfoRepository;
|
|
|
+import com.jiayue.ipfcst.common.data.repository.*;
|
|
|
import com.jiayue.ipfcst.common.data.service.uploadfilerule.E63UploadFileRuleService;
|
|
|
import com.jiayue.ipfcst.console.service.ForecastPowerShortTermService;
|
|
|
import com.jiayue.ipfcst.console.service.ForecastPowerUltraShortTermService;
|
|
@@ -54,10 +53,16 @@ public class E63UploadFileService extends BaseUploadFileService {
|
|
|
|
|
|
private final WeatherStationStatusDataRepository weatherStationStatusDataRepository;
|
|
|
|
|
|
+ private final WindTowerInfoRepository windTowerInfoRepository;
|
|
|
+
|
|
|
+ private final WindTowerStatusDataRepository windTowerStatusDataRepository;
|
|
|
+
|
|
|
+ private final NwpRepository nwpRepository;
|
|
|
+
|
|
|
@Autowired
|
|
|
private RedisUtils redisUtils;
|
|
|
|
|
|
- public E63UploadFileService(VelocityEngine velocityEngine, ForecastPowerShortTermService forecastPowerShortTermService, ForecastPowerUltraShortTermService forecastPowerUltraShortTermService, E63UploadFileRuleService e63UploadFileRuleService, WeatherStationInfoRepository weatherStationInfoRepository, WindTurbineInfoRepository windTurbineInfoRepository, WeatherStationStatusDataRepository weatherStationStatusDataRepository) {
|
|
|
+ public E63UploadFileService(VelocityEngine velocityEngine, ForecastPowerShortTermService forecastPowerShortTermService, ForecastPowerUltraShortTermService forecastPowerUltraShortTermService, E63UploadFileRuleService e63UploadFileRuleService, WeatherStationInfoRepository weatherStationInfoRepository, WindTurbineInfoRepository windTurbineInfoRepository, WeatherStationStatusDataRepository weatherStationStatusDataRepository, WindTowerInfoRepository windTowerInfoRepository, WindTowerStatusDataRepository windTowerStatusDataRepository, NwpRepository nwpRepository) {
|
|
|
this.velocityEngine = velocityEngine;
|
|
|
this.forecastPowerShortTermService = forecastPowerShortTermService;
|
|
|
this.forecastPowerUltraShortTermService = forecastPowerUltraShortTermService;
|
|
@@ -65,6 +70,9 @@ public class E63UploadFileService extends BaseUploadFileService {
|
|
|
this.weatherStationInfoRepository = weatherStationInfoRepository;
|
|
|
this.windTurbineInfoRepository = windTurbineInfoRepository;
|
|
|
this.weatherStationStatusDataRepository = weatherStationStatusDataRepository;
|
|
|
+ this.windTowerInfoRepository = windTowerInfoRepository;
|
|
|
+ this.windTowerStatusDataRepository = windTowerStatusDataRepository;
|
|
|
+ this.nwpRepository = nwpRepository;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -403,21 +411,21 @@ public class E63UploadFileService extends BaseUploadFileService {
|
|
|
if (date != null) {
|
|
|
systemDate = date;
|
|
|
}
|
|
|
- Long startTime = DateMomentUtil.getMomentTime(systemDate.getTime() - 5 * 60 * 1000, 1, 5 * 60 * 1000L);
|
|
|
- Long endTime = startTime + 5 * 60 * 1000 - 1000;
|
|
|
+ Long endTime = DateMomentUtil.getMomentTime(systemDate.getTime(), 1, 5 * 60 * 1000L);
|
|
|
+ Long startTime = endTime - 4 * 60 * 1000;
|
|
|
// 生成上报文件名格式
|
|
|
Template template = null;
|
|
|
VelocityContext velocityContext = new VelocityContext();
|
|
|
if (electricFieldInfo.getElectricFieldTypeEnum().toString().equals("E1")) {
|
|
|
// 获取气象站模板
|
|
|
template = this.velocityEngine.getTemplate(this.vmsPath + "/QXZ.vm");
|
|
|
- fileName = e63UploadFileRuleService.getFileNameRule(electricFieldInfo, "E6", endTime + 1000);
|
|
|
+ fileName = e63UploadFileRuleService.getFileNameRule(electricFieldInfo, "E6", endTime);
|
|
|
if (getFileName(fileName, "E6", stationCode)) {
|
|
|
generateQxzFile(fileName, template, electricFieldInfo, date, startTime, endTime);
|
|
|
}
|
|
|
} else {
|
|
|
template = this.velocityEngine.getTemplate(this.vmsPath + "/CFT.vm");
|
|
|
- fileName = e63UploadFileRuleService.getFileNameRule(electricFieldInfo, "E7", endTime + 1000);
|
|
|
+ fileName = e63UploadFileRuleService.getFileNameRule(electricFieldInfo, "E7", endTime);
|
|
|
if (getFileName(fileName, "E7", stationCode)) {
|
|
|
generateCftFile(fileName, template, electricFieldInfo, date, startTime, endTime);
|
|
|
}
|
|
@@ -429,16 +437,16 @@ public class E63UploadFileService extends BaseUploadFileService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 生成测风塔上报文件
|
|
|
+ * 生成气象站上报文件
|
|
|
*/
|
|
|
private void generateQxzFile(String fileName, Template template, ElectricField electricFieldInfo, Date date, Long startTime, Long endTime) throws Exception {
|
|
|
// 获取气象站信息
|
|
|
List<WeatherStationInfo> weatherStationInfoList = weatherStationInfoRepository.findAll();
|
|
|
- // 将测风塔信息过滤出上报的塔
|
|
|
+ // 将气象站信息过滤出上报
|
|
|
List<WeatherStationInfo> weatherStationInfos = weatherStationInfoList.stream().filter(w -> w.getReport() == true).collect(Collectors.toList());
|
|
|
if (!weatherStationInfos.isEmpty()) {
|
|
|
String uploadWeatherStationNo = weatherStationInfos.get(0).getEquipmentNo();
|
|
|
- Map<String,String> qxzMap = redisUtils.hgetall("qxz-"+electricFieldInfo.getStationCode()+"-"+uploadWeatherStationNo);
|
|
|
+ Map<String, String> qxzMap = redisUtils.hgetall("qxz-" + electricFieldInfo.getStationCode() + "-" + uploadWeatherStationNo);
|
|
|
// 数据格式化
|
|
|
DecimalFormat df = new DecimalFormat("0.00");
|
|
|
BigDecimal globalR = new BigDecimal(0);
|
|
@@ -450,55 +458,48 @@ public class E63UploadFileService extends BaseUploadFileService {
|
|
|
BigDecimal p = new BigDecimal(0);
|
|
|
BigDecimal rh = new BigDecimal(0);
|
|
|
BigDecimal cellT = new BigDecimal(0);
|
|
|
- if (qxzMap.isEmpty()){
|
|
|
- // 缓存是空的,再查询数据表中,时间段里是否有数据
|
|
|
- List<WeatherStationStatusData> weatherStationStatusDataList = weatherStationStatusDataRepository.findByTimeBetweenAndEquipmentNo(new Date(startTime),new Date(endTime),uploadWeatherStationNo);
|
|
|
- if (weatherStationStatusDataList.isEmpty()){
|
|
|
- // 总辐射产生500-1000随机数
|
|
|
- globalR = new BigDecimal(df.format(Math.random() * 500 + 500));
|
|
|
- // 直辐射产生400-500随机数
|
|
|
- directR = new BigDecimal(df.format(Math.random() * 100 + 400));
|
|
|
- // 散辐射 = 总 - 直
|
|
|
- diffuseR = globalR.subtract(directR);
|
|
|
- airT = new BigDecimal(df.format(Math.random() * 4 + 8));
|
|
|
- p = new BigDecimal(df.format(Math.random() * 200 + 800));
|
|
|
- rh = new BigDecimal(df.format(Math.random() * 10 + 30));
|
|
|
- cellT = new BigDecimal(df.format(Math.random() * 26 + 4));
|
|
|
- ws = new BigDecimal(df.format(Math.random() * 9 + 1));
|
|
|
- wd = new BigDecimal(df.format(Math.random() * 100 + 200));
|
|
|
- }
|
|
|
- else{
|
|
|
- // 从数据表里赋值
|
|
|
- weatherStationStatusDataList.sort(Comparator.comparing(WeatherStationStatusData::getTime).reversed());
|
|
|
- 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();
|
|
|
+
|
|
|
+ boolean isRedisData = false;
|
|
|
+ if (!qxzMap.isEmpty()) {
|
|
|
+ String time = qxzMap.get("time");
|
|
|
+ if (StrUtil.isNotBlank(time)) {
|
|
|
+ if (Long.parseLong(time) >= startTime && Long.parseLong(time) <= endTime) {
|
|
|
+ isRedisData = true;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- else{
|
|
|
+
|
|
|
+ if (isRedisData) {
|
|
|
// 从缓存里赋值
|
|
|
- globalR = new BigDecimal(qxzMap.get("globalR"));
|
|
|
- directR = new BigDecimal(qxzMap.get("directR"));
|
|
|
- diffuseR = new BigDecimal(qxzMap.get("diffuseR"));
|
|
|
- airT = new BigDecimal(qxzMap.get("airT"));
|
|
|
- p = new BigDecimal(qxzMap.get("p"));
|
|
|
- rh = new BigDecimal(qxzMap.get("rh"));
|
|
|
- cellT = new BigDecimal(qxzMap.get("cellT"));
|
|
|
- ws = new BigDecimal(qxzMap.get("ws"));
|
|
|
- wd = new BigDecimal(qxzMap.get("wd"));
|
|
|
+ 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() + "生成气象站数据用随机数");
|
|
|
}
|
|
|
// 创建上报文件
|
|
|
File file = super.createTempFile(fileName);
|
|
|
//青海要求 直=总-散;但是当散辐射大于总辐射时直辐射为负数不符合该规则。所以比较总直散三个值,用最大的当总辐射去减去
|
|
|
- log.info("qxz 实际值 总GlobalR:" + globalR + " 直DirectR:" + directR + " 散DiffuseR:" + diffuseR);
|
|
|
+ log.info(electricFieldInfo.getStationCode() + "qxz实际值 总GlobalR:" + globalR + " 直DirectR:" + directR + " 散DiffuseR:" + diffuseR);
|
|
|
if (globalR.compareTo(diffuseR) == -1) {
|
|
|
//当散辐射大于总辐射时,数值互换
|
|
|
BigDecimal a = globalR;
|
|
@@ -522,9 +523,9 @@ public class E63UploadFileService extends BaseUploadFileService {
|
|
|
// 场站装机容量
|
|
|
velocityContext.put("capacity", electricFieldInfo.getCapacity());
|
|
|
// 系统当前日期
|
|
|
- velocityContext.put("currentTime", DateFormatUtils.format(endTime + 1000, "yyyy-MM-dd_HH:mm") + ":00");
|
|
|
+ velocityContext.put("currentTime", DateFormatUtils.format(endTime, "yyyy-MM-dd_HH:mm") + ":00");
|
|
|
// 上报数据开始日期
|
|
|
- velocityContext.put("uploadTime", DateFormatUtils.format(endTime + 1000, "yyyy-MM-dd_HH:mm"));
|
|
|
+ velocityContext.put("uploadTime", DateFormatUtils.format(endTime, "yyyy-MM-dd_HH:mm"));
|
|
|
StringWriter writer = new StringWriter();
|
|
|
template.merge(velocityContext, writer);
|
|
|
super.copyUploadFile(writer, file, FileTypeEnum.E6.name(), null, date, electricFieldInfo.getStationCode());
|
|
@@ -535,156 +536,204 @@ public class E63UploadFileService extends BaseUploadFileService {
|
|
|
* 生成测风塔上报文件
|
|
|
*/
|
|
|
private void generateCftFile(String fileName, Template template, ElectricField electricFieldInfo, Date date, Long startTime, Long endTime) throws Exception {
|
|
|
- WindTowerStatusData windTowerStatusData = null;
|
|
|
- // 数据格式化
|
|
|
- DecimalFormat df = new DecimalFormat("0.00");
|
|
|
- BigDecimal ws10 = new BigDecimal(0);
|
|
|
- BigDecimal wd10 = new BigDecimal(0);
|
|
|
- BigDecimal ws30 = new BigDecimal(0);
|
|
|
- BigDecimal wd30 = new BigDecimal(0);
|
|
|
- BigDecimal ws50 = new BigDecimal(0);
|
|
|
- BigDecimal wd50 = new BigDecimal(0);
|
|
|
- BigDecimal ws60 = new BigDecimal(0);
|
|
|
- BigDecimal wd60 = new BigDecimal(0);
|
|
|
- BigDecimal ws70 = new BigDecimal(0);
|
|
|
- BigDecimal wd70 = new BigDecimal(0);
|
|
|
- BigDecimal ws80 = new BigDecimal(0);
|
|
|
- BigDecimal wd80 = new BigDecimal(0);
|
|
|
- BigDecimal ws90 = new BigDecimal(0);
|
|
|
- BigDecimal wd90 = new BigDecimal(0);
|
|
|
- BigDecimal ws100 = new BigDecimal(0);
|
|
|
- BigDecimal wd100 = new BigDecimal(0);
|
|
|
- BigDecimal wsHubHeight = new BigDecimal(0);
|
|
|
- BigDecimal wdHubHeight = new BigDecimal(0);
|
|
|
- BigDecimal t8 = new BigDecimal(0);
|
|
|
- BigDecimal p8 = new BigDecimal(0);
|
|
|
- BigDecimal rh8 = new BigDecimal(0);
|
|
|
-
|
|
|
- if (windTowerStatusData == null) {
|
|
|
- // 10米风速产生1-5随机数
|
|
|
- BigDecimal ws10RandomValue = new BigDecimal(df.format(Math.random() * 4 + 1));
|
|
|
- ws10 = ws10.add(ws10RandomValue).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
- // 10米风向产生40-60随机数
|
|
|
- BigDecimal wd10RandomValue = new BigDecimal(df.format(Math.random() * 20 + 40));
|
|
|
- wd10 = wd10.add(wd10RandomValue).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
- // 30米风速产生6-10随机数
|
|
|
- BigDecimal ws30RandomValue = new BigDecimal(df.format(Math.random() * 4 + 6));
|
|
|
- ws30 = ws30.add(ws30RandomValue).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
- // 30米风向产生70-90随机数
|
|
|
- BigDecimal wd30RandomValue = new BigDecimal(df.format(Math.random() * 20 + 70));
|
|
|
- wd30 = wd30.add(wd30RandomValue).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
- // 50米风速产生16-20随机数
|
|
|
- BigDecimal ws50RandomValue = new BigDecimal(df.format(Math.random() * 4 + 16));
|
|
|
- ws50 = ws50.add(ws50RandomValue).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
- // 50米风向产生130-150随机数
|
|
|
- BigDecimal wd50RandomValue = new BigDecimal(df.format(Math.random() * 20 + 130));
|
|
|
- wd50 = wd50.add(wd50RandomValue).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
- // 70米风速产生31-35随机数
|
|
|
- BigDecimal ws70RandomValue = new BigDecimal(df.format(Math.random() * 4 + 31));
|
|
|
- ws70 = ws70.add(ws70RandomValue).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
- // 70米风向产生220-240随机数
|
|
|
- BigDecimal wd70RandomValue = new BigDecimal(df.format(Math.random() * 20 + 220));
|
|
|
- wd70 = wd70.add(wd70RandomValue).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
-
|
|
|
- // 80米风速产生35-40随机数
|
|
|
- BigDecimal ws80RandomValue = new BigDecimal(df.format(Math.random() * 5 + 35));
|
|
|
- ws80 = ws80.add(ws80RandomValue).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
- // 80米风向产生240-250随机数
|
|
|
- BigDecimal wd80RandomValue = new BigDecimal(df.format(Math.random() * 10 + 240));
|
|
|
- wd80 = wd80.add(wd80RandomValue).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
-
|
|
|
- // 90米风速产生45-50随机数
|
|
|
- BigDecimal ws90RandomValue = new BigDecimal(df.format(Math.random() * 5 + 45));
|
|
|
- ws90 = ws90.add(ws90RandomValue).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
- // 90米风向产生260-270随机数
|
|
|
- BigDecimal wd90RandomValue = new BigDecimal(df.format(Math.random() * 10 + 260));
|
|
|
- wd90 = wd90.add(wd90RandomValue).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
-
|
|
|
- // 100米风速产生60-70随机数
|
|
|
- BigDecimal ws100RandomValue = new BigDecimal(df.format(Math.random() * 10 + 60));
|
|
|
- ws100 = ws100.add(ws100RandomValue).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
- // 100米风向产生280-290随机数
|
|
|
- BigDecimal wd100RandomValue = new BigDecimal(df.format(Math.random() * 10 + 280));
|
|
|
- wd100 = wd100.add(wd100RandomValue).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
-
|
|
|
- BigDecimal wsRandomValue = new BigDecimal(df.format(Math.random() * 4 + 70));
|
|
|
- wsHubHeight = wsHubHeight.add(wsRandomValue).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
- BigDecimal wdRandomValue = new BigDecimal(df.format(Math.random() * 20 + 250));
|
|
|
- wdHubHeight = wdHubHeight.add(wdRandomValue).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
- // 湿度产生50-60随机数
|
|
|
- BigDecimal rhRandomValue = new BigDecimal(df.format(Math.random() * 10 + 50));
|
|
|
- rh8 = rh8.add(rhRandomValue).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
- // 温度产生20-35随机数
|
|
|
- BigDecimal tRandomValue = new BigDecimal(df.format(Math.random() * 15 + 20));
|
|
|
- t8 = t8.add(rhRandomValue).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
- // 气压产生75-90随机数
|
|
|
- BigDecimal paRandomValue = new BigDecimal(df.format(Math.random() * 15 + 75));
|
|
|
- p8 = p8.add(paRandomValue).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
- } else {
|
|
|
-
|
|
|
- ws10 = windTowerStatusData.getWsInst10().compareTo(new BigDecimal(-99)) == 0 ? new BigDecimal(0) : windTowerStatusData.getWsInst10();
|
|
|
- wd10 = windTowerStatusData.getWdInst10().compareTo(new BigDecimal(-99)) == 0 ? new BigDecimal(0) : windTowerStatusData.getWdInst10();
|
|
|
- ws30 = windTowerStatusData.getWsInst30().compareTo(new BigDecimal(-99)) == 0 ? new BigDecimal(0) : windTowerStatusData.getWsInst30();
|
|
|
- wd30 = windTowerStatusData.getWdInst30().compareTo(new BigDecimal(-99)) == 0 ? new BigDecimal(0) : windTowerStatusData.getWdInst30();
|
|
|
- ws50 = windTowerStatusData.getWsInst50().compareTo(new BigDecimal(-99)) == 0 ? new BigDecimal(0) : windTowerStatusData.getWsInst50();
|
|
|
- wd50 = windTowerStatusData.getWdInst50().compareTo(new BigDecimal(-99)) == 0 ? new BigDecimal(0) : windTowerStatusData.getWdInst50();
|
|
|
- ws70 = windTowerStatusData.getWsInst70().compareTo(new BigDecimal(-99)) == 0 ? new BigDecimal(0) : windTowerStatusData.getWsInst70();
|
|
|
- wd70 = windTowerStatusData.getWdInst70().compareTo(new BigDecimal(-99)) == 0 ? new BigDecimal(0) : windTowerStatusData.getWdInst70();
|
|
|
- ws80 = windTowerStatusData.getWsInst80().compareTo(new BigDecimal(-99)) == 0 ? new BigDecimal(0) : windTowerStatusData.getWsInst80();
|
|
|
- wd80 = windTowerStatusData.getWdInst80().compareTo(new BigDecimal(-99)) == 0 ? new BigDecimal(0) : windTowerStatusData.getWdInst80();
|
|
|
- ws90 = windTowerStatusData.getWsInst90().compareTo(new BigDecimal(-99)) == 0 ? new BigDecimal(0) : windTowerStatusData.getWsInst90();
|
|
|
- wd90 = windTowerStatusData.getWdInst90().compareTo(new BigDecimal(-99)) == 0 ? new BigDecimal(0) : windTowerStatusData.getWdInst90();
|
|
|
- ws100 = windTowerStatusData.getWsInst100().compareTo(new BigDecimal(-99)) == 0 ? new BigDecimal(0) : windTowerStatusData.getWsInst100();
|
|
|
- wd100 = windTowerStatusData.getWdInst100().compareTo(new BigDecimal(-99)) == 0 ? new BigDecimal(0) : windTowerStatusData.getWdInst100();
|
|
|
- wsHubHeight = windTowerStatusData.getWsInstHubHeight().compareTo(new BigDecimal(-99)) == 0 ? new BigDecimal(0) : windTowerStatusData.getWsInstHubHeight();
|
|
|
- wdHubHeight = windTowerStatusData.getWdInstHubHeight().compareTo(new BigDecimal(-99)) == 0 ? new BigDecimal(0) : windTowerStatusData.getWdInstHubHeight();
|
|
|
- p8 = windTowerStatusData.getPaInst().compareTo(new BigDecimal(-99)) == 0 ? new BigDecimal(0) : windTowerStatusData.getPaInst();
|
|
|
- rh8 = windTowerStatusData.getRhInst().compareTo(new BigDecimal(-99)) == 0 ? new BigDecimal(0) : windTowerStatusData.getRhInst();
|
|
|
- t8 = windTowerStatusData.getTInst().compareTo(new BigDecimal(-99)) == 0 ? new BigDecimal(0) : windTowerStatusData.getTInst();
|
|
|
- }
|
|
|
- // 创建上报文件
|
|
|
- File file = super.createTempFile(fileName);
|
|
|
- // 根据模板生成文件内容
|
|
|
- VelocityContext velocityContext = new VelocityContext();
|
|
|
- velocityContext.put("WS_10", df.format(ws10));
|
|
|
- velocityContext.put("WD_10", df.format(wd10));
|
|
|
-
|
|
|
- velocityContext.put("WS_30", df.format(ws30));
|
|
|
- velocityContext.put("WD_30", df.format(wd30));
|
|
|
-
|
|
|
- velocityContext.put("WS_50", df.format(ws50));
|
|
|
- velocityContext.put("WD_50", df.format(wd50));
|
|
|
-
|
|
|
- velocityContext.put("WS_60", df.format(ws60));
|
|
|
- velocityContext.put("WD_60", df.format(wd60));
|
|
|
-
|
|
|
- velocityContext.put("WS_70", df.format(ws70));
|
|
|
- velocityContext.put("WD_70", df.format(wd70));
|
|
|
-
|
|
|
- velocityContext.put("WS_80", df.format(ws80));
|
|
|
- velocityContext.put("WD_80", df.format(wd80));
|
|
|
-
|
|
|
- velocityContext.put("WS_90", df.format(ws90));
|
|
|
- velocityContext.put("WD_90", df.format(wd90));
|
|
|
-
|
|
|
- velocityContext.put("WS_100", df.format(ws100));
|
|
|
- velocityContext.put("WD_100", df.format(wd100));
|
|
|
+ // 获取测风塔信息
|
|
|
+ List<WindTowerInfo> windTowerInfoList = windTowerInfoRepository.findAll();
|
|
|
+ // 将测风塔信息过滤出上报的塔
|
|
|
+ List<WindTowerInfo> filterWindTowerInfoList = windTowerInfoList.stream().filter(w -> w.getReport() == true).collect(Collectors.toList());
|
|
|
+ if (!filterWindTowerInfoList.isEmpty()) {
|
|
|
+ String uploadWindtowerStationNo = filterWindTowerInfoList.get(0).getEquipmentNo();
|
|
|
+ Map<String, String> cftMap = redisUtils.hgetall("cft-" + electricFieldInfo.getStationCode() + "-" + uploadWindtowerStationNo);
|
|
|
+ // 数据格式化
|
|
|
+ DecimalFormat df = new DecimalFormat("0.00");
|
|
|
+ BigDecimal ws10 = new BigDecimal(0);
|
|
|
+ BigDecimal wd10 = new BigDecimal(0);
|
|
|
+ BigDecimal ws30 = new BigDecimal(0);
|
|
|
+ BigDecimal wd30 = new BigDecimal(0);
|
|
|
+ BigDecimal ws50 = new BigDecimal(0);
|
|
|
+ BigDecimal wd50 = new BigDecimal(0);
|
|
|
+ BigDecimal ws60 = new BigDecimal(0);
|
|
|
+ BigDecimal wd60 = new BigDecimal(0);
|
|
|
+ BigDecimal ws70 = new BigDecimal(0);
|
|
|
+ BigDecimal wd70 = new BigDecimal(0);
|
|
|
+ BigDecimal ws80 = new BigDecimal(0);
|
|
|
+ BigDecimal wd80 = new BigDecimal(0);
|
|
|
+ BigDecimal ws90 = new BigDecimal(0);
|
|
|
+ BigDecimal wd90 = new BigDecimal(0);
|
|
|
+ BigDecimal ws100 = new BigDecimal(0);
|
|
|
+ BigDecimal wd100 = new BigDecimal(0);
|
|
|
+ BigDecimal wsHubHeight = new BigDecimal(0);
|
|
|
+ BigDecimal wdHubHeight = new BigDecimal(0);
|
|
|
+ BigDecimal t8 = new BigDecimal(0);
|
|
|
+ BigDecimal p8 = new BigDecimal(0);
|
|
|
+ BigDecimal rh8 = new BigDecimal(0);
|
|
|
|
|
|
- velocityContext.put("WS_HubHeight", df.format(wsHubHeight));
|
|
|
- velocityContext.put("WD_HubHeight", df.format(wdHubHeight));
|
|
|
+ boolean isRedisData = false;
|
|
|
+ if (!cftMap.isEmpty()) {
|
|
|
+ String time = cftMap.get("time");
|
|
|
+ if (StrUtil.isNotBlank(time)) {
|
|
|
+ if (Long.parseLong(time) >= startTime && Long.parseLong(time) <= endTime) {
|
|
|
+ isRedisData = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ 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(date.getTime(), 1, 15 * 60 * 1000L);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("获取nwp时刻步长错误", e);
|
|
|
+ nwpTime = DateMomentUtil.getDayStartTime(date.getTime());
|
|
|
+ }
|
|
|
+ List<Nwp> nwpList = nwpRepository.findByPreTimeBetween(nwpTime, nwpTime);
|
|
|
|
|
|
- velocityContext.put("T_8", df.format(t8));
|
|
|
- velocityContext.put("P_8", df.format(p8));
|
|
|
- velocityContext.put("RH_8", df.format(rh8));
|
|
|
- // 场站标识
|
|
|
- velocityContext.put("sign", electricFieldInfo.getSign());
|
|
|
- // 系统当前日期
|
|
|
- velocityContext.put("currentTime", DateFormatUtils.format(endTime + 1000, "yyyy-MM-dd_HH:mm") + ":00");
|
|
|
- // 上报数据开始日期
|
|
|
- velocityContext.put("uploadTime", DateFormatUtils.format(endTime + 1000, "yyyy-MM-dd_HH:mm"));
|
|
|
- StringWriter writer = new StringWriter();
|
|
|
- template.merge(velocityContext, writer);
|
|
|
- super.copyUploadFile(writer, file, FileTypeEnum.E7.name(), null, date, electricFieldInfo.getStationCode());
|
|
|
+ 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() + "生成测风塔数据用随机数");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 创建上报文件
|
|
|
+ File file = super.createTempFile(fileName);
|
|
|
+ // 根据模板生成文件内容
|
|
|
+ VelocityContext velocityContext = new VelocityContext();
|
|
|
+ velocityContext.put("WS_10", df.format(ws10));
|
|
|
+ velocityContext.put("WD_10", df.format(wd10));
|
|
|
+ velocityContext.put("WS_30", df.format(ws30));
|
|
|
+ velocityContext.put("WD_30", df.format(wd30));
|
|
|
+ velocityContext.put("WS_50", df.format(ws50));
|
|
|
+ velocityContext.put("WD_50", df.format(wd50));
|
|
|
+ velocityContext.put("WS_60", df.format(ws60));
|
|
|
+ velocityContext.put("WD_60", df.format(wd60));
|
|
|
+ velocityContext.put("WS_70", df.format(ws70));
|
|
|
+ velocityContext.put("WD_70", df.format(wd70));
|
|
|
+ velocityContext.put("WS_80", df.format(ws80));
|
|
|
+ velocityContext.put("WD_80", df.format(wd80));
|
|
|
+ velocityContext.put("WS_90", df.format(ws90));
|
|
|
+ velocityContext.put("WD_90", df.format(wd90));
|
|
|
+ velocityContext.put("WS_100", df.format(ws100));
|
|
|
+ velocityContext.put("WD_100", df.format(wd100));
|
|
|
+ velocityContext.put("WS_HubHeight", df.format(wsHubHeight));
|
|
|
+ velocityContext.put("WD_HubHeight", df.format(wdHubHeight));
|
|
|
+ velocityContext.put("T_8", df.format(t8));
|
|
|
+ velocityContext.put("P_8", df.format(p8));
|
|
|
+ velocityContext.put("RH_8", df.format(rh8));
|
|
|
+ // 场站标识
|
|
|
+ velocityContext.put("sign", electricFieldInfo.getSign());
|
|
|
+ // 系统当前日期
|
|
|
+ velocityContext.put("currentTime", DateFormatUtils.format(endTime, "yyyy-MM-dd_HH:mm") + ":00");
|
|
|
+ // 上报数据开始日期
|
|
|
+ velocityContext.put("uploadTime", DateFormatUtils.format(endTime, "yyyy-MM-dd_HH:mm"));
|
|
|
+ StringWriter writer = new StringWriter();
|
|
|
+ template.merge(velocityContext, writer);
|
|
|
+ super.copyUploadFile(writer, file, FileTypeEnum.E7.name(), null, date, electricFieldInfo.getStationCode());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -929,4 +978,107 @@ public class E63UploadFileService extends BaseUploadFileService {
|
|
|
}
|
|
|
return v1.divide(v2, scale, BigDecimal.ROUND_HALF_UP);
|
|
|
}
|
|
|
+
|
|
|
+ private BigDecimal qxzRandomCreate(String type) {
|
|
|
+ DecimalFormat df = new DecimalFormat("0.00");
|
|
|
+ switch (type) {
|
|
|
+ case "globalR":
|
|
|
+ // 总辐射产生500-1000随机数
|
|
|
+ return new BigDecimal(df.format(Math.random() * 500 + 500));
|
|
|
+ case "directR":
|
|
|
+ // 直辐射产生400-500随机数
|
|
|
+ return new BigDecimal(df.format(Math.random() * 100 + 400));
|
|
|
+ case "airT":
|
|
|
+ // 温度
|
|
|
+ return new BigDecimal(df.format(Math.random() * 4 + 8));
|
|
|
+ case "p":
|
|
|
+ // 气压
|
|
|
+ return new BigDecimal(df.format(Math.random() * 200 + 800));
|
|
|
+ case "rh":
|
|
|
+ // 湿度
|
|
|
+ return new BigDecimal(df.format(Math.random() * 10 + 30));
|
|
|
+ case "cellT":
|
|
|
+ // 电池板温度
|
|
|
+ return new BigDecimal(df.format(Math.random() * 26 + 4));
|
|
|
+ case "ws":
|
|
|
+ // 风速
|
|
|
+ return new BigDecimal(df.format(Math.random() * 9 + 1));
|
|
|
+ case "wd":
|
|
|
+ // 风向
|
|
|
+ return new BigDecimal(df.format(Math.random() * 100 + 200));
|
|
|
+ default:
|
|
|
+ return new BigDecimal("0");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private BigDecimal cftRandomCreate(String type) {
|
|
|
+ DecimalFormat df = new DecimalFormat("0.00");
|
|
|
+ switch (type) {
|
|
|
+ case "wsInst10":
|
|
|
+ // 10米风速产生1-5随机数
|
|
|
+ return new BigDecimal(df.format(Math.random() * 4 + 1));
|
|
|
+ case "wdInst10":
|
|
|
+ // 10米风向产生40-60随机数
|
|
|
+ return new BigDecimal(df.format(Math.random() * 20 + 40));
|
|
|
+ case "wsInst30":
|
|
|
+ // 30米风速产生6-10随机数
|
|
|
+ return new BigDecimal(df.format(Math.random() * 4 + 6));
|
|
|
+ case "wdInst30":
|
|
|
+ // 30米风向产生70-90随机数
|
|
|
+ return new BigDecimal(df.format(Math.random() * 20 + 70));
|
|
|
+ case "wsInst50":
|
|
|
+ // 50米风速产生16-20随机数
|
|
|
+ return new BigDecimal(df.format(Math.random() * 4 + 16));
|
|
|
+ case "wdInst50":
|
|
|
+ // 50米风向产生130-150随机数
|
|
|
+ return new BigDecimal(df.format(Math.random() * 20 + 130));
|
|
|
+ case "wsInst60":
|
|
|
+ // 60米风速产生25-30随机数
|
|
|
+ return new BigDecimal(df.format(Math.random() * 5 + 25));
|
|
|
+ case "wdInst60":
|
|
|
+ // 60米风向产生160-200随机数
|
|
|
+ return new BigDecimal(df.format(Math.random() * 40 + 160));
|
|
|
+ case "wsInst70":
|
|
|
+ // 70米风速产生31-35随机数
|
|
|
+ return new BigDecimal(df.format(Math.random() * 4 + 31));
|
|
|
+ case "wdInst70":
|
|
|
+ // 70米风向产生220-240随机数
|
|
|
+ return new BigDecimal(df.format(Math.random() * 20 + 220));
|
|
|
+ case "wsInst80":
|
|
|
+ // 80米风速产生35-40随机数
|
|
|
+ return new BigDecimal(df.format(Math.random() * 20 + 220));
|
|
|
+ case "wdInst80":
|
|
|
+ // 80米风向产生240-250随机数
|
|
|
+ return new BigDecimal(df.format(Math.random() * 10 + 240));
|
|
|
+ case "wsInst90":
|
|
|
+ // 90米风速产生45-50随机数
|
|
|
+ return new BigDecimal(df.format(Math.random() * 5 + 45));
|
|
|
+ case "wdInst90":
|
|
|
+ // 90米风向产生260-270随机数
|
|
|
+ return new BigDecimal(df.format(Math.random() * 10 + 260));
|
|
|
+ case "wsInst100":
|
|
|
+ // 100米风速产生60-70随机数
|
|
|
+ return new BigDecimal(df.format(Math.random() * 10 + 60));
|
|
|
+ case "wdInst100":
|
|
|
+ // 100米风向产生280-290随机数
|
|
|
+ return new BigDecimal(df.format(Math.random() * 10 + 280));
|
|
|
+ case "wsInstHubHeight":
|
|
|
+ // 轮毂风速70-74随机数
|
|
|
+ return new BigDecimal(df.format(Math.random() * 4 + 70));
|
|
|
+ case "wdInstHubHeight":
|
|
|
+ // 轮毂风向280-290随机数
|
|
|
+ return new BigDecimal(df.format(Math.random() * 20 + 250));
|
|
|
+ case "tInst":
|
|
|
+ // 温度产生20-35随机数
|
|
|
+ return new BigDecimal(df.format(Math.random() * 15 + 20));
|
|
|
+ case "paInst":
|
|
|
+ // 气压产生75-90随机数
|
|
|
+ return new BigDecimal(df.format(Math.random() * 15 + 75));
|
|
|
+ case "rhInst":
|
|
|
+ // 湿度产生50-60随机数
|
|
|
+ return new BigDecimal(df.format(Math.random() * 10 + 50));
|
|
|
+ default:
|
|
|
+ return new BigDecimal("0");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|