修复继续接收加载测试配置
继续接收前加载数据库中的电池绑定配置,避免旧测试数据缺少内嵌 batteries 时发生空指针。
| | |
| | | TTest current = validTest(); |
| | | current.setTestId(10L); |
| | | current.setReceptionStatus("PAUSED"); |
| | | List<TTestBattery> configuredBatteries = current.getBatteries(); |
| | | current.setBatteries(null); |
| | | when(testMapper.selectTestByIdForUpdate(10L)).thenReturn(current); |
| | | when(testMapper.selectTestBatteries(10L)).thenReturn(configuredBatteries); |
| | | when(testMapper.updateReceptionResumed(eq(10L), eq("operator"), any())).thenReturn(1); |
| | | |
| | | assertEquals(1, testService.resumeReception(10L, 7L, "operator")); |
| | |
| | | if (current == null) throw new ServiceException("测试不存在"); |
| | | if (!"PAUSED".equals(current.getReceptionStatus())) |
| | | throw new ServiceException("当前测试不是暂停接收状态"); |
| | | // 加锁查询只返回测试主表,继续接收需要完整绑定配置来重建各来源接收区间。 |
| | | loadConfiguration(current); |
| | | Date actionAt = new Date(); |
| | | if (testMapper.updateReceptionResumed(testId, updateBy, actionAt) != 1) |
| | | throw new ServiceException("测试状态已变更,请刷新后重试"); |