fix(appearance-patent): 代理缺失回填与任务前置提示

- 本地代理回填兼容旧版全局 proxy_url,补报成功后重拉服务端快照
- 创建任务前检查服务端代理,缺失时弹窗拦截并引导配置
- 商标查询失败的真实原因写入结果原因列,不再只显示查询失败
This commit is contained in:
2026-10-25 21:28:26 +08:00
parent fcb6b5f545
commit e265c188f7
7 changed files with 239 additions and 22 deletions
@@ -78,6 +78,36 @@ class AppearancePatentBrandBatchTest {
assertThat(merged.get(1).getTitleRisk()).as("干净行不得继承别行的侵权词").isEqualTo("无侵权");
}
/**
* 商标查询失败时,上游给的真实原因要落进行级原因,不能只留一句「商标查询失败」。
* 2026-10-25 账号 1210 的 32300/32309 整批就是这个形状:服务端缺代理,
* 交付表上每行只有「商标查询失败」,用户和运维都看不出该去配代理。
*/
@Test
void brandQueryFailureReasonIsKeptForTheResult() throws Exception {
when(brandCheckClient.checkTitleTexts(anyList(), eq("Terms"), any())).thenAnswer(invocation -> {
List<String> titles = invocation.getArgument(0);
List<BrandCheckClient.BrandCheckBatchResult> results = new ArrayList<>();
for (String title : titles) {
results.add(new BrandCheckClient.BrandCheckBatchResult(
List.of(title), List.of(), List.of(title), "用户未配置代理"));
}
return results;
});
List<AppearancePatentResultRowDto> rows = List.of(row("1"));
String dataText = """
{"data":[{"row_id":"1","title":"小米","appearance":"无侵权","result":"无侵权"}]}
""";
List<AppearancePatentResultRowDto> merged = client.mergeRowsFromDataText(rows, dataText);
assertThat(merged.get(0).getTitleRisk()).startsWith("商标查询失败");
assertThat(merged.get(0).getConclusion()).isEqualTo("外观无侵权·商标待复核");
assertThat(merged.get(0).getTitleReason())
.as("原因列要能直接告诉用户/运维缺的是代理")
.isEqualTo("用户未配置代理");
}
@Test
void batchWithNothingToCheckSendsNoBrandQueryAtAll() throws Exception {
List<AppearancePatentResultRowDto> rows = List.of(row("1"));