Browse Source

Merge branch 'release/V1.0.1/test' of http://192.168.4.240:3000/LINK/LINK-SERVER into release/V2.0.0/test

 Conflicts:
	src/main/java/com/lqkj/link/module/zone/controller/ZoneInfoController.java
	src/main/java/com/lqkj/link/module/zone/domain/ZoneInfo.java
	src/main/java/com/lqkj/link/module/zone/repository/ZoneInfoRepository.java
	src/main/java/com/lqkj/link/module/zone/service/ZoneInfoService.java
liaoyitao 4 months ago
parent
commit
ccd7a69d25

+ 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
     }

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

@@ -1,9 +1,11 @@
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;
6 7
 import com.lqkj.link.module.base.service.BaseService;
8
+import com.lqkj.link.module.bulletin.domain.BulletinInfo;
7 9
 import com.lqkj.link.module.jwt.service.JwtService;
8 10
 import com.lqkj.link.module.zone.domain.ZoneInfo;
9 11
 import com.lqkj.link.module.zone.service.ZoneInfoService;
@@ -413,4 +415,46 @@ public class ZoneInfoController {
413 415
         return MessageBean.ok(zoneInfoService.viewShareUser(zoneId), "查看分享用户");
414 416
     }
415 417
 
418
+
419
+    @PostMapping("/getSpawnPointList")
420
+    public MessageBean<List<Map<String, Object>>> getSpawnPointList(@RequestParam Integer zoneId) {
421
+        return MessageBean.ok(zoneInfoService.getSpawnPointList(zoneId), "获取出生点列表");
422
+    }
423
+
424
+    @Operation(
425
+            summary = "保存作品",
426
+            description = "保存作品",
427
+            requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(
428
+                    description = "通知公告信息实体",
429
+                    required = true,
430
+                    content = @Content(
431
+                            mediaType = "application/json",
432
+                            schema = @Schema(implementation = BulletinInfo.class)
433
+                    )
434
+            ))
435
+    @PostMapping("/save")
436
+    public MessageBean<String> save(@RequestBody ZoneInfo zoneInfo) {
437
+        zoneInfoService.save(zoneInfo);
438
+        return MessageBean.ok();
439
+    }
440
+
441
+
442
+    @Operation(
443
+            summary = "作品详情",
444
+            description = "作品详情",
445
+            parameters = {
446
+                    @Parameter(name = "zoneId", description = "作品ID", required = true)
447
+            }
448
+    )
449
+    @PostMapping("/zoneDetails")
450
+    public MessageBean<ZoneInfo> zoneDetails(@RequestParam Integer zoneId) {
451
+
452
+        return MessageBean.ok(zoneInfoService.zoneDetails(zoneId), "作品详情");
453
+    }
454
+
455
+
456
+
457
+
458
+
459
+
416 460
 }

+ 4 - 0
src/main/java/com/lqkj/link/module/zone/domain/GeomInfo.java

@@ -66,6 +66,10 @@ public class GeomInfo {
66 66
     private Boolean navigation;
67 67
     @Column(name = "navigation_end")
68 68
     private String navigationEnd;
69
+    @Column(name = "type_number")
70
+    private Integer typeNumber;
71
+    @Column(name = "static_id")
72
+    private Integer staticId;
69 73
 
70 74
     /**
71 75
      * 材质ID

+ 3 - 0
src/main/java/com/lqkj/link/module/zone/domain/ZoneInfo.java

@@ -62,4 +62,7 @@ public class ZoneInfo {
62 62
     @Column(name = "like_count")
63 63
     @Schema(description = "点赞次数")
64 64
     private Integer likeCount;
65
+    @Column(name = "effect_address")
66
+    @Schema(description = "模板文件路径")
67
+    private String effectAddress;
65 68
 }

+ 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;
@@ -223,4 +225,9 @@ public interface ZoneInfoRepository extends JpaRepository<ZoneInfo, Integer> {
223 225
     void acceptShare(@Param("zoneId") Integer zoneId,
224 226
                      @Param("userId") Integer userId,
225 227
                      @Param("acceptStatus") Boolean acceptStatus);
228
+
229
+    @Query(nativeQuery = true,
230
+            value = "SELECT * FROM initial_points WHERE zone_id =:zoneId"
231
+    )
232
+    List<Map<String, Object>> getSpawnPointList(@Param("zoneId") Integer zoneId);
226 233
 }

+ 38 - 5
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;
@@ -15,6 +16,7 @@ import org.apache.commons.lang3.StringUtils;
15 16
 import org.apache.commons.lang3.SystemUtils;
16 17
 import org.aspectj.weaver.ast.Var;
17 18
 import org.checkerframework.checker.units.qual.A;
19
+import org.aspectj.weaver.ast.Var;
18 20
 import org.locationtech.jts.geom.Coordinate;
19 21
 import org.locationtech.jts.geom.GeometryFactory;
20 22
 import org.springframework.beans.BeanUtils;
@@ -380,13 +382,12 @@ public class ZoneInfoService {
380 382
             template = zoneInfoRepository.findById(templateId).get();
381 383
         }
382 384
 
383
-        ZoneInfo zoneInfo = new ZoneInfo(null, userInfo.getUserId(), name, template == null ? null : template.getInitLocation(),
385
+        ZoneInfo zoneInfo = new ZoneInfo(null, userInfo.getUserId(), name, template == null ? new JSONObject(JSON.parseObject("{\"rotation\":{\"x\":0,\"y\":0.4383658766746521,\"z\":0,\"w\":0.8987966179847717},\"translation\":{\"x\":-820.947265625,\"y\":0,\"z\":955.6719360351563},\"scale3D\":{\"x\":1,\"y\":1,\"z\":1}}")) : template.getInitLocation(),
384 386
                 template == null ? null : template.getThumbnail(), 0, new Date(), 0, 0,
385
-                null, null, 0, 0);
387
+                null, null, 0,null);
386 388
         ZoneInfo newInfo = zoneInfoRepository.save(zoneInfo);
387
-
389
+        GeometryFactory geometryFactory = new GeometryFactory();
388 390
         if (templateId != null) {
389
-            GeometryFactory geometryFactory = new GeometryFactory();
390 391
             if (geomInfoRepository.hasGeom(templateId)) {
391 392
                 List<GeomInfo> geomInfoList = geomInfoRepository.findAllByZoneId(templateId);
392 393
                 List<GeomInfo> list = new ArrayList<>();
@@ -409,6 +410,17 @@ public class ZoneInfoService {
409 410
             }
410 411
             // 模板使用次数+1
411 412
             zoneInfoRepository.addTemplateUse(templateId);
413
+        }else {
414
+            GeomInfo geomInfo = new GeomInfo();
415
+            geomInfo.setZoneId(newInfo.getZoneId());
416
+            geomInfo.setGeomId(newInfo.getZoneId() + "_1");
417
+            geomInfo.setModelId(10000);
418
+            geomInfo.setGeomName("地板");
419
+            geomInfo.setLocking(false);
420
+            geomInfo.setTrans(new JSONObject(JSON.parseObject("{\"rotation\":{\"x\":0,\"y\":0,\"z\":0,\"w\":1},\"translation\":{\"x\":0,\"y\":0,\"z\":20},\"scale3D\":{\"x\":1,\"y\":1,\"z\":1}}")));
421
+            geomInfo.setGeom(geometryFactory.createPoint(new Coordinate(0, 0, 0)));
422
+            geomInfo.setTypeNumber(0);
423
+            geomInfoRepository.save(geomInfo);
412 424
         }
413 425
         result.put("zone", newInfo);
414 426
 
@@ -418,7 +430,7 @@ public class ZoneInfoService {
418 430
     public void saveThumbnail(Integer zoneId, String thumbnailPath) {
419 431
         ZoneInfo zoneInfo = zoneInfoRepository.findById(zoneId).get();
420 432
         zoneInfo.setThumbnail(thumbnailPath);
421
-        zoneInfo.setUpdateTime(new Date());
433
+//        zoneInfo.setUpdateTime(new Date());
422 434
         zoneInfoRepository.save(zoneInfo);
423 435
     }
424 436
 
@@ -510,4 +522,25 @@ public class ZoneInfoService {
510 522
             return mutableMap;
511 523
         }).collect(Collectors.toList());
512 524
     }
525
+    public List<Map<String, Object>> getSpawnPointList(Integer zoneId) {
526
+        List<Map<String, Object>> spawnPointList = zoneInfoRepository.getSpawnPointList(zoneId);
527
+        ArrayList<Map<String, Object>> maps = new ArrayList<>();
528
+        for (Map<String, Object> map : spawnPointList) {
529
+            HashMap<String, Object> stringObjectHashMap = new HashMap<>();
530
+            stringObjectHashMap.put("id", map.get("id"));
531
+            stringObjectHashMap.put("zone_id", map.get("zone_id"));
532
+            stringObjectHashMap.put("name", map.get("name"));
533
+            stringObjectHashMap.put("init_location", JSONObject.parse(map.get("init_location").toString()));
534
+            maps.add(stringObjectHashMap);
535
+        }
536
+        return maps;
537
+    }
538
+
539
+    public void save(ZoneInfo zoneInfo) {
540
+        zoneInfoRepository.save(zoneInfo);
541
+    }
542
+
543
+    public ZoneInfo zoneDetails(Integer zoneId) {
544
+        return zoneInfoRepository.findById(zoneId).get();
545
+    }
513 546
 }

+ 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 '初始位置';

+ 15 - 0
src/main/resources/db/migration/V5__1.0.0.sql

@@ -0,0 +1,15 @@
1
+ALTER TABLE zone_info
2
+add COLUMN if not exists effect_address VARCHAR(255);
3
+comment on column zone_info.effect_address is '特效文件地址';
4
+
5
+ALTER TABLE geom_info
6
+    add COLUMN if not exists type_number int default 0;
7
+comment on column geom_info.type_number is '类型编号0:模型 1:特效';
8
+
9
+ALTER TABLE geom_info
10
+    add COLUMN if not exists static_id int;
11
+comment on column geom_info.static_id is '类型编号';
12
+
13
+INSERT INTO "public"."model_category" ("category_id", "user_id", "icon", "category_name", "order_id", "compress_file_path", "compress_file_name") VALUES (10000, NULL, 'https://link-meta.oss-cn-chengdu.aliyuncs.com/file/2024-12-02/7F1B512F-4D21-4c7a-83E8-4AE96D0C3CB4.png', '地形', NULL, NULL, NULL);
14
+
15
+INSERT INTO "public"."model_info" ("model_id", "category_id", "model_name", "json_path", "texture_path", "order_id", "original_path", "model_icon", "template_id") VALUES (10000, 10000, '地板', NULL, NULL, NULL, 'https://link-meta.oss-cn-chengdu.aliyuncs.com/file/2024-12-02/2.fbx', 'https://link-meta.oss-cn-chengdu.aliyuncs.com/file/2024-12-02/7F1B512F-4D21-4c7a-83E8-4AE96D0C3CB4.png', NULL);