| 
						
						
						
					 | 
					@ -1,21 +1,23 @@ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					package com.epmet.controller; | 
					 | 
					 | 
					package com.epmet.controller; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.utils.Result; | 
					 | 
					 | 
					import com.epmet.commons.tools.utils.Result; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.epmet.dto.result.UploadImgResultDTO; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.epmet.service.OssService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import org.apache.commons.io.FileUtils; | 
					 | 
					 | 
					import org.apache.commons.io.FileUtils; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					import org.springframework.web.bind.annotation.PostMapping; | 
					 | 
					 | 
					import org.springframework.beans.factory.annotation.Autowired; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					import org.springframework.web.bind.annotation.RequestMapping; | 
					 | 
					 | 
					import org.springframework.mock.web.MockMultipartFile; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					import org.springframework.web.bind.annotation.RequestPart; | 
					 | 
					 | 
					import org.springframework.web.bind.annotation.*; | 
				
			
			
				
				
			
		
	
		
		
			
				
					 | 
					 | 
					import org.springframework.web.bind.annotation.RestController; | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					import org.springframework.web.multipart.MultipartFile; | 
					 | 
					 | 
					import org.springframework.web.multipart.MultipartFile; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					import java.io.File; | 
					 | 
					 | 
					import java.io.*; | 
				
			
			
				
				
			
		
	
		
		
			
				
					 | 
					 | 
					import java.io.IOException; | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import java.io.InputStream; | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					@RestController | 
					 | 
					 | 
					@RestController | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					@RequestMapping("test") | 
					 | 
					 | 
					@RequestMapping("test") | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					public class TestController { | 
					 | 
					 | 
					public class TestController { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    @Autowired | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    private OssService ossService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @PostMapping("local-upload") | 
					 | 
					 | 
					    @PostMapping("local-upload") | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    public Result localUpload(@RequestPart("file") MultipartFile file) { | 
					 | 
					 | 
					    public Result localUpload(@RequestPart("file") MultipartFile file) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -28,4 +30,17 @@ public class TestController { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        return new Result(); | 
					 | 
					 | 
					        return new Result(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    } | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    @PostMapping("upload2aliyun") | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    public Result upload2aliyun() { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        try (final FileInputStream fis = new FileInputStream("/opt/upload_files/temp")) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            final MockMultipartFile mockMultipartFile = new MockMultipartFile("temp", fis); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            return ossService.uploadImg(mockMultipartFile); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        } catch (FileNotFoundException e) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            e.printStackTrace(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        } catch (IOException e) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            e.printStackTrace(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        return new Result(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					} | 
					 | 
					 | 
					} | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
					 | 
					
  |