| | |
| | | |
| | | @ApiOperation(value = "获取检查资料列表") |
| | | @GetMapping("/getDeviceDetailCheckPlanList") |
| | | public R<List<Check>> getDeviceDetailCheckPlanList(@RequestParam Integer planId) { |
| | | List<Check> list = checkService.list(new LambdaQueryWrapper<Check>().eq(Check::getPlanId,planId).orderByDesc(Check::getTime)); |
| | | public R<List<Check>> getDeviceDetailCheckPlanList(@RequestParam Integer planId,@RequestParam Integer projectId) { |
| | | List<Check> list = checkService.list(new LambdaQueryWrapper<Check>().eq(Check::getPlanId,planId).eq(projectId!=null,Check::getProjectId,projectId).orderByDesc(Check::getTime)); |
| | | if(!list.isEmpty()){ |
| | | List<Integer> planIds = list.stream().map(Check::getPlanId).toList(); |
| | | List<Plan> plans = planService.listByIds(planIds); |
| | |
| | | } |
| | | |
| | | private ResponseEntity<org.springframework.core.io.Resource> downloadFile(UserFile userFile) throws IOException { |
| | | InputStreamResource resource =resolveResource(userFile); |
| | | InputStreamResource resource =userFileService.resolveResource(userFile); |
| | | var fileSize = userFile.getSize(); |
| | | // if(resource == null) { |
| | | // resource = new InputStreamResource(getClass().getClassLoader().getResourceAsStream("images/wukong.png")); |
| | |
| | | .body(resource); |
| | | } |
| | | |
| | | public InputStreamResource resolveResource(UserFile userFile) throws IOException { |
| | | var filePath = fileLocation.resolve(userFile.getName() + "." + userFile.getExtension()).normalize(); |
| | | if(!Files.exists(filePath)){ |
| | | return null; |
| | | } |
| | | return new InputStreamResource(Files.newInputStream(filePath)); |
| | | } |
| | | |
| | | private Path fileLocation; |
| | | |
| | | |
| | | |