|
@@ -159,6 +159,7 @@ public class ZoneInfoService {
|
159
|
159
|
result.put("msg", "模板压缩文件解压失败!");
|
160
|
160
|
return result;
|
161
|
161
|
}
|
|
162
|
+ checkZipContent(zoneInfo1);
|
162
|
163
|
TemplateGeom templateGeom = JSON.parseObject(geomJsonString, TemplateGeom.class);
|
163
|
164
|
|
164
|
165
|
zoneInfo1.setInitLocation(templateGeom.getInit());
|
|
@@ -259,6 +260,27 @@ public class ZoneInfoService {
|
259
|
260
|
return result;
|
260
|
261
|
}
|
261
|
262
|
|
|
263
|
+ private void checkZipContent(ZoneInfo zoneInfo) {
|
|
264
|
+ int fileLength;
|
|
265
|
+ if (zoneInfo.getTypeNumber() == 1){
|
|
266
|
+ String modelFolderPath = "./upload/template/" + zoneInfo.getZoneId() + "/models";
|
|
267
|
+ File modelFolder = new File(modelFolderPath);
|
|
268
|
+ File[] models = modelFolder.listFiles();
|
|
269
|
+ fileLength = models == null ? 0 : models.length;
|
|
270
|
+ }
|
|
271
|
+ else {
|
|
272
|
+ String directoryPath = "./upload/template/" + zoneInfo.getZoneId();
|
|
273
|
+ File directory = new File(directoryPath);
|
|
274
|
+ // 获取目录下的所有文件
|
|
275
|
+ File[] files = directory.listFiles((dir, name) -> name.endsWith(".pak"));
|
|
276
|
+ fileLength = files == null ? 0 : files.length;
|
|
277
|
+ }
|
|
278
|
+ if (fileLength == 0){
|
|
279
|
+ throw new RuntimeException("模板内容选择有误,请确认后重新上传!");
|
|
280
|
+ }
|
|
281
|
+
|
|
282
|
+ }
|
|
283
|
+
|
262
|
284
|
@Transactional
|
263
|
285
|
public void deleteTemplate(List<Integer> zoneIds) {
|
264
|
286
|
zoneInfoRepository.deleteAllByIdInBatch(zoneIds);
|