diff --git a/pom.xml b/pom.xml
index 4c7c43e..531652f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -40,6 +40,7 @@
2.1.3
4.5.13
0.4.8
+ 1.2.83
@@ -73,6 +74,13 @@
import
+
+
+ com.alibaba
+ fastjson
+ ${fastjson.version}
+
+
ch.qos.logback
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/gis/GisMapController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/gis/GisMapController.java
new file mode 100644
index 0000000..f9ff91a
--- /dev/null
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/gis/GisMapController.java
@@ -0,0 +1,95 @@
+package com.ruoyi.web.controller.gis;
+
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.system.domain.SysGis;
+import com.ruoyi.system.service.ISysGisService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+/**
+ * GIS
+ * @author zhangzl
+ */
+@Slf4j
+@Controller
+@RequestMapping("/gis/map")
+public class GisMapController extends BaseController {
+
+ @Autowired
+ private ISysGisService gisService;
+
+
+ /**
+ * 坐标点 更新 通用
+ */
+ @Log(title = "GIS", businessType = BusinessType.UPDATE)
+ @PostMapping("/point/do")
+ @ResponseBody
+ public AjaxResult pointSave(SysGis gis) {
+ return toAjax(gisService.updateGeomByPoint(gis));
+ }
+
+ /**
+ * 坐标点 更新 通用 - 自己指定主键ID
+ */
+ @Log(title = "GIS", businessType = BusinessType.UPDATE)
+ @PostMapping("/point/private/do")
+ @ResponseBody
+ public AjaxResult pointSavePri(SysGis gis) {
+ return toAjax(gisService.updateGeomByPointPri(gis));
+ }
+
+
+ /**
+ * 多边形面 更新 通用
+ */
+ @Log(title = "GIS", businessType = BusinessType.UPDATE)
+ @PostMapping("/polygon/do")
+ @ResponseBody
+ public AjaxResult areaSave(SysGis gis) {
+ return toAjax(gisService.updateGeomByPolygon(gis));
+ }
+
+
+ /**
+ * 多边形面 更新 通用 - 自己指定主键ID
+ */
+ @Log(title = "GIS", businessType = BusinessType.UPDATE)
+ @PostMapping("/polygon/private/do")
+ @ResponseBody
+ public AjaxResult areaSavePri(SysGis gis) {
+ return toAjax(gisService.updateGeomByPolygonPri(gis));
+ }
+
+
+ /**
+ * 清空 geo 通用
+ */
+ @Log(title = "GIS", businessType = BusinessType.UPDATE)
+ @PostMapping("/clean/do")
+ @ResponseBody
+ public AjaxResult cleanSave(SysGis gis) {
+ return toAjax(gisService.cleanGeomById(gis));
+ }
+
+
+ /**
+ * 清空 geo 通用 - 自己指定主键ID
+ */
+ @Log(title = "GIS", businessType = BusinessType.UPDATE)
+ @PostMapping("/clean/private/do")
+ @ResponseBody
+ public AjaxResult cleanSavePri(SysGis gis) {
+ return toAjax(gisService.cleanGeomByIdPri(gis));
+ }
+
+
+
+}
diff --git a/ruoyi-system/pom.xml b/ruoyi-system/pom.xml
index f514d3d..310f29b 100644
--- a/ruoyi-system/pom.xml
+++ b/ruoyi-system/pom.xml
@@ -23,6 +23,12 @@
ruoyi-common
+
+
+ com.alibaba
+ fastjson
+
+
-
\ No newline at end of file
+
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysGis.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysGis.java
new file mode 100644
index 0000000..bd8fc49
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysGis.java
@@ -0,0 +1,32 @@
+package com.ruoyi.system.domain;
+
+import lombok.Data;
+
+/**
+ * gis
+ * @author zhangzl
+ *
+ */
+@Data
+public class SysGis {
+
+ private static final long serialVersionUID = 1L;
+
+ private Long id;
+
+ private String priId;
+
+ private String tableName;
+
+ private String itemName;
+
+ /** 经度 */
+ private String longitude;
+
+ /** 纬度 */
+ private String latitude;
+
+
+ private String theGeom;
+
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/gis/GeoPoint.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/gis/GeoPoint.java
new file mode 100644
index 0000000..108d920
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/gis/GeoPoint.java
@@ -0,0 +1,20 @@
+package com.ruoyi.system.domain.gis;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * gis
+ * @author zhangzl
+ *
+ */
+@Data
+public class GeoPoint {
+
+ private static final long serialVersionUID = 1L;
+
+ private List pointList;
+
+
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/gis/Geometry.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/gis/Geometry.java
new file mode 100644
index 0000000..359f2d6
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/gis/Geometry.java
@@ -0,0 +1,28 @@
+package com.ruoyi.system.domain.gis;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * gis
+ * @author zhangzl
+ *
+ */
+@Data
+public class Geometry {
+
+
+ private Long id;
+
+ private String tableName;
+
+ private String itemName;
+
+
+ private String type;
+
+ private List points;
+
+
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/gis/GeometryArea.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/gis/GeometryArea.java
new file mode 100644
index 0000000..57d9712
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/gis/GeometryArea.java
@@ -0,0 +1,20 @@
+package com.ruoyi.system.domain.gis;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * gis
+ * @author zhangzl
+ *
+ */
+@Data
+public class GeometryArea {
+
+ private String type;
+
+ private List>> coordinates;
+
+
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/gis/GeometryPoint.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/gis/GeometryPoint.java
new file mode 100644
index 0000000..f0b399c
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/gis/GeometryPoint.java
@@ -0,0 +1,17 @@
+package com.ruoyi.system.domain.gis;
+
+import lombok.Data;
+
+/**
+ * gis
+ * @author zhangzl
+ *
+ */
+@Data
+public class GeometryPoint {
+
+ private String type;
+
+ private String[] coordinates;
+
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/gis/Point.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/gis/Point.java
new file mode 100644
index 0000000..02426e2
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/gis/Point.java
@@ -0,0 +1,30 @@
+package com.ruoyi.system.domain.gis;
+
+import lombok.Data;
+
+/**
+ * gis
+ * @author zhangzl
+ *
+ */
+@Data
+public class Point {
+
+ private static final long serialVersionUID = 1L;
+
+ /** 经度 */
+ private String longitude;
+
+ /** 纬度 */
+ private String latitude;
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ Point point = (Point) obj;
+ return longitude == point.longitude && latitude == point.latitude;
+ }
+
+
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/gis/Polygon.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/gis/Polygon.java
new file mode 100644
index 0000000..28b1ea5
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/gis/Polygon.java
@@ -0,0 +1,22 @@
+package com.ruoyi.system.domain.gis;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @description: 面
+ * @author: zhangzl
+ *
+ */
+@Data
+public class Polygon {
+
+ private Long id;
+
+ private String deptName;
+
+ private String point;
+
+ private List points;
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysGisMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysGisMapper.java
new file mode 100644
index 0000000..980ef2c
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysGisMapper.java
@@ -0,0 +1,28 @@
+package com.ruoyi.system.mapper;
+
+import com.ruoyi.system.domain.SysGis;
+
+/**
+ * gis 数据层
+ *
+ * @author zhagnzl
+ */
+public interface SysGisMapper {
+
+ public int updateGeomByPoint(SysGis gis);
+
+ public int updateGeomByPointPri(SysGis gis);
+
+
+ public int updateGeomByPolygon(SysGis gis);
+
+ public int updateGeomByPolygonPri(SysGis gis);
+
+
+ public int cleanGeomById(SysGis gis);
+
+ public int cleanGeomByIdPri(SysGis gis);
+
+
+}
+
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysGisService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysGisService.java
new file mode 100644
index 0000000..78b8d1e
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysGisService.java
@@ -0,0 +1,27 @@
+package com.ruoyi.system.service;
+
+import com.ruoyi.system.domain.SysGis;
+
+/**
+ * gis 业务层
+ * @author zhagnzl
+ */
+public interface ISysGisService {
+
+
+ public int updateGeomByPoint(SysGis gis);
+
+ public int updateGeomByPointPri(SysGis gis);
+
+
+ public int updateGeomByPolygon(SysGis gis);
+
+ public int updateGeomByPolygonPri(SysGis gis);
+
+
+ public int cleanGeomById(SysGis gis);
+
+ public int cleanGeomByIdPri(SysGis gis);
+
+
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysGsiServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysGsiServiceImpl.java
new file mode 100644
index 0000000..bcea702
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysGsiServiceImpl.java
@@ -0,0 +1,106 @@
+package com.ruoyi.system.service.impl;
+
+import com.alibaba.fastjson.JSON;
+import com.ruoyi.system.domain.SysGis;
+import com.ruoyi.system.domain.gis.Point;
+import com.ruoyi.system.mapper.SysGisMapper;
+import com.ruoyi.system.service.ISysGisService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * gis 业务层处理
+ *
+ * @author zhagnzl
+ */
+@Service
+public class SysGsiServiceImpl implements ISysGisService {
+
+ @Autowired
+ private SysGisMapper gisMapper;
+
+ @Override
+ public int updateGeomByPoint(SysGis gis) {
+ return gisMapper.updateGeomByPoint(gis);
+ }
+
+ @Override
+ public int updateGeomByPointPri(SysGis gis) {
+ return gisMapper.updateGeomByPointPri(gis);
+ }
+
+ @Override
+ public int updateGeomByPolygon(SysGis gis) {
+ StringBuilder sb = new StringBuilder();
+ sb.append("MULTIPOLYGON(((");
+
+ //ObjectMapper mapper = new ObjectMapper();
+ try {
+ String theGeom = gis.getTheGeom();
+ //GeoPoint gp = mapper.readValue(theGeom, GeoPoint.class);
+ List pointList = JSON.parseArray(theGeom, Point.class);
+ //pointList.remove(pointList.size()-1);
+ // 检查第一个点和最后一个点是否相同
+ if (!pointList.get(0).equals(pointList.get(pointList.size() - 1))) {
+ // 如果不相同,添加第一个点作为最后一个点来闭合多边形
+ pointList.add(pointList.get(0));
+ }
+ pointList.forEach(p -> {
+ sb.append(p.getLongitude());
+ sb.append(" ");
+ sb.append(p.getLatitude());
+ sb.append(",");
+ });
+ sb.setLength(sb.length() - 1);
+ sb.append(")))");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ gis.setTheGeom(sb.toString());
+ return gisMapper.updateGeomByPolygon(gis);
+ }
+
+ @Override
+ public int updateGeomByPolygonPri(SysGis gis) {
+
+ StringBuilder sb = new StringBuilder();
+ sb.append("MULTIPOLYGON(((");
+
+ //ObjectMapper mapper = new ObjectMapper();
+ try {
+ String theGeom = gis.getTheGeom();
+ //GeoPoint gp = mapper.readValue(theGeom, GeoPoint.class);
+ List pointList = JSON.parseArray(theGeom, Point.class);
+ //pointList.remove(pointList.size()-1);
+ // 检查第一个点和最后一个点是否相同
+ if (!pointList.get(0).equals(pointList.get(pointList.size() - 1))) {
+ // 如果不相同,添加第一个点作为最后一个点来闭合多边形
+ pointList.add(pointList.get(0));
+ }
+ pointList.forEach(p -> {
+ sb.append(p.getLongitude());
+ sb.append(" ");
+ sb.append(p.getLatitude());
+ sb.append(",");
+ });
+ sb.setLength(sb.length() - 1);
+ sb.append(")))");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ gis.setTheGeom(sb.toString());
+ return gisMapper.updateGeomByPolygonPri(gis);
+ }
+
+ @Override
+ public int cleanGeomById(SysGis gis) {
+ return gisMapper.cleanGeomById(gis);
+ }
+
+ @Override
+ public int cleanGeomByIdPri(SysGis gis) {
+ return gisMapper.cleanGeomByIdPri(gis);
+ }
+}
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysGisMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysGisMapper.xml
new file mode 100644
index 0000000..1df20f7
--- /dev/null
+++ b/ruoyi-system/src/main/resources/mapper/system/SysGisMapper.xml
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+ update ${tableName} set the_geom = ST_GeomFromText(CONCAT('POINT(', #{deptLongitude}, ' ', #{deptLatitude}, ')'), 4326) where id = #{id}
+
+
+
+ update ${tableName} set the_geom = ST_GeomFromText(CONCAT('POINT(', #{deptLongitude}, ' ', #{deptLatitude}, ')'), 4326) where ${priId} = #{id}
+
+
+
+
+
+ update ${tableName} set the_geom = ST_GEOMFROMTEXT(#{theGeom}) where id = #{id}
+
+
+
+ update ${tableName} set the_geom = ST_GEOMFROMTEXT(#{theGeom}) where ${priId} = #{id}
+
+
+
+
+
+ update ${tableName} set the_geom = null where id = #{id}
+
+
+
+ update ${tableName} set the_geom = null where ${priId} = #{id}
+
+
+