1515import top .cadecode .uniboot .common .core .util .AssertUtil ;
1616import top .cadecode .uniboot .framework .annotation .ApiFormat ;
1717import top .cadecode .uniboot .framework .enums .FrameErrorEnum ;
18- import top .cadecode .uniboot .framework .manager . FileUploadManager ;
18+ import top .cadecode .uniboot .framework .util . FileUploadUtil ;
1919
2020import javax .servlet .http .HttpServletRequest ;
2121import javax .servlet .http .HttpServletResponse ;
@@ -39,10 +39,10 @@ public class CommonController {
3939 @ PostMapping ("common/upload" )
4040 public boolean upload (@ RequestPart ("file" ) MultipartFile file ) {
4141 String originalFilename = file .getOriginalFilename ();
42- boolean checked = FileUploadManager .checkAllowedExtension (originalFilename );
42+ boolean checked = FileUploadUtil .checkAllowedExtension (originalFilename );
4343 AssertUtil .isFalse (checked , FrameErrorEnum .EXTENSION_NOT_ALLOWED , originalFilename + "不被允许" );
44- String renamedFileName = FileUploadManager .renameByUUID (originalFilename );
45- String targetFilePath = FileUploadManager .uploadPath () + renamedFileName ;
44+ String renamedFileName = FileUploadUtil .renameByUUID (originalFilename );
45+ String targetFilePath = FileUploadUtil .uploadPath () + renamedFileName ;
4646 try {
4747 File targetFile = FileUtil .file (targetFilePath );
4848 FileUtil .mkParentDirs (targetFile );
@@ -65,22 +65,22 @@ public int uploadFiles(@RequestPart("files") MultipartFile[] files) {
6565 }
6666
6767 @ ApiOperation ("下载文件" )
68- @ GetMapping (FileUploadManager .DEFAULT_DOWNLOAD_API )
68+ @ GetMapping (FileUploadUtil .DEFAULT_DOWNLOAD_API )
6969 public void download (HttpServletRequest request , HttpServletResponse response , String fileName ) throws IOException {
70- boolean checked = FileUploadManager .checkAllowedExtension (fileName );
70+ boolean checked = FileUploadUtil .checkAllowedExtension (fileName );
7171 AssertUtil .isFalse (checked , FrameErrorEnum .EXTENSION_NOT_ALLOWED , fileName + "不被允许" );
7272 // 写文件流
73- String targetFilePath = FileUploadManager .downloadPath () + fileName ;
73+ String targetFilePath = FileUploadUtil .downloadPath () + fileName ;
7474 boolean exist = FileUtil .exist (targetFilePath );
7575 AssertUtil .isFalse (exist , FrameErrorEnum .FILE_NOT_FOUND , fileName + "不存在" );
7676 ServletUtil .write (response , new File (targetFilePath ));
7777 }
7878
7979 @ ApiOperation ("下载临时文件" )
80- @ GetMapping (FileUploadManager .DEFAULT_DOWNLOAD_TEMP_API )
80+ @ GetMapping (FileUploadUtil .DEFAULT_DOWNLOAD_TEMP_API )
8181 public void downloadTemp (HttpServletRequest request , HttpServletResponse response , String fileName ) throws IOException {
8282 download (request , response , fileName );
83- String targetFilePath = FileUploadManager .downloadPath () + fileName ;
83+ String targetFilePath = FileUploadUtil .downloadPath () + fileName ;
8484 FileUtil .del (targetFilePath );
8585 }
8686
0 commit comments