From 8ab97da36f98d75daed63cb795f037a13c530024 Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期四, 29 一月 2026 17:40:30 +0800
Subject: [PATCH] 修改bug

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/ProjectController.java     |   11 +----------
 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UserFileServiceImpl.java |   25 +++++++++++++++++++++++++
 ruoyi-system/src/main/resources/mapper/system/OnDutyMapper.xml                    |    2 +-
 ruoyi-admin/src/main/resources/application-test.yml                               |    1 +
 ruoyi-system/src/main/resources/mapper/system/RecordMapper.xml                    |   14 ++++++++++----
 ruoyi-system/src/main/java/com/ruoyi/system/service/UserFileService.java          |    3 +++
 6 files changed, 41 insertions(+), 15 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 04299d0..10f4271 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
@@ -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;
 
 
 
diff --git a/ruoyi-admin/src/main/resources/application-test.yml b/ruoyi-admin/src/main/resources/application-test.yml
index ffc467d..bfb0dd8 100644
--- a/ruoyi-admin/src/main/resources/application-test.yml
+++ b/ruoyi-admin/src/main/resources/application-test.yml
@@ -189,6 +189,7 @@
 file:
   upload:
     dir: F:\file\estate
+    dirFile: F:\file\estate\files
     location: /file/
     qrLocation: /file/qrCode/
     accessPath: /file/
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/UserFileService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/UserFileService.java
index 17b6a26..57a52d1 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/UserFileService.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/UserFileService.java
@@ -3,6 +3,7 @@
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.ruoyi.system.model.UserFile;
+import org.springframework.core.io.InputStreamResource;
 
 /**
  * <p>
@@ -14,4 +15,6 @@
  */
 public interface UserFileService extends IService<UserFile> {
 
+    InputStreamResource resolveResource(UserFile userFile);
+
 }
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UserFileServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UserFileServiceImpl.java
index 4d05c2b..90af185 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UserFileServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UserFileServiceImpl.java
@@ -5,7 +5,13 @@
 import com.ruoyi.system.mapper.UserFileMapper;
 import com.ruoyi.system.model.UserFile;
 import com.ruoyi.system.service.UserFileService;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.core.io.InputStreamResource;
 import org.springframework.stereotype.Service;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
 
 /**
  * <p>
@@ -18,4 +24,23 @@
 @Service
 public class UserFileServiceImpl extends ServiceImpl<UserFileMapper, UserFile> implements UserFileService {
 
+    @Value("${file.upload.dirFile}")
+    private Path fileLocation;
+
+    @Override
+
+    public InputStreamResource resolveResource(UserFile userFile){
+        try {
+            var filePath = fileLocation.resolve(userFile.getName() + "." + userFile.getExtension()).normalize();
+            if (!Files.exists(filePath)) {
+                return null;
+            }
+            return new InputStreamResource(Files.newInputStream(filePath));
+
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+        return null;
+
+    }
 }
diff --git a/ruoyi-system/src/main/resources/mapper/system/OnDutyMapper.xml b/ruoyi-system/src/main/resources/mapper/system/OnDutyMapper.xml
index ae6ba67..9bbbfea 100644
--- a/ruoyi-system/src/main/resources/mapper/system/OnDutyMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/OnDutyMapper.xml
@@ -43,7 +43,7 @@
         <if test="query.remark != null">
             and t1.remark like concat('%',#{query.remark},'%')
         </if>
-        order by t1.time desc
+        order by t1.create_time desc
     </select>
     <select id="getProjectOnDutyDetail" resultType="com.ruoyi.system.vo.ProjectPersonOnDutyListVo"
             parameterType="java.lang.Integer">
diff --git a/ruoyi-system/src/main/resources/mapper/system/RecordMapper.xml b/ruoyi-system/src/main/resources/mapper/system/RecordMapper.xml
index 196b13b..df3b9c9 100644
--- a/ruoyi-system/src/main/resources/mapper/system/RecordMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/RecordMapper.xml
@@ -37,19 +37,22 @@
         when t1.device_id is null then 1
         else 2
         end as type,
-        t1.create_time,t1.reformed,t1.responsible_person responsiblePerson
+        t1.create_time,t1.reformed,t1.responsible_person responsiblePerson,
+        case
+        when t5.id is null then 3
+        else t5.state
+        end as state
         from record t1
         left join problem t2 on t1.problem_id = t2.id
         left join task t3 on t1.check_task_id = t3.id
         left join plan t4 on t3.plan_id = t4.id
+        left join error_review t5 on t1.error_review_id = t5.id
         where t1.deleted = 0 and t1.level is not null
         and t1.check_task_id in
         <foreach item="item" index="index" collection="taskIds" open="(" separator="," close=")">
             #{item}
         </foreach>
-        <if test="query.reformed != null">
-            and t1.reformed = #{query.reformed}
-        </if>
+
         <if test="query.type == null">
             and t1.level = 0
         </if>
@@ -61,6 +64,9 @@
         </if>
 
         ) as o where 1=1
+        <if test="query.reformed != null">
+            and o.state = #{query.reformed}
+        </if>
         <if test="query.type != null">
             and o.type = #{query.type}
         </if>

--
Gitblit v1.7.1