fix(aihr): require explicit SOP review verdict

This commit is contained in:
2026-07-14 11:07:43 +08:00
parent a34aeacc09
commit 8fcc58fe22
4 changed files with 18 additions and 0 deletions
@@ -199,6 +199,9 @@ public class AihrSopSeedService {
if (id == null) {
return null;
}
if (!hasExplicitSopReviewDecision(request)) {
throw new ServiceException("SOP评审必须明确选择可用或不可用");
}
ensureSopReviewTable();
int updated = jdbcTemplate.update("""
UPDATE aihr_sop_answer_review
@@ -216,6 +219,10 @@ public class AihrSopSeedService {
return updated == 0 ? null : sopReview(id);
}
static boolean hasExplicitSopReviewDecision(SopReviewRequest request) {
return request != null && request.usable() != null;
}
public AnswerFeedbackResponse answerFeedback(AnswerFeedbackRequest request) {
String queryText = request == null ? "" : Optional.ofNullable(request.queryText()).orElse("").trim();
String queryNorm = normalizeFeedbackQuery(queryText);
@@ -44,6 +44,15 @@ public class AihrSopSeedServiceTest {
assertFalse(AihrSopSeedService.shouldCreateSopReview("物业费怎么交", "verify_demo_questions"));
}
@Test
@Tag("dev")
public void sopReviewRequiresExplicitUsableDecision() {
assertFalse(AihrSopSeedService.hasExplicitSopReviewDecision(null));
assertFalse(AihrSopSeedService.hasExplicitSopReviewDecision(new AihrSopDto.SopReviewRequest(null, null, null)));
assertTrue(AihrSopSeedService.hasExplicitSopReviewDecision(new AihrSopDto.SopReviewRequest(true, null, null)));
assertTrue(AihrSopSeedService.hasExplicitSopReviewDecision(new AihrSopDto.SopReviewRequest(false, null, null)));
}
@Test
@Tag("dev")
public void evidenceHitsKeepsNamedDocumentOnly() {