From 99042da077ad98e38340f96cb03ffcf4d249ab87 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期五, 01 十一月 2024 13:49:21 +0800
Subject: [PATCH] 1

---
 src/main/java/com/yssh/service/SuYuanService.java |   26 ++++++++++++++++++++++----
 1 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/src/main/java/com/yssh/service/SuYuanService.java b/src/main/java/com/yssh/service/SuYuanService.java
index 19675b8..0ff00b8 100644
--- a/src/main/java/com/yssh/service/SuYuanService.java
+++ b/src/main/java/com/yssh/service/SuYuanService.java
@@ -126,7 +126,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 +146,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 +175,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 +210,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 +245,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());

--
Gitblit v1.9.3