|
@@ -251,7 +251,15 @@ public class ToInfraredServiceImpl extends BaseServiceImpl<ToInfraredMapper, ToI
|
|
|
} catch (Exception e2) {
|
|
|
if (val.contains(",")) {
|
|
|
val = val.replaceAll("\\[", "").replaceAll("\\]", "").replaceAll("\\s", "");
|
|
|
- return Arrays.stream(val.split(",")).map(Integer::parseInt).collect(Collectors.toList());
|
|
|
+ try {
|
|
|
+ return Arrays.stream(val.split(",")).map(Integer::parseInt).collect(Collectors.toList());
|
|
|
+ } catch (Exception e3) {
|
|
|
+ try {
|
|
|
+ return Arrays.stream(val.split(",")).map(Double::parseDouble).collect(Collectors.toList());
|
|
|
+ } catch (Exception e4) {
|
|
|
+ return "[" + val + "]";
|
|
|
+ }
|
|
|
+ }
|
|
|
} else {
|
|
|
return Boolean.parseBoolean(val);
|
|
|
}
|
|
@@ -538,6 +546,21 @@ public class ToInfraredServiceImpl extends BaseServiceImpl<ToInfraredMapper, ToI
|
|
|
return content;
|
|
|
}
|
|
|
|
|
|
+ public static long getFolderSize(File folder) {
|
|
|
+ long totalSize = 0;
|
|
|
+ if (folder.isDirectory()) {
|
|
|
+ File[] files = folder.listFiles();
|
|
|
+ if (files != null) {
|
|
|
+ for (File file : files) {
|
|
|
+ totalSize += getFolderSize(file);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ totalSize = folder.length();
|
|
|
+ }
|
|
|
+ return totalSize;
|
|
|
+ }
|
|
|
+
|
|
|
public static CommonResult getModelList_(String modelPath, String profile) {
|
|
|
File modelDir = new File(modelPath);
|
|
|
if (!modelDir.exists()) {
|
|
@@ -547,7 +570,8 @@ public class ToInfraredServiceImpl extends BaseServiceImpl<ToInfraredMapper, ToI
|
|
|
Integer idx = 0;
|
|
|
ArrayList<Map<String, String>> res = new ArrayList<>();
|
|
|
for (File file : files) {
|
|
|
- if (file.getName().endsWith(".log")) {
|
|
|
+ if (file.getName().endsWith(".log") || file.getName().endsWith(".json")
|
|
|
+ || file.getName().startsWith("events.out")) {
|
|
|
continue;
|
|
|
}
|
|
|
idx += 1;
|
|
@@ -556,14 +580,14 @@ public class ToInfraredServiceImpl extends BaseServiceImpl<ToInfraredMapper, ToI
|
|
|
tmp.put("name", file.getName());
|
|
|
String filePath = file.getPath();
|
|
|
tmp.put("path", filePath);
|
|
|
- // todo 获取真正的url
|
|
|
+ // 获取url
|
|
|
// http://localhost:9090/profile/upload/2024/10/27/1_1729404909511_20241027153840A001.zip
|
|
|
// /profile/upload/2024/10/27/1_1729404909511_20241027153840A001.zip
|
|
|
String url = "/api" + Constants.RESOURCE_PREFIX + filePath.substring(profile.length());
|
|
|
url = url.replaceAll("\\\\", "/"); // windows
|
|
|
tmp.put("url", url);
|
|
|
|
|
|
- double fileSize = (file.length() / (1024.0 * 1024.0));
|
|
|
+ double fileSize = (getFolderSize(file) / (1024.0 * 1024.0));
|
|
|
DecimalFormat decimalFormat = new DecimalFormat("#.##");
|
|
|
String formatFileSize = decimalFormat.format(fileSize);
|
|
|
tmp.put("size", formatFileSize + "MB");
|