|
@@ -14,10 +14,7 @@ import com.jiayue.biz.domain.*;
|
|
|
import com.jiayue.biz.mapper.ProphaseAnemometryDataMapper;
|
|
|
import com.jiayue.biz.mapper.ProphaseWeatherDataMapper;
|
|
|
import com.jiayue.biz.mapper.WindTowerDataParentTableMapper;
|
|
|
-import com.jiayue.biz.service.ProphaseAnemometryDataService;
|
|
|
-import com.jiayue.biz.service.ProphaseWeatherDataService;
|
|
|
-import com.jiayue.biz.service.WindTowerDataChildTableService;
|
|
|
-import com.jiayue.biz.service.WindTowerDataParentTableService;
|
|
|
+import com.jiayue.biz.service.*;
|
|
|
import com.jiayue.biz.util.CalculationUtil;
|
|
|
import com.jiayue.biz.util.CommonUtil;
|
|
|
import com.jiayue.biz.util.DateTimeUtil;
|
|
@@ -65,6 +62,12 @@ public class WindTowerDataParentTableServiceImpl extends ServiceImpl<WindTowerDa
|
|
|
ProphaseAnemometryDataService prophaseAnemometryDataService;
|
|
|
|
|
|
@Autowired
|
|
|
+ ProphaseAnemometryDataOrgService prophaseAnemometryDataOrgService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ ProphaseWeatherDataOrgService prophaseWeatherDataOrgService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
ProphaseWeatherDataService prophaseWeatherDataService;
|
|
|
|
|
|
|
|
@@ -100,117 +103,119 @@ 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 (Map<String, Object> m : allData) {
|
|
|
- for (String height : heightAll) {
|
|
|
- if(m.get("time").toString().contains("4:50")){
|
|
|
- System.out.println("height = " + m);
|
|
|
- }
|
|
|
-
|
|
|
- //异常数据赋值为-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);
|
|
|
+ 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);
|
|
|
}
|
|
|
- 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()));
|
|
|
- }
|
|
|
+ }
|
|
|
+ this.packageOrgData(m, heightAll, simpleDateFormat, eqNo, "noOrg");
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("时间转换异常:" + e);
|
|
|
- }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ 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 {
|
|
|
+ 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()));
|
|
|
}
|
|
|
- prophaseAnemometryDataService.insertOneWithNew(one);
|
|
|
- }
|
|
|
|
|
|
-// log.error("prophaseAnemometryDataArrayList = " + JSONUtil.toJsonPrettyStr(prophaseAnemometryDataArrayList));
|
|
|
-// prophaseAnemometryDataMapper.insertSplice(prophaseAnemometryDataArrayList, equipmentId, height);
|
|
|
-
|
|
|
-
|
|
|
- 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());
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("时间转换异常:" + e);
|
|
|
}
|
|
|
- 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()));
|
|
|
- }
|
|
|
+ }
|
|
|
+ if (org.equals("org")) {
|
|
|
+ prophaseAnemometryDataOrgService.insertOneWithNew(one);
|
|
|
+ } else {
|
|
|
+ prophaseAnemometryDataService.insertOneWithNew(one);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("时间转换异常:" + e);
|
|
|
- }
|
|
|
+ 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) {
|
|
|
+ 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) {
|
|
|
+ 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);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|