| | |
| | | import com.boying.service.FileInfoService; |
| | | import io.lettuce.core.dynamic.annotation.Param; |
| | | import io.swagger.models.auth.In; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | @RestController |
| | | @RequestMapping("ffzf/fileinfo") |
| | | @RequiredArgsConstructor |
| | | @Tag(description = "ffzf/fileinfo" , name = "文件接口(已废弃)" ) |
| | | public class FileInfoController { |
| | | |
| | | private final FileInfoService fileInfoService; |
| | |
| | | * @Param downloadPath 文件路径 |
| | | */ |
| | | @GetMapping("/download/downloadZip") |
| | | @Operation(summary = "下载zip" , description = "下载zip" ) |
| | | public void downloadZip(@Param("downloadPath") String downloadPath, HttpServletRequest request, HttpServletResponse response) { |
| | | //下载图片 |
| | | String down = fileInfoService.downloadPathFile(downloadPath, request, response); |
| | | } |
| | | |
| | | @PostMapping("/download/downloadZips") |
| | | @Operation(summary = "下载多个zip" , description = "下载多个zip" ) |
| | | public void downloadZips(String fileIds, HttpServletRequest request, HttpServletResponse response) { |
| | | List<FileInfo> fileInfoList = new ArrayList<>(); |
| | | if(fileIds.contains(",")){ |
| | |
| | | fileInfoService.downForZip(fileInfoList, request, response); |
| | | } |
| | | @PostMapping("/download/downloadPng") |
| | | @Operation(summary = "下载图片" , description = "下载图片" ) |
| | | public void downloadPng(String fileId, HttpServletRequest request, HttpServletResponse response) { |
| | | FileInfo byId = fileInfoService.getById(Integer.parseInt(fileId)); |
| | | fileInfoService.downloadPng(byId,request,response); |
| | | } |
| | | |
| | | @GetMapping("/showImg/{filename}") |
| | | @Operation(summary = "根据路径预览图片" , description = "根据路径预览图片" ) |
| | | public void showImg(@PathVariable String filename,HttpServletResponse response) { |
| | | fileInfoService.getFile(filename,response); |
| | | } |
| | | |
| | | @GetMapping("/showImgById/{fileId}") |
| | | @Operation(summary = "根据文件id预览图片" , description = "根据文件id预览图片" ) |
| | | public void showImgById(@PathVariable Long fileId,HttpServletResponse response) { |
| | | fileInfoService.getFileById(fileId,response); |
| | | } |