上传bug修复
This commit is contained in:
parent
bad3ab281d
commit
1edb9bd8bb
@ -55,10 +55,10 @@ public class FiletransferServiceImpl implements IFiletransferService {
|
|||||||
Uploader uploader = new ChunkUploaderFactory().getUploader(uploadFile);
|
Uploader uploader = new ChunkUploaderFactory().getUploader(uploadFile);
|
||||||
checkParams(uploadFileDTO, uploadFile);
|
checkParams(uploadFileDTO, uploadFile);
|
||||||
List<UploadFile> uploadFileList = uploader.upload(request, PathUtil.getBasePath() + "/");
|
List<UploadFile> uploadFileList = uploader.upload(request, PathUtil.getBasePath() + "/");
|
||||||
minioUtils.uploadBySameName(uploadFile.getUrl(), false);
|
|
||||||
for (int i = 0; i < uploadFileList.size(); i++) {
|
for (int i = 0; i < uploadFileList.size(); i++) {
|
||||||
uploadFile = uploadFileList.get(i);
|
uploadFile = uploadFileList.get(i);
|
||||||
if (uploadFile.getSuccess() == 1) {
|
if (uploadFile.getSuccess() == 1) {
|
||||||
|
minioUtils.uploadBySameName(uploadFile.getUrl(), false);
|
||||||
ProjectFile userFile = new ProjectFile();
|
ProjectFile userFile = new ProjectFile();
|
||||||
userFile.setExtendName(uploadFile.getFileType());
|
userFile.setExtendName(uploadFile.getFileType());
|
||||||
userFile.setFileName(uploadFile.getFileName());
|
userFile.setFileName(uploadFile.getFileName());
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import cn.hutool.core.util.StrUtil;
|
|||||||
import cn.hutool.http.HttpUtil;
|
import cn.hutool.http.HttpUtil;
|
||||||
import cn.xuyanwu.spring.file.storage.FileInfo;
|
import cn.xuyanwu.spring.file.storage.FileInfo;
|
||||||
import cn.xuyanwu.spring.file.storage.FileStorageService;
|
import cn.xuyanwu.spring.file.storage.FileStorageService;
|
||||||
|
import com.gexin.fastjson.JSON;
|
||||||
import com.zhgd.xmgl.config.MinIoClientConfig;
|
import com.zhgd.xmgl.config.MinIoClientConfig;
|
||||||
import com.zhgd.xmgl.constant.Cts;
|
import com.zhgd.xmgl.constant.Cts;
|
||||||
import io.minio.*;
|
import io.minio.*;
|
||||||
@ -261,7 +262,7 @@ public class MinioUtils {
|
|||||||
minioClient.removeObject(removeObjectArgs);
|
minioClient.removeObject(removeObjectArgs);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("minio remove file error. pathUrl:{}", path);
|
log.error("minio remove file error. pathUrl:{}", path);
|
||||||
e.printStackTrace();
|
log.error("", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -324,11 +325,15 @@ public class MinioUtils {
|
|||||||
fileName = StringUtils.substringAfterLast(path, "/");
|
fileName = StringUtils.substringAfterLast(path, "/");
|
||||||
savePath = StringUtils.substringBeforeLast(path, "/");
|
savePath = StringUtils.substringBeforeLast(path, "/");
|
||||||
}
|
}
|
||||||
FileInfo fileInfo = fileStorageService.of(PathUtil.getBasePath() + "/" + path)
|
String url = PathUtil.getBasePath() + "/" + path;
|
||||||
|
String savePath1 = savePath != null ? savePath + "/" : "";
|
||||||
|
log.info("上传minio文件-路径:{},savePath1:{},saveFilename:{}", url, savePath1, fileName);
|
||||||
|
FileInfo fileInfo = fileStorageService.of(url)
|
||||||
.setPlatform(Cts.MINIO_1) //使用指定的存储平台
|
.setPlatform(Cts.MINIO_1) //使用指定的存储平台
|
||||||
.setPath(savePath != null ? savePath + "/" : "")
|
.setPath(savePath1)
|
||||||
.setSaveFilename(fileName)
|
.setSaveFilename(fileName)
|
||||||
.upload();
|
.upload();
|
||||||
|
log.info("上传minio文件:{}", JSON.toJSONString(fileInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user