| | |
| | | @Override |
| | | public ResultBody baseDownLoad(Map<String, Object> map) throws Exception { |
| | | String urlDiZhi=MapUtils.getString(map,"url"); |
| | | if(!urlDiZhi.contains(DOMAIN)){ |
| | | if(!urlDiZhi.contains(DOMAIN)&&!urlDiZhi.contains(DOMAIN.replace("https","http"))){ |
| | | ByteArrayOutputStream outPut = new ByteArrayOutputStream(); |
| | | byte[] data = new byte[1024]; |
| | | try { |
| | |
| | | List<FileInfo> fileInfos = baseMapper.selectByMap(map); |
| | | if (fileInfos.size() > 0) { |
| | | FileInfo fileInfo = fileInfos.get(0); |
| | | OSSObject down = this.down(fileInfo.getUrl().replace(DOMAIN, "")); |
| | | OSSObject down = this.down(fileInfo.getUrl().replace(DOMAIN, "").replace(DOMAIN.replace("https","http"),"")); |
| | | InputStream objectContent = down.getObjectContent(); |
| | | //返回Base64编码过的字节数组字符串 |
| | | byte[] data = null; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public FileInfo byteUplaod(String fileName, InputStream inputStream,int size) { |
| | | public FileInfo byteUplaod(String fileName, InputStream inputStream,int size) throws IOException { |
| | | String houzhui=fileName.substring(fileName.lastIndexOf(".")+1); |
| | | String newFileName= RandomValueUtils.uuid()+"."+houzhui; |
| | | FileInfo newfileInfo=new FileInfo(); |
| | |
| | | newfileInfo.setSource("aliyun"); |
| | | newfileInfo.setImgType(houzhui); |
| | | newfileInfo.setCreateTime(new Date()); |
| | | this.fileUpLoadOss(newfileInfo,OssPathEn.trim()+"pdf/"+newFileName,inputStream); |
| | | this.fileUpLoadOss(newfileInfo,"pdf/"+newFileName,inputStream); |
| | | baseMapper.insert(newfileInfo); |
| | | inputStream.close(); |
| | | return newfileInfo; |
| | | } |
| | | |
| | |
| | | public FileInfo feignUploadHosIdAndDepId(MultipartFile file, String imgType, String hospitalId, String departmentId) throws Exception { |
| | | List<String> lassStr= Arrays.asList("png","bmp","dib","gif","jfif","jpe","jpeg","jpg","tif","tiff","ico"); |
| | | String suffix=file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1); |
| | | if(!lassStr.contains(suffix)){ |
| | | if(!lassStr.contains(suffix.toLowerCase())){ |
| | | return null; |
| | | } |
| | | String name = file.getOriginalFilename(); |