| | |
| | | import com.java110.utils.util.DateUtil; |
| | | import com.java110.utils.util.OSSUtil; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import com.java110.core.log.LoggerFactory; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | |
| | | return fileName; |
| | | } |
| | | |
| | | public String upload(InputStream inputStream, String ftpPath) { |
| | | String fileName = ""; |
| | | OSSClient ossClient = null; |
| | | try { |
| | | ossClient = OSSUtil.getOSSClient(); |
| | | OSSUtil.uploadByInputStream(ossClient, inputStream, ftpPath); |
| | | } catch (Exception e) { |
| | | // logger.error("上传文件失败", e); |
| | | throw new IllegalArgumentException("上传文件失败"); |
| | | } finally { |
| | | } |
| | | return fileName; |
| | | } |
| | | |
| | | /* |
| | | *文件下载工具方法 |
| | | */ |
| | |
| | | ByteArrayInputStream fis = null; |
| | | try { |
| | | ossClient = OSSUtil.getOSSClient(); |
| | | OSSUtil.getInputStreamByOSS(ossClient, remotePath + fileName); |
| | | ins = OSSUtil.getInputStreamByOSS(ossClient, remotePath + fileName); |
| | | byteOut = new ByteArrayOutputStream(); |
| | | byte[] buf = new byte[2048]; |
| | | int bufsize = 0; |