资质上传到本地

dev2.0
薛宇 2 years ago
parent 9b3d6927d1
commit b9252fa091

@ -26,6 +26,10 @@ public class uploadController {
@Value("${file_path}")
private String filePath;
@Value("${file_url}")
private String fileUrl;
@Value("${file_lpath}")
private String fileLpath;
@Value("${minio_path}")
private String minioPath;
@Value("${minio_url}")
@ -121,23 +125,23 @@ public class uploadController {
return ResultVOUtils.error(ResultEnum.DATA_ERROR, "上传文件只能是 jpg,png,doc,pdf 格式");
}
String newName = UUID.randomUUID() + fileType;//生成新文件名
String savePath = minioPath + "/register/file/" + type;
String fileFullName = savePath + "/" + newName;
String savePath = filePath + "/register/" + type;
String savePath1 = fileLpath + "?type=" + type;
// File file1 = new File(savePath);
// if (!file1.exists()) {// 判断目录是否存在
// file1.mkdirs();// 创建多层目录
// }
// file1 = new File(savePath + "/" + newName);
File file1 = new File(savePath);
if (!file1.exists()) {// 判断目录是否存在
file1.mkdirs();// 创建多层目录
}
file1 = new File(savePath + "/" + newName);
try {
// file.transferTo(file1);
MinioUtil.uploadFile(fileFullName, file);
file.transferTo(file1);
// MinioUtil.uploadFile(fileFullName, file);
Map<String, String> rMap = new HashMap<>();
rMap.put("msg", "上传成功");
rMap.put("name", minioUrl + fileFullName);
rMap.put("name", fileUrl + savePath1 + "&name=" + newName);
rMap.put("type", type);
return ResultVOUtils.success(rMap);
} catch (Exception e) {
} catch (IOException e) {
e.printStackTrace();
}
return ResultVOUtils.error(ResultEnum.DATA_ERROR, "上传失败");

@ -47,7 +47,9 @@ logging:
level:
com.glxp.api.dao: debug
file_path: d:/udi/udiwms/udiwmsfile/
file_path: D:/udi/udiwms/udiwmsfile/
file_url: http://127.0.0.1:9993
file_lpath: /udiwms/image/register/file/getImage
minio_path: /udi
minio_url: http://139.9.219.60:9000
err_path: d:/udi/udiwms/err/

Loading…
Cancel
Save