yeg
2026-09-02 96144b97e1761db230c0dc61a837ec55d76210df
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TTestServiceImpl.java
@@ -154,6 +154,9 @@
        throw new ServiceException("旧开始入口已停用,请使用原子开始接收接口并提供操作人");
    }
    /**
     * 建立测试接收边界;来源离线不阻断状态流转,只有成功观测数据才会写入测试事实。
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public int startReception(Long testId, Long operatorId, String updateBy)
@@ -179,14 +182,12 @@
            if (!channelIds.add(binding.getChannelId()))
                throw new ServiceException("检测柜通道重复绑定,无法开始接收");
            TDetectionChannel channel = testMapper.selectReceptionChannelForUpdate(binding.getChannelId());
            if (channel == null || !isEnabled(channel.getStatus()) || !isOnline(channel.getOnlineStatus()))
                throw new ServiceException("检测柜通道 " + binding.getChannelId() + " 当前离线或不可观测");
            if (channel == null || !isEnabled(channel.getStatus()))
                throw new ServiceException("检测柜通道 " + binding.getChannelId() + " 不存在或未启用");
            // 只有设备事实为运行中时才标记“运行中接入”;设备暂停属于独立设备状态。
            runtimeAttach |= "WORKING".equalsIgnoreCase(channel.getWorkStatus());
            if (battery.getCollectorId() == null || testMapper.countCollectorEnabled(battery.getCollectorId()) == 0)
                throw new ServiceException("电池号 " + battery.getBatteryNo() + " 的采集器不存在或未启用");
            if (!testMapper.collectorOnline(battery.getCollectorId()))
                throw new ServiceException("采集器 " + battery.getCollectorId() + " 当前离线或不可观测");
            Integer collectorChannelCount = testMapper.selectCollectorChannelCount(battery.getCollectorId());
            validateCollectorChannels(battery.getCollectorId(), collectorChannelCount == null ? 0 : collectorChannelCount,
                    battery.getCollectorChannels(), collectorChannels);
@@ -264,11 +265,6 @@
                JSON.toJSONString(Map.of("testStatus", "COMPLETED", "receptionStatus", "ENDED",
                        "polling", "STOPPED", "release", "IMMEDIATE")));
        return 1;
    }
    private boolean isOnline(String status)
    {
        return status != null && ("ONLINE".equalsIgnoreCase(status) || "0".equals(status));
    }
    private boolean isEnabled(String status)