yeg
2026-08-30 be46e4544be4a0a0200924c06bf3d460b0783d8d
修正测试状态与实时异常展示规则
4个文件已修改
33 ■■■■■ 已修改文件
ruoyi-admin/src/test/java/com/ruoyi/config/TestDeviceBindingMapperContractTest.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/test/java/com/ruoyi/system/service/impl/TTestServiceImplTest.java 4 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TTestServiceImpl.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/TTestMapper.xml 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/test/java/com/ruoyi/config/TestDeviceBindingMapperContractTest.java
@@ -27,6 +27,9 @@
        assertTrue(mapper.contains("id=\"selectReceptionChannelForUpdate\""));
        assertTrue(mapper.contains("channel_fact.online_status onlineStatus"));
        assertTrue(mapper.contains("channel_fact.last_seen_at_utc lastSeenAtUtc"));
        assertTrue(mapper.contains("then 'RUNNING_ABNORMAL'"));
        assertTrue(mapper.contains("exception_fact.interval_status = 'OPEN'"));
        assertTrue(mapper.contains("set test_status = 'COMPLETED'"));
        assertFalse(mapper.contains("group_concat"));
    }
ruoyi-admin/src/test/java/com/ruoyi/system/service/impl/TTestServiceImplTest.java
@@ -532,7 +532,7 @@
    }
    @Test
    void stopTestShouldTerminateAndReleaseLeases()
    void stopTestShouldCompleteAndReleaseLeases()
    {
        TTest current = validTest();
        current.setTestId(10L);
@@ -545,7 +545,7 @@
        verify(testMapper).deleteChannelLeasesByTestId(10L);
        verify(testMapper).deleteCollectorChannelLeasesByTestId(10L);
        verify(testMapper).insertTestAudit(eq(10L), eq("TEST_STOPPED"), eq(7L), eq("operator"), isNull(),
                org.mockito.ArgumentMatchers.argThat(value -> value != null && value.contains("TERMINATED")));
                org.mockito.ArgumentMatchers.argThat(value -> value != null && value.contains("COMPLETED")));
    }
    private void mockEnabledOptions()
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TTestServiceImpl.java
@@ -269,7 +269,7 @@
        testMapper.deleteChannelLeasesByTestId(testId);
        testMapper.deleteCollectorChannelLeasesByTestId(testId);
        testMapper.insertTestAudit(testId, "TEST_STOPPED", operatorId, updateBy, null,
                JSON.toJSONString(Map.of("testStatus", "TERMINATED", "receptionStatus", "ENDED", "polling", "STOPPED")));
                JSON.toJSONString(Map.of("testStatus", "COMPLETED", "receptionStatus", "ENDED", "polling", "STOPPED")));
        return 1;
    }
ruoyi-system/src/main/resources/mapper/system/TTestMapper.xml
@@ -130,7 +130,13 @@
        select t.test_id, t.test_name, t.creator_id, creator.nick_name creator_name,
               t.principal_id, principal.nick_name principal_name,
               t.test_type_id, ty.test_type_name, t.test_purpose,
               t.test_status, t.reception_status, t.monitor_timeout_minutes,
               case when t.test_status = 'RUNNING'
                         and exists (select 1 from t_test_collector_exception_interval exception_fact
                                     where exception_fact.test_id = t.test_id
                                       and exception_fact.interval_status = 'OPEN')
                    then 'RUNNING_ABNORMAL'
                    else t.test_status end test_status,
               t.reception_status, t.monitor_timeout_minutes,
               t.started_at_utc, t.ended_at_utc, t.del_flag,
               t.create_by, t.create_time, t.update_by, t.update_time, t.remark,
               (select count(1) from t_test_battery b where b.test_id = t.test_id and b.del_flag = 0) battery_count,
@@ -149,7 +155,17 @@
            <if test="testName != null and testName != ''">and t.test_name like concat('%', #{testName}, '%')</if>
            <if test="testTypeId != null">and t.test_type_id = #{testTypeId}</if>
            <if test="batteryNo != null and batteryNo != ''">and exists (select 1 from t_test_battery fb where fb.test_id = t.test_id and fb.battery_no = #{batteryNo} and fb.del_flag = 0)</if>
            <if test="testStatus != null and testStatus != ''">and t.test_status = #{testStatus}</if>
            <if test="testStatus != null and testStatus != ''">
                and case
                    when #{testStatus} = 'RUNNING_ABNORMAL' then t.test_status = 'RUNNING'
                        and exists (select 1 from t_test_collector_exception_interval exception_fact
                                    where exception_fact.test_id = t.test_id and exception_fact.interval_status = 'OPEN')
                    when #{testStatus} = 'RUNNING' then t.test_status = 'RUNNING'
                        and not exists (select 1 from t_test_collector_exception_interval exception_fact
                                        where exception_fact.test_id = t.test_id and exception_fact.interval_status = 'OPEN')
                    else t.test_status = #{testStatus}
                end
            </if>
            <if test="receptionStatus != null and receptionStatus != ''">and t.reception_status = #{receptionStatus}</if>
            <if test="beginCreateTime != null">and t.create_time &gt;= #{beginCreateTime}</if>
            <if test="endCreateTime != null">and t.create_time &lt;= #{endCreateTime}</if>
@@ -471,7 +487,7 @@
    </update>
    <update id="updateReceptionStopped">
        update t_test
        set test_status = 'TERMINATED', reception_status = 'ENDED', ended_at_utc = #{endedAtUtc},
        set test_status = 'COMPLETED', reception_status = 'ENDED', ended_at_utc = #{endedAtUtc},
            update_by = #{updateBy}, update_time = #{endedAtUtc}
        where test_id = #{testId} and reception_status in ('RECEIVING', 'PAUSED') and del_flag = 0
    </update>
@@ -516,7 +532,7 @@
        left join t_test_collector_channel mapping on mapping.battery_relation_id = exception_fact.battery_relation_id
            and mapping.collector_id = exception_fact.collector_id
            and mapping.channel_code = exception_fact.collector_channel_code
        where exception_fact.test_id = #{testId}
        where exception_fact.test_id = #{testId} and exception_fact.interval_status = 'OPEN'
        order by exception_fact.opened_at_utc, exception_fact.interval_id
    </select>
</mapper>