hxf 2 năm trước cách đây
mục cha
commit
f06dbec516

+ 0 - 92
neim-biz/src/main/java/com/jiayue/biz/job/FileAnalysisJob.java

@@ -42,8 +42,6 @@ public class FileAnalysisJob {
     AnalysisDataImpl analysisData;
     @Autowired
     WindTowerInfoService windTowerInfoService;
-    @Autowired
-    WindTowerDataParentTableService windTowerDataParentTableService;
 
     @Autowired
     ProphaseAnemometryDataService prophaseAnemometryDataService;
@@ -51,11 +49,6 @@ public class FileAnalysisJob {
     @Autowired
     ProphaseWeatherDataService prophaseWeatherDataService;
 
-
-
-
-
-
     public FileAnalysisJob(EmailImpl emailImpl) {
         this.emailImpl = emailImpl;
     }
@@ -81,91 +74,6 @@ public class FileAnalysisJob {
 
     }
 //    @Scheduled(fixedDelay = 60000 * 6000)
-    public void test(){
-        List<WindTowerInfo> list1 = windTowerInfoService.lambdaQuery().list();
-        list1 =  list1.stream().filter(w -> !w.getEquipmentNo().equals("006171") && !w.getEquipmentNo().equals("5302")).collect(Collectors.toList());
-        for (WindTowerInfo windTowerInfo : list1) {
-            log.error("开始入库{}",windTowerInfo.getName());
-            Date date = new Date(1606752000000l);
-            String equipmentId = windTowerInfo.getEquipmentNo();
-            HashSet<String> dataSet = new HashSet<>();
-            String heights = windTowerInfo.getHeights();
-            String wdHeights = windTowerInfo.getWdHeights();
-            dataSet.addAll(Arrays.asList(heights.split(",")));
-            dataSet.addAll(Arrays.asList(wdHeights.split(",")));
-            for (long i = date.getTime(); i < 1682870400000l; i = DateUtil.offsetMonth(new Date(i), 1).getTime()) {
-                long l = DateUtil.offsetMonth(new Date(i), 1).getTime();
-                List<Map<String, Object>> mapList = windTowerDataParentTableService.selectByBetweenTimeAndEquipmetIdOld(new Date(i), new Date(l), equipmentId);
-                if (mapList.size() > 0) {
-                    ArrayList<ProphaseWeatherData> prophaseAnemometryPublicDataArrayList = new ArrayList<>();
-                    for (Map<String, Object> map : mapList) {
-
-                        //公共部分
-                        ProphaseWeatherData prophaseAnemometryPublicData = new ProphaseWeatherData();
-                        prophaseAnemometryPublicData.setTs(new Timestamp(Long.parseLong(map.get("time").toString())));
-                        prophaseAnemometryPublicData.setTInst(!map.containsKey("t_inst") ? null : Float.parseFloat(map.get("t_inst").toString()));
-                        prophaseAnemometryPublicData.setTAve(!map.containsKey("t_ave") ? null : Float.parseFloat(map.get("t_ave").toString()));
-                        prophaseAnemometryPublicData.setTMax(!map.containsKey("t_max") ? null : Float.parseFloat(map.get("t_max").toString()));
-                        prophaseAnemometryPublicData.setTMin(!map.containsKey("t_min") ? null : Float.parseFloat(map.get("t_min").toString()));
-                        prophaseAnemometryPublicData.setTSta(!map.containsKey("t_sta") ? null : Float.parseFloat(map.get("t_sta").toString()));
-
-                        prophaseAnemometryPublicData.setRhInst(!map.containsKey("rh_inst") ? null : Float.parseFloat(map.get("rh_inst").toString()));
-                        prophaseAnemometryPublicData.setRhAve(!map.containsKey("rh_ave") ? null : Float.parseFloat(map.get("rh_ave").toString()));
-                        prophaseAnemometryPublicData.setRhMax(!map.containsKey("rh_max") ? null : Float.parseFloat(map.get("rh_max").toString()));
-                        prophaseAnemometryPublicData.setRhMin(!map.containsKey("rh_min") ? null : Float.parseFloat(map.get("rh_min").toString()));
-                        prophaseAnemometryPublicData.setRhSta(!map.containsKey("rh_sta") ? null : Float.parseFloat(map.get("rh_sta").toString()));
-
-                        prophaseAnemometryPublicData.setPaInst(!map.containsKey("pa_inst") ? null : Float.parseFloat(map.get("pa_inst").toString()));
-                        prophaseAnemometryPublicData.setPaAve(!map.containsKey("pa_ave") ? null : Float.parseFloat(map.get("pa_ave").toString()));
-                        prophaseAnemometryPublicData.setPaMax(!map.containsKey("pa_max") ? null : Float.parseFloat(map.get("pa_max").toString()));
-                        prophaseAnemometryPublicData.setPaMin(!map.containsKey("pa_min") ? null : Float.parseFloat(map.get("pa_min").toString()));
-                        prophaseAnemometryPublicData.setPaSta(!map.containsKey("pa_sta") ? null : Float.parseFloat(map.get("pa_sta").toString()));
-
-                        prophaseAnemometryPublicData.setAirDensity(!map.containsKey("air_density") ? null : Float.parseFloat(map.get("air_density").toString()));
-                        prophaseAnemometryPublicDataArrayList.add(prophaseAnemometryPublicData);
-                    }
-                    //切分List
-                    List<List<ProphaseWeatherData>> partition = ListUtil.partition(prophaseAnemometryPublicDataArrayList, 3000);
-                    //分批保存
-                    for (List<ProphaseWeatherData> prophaseAnemometryPublicDataList : partition) {
-                        prophaseWeatherDataService.insertSplice(prophaseAnemometryPublicDataList, equipmentId);
-                    }
-                    ArrayList<ProphaseAnemometryData> prophaseAnemometryDataArrayList = new ArrayList<>();
-                    for (String height : dataSet) {
-                        for (Map<String, Object> m : mapList) {
-                            //风速 风向
-                            ProphaseAnemometryData one = new ProphaseAnemometryData();
-                            //组装子表数据
-                            one.setWsAve(!m.containsKey("ws_ave" + height) ? null : CalculationUtil.getBigDecimal(m.get("ws_ave" + height)).setScale(2, RoundingMode.HALF_UP).floatValue());
-                            one.setWsMax(!m.containsKey("ws_max" + height) ? null : CalculationUtil.getBigDecimal(m.get("ws_max" + height)).setScale(2, RoundingMode.HALF_UP).floatValue());
-                            one.setWsMin(!m.containsKey("ws_min" + height) ? null : CalculationUtil.getBigDecimal(m.get("ws_min" + height)).setScale(2, RoundingMode.HALF_UP).floatValue());
-                            one.setWsSta(!m.containsKey("ws_sta" + height) ? null : CalculationUtil.getBigDecimal(m.get("ws_sta" + height)).setScale(2, RoundingMode.HALF_UP).floatValue());
-                            one.setWsInst(!m.containsKey("ws_inst" + height) ? null : CalculationUtil.getBigDecimal(m.get("ws_inst" + height)).setScale(2, RoundingMode.HALF_UP).floatValue());
-                            one.setWdAve(!m.containsKey("wd_ave" + height) ? null : CalculationUtil.getBigDecimal(m.get("wd_ave" + height)).setScale(2, RoundingMode.HALF_UP).floatValue());
-                            one.setWdMax(!m.containsKey("wd_max" + height) ? null : CalculationUtil.getBigDecimal(m.get("wd_max" + height)).setScale(2, RoundingMode.HALF_UP).floatValue());
-                            one.setWdMin(!m.containsKey("wd_min" + height) ? null : CalculationUtil.getBigDecimal(m.get("wd_min" + height)).setScale(2, RoundingMode.HALF_UP).floatValue());
-                            one.setWdSta(!m.containsKey("wd_sta" + height) ? null : CalculationUtil.getBigDecimal(m.get("wd_sta" + height)).setScale(2, RoundingMode.HALF_UP).floatValue());
-                            one.setWdInst(!m.containsKey("wd_inst" + height) ? null : CalculationUtil.getBigDecimal(m.get("wd_inst" + height)).setScale(2, RoundingMode.HALF_UP).floatValue());
-                            one.setLayerHeight(height);
-                            one.setEquipmentId(windTowerInfo.getEquipmentNo());
-                            one.setTs(new Timestamp(Long.parseLong(m.get("time").toString())));
-
-                            prophaseAnemometryDataService.insertOneWithNew(one);
-//                            prophaseAnemometryDataArrayList.add(one);
-                        }
-                        //切分List
-//                        List<List<ProphaseAnemometryData>> partition1 = ListUtil.partition(prophaseAnemometryDataArrayList, 3000);
-//                        //分批保存
-//                        for (List<ProphaseAnemometryData> prophaseAnemometryData : partition1) {
-//                            prophaseAnemometryDataMapper.insertSplice(prophaseAnemometryData, equipmentId, height);
-//                        }
-                    }
-                }
-            }
-            log.error("入库结束{}",windTowerInfo.getName());
-        }
-    }
-