From bc1e19dd5e324a729b395f63408ac29d3854ccfc Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期三, 04 三月 2026 14:27:18 +0800
Subject: [PATCH] 修改bug

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/ProjectController.java |   33 ++++++++++++---------------------
 1 files changed, 12 insertions(+), 21 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/ProjectController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/ProjectController.java
index 9174fd2..0d75e46 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/ProjectController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/ProjectController.java
@@ -250,8 +250,8 @@
 
     @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);
@@ -466,7 +466,7 @@
     }
 
     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"));
@@ -482,15 +482,6 @@
                 .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;
 
 
 
@@ -498,14 +489,14 @@
     private String UPLOAD_DIR;
 
 
-    @PostConstruct
-    void init(){
-        fileLocation  = Path.of(UPLOAD_DIR).toAbsolutePath().normalize();
-        try {
-            Files.createDirectories(this.fileLocation);
-        } catch (Exception ex) {
-            throw new RuntimeException("Could not create the directory where the uploaded files will be stored.", ex);
-        }
-    }
+//    @PostConstruct
+//    void init(){
+//        fileLocation  = Path.of(UPLOAD_DIR).toAbsolutePath().normalize();
+//        try {
+//            Files.createDirectories(this.fileLocation);
+//        } catch (Exception ex) {
+//            throw new RuntimeException("Could not create the directory where the uploaded files will be stored.", ex);
+//        }
+//    }
 
 }

--
Gitblit v1.7.1