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