|
@@ -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);
|
|
@@ -276,16 +295,19 @@ public class ZoneInfoService {
|
276
|
295
|
result.put("msg", "不能与已有作品重名!");
|
277
|
296
|
return result;
|
278
|
297
|
}
|
279
|
|
- ZoneInfo zoneInfo = new ZoneInfo(null, userInfo.getUserId(), name, null,
|
280
|
|
- null, 0, new Date(), 0, 0,
|
|
298
|
+
|
|
299
|
+ ZoneInfo template = null;
|
|
300
|
+ if (templateId != null) {
|
|
301
|
+ template = zoneInfoRepository.findById(templateId).get();
|
|
302
|
+ }
|
|
303
|
+
|
|
304
|
+ ZoneInfo zoneInfo = new ZoneInfo(null, userInfo.getUserId(), name, template == null ? null : template.getInitLocation(),
|
|
305
|
+ template == null ? null : template.getThumbnail(), 0, new Date(), 0, 0,
|
281
|
306
|
null, null, 0);
|
282
|
307
|
ZoneInfo newInfo = zoneInfoRepository.save(zoneInfo);
|
283
|
308
|
|
284
|
309
|
if (templateId != null) {
|
285
|
310
|
GeometryFactory geometryFactory = new GeometryFactory();
|
286
|
|
- ZoneInfo template = zoneInfoRepository.findById(templateId).get();
|
287
|
|
- newInfo.setThumbnail(template.getThumbnail());
|
288
|
|
- zoneInfoRepository.save(newInfo);
|
289
|
311
|
if (geomInfoRepository.hasGeom(templateId)) {
|
290
|
312
|
List<GeomInfo> geomInfoList = geomInfoRepository.findAllByZoneId(templateId);
|
291
|
313
|
List<GeomInfo> list = new ArrayList<>();
|
|
@@ -306,11 +328,11 @@ public class ZoneInfoService {
|
306
|
328
|
}
|
307
|
329
|
geomInfoRepository.saveAll(list);
|
308
|
330
|
}
|
|
331
|
+
|
|
332
|
+ zoneInfoRepository.addTemplateUse(templateId);
|
309
|
333
|
}
|
310
|
334
|
result.put("zone", newInfo);
|
311
|
335
|
|
312
|
|
-
|
313
|
|
- zoneInfoRepository.addTemplateUse(templateId);
|
314
|
336
|
return result;
|
315
|
337
|
}
|
316
|
338
|
|