Преглед на файлове

1.调整测风塔排序

wangt преди 1 година
родител
ревизия
29c7299bef

+ 1 - 1
neim-biz/src/main/java/com/jiayue/biz/controller/StatisticsSituationController.java

@@ -56,7 +56,7 @@ public class StatisticsSituationController extends BaseController {
 //        startPage();
         LambdaQueryWrapper<StatisticsSituation> queryWrapper = this.buildQueryParams(statisticsSituation);
         List<StatisticsSituation> list = iStatisticsSituationService.list(queryWrapper).stream().sorted(Comparator.comparing(StatisticsSituation::getEquipmentId)).collect(Collectors.toList());
-        ;
+
         return getDataTable(list);
     }
 

+ 1 - 1
neim-biz/src/main/java/com/jiayue/biz/controller/WindTowerInfoController.java

@@ -132,7 +132,7 @@ public class WindTowerInfoController extends BaseController {
     @GetMapping("/listEquipmentIdAndDataTime")
     public AjaxResult listEquipmentIdAndDataTime() {
         try {
-            return AjaxResult.success(windTowerInfoService.listEquipmentIdAndDataTime());
+            return AjaxResult.success(windTowerInfoService.listEquipmentIdAndDataTime(false));
         } catch (Exception e) {
             return AjaxResult.error("获取测风塔列表失败:" + e);
         }

+ 4 - 0
neim-biz/src/main/java/com/jiayue/biz/domain/WindTowerInfo.java

@@ -123,5 +123,9 @@ public class WindTowerInfo implements Serializable {
      *测风塔附属于
      */
     private String type;
+    /**
+     *测风塔附属于
+     */
+    private Date  createTime;
 
 }

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

@@ -73,12 +73,6 @@ public class FileAnalysisJob {
 
     }
 
-    @Scheduled(cron = "0 51 16 13 6 ?")
-    public void cronOne(){
-        System.out.println("xxxxxxxxxx = ");
-
-
-    }
 
 
 

+ 43 - 0
neim-biz/src/main/java/com/jiayue/biz/job/RedisCacheUpdateJob.java

@@ -0,0 +1,43 @@
+package com.jiayue.biz.job;
+
+
+import com.jiayue.biz.service.ProphaseAnemometryDataService;
+import com.jiayue.biz.service.ProphaseWeatherDataService;
+import com.jiayue.biz.service.WindTowerInfoService;
+import com.jiayue.biz.service.impl.AnalysisDataImpl;
+import com.jiayue.biz.service.impl.EmailImpl;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Service;
+
+
+/**
+ * 定时扫描系统邮件并解析
+ *
+ * @author whc
+ * @version 3.0
+ */
+@Slf4j
+@Service
+@EnableScheduling
+public class RedisCacheUpdateJob {
+
+    @Autowired
+    WindTowerInfoService windTowerInfoService;
+
+    /**
+     * 更新测风塔选择框
+     */
+    public void updateWindTowerSeleter() {
+
+        windTowerInfoService.listEquipmentIdAndDataTime(true);
+
+        log.info("更新测风塔选择框数据到redis缓存中");
+
+    }
+
+
+
+}

+ 2 - 0
neim-biz/src/main/java/com/jiayue/biz/mapper/ProphaseWeatherDataMapper.java

@@ -52,4 +52,6 @@ public interface ProphaseWeatherDataMapper extends BaseMapper<ProphaseWeatherDat
     @Select("select last (ts) from nerp_db.weather_#{equipmentId}")
     List<Entity> getLastData(@Param("equipmentId") String equipmentId);
 
+    @Select("CREATE TABLE IF NOT EXISTS weather_${equipmentId} USING prophase_weather_data TAGS (#{equipmentId})")
+    void createTable(@Param("equipmentId") String equipmentId);
 }

+ 1 - 1
neim-biz/src/main/java/com/jiayue/biz/service/WindTowerInfoService.java

@@ -28,7 +28,7 @@ public interface WindTowerInfoService extends IService<WindTowerInfo> {
 
     boolean deleteWindTowerInfo(List<String> ids);
 
-    List<Map<String, String>> listEquipmentIdAndDataTime();
+    List<Map<String, String>> listEquipmentIdAndDataTime(boolean updateFlag);
 
     //获取测风塔层高
     String getWsHeights(String equipmentId);

+ 28 - 7
neim-biz/src/main/java/com/jiayue/biz/service/impl/ProphaseWeatherDataServiceImpl.java

@@ -17,10 +17,7 @@ import org.springframework.stereotype.Service;
 import javax.annotation.Resource;
 import java.sql.Timestamp;
 import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 
 @Service
@@ -33,7 +30,7 @@ public class ProphaseWeatherDataServiceImpl extends ServiceImpl<ProphaseWeatherD
     StatisticsSituationService statisticsSituationService;
     //获取测风塔起止时间
     public Map<String, Long> getDataTimeStartAndEnd(String equipmentNo) {
-        List<StatisticsSituation> statisticsSituationList = statisticsSituationService.list();
+
         HashMap<String, Long> hashMap = new HashMap<>();
         hashMap.put("startTime", 0l);
         hashMap.put("endTime", 0l);
@@ -47,14 +44,20 @@ public class ProphaseWeatherDataServiceImpl extends ServiceImpl<ProphaseWeatherD
                 hashMap.put("endTime", timeEnd.getTime());
             }
         } catch (Exception e) {
+            List<StatisticsSituation> statisticsSituationList = statisticsSituationService.list();
             List<StatisticsSituation> collect = statisticsSituationList.stream().filter(s -> s.getEquipmentId().equals(equipmentNo)).collect(Collectors.toList());
             if(collect.size() != 0){
                 String[] timeArr = collect.get(0).getStartTimeAndEndTime().split(",");
                 hashMap.put("startTime", Long.parseLong(timeArr[0]));
                 hashMap.put("endTime", Long.parseLong(timeArr[1]));
             }
-//            e.printStackTrace();
-            log.error("{} 此测风塔没有表",equipmentNo);
+            log.error("{} 此测风塔没有表,创建表",equipmentNo);
+            try {
+                createTable(equipmentNo);
+            }catch (Exception e1){
+                log.error("创建测风塔设备:{} 的环境表数据失败:{}",equipmentNo,e1);
+            }
+
         }
 
         return hashMap;
@@ -110,6 +113,24 @@ public class ProphaseWeatherDataServiceImpl extends ServiceImpl<ProphaseWeatherD
         baseMapper.insertOneWithNew(prophaseWeatherData);
     }
 
+    /**
+     * 创建不存在的环境数据表
+     * @param equipmentId
+     */
+    public void createTable(String equipmentId){
+        baseMapper.createTable(equipmentId);
+    }
+
+    /**
+     * 待改造
+     * @return
+     */
+    @Override
+    public List<Map<String, Long>> listAll() {
+
+
+        return new ArrayList<>();
+    }
 
 
 }

+ 0 - 269
neim-biz/src/main/java/com/jiayue/biz/service/impl/WindTowerDataParentTableServiceImpl.java

@@ -229,275 +229,6 @@ public class WindTowerDataParentTableServiceImpl extends ServiceImpl<WindTowerDa
     }
 
 
-    /**
-     * 组装数据
-     *
-     * @param allData     数据
-     * @param equipmentId 设备编号
-     * @param eTime       时间
-     * @param type        文件类型
-     * @param operation   操作类型(DataRecalculation数据重算)
-     */
-    public void packageData1(List<Map<String, Object>> allData, String equipmentId, String eTime, String type, String operation) {
-
-        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
-        if (type.equals("rld")) {
-            simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-        }
-        if (type.equals("sld")) {
-            simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmm");
-        }
-        String eqNo = equipmentId;
-        List<EquipmentAttribute> equipmentAttributeList = equipmentAttributeService.list();
-        List<EquipmentAttribute> heightList = equipmentAttributeList.stream().filter(e -> "height".equals(e.getAttributeFunction())).collect(Collectors.toList());
-        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();
-        String[] wdHeight = windTowerInfoWdHeights.split(",");
-        String[] heights = windTowerInfoHeights.split(",");
-        HashSet<String> heightAll = new HashSet<>();
-        heightAll.addAll(Arrays.asList(wdHeight));
-        heightAll.addAll(Arrays.asList(heights));
-        //层高
-        List<WindTowerDataParentTable> windTowerDataParentTableList = new ArrayList<>();
-        List<WindTowerDataChildTable> windTowerDataChildTableList = new ArrayList<>();
-
-        try {
-            //所有数据
-            if (operation.equals("DataRecalculation")) {
-                for (Map<String, Object> m : allData) {
-                    WindTowerDataParentTable windTowerDataParentTable = new WindTowerDataParentTable();
-                    UUID uuid = UUID.randomUUID();
-                    for (String height : heightAll) {
-                        //层高对应的属性
-                        List<EquipmentAttribute> eqHeight = heightList.stream().filter(h -> height.equals(h.getFieldName())).collect(Collectors.toList());
-                        //组装子表数据
-                        WindTowerDataChildTable windTowerDataChildTable = new WindTowerDataChildTable();
-                        windTowerDataChildTable.setParentId(uuid.toString());
-                        windTowerDataChildTable.setLayerHeight(eqHeight.get(0).getId());
-                        windTowerDataChildTable.setWsAve(CalculationUtil.getBigDecimal(m.get("ws_ave" + height) == null ? null : m.get("ws_ave" + height).toString()));
-                        windTowerDataChildTable.setWsMin(CalculationUtil.getBigDecimal(m.get("ws_min" + height) == null ? null : m.get("ws_min" + height).toString()));
-                        windTowerDataChildTable.setWsMax(CalculationUtil.getBigDecimal(m.get("ws_max" + height) == null ? null : m.get("ws_max" + height).toString()));
-                        windTowerDataChildTable.setWsSta(CalculationUtil.getBigDecimal(m.get("ws_sta" + height) == null ? null : m.get("ws_sta" + height).toString()));
-                        windTowerDataChildTable.setWdAve(CalculationUtil.getBigDecimal(m.get("wd_ave" + height) == null ? null : m.get("wd_ave" + height).toString()));
-                        windTowerDataChildTable.setWdMax(CalculationUtil.getBigDecimal(m.get("wd_max" + height) == null ? null : m.get("wd_max" + height).toString()));
-                        windTowerDataChildTable.setWdMin(CalculationUtil.getBigDecimal(m.get("wd_min" + height) == null ? null : m.get("wd_min" + height).toString()));
-                        windTowerDataChildTable.setWdSta(CalculationUtil.getBigDecimal(m.get("wd_sta" + height) == null ? null : m.get("wd_sta" + height).toString()));
-                        windTowerDataChildTableList.add(windTowerDataChildTable);
-                    }
-                    //组装父表数据
-                    windTowerDataParentTable.setEquipmentId(equipmentId);
-                    windTowerDataParentTable.setId(uuid.toString());
-                    if (m.get("time") != null)
-                        try {
-                            try {
-                                windTowerDataParentTable.setTime(simpleDateFormat.parse(m.get("time").toString()));
-                            } catch (ParseException e) {
-
-                                windTowerDataParentTable.setTime(new Date(Long.parseLong(m.get("time").toString())));
-                            }
-
-                        } catch (Exception e) {
-                            log.error("时间转换异常:" + e);
-                        }
-
-                    if (m.get("paMax") != null)
-                        //kpa转hpa
-                        if (BigDecimal.valueOf(Double.parseDouble(m.get("pa_max").toString())).compareTo(new BigDecimal(200)) < 0)
-                            windTowerDataParentTable.setPaMax(CalculationUtil.getBigDecimal(m.get("pa_max").toString()).multiply(new BigDecimal(10)).setScale(4, RoundingMode.HALF_UP));
-                        else
-                            windTowerDataParentTable.setPaMax(CalculationUtil.getBigDecimal(m.get("pa_max").toString()));
-                    if (m.get("pa_min") != null)
-                        //kpa转hpa
-                        if (BigDecimal.valueOf(Double.parseDouble(m.get("pa_min").toString())).compareTo(new BigDecimal(200)) < 0)
-                            windTowerDataParentTable.setPaMin(CalculationUtil.getBigDecimal(m.get("pa_min").toString()).multiply(new BigDecimal(10)).setScale(4, RoundingMode.HALF_UP));
-                        else
-                            windTowerDataParentTable.setPaMin(CalculationUtil.getBigDecimal(m.get("pa_min").toString()));
-                    if (m.get("pa_ave") != null)
-                        //kpa转hpa
-                        if (BigDecimal.valueOf(Double.parseDouble(m.get("pa_ave").toString())).compareTo(new BigDecimal(200)) < 0)
-                            windTowerDataParentTable.setPaAve(CalculationUtil.getBigDecimal(m.get("pa_ave").toString()).multiply(new BigDecimal(10)).setScale(4, RoundingMode.HALF_UP));
-                        else
-                            windTowerDataParentTable.setPaAve(CalculationUtil.getBigDecimal(m.get("pa_ave").toString()));
-                    windTowerDataParentTable.setPaSta(CalculationUtil.getBigDecimal(m.get("pa_sta") == null ? null : m.get("pa_sta").toString()));
-                    windTowerDataParentTable.setTMax(CalculationUtil.getBigDecimal(m.get("t_max") == null ? null : m.get("t_max").toString()));
-                    windTowerDataParentTable.setTMin(CalculationUtil.getBigDecimal(m.get("t_min") == null ? null : m.get("t_min").toString()));
-                    windTowerDataParentTable.setTAve(CalculationUtil.getBigDecimal(m.get("t_ave") == null ? null : m.get("t_ave").toString()));
-                    windTowerDataParentTable.setTSta(CalculationUtil.getBigDecimal(m.get("t_sta") == null ? null : m.get("t_sta").toString()));
-                    windTowerDataParentTable.setRhMax(CalculationUtil.getBigDecimal(m.get("rh_max") == null ? null : m.get("rh_max").toString()));
-                    windTowerDataParentTable.setRhMin(CalculationUtil.getBigDecimal(m.get("rh_min") == null ? null : m.get("rh_min").toString()));
-                    windTowerDataParentTable.setRhAve(CalculationUtil.getBigDecimal(m.get("rh_ave") == null ? null : m.get("rh_ave").toString()));
-                    windTowerDataParentTable.setRhSta(CalculationUtil.getBigDecimal(m.get("rh_sta") == null ? null : m.get("rh_sta").toString()));
-                    windTowerDataParentTable.setAbnormalData(m.get("abnormalData") == null ? null : m.get("abnormalData").toString());
-                    windTowerDataParentTable.setAbnormalType(m.get("abnormalType") == null ? null : m.get("abnormalType").toString());
-                    windTowerDataParentTableList.add(windTowerDataParentTable);
-                }
-            } else {
-                for (Map<String, Object> m : allData) {
-                    WindTowerDataParentTable windTowerDataParentTable = new WindTowerDataParentTable();
-                    UUID uuid = UUID.randomUUID();
-                    for (String height : heightAll) {
-                        //层高对应的属性
-                        List<EquipmentAttribute> eqHeight = heightList.stream().filter(h -> height.equals(h.getFieldName())).collect(Collectors.toList());
-                        //组装子表数据
-                        WindTowerDataChildTable windTowerDataChildTable = new WindTowerDataChildTable();
-                        windTowerDataChildTable.setParentId(uuid.toString());
-                        windTowerDataChildTable.setLayerHeight(eqHeight.get(0).getId());
-                        windTowerDataChildTable.setWsAve(CalculationUtil.getBigDecimal(m.get("wsAve_" + height) == null ? null : m.get("wsAve_" + height).toString()));
-                        windTowerDataChildTable.setWsMin(CalculationUtil.getBigDecimal(m.get("wsMin_" + height) == null ? null : m.get("wsMin_" + height).toString()));
-                        windTowerDataChildTable.setWsMax(CalculationUtil.getBigDecimal(m.get("wsMax_" + height) == null ? null : m.get("wsMax_" + height).toString()));
-                        windTowerDataChildTable.setWsSta(CalculationUtil.getBigDecimal(m.get("wsSta_" + height) == null ? null : m.get("wsSta_" + height).toString()));
-                        windTowerDataChildTable.setWdAve(CalculationUtil.getBigDecimal(m.get("wdAve_" + height) == null ? null : m.get("wdAve_" + height).toString()));
-                        windTowerDataChildTable.setWdMax(CalculationUtil.getBigDecimal(m.get("wdMax_" + height) == null ? null : m.get("wdMax_" + height).toString()));
-                        windTowerDataChildTable.setWdMin(CalculationUtil.getBigDecimal(m.get("wdMin_" + height) == null ? null : m.get("wdMin_" + height).toString()));
-                        windTowerDataChildTable.setWdSta(CalculationUtil.getBigDecimal(m.get("wdSta_" + height) == null ? null : m.get("wdSta_" + height).toString()));
-                        windTowerDataChildTableList.add(windTowerDataChildTable);
-                    }
-                    //组装父表数据
-                    windTowerDataParentTable.setEquipmentId(equipmentId);
-                    windTowerDataParentTable.setId(uuid.toString());
-                    if (m.get("time") != null)
-                        try {
-                            try {
-                                windTowerDataParentTable.setTime(simpleDateFormat.parse(m.get("time").toString()));
-                            } catch (ParseException e) {
-
-                                windTowerDataParentTable.setTime(new Date(Long.parseLong(m.get("time").toString())));
-                            }
-
-                        } catch (Exception e) {
-                            log.error("时间转换异常:" + e);
-                        }
-
-                    if (m.get("paMax") != null)
-                        //kpa转hpa
-                        if (BigDecimal.valueOf(Double.parseDouble(m.get("paMax").toString())).compareTo(new BigDecimal(200)) < 0)
-                            windTowerDataParentTable.setPaMax(CalculationUtil.getBigDecimal(m.get("paMax").toString()).multiply(new BigDecimal(10)).setScale(4, RoundingMode.HALF_UP));
-                        else
-                            windTowerDataParentTable.setPaMax(CalculationUtil.getBigDecimal(m.get("paMax").toString()));
-                    if (m.get("paMin") != null)
-                        //kpa转hpa
-                        if (BigDecimal.valueOf(Double.parseDouble(m.get("paMin").toString())).compareTo(new BigDecimal(200)) < 0)
-                            windTowerDataParentTable.setPaMin(CalculationUtil.getBigDecimal(m.get("paMin").toString()).multiply(new BigDecimal(10)).setScale(4, RoundingMode.HALF_UP));
-                        else
-                            windTowerDataParentTable.setPaMin(CalculationUtil.getBigDecimal(m.get("paMin").toString()));
-                    if (m.get("paAve") != null)
-                        //kpa转hpa
-                        if (BigDecimal.valueOf(Double.parseDouble(m.get("paAve").toString())).compareTo(new BigDecimal(200)) < 0)
-                            windTowerDataParentTable.setPaAve(CalculationUtil.getBigDecimal(m.get("paAve").toString()).multiply(new BigDecimal(10)).setScale(4, RoundingMode.HALF_UP));
-                        else
-                            windTowerDataParentTable.setPaAve(CalculationUtil.getBigDecimal(m.get("paAve").toString()));
-                    windTowerDataParentTable.setPaSta(CalculationUtil.getBigDecimal(m.get("paSta") == null ? null : m.get("paSta").toString()));
-                    windTowerDataParentTable.setTMax(CalculationUtil.getBigDecimal(m.get("tMax") == null ? null : m.get("tMax").toString()));
-                    windTowerDataParentTable.setTMin(CalculationUtil.getBigDecimal(m.get("tMin") == null ? null : m.get("tMin").toString()));
-                    windTowerDataParentTable.setTAve(CalculationUtil.getBigDecimal(m.get("tAve") == null ? null : m.get("tAve").toString()));
-                    windTowerDataParentTable.setTSta(CalculationUtil.getBigDecimal(m.get("tSta") == null ? null : m.get("tSta").toString()));
-                    windTowerDataParentTable.setRhMax(CalculationUtil.getBigDecimal(m.get("rhMax") == null ? null : m.get("rhMax").toString()));
-                    windTowerDataParentTable.setRhMin(CalculationUtil.getBigDecimal(m.get("rhMin") == null ? null : m.get("rhMin").toString()));
-                    windTowerDataParentTable.setRhAve(CalculationUtil.getBigDecimal(m.get("rhAve") == null ? null : m.get("rhAve").toString()));
-                    windTowerDataParentTable.setRhSta(CalculationUtil.getBigDecimal(m.get("rhSta") == null ? null : m.get("rhSta").toString()));
-                    windTowerDataParentTable.setAbnormalData(m.get("abnormalData") == null ? null : m.get("abnormalData").toString());
-                    windTowerDataParentTable.setAbnormalType(m.get("abnormalType") == null ? null : m.get("abnormalType").toString());
-                    windTowerDataParentTableList.add(windTowerDataParentTable);
-                }
-            }
-
-        } catch (Exception e) {
-            log.error("组装数据异常");
-        }
-        this.dataSave(windTowerDataParentTableList, windTowerDataChildTableList, equipmentId, eTime, type);
-    }
-
-    /**
-     * 数据计算入库
-     *
-     * @param windTowerDataParentTableList 父表数据
-     * @param windTowerDataChildTableList  子表数据
-     * @param
-     */
-    private void dataSave(List<WindTowerDataParentTable> windTowerDataParentTableList, List<WindTowerDataChildTable> windTowerDataChildTableList, String equipmentId, String eTime, String type) {
-        //获取设备编号 006177_2022-03-28_00.00_000060.rld 006177为设备编号
-        //应该是文件的时间而不是系统时间
-        Date date = new Date();
-        if (type.equals("rld")) {
-            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
-            try {
-                date = simpleDateFormat.parse(eTime);
-            } catch (ParseException e) {
-                log.error("RLD转换文件名日期异常");
-            }
-        } else if (type.equals("sld")) {
-            SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmm");
-            try {
-                date = sdf.parse(eTime);
-            } catch (ParseException e) {
-                log.error("RWD转换文件名异常");
-            }
-        } else {
-            SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
-            try {
-                date = sdf.parse(eTime);
-            } catch (ParseException e) {
-                log.error("声雷达日期转换异常常");
-            }
-        }
-
-        try {
-            List<WindTowerDataParentTable> parentTableList = new ArrayList<>();
-            List<WindTowerDataParentTable> parentTableCollect = windTowerDataParentTableList.stream().sorted(Comparator.comparing(WindTowerDataParentTable::getTime)).collect(Collectors.toList());
-            List<Map<String, Object>> windTowerDataParentTables = selectDataByBetweenTimeAndEquipmetId(parentTableCollect.get(0).getTime(), parentTableCollect.get(parentTableCollect.size() - 1).getTime(), equipmentId);
-            List<String> parentIdList = new ArrayList<>();
-            if (!windTowerDataParentTables.isEmpty()) {
-                for (Map<String, Object> map : windTowerDataParentTables) {
-                    if (!map.get("id").toString().isEmpty()) {
-                        parentIdList.add(map.get("id").toString());
-                    }
-                }
-                windTowerDataChildTableService.deleteBetweenTimeAndEquipmentIdAndChild(parentIdList, equipmentId);
-                deleteBetweenTimeAndEquipmentIdAndParent(DateTimeUtil.getDayStartTime(date.getTime()), DateTimeUtil.getDayLastTime(date.getTime()), equipmentId);
-            }
-            for (WindTowerDataParentTable w : parentTableCollect) {
-                //计算空气密度  1.293*(273/(273+温度摄氏度))*气压百帕/1013
-                if (w.getTAve() != null && w.getPaAve() != null) {
-                    BigDecimal airDensity = BigDecimal.valueOf(1.293).multiply(new BigDecimal(273).divide(new BigDecimal(273).add(w.getTAve()), 2, RoundingMode.HALF_UP)).multiply(w.getPaAve()).divide(new BigDecimal(1013), 2, RoundingMode.HALF_UP);
-                    w.setAirDensity(airDensity);
-                }
-                w.setEquipmentId(equipmentId);
-                parentTableList.add(w);
-            }
-            saveBatchByEquipmentId(parentTableList, windTowerDataChildTableList, equipmentId);
-            AnalysisLog analysisLog = new AnalysisLog();
-            analysisLog.setStatus("1");
-            analysisLog.setTime(date);
-            analysisLog.setEquipmentId(equipmentId);
-            analysisLogService.save(analysisLog);
-        } catch (Exception e) {
-            log.error("数据入库失败" + e);
-            AnalysisLog analysisLog = new AnalysisLog();
-            analysisLog.setStatus("2");
-            analysisLog.setTime(date);
-            analysisLog.setEquipmentId(equipmentId);
-            analysisLogService.save(analysisLog);
-        }
-    }
-
-    /**
-     * 存多条数据
-     *
-     * @param windTowerDataParentTableList
-     * @param windTowerDataChildTableList
-     * @param equipmentId
-     */
-    public void saveBatchById(List<WindTowerDataParentTable> windTowerDataParentTableList, List<WindTowerDataChildTable> windTowerDataChildTableList, String equipmentId) {
-        Map<String, Object> map = new HashMap<>();
-        map.put("equipment_id", equipmentId);
-        RequestDataHelper.setRequestData(map);
-        windTowerDataChildTableService.saveBatchByEquipmentId(windTowerDataChildTableList, equipmentId);
-        this.saveBatch(windTowerDataParentTableList);
-    }
-
-
     //通道数据保存
     public void saveDataForTunnel(HashMap<String, BigDecimal> dataMap, HashSet<Integer> heightSet, String equipmentNo, String time) {
         Timestamp curentTimestamp = new Timestamp(DateUtil.parse(time).getTime());

+ 16 - 3
neim-biz/src/main/java/com/jiayue/biz/service/impl/WindTowerInfoServiceImpl.java

@@ -9,9 +9,11 @@ import com.jiayue.biz.domain.ProjectInfo;
 import com.jiayue.biz.domain.StatisticsSituation;
 import com.jiayue.biz.service.ProjectInfoService;
 import com.jiayue.biz.service.ProphaseWeatherDataService;
+import com.jiayue.biz.util.SortListUtil;
 import com.jiayue.common.core.redis.RedisCache;
 import com.jiayue.common.utils.DateUtil;
 import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.mongodb.core.MongoTemplate;
 import org.springframework.stereotype.Service;
@@ -33,6 +35,7 @@ import java.util.stream.Collectors;
  * @date 2022-05-11
  */
 @Service
+@Slf4j
 public class WindTowerInfoServiceImpl extends ServiceImpl<WindTowerInfoMapper, WindTowerInfo> implements WindTowerInfoService {
 
     @Autowired
@@ -126,15 +129,21 @@ public class WindTowerInfoServiceImpl extends ServiceImpl<WindTowerInfoMapper, W
         return page(page, wrapper);
     }
 
-    public List<Map<String, String>> listEquipmentIdAndDataTime() {
-        if (redisCache.getCacheObject("listEquipmentIdAndDataTime") != null) {
-            return redisCache.getCacheObject("listEquipmentIdAndDataTime");
+    public List<Map<String, String>> listEquipmentIdAndDataTime(boolean updateFlag) {
+        if ( !updateFlag ){
+            if(redisCache.getCacheObject("listEquipmentIdAndDataTime") != null ) {
+                log.info("从缓存中获取【listEquipmentIdAndDataTime】");
+                return redisCache.getCacheObject("listEquipmentIdAndDataTime");
+            }
         }
         //TODO韩雪峰  新建的塔没有统计概述的时候无法显示  需要考虑到这种情况
         List<WindTowerInfo> windTowerInfoList = this.list();
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
         List<Map<String, String>> mapList = new ArrayList<>();
         List<Map<String, String>> statusMapList = new ArrayList<>();
+
+        //List<Map<String, Long>> dataTimeStartAndEndAll = prophaseWeatherDataService.listAll();
+
         Map<String, Long> maps = new HashMap<>();
         for (WindTowerInfo windTowerInfo : windTowerInfoList) {
             Map<String, Long> dataTimeStartAndEnd = prophaseWeatherDataService.getDataTimeStartAndEnd(windTowerInfo.getEquipmentNo());
@@ -159,7 +168,11 @@ public class WindTowerInfoServiceImpl extends ServiceImpl<WindTowerInfoMapper, W
                 }
             }
         }
+
         Map<String, String> map;
+
+        SortListUtil<WindTowerInfo> sortList = new SortListUtil<WindTowerInfo>();
+        sortList.Sort(windTowerInfos, "getCreateTime", null);
         for (WindTowerInfo w : windTowerInfos) {
             map = new HashMap<>();
             map.put("value", w.getEquipmentNo());

+ 47 - 0
neim-biz/src/main/java/com/jiayue/biz/util/SortListUtil.java

@@ -0,0 +1,47 @@
+package com.jiayue.biz.util;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import org.apache.commons.lang3.StringUtils;
+
+/**
+ * @author hungteshun
+ * @description:
+ * @date 2018/11/31 22:23
+ */
+public class SortListUtil<E> {
+
+    public void Sort(List<E> list, final String method, final String order) {
+        Collections.sort(list, new Comparator<E>() {
+            @Override
+            public int compare(E o1, E o2) {
+                int ret = 0;
+                try {
+                    Method method1 = o1.getClass().getMethod(method, null);
+                    Method method2 = o2.getClass().getMethod(method, null);
+                    //倒序
+                    if (StringUtils.isNotEmpty(order) && "desc".equalsIgnoreCase(order)) {
+                        ret = method2.invoke(o2, null).toString().compareTo(method1.invoke(o1, null)
+                                .toString());
+                    }
+                    else {
+                        ret = method1.invoke(o1, null).toString()
+                                .compareTo(method2.invoke(o2, null).toString());
+                    }
+
+                } catch (NoSuchMethodException e) {
+                    e.printStackTrace();
+                } catch (IllegalAccessException e) {
+                    e.printStackTrace();
+                } catch (InvocationTargetException e) {
+                    e.printStackTrace();
+                }
+                return ret;
+            }
+        });
+    }
+}