From 049e8125cd972b564c20dcdc153dfec55b6ae810 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期三, 28 十二月 2022 15:54:57 +0800
Subject: [PATCH] 12.28

---
 src/main/java/com/lf/server/controller/show/ApplyController.java    |    2 
 src/main/java/com/lf/server/mapper/show/PipelineMapper.java         |   31 +++++
 data/ts.sql                                                         |   36 ++++++
 src/main/java/com/lf/server/entity/all/StaticData.java              |    5 
 src/main/java/com/lf/server/entity/show/PipelineEntity.java         |  123 ++++++++++++++++++++
 说明.txt                                                              |    1 
 src/main/java/com/lf/server/service/show/PipelineService.java       |   28 ++++
 src/main/java/com/lf/server/controller/show/PipelineController.java |   85 ++++++++++++++
 src/main/resources/mapper/show/PipelineMapper.xml                   |   15 ++
 9 files changed, 325 insertions(+), 1 deletions(-)

diff --git a/data/ts.sql b/data/ts.sql
index f06fef8..14f8583 100644
--- a/data/ts.sql
+++ b/data/ts.sql
@@ -97,6 +97,42 @@
 from lf.sys_user a inner join lf.sys_role_user b on a.id = b.userid inner join lf.sys_role c on b.roleid = c.id
 where c.id = 15
 
+select *, st_astext(geom) as wkt from bs.m_pipesegment;
+select * from bs.m_pipesegment;
+select gid, pipename, segname from bs.m_pipesegment order by pipename, segname;
+
+select * from bd.dlg_25w_hydl;
+select * from bd.dlg_25w_lrdl;
+select * from bd.dlg_25w_lrrl;
+select * from bd.dlg_25w_hyda;
+
+SELECT a.name as acrossName,
+	   b.segname as segName,
+	   b.remarks,
+	   b.pipename as pipeName,
+	   st_length( st_geographyfromtext( st_astext( st_intersection( ST_MakeValid(a.geom), ST_MakeValid(b.geom) ) ) ) ) AS acrossLength,
+	   st_astext(b.geom) as wkt
+FROM bd.dlg_25w_hyda AS a,
+	 (SELECT *
+	  FROM bs.m_pipesegment
+	  WHERE segname = 'DD' ) AS b
+WHERE ST_Intersects(a.geom, b.geom)
+
+select a.name as acrossName, b.segname as segName, b.remarks, b.pipename as pipeName,
+  cast( st_length( st_geographyfromtext( st_astext( st_intersection(ST_MakeValid(a.geom), ST_MakeValid(b.geom) ) ) ) ) as decimal(12, 3) ) AS acrossLength,
+  st_astext( st_intersection( ST_MakeValid(a.geom), ST_MakeValid(b.geom) ) ) as wkt
+from bd.dlg_25w_hyda as a, (select segname, remarks, pipename, geom from bs.m_pipesegment where gid = 24) as b
+where ST_Intersects(a.geom, b.geom)
+
+
+
+
+
+
+
+
+
+
 
 
 
diff --git a/src/main/java/com/lf/server/controller/show/ApplyController.java b/src/main/java/com/lf/server/controller/show/ApplyController.java
index 612d6c7..549ba52 100644
--- a/src/main/java/com/lf/server/controller/show/ApplyController.java
+++ b/src/main/java/com/lf/server/controller/show/ApplyController.java
@@ -28,7 +28,7 @@
  * 鏁版嵁鐢宠
  * @author WWW
  */
-@Api(tags = "杩愮淮绠$悊\\鏁版嵁鐢宠")
+@Api(tags = "缁煎悎灞曠ず\\鏁版嵁鐢宠")
 @RestController
 @RequestMapping("/apply")
 public class ApplyController extends BaseController {
diff --git a/src/main/java/com/lf/server/controller/show/PipelineController.java b/src/main/java/com/lf/server/controller/show/PipelineController.java
new file mode 100644
index 0000000..51aa1ff
--- /dev/null
+++ b/src/main/java/com/lf/server/controller/show/PipelineController.java
@@ -0,0 +1,85 @@
+package com.lf.server.controller.show;
+
+import com.lf.server.annotation.SysLog;
+import com.lf.server.controller.all.BaseController;
+import com.lf.server.entity.all.ResponseMsg;
+import com.lf.server.entity.all.StaticData;
+import com.lf.server.entity.show.PipelineEntity;
+import com.lf.server.service.show.PipelineService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.*;
+
+/**
+ * 绠¢亾鍒嗘瀽
+ * @author WWW
+ */
+@Api(tags = "缁煎悎灞曠ず\\绠¢亾鍒嗘瀽")
+@RestController
+@RequestMapping("/pipeline")
+public class PipelineController extends BaseController {
+    @Autowired
+    PipelineService pipelineService;
+
+    @SysLog()
+    @ApiOperation(value = "鏌ヨ绠℃")
+    @GetMapping(value = "/selectSegNames")
+    public ResponseMsg<Object> selectSegNames() {
+        try {
+            List<PipelineEntity> rs = pipelineService.selectSegNames();
+
+            return success(rs);
+        } catch (Exception ex) {
+            return fail(ex.getMessage(), null);
+        }
+    }
+
+    @SysLog()
+    @ApiOperation(value = "鏌ヨ绠$嚎鍒嗘瀽")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "pe", value = "绠¢亾鍒嗘瀽瀹炰綋绫�", dataType = "PipelineEntity", paramType = "body")
+    })
+    @ResponseBody
+    @PostMapping(value = "/selectPipeAnalysis")
+    public ResponseMsg<Object> selectPipeAnalysis(@RequestBody PipelineEntity pe) {
+        try {
+            if (null == pe.getGid() || pe.getGid() < 1) {
+                return fail("璇疯緭鍏ョ娈礗D");
+            }
+            if (null == pe.getTabs() || 0 == pe.getTabs().size()) {
+                return fail("璇疯緭鍏ヨ〃鍚�");
+            }
+            if (!checkTabs(pe.getTabs())) {
+                return fail("瀛樺湪闈炴硶琛ㄥ悕");
+            }
+
+            Map<String, Object> map = new HashMap<>();
+            for (String tab : pe.getTabs()) {
+                List<PipelineEntity> rs = pipelineService.selectPipeAnalysis(tab, pe.getGid());
+                map.put(tab, rs);
+            }
+
+            return success(map);
+        } catch (Exception ex) {
+            return fail(ex.getMessage(), null);
+        }
+    }
+
+    /**
+     * 妫�鏌ヨ〃鍚�
+     */
+    private boolean checkTabs(List<String> tabs) {
+        for (String tab : tabs) {
+            if (!StaticData.PIPE_ANALYSIS_TABS.contains(tab)) {
+                return false;
+            }
+        }
+
+        return true;
+    }
+}
diff --git a/src/main/java/com/lf/server/entity/all/StaticData.java b/src/main/java/com/lf/server/entity/all/StaticData.java
index c74a5d4..1148623 100644
--- a/src/main/java/com/lf/server/entity/all/StaticData.java
+++ b/src/main/java/com/lf/server/entity/all/StaticData.java
@@ -103,4 +103,9 @@
      * GDB鎺掗櫎瀛楁
      */
     public final static List<String> GDB_EXCLUDE_FIELDS = new ArrayList<>(Arrays.asList("geom", "objectid", "shape_leng", "shape_area", "serialVersionUID", "dirName", "depName", "verName", "createName", "updateName"));
+
+    /**
+     * 绠$嚎鍒嗘瀽琛ㄥ悕闆嗗悎
+     */
+    public final static List<String> PIPE_ANALYSIS_TABS = new ArrayList<>(Arrays.asList("bd.dlg_25w_hydl", "bd.dlg_25w_lrdl", "bd.dlg_25w_lrrl", "bd.dlg_25w_hyda"));
 }
diff --git a/src/main/java/com/lf/server/entity/show/PipelineEntity.java b/src/main/java/com/lf/server/entity/show/PipelineEntity.java
new file mode 100644
index 0000000..b30de8c
--- /dev/null
+++ b/src/main/java/com/lf/server/entity/show/PipelineEntity.java
@@ -0,0 +1,123 @@
+package com.lf.server.entity.show;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 绠¢亾鍒嗘瀽瀹炰綋绫�
+ *
+ * @author xingjinshuang@smartearth.cn
+ * @date 2022/12/26
+ */
+public class PipelineEntity implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 琛ㄥ悕
+     */
+    @JSONField(serialize = false)
+    @JsonInclude(JsonInclude.Include.NON_NULL)
+    private List<String> tabs;
+
+    /**
+     * 涓婚敭ID
+     */
+    private Integer gid;
+
+    /**
+     * 绠$嚎
+     */
+    private String pipeName;
+
+    /**
+     * 绠℃
+     */
+    private String segName;
+
+    /**
+     * 绌胯秺鍚嶇О
+     */
+    private String acrossName;
+
+    /**
+     * 绌胯秺闀垮害
+     */
+    private double acrossLength;
+
+    /**
+     * 澶囨敞
+     */
+    private String remarks;
+
+    /**
+     * wkt
+     */
+    private String wkt;
+
+    public Integer getGid() {
+        return gid;
+    }
+
+    public void setGid(Integer gid) {
+        this.gid = gid;
+    }
+
+    public List<String> getTabs() {
+        return tabs;
+    }
+
+    public void setTabs(List<String> tabs) {
+        this.tabs = tabs;
+    }
+
+    public String getPipeName() {
+        return pipeName;
+    }
+
+    public void setPipeName(String pipeName) {
+        this.pipeName = pipeName;
+    }
+
+    public String getSegName() {
+        return segName;
+    }
+
+    public void setSegName(String segName) {
+        this.segName = segName;
+    }
+
+    public String getAcrossName() {
+        return acrossName;
+    }
+
+    public void setAcrossName(String acrossName) {
+        this.acrossName = acrossName;
+    }
+
+    public double getAcrossLength() {
+        return acrossLength;
+    }
+
+    public void setAcrossLength(double acrossLength) {
+        this.acrossLength = acrossLength;
+    }
+
+    public String getRemarks() {
+        return remarks;
+    }
+
+    public void setRemarks(String remarks) {
+        this.remarks = remarks;
+    }
+
+    public String getWkt() {
+        return wkt;
+    }
+
+    public void setWkt(String wkt) {
+        this.wkt = wkt;
+    }
+}
diff --git a/src/main/java/com/lf/server/mapper/show/PipelineMapper.java b/src/main/java/com/lf/server/mapper/show/PipelineMapper.java
new file mode 100644
index 0000000..ff9975e
--- /dev/null
+++ b/src/main/java/com/lf/server/mapper/show/PipelineMapper.java
@@ -0,0 +1,31 @@
+package com.lf.server.mapper.show;
+
+import com.lf.server.entity.show.PipelineEntity;
+import org.apache.ibatis.annotations.Mapper;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+/**
+ * 绠¢亾鍒嗘瀽鏄犲皠绫�
+ * @author WWW
+ */
+@Mapper
+@Repository
+public interface PipelineMapper {
+    /**
+     * 鏌ヨ绠℃
+     *
+     * @return 绠$嚎瀹炰綋绫婚泦鍚�
+     */
+    public List<PipelineEntity> selectSegNames();
+
+    /**
+     * 鏌ヨ绠$嚎鍒嗘瀽
+     *
+     * @param tab 琛ㄥ悕
+     * @param gid ID
+     * @return 绠$嚎瀹炰綋绫婚泦鍚�
+     */
+    public List<PipelineEntity> selectPipeAnalysis(String tab, Integer gid);
+}
diff --git a/src/main/java/com/lf/server/service/show/PipelineService.java b/src/main/java/com/lf/server/service/show/PipelineService.java
new file mode 100644
index 0000000..387cfb1
--- /dev/null
+++ b/src/main/java/com/lf/server/service/show/PipelineService.java
@@ -0,0 +1,28 @@
+package com.lf.server.service.show;
+
+import com.lf.server.entity.show.PipelineEntity;
+import com.lf.server.mapper.show.PipelineMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 绠¢亾鍒嗘瀽鏈嶅姟绫�
+ * @author WWW
+ */
+@Service
+public class PipelineService implements PipelineMapper {
+    @Autowired
+    PipelineMapper pipelineMapper;
+
+    @Override
+    public List<PipelineEntity> selectSegNames() {
+        return pipelineMapper.selectSegNames();
+    }
+
+    @Override
+    public List<PipelineEntity> selectPipeAnalysis(String tab, Integer gid) {
+        return pipelineMapper.selectPipeAnalysis(tab, gid);
+    }
+}
diff --git a/src/main/resources/mapper/show/PipelineMapper.xml b/src/main/resources/mapper/show/PipelineMapper.xml
new file mode 100644
index 0000000..9b6abe1
--- /dev/null
+++ b/src/main/resources/mapper/show/PipelineMapper.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.lf.server.mapper.show.PipelineMapper">
+    <select id="selectSegNames" resultType="com.lf.server.entity.show.PipelineEntity">
+        select gid, pipename, segname from bs.m_pipesegment order by pipename, segname;
+    </select>
+
+    <select id="selectPipeAnalysis" resultType="com.lf.server.entity.show.PipelineEntity">
+        select a.name as acrossName, b.segname as segName, b.remarks, b.pipename as pipeName,
+            cast( st_length( st_geographyfromtext( st_astext( st_intersection(ST_MakeValid(a.geom), ST_MakeValid(b.geom) ) ) ) ) as decimal(12, 2) ) AS acrossLength,
+            st_astext( st_intersection( ST_MakeValid(a.geom), ST_MakeValid(b.geom) ) ) as wkt
+        from ${tab} as a, (select segname, remarks, pipename, geom from bs.m_pipesegment where gid = #{gid} ) as b
+        where ST_Intersects(a.geom, b.geom)
+    </select>
+</mapper>
\ No newline at end of file
diff --git "a/\350\257\264\346\230\216.txt" "b/\350\257\264\346\230\216.txt"
index f2beeff..248a200 100644
--- "a/\350\257\264\346\230\216.txt"
+++ "b/\350\257\264\346\230\216.txt"
@@ -60,6 +60,7 @@
 http://192.168.20.39:12306/
 http://192.168.20.39:12315/
 http://192.168.20.39:12316/
+http://192.168.20.39:12316/server/druid/sql.html
 -------------------------------------------------------------------------------
 String path = System.getProperty("user.dir");
 String uid = RsaHelper.decrypt(user.getUid());

--
Gitblit v1.9.3