| | |
| | | import com.ard.common.core.domain.AjaxResult; |
| | | import com.ard.common.enums.BusinessType; |
| | | import com.ard.inspection.service.IBigFileUploadService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import io.swagger.annotations.Api; |
| | |
| | | @Autowired |
| | | private IBigFileUploadService bigFileUploadService; |
| | | |
| | | //@Value(value = "${inspection.profile}") |
| | | @Value(value = "${inspection.profile}") |
| | | private String uploadPath; |
| | | |
| | | //@Value(value = "${inspection.chunk.path}") |
| | | @Value(value = "${inspection.chunk.path}") |
| | | private String chunkPath; |
| | | |
| | | /** |
| | | * 检查分片是否存在 |
| | | */ |
| | | @GetMapping("/chunks/{fileMd5}") |
| | | @ApiOperation("检查分片是否存在") |
| | | @GetMapping("/bigfile/{fileMd5}") |
| | | public AjaxResult checkChunk(@PathVariable String fileMd5) { |
| | | Map<String, Object> result = bigFileUploadService.checkChunk(fileMd5,chunkPath); |
| | | return AjaxResult.success(result); |
| | |
| | | /** |
| | | * 上传分片 |
| | | */ |
| | | @PostMapping("/chunk") |
| | | @ApiOperation("上传分片") |
| | | @PostMapping("/bigfile/chunk") |
| | | public AjaxResult uploadChunk(@RequestParam("file") MultipartFile file, |
| | | @RequestParam("chunkNumber") Integer chunkNumber, |
| | | @RequestParam("fileMd5") String fileMd5) { |
| | |
| | | /** |
| | | * 合并切片 |
| | | */ |
| | | @ApiOperation("合并分片") |
| | | @Log(title = "合并切片", businessType = BusinessType.IMPORT) |
| | | @PostMapping("/merge") |
| | | @PostMapping("/bigfile/merge") |
| | | public AjaxResult mergeChunks(@RequestParam("md5") String md5, |
| | | @RequestParam("fileName") String fileName) { |
| | | Map<String, Object> result = bigFileUploadService.mergeChunks(md5, fileName, uploadPath); |