|
@@ -59,6 +59,11 @@ public class WindTowerDataParentTableServiceImpl extends ServiceImpl<WindTowerDa
|
|
|
DisplayConfigServiceImpl displayConfigService;
|
|
|
|
|
|
@Autowired
|
|
|
+ ProphaseAnemometryDataOrgService prophaseAnemometryDataOrgService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ ProphaseWeatherDataOrgService prophaseWeatherDataOrgService;
|
|
|
+ @Autowired
|
|
|
ProphaseAnemometryDataService prophaseAnemometryDataService;
|
|
|
|
|
|
@Autowired
|
|
@@ -87,7 +92,7 @@ public class WindTowerDataParentTableServiceImpl extends ServiceImpl<WindTowerDa
|
|
|
simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm");
|
|
|
}
|
|
|
String eqNo = equipmentId;
|
|
|
- List<WindTowerInfo> windTowerInfoList = windTowerInfoService.getAllWindTower();
|
|
|
+ List<WindTowerInfo> windTowerInfoList = windTowerInfoService.list();
|
|
|
List<WindTowerInfo> windTowerInfo = windTowerInfoList.stream().filter(w -> w.getEquipmentNo().equals(eqNo)).collect(Collectors.toList());
|
|
|
String windTowerInfoHeights = windTowerInfo.get(0).getHeights();
|
|
|
String windTowerInfoWdHeights = windTowerInfo.get(0).getWdHeights();
|
|
@@ -97,105 +102,128 @@ public class WindTowerDataParentTableServiceImpl extends ServiceImpl<WindTowerDa
|
|
|
heightAll.addAll(Arrays.asList(wdHeight));
|
|
|
heightAll.addAll(Arrays.asList(heights));
|
|
|
//层高
|
|
|
- ArrayList<ProphaseAnemometryData> prophaseAnemometryDataArrayList = new ArrayList<>();
|
|
|
- ArrayList<ProphaseWeatherData> prophaseAnemometryPublicDataArrayList = new ArrayList<>();
|
|
|
-
|
|
|
+// ArrayList<ProphaseAnemometryData> prophaseAnemometryDataArrayList = new ArrayList<>();
|
|
|
+// ArrayList<ProphaseWeatherData> prophaseAnemometryPublicDataArrayList = new ArrayList<>();
|
|
|
try {
|
|
|
//所有数据
|
|
|
- for (String height : heightAll) {
|
|
|
- for (Map<String, Object> m : allData) {
|
|
|
- ProphaseAnemometryData one = new ProphaseAnemometryData();
|
|
|
- //组装子表数据
|
|
|
- one.setWsAve(m.get("wsAve_" + height) == null ? null : CalculationUtil.getBigDecimal(m.get("wsAve_" + height)).setScale(2, RoundingMode.HALF_UP).floatValue());
|
|
|
- one.setWsMin(m.get("wsMin_" + height) == null ? null : CalculationUtil.getBigDecimal(m.get("wsMin_" + height)).setScale(2, RoundingMode.HALF_UP).floatValue());
|
|
|
- one.setWsMax(m.get("wsMax_" + height) == null ? null : CalculationUtil.getBigDecimal(m.get("wsMax_" + height)).setScale(2, RoundingMode.HALF_UP).floatValue());
|
|
|
- one.setWsSta(m.get("wsSta_" + height) == null ? null : CalculationUtil.getBigDecimal(m.get("wsSta_" + height)).setScale(2, RoundingMode.HALF_UP).floatValue());
|
|
|
- one.setWsInst(m.get("wsInst_" + height) == null ? null : CalculationUtil.getBigDecimal(m.get("wsInst_" + height)).setScale(2, RoundingMode.HALF_UP).floatValue());
|
|
|
- one.setWdAve(m.get("wdAve_" + height) == null ? null : CalculationUtil.getBigDecimal(m.get("wdAve_" + height)).setScale(2, RoundingMode.HALF_UP).floatValue());
|
|
|
- one.setWdMax(m.get("wdMax_" + height) == null ? null : CalculationUtil.getBigDecimal(m.get("wdMax_" + height)).setScale(2, RoundingMode.HALF_UP).floatValue());
|
|
|
- one.setWdMin(m.get("wdMin_" + height) == null ? null : CalculationUtil.getBigDecimal(m.get("wdMin_" + height)).setScale(2, RoundingMode.HALF_UP).floatValue());
|
|
|
- one.setWdSta(m.get("wdSta_" + height) == null ? null : CalculationUtil.getBigDecimal(m.get("wdSta_" + height)).setScale(2, RoundingMode.HALF_UP).floatValue());
|
|
|
- one.setWdInst(m.get("wdInst_" + height) == null ? null : CalculationUtil.getBigDecimal(m.get("wdInst_" + height)).setScale(2, RoundingMode.HALF_UP).floatValue());
|
|
|
- one.setLayerHeight(height);
|
|
|
- one.setEquipmentId(equipmentId);
|
|
|
- prophaseAnemometryDataArrayList.add(one);
|
|
|
- if (m.get("time") != null) {
|
|
|
- try {
|
|
|
- try {
|
|
|
- one.setTs(new Timestamp(simpleDateFormat.parse(m.get("time").toString()).getTime()));
|
|
|
- } catch (ParseException e) {
|
|
|
- one.setTs(new Timestamp(new Date(Long.parseLong(m.get("time").toString())).getTime()));
|
|
|
- }
|
|
|
-
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("时间转换异常:" + e);
|
|
|
+ for (Map<String, Object> m : allData) {
|
|
|
+ if (!operation.equals("DataRecalculation")) {
|
|
|
+ this.packageOrgData(m, heightAll, simpleDateFormat, eqNo, "org");
|
|
|
+ }
|
|
|
+ //异常数据赋值为-99
|
|
|
+ if (m.get("abnormalType") != null) {
|
|
|
+ if (m.get("abnormalType").toString().contains(",")) {
|
|
|
+ String[] abnormalTypes = m.get("abnormalType").toString().split(",");
|
|
|
+ for (String abnormalType : abnormalTypes) {
|
|
|
+ m.put(abnormalType, -99f);
|
|
|
}
|
|
|
+ } else {
|
|
|
+ m.put(m.get("abnormalType").toString(), -99f);
|
|
|
}
|
|
|
- prophaseAnemometryDataService.insertOneWithNew(one);
|
|
|
}
|
|
|
-
|
|
|
-// log.error("prophaseAnemometryDataArrayList = " + JSONUtil.toJsonPrettyStr(prophaseAnemometryDataArrayList));
|
|
|
-// prophaseAnemometryDataMapper.insertSplice(prophaseAnemometryDataArrayList, equipmentId, height);
|
|
|
+ this.packageOrgData(m, heightAll, simpleDateFormat, eqNo, "noOrg");
|
|
|
}
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
|
|
|
- for (Map<String, Object> m : allData) {
|
|
|
- ProphaseWeatherData prophaseAnemometryPublicData = new ProphaseWeatherData();
|
|
|
- if (m.get("paMax") != null)
|
|
|
- //kpa转hpa
|
|
|
- if (BigDecimal.valueOf(Double.parseDouble(m.get("paMax").toString())).compareTo(new BigDecimal(200)) < 0)
|
|
|
- prophaseAnemometryPublicData.setPaMax(CalculationUtil.getBigDecimal(m.get("paMax").toString()).multiply(new BigDecimal(10)).setScale(2, RoundingMode.HALF_UP).floatValue());
|
|
|
- else
|
|
|
- prophaseAnemometryPublicData.setPaMax(CalculationUtil.getBigDecimal(m.get("paMax").toString()).floatValue());
|
|
|
- if (m.get("paMin") != null)
|
|
|
- //kpa转hpa
|
|
|
- if (BigDecimal.valueOf(Double.parseDouble(m.get("paMin").toString())).compareTo(new BigDecimal(200)) < 0)
|
|
|
- prophaseAnemometryPublicData.setPaMin(CalculationUtil.getBigDecimal(m.get("paMin").toString()).multiply(new BigDecimal(10)).setScale(2, RoundingMode.HALF_UP).floatValue());
|
|
|
- else
|
|
|
- prophaseAnemometryPublicData.setPaMin(CalculationUtil.getBigDecimal(m.get("paMin").toString()).floatValue());
|
|
|
- if (m.get("paAve") != null)
|
|
|
- //kpa转hpa
|
|
|
- if (BigDecimal.valueOf(Double.parseDouble(m.get("paAve").toString())).compareTo(new BigDecimal(200)) < 0)
|
|
|
- prophaseAnemometryPublicData.setPaAve(CalculationUtil.getBigDecimal(m.get("paAve").toString()).multiply(new BigDecimal(10)).setScale(2, RoundingMode.HALF_UP).floatValue());
|
|
|
- else
|
|
|
- prophaseAnemometryPublicData.setPaAve(CalculationUtil.getBigDecimal(m.get("paAve").toString()).floatValue());
|
|
|
- prophaseAnemometryPublicData.setPaSta(m.get("paSta") == null ? null : CalculationUtil.getBigDecimal(m.get("paSta")).setScale(2, RoundingMode.HALF_UP).floatValue());
|
|
|
- prophaseAnemometryPublicData.setTMax(m.get("tMax") == null ? null : CalculationUtil.getBigDecimal(m.get("tMax")).setScale(2, RoundingMode.HALF_UP).floatValue());
|
|
|
- prophaseAnemometryPublicData.setTMin(m.get("tMin") == null ? null : CalculationUtil.getBigDecimal(m.get("tMin")).setScale(2, RoundingMode.HALF_UP).floatValue());
|
|
|
- prophaseAnemometryPublicData.setTAve(m.get("tAve") == null ? null : CalculationUtil.getBigDecimal(m.get("tAve")).setScale(2, RoundingMode.HALF_UP).floatValue());
|
|
|
- prophaseAnemometryPublicData.setTSta(m.get("tSta") == null ? null : CalculationUtil.getBigDecimal(m.get("tSta")).setScale(2, RoundingMode.HALF_UP).floatValue());
|
|
|
- prophaseAnemometryPublicData.setRhMax(m.get("rhMax") == null ? null : CalculationUtil.getBigDecimal(m.get("rhMax")).setScale(2, RoundingMode.HALF_UP).floatValue());
|
|
|
- prophaseAnemometryPublicData.setRhMin(m.get("rhMin") == null ? null : CalculationUtil.getBigDecimal(m.get("rhMin")).setScale(2, RoundingMode.HALF_UP).floatValue());
|
|
|
- prophaseAnemometryPublicData.setRhAve(m.get("rhAve") == null ? null : CalculationUtil.getBigDecimal(m.get("rhAve")).setScale(2, RoundingMode.HALF_UP).floatValue());
|
|
|
- prophaseAnemometryPublicData.setRhSta(m.get("rhSta") == null ? null : CalculationUtil.getBigDecimal(m.get("rhSta")).setScale(2, RoundingMode.HALF_UP).floatValue());
|
|
|
- //计算空气密度 1.293*(273/(273+温度摄氏度))*气压百帕/1013
|
|
|
- if (prophaseAnemometryPublicData.getTAve() != null && prophaseAnemometryPublicData.getPaAve() != null) {
|
|
|
- BigDecimal airDensity = BigDecimal.valueOf(1.293).multiply(new BigDecimal(273).divide(new BigDecimal(273).add(BigDecimal.valueOf(prophaseAnemometryPublicData.getTAve())), 2, RoundingMode.HALF_UP)).multiply(BigDecimal.valueOf(prophaseAnemometryPublicData.getPaAve())).divide(new BigDecimal(1013), 2, RoundingMode.HALF_UP);
|
|
|
- prophaseAnemometryPublicData.setAirDensity(airDensity.floatValue());
|
|
|
- }
|
|
|
- if (m.get("time") != null) {
|
|
|
+ }
|
|
|
+ public void packageOrgData(Map<String, Object> m, HashSet<String> heightAll, SimpleDateFormat simpleDateFormat, String equipmentId, String org) {
|
|
|
+ for (String height : heightAll) {
|
|
|
+ ProphaseAnemometryData one = new ProphaseAnemometryData();
|
|
|
+ //组装子表数据
|
|
|
+ one.setWsAve(m.get("wsAve_" + height) == null ? null : CalculationUtil.getBigDecimal(m.get("wsAve_" + height)).setScale(2, RoundingMode.HALF_UP).floatValue());
|
|
|
+ one.setWsMin(m.get("wsMin_" + height) == null ? null : CalculationUtil.getBigDecimal(m.get("wsMin_" + height)).setScale(2, RoundingMode.HALF_UP).floatValue());
|
|
|
+ one.setWsMax(m.get("wsMax_" + height) == null ? null : CalculationUtil.getBigDecimal(m.get("wsMax_" + height)).setScale(2, RoundingMode.HALF_UP).floatValue());
|
|
|
+ one.setWsSta(m.get("wsSta_" + height) == null ? null : CalculationUtil.getBigDecimal(m.get("wsSta_" + height)).setScale(2, RoundingMode.HALF_UP).floatValue());
|
|
|
+ one.setWsInst(m.get("wsInst_" + height) == null ? null : CalculationUtil.getBigDecimal(m.get("wsInst_" + height)).setScale(2, RoundingMode.HALF_UP).floatValue());
|
|
|
+ one.setWdAve(m.get("wdAve_" + height) == null ? null : CalculationUtil.getBigDecimal(m.get("wdAve_" + height)).setScale(2, RoundingMode.HALF_UP).floatValue());
|
|
|
+ one.setWdMax(m.get("wdMax_" + height) == null ? null : CalculationUtil.getBigDecimal(m.get("wdMax_" + height)).setScale(2, RoundingMode.HALF_UP).floatValue());
|
|
|
+ one.setWdMin(m.get("wdMin_" + height) == null ? null : CalculationUtil.getBigDecimal(m.get("wdMin_" + height)).setScale(2, RoundingMode.HALF_UP).floatValue());
|
|
|
+ one.setWdSta(m.get("wdSta_" + height) == null ? null : CalculationUtil.getBigDecimal(m.get("wdSta_" + height)).setScale(2, RoundingMode.HALF_UP).floatValue());
|
|
|
+ one.setWdInst(m.get("wdInst_" + height) == null ? null : CalculationUtil.getBigDecimal(m.get("wdInst_" + height)).setScale(2, RoundingMode.HALF_UP).floatValue());
|
|
|
+ one.setLayerHeight(height);
|
|
|
+ one.setEquipmentId(equipmentId);
|
|
|
+ if (m.get("time") != null) {
|
|
|
+ try {
|
|
|
try {
|
|
|
- try {
|
|
|
- prophaseAnemometryPublicData.setTs(new Timestamp(simpleDateFormat.parse(m.get("time").toString()).getTime()));
|
|
|
- } catch (ParseException e) {
|
|
|
- prophaseAnemometryPublicData.setTs(new Timestamp(new Date(Long.parseLong(m.get("time").toString())).getTime()));
|
|
|
- }
|
|
|
-
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("时间转换异常:" + e);
|
|
|
+ one.setTs(new Timestamp(simpleDateFormat.parse(m.get("time").toString()).getTime()));
|
|
|
+ } catch (ParseException e) {
|
|
|
+ one.setTs(new Timestamp(new Date(Long.parseLong(m.get("time").toString())).getTime()));
|
|
|
}
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("时间转换异常:" + e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (org.equals("org")) {
|
|
|
+ prophaseAnemometryDataOrgService.insertOneWithNew(one);
|
|
|
+ } else {
|
|
|
+ prophaseAnemometryDataService.insertOneWithNew(one);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ProphaseWeatherData prophaseAnemometryPublicData = new ProphaseWeatherData();
|
|
|
+ prophaseAnemometryPublicData.setEquipmentId(equipmentId);
|
|
|
+ if (m.get("paMax") != null)
|
|
|
+ //kpa转hpa
|
|
|
+ if (BigDecimal.valueOf(Double.parseDouble(m.get("paMax").toString())).compareTo(new BigDecimal(200)) < 0)
|
|
|
+ prophaseAnemometryPublicData.setPaMax(CalculationUtil.getBigDecimal(m.get("paMax").toString()).multiply(new BigDecimal(10)).setScale(2, RoundingMode.HALF_UP).floatValue());
|
|
|
+ else
|
|
|
+ prophaseAnemometryPublicData.setPaMax(CalculationUtil.getBigDecimal(m.get("paMax").toString()).floatValue());
|
|
|
+ if (m.get("paMin") != null)
|
|
|
+ //kpa转hpa
|
|
|
+ if (BigDecimal.valueOf(Double.parseDouble(m.get("paMin").toString())).compareTo(new BigDecimal(200)) < 0)
|
|
|
+ prophaseAnemometryPublicData.setPaMin(CalculationUtil.getBigDecimal(m.get("paMin").toString()).multiply(new BigDecimal(10)).setScale(2, RoundingMode.HALF_UP).floatValue());
|
|
|
+ else
|
|
|
+ prophaseAnemometryPublicData.setPaMin(CalculationUtil.getBigDecimal(m.get("paMin").toString()).floatValue());
|
|
|
+ if (m.get("paAve") != null)
|
|
|
+ //kpa转hpa
|
|
|
+ if (BigDecimal.valueOf(Double.parseDouble(m.get("paAve").toString())).compareTo(new BigDecimal(200)) < 0)
|
|
|
+ prophaseAnemometryPublicData.setPaAve(CalculationUtil.getBigDecimal(m.get("paAve").toString()).multiply(new BigDecimal(10)).setScale(2, RoundingMode.HALF_UP).floatValue());
|
|
|
+ else
|
|
|
+ prophaseAnemometryPublicData.setPaAve(CalculationUtil.getBigDecimal(m.get("paAve").toString()).floatValue());
|
|
|
+ prophaseAnemometryPublicData.setPaSta(m.get("paSta") == null ? null : CalculationUtil.getBigDecimal(m.get("paSta")).setScale(2, RoundingMode.HALF_UP).floatValue());
|
|
|
+ prophaseAnemometryPublicData.setTMax(m.get("tMax") == null ? null : CalculationUtil.getBigDecimal(m.get("tMax")).setScale(2, RoundingMode.HALF_UP).floatValue());
|
|
|
+ prophaseAnemometryPublicData.setTMin(m.get("tMin") == null ? null : CalculationUtil.getBigDecimal(m.get("tMin")).setScale(2, RoundingMode.HALF_UP).floatValue());
|
|
|
+ prophaseAnemometryPublicData.setTAve(m.get("tAve") == null ? null : CalculationUtil.getBigDecimal(m.get("tAve")).setScale(2, RoundingMode.HALF_UP).floatValue());
|
|
|
+ prophaseAnemometryPublicData.setTSta(m.get("tSta") == null ? null : CalculationUtil.getBigDecimal(m.get("tSta")).setScale(2, RoundingMode.HALF_UP).floatValue());
|
|
|
+ prophaseAnemometryPublicData.setRhMax(m.get("rhMax") == null ? null : CalculationUtil.getBigDecimal(m.get("rhMax")).setScale(2, RoundingMode.HALF_UP).floatValue());
|
|
|
+ prophaseAnemometryPublicData.setRhMin(m.get("rhMin") == null ? null : CalculationUtil.getBigDecimal(m.get("rhMin")).setScale(2, RoundingMode.HALF_UP).floatValue());
|
|
|
+ prophaseAnemometryPublicData.setRhAve(m.get("rhAve") == null ? null : CalculationUtil.getBigDecimal(m.get("rhAve")).setScale(2, RoundingMode.HALF_UP).floatValue());
|
|
|
+ prophaseAnemometryPublicData.setRhSta(m.get("rhSta") == null ? null : CalculationUtil.getBigDecimal(m.get("rhSta")).setScale(2, RoundingMode.HALF_UP).floatValue());
|
|
|
+ //计算空气密度 1.293*(273/(273+温度摄氏度))*气压百帕/1013
|
|
|
+ if (prophaseAnemometryPublicData.getTAve() != null && prophaseAnemometryPublicData.getPaAve() != null &&
|
|
|
+ prophaseAnemometryPublicData.getTAve() != -99 && prophaseAnemometryPublicData.getPaAve() > 0) {
|
|
|
+ BigDecimal airDensity = BigDecimal.valueOf(1.293).multiply(new BigDecimal(273).divide(new BigDecimal(273).add(BigDecimal.valueOf(prophaseAnemometryPublicData.getTAve())), 2, RoundingMode.HALF_UP)).multiply(BigDecimal.valueOf(prophaseAnemometryPublicData.getPaAve())).divide(new BigDecimal(1013), 2, RoundingMode.HALF_UP);
|
|
|
+ prophaseAnemometryPublicData.setAirDensity(airDensity.floatValue());
|
|
|
+ }else{
|
|
|
+ //随机数 上限1.28 下限1.15
|
|
|
+ Random random = new Random();
|
|
|
+ int randNumber = random.nextInt(128 - 115 + 1) + 115;
|
|
|
+ BigDecimal air = BigDecimal.valueOf(randNumber).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP);
|
|
|
+ prophaseAnemometryPublicData.setAirDensity(air.floatValue());
|
|
|
+ }
|
|
|
+ if (m.get("time") != null) {
|
|
|
+ try {
|
|
|
+ try {
|
|
|
+ prophaseAnemometryPublicData.setTs(new Timestamp(simpleDateFormat.parse(m.get("time").toString()).getTime()));
|
|
|
+ } catch (ParseException e) {
|
|
|
+ prophaseAnemometryPublicData.setTs(new Timestamp(new Date(Long.parseLong(m.get("time").toString())).getTime()));
|
|
|
}
|
|
|
- prophaseAnemometryPublicDataArrayList.add(prophaseAnemometryPublicData);
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("时间转换异常:" + e);
|
|
|
}
|
|
|
-// log.error("prophaseAnemometryPublicDataArrayList = " + JSONUtil.toJsonPrettyStr(prophaseAnemometryPublicDataArrayList));
|
|
|
- prophaseWeatherDataService.insertSplice(prophaseAnemometryPublicDataArrayList, equipmentId);
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
}
|
|
|
|
|
|
+ if (org.equals("org")) {
|
|
|
+ prophaseWeatherDataOrgService.insertOne(prophaseAnemometryPublicData);
|
|
|
+ } else {
|
|
|
+ prophaseWeatherDataService.insertOne(prophaseAnemometryPublicData);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 组装数据
|
|
|
*
|
|
@@ -755,7 +783,7 @@ public class WindTowerDataParentTableServiceImpl extends ServiceImpl<WindTowerDa
|
|
|
.append(",").append("pa_ave")
|
|
|
.append(",").append("pa_sta");
|
|
|
//所有层高
|
|
|
- String[] height = {"150", "150A", "140", "140A", "120", "120A", "110", "110A", "100", "100A", "90", "90A", "80", "80A", "70", "70A", "50", "50A", "30", "30A", "10", "10A"};
|
|
|
+ String[] height = {"200", "200A","190", "190A","180", "180A","170", "170A","160", "160A","150", "150A", "140", "140A", "120", "120A", "110", "110A", "100", "100A", "90", "90A", "80", "80A", "70", "70A", "50", "50A", "30", "30A", "10", "10A"};
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
if (!mapList.isEmpty()) {
|
|
|
map = mapList.get(0);
|