liujie
2026-01-29 8ab97da36f98d75daed63cb795f037a13c530024
修改bug
6个文件已修改
56 ■■■■■ 已修改文件
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/ProjectController.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/resources/application-test.yml 1 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/UserFileService.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UserFileServiceImpl.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/OnDutyMapper.xml 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/RecordMapper.xml 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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;
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/
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);
}
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;
    }
}
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">
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>