From 40de16462861beb647bd43a72ecde16a2cba4226 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 5 Mar 2026 12:40:34 +0800 Subject: [PATCH] fix: allow rejected primary tasks submit without items --- .../java/com/designhub/service/TaskService.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/backend/src/main/java/com/designhub/service/TaskService.java b/backend/src/main/java/com/designhub/service/TaskService.java index ccb948f..5276f11 100644 --- a/backend/src/main/java/com/designhub/service/TaskService.java +++ b/backend/src/main/java/com/designhub/service/TaskService.java @@ -1887,12 +1887,14 @@ public class TaskService { throw new BusinessException(ResultCode.PARAM_ERROR, "流水线模式必须是 sequential 或 parallel"); } - // 验证子任务列表(一级需求部门任务在草稿状态下可以不填写子任务) - boolean isPrimaryTaskInDraft = existTask.getIsPrimaryTask() != null - && existTask.getIsPrimaryTask() == 1 - && "draft".equals(existTask.getApprovalStatus()); + // 验证子任务列表(一级需求部门任务在草稿/驳回/待完善明细状态下可以不填写子任务) + boolean allowPrimaryTaskWithoutItems = existTask.getIsPrimaryTask() != null + && existTask.getIsPrimaryTask() == 1 + && ("draft".equals(status) + || "pending_detail_completion".equals(approvalStatus) + || (approvalStatus != null && approvalStatus.contains("rejected"))); - if ((dto.getItems() == null || dto.getItems().isEmpty()) && !isPrimaryTaskInDraft) { + if ((dto.getItems() == null || dto.getItems().isEmpty()) && !allowPrimaryTaskWithoutItems) { throw new BusinessException(ResultCode.PARAM_ERROR, "流水线任务至少需要一个子任务"); } @@ -1923,9 +1925,9 @@ public class TaskService { totalScoreDecimal = totalScoreDecimal.setScale(2, java.math.RoundingMode.HALF_UP); int totalScoreInt = totalScoreDecimal.intValue(); // 用于积分检查 - // 检查部门积分是否充足(管理员跳过积分检查,一级需求部门草稿任务跳过) + // 检查部门积分是否充足(管理员跳过积分检查,一级需求部门无明细提交场景跳过) User user = userService.getUserById(userId); - if (!isAdmin && !isPrimaryTaskInDraft && user.getDeptId() != null) { + if (!isAdmin && !allowPrimaryTaskWithoutItems && user.getDeptId() != null) { if (!teamScorePoolService.checkBalance(user.getDeptId(), totalScoreInt)) { throw new BusinessException(ResultCode.INSUFFICIENT_SCORE, "部门积分余额不足"); }