fix: allow rejected primary tasks submit without items

This commit is contained in:
Your Name 2026-03-05 12:40:34 +08:00
parent 26a99e3a34
commit 40de164628

View File

@ -1887,12 +1887,14 @@ public class TaskService {
throw new BusinessException(ResultCode.PARAM_ERROR, "流水线模式必须是 sequential 或 parallel");
}
// 验证子任务列表(一级需求部门任务在草稿状态下可以不填写子任务)
boolean isPrimaryTaskInDraft = existTask.getIsPrimaryTask() != null
// 验证子任务列表(一级需求部门任务在草稿/驳回/待完善明细状态下可以不填写子任务)
boolean allowPrimaryTaskWithoutItems = existTask.getIsPrimaryTask() != null
&& existTask.getIsPrimaryTask() == 1
&& "draft".equals(existTask.getApprovalStatus());
&& ("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, "部门积分余额不足");
}