refactor(phase-3): 3A 拆薄第五笔——外观专利 LLM 批管线出件,服务 3135→2801

B 聚类(候选收集、批调度、轮次判死、结果行合并、批计数)原样搬进
service/support/AppearancePatentLlmBatchPipeline;读分片、分片合并、
心跳、封口判定仍留在服务侧,以回调交入。四枚同名入口保留为测试
按名反射的接缝;SourceScanTest 面数 31→32、support 8→9 并逐枚点名新件。
This commit is contained in:
2026-10-20 14:03:18 +08:00
parent 3ac859e05f
commit 4bcce9d534
4 changed files with 537 additions and 371 deletions
@@ -10,6 +10,7 @@ import com.nanri.aiimage.config.InstanceMetadata;
import com.nanri.aiimage.config.StorageProperties;
import com.nanri.aiimage.modules.appearancepatent.client.AppearancePatentLlmClient;
import com.nanri.aiimage.modules.appearancepatent.model.dto.AppearancePatentResultRowDto;
import com.nanri.aiimage.modules.appearancepatent.service.support.AppearancePatentLlmBatchPipeline;
import com.nanri.aiimage.modules.file.service.LocalFileStorageService;
import com.nanri.aiimage.modules.file.service.oss.OssStorageService;
import com.nanri.aiimage.modules.task.mapper.FileResultMapper;
@@ -137,7 +138,7 @@ class AppearancePatentRowMarkTimingTest {
when(taskCacheService.beginRowInspection(eq(TASK_ID), anyString())).thenReturn(true);
List<AppearancePatentResultRowDto> candidates = (List<AppearancePatentResultRowDto>) ReflectionTestUtils
.invokeMethod(service, "collectPendingLlmCandidates", List.of(chunk()), new AppearancePatentTaskService.ChunkRowKeyIndex());
.invokeMethod(service, "collectPendingLlmCandidates", List.of(chunk()), new AppearancePatentLlmBatchPipeline.ChunkRowKeyIndex());
assertEquals(2, candidates.size());
verify(taskCacheService).beginRowInspection(TASK_ID, "r1");
@@ -153,7 +154,7 @@ class AppearancePatentRowMarkTimingTest {
when(taskCacheService.beginRowInspection(eq(TASK_ID), eq("r2"))).thenReturn(false);
List<AppearancePatentResultRowDto> candidates = (List<AppearancePatentResultRowDto>) ReflectionTestUtils
.invokeMethod(service, "collectPendingLlmCandidates", List.of(chunk()), new AppearancePatentTaskService.ChunkRowKeyIndex());
.invokeMethod(service, "collectPendingLlmCandidates", List.of(chunk()), new AppearancePatentLlmBatchPipeline.ChunkRowKeyIndex());
assertEquals(1, candidates.size());
assertEquals("r1", candidates.get(0).getRowToken());
@@ -362,7 +363,7 @@ class AppearancePatentRowMarkTimingTest {
when(taskCacheService.beginRowInspection(eq(TASK_ID), anyString())).thenReturn(true);
List<AppearancePatentResultRowDto> candidates = (List<AppearancePatentResultRowDto>) ReflectionTestUtils
.invokeMethod(service, "collectPendingLlmCandidates", List.of(chunk()), new AppearancePatentTaskService.ChunkRowKeyIndex());
.invokeMethod(service, "collectPendingLlmCandidates", List.of(chunk()), new AppearancePatentLlmBatchPipeline.ChunkRowKeyIndex());
assertEquals(1, candidates.size());
assertEquals("r3", candidates.get(0).getRowToken());
@@ -387,7 +388,7 @@ class AppearancePatentRowMarkTimingTest {
List<AppearancePatentResultRowDto> candidates = (List<AppearancePatentResultRowDto>) ReflectionTestUtils
.invokeMethod(service, "collectPendingLlmCandidates", List.of(chunk()),
new AppearancePatentTaskService.ChunkRowKeyIndex());
new AppearancePatentLlmBatchPipeline.ChunkRowKeyIndex());
assertEquals(3, candidates.size(), "同父号三行必须都进候选,不能只检一行");
verify(taskCacheService).beginRowInspection(TASK_ID, "r21");
@@ -409,7 +410,7 @@ class AppearancePatentRowMarkTimingTest {
List<AppearancePatentResultRowDto> candidates = (List<AppearancePatentResultRowDto>) ReflectionTestUtils
.invokeMethod(service, "collectPendingLlmCandidates", List.of(chunk()),
new AppearancePatentTaskService.ChunkRowKeyIndex());
new AppearancePatentLlmBatchPipeline.ChunkRowKeyIndex());
assertEquals(1, candidates.size());
assertEquals("r22", candidates.get(0).getRowToken(), "该检的是没结论的那一行,不是已经检过的");
@@ -435,7 +436,7 @@ class AppearancePatentRowMarkTimingTest {
landed.setConclusion("无侵权");
ReflectionTestUtils.invokeMethod(service, "mergeLlmRowsIntoChunks",
task(), List.of(landed), List.of(landed), new AppearancePatentTaskService.ChunkRowKeyIndex());
task(), List.of(landed), List.of(landed), new AppearancePatentLlmBatchPipeline.ChunkRowKeyIndex());
ArgumentCaptor<String> written = ArgumentCaptor.forClass(String.class);
verify(transientPayloadStorageService, org.mockito.Mockito.atLeastOnce()).storeChunkPayloadVersioned(