From 84a874883f190fb8022382ff591e50b5bb049690 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期三, 06 十一月 2024 16:50:16 +0800
Subject: [PATCH] 1

---
 src/main/java/com/se/simu/helper/ShpHelper.java           |    2 +-
 src/main/java/com/se/simu/controller/WaterController.java |    9 ++++++---
 src/main/java/com/se/simu/domain/vo/PondingVo.java        |   42 ++++++++++++++++++++++++++++++++++++++++++
 src/main/java/com/se/simu/service/WaterService.java       |    4 ++++
 4 files changed, 53 insertions(+), 4 deletions(-)

diff --git a/src/main/java/com/se/simu/controller/WaterController.java b/src/main/java/com/se/simu/controller/WaterController.java
index 4befa5a..4df2535 100644
--- a/src/main/java/com/se/simu/controller/WaterController.java
+++ b/src/main/java/com/se/simu/controller/WaterController.java
@@ -1,6 +1,7 @@
 package com.se.simu.controller;
 
 import com.se.simu.domain.po.SimuPo;
+import com.se.simu.domain.vo.PondingVo;
 import com.se.simu.domain.vo.R;
 import com.se.simu.helper.StringHelper;
 import com.se.simu.helper.WebHelper;
@@ -153,15 +154,17 @@
             @ApiImplicitParam(name = "timestamp", value = "鏃堕棿鎴�", dataType = "long", paramType = "query", example = "1730217660000")
     })
     @GetMapping("/{serviceName}/getWaterHeight")
-    public R<Double> getWaterHeight(@PathVariable String serviceName, double x, double y, long timestamp, HttpServletResponse res) {
+    public R<Object> getWaterHeight(@PathVariable String serviceName, double x, double y, long timestamp, HttpServletResponse res) {
         try {
             SimuPo simu = simuService.getSimuByServiceName(serviceName);
             if (null == simu) {
                 return null;
             }
 
-            // 鏍规嵁鏈嶅姟鍚�+鏃堕棿鎴�+鍧愭爣锛屾煡璇㈠搴旂殑绉按娣卞害
-            return success(waterService.getWaterHeight(simu, x, y, timestamp));
+            Double depth = waterService.getWaterHeight(simu, x, y, timestamp);
+            Double area = waterService.getWaterArea(simu, x, y, timestamp);
+
+            return success(new PondingVo(depth, area));
         } catch (Exception ex) {
             log.error(ex.getMessage(), ex);
             return fail(ex);
diff --git a/src/main/java/com/se/simu/domain/vo/PondingVo.java b/src/main/java/com/se/simu/domain/vo/PondingVo.java
new file mode 100644
index 0000000..7c484d2
--- /dev/null
+++ b/src/main/java/com/se/simu/domain/vo/PondingVo.java
@@ -0,0 +1,42 @@
+package com.se.simu.domain.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * 绉按瑙嗗浘绫�
+ *
+ * @author WWW
+ * @date 2024-11-06
+ */
+@SuppressWarnings("ALL")
+public class PondingVo {
+    @ApiModelProperty("绉按娣卞害")
+    private Double depth;
+
+    @ApiModelProperty("绉按闈㈢Н")
+    private Double area;
+
+    public PondingVo() {
+    }
+
+    public PondingVo(Double depth, Double area) {
+        this.depth = depth;
+        this.area = area;
+    }
+
+    public Double getDepth() {
+        return depth;
+    }
+
+    public void setDepth(Double depth) {
+        this.depth = depth;
+    }
+
+    public Double getArea() {
+        return area;
+    }
+
+    public void setArea(Double area) {
+        this.area = area;
+    }
+}
diff --git a/src/main/java/com/se/simu/helper/ShpHelper.java b/src/main/java/com/se/simu/helper/ShpHelper.java
index fb31cef..c3031a2 100644
--- a/src/main/java/com/se/simu/helper/ShpHelper.java
+++ b/src/main/java/com/se/simu/helper/ShpHelper.java
@@ -342,7 +342,7 @@
             dataSource = driver.CreateDataSource(filePath, null);
             if (null == dataSource) return false;
 
-            layer = dataSource.CreateLayer(FileUtil.getName(filePath), ds.GetSpatialRef(), ogr.wkbPolygon, getOptions());
+            layer = dataSource.CreateLayer(FileUtil.getName(filePath), ds.GetSpatialRef(), ogr.wkbPolygon);
             if (null == layer) return false;
 
             layer.CreateField(new FieldDefn("val", ogr.OFTReal));
diff --git a/src/main/java/com/se/simu/service/WaterService.java b/src/main/java/com/se/simu/service/WaterService.java
index 3f38e8d..06318fa 100644
--- a/src/main/java/com/se/simu/service/WaterService.java
+++ b/src/main/java/com/se/simu/service/WaterService.java
@@ -171,6 +171,10 @@
         return !Double.isNaN(val) && val > Integer.MIN_VALUE;
     }
 
+    public Double getWaterArea(SimuPo simu, double x, double y, Long timestamp) {
+        return null;
+    }
+
     public List<BuildingDepthVo> getBuildingDepthBySeid(String serviceName, String seid) {
         List<BuildingDepthVo> list = readBuildingJson(serviceName);
         if (CollectionUtils.isEmpty(list)) return null;

--
Gitblit v1.9.3