Browse Source

fix:增加出点

liaoyitao 4 months ago
parent
commit
09ffdd5fc9

+ 1 - 0
src/main/java/com/lqkj/link/config/OpenApiConfig.java

@@ -107,6 +107,7 @@ public class OpenApiConfig {
107 107
                         "/notice/v1/**",
108 108
                         "/layer/v1/**",
109 109
                         "/resource/v1/**",
110
+                        "/zone/getSpawnPointList",
110 111
                         "/resource/ossUpload")
111 112
                 .build();
112 113
     }

+ 8 - 0
src/main/java/com/lqkj/link/module/zone/controller/ZoneInfoController.java

@@ -1,5 +1,6 @@
1 1
 package com.lqkj.link.module.zone.controller;
2 2
 
3
+import com.alibaba.fastjson2.JSONArray;
3 4
 import com.alibaba.fastjson2.JSONObject;
4 5
 import com.lqkj.link.message.MessageBean;
5 6
 import com.lqkj.link.message.MessageListBean;
@@ -334,4 +335,11 @@ public class ZoneInfoController {
334 335
     public MessageBean<JSONObject> loadTrans(@RequestParam Integer zoneId) {
335 336
         return MessageBean.ok(zoneInfoService.readTrans(zoneId), "获取变换接口");
336 337
     }
338
+
339
+    @PostMapping("/getSpawnPointList")
340
+    public MessageBean<List<Map<String, Object>>> getSpawnPointList(@RequestParam Integer zoneId) {
341
+        return MessageBean.ok(zoneInfoService.getSpawnPointList(zoneId), "获取出生点列表");
342
+    }
343
+
344
+
337 345
 }

+ 7 - 0
src/main/java/com/lqkj/link/module/zone/repository/ZoneInfoRepository.java

@@ -1,5 +1,7 @@
1 1
 package com.lqkj.link.module.zone.repository;
2 2
 
3
+import com.alibaba.fastjson2.JSONArray;
4
+import com.alibaba.fastjson2.JSONObject;
3 5
 import com.lqkj.link.module.zone.domain.ZoneInfo;
4 6
 import org.springframework.data.domain.Page;
5 7
 import org.springframework.data.domain.Pageable;
@@ -186,4 +188,9 @@ public interface ZoneInfoRepository extends JpaRepository<ZoneInfo, Integer> {
186 188
     )
187 189
     Boolean hasSameTemplateNameWithoutOne(@Param("zoneName") String zoneName,
188 190
                                           @Param("zoneId") Integer zoneId);
191
+
192
+    @Query(nativeQuery = true,
193
+            value = "SELECT * FROM initial_points WHERE zone_id =:zoneId"
194
+    )
195
+    List<Map<String, Object>> getSpawnPointList(@Param("zoneId") Integer zoneId);
189 196
 }

+ 15 - 0
src/main/java/com/lqkj/link/module/zone/service/ZoneInfoService.java

@@ -1,6 +1,7 @@
1 1
 package com.lqkj.link.module.zone.service;
2 2
 
3 3
 import com.alibaba.fastjson2.JSON;
4
+import com.alibaba.fastjson2.JSONArray;
4 5
 import com.alibaba.fastjson2.JSONObject;
5 6
 import com.lqkj.link.module.authority.domain.UserInfo;
6 7
 import com.lqkj.link.module.authority.repository.UserInfoRepository;
@@ -11,6 +12,7 @@ import com.lqkj.link.module.zone.repository.ZoneInfoRepository;
11 12
 import com.lqkj.link.util.AliOSSUtils;
12 13
 import com.lqkj.link.util.Unzipper;
13 14
 import org.apache.commons.lang3.StringUtils;
15
+import org.aspectj.weaver.ast.Var;
14 16
 import org.locationtech.jts.geom.Coordinate;
15 17
 import org.locationtech.jts.geom.GeometryFactory;
16 18
 import org.springframework.beans.factory.annotation.Autowired;
@@ -346,4 +348,17 @@ public class ZoneInfoService {
346 348
         return zoneInfoRepository.findById(zoneId).get().getInitLocation();
347 349
     }
348 350
 
351
+    public List<Map<String, Object>> getSpawnPointList(Integer zoneId) {
352
+        List<Map<String, Object>> spawnPointList = zoneInfoRepository.getSpawnPointList(zoneId);
353
+        ArrayList<Map<String, Object>> maps = new ArrayList<>();
354
+        for (Map<String, Object> map : spawnPointList) {
355
+            HashMap<String, Object> stringObjectHashMap = new HashMap<>();
356
+            stringObjectHashMap.put("id", map.get("id"));
357
+            stringObjectHashMap.put("zone_id", map.get("zone_id"));
358
+            stringObjectHashMap.put("name", map.get("name"));
359
+            stringObjectHashMap.put("init_location", JSONObject.parse(map.get("init_location").toString()));
360
+            maps.add(stringObjectHashMap);
361
+        }
362
+        return maps;
363
+    }
349 364
 }

+ 12 - 0
src/main/resources/db/migration/V4__1.0.0.sql

@@ -0,0 +1,12 @@
1
+create table initial_points(
2
+    id            SERIAL               not null,
3
+    zone_id       INT4                 null,
4
+    name          VARCHAR(255)         null,
5
+    init_location        jsonb                null,
6
+    constraint PK_INITIAL_POINTS primary key (id)
7
+);
8
+comment on table initial_points is '初始点';
9
+comment on column initial_points.id is 'id';
10
+comment on column initial_points.zone_id is '所属区域';
11
+comment on column initial_points.name is '名称';
12
+comment on column initial_points.init_location is '初始位置';