燕山石化溯源三维电子沙盘-【后端】-服务
13693261870
2023-11-05 6e797b6bf65719823a20066f14344e180aff2e33
src/main/java/com/yssh/service/SuYuanService.java
@@ -47,6 +47,15 @@
   @Resource
   private LocationService locService;
   @Resource
   private AlertConfigMapper alertConfigMapper;
   private static HashMap<String, String> sites = new HashMap<>();
   public double getJcyj() {
      return alertConfigMapper.getAll().get(0).getJcyj();
   }
   //@Transactional
   @Async("threadPoolTaskExecutor")
   public void insertSuYuanDatasAsync(List<SuYuan> lists, String time) throws Exception {
@@ -103,7 +112,7 @@
   }
   public Map<String, Object> selectSuYuan100(String name, Date date) {
      Map<String, Object> result = new HashMap<String, Object>();
      Map<String, Object> result = new HashMap<>();
      MonitorPointPosition checkPoint = commonService.select3dCheckPointByName(name);
      if (StringUtils.isNull(checkPoint)) {
         return null;
@@ -115,6 +124,8 @@
      if (StringUtils.isNull(dictRecord)) {
         return null;
      }
      if (suYuanMapper.isTableExists(dictRecord.getTableName()) == 0) return null;
      List<DistanceSuYuan> list = suYuanMapper.getDistanceSuYuan(dictRecord.getTableName(), ids3d);
      AtomicInteger i = new AtomicInteger(0);
      list.stream().forEach(s -> {
@@ -147,6 +158,8 @@
      if (StringUtils.isNull(dictRecord)) {
         return null;
      }
      if (suYuanMapper.isTableExists(dictRecord.getTableName()) == 0) return null;
      List<DistanceSuYuan> list = suYuanMapper.getDistanceSuYuan(dictRecord.getTableName(), ids3d);
      AtomicInteger i = new AtomicInteger(0);
      list.stream().forEach(s -> {
@@ -179,6 +192,8 @@
      if (StringUtils.isNull(dictRecord)) {
         return null;
      }
      if (suYuanMapper.isTableExists(dictRecord.getTableName()) == 0) return null;
      List<DistanceSuYuan> list = suYuanMapper.getDistanceSuYuan(dictRecord.getTableName(), ids3d);
      AtomicInteger i = new AtomicInteger(0);
      list.stream().forEach(s -> {
@@ -199,7 +214,7 @@
   }
   public Map<String, Object> selectSuYuan500(String name, Date date) {
      Map<String, Object> result = new HashMap<String, Object>();
      Map<String, Object> result = new HashMap<>();
      MonitorPointPosition checkPoint = commonService.select3dCheckPointByName(name);
      if (StringUtils.isNull(checkPoint)) {
         return null;
@@ -211,6 +226,8 @@
      if (StringUtils.isNull(dictRecord)) {
         return null;
      }
      if (suYuanMapper.isTableExists(dictRecord.getTableName()) == 0) return null;
      List<DistanceSuYuan> list = suYuanMapper.getDistanceSuYuan(dictRecord.getTableName(), ids3d);
      AtomicInteger i = new AtomicInteger(0);
      list.stream().forEach(s -> {
@@ -298,16 +315,35 @@
   }
   public String selectAddrByXY(double x, double y) {
      // 1米=0.0000089932
      List<Location> locations = locationMapper.selectByXY(x, y);
      if (null != locations && locations.size() > 0) {
         return locations.get(0).getName();
      }
      locations = locService.selectVocAddrs(x, y);
      /*locations = locService.selectVocAddrs(x, y);
      if (null != locations && locations.size() > 0) {
         return locations.get(0).getName();
      }
      }*/
      return null;
   }
   public String selectSuYuanIdByName(String name) {
      if (sites.containsKey(name)) {
         return sites.get(name);
      }
      MonitorPointPosition mpp = commonService.select3dCheckPointByName(name);
      if (null == mpp) {
         return null;
      }
      String suYuanId = mpp.getId().substring(0, mpp.getId().lastIndexOf("_") + 1) + "0";
      if (!sites.containsKey(name)) {
         sites.put(name, suYuanId);
      }
      return suYuanId;
   }
}