liujie
2026-02-05 b5a5e43e2ea7af773dba1ee99c2194be61515df8
Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/smart_screen
1个文件已添加
5个文件已修改
127 ■■■■■ 已修改文件
ruoyi-system/src/main/java/com/ruoyi/system/mapper/ErrorReviewMapper.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ClientServiceImpl.java 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DeviceUsageServiceImpl.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/vo/EntrustDeviceListVo.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/vo/ErrorListVo.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/DeviceUsageMapper.xml 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/mapper/ErrorReviewMapper.java
New file
@@ -0,0 +1,13 @@
package com.ruoyi.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.system.model.ErrorReview;
/**
 * ErrorReview Mapper 接口
 *
 * @author administrator
 * @since 2026-02-05
 */
public interface ErrorReviewMapper extends BaseMapper<ErrorReview> {
}
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ClientServiceImpl.java
@@ -47,6 +47,7 @@
    private final ProjectCategoryCalculator projectCategoryCalculator;
    private final ClientParamMapper clientParamMapper;
    private final DeviceMapper deviceMapper;
    private final ErrorReviewMapper errorReviewMapper;
    @Override
    public ClientDashboardVO getClientDashboard(ClientDashboardQuery query) {
@@ -542,12 +543,25 @@
        vo.setMajorHazardTotal(majorHazards.size());
        // 统计已整改和未整改数量
        long rectifiedCount = majorHazards.stream()
                .filter(r -> r.getReformed() != null && r.getReformed())
                .count();
        long unrectifiedCount = majorHazards.stream()
                .filter(r -> r.getReformed() == null || !r.getReformed())
                .count();
        // 1. 收集所有非空的 errorReviewId
        List<Integer> errorReviewIds = majorHazards.stream()
                .map(Record::getErrorReviewId)
                .filter(Objects::nonNull)
                .distinct()
                .collect(Collectors.toList());
        // 2. 查询 ErrorReview 中 state=2 的记录
        long rectifiedCount = 0;
        if (!errorReviewIds.isEmpty()) {
            LambdaQueryWrapper<ErrorReview> reviewWrapper = new LambdaQueryWrapper<>();
            reviewWrapper.in(ErrorReview::getId, errorReviewIds)
                    .eq(ErrorReview::getState, 2)  // state=2 表示已整改
                    .eq(ErrorReview::getDeleted, false);
            rectifiedCount = errorReviewMapper.selectCount(reviewWrapper);
        }
        // 3. 未整改数量 = 总数 - 已整改数量
        long unrectifiedCount = majorHazards.size() - rectifiedCount;
        vo.setRectifiedHazardCount((int) rectifiedCount);
        vo.setUnrectifiedHazardCount((int) unrectifiedCount);
@@ -588,12 +602,25 @@
        vo.setMajorHazardTotal(majorHazards.size());
        // 统计已整改和未整改数量
        long rectifiedCount = majorHazards.stream()
                .filter(r -> r.getReformed() != null && r.getReformed())
                .count();
        long unrectifiedCount = majorHazards.stream()
                .filter(r -> r.getReformed() == null || !r.getReformed())
                .count();
        // 1. 收集所有非空的 errorReviewId
        List<Integer> errorReviewIds = majorHazards.stream()
                .map(Record::getErrorReviewId)
                .filter(Objects::nonNull)
                .distinct()
                .collect(Collectors.toList());
        // 2. 查询 ErrorReview 中 state=2 的记录
        long rectifiedCount = 0;
        if (!errorReviewIds.isEmpty()) {
            LambdaQueryWrapper<ErrorReview> reviewWrapper = new LambdaQueryWrapper<>();
            reviewWrapper.in(ErrorReview::getId, errorReviewIds)
                    .eq(ErrorReview::getState, 2)  // state=2 表示已整改
                    .eq(ErrorReview::getDeleted, false);
            rectifiedCount = errorReviewMapper.selectCount(reviewWrapper);
        }
        // 3. 未整改数量 = 总数 - 已整改数量
        long unrectifiedCount = majorHazards.size() - rectifiedCount;
        vo.setRectifiedHazardCount((int) rectifiedCount);
        vo.setUnrectifiedHazardCount((int) unrectifiedCount);
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DeviceUsageServiceImpl.java
@@ -156,6 +156,12 @@
                        .in(Task::getId, checkTaskIds)
                        .isNotNull(Task::getProjectId))
                .stream().collect(Collectors.groupingBy(Task::getProjectId));
        Map<Integer, Task> taskRecordMap = taskMapper.selectList(new LambdaQueryWrapper<Task>()
                        .ge(Task::getCreateTime, startTime)
                        .le(Task::getCreateTime, LocalDateTime.now())
                        .in(Task::getId, checkTaskIds)
                        .isNotNull(Task::getProjectId))
                .stream().collect(Collectors.toMap(Task::getId,e->e));
        Map<Integer, List<EvalResult>> resultMap = evalResultMapper.selectList(new LambdaQueryWrapper<EvalResult>()
                .in(EvalResult::getCheckTaskId, checkTaskIds)
        ).stream().collect(Collectors.groupingBy(EvalResult::getProjectId));
@@ -209,7 +215,10 @@
                List<Record> recordList = records.stream().filter(e -> taskIds.contains(e.getCheckTaskId())).toList();
                Record record = recordList.stream().max(Comparator.comparing(Record::getCreateTime)).orElse(null);
                if (record != null) {
                    deviceListVo.setCheckTime(record.getCreateTime());
                    Task task = taskRecordMap.get(record.getCheckTaskId());
                    if (task!=null){
                        deviceListVo.setCheckTime(task.getCreateTime());
                    }
                    deviceListVo.setCheckResult("已检查");
                } else {
                    deviceListVo.setCheckTime(null);
@@ -351,13 +360,17 @@
                .eq(Record::getDeleted, false);
        List<Record> records = recordMapper.selectList(recordWrapper);
        List<Integer> deviceIdsRecord = records.stream().map(Record::getDeviceId).distinct().collect(Collectors.toList());
        for (EntrustDeviceListVo deviceListVo : deviceList) {
            if (deviceIdsRecord.contains(deviceListVo.getId())) {
                Record record = records.stream().filter(e -> e.getDeviceId().equals(deviceListVo.getId())).findFirst()
                        .orElse(null);
                if (record != null) {
                    Task task = taskMapper.selectById(record.getCheckTaskId());
                    if (task != null){
                        deviceListVo.setCheckTime(task.getCreateTime());
                    }
                    deviceListVo.setCheckResult("已检查");
                    deviceListVo.setCheckTime(record.getCreateTime());
                }
            } else {
                deviceListVo.setCheckResult("未检查");
ruoyi-system/src/main/java/com/ruoyi/system/vo/EntrustDeviceListVo.java
@@ -27,6 +27,6 @@
    @ApiModelProperty("检查情况")
    private String checkResult;
    @ApiModelProperty("检查时间")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime checkTime;
}
ruoyi-system/src/main/java/com/ruoyi/system/vo/ErrorListVo.java
@@ -33,7 +33,7 @@
    @ApiModelProperty("图片")
    private List<UserFile> pictures;
    @ApiModelProperty("检查时间")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime checkTime;
    @ApiModelProperty("整改情况0未复查1-未整改 2-部分整改 3-已整改")
ruoyi-system/src/main/resources/mapper/system/DeviceUsageMapper.xml
@@ -123,8 +123,8 @@
    </select>
    <select id="errorList" resultType="com.ruoyi.system.vo.ErrorListVo">
        select t1.*,t2.project_id,t2.plan_id,t3.`name` as  projectName,t4.`name` as planName
             ,t5.`name` as problemName,IF(t1.device_id is null ,1,2) as type,t1.create_time as checkTime
        ,IF(t6.state  is null,0,t6.state) as state
             ,t5.description as problemName,IF(t1.device_id is null ,1,2) as type,t2.create_time as checkTime
        ,IF(t6.state  is null,0,t6.state+1) as state
        from record t1
                 LEFT JOIN task t2 on t1.check_task_id = t2.id
                 LEFT JOIN project t3 on t2.project_id = t3.id
@@ -142,17 +142,17 @@
        <if test="query.projectId != null">
            and t2.project_id = #{query.projectId}
        </if>
        <if test="query.state ==0 ">
            and t6.state is null
        <if test="query.state ==4 ">
            and t1.error_review_id is null
        </if>
        <if test="query.state ==1 ">
            and t6.state = #{query.state}
            and t6.state = 0
        </if>
        <if test="query.state ==2 ">
            and t6.state = #{query.state}
            and t6.state = 1
        </if>
        <if test="query.state ==3 ">
            and t6.state = #{query.state}
            and t6.state = 2
        </if>
        <if test="query.type != null and query.type == 1">
            and t1.device_id is null
@@ -173,8 +173,8 @@
    </select>
    <select id="deviceErrorList" resultType="com.ruoyi.system.vo.ErrorListVo">
        select t1.*,t2.project_id,t2.plan_id,t3.`name` as  projectName,t4.`name` as planName
        ,t5.`name` as problemName,IF(t1.device_id is null ,1,2) as type,t1.create_time as checkTime
        ,IF(t6.state  is null,0,t6.state) as state
        ,t5.description as problemName,IF(t1.device_id is null ,1,2) as type,t1.create_time as checkTime
        ,IF(t6.state  is null,0,t6.state+1) as state
        from record t1
        LEFT JOIN task t2 on t1.check_task_id = t2.id
        LEFT JOIN project t3 on t2.project_id = t3.id
@@ -192,17 +192,17 @@
        <if test="query.projectId != null">
            and t2.project_id = #{query.projectId}
        </if>
        <if test="query.state ==0 ">
            and t6.state is null
        <if test="query.state ==4 ">
            and t1.error_review_id is null
        </if>
        <if test="query.state ==1 ">
            and t6.state = #{query.state}
            and t6.state = 0
        </if>
        <if test="query.state ==2 ">
            and t6.state = #{query.state}
            and t6.state = 1
        </if>
        <if test="query.state ==3 ">
            and t6.state = #{query.state}
            and t6.state = 2
        </if>
        <if test="query.content!= null and query.content!=''">
@@ -217,8 +217,8 @@
    </select>
    <select id="safetyErrorList" resultType="com.ruoyi.system.vo.ErrorListVo">
        select t1.*,t2.project_id,t2.plan_id,t3.`name` as  projectName,t4.`name` as planName
        ,t5.`name` as problemName,IF(t1.device_id is null ,1,2) as type,t1.create_time as checkTime
        ,IF(t6.state  is null,0,t6.state) as state
        ,t5.description as problemName,IF(t1.device_id is null ,1,2) as type,t1.create_time as checkTime
        ,IF(t6.state  is null,0,t6.state+1) as state
        from record t1
        LEFT JOIN task t2 on t1.check_task_id = t2.id
        LEFT JOIN project t3 on t2.project_id = t3.id
@@ -236,17 +236,17 @@
        <if test="query.projectId != null">
            and t2.project_id = #{query.projectId}
        </if>
        <if test="query.state ==0 ">
            and t6.state is null
        <if test="query.state ==4 ">
            and t1.error_review_id is null
        </if>
        <if test="query.state ==1 ">
            and t6.state = #{query.state}
            and t6.state = 0
        </if>
        <if test="query.state ==2 ">
            and t6.state = #{query.state}
            and t6.state = 1
        </if>
        <if test="query.state ==3 ">
            and t6.state = #{query.state}
            and t6.state = 2
        </if>
        <if test="query.content!= null and query.content!=''">