|
@@ -6,6 +6,7 @@ import cn.hutool.core.img.ImgUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
|
@@ -243,4 +244,21 @@ public class FileController {
|
|
|
}
|
|
|
return RT.fileStream(resultBtyeAry_temp, encodedFileName + ".zip");
|
|
|
}
|
|
|
+
|
|
|
+ @GetMapping("/downloadFile")
|
|
|
+ @ApiOperation(value = "按照上传文件名下载文件")
|
|
|
+ public ResponseEntity<byte[]> downloadFile(@RequestParam Long folderId){
|
|
|
+ byte[] resultBtyeAry_temp = fileService.downloadFileByZip(folderId);
|
|
|
+ File file = fileService.getOne(
|
|
|
+ new QueryWrapper<File>().lambda()
|
|
|
+ .eq(File::getFolderId, folderId)
|
|
|
+ );
|
|
|
+ String encodedFileName = "";
|
|
|
+ try{
|
|
|
+ encodedFileName = URLEncoder.encode(file.getFileName(), "UTF-8");
|
|
|
+ }catch (Exception e){
|
|
|
+
|
|
|
+ }
|
|
|
+ return RT.fileStream(resultBtyeAry_temp, encodedFileName + file.getFileType());
|
|
|
+ }
|
|
|
}
|