Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
17d4235e42
@ -78,6 +78,30 @@ public class EbikeOrdersSystemInfoController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 附件文件上传用户头像
|
||||||
|
*
|
||||||
|
* @param multipartFile 文件对象
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping(value = "fileUploadUserPicture", consumes = "multipart/*", headers = "content-type=multipart/form-data")
|
||||||
|
public JsonResult<?> fileUploadUserPicture(@RequestParam("multipartFile") MultipartFile multipartFile) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
minioUtil.createBucket(MinioUtil.BUCKET_USERS);
|
||||||
|
InputStream inputStream = multipartFile.getInputStream();
|
||||||
|
String fileName = multipartFile.getOriginalFilename();
|
||||||
|
String fileUniqueKey = UUID.randomUUID() + fileName.substring(fileName.lastIndexOf("."));
|
||||||
|
minioUtil.uploadFile(inputStream, MinioUtil.BUCKET_USERS, fileUniqueKey);
|
||||||
|
String minioFileUrl = minioUtil.getFileUrl(MinioUtil.BUCKET_USERS, fileUniqueKey);
|
||||||
|
EbikeOrderAttachmentFileDto ebikeAttachmentFileDto = new EbikeOrderAttachmentFileDto();
|
||||||
|
ebikeAttachmentFileDto.setUrl(minioFileUrl);
|
||||||
|
return JsonResult.success(ebikeAttachmentFileDto);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("fileUploadUser===>{}", e.getMessage() + Arrays.toString(e.getStackTrace()));
|
||||||
|
return JsonResult.failed("上传失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 获取附件文件地址
|
* 获取附件文件地址
|
||||||
*
|
*
|
||||||
|
|||||||
@ -17,7 +17,10 @@ public class MinioUtil {
|
|||||||
* 运维OSS储存桶
|
* 运维OSS储存桶
|
||||||
*/
|
*/
|
||||||
public final static String BUCKET_ORDERS = "orders-bucket";
|
public final static String BUCKET_ORDERS = "orders-bucket";
|
||||||
|
/**
|
||||||
|
* 储存用户头像图片的桶
|
||||||
|
*/
|
||||||
|
public final static String BUCKET_USERS = "userphoto-bucket";
|
||||||
@Resource
|
@Resource
|
||||||
private MinioClient minioClient;
|
private MinioClient minioClient;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user