|
@@ -4,10 +4,7 @@ import com.alibaba.fastjson2.JSON;
|
4
|
4
|
import com.alibaba.fastjson2.JSONObject;
|
5
|
5
|
import com.lqkj.link.module.authority.domain.UserInfo;
|
6
|
6
|
import com.lqkj.link.module.authority.repository.UserInfoRepository;
|
7
|
|
-import com.lqkj.link.module.zone.domain.GeomInfo;
|
8
|
|
-import com.lqkj.link.module.zone.domain.ModelInfo;
|
9
|
|
-import com.lqkj.link.module.zone.domain.TemplateInfo;
|
10
|
|
-import com.lqkj.link.module.zone.domain.ZoneInfo;
|
|
7
|
+import com.lqkj.link.module.zone.domain.*;
|
11
|
8
|
import com.lqkj.link.module.zone.repository.GeomInfoRepository;
|
12
|
9
|
import com.lqkj.link.module.zone.repository.ModelInfoRepository;
|
13
|
10
|
import com.lqkj.link.module.zone.repository.ZoneInfoRepository;
|
|
@@ -78,37 +75,59 @@ public class ZoneInfoService {
|
78
|
75
|
|
79
|
76
|
|
80
|
77
|
|
81
|
|
-
|
82
|
|
-
|
83
|
|
-
|
84
|
|
-
|
85
|
|
-
|
86
|
|
-
|
87
|
|
-
|
88
|
|
-
|
89
|
|
-
|
90
|
|
-
|
91
|
|
-
|
92
|
|
-
|
93
|
|
-
|
94
|
|
-
|
95
|
|
-
|
96
|
|
-
|
97
|
|
-
|
98
|
|
-
|
99
|
|
-
|
100
|
|
-
|
101
|
|
-
|
102
|
|
-
|
103
|
|
-
|
104
|
|
-
|
105
|
|
-
|
106
|
|
-
|
107
|
|
-
|
108
|
|
-
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
109
|
123
|
Unzipper.unZipFiles(new File("." + zoneInfo.getTemplateFilePath()), "./upload/template/" + zoneInfo1.getZoneId() + "/");
|
110
|
124
|
String geomJsonString = Files.readString(Paths.get("./upload/template/" + zoneInfo1.getZoneId() + "/geom.json"));
|
111
|
|
- List<TemplateInfo> templateInfoList = JSON.parseArray(geomJsonString, TemplateInfo.class);
|
|
125
|
+ TemplateGeom templateGeom = JSON.parseObject(geomJsonString, TemplateGeom.class);
|
|
126
|
+
|
|
127
|
+ zoneInfo1.setInitLocation(templateGeom.getInit());
|
|
128
|
+ zoneInfoRepository.save(zoneInfo1);
|
|
129
|
+
|
|
130
|
+ List<TemplateInfo> templateInfoList = templateGeom.getModels();
|
112
|
131
|
|
113
|
132
|
String modelFolderPath = "./upload/template/" + zoneInfo1.getZoneId() + "/models";
|
114
|
133
|
File modelFolder = new File(modelFolderPath);
|
|
@@ -273,16 +292,19 @@ public class ZoneInfoService {
|
273
|
292
|
result.put("msg", "不能与已有作品重名!");
|
274
|
293
|
return result;
|
275
|
294
|
}
|
276
|
|
- ZoneInfo zoneInfo = new ZoneInfo(null, userInfo.getUserId(), name, null,
|
277
|
|
- null, 0, new Date(), 0, 0,
|
|
295
|
+
|
|
296
|
+ ZoneInfo template = null;
|
|
297
|
+ if (templateId != null) {
|
|
298
|
+ template = zoneInfoRepository.findById(templateId).get();
|
|
299
|
+ }
|
|
300
|
+
|
|
301
|
+ ZoneInfo zoneInfo = new ZoneInfo(null, userInfo.getUserId(), name, template == null ? null : template.getInitLocation(),
|
|
302
|
+ template == null ? null : template.getThumbnail(), 0, new Date(), 0, 0,
|
278
|
303
|
null, null, 0);
|
279
|
304
|
ZoneInfo newInfo = zoneInfoRepository.save(zoneInfo);
|
280
|
305
|
|
281
|
306
|
if (templateId != null) {
|
282
|
307
|
GeometryFactory geometryFactory = new GeometryFactory();
|
283
|
|
- ZoneInfo template = zoneInfoRepository.findById(templateId).get();
|
284
|
|
- newInfo.setThumbnail(template.getThumbnail());
|
285
|
|
- zoneInfoRepository.save(newInfo);
|
286
|
308
|
if (geomInfoRepository.hasGeom(templateId)) {
|
287
|
309
|
List<GeomInfo> geomInfoList = geomInfoRepository.findAllByZoneId(templateId);
|
288
|
310
|
List<GeomInfo> list = new ArrayList<>();
|
|
@@ -303,11 +325,11 @@ public class ZoneInfoService {
|
303
|
325
|
}
|
304
|
326
|
geomInfoRepository.saveAll(list);
|
305
|
327
|
}
|
|
328
|
+
|
|
329
|
+ zoneInfoRepository.addTemplateUse(templateId);
|
306
|
330
|
}
|
307
|
331
|
result.put("zone", newInfo);
|
308
|
332
|
|
309
|
|
-
|
310
|
|
- zoneInfoRepository.addTemplateUse(templateId);
|
311
|
333
|
return result;
|
312
|
334
|
}
|
313
|
335
|
|