From d2774a31e0b549f7900ff6472d0ed2d9b09f2ad5 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期四, 20 七月 2023 11:50:30 +0800 Subject: [PATCH] 1 --- src/main/java/com/yssh/service/WarningAnalyseService.java | 42 +++++++++++++++++++++++++----------------- 1 files changed, 25 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/yssh/service/WarningAnalyseService.java b/src/main/java/com/yssh/service/WarningAnalyseService.java index 05a9979..df01c61 100644 --- a/src/main/java/com/yssh/service/WarningAnalyseService.java +++ b/src/main/java/com/yssh/service/WarningAnalyseService.java @@ -1,13 +1,7 @@ package com.yssh.service; import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.concurrent.CountDownLatch; import com.yssh.entity.*; @@ -51,7 +45,7 @@ private QxshMapper qxshMapper; @Resource - private SuYuanService suYuanService; + private VocValsService vocValsService; private SimpleDateFormat ym = new SimpleDateFormat("yyyyMM%"); @@ -370,6 +364,7 @@ List<WarningDetail> rsBj = warningDetailMapper.selectByTimeForBj(startTime, endTime); if (null != rsBj && rsBj.size() > 0) rs.addAll(rsBj); + Hashtable<String, Boolean> dict = new Hashtable<>(); List<Report> list = new ArrayList<>(); for (WarningDetail wd : rs) { //String time = ymdh.format(wd.getCreateTime()); @@ -388,9 +383,12 @@ suMax = suYuan; }*/ - int rows = suYuanMapper.isTableExists(wd.getTableName()); - if (rows == 0) { - continue; + if (dict.containsKey(wd.getTableName())) { + if (!dict.get(wd.getTableName())) continue; + } else { + Boolean b = suYuanMapper.isTableExists(wd.getTableName()) > 0; + dict.put(wd.getTableName(), b); + if (!b) continue; } DistanceSuYuan suYuan = suYuanMapper.getSuYuanById(wd.getTableName(), wd.getSuYuanId()); @@ -399,12 +397,7 @@ MonitorPointPosition point = commonService.select3dCheckPointByName(wd.getLocationName()); List<String> ids3d = CalculateUtils.aloneCrosswiseExtend(point, 50); DistanceSuYuan suMax = suYuanMapper.getSuYuan500Max(wd.getTableName(), ids3d); - - String[] strs = suMax.getId().split("_"); - int x = Integer.parseInt(strs[0]) / 10; - int y = Integer.parseInt(strs[1]) / 10; - String addr = suYuanService.selectAddrByXY(x, y); - suMax.setAddr(addr); + suMax.setAddr(getAddr(suMax.getId())); Report report = Report.calcReport(wd, suYuan, suMax); report.setLastVal(lastVal); @@ -414,4 +407,19 @@ return list; } + + private String getAddr(String id) { + String[] strs = id.split("_"); + int x = Integer.parseInt(strs[0]) / 10; + int y = Integer.parseInt(strs[1]) / 10; + + List<VocCoords> list = vocValsService.selectCoords(x, y); + for (VocCoords vc : list) { + if (null != vc.getAddr() && vc.getAddr().length() > 0) { + return vc.getAddr(); + } + } + + return null; + } } -- Gitblit v1.9.3