From 26943dd23596398e2d3af51379463fae5580a1fa Mon Sep 17 00:00:00 2001 From: luogw <3132758203@qq.com> Date: Wed, 18 Mar 2026 17:19:11 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/Impl/CheckAppealDomainServiceImpl.java | 6 ------ .../PostToGenerateQuestionDomainServiceImpl.java | 12 +++++++++--- .../impl/SaveOrUpdateTaskDomainServiceImpl.java | 2 +- src/main/resources/application-dev.yml | 1 + src/main/resources/application-test.yml | 1 + 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/project/appeal/domain/service/Impl/CheckAppealDomainServiceImpl.java b/src/main/java/com/project/appeal/domain/service/Impl/CheckAppealDomainServiceImpl.java index 1d532b1..108fb4a 100644 --- a/src/main/java/com/project/appeal/domain/service/Impl/CheckAppealDomainServiceImpl.java +++ b/src/main/java/com/project/appeal/domain/service/Impl/CheckAppealDomainServiceImpl.java @@ -37,9 +37,6 @@ public class CheckAppealDomainServiceImpl implements CheckAppealDomainService { if (ObjectUtil.isEmpty(appealDTO.getId()) && StringUtils.isBlank(appealDTO.getRemark())){ throw new MissingParameterException("缺少申诉理由"); } - if (ObjectUtil.isEmpty(appealDTO.getId()) && appealDTO.getRemark().length() > 500){ - throw new MissingParameterException("申诉理由不能超过500字符"); - } if (ObjectUtil.isEmpty(appealDTO.getId()) && !appealDTO.getStatus().equals(AppealStatusEnum.PENDING_REVIEW.getValue())){ throw new BusinessErrorException("申诉状态错误"); @@ -50,9 +47,6 @@ public class CheckAppealDomainServiceImpl implements CheckAppealDomainService { if (!appealDTO.getStatus().equals(AppealStatusEnum.PENDING_REVIEW.getValue()) && StringUtils.isBlank(appealDTO.getReason())){ throw new BusinessErrorException("缺少审批意见"); } - if (!appealDTO.getStatus().equals(AppealStatusEnum.PENDING_REVIEW.getValue()) && appealDTO.getReason().length() > 500){ - throw new MissingParameterException("审批意见不能超过500字符"); - } //校验题目是否以申诉过 if (ObjectUtil.isEmpty(appealDTO.getId()) ){ QueryWrapper entityQueryWrapper = new QueryWrapper<>(); diff --git a/src/main/java/com/project/interaction/domain/service/impl/PostToGenerateQuestionDomainServiceImpl.java b/src/main/java/com/project/interaction/domain/service/impl/PostToGenerateQuestionDomainServiceImpl.java index 94a2264..5d574ba 100644 --- a/src/main/java/com/project/interaction/domain/service/impl/PostToGenerateQuestionDomainServiceImpl.java +++ b/src/main/java/com/project/interaction/domain/service/impl/PostToGenerateQuestionDomainServiceImpl.java @@ -55,6 +55,10 @@ public class PostToGenerateQuestionDomainServiceImpl implements PostToGenerateQu private final List list = Arrays.asList(0, 1, 2, 3); + + @Value("${question.generation.downgrade:true}") + private Boolean downgrade; + /** * 生成题目 * 1. 先尝试调用算法服务生成真实题目 @@ -73,6 +77,11 @@ public class PostToGenerateQuestionDomainServiceImpl implements PostToGenerateQu log.info(">>> [题目生成] 开始生成题目, TaskId: {}, ClusterId: {}, 题型: {}, 数量: {}", taskId, clusterId, questionType, num); + if (downgrade){ + generateFallbackQuestions(dtoList, questionType, num); + return; + } + try { // 应用限流:获取令牌,超过限流速率则等待 long waitStart = System.currentTimeMillis(); @@ -96,9 +105,6 @@ public class PostToGenerateQuestionDomainServiceImpl implements PostToGenerateQu taskId, e.getMessage()); } - //熔断降级:算法服务失败时使用硬编码生成默认题目 -// log.info(">>> [题目生成] 启用熔断降级,生成默认题目"); -// generateFallbackQuestions(dtoList, questionType, num); //发送预警通知 notifyUtil.notify(taskId,clusterId); } diff --git a/src/main/java/com/project/task/domain/service/impl/SaveOrUpdateTaskDomainServiceImpl.java b/src/main/java/com/project/task/domain/service/impl/SaveOrUpdateTaskDomainServiceImpl.java index 55cd70a..5a6ed13 100644 --- a/src/main/java/com/project/task/domain/service/impl/SaveOrUpdateTaskDomainServiceImpl.java +++ b/src/main/java/com/project/task/domain/service/impl/SaveOrUpdateTaskDomainServiceImpl.java @@ -225,7 +225,7 @@ public class SaveOrUpdateTaskDomainServiceImpl implements SaveOrUpdateTaskDomain // 获取知识点总数用于校验 int totalKnowledgePoints = dto.getAccurateGraspNum() + dto.getVagueGraspNum(); if (totalQuestions > totalKnowledgePoints) { - throw new BusinessErrorException("题目总数(" + totalQuestions + ")不能超过知识点总数(" + totalKnowledgePoints + ")"); + throw new BusinessErrorException("题目总数" + totalQuestions + ",不能超过知识点总数" + totalKnowledgePoints); } if (totalQuestions > 100) { throw new BusinessErrorException("题目总数不能超过 100 道,当前为:" + totalQuestions); diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index ced36c7..aadba9c 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -86,5 +86,6 @@ question: generation: # 限流速率:每秒允许的API请求数 rate-limit: 20 + downgrade: false scheduled-task: owner: test \ No newline at end of file diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml index 33def6a..4e1316b 100644 --- a/src/main/resources/application-test.yml +++ b/src/main/resources/application-test.yml @@ -84,6 +84,7 @@ question: generation: # 限流速率:每秒允许的API请求数 rate-limit: 20 + downgrade: true scheduled-task: owner: test \ No newline at end of file