|  |  |  | @ -1,5 +1,6 @@ | 
		
	
		
			
				|  |  |  |  | package org.ils.file.service.impl; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | import cn.hutool.core.io.FileUtil; | 
		
	
		
			
				|  |  |  |  | import cn.xuyanwu.spring.file.storage.Downloader; | 
		
	
		
			
				|  |  |  |  | import cn.xuyanwu.spring.file.storage.FileInfo; | 
		
	
		
			
				|  |  |  |  | import cn.xuyanwu.spring.file.storage.FileStorageService; | 
		
	
	
		
			
				
					|  |  |  | @ -11,10 +12,8 @@ import org.springframework.stereotype.Service; | 
		
	
		
			
				|  |  |  |  | import org.springframework.web.multipart.MultipartFile; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | import javax.servlet.http.HttpServletResponse; | 
		
	
		
			
				|  |  |  |  | import java.io.BufferedOutputStream; | 
		
	
		
			
				|  |  |  |  | import java.io.ByteArrayOutputStream; | 
		
	
		
			
				|  |  |  |  | import java.io.IOException; | 
		
	
		
			
				|  |  |  |  | import java.io.OutputStream; | 
		
	
		
			
				|  |  |  |  | import java.io.*; | 
		
	
		
			
				|  |  |  |  | import java.util.Base64; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /** | 
		
	
	
		
			
				
					|  |  |  | @ -25,6 +24,8 @@ import java.io.OutputStream; | 
		
	
		
			
				|  |  |  |  | @Slf4j | 
		
	
		
			
				|  |  |  |  | @Service | 
		
	
		
			
				|  |  |  |  | public class IlsFileDetailServiceImpl  implements IlsFileDetailService { | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     private static  final String SPLIT_STR = "."; | 
		
	
		
			
				|  |  |  |  |     @Autowired | 
		
	
		
			
				|  |  |  |  |     private FileStorageService fileStorageService; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
	
		
			
				
					|  |  |  | @ -86,4 +87,16 @@ public class IlsFileDetailServiceImpl  implements IlsFileDetailService { | 
		
	
		
			
				|  |  |  |  |         toClient.close(); | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     @Override | 
		
	
		
			
				|  |  |  |  |     public FileInfo uploadByUrl(String url, String contentType, HttpServletResponse response) throws FileNotFoundException { | 
		
	
		
			
				|  |  |  |  |         FileInfo fileInfo = fileStorageService.of(url).setOriginalFilename(System.currentTimeMillis() + SPLIT_STR  + contentType).upload(); | 
		
	
		
			
				|  |  |  |  |         return fileInfo; | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     @Override | 
		
	
		
			
				|  |  |  |  |     public FileInfo uploadByBase64(String base64, String contentType, HttpServletResponse response) throws FileNotFoundException { | 
		
	
		
			
				|  |  |  |  |         FileInfo fileInfo = fileStorageService.of(Base64.getDecoder().decode(base64)).setOriginalFilename(System.currentTimeMillis() + SPLIT_STR  + contentType).upload(); | 
		
	
		
			
				|  |  |  |  |         return fileInfo; | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | } | 
		
	
	
		
			
				
					|  |  |  | 
 |