From 2f55cebbad3dea187a5f91d16ec80a9677dab699 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期三, 13 十一月 2024 11:16:53 +0800 Subject: [PATCH] 1 --- src/main/java/com/yssh/service/SuYuanService.java | 32 +++++++++++++++++++++++--------- 1 files changed, 23 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/yssh/service/SuYuanService.java b/src/main/java/com/yssh/service/SuYuanService.java index 842f249..e3bcddf 100644 --- a/src/main/java/com/yssh/service/SuYuanService.java +++ b/src/main/java/com/yssh/service/SuYuanService.java @@ -59,7 +59,6 @@ //@Transactional @Async("threadPoolTaskExecutor") public void insertSuYuanDatasAsync(List<SuYuan> lists, String time) throws Exception { - //鎻掑叆鏁版嵁 List<List<SuYuan>> list = Lists.partition(lists, AsyncService.BATCH_INSERT_NUMBER); CountDownLatch countDownLatch = new CountDownLatch(list.size()); for (List<SuYuan> corpReserveList : list) { @@ -126,7 +125,8 @@ } if (suYuanMapper.isTableExists(dictRecord.getTableName()) == 0) return null; - List<DistanceSuYuan> list = suYuanMapper.getDistanceSuYuan(dictRecord.getTableName(), ids3d); + List<DistanceSuYuan> source = suYuanMapper.getDistanceSuYuan(dictRecord.getTableName(), ids3d); + List<DistanceSuYuan> list = getList(ids3d, source); AtomicInteger i = new AtomicInteger(0); list.stream().forEach(s -> { s.setName(checkPoint.getName()); @@ -145,6 +145,20 @@ return result; } + private List<DistanceSuYuan> getList(List<String> ids3d, List<DistanceSuYuan> source) { + List<DistanceSuYuan> list = new ArrayList<>(); + for (String id : ids3d) { + DistanceSuYuan suYuan = source.stream().filter(db -> id.equals(db.getId())).findFirst().orElse(null); + if (null == suYuan) { + String[] strs = id.split("_"); + suYuan = new DistanceSuYuan(null, null, 0.0, id, Integer.parseInt(strs[0]), Integer.parseInt(strs[1]), 0, 0, null, 0.0, 0.0, 0.0, 0.0); + } + list.add(suYuan); + } + + return list; + } + public Map<String, Object> selectSuYuan200(String name, Date date) { Map<String, Object> result = new HashMap<String, Object>(); MonitorPointPosition checkPoint = commonService.select3dCheckPointByName(name); @@ -160,7 +174,8 @@ } if (suYuanMapper.isTableExists(dictRecord.getTableName()) == 0) return null; - List<DistanceSuYuan> list = suYuanMapper.getDistanceSuYuan(dictRecord.getTableName(), ids3d); + List<DistanceSuYuan> source = suYuanMapper.getDistanceSuYuan(dictRecord.getTableName(), ids3d); + List<DistanceSuYuan> list = getList(ids3d, source); AtomicInteger i = new AtomicInteger(0); list.stream().forEach(s -> { s.setName(checkPoint.getName()); @@ -194,7 +209,8 @@ } if (suYuanMapper.isTableExists(dictRecord.getTableName()) == 0) return null; - List<DistanceSuYuan> list = suYuanMapper.getDistanceSuYuan(dictRecord.getTableName(), ids3d); + List<DistanceSuYuan> source = suYuanMapper.getDistanceSuYuan(dictRecord.getTableName(), ids3d); + List<DistanceSuYuan> list = getList(ids3d, source); AtomicInteger i = new AtomicInteger(0); list.stream().forEach(s -> { s.setName(checkPoint.getName()); @@ -228,7 +244,8 @@ } if (suYuanMapper.isTableExists(dictRecord.getTableName()) == 0) return null; - List<DistanceSuYuan> list = suYuanMapper.getDistanceSuYuan(dictRecord.getTableName(), ids3d); + List<DistanceSuYuan> source = suYuanMapper.getDistanceSuYuan(dictRecord.getTableName(), ids3d); + List<DistanceSuYuan> list = getList(ids3d, source); AtomicInteger i = new AtomicInteger(0); list.stream().forEach(s -> { s.setName(checkPoint.getName()); @@ -272,7 +289,7 @@ calendar.add(Calendar.DATE, -7); String start = DateUtils.getYyyyMmDdHh(calendar.getTime()); - return suYuanMapper.getNewMonitorData(checkPoint.getName(), start, end); + return qxshMapper.getNewMonitorData(checkPoint.getName(), start, end); } public int updateVocsName(Date date, String id, String vocsName) { @@ -347,9 +364,6 @@ return suYuanId; } - /** - * 鏍规嵁ID鏌ヨ蹇�熸函婧� - */ public List<SuYuanFast> selectFastById(String id, Date date) { String time = DateUtils.getYyyyMmDdHhMmSs(date); -- Gitblit v1.9.3