Sfoglia il codice sorgente

新增配套资源后台管理模块 可手动添加类型 添加点位

zhouwang 4 giorni fa
parent
commit
1b99dabfb1

+ 16 - 1
pom.xml

@@ -15,6 +15,7 @@
15 15
 
16 16
 
17 17
     <properties>
18
+        <geotools.version>19.2</geotools.version>
18 19
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
19 20
         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
20 21
         <java.version>1.8</java.version>
@@ -364,6 +365,20 @@
364 365
             <version>1.18.2</version> <!-- 请检查是否有更新的版本 -->
365 366
         </dependency>
366 367
 
368
+
369
+        <!--空间数据-->
370
+        <dependency>
371
+            <groupId>org.geotools</groupId>
372
+            <artifactId>gt-geojson</artifactId>
373
+            <version>${geotools.version}</version>
374
+        </dependency>
375
+        <dependency>
376
+            <groupId>org.geotools</groupId>
377
+            <artifactId>gt-epsg-hsql</artifactId>
378
+            <version>${geotools.version}</version>
379
+        </dependency>
380
+
381
+
367 382
     </dependencies>
368 383
     <build>
369 384
         <plugins>
@@ -429,4 +444,4 @@
429 444
             </plugin>
430 445
         </plugins>
431 446
     </build>
432
-</project>
447
+</project>

+ 69 - 0
src/main/java/com/lqkj/common/utils/GeoUtils.java

@@ -0,0 +1,69 @@
1
+package com.lqkj.common.utils;
2
+
3
+import com.alibaba.fastjson.JSON;
4
+import com.alibaba.fastjson.JSONObject;
5
+import com.vividsolutions.jts.geom.Coordinate;
6
+import com.vividsolutions.jts.geom.Geometry;
7
+import com.vividsolutions.jts.geom.GeometryFactory;
8
+import com.vividsolutions.jts.geom.Point;
9
+import org.apache.commons.lang.StringUtils;
10
+import org.geotools.geojson.geom.GeometryJSON;
11
+import org.geotools.geometry.jts.JTSFactoryFinder;
12
+
13
+import java.io.StringWriter;
14
+
15
+public class GeoUtils {
16
+    private static GeometryFactory GEOMETRY_FACTORY = JTSFactoryFinder.getGeometryFactory( null );
17
+
18
+    public static Point createPoint(String lngLatString){
19
+        if(StringUtils.isNotEmpty(lngLatString)){
20
+            String[] lngLat = lngLatString.split(",");
21
+            if(lngLat.length == 2){
22
+                Double x = Double.parseDouble(lngLat[0]);
23
+                Double y = Double.parseDouble(lngLat[1]);
24
+                Coordinate coordinate = new Coordinate(x, y);
25
+                return GEOMETRY_FACTORY.createPoint(coordinate);
26
+            }
27
+            return null;
28
+        }
29
+        return null;
30
+    }
31
+
32
+    public static Geometry readFromGeoJsonString(String geoJson){
33
+        try {
34
+            GeometryJSON geometryJSON = new GeometryJSON(10);
35
+            return geometryJSON.read(geoJson);
36
+        } catch (Exception e) {
37
+            e.printStackTrace();
38
+        }
39
+        return null;
40
+    }
41
+
42
+    public static JSONObject readFromGeometry(Geometry geometry){
43
+        JSONObject json = null;
44
+        if (geometry != null)
45
+            try {
46
+                GeometryJSON geometryJSON = new GeometryJSON(30);//精度到小数点后参数位
47
+                StringWriter writer = new StringWriter();
48
+                geometryJSON.write(geometry, writer);
49
+                json = (JSONObject) JSON.parse(writer.toString());
50
+            } catch (Exception e) {
51
+                e.printStackTrace();
52
+            }
53
+        return json;
54
+    }
55
+    public static String  readFromGeometryToString(Geometry geometry) {
56
+        if (geometry != null) {
57
+            try {
58
+                GeometryJSON geometryJSON = new GeometryJSON(30);//精度到小数点后参数位
59
+                StringWriter writer = new StringWriter();
60
+                geometryJSON.write(geometry, writer);
61
+                return writer.toString();
62
+            } catch (Exception e) {
63
+                e.printStackTrace();
64
+                return null;
65
+            }
66
+        }
67
+        return null;
68
+    }
69
+}

+ 112 - 0
src/main/java/com/lqkj/supporting/controller/ResourcesInfoController.java

@@ -0,0 +1,112 @@
1
+package com.lqkj.supporting.controller;
2
+
3
+import java.util.List;
4
+import org.springframework.security.access.prepost.PreAuthorize;
5
+import org.springframework.beans.factory.annotation.Autowired;
6
+import org.springframework.web.bind.annotation.GetMapping;
7
+import org.springframework.web.bind.annotation.PostMapping;
8
+import org.springframework.web.bind.annotation.PutMapping;
9
+import org.springframework.web.bind.annotation.DeleteMapping;
10
+import org.springframework.web.bind.annotation.PathVariable;
11
+import org.springframework.web.bind.annotation.RequestBody;
12
+import org.springframework.web.bind.annotation.RequestMapping;
13
+import org.springframework.web.bind.annotation.RestController;
14
+import com.lqkj.common.annotation.Log;
15
+import com.lqkj.common.core.controller.BaseController;
16
+import com.lqkj.common.core.model.ResultUtil;
17
+import com.lqkj.common.enums.BusinessType;
18
+import io.swagger.annotations.Api;
19
+import io.swagger.annotations.ApiOperation;
20
+import com.lqkj.supporting.entity.ResourcesInfo;
21
+import com.lqkj.supporting.service.ResourcesInfoService;
22
+import com.lqkj.common.utils.poi.ExcelUtil;
23
+import com.github.pagehelper.PageInfo;
24
+
25
+/**
26
+ * 资源点位对象Controller
27
+ *
28
+ * @author lqkj
29
+ * @date 2025-05-07
30
+ */
31
+@Api(tags = {"资源点位对象"})
32
+@RestController
33
+@RequestMapping("/supporting/info")
34
+public class ResourcesInfoController extends BaseController
35
+{
36
+    @Autowired
37
+    private ResourcesInfoService resourcesInfoService;
38
+
39
+    /**
40
+     * 查询资源点位对象列表
41
+     */
42
+    @ApiOperation("查询资源点位对象列表")
43
+    @PreAuthorize("@ss.hasPermi('supporting:info:list')")
44
+    @GetMapping("/list")
45
+    public ResultUtil list(ResourcesInfo resourcesInfo)
46
+    {
47
+        startPage( resourcesInfo);
48
+        PageInfo<ResourcesInfo> pageInfo = new PageInfo<>(resourcesInfoService.selectResourcesInfoList(resourcesInfo));
49
+        return ResultUtil.success(pageInfo);
50
+    }
51
+
52
+    /**
53
+     * 导出资源点位对象列表
54
+     */
55
+    @ApiOperation("导出资源点位对象列表")
56
+    @PreAuthorize("@ss.hasPermi('supporting:info:export')")
57
+    @Log(title = "资源点位对象", businessType = BusinessType.EXPORT)
58
+    @GetMapping("/export")
59
+    public ResultUtil export(ResourcesInfo resourcesInfo)
60
+    {
61
+        List<ResourcesInfo> list = resourcesInfoService.selectResourcesInfoList(resourcesInfo);
62
+        ExcelUtil<ResourcesInfo> util = new ExcelUtil<ResourcesInfo>(ResourcesInfo.class);
63
+        return util.exportExcel(list, "资源点位对象数据");
64
+    }
65
+
66
+    /**
67
+     * 获取资源点位对象详细信息
68
+     */
69
+    @ApiOperation("获取资源点位对象详细信息")
70
+    @PreAuthorize("@ss.hasPermi('supporting:info:query')")
71
+    @GetMapping(value = "/{infoId}")
72
+    public ResultUtil getInfo(@PathVariable("infoId") Integer infoId)
73
+    {
74
+        return ResultUtil.success(resourcesInfoService.selectResourcesInfoByInfoId(infoId));
75
+    }
76
+
77
+    /**
78
+     * 新增资源点位对象
79
+     */
80
+    @ApiOperation("新增资源点位对象")
81
+    @PreAuthorize("@ss.hasPermi('supporting:info:add')")
82
+    @Log(title = "资源点位对象", businessType = BusinessType.INSERT)
83
+    @PostMapping
84
+    public ResultUtil add(@RequestBody ResourcesInfo resourcesInfo)
85
+    {
86
+        return resultByRows(resourcesInfoService.insertResourcesInfo(resourcesInfo));
87
+    }
88
+
89
+    /**
90
+     * 修改资源点位对象
91
+     */
92
+    @ApiOperation("修改资源点位对象")
93
+    @PreAuthorize("@ss.hasPermi('supporting:info:edit')")
94
+    @Log(title = "资源点位对象", businessType = BusinessType.UPDATE)
95
+    @PutMapping
96
+    public ResultUtil edit(@RequestBody ResourcesInfo resourcesInfo)
97
+    {
98
+        return resultByRows(resourcesInfoService.updateResourcesInfo(resourcesInfo));
99
+    }
100
+
101
+    /**
102
+     * 删除资源点位对象
103
+     */
104
+    @ApiOperation("删除资源点位对象")
105
+    @PreAuthorize("@ss.hasPermi('supporting:info:remove')")
106
+    @Log(title = "资源点位对象", businessType = BusinessType.DELETE)
107
+	@DeleteMapping("/{infoIds}")
108
+    public ResultUtil remove(@PathVariable Integer[] infoIds)
109
+    {
110
+        return resultByRows(resourcesInfoService.deleteResourcesInfoByInfoIds(infoIds));
111
+    }
112
+}

+ 117 - 0
src/main/java/com/lqkj/supporting/controller/ResourcesTypeController.java

@@ -0,0 +1,117 @@
1
+package com.lqkj.supporting.controller;
2
+
3
+import java.util.List;
4
+import org.springframework.security.access.prepost.PreAuthorize;
5
+import org.springframework.beans.factory.annotation.Autowired;
6
+import org.springframework.web.bind.annotation.GetMapping;
7
+import org.springframework.web.bind.annotation.PostMapping;
8
+import org.springframework.web.bind.annotation.PutMapping;
9
+import org.springframework.web.bind.annotation.DeleteMapping;
10
+import org.springframework.web.bind.annotation.PathVariable;
11
+import org.springframework.web.bind.annotation.RequestBody;
12
+import org.springframework.web.bind.annotation.RequestMapping;
13
+import org.springframework.web.bind.annotation.RestController;
14
+import com.lqkj.common.annotation.Log;
15
+import com.lqkj.common.core.controller.BaseController;
16
+import com.lqkj.common.core.model.ResultUtil;
17
+import com.lqkj.common.enums.BusinessType;
18
+import io.swagger.annotations.Api;
19
+import io.swagger.annotations.ApiOperation;
20
+import com.lqkj.supporting.entity.ResourcesType;
21
+import com.lqkj.supporting.service.ResourcesTypeService;
22
+import com.lqkj.common.utils.poi.ExcelUtil;
23
+import com.github.pagehelper.PageInfo;
24
+
25
+/**
26
+ * 资源类型Controller
27
+ *
28
+ * @author lqkj
29
+ * @date 2025-05-07
30
+ */
31
+@Api(tags = {"资源类型"})
32
+@RestController
33
+@RequestMapping("/supporting/type")
34
+public class ResourcesTypeController extends BaseController
35
+{
36
+    @Autowired
37
+    private ResourcesTypeService resourcesTypeService;
38
+
39
+    /**
40
+     * 查询资源类型列表
41
+     */
42
+    @ApiOperation("查询资源类型列表")
43
+    @PreAuthorize("@ss.hasPermi('supporting:type:list')")
44
+    @GetMapping("/list")
45
+    public ResultUtil list(ResourcesType resourcesType)
46
+    {
47
+        startPage( resourcesType);
48
+        PageInfo<ResourcesType> pageInfo = new PageInfo<>(resourcesTypeService.selectResourcesTypeList(resourcesType));
49
+        return ResultUtil.success(pageInfo);
50
+    }
51
+    @ApiOperation("查询所有资源类型列表")
52
+    @GetMapping("/listAll")
53
+    public ResultUtil list() {
54
+        return ResultUtil.success(resourcesTypeService.selectResourcesTypeList(new ResourcesType()));
55
+    }
56
+
57
+    /**
58
+     * 导出资源类型列表
59
+     */
60
+    @ApiOperation("导出资源类型列表")
61
+    @PreAuthorize("@ss.hasPermi('supporting:type:export')")
62
+    @Log(title = "资源类型", businessType = BusinessType.EXPORT)
63
+    @GetMapping("/export")
64
+    public ResultUtil export(ResourcesType resourcesType)
65
+    {
66
+        List<ResourcesType> list = resourcesTypeService.selectResourcesTypeList(resourcesType);
67
+        ExcelUtil<ResourcesType> util = new ExcelUtil<ResourcesType>(ResourcesType.class);
68
+        return util.exportExcel(list, "资源类型数据");
69
+    }
70
+
71
+    /**
72
+     * 获取资源类型详细信息
73
+     */
74
+    @ApiOperation("获取资源类型详细信息")
75
+    @PreAuthorize("@ss.hasPermi('supporting:type:query')")
76
+    @GetMapping(value = "/{typeId}")
77
+    public ResultUtil getInfo(@PathVariable("typeId") Integer typeId)
78
+    {
79
+        return ResultUtil.success(resourcesTypeService.selectResourcesTypeByTypeId(typeId));
80
+    }
81
+
82
+    /**
83
+     * 新增资源类型
84
+     */
85
+    @ApiOperation("新增资源类型")
86
+    @PreAuthorize("@ss.hasPermi('supporting:type:add')")
87
+    @Log(title = "资源类型", businessType = BusinessType.INSERT)
88
+    @PostMapping
89
+    public ResultUtil add(@RequestBody ResourcesType resourcesType)
90
+    {
91
+        return resultByRows(resourcesTypeService.insertResourcesType(resourcesType));
92
+    }
93
+
94
+    /**
95
+     * 修改资源类型
96
+     */
97
+    @ApiOperation("修改资源类型")
98
+    @PreAuthorize("@ss.hasPermi('supporting:type:edit')")
99
+    @Log(title = "资源类型", businessType = BusinessType.UPDATE)
100
+    @PutMapping
101
+    public ResultUtil edit(@RequestBody ResourcesType resourcesType)
102
+    {
103
+        return resultByRows(resourcesTypeService.updateResourcesType(resourcesType));
104
+    }
105
+
106
+    /**
107
+     * 删除资源类型
108
+     */
109
+    @ApiOperation("删除资源类型")
110
+    @PreAuthorize("@ss.hasPermi('supporting:type:remove')")
111
+    @Log(title = "资源类型", businessType = BusinessType.DELETE)
112
+	@DeleteMapping("/{typeIds}")
113
+    public ResultUtil remove(@PathVariable Integer[] typeIds)
114
+    {
115
+        return resultByRows(resourcesTypeService.deleteResourcesTypeByTypeIds(typeIds));
116
+    }
117
+}

+ 105 - 0
src/main/java/com/lqkj/supporting/entity/ResourcesInfo.java

@@ -0,0 +1,105 @@
1
+package com.lqkj.supporting.entity;
2
+
3
+import com.fasterxml.jackson.annotation.JsonIgnore;
4
+import com.vividsolutions.jts.geom.Geometry;
5
+import org.apache.commons.lang3.builder.ToStringBuilder;
6
+import org.apache.commons.lang3.builder.ToStringStyle;
7
+import com.lqkj.common.annotation.Excel;
8
+import com.lqkj.common.core.model.BaseEntity;
9
+
10
+/**
11
+ * 资源点位对象对象 resources_info
12
+ *
13
+ * @author lqkj
14
+ * @date 2025-05-07
15
+ */
16
+public class ResourcesInfo extends BaseEntity
17
+{
18
+    private static final long serialVersionUID = 1L;
19
+
20
+    /** 信息ID */
21
+    private Integer infoId;
22
+
23
+    /** 类型编号:type_id */
24
+    @Excel(name = "类型编号:type_id")
25
+    private Integer typeId;
26
+
27
+    /** 名字:area_name */
28
+    @Excel(name = "名字:area_name")
29
+    private String infoName;
30
+
31
+    /** 备注:memo */
32
+    @Excel(name = "备注:memo")
33
+    private String memo;
34
+
35
+    /** 坐标: location */
36
+    @Excel(name = "坐标: location")
37
+    private Object location;
38
+
39
+    private String typeName;
40
+
41
+    public void setInfoId(Integer infoId)
42
+    {
43
+        this.infoId = infoId;
44
+    }
45
+
46
+    public Integer getInfoId()
47
+    {
48
+        return infoId;
49
+    }
50
+    public void setTypeId(Integer typeId)
51
+    {
52
+        this.typeId = typeId;
53
+    }
54
+
55
+    public Integer getTypeId()
56
+    {
57
+        return typeId;
58
+    }
59
+    public void setInfoName(String infoName)
60
+    {
61
+        this.infoName = infoName;
62
+    }
63
+
64
+    public String getInfoName()
65
+    {
66
+        return infoName;
67
+    }
68
+    public void setMemo(String memo)
69
+    {
70
+        this.memo = memo;
71
+    }
72
+
73
+    public String getMemo()
74
+    {
75
+        return memo;
76
+    }
77
+    public void setLocation(Object location)
78
+    {
79
+        this.location = location;
80
+    }
81
+
82
+    public Object getLocation()
83
+    {
84
+        return location;
85
+    }
86
+
87
+    public String getTypeName() {
88
+        return typeName;
89
+    }
90
+
91
+    public void setTypeName(String typeName) {
92
+        this.typeName = typeName;
93
+    }
94
+
95
+    @Override
96
+    public String toString() {
97
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
98
+            .append("infoId", getInfoId())
99
+            .append("typeId", getTypeId())
100
+            .append("infoName", getInfoName())
101
+            .append("memo", getMemo())
102
+            .append("location", getLocation())
103
+            .toString();
104
+    }
105
+}

+ 107 - 0
src/main/java/com/lqkj/supporting/entity/ResourcesType.java

@@ -0,0 +1,107 @@
1
+package com.lqkj.supporting.entity;
2
+
3
+import org.apache.commons.lang3.builder.ToStringBuilder;
4
+import org.apache.commons.lang3.builder.ToStringStyle;
5
+import com.lqkj.common.annotation.Excel;
6
+import com.lqkj.common.core.model.BaseEntity;
7
+
8
+/**
9
+ * 资源类型对象 resources_type
10
+ *
11
+ * @author lqkj
12
+ * @date 2025-05-07
13
+ */
14
+public class ResourcesType extends BaseEntity
15
+{
16
+    private static final long serialVersionUID = 1L;
17
+
18
+    /** 类型ID */
19
+    private Integer typeId;
20
+
21
+    /** 类型名称 */
22
+    @Excel(name = "类型名称")
23
+    private String typeName;
24
+
25
+    /** 类型分类 */
26
+    @Excel(name = "类型分类")
27
+    private String typeLabel;
28
+
29
+    /** 类型图标 */
30
+    @Excel(name = "类型图标")
31
+    private String icon;
32
+
33
+    /** 排序:order_id */
34
+    @Excel(name = "排序:order_id")
35
+    private Integer orderId;
36
+
37
+    /** 备注 */
38
+    @Excel(name = "备注")
39
+    private String memo;
40
+
41
+    public void setTypeId(Integer typeId)
42
+    {
43
+        this.typeId = typeId;
44
+    }
45
+
46
+    public Integer getTypeId()
47
+    {
48
+        return typeId;
49
+    }
50
+    public void setTypeName(String typeName)
51
+    {
52
+        this.typeName = typeName;
53
+    }
54
+
55
+    public String getTypeName()
56
+    {
57
+        return typeName;
58
+    }
59
+    public void setTypeLabel(String typeLabel)
60
+    {
61
+        this.typeLabel = typeLabel;
62
+    }
63
+
64
+    public String getTypeLabel()
65
+    {
66
+        return typeLabel;
67
+    }
68
+    public void setIcon(String icon)
69
+    {
70
+        this.icon = icon;
71
+    }
72
+
73
+    public String getIcon()
74
+    {
75
+        return icon;
76
+    }
77
+    public void setOrderId(Integer orderId)
78
+    {
79
+        this.orderId = orderId;
80
+    }
81
+
82
+    public Integer getOrderId()
83
+    {
84
+        return orderId;
85
+    }
86
+    public void setMemo(String memo)
87
+    {
88
+        this.memo = memo;
89
+    }
90
+
91
+    public String getMemo()
92
+    {
93
+        return memo;
94
+    }
95
+
96
+    @Override
97
+    public String toString() {
98
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
99
+            .append("typeId", getTypeId())
100
+            .append("typeName", getTypeName())
101
+            .append("typeLabel", getTypeLabel())
102
+            .append("icon", getIcon())
103
+            .append("orderId", getOrderId())
104
+            .append("memo", getMemo())
105
+            .toString();
106
+    }
107
+}

+ 63 - 0
src/main/java/com/lqkj/supporting/mapper/ResourcesInfoMapper.java

@@ -0,0 +1,63 @@
1
+package com.lqkj.supporting.mapper;
2
+
3
+import java.util.List;
4
+import org.apache.ibatis.annotations.Mapper;
5
+import com.lqkj.supporting.entity.ResourcesInfo;
6
+
7
+/**
8
+ * 资源点位对象Mapper接口
9
+ *
10
+ * @author lqkj
11
+ * @date 2025-05-07
12
+ */
13
+@Mapper
14
+public interface ResourcesInfoMapper
15
+{
16
+    /**
17
+     * 查询资源点位对象
18
+     *
19
+     * @param infoId 资源点位对象主键
20
+     * @return 资源点位对象
21
+     */
22
+    public ResourcesInfo selectResourcesInfoByInfoId(Integer infoId);
23
+
24
+    /**
25
+     * 查询资源点位对象列表
26
+     *
27
+     * @param resourcesInfo 资源点位对象
28
+     * @return 资源点位对象集合
29
+     */
30
+    public List<ResourcesInfo> selectResourcesInfoList(ResourcesInfo resourcesInfo);
31
+
32
+    /**
33
+     * 新增资源点位对象
34
+     *
35
+     * @param resourcesInfo 资源点位对象
36
+     * @return 结果
37
+     */
38
+    public int insertResourcesInfo(ResourcesInfo resourcesInfo);
39
+
40
+    /**
41
+     * 修改资源点位对象
42
+     *
43
+     * @param resourcesInfo 资源点位对象
44
+     * @return 结果
45
+     */
46
+    public int updateResourcesInfo(ResourcesInfo resourcesInfo);
47
+
48
+    /**
49
+     * 删除资源点位对象
50
+     *
51
+     * @param infoId 资源点位对象主键
52
+     * @return 结果
53
+     */
54
+    public int deleteResourcesInfoByInfoId(Integer infoId);
55
+
56
+    /**
57
+     * 批量删除资源点位对象
58
+     *
59
+     * @param infoIds 需要删除的数据主键集合
60
+     * @return 结果
61
+     */
62
+    public int deleteResourcesInfoByInfoIds(Integer[] infoIds);
63
+}

+ 63 - 0
src/main/java/com/lqkj/supporting/mapper/ResourcesTypeMapper.java

@@ -0,0 +1,63 @@
1
+package com.lqkj.supporting.mapper;
2
+
3
+import java.util.List;
4
+import org.apache.ibatis.annotations.Mapper;
5
+import com.lqkj.supporting.entity.ResourcesType;
6
+
7
+/**
8
+ * 资源类型Mapper接口
9
+ *
10
+ * @author lqkj
11
+ * @date 2025-05-07
12
+ */
13
+@Mapper
14
+public interface ResourcesTypeMapper
15
+{
16
+    /**
17
+     * 查询资源类型
18
+     *
19
+     * @param typeId 资源类型主键
20
+     * @return 资源类型
21
+     */
22
+    public ResourcesType selectResourcesTypeByTypeId(Integer typeId);
23
+
24
+    /**
25
+     * 查询资源类型列表
26
+     *
27
+     * @param resourcesType 资源类型
28
+     * @return 资源类型集合
29
+     */
30
+    public List<ResourcesType> selectResourcesTypeList(ResourcesType resourcesType);
31
+
32
+    /**
33
+     * 新增资源类型
34
+     *
35
+     * @param resourcesType 资源类型
36
+     * @return 结果
37
+     */
38
+    public int insertResourcesType(ResourcesType resourcesType);
39
+
40
+    /**
41
+     * 修改资源类型
42
+     *
43
+     * @param resourcesType 资源类型
44
+     * @return 结果
45
+     */
46
+    public int updateResourcesType(ResourcesType resourcesType);
47
+
48
+    /**
49
+     * 删除资源类型
50
+     *
51
+     * @param typeId 资源类型主键
52
+     * @return 结果
53
+     */
54
+    public int deleteResourcesTypeByTypeId(Integer typeId);
55
+
56
+    /**
57
+     * 批量删除资源类型
58
+     *
59
+     * @param typeIds 需要删除的数据主键集合
60
+     * @return 结果
61
+     */
62
+    public int deleteResourcesTypeByTypeIds(Integer[] typeIds);
63
+}

+ 133 - 0
src/main/java/com/lqkj/supporting/service/ResourcesInfoService.java

@@ -0,0 +1,133 @@
1
+package com.lqkj.supporting.service;
2
+
3
+import java.util.ArrayList;
4
+import java.util.LinkedHashMap;
5
+import java.util.List;
6
+import java.util.Map;
7
+
8
+import com.alibaba.fastjson.JSON;
9
+import com.alibaba.fastjson.JSONArray;
10
+import com.alibaba.fastjson.JSONObject;
11
+import com.fasterxml.jackson.databind.ObjectMapper;
12
+import com.lqkj.common.utils.GeoUtils;
13
+import com.lqkj.supporting.entity.ResourcesType;
14
+import com.vividsolutions.jts.geom.Coordinate;
15
+import com.vividsolutions.jts.geom.Geometry;
16
+import com.vividsolutions.jts.geom.GeometryFactory;
17
+import com.vividsolutions.jts.geom.Point;
18
+import org.springframework.beans.factory.annotation.Autowired;
19
+import org.springframework.stereotype.Service;
20
+import com.lqkj.supporting.mapper.ResourcesInfoMapper;
21
+import com.lqkj.supporting.entity.ResourcesInfo;
22
+import com.lqkj.common.utils.uuid.IdUtils;
23
+import org.springframework.util.CollectionUtils;
24
+
25
+/**
26
+ * 资源点位对象Service业务层处理
27
+ *
28
+ * @author lqkj
29
+ * @date 2025-05-07
30
+ */
31
+@Service
32
+public class ResourcesInfoService {
33
+    @Autowired
34
+    private ResourcesInfoMapper resourcesInfoMapper;
35
+
36
+    @Autowired
37
+    private ResourcesTypeService resourcesTypeService;
38
+
39
+    /**
40
+     * 查询资源点位对象
41
+     *
42
+     * @param infoId 资源点位对象主键
43
+     * @return 资源点位对象
44
+     */
45
+
46
+    public ResourcesInfo selectResourcesInfoByInfoId(Integer infoId) {
47
+        ResourcesInfo resourcesInfo = resourcesInfoMapper.selectResourcesInfoByInfoId(infoId);
48
+        paseGeom(resourcesInfo);
49
+        return resourcesInfo;
50
+    }
51
+
52
+    private void paseGeom(ResourcesInfo resourcesInfo) {
53
+        Object location = resourcesInfo.getLocation();
54
+        System.out.println(location.getClass());
55
+        Map<String, Object> map = (LinkedHashMap<String, Object>) location;
56
+        // 假设该 Map 来自 GeoJSON 格式,可以手动提取坐标并构造 Point
57
+        List coordinates = (ArrayList) map.get("coordinates");
58
+
59
+        resourcesInfo.setLocation(coordinates.get(0).toString()  + "," + coordinates.get(1).toString());
60
+        Integer typeId = resourcesInfo.getTypeId();
61
+        ResourcesType resourcesType = resourcesTypeService.selectResourcesTypeByTypeId(typeId);
62
+        resourcesInfo.setTypeName(resourcesType.getTypeName());
63
+    }
64
+
65
+    /**
66
+     * 查询资源点位对象列表
67
+     *
68
+     * @param resourcesInfo 资源点位对象
69
+     * @return 资源点位对象
70
+     */
71
+    public List<ResourcesInfo> selectResourcesInfoList(ResourcesInfo resourcesInfo) {
72
+        List<ResourcesInfo> resourcesInfos = resourcesInfoMapper.selectResourcesInfoList(resourcesInfo);
73
+        if (!CollectionUtils.isEmpty(resourcesInfos)) {
74
+            resourcesInfos.forEach(resourcesInfo1 -> {
75
+                paseGeom(resourcesInfo1);
76
+            });
77
+        }
78
+        return resourcesInfos;
79
+    }
80
+
81
+    /**
82
+     * 新增资源点位对象
83
+     *
84
+     * @param resourcesInfo 资源点位对象
85
+     * @return 结果
86
+     */
87
+
88
+    public int insertResourcesInfo(ResourcesInfo resourcesInfo) {
89
+
90
+        String location = (String) resourcesInfo.getLocation();
91
+        Point point = GeoUtils.createPoint(location);
92
+        JSONObject jsonObject = GeoUtils.readFromGeometry(point);
93
+        resourcesInfo.setLocation(jsonObject);
94
+        return resourcesInfoMapper.insertResourcesInfo(resourcesInfo);
95
+    }
96
+
97
+    /**
98
+     * 修改资源点位对象
99
+     *
100
+     * @param resourcesInfo 资源点位对象
101
+     * @return 结果
102
+     */
103
+
104
+    public int updateResourcesInfo(ResourcesInfo resourcesInfo) {
105
+//        String location = resourcesInfo.getLocation();
106
+//        Point point = GeoUtils.createPoint(location);
107
+//        JSONObject jsonObject = GeoUtils.readFromGeometry(point);
108
+//        resourcesInfo.setLocation(jsonObject.toJSONString());
109
+        return resourcesInfoMapper.updateResourcesInfo(resourcesInfo);
110
+    }
111
+
112
+    /**
113
+     * 批量删除资源点位对象
114
+     *
115
+     * @param infoIds 需要删除的资源点位对象主键
116
+     * @return 结果
117
+     */
118
+
119
+    public int deleteResourcesInfoByInfoIds(Integer[] infoIds) {
120
+        return resourcesInfoMapper.deleteResourcesInfoByInfoIds(infoIds);
121
+    }
122
+
123
+    /**
124
+     * 删除资源点位对象信息
125
+     *
126
+     * @param infoId 资源点位对象主键
127
+     * @return 结果
128
+     */
129
+
130
+    public int deleteResourcesInfoByInfoId(Integer infoId) {
131
+        return resourcesInfoMapper.deleteResourcesInfoByInfoId(infoId);
132
+    }
133
+}

+ 91 - 0
src/main/java/com/lqkj/supporting/service/ResourcesTypeService.java

@@ -0,0 +1,91 @@
1
+package com.lqkj.supporting.service;
2
+
3
+import java.util.List;
4
+import org.springframework.beans.factory.annotation.Autowired;
5
+import org.springframework.stereotype.Service;
6
+import com.lqkj.supporting.mapper.ResourcesTypeMapper;
7
+import com.lqkj.supporting.entity.ResourcesType;
8
+import com.lqkj.common.utils.uuid.IdUtils;
9
+/**
10
+ * 资源类型Service业务层处理
11
+ *
12
+ * @author lqkj
13
+ * @date 2025-05-07
14
+ */
15
+@Service
16
+public class ResourcesTypeService
17
+{
18
+    @Autowired
19
+    private ResourcesTypeMapper resourcesTypeMapper;
20
+
21
+    /**
22
+     * 查询资源类型
23
+     *
24
+     * @param typeId 资源类型主键
25
+     * @return 资源类型
26
+     */
27
+
28
+    public ResourcesType selectResourcesTypeByTypeId(Integer typeId)
29
+    {
30
+        return resourcesTypeMapper.selectResourcesTypeByTypeId(typeId);
31
+    }
32
+
33
+    /**
34
+     * 查询资源类型列表
35
+     *
36
+     * @param resourcesType 资源类型
37
+     * @return 资源类型
38
+     */
39
+    public List<ResourcesType> selectResourcesTypeList(ResourcesType resourcesType)
40
+    {
41
+        return resourcesTypeMapper.selectResourcesTypeList(resourcesType);
42
+    }
43
+
44
+    /**
45
+     * 新增资源类型
46
+     *
47
+     * @param resourcesType 资源类型
48
+     * @return 结果
49
+     */
50
+
51
+    public int insertResourcesType(ResourcesType resourcesType)
52
+    {
53
+        return resourcesTypeMapper.insertResourcesType(resourcesType);
54
+    }
55
+
56
+    /**
57
+     * 修改资源类型
58
+     *
59
+     * @param resourcesType 资源类型
60
+     * @return 结果
61
+     */
62
+
63
+    public int updateResourcesType(ResourcesType resourcesType)
64
+    {
65
+        return resourcesTypeMapper.updateResourcesType(resourcesType);
66
+    }
67
+
68
+    /**
69
+     * 批量删除资源类型
70
+     *
71
+     * @param typeIds 需要删除的资源类型主键
72
+     * @return 结果
73
+     */
74
+
75
+    public int deleteResourcesTypeByTypeIds(Integer[] typeIds)
76
+    {
77
+        return resourcesTypeMapper.deleteResourcesTypeByTypeIds(typeIds);
78
+    }
79
+
80
+    /**
81
+     * 删除资源类型信息
82
+     *
83
+     * @param typeId 资源类型主键
84
+     * @return 结果
85
+     */
86
+
87
+    public int deleteResourcesTypeByTypeId(Integer typeId)
88
+    {
89
+        return resourcesTypeMapper.deleteResourcesTypeByTypeId(typeId);
90
+    }
91
+}

+ 171 - 0
src/main/resources/db/migration/V1_17__20250507.sql

@@ -0,0 +1,171 @@
1
+-- 一级菜单 SQL
2
+
3
+insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible,
4
+                      status, perms, icon, create_by, create_time, update_by, update_time, remark)
5
+values ('配套资源', '0', '0', 'supporting', null, false, true,'M', true,
6
+        true, '', 'trend-chart', 'admin', now(), '', null,'配套资源主分类');
7
+
8
+
9
+
10
+with temp_menu2 as (
11
+insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible,
12
+                      status, perms, icon, create_by, create_time, update_by, update_time, remark)
13
+values ('类型管理', (select menu_id from sys_menu where menu_name = '配套资源' limit 1), '1', 'type', 'supporting/type/index', false, true,'C', true,
14
+        true, 'supporting:type:list', 'operation', 'admin', now(), '', null,'配套资源类型管理') returning menu_id)
15
+
16
+
17
+-- 按钮 SQL
18
+insert
19
+into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms,
20
+               icon, create_by, create_time, update_by, update_time, remark)
21
+values ('类型管理查询', (select * from temp_menu2), '1', '#', '', false, true, 'F', true, true,
22
+    'supporting:type:query', '#', 'admin', now(), '', null, ''),
23
+    ('类型管理新增', (select * from temp_menu2), '2', '#', '', false, true, 'F', true, true,
24
+    'supporting:type:add', '#', 'admin', now(), '', null, ''),
25
+    ('类型管理修改', (select * from temp_menu2), '3', '#', '', false, true, 'F', true, true,
26
+    'supporting:type:edit', '#', 'admin', now(), '', null, ''),
27
+    ('类型管理删除', (select * from temp_menu2), '4', '#', '', false, true, 'F', true, true,
28
+    'supporting:type:remove', '#', 'admin', now(), '', null, ''),
29
+    ('类型管理导出', (select * from temp_menu2), '5', '#', '', false, true, 'F', true, true,
30
+    'supporting:type:export', '#', 'admin', now(), '', null, '');
31
+
32
+-- 菜单 SQL
33
+with temp_menu3 as (
34
+insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible,
35
+                      status, perms, icon, create_by, create_time, update_by, update_time, remark)
36
+values ('点位管理', (select menu_id from sys_menu where menu_name = '配套资源' limit 1), '2', 'info', 'supporting/info/index', false, true, 'C',
37
+    true, true, 'supporting:info:list', 'operation', 'admin', now(), '', null,
38
+    '配套资源点位管理') returning menu_id)
39
+-- 按钮 SQL
40
+insert
41
+into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms,
42
+               icon, create_by, create_time, update_by, update_time, remark)
43
+values ('点位管理查询', (select * from temp_menu3), '1', '#', '', false, true, 'F', true, true,
44
+    'supporting:info:query', '#', 'admin', now(), '', null, ''),
45
+    ('点位管理新增', (select * from temp_menu3), '2', '#', '', false, true, 'F', true, true,
46
+    'supporting:info:add', '#', 'admin', now(), '', null, ''),
47
+    ('点位管理修改', (select * from temp_menu3), '3', '#', '', false, true, 'F', true, true,
48
+    'supporting:info:edit', '#', 'admin', now(), '', null, ''),
49
+    ('点位管理删除', (select * from temp_menu3), '4', '#', '', false, true, 'F', true, true,
50
+    'supporting:info:remove', '#', 'admin', now(), '', null, ''),
51
+    ('点位管理导出', (select * from temp_menu3), '5', '#', '', false, true, 'F', true, true,
52
+    'supporting:info:export', '#', 'admin', now(), '', null, '');
53
+
54
+INSERT INTO "public"."sys_dict_type" ("dict_name", "dict_type", "status", "create_by", "create_time", "update_by", "update_time", "remark")
55
+VALUES ('配套资源分类', 'supporting_resources_classify', 't', '超级管理员', now(), NULL, NULL, NULL);
56
+
57
+
58
+INSERT INTO "public"."sys_dict_data" ("dict_sort", "dict_label", "dict_value", "dict_type", "css_class", "list_class", "is_default", "status", "create_by", "create_time", "update_by", "update_time", "remark", "icon", "park_id")
59
+       VALUES (1, '企业服务', '企业服务', 'supporting_resources_classify', NULL, 'default', 'f', 't', '超级管理员', now(), NULL, NULL, NULL, NULL, NULL),
60
+              (2, '便民服务', '企业服务', 'supporting_resources_classify', NULL, 'default', 'f', 't', '超级管理员', now(), NULL, NULL, NULL, NULL, NULL),
61
+              (3, '交通服务', '企业服务', 'supporting_resources_classify', NULL, 'default', 'f', 't', '超级管理员', now(), NULL, NULL, NULL, NULL, NULL);
62
+
63
+
64
+
65
+
66
+create table resources_type (
67
+                           type_id              SERIAL               not null,
68
+                           type_name            VARCHAR(255)         null,
69
+                           type_label           VARCHAR(255)         null,
70
+                           icon                 VARCHAR(255)         null,
71
+                           order_id             INT4                 null,
72
+                           memo                 VARCHAR(255)         null,
73
+                           constraint PK_RESOURCES_TYPE primary key (type_id)
74
+);
75
+
76
+comment on table resources_type is
77
+    '资源类型';
78
+
79
+comment on column resources_type.type_id is
80
+    '类型ID';
81
+
82
+comment on column resources_type.type_name is
83
+    '类型名称';
84
+
85
+comment on column resources_type.type_label is
86
+    '类型分类';
87
+
88
+comment on column resources_type.icon is
89
+    '类型图标';
90
+
91
+comment on column resources_type.order_id is
92
+    '排序:order_id';
93
+
94
+comment on column resources_type.memo is
95
+    '备注';
96
+
97
+
98
+
99
+
100
+create table resources_info (
101
+                           info_id              SERIAL               not null,
102
+                           type_id              INT4                 not null,
103
+                           info_name            VARCHAR(255)         null,
104
+                           memo                 VARCHAR(255)         null,
105
+                           location             jsonb                null,
106
+                           constraint PK_RESOURCES_INFO primary key (info_id)
107
+);
108
+
109
+comment on table resources_info is
110
+    '资源点位对象';
111
+
112
+comment on column resources_info.info_id is
113
+    '信息ID';
114
+
115
+comment on column resources_info.type_id is
116
+    '类型编号:type_id';
117
+
118
+comment on column resources_info.info_name is
119
+    '名字:area_name';
120
+
121
+comment on column resources_info.memo is
122
+    '备注:memo';
123
+
124
+comment on column resources_info.location is
125
+    '坐标: location';
126
+
127
+
128
+
129
+
130
+
131
+
132
+
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+
150
+
151
+
152
+
153
+
154
+
155
+
156
+
157
+
158
+
159
+
160
+
161
+
162
+
163
+
164
+
165
+
166
+
167
+
168
+
169
+
170
+
171
+

+ 72 - 0
src/main/resources/mapper/supporting/ResourcesInfoMapper.xml

@@ -0,0 +1,72 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper
3
+		PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4
+		"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5
+<mapper namespace="com.lqkj.supporting.mapper.ResourcesInfoMapper">
6
+
7
+	<resultMap type="ResourcesInfo" id="ResourcesInfoResult">
8
+		<result property="infoId"    column="info_id"    />
9
+		<result property="typeId"    column="type_id"    />
10
+		<result property="infoName"    column="info_name"    />
11
+		<result property="memo"    column="memo"    />
12
+		<result property="location"    column="location"   jdbcType="OTHER"
13
+				typeHandler="com.lqkj.framework.sql.JsonbTypeHandler"/>
14
+	</resultMap>
15
+
16
+	<sql id="selectResourcesInfoVo">
17
+		select info_id, type_id, info_name, memo, location from resources_info
18
+	</sql>
19
+
20
+	<select id="selectResourcesInfoList" parameterType="ResourcesInfo" resultMap="ResourcesInfoResult">
21
+		<include refid="selectResourcesInfoVo"/>
22
+		<where>
23
+			<if test="typeId != null "> and type_id = #{typeId}</if>
24
+			<if test="infoName != null  and infoName != ''"> and info_name like concat('%', #{infoName}, '%')</if>
25
+		</where>
26
+		order by info_id
27
+
28
+	</select>
29
+
30
+	<select id="selectResourcesInfoByInfoId" parameterType="Integer" resultMap="ResourcesInfoResult">
31
+		<include refid="selectResourcesInfoVo"/>
32
+		where info_id = #{infoId}
33
+	</select>
34
+
35
+	<insert id="insertResourcesInfo" parameterType="ResourcesInfo" useGeneratedKeys="true" keyProperty="infoId">
36
+		insert into resources_info
37
+		<trim prefix="(" suffix=")" suffixOverrides=",">
38
+			<if test="typeId != null">type_id,</if>
39
+			<if test="infoName != null and infoName != ''">info_name,</if>
40
+			<if test="memo != null and memo != ''">memo,</if>
41
+			<if test="location != null and location != ''">location,</if>
42
+		</trim>
43
+		<trim prefix="values (" suffix=")" suffixOverrides=",">
44
+			<if test="typeId != null">#{typeId},</if>
45
+			<if test="infoName != null and infoName != ''">#{infoName},</if>
46
+			<if test="memo != null and memo != ''">#{memo},</if>
47
+			<if test="location != null and location != ''">#{location,jdbcType=OTHER,typeHandler=com.lqkj.framework.sql.JsonbTypeHandler},</if>
48
+		</trim>
49
+	</insert>
50
+
51
+	<update id="updateResourcesInfo" parameterType="ResourcesInfo">
52
+		update resources_info
53
+		<trim prefix="SET" suffixOverrides=",">
54
+			<if test="typeId != null ">type_id = #{typeId},</if>
55
+			info_name = #{infoName},
56
+			memo = #{memo},
57
+			location = #{location,jdbcType=OTHER,typeHandler=com.lqkj.framework.sql.JsonbTypeHandler},
58
+		</trim>
59
+		where info_id = #{infoId}
60
+	</update>
61
+
62
+	<delete id="deleteResourcesInfoByInfoId" parameterType="Integer">
63
+		delete from resources_info where info_id = #{infoId}
64
+	</delete>
65
+
66
+	<delete id="deleteResourcesInfoByInfoIds" parameterType="String">
67
+		delete from resources_info where info_id in
68
+		<foreach item="infoId" collection="array" open="(" separator="," close=")">
69
+			#{infoId}
70
+		</foreach>
71
+	</delete>
72
+</mapper>

+ 75 - 0
src/main/resources/mapper/supporting/ResourcesTypeMapper.xml

@@ -0,0 +1,75 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper
3
+		PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4
+		"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5
+<mapper namespace="com.lqkj.supporting.mapper.ResourcesTypeMapper">
6
+
7
+	<resultMap type="ResourcesType" id="ResourcesTypeResult">
8
+		<result property="typeId"    column="type_id"    />
9
+		<result property="typeName"    column="type_name"    />
10
+		<result property="typeLabel"    column="type_label"    />
11
+		<result property="icon"    column="icon"    />
12
+		<result property="orderId"    column="order_id"    />
13
+		<result property="memo"    column="memo"    />
14
+	</resultMap>
15
+
16
+	<sql id="selectResourcesTypeVo">
17
+		select type_id, type_name, type_label, icon, order_id, memo from resources_type
18
+	</sql>
19
+
20
+	<select id="selectResourcesTypeList" parameterType="ResourcesType" resultMap="ResourcesTypeResult">
21
+		<include refid="selectResourcesTypeVo"/>
22
+		<where>
23
+			<if test="typeName != null  and typeName != ''"> and type_name like concat('%', #{typeName}, '%')</if>
24
+			<if test="typeLabel != null  and typeLabel != ''"> and type_label = #{typeLabel}</if>
25
+		</where>
26
+		order by type_id
27
+
28
+	</select>
29
+
30
+	<select id="selectResourcesTypeByTypeId" parameterType="Integer" resultMap="ResourcesTypeResult">
31
+		<include refid="selectResourcesTypeVo"/>
32
+		where type_id = #{typeId}
33
+	</select>
34
+
35
+	<insert id="insertResourcesType" parameterType="ResourcesType" useGeneratedKeys="true" keyProperty="typeId">
36
+		insert into resources_type
37
+		<trim prefix="(" suffix=")" suffixOverrides=",">
38
+			<if test="typeName != null and typeName != ''">type_name,</if>
39
+			<if test="typeLabel != null and typeLabel != ''">type_label,</if>
40
+			<if test="icon != null and icon != ''">icon,</if>
41
+			<if test="orderId != null">order_id,</if>
42
+			<if test="memo != null and memo != ''">memo,</if>
43
+		</trim>
44
+		<trim prefix="values (" suffix=")" suffixOverrides=",">
45
+			<if test="typeName != null and typeName != ''">#{typeName},</if>
46
+			<if test="typeLabel != null and typeLabel != ''">#{typeLabel},</if>
47
+			<if test="icon != null and icon != ''">#{icon},</if>
48
+			<if test="orderId != null">#{orderId},</if>
49
+			<if test="memo != null and memo != ''">#{memo},</if>
50
+		</trim>
51
+	</insert>
52
+
53
+	<update id="updateResourcesType" parameterType="ResourcesType">
54
+		update resources_type
55
+		<trim prefix="SET" suffixOverrides=",">
56
+			<if test="typeName != null  and typeName != ''">type_name = #{typeName},</if>
57
+			<if test="typeLabel != null  and typeLabel != ''">type_label = #{typeLabel},</if>
58
+			icon = #{icon},
59
+			order_id = #{orderId},
60
+			memo = #{memo},
61
+		</trim>
62
+		where type_id = #{typeId}
63
+	</update>
64
+
65
+	<delete id="deleteResourcesTypeByTypeId" parameterType="Integer">
66
+		delete from resources_type where type_id = #{typeId}
67
+	</delete>
68
+
69
+	<delete id="deleteResourcesTypeByTypeIds" parameterType="String">
70
+		delete from resources_type where type_id in
71
+		<foreach item="typeId" collection="array" open="(" separator="," close=")">
72
+			#{typeId}
73
+		</foreach>
74
+	</delete>
75
+</mapper>