| | |
| | | } |
| | | |
| | | /** |
| | | * |
| | | *APP警单反馈图片,视频 |
| | | * @param file |
| | | */ |
| | | @PostMapping("put-objects") |
| | | public R put(@RequestParam MultipartFile file) throws InvalidPortException, InvalidEndpointException, IOException, XmlPullParserException, NoSuchAlgorithmException, InvalidKeyException, InvalidArgumentException, InternalException, NoResponseException, InvalidBucketNameException, InsufficientDataException, ErrorResponseException, RegionConflictException { |
| | | MinioClient minioClient = new MinioClient("http://36.134.81.48:9000","adminminio","adminminio"); |
| | | MinioClient minioClient = new MinioClient("http://web.byisf.com:9000","adminminio","adminminio"); |
| | | if (!minioClient.bucketExists("jfpt")) { //是否存在名为“test”的bucket |
| | | minioClient.makeBucket("jfpt"); |
| | | } |
| | | String fileName = file.getOriginalFilename(); |
| | | String newName ="upload/"+UUID.randomUUID().toString().replaceAll("-", "") |
| | | String newName ="upload/fk/"+UUID.randomUUID().toString().replaceAll("-", "") |
| | | + fileName.substring(fileName.lastIndexOf(".")); |
| | | InputStream inputStream = file.getInputStream(); //获取file的inputStream |
| | | minioClient.putObject("jfpt", newName, inputStream, "application/octet-stream");//上传 |
| | | inputStream.close(); |
| | | String url = minioClient.getObjectUrl("jfpt", newName); //文件访问路径 |
| | | return R.data(url); |
| | | String substring = url.substring(25, url.length()); |
| | | String urls="https://web.byisf.com/minio"+substring; |
| | | return R.data(urls); |
| | | } |
| | | |
| | | /** |