|
@@ -152,9 +152,20 @@ public class FileUploadController {
|
|
|
, @RequestParam String model_name, @RequestParam String model_type, @RequestParam String model_no, @RequestParam String output_list, SysUser sysUser
|
|
|
) throws IOException {
|
|
|
int type = Integer.parseInt(model_type);
|
|
|
+
|
|
|
+ String filename="";
|
|
|
+ String filefmt="";
|
|
|
+ int lastDotIndex = name.lastIndexOf(".");
|
|
|
+ if (lastDotIndex != -1 && lastDotIndex < name.length() - 1) {
|
|
|
+ filename = name.substring(0, lastDotIndex);
|
|
|
+ filefmt = name.substring(lastDotIndex + 1);
|
|
|
+ } else {
|
|
|
+ return Result.error("文件名中不包含点或点在末尾");
|
|
|
+ }
|
|
|
+
|
|
|
if (type == 1 || type == 2) {
|
|
|
- String filename = name.split("\\.")[0];
|
|
|
- String filefmt = name.split("\\.")[1];
|
|
|
+
|
|
|
+
|
|
|
String fullFileName = String.join("-", new String[]{filename, uid, index + "", "." + filefmt});
|
|
|
String filePath = fileuploadPath + "/" + sysUser.getUserName() + "/" + filename + "." + filefmt;
|
|
|
log.info("filename:" + fullFileName);
|
|
@@ -201,8 +212,7 @@ public class FileUploadController {
|
|
|
|
|
|
} else {
|
|
|
// http请求
|
|
|
- String filename = name.split("\\.")[0];
|
|
|
- String filefmt = name.split("\\.")[1];
|
|
|
+
|
|
|
String fullFileName = String.join("-", new String[]{filename, uid, index + "", "." + filefmt});
|
|
|
log.info("filename:" + fullFileName);
|
|
|
File dir = new File(warPath);
|