fix(appearance-patent): 代理缺失回填与任务前置提示
- 本地代理回填兼容旧版全局 proxy_url,补报成功后重拉服务端快照 - 创建任务前检查服务端代理,缺失时弹窗拦截并引导配置 - 商标查询失败的真实原因写入结果原因列,不再只显示查询失败
This commit is contained in:
+7
-1
@@ -1156,7 +1156,13 @@ public class AppearancePatentLlmClient {
|
||||
row.setPatentRisk(result.patent());
|
||||
row.setConclusion(buildConclusion(row.getTitleRisk(), row.getAppearanceRisk(), result.result()));
|
||||
row.setStatus(result.status());
|
||||
row.setTitleReason(result.titleReason());
|
||||
// 商标查询失败时把上游给的真实原因(如「用户未配置代理」「品牌检测服务不可达」)
|
||||
// 落进「原因」sheet:只写「商标查询失败」时,用户和运维都看不出该去配代理还是等上游恢复。
|
||||
String titleReason = result.titleReason();
|
||||
if ((titleReason == null || titleReason.isBlank()) && isBrandQueryFailed(row.getTitleRisk())) {
|
||||
titleReason = brandCheck == null ? "" : brandCheck.reason();
|
||||
}
|
||||
row.setTitleReason(titleReason);
|
||||
row.setAppearanceReason(result.appearanceReason());
|
||||
row.setPatentReason(result.patentReason());
|
||||
row.setScore(result.score());
|
||||
|
||||
+30
@@ -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"));
|
||||
|
||||
Reference in New Issue
Block a user