修复:允许需求部门成员编辑待完善明细的一级需求任务

This commit is contained in:
Your Name 2026-01-23 13:42:21 +08:00
parent f80c956b2b
commit 5c761f733a

View File

@ -1671,7 +1671,22 @@ public class TaskService {
&& existTask.getDetailCompleterId() != null
&& userId.equals(existTask.getDetailCompleterId());
if (!isAdmin && !userId.equals(existTask.getPublisherId()) && !isPrimaryTaskDetailCompleter) {
// 对于一级需求任务在待完善明细状态,需求部门的成员都可以编辑
boolean isDemandDeptMemberForPrimaryTask = false;
if (existTask.getIsPrimaryTask() != null && existTask.getIsPrimaryTask() == 1
&& "pending_detail_completion".equals(existTask.getApprovalStatus())) {
// 获取当前用户的部门类型
User currentUser = userMapper.selectById(userId);
if (currentUser != null && currentUser.getDeptId() != null) {
Department userDept = departmentMapper.selectById(currentUser.getDeptId());
if (userDept != null && "demand".equals(userDept.getDeptType())) {
isDemandDeptMemberForPrimaryTask = true;
log.info("需求部门成员 {} 编辑一级需求任务 {}", userId, id);
}
}
}
if (!isAdmin && !userId.equals(existTask.getPublisherId()) && !isPrimaryTaskDetailCompleter && !isDemandDeptMemberForPrimaryTask) {
throw new BusinessException(ResultCode.FORBIDDEN, "只有任务发布人或指定的明细完善人可以更新任务");
}