| | |
| | | import org.springblade.core.oss.model.BladeFile; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.jfpt.alarm.service.IAlarmService; |
| | | import org.springblade.jfpt.wj.entity.Wj; |
| | | import org.springblade.jfpt.wj.service.IWjService; |
| | | import org.springblade.jfpt.xlfeedback.entity.Xlfeedback; |
| | |
| | | private final IXlfeedbackService xlfeedbackService; |
| | | private IWjService iWjService; |
| | | private MinioTemplate minioTemplate; |
| | | private final IAlarmService alarmService; |
| | | |
| | | /** |
| | | * 详情 |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @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"); |
| | |
| | | return R.data(url); |
| | | } |
| | | |
| | | /** |
| | | * @param file |
| | | */ |
| | | @PostMapping("put-objecty") |
| | | public R puty(@RequestParam MultipartFile file,String jid) throws InvalidPortException, InvalidEndpointException, IOException, XmlPullParserException, NoSuchAlgorithmException, InvalidKeyException, InvalidArgumentException, InternalException, NoResponseException, InvalidBucketNameException, InsufficientDataException, ErrorResponseException, RegionConflictException { |
| | | 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/avoid/"+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); //文件访问路径 |
| | | String substring = url.substring(25, url.length()); |
| | | String urls="https://web.byisf.com/minio"+substring; |
| | | alarmService.updateAaddress(url,jid); |
| | | return R.data(url); |
| | | } |
| | | |
| | | |
| | | } |