| | |
| | | |
| | | @Override |
| | | public String uploadCarPicture(String id, MultipartFile carPicture) { |
| | | ArdSyCar ardSyCarr = ardSyCarMapper.selectArdSyCarById(id); |
| | | List<String> objectNames = new ArrayList(); |
| | | if(ardSyCarr.getCarPicture() != null || !ardSyCarr.getCarPicture().equals("")){ |
| | | String objectName = ardSyCarr.getCarPicture().split("/sycar/")[1]; |
| | | objectNames.add(objectName); |
| | | MinioUtils.removeObjects("sycar", objectNames); |
| | | if(id != null && !id.equals("")){//id为非必要 |
| | | ArdSyCar ardSyCarr = ardSyCarMapper.selectArdSyCarById(id); |
| | | List<String> objectNames = new ArrayList(); |
| | | if(ardSyCarr.getCarPicture() != null || !ardSyCarr.getCarPicture().equals("")){ |
| | | String objectName = ardSyCarr.getCarPicture().split("/sycar/")[1]; |
| | | objectNames.add(objectName); |
| | | MinioUtils.removeObjects("sycar", objectNames); |
| | | } |
| | | } |
| | | //判断文件是否为空 |
| | | if (null == carPicture || 0 == carPicture.getSize()) { |
| | |
| | | .build(); |
| | | String presignedObjectUrl = MinioClientSingleton.getMinioClient().getPresignedObjectUrl(getPresignedObjectUrlArgs); |
| | | String ObjectUrl = presignedObjectUrl.substring(0, presignedObjectUrl.indexOf("?")); |
| | | ArdSyCar ardSyCar = new ArdSyCar(); |
| | | ardSyCar.setId(id); |
| | | ardSyCar.setCarPicture(ObjectUrl); |
| | | ardSyCarMapper.updateArdSyCar(ardSyCar); |
| | | if(id != null && !id.equals("")){//id为非必要 |
| | | ArdSyCar ardSyCar = new ArdSyCar(); |
| | | ardSyCar.setId(id); |
| | | ardSyCar.setCarPicture(ObjectUrl); |
| | | ardSyCarMapper.updateArdSyCar(ardSyCar); |
| | | } |
| | | return ObjectUrl; |
| | | } catch (Exception ex) { |
| | | return ""; |