|
@@ -302,13 +302,12 @@ public class ZoneInfoService {
|
302
|
302
|
template = zoneInfoRepository.findById(templateId).get();
|
303
|
303
|
}
|
304
|
304
|
|
305
|
|
- ZoneInfo zoneInfo = new ZoneInfo(null, userInfo.getUserId(), name, template == null ? null : template.getInitLocation(),
|
|
305
|
+ 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(),
|
306
|
306
|
template == null ? null : template.getThumbnail(), 0, new Date(), 0, 0,
|
307
|
307
|
null, null, 0,null);
|
308
|
308
|
ZoneInfo newInfo = zoneInfoRepository.save(zoneInfo);
|
309
|
|
-
|
|
309
|
+ GeometryFactory geometryFactory = new GeometryFactory();
|
310
|
310
|
if (templateId != null) {
|
311
|
|
- GeometryFactory geometryFactory = new GeometryFactory();
|
312
|
311
|
if (geomInfoRepository.hasGeom(templateId)) {
|
313
|
312
|
List<GeomInfo> geomInfoList = geomInfoRepository.findAllByZoneId(templateId);
|
314
|
313
|
List<GeomInfo> list = new ArrayList<>();
|
|
@@ -331,6 +330,17 @@ public class ZoneInfoService {
|
331
|
330
|
}
|
332
|
331
|
// 模板使用次数+1
|
333
|
332
|
zoneInfoRepository.addTemplateUse(templateId);
|
|
333
|
+ }else {
|
|
334
|
+ GeomInfo geomInfo = new GeomInfo();
|
|
335
|
+ geomInfo.setZoneId(newInfo.getZoneId());
|
|
336
|
+ geomInfo.setGeomId(newInfo.getZoneId() + "_1");
|
|
337
|
+ geomInfo.setModelId(10000);
|
|
338
|
+ geomInfo.setGeomName("地板");
|
|
339
|
+ geomInfo.setLocking(false);
|
|
340
|
+ 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}}")));
|
|
341
|
+ geomInfo.setGeom(geometryFactory.createPoint(new Coordinate(0, 0, 0)));
|
|
342
|
+ geomInfo.setTypeNumber(0);
|
|
343
|
+ geomInfoRepository.save(geomInfo);
|
334
|
344
|
}
|
335
|
345
|
result.put("zone", newInfo);
|
336
|
346
|
|
|
@@ -340,7 +350,7 @@ public class ZoneInfoService {
|
340
|
350
|
public void saveThumbnail(Integer zoneId, String thumbnailPath) {
|
341
|
351
|
ZoneInfo zoneInfo = zoneInfoRepository.findById(zoneId).get();
|
342
|
352
|
zoneInfo.setThumbnail(thumbnailPath);
|
343
|
|
- zoneInfo.setUpdateTime(new Date());
|
|
353
|
+// zoneInfo.setUpdateTime(new Date());
|
344
|
354
|
zoneInfoRepository.save(zoneInfo);
|
345
|
355
|
}
|
346
|
356
|
|