From 048c5e189ea2161a46e97ce956f9057e6aa8e61f Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 20 Jan 2026 00:32:53 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=B8=80=E7=BA=A7=E9=9C=80=E6=B1=82?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 需求部门处理人进行中任务显示一级需求部门的任务 2. 一级需求任务完结后由明细完善人确认接收并评分 3. 商品条码由一级需求发起人填写,明细编辑模式下只读 --- .../java/com/designhub/mapper/TaskMapper.java | 3 +- .../com/designhub/service/TaskService.java | 37 ++++++-- frontend/src/views/CreateTask.vue | 94 ++++++++++++------- 3 files changed, 92 insertions(+), 42 deletions(-) diff --git a/backend/src/main/java/com/designhub/mapper/TaskMapper.java b/backend/src/main/java/com/designhub/mapper/TaskMapper.java index f1ce04f..7767e3c 100644 --- a/backend/src/main/java/com/designhub/mapper/TaskMapper.java +++ b/backend/src/main/java/com/designhub/mapper/TaskMapper.java @@ -171,6 +171,7 @@ public interface TaskMapper extends BaseMapper { /** * 查询我接收的任务 + * 包括:作为接收人的任务 或 作为一级需求任务明细完善人的任务 */ @Select("") diff --git a/backend/src/main/java/com/designhub/service/TaskService.java b/backend/src/main/java/com/designhub/service/TaskService.java index 37bcf74..fa93803 100644 --- a/backend/src/main/java/com/designhub/service/TaskService.java +++ b/backend/src/main/java/com/designhub/service/TaskService.java @@ -3119,12 +3119,27 @@ public class TaskService { task.setUpdateTime(LocalDateTime.now()); taskMapper.updateById(task); - // 发送通知给发起人 + // 发送通知 + // 对于一级需求任务,通知明细完善人;否则通知发起人 try { Notification notification = new Notification(); - notification.setReceiverId(task.getPublisherId()); - notification.setTitle("任务提交审核"); - notification.setContent("任务【" + task.getTitle() + "】已提交审核,请查看"); + + boolean isPrimaryTask = task.getIsPrimaryTask() != null && task.getIsPrimaryTask() == 1; + Long receiverId; + + if (isPrimaryTask && task.getDetailCompleterId() != null) { + // 一级需求任务:通知明细完善人确认接收并评分 + receiverId = task.getDetailCompleterId(); + notification.setTitle("一级需求任务待确认"); + notification.setContent("一级需求任务【" + task.getTitle() + "】已完成,请确认接收并评分"); + } else { + // 普通任务:通知发起人 + receiverId = task.getPublisherId(); + notification.setTitle("任务提交审核"); + notification.setContent("任务【" + task.getTitle() + "】已提交审核,请查看"); + } + + notification.setReceiverId(receiverId); notification.setNotificationType("TASK_REVIEW"); notification.setRelatedType("task"); notification.setRelatedId(taskId); @@ -3149,12 +3164,16 @@ public class TaskService { throw new BusinessException("任务不存在"); } - // 验证权限(发起人或部门负责人) + // 验证权限 + // 对于一级需求任务:明细完善人可以审核 + // 对于普通任务:发起人或部门负责人可以审核 User user = userService.getUserById(userId); if (user == null) { throw new BusinessException("用户不存在"); } + boolean isPrimaryTask = task.getIsPrimaryTask() != null && task.getIsPrimaryTask() == 1; + boolean isDetailCompleter = isPrimaryTask && userId.equals(task.getDetailCompleterId()); boolean isPublisher = userId.equals(task.getPublisherId()); boolean isDeptLeader = false; @@ -3165,8 +3184,12 @@ public class TaskService { } } - if (!isPublisher && !isDeptLeader) { - throw new BusinessException("只有任务发起人或部门负责人才能审核任务"); + if (!isDetailCompleter && !isPublisher && !isDeptLeader) { + if (isPrimaryTask) { + throw new BusinessException("只有明细完善人才能确认接收一级需求任务"); + } else { + throw new BusinessException("只有任务发起人或部门负责人才能审核任务"); + } } // 验证任务状态 diff --git a/frontend/src/views/CreateTask.vue b/frontend/src/views/CreateTask.vue index 7d24802..215176c 100644 --- a/frontend/src/views/CreateTask.vue +++ b/frontend/src/views/CreateTask.vue @@ -266,42 +266,63 @@ label="商品条码" required > - -
-
- 已添加条码 ({{ formData.productBarcodes.length }}个) + + - -
- - - 验证并添加 - -
+ +
@@ -2184,6 +2205,11 @@ const loadPrimaryTaskForEdit = async () => { formData.releaseType = task.releaseType || 'recruitment' formData.isUrgent = task.isUrgent === 1 || task.isUrgent === true + // 加载商品条码(一级需求发起人填写的) + if (task.productBarcodes) { + formData.productBarcodes = task.productBarcodes.split(',').filter((b: string) => b.trim()) + } + // 处理预览图 if (task.previewImage) { formData.previewImage = task.previewImage