From eb53c182ad4f90b17afa597f3c2f088fbd131d66 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 8 Jan 2026 15:53:31 +0800 Subject: [PATCH] =?UTF-8?q?fix:=201.=E6=8C=87=E6=B4=BE=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E5=AE=A1=E6=A0=B8=E9=80=9A=E8=BF=87=E5=90=8E=E5=8F=AA=E5=8F=91?= =?UTF-8?q?=E9=80=81=E4=B8=AA=E4=BA=BA=E9=80=9A=E7=9F=A5=E7=BB=99=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=B8=88=202.=E4=BC=98=E5=8C=96=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E6=98=8E=E7=A1=AE=E5=91=8A=E7=9F=A5=E6=97=A0?= =?UTF-8?q?=E9=9C=80=E6=8A=A2=E5=8D=95=203.=E4=BF=AE=E5=A4=8D=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=B8=88=E8=BF=9B=E8=A1=8C=E4=B8=AD=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E8=B0=83=E7=94=A8=E6=AD=A3=E7=A1=AE=E7=9A=84?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/TaskApprovalService.java | 66 +++++++++++-------- frontend/src/views/TaskHall.vue | 10 +-- 2 files changed, 43 insertions(+), 33 deletions(-) diff --git a/backend/src/main/java/com/designhub/service/TaskApprovalService.java b/backend/src/main/java/com/designhub/service/TaskApprovalService.java index 24b8a6e..508a2b6 100644 --- a/backend/src/main/java/com/designhub/service/TaskApprovalService.java +++ b/backend/src/main/java/com/designhub/service/TaskApprovalService.java @@ -271,6 +271,7 @@ public class TaskApprovalService { // 1. 发送个人钉钉通知给设计师 StringBuilder personalContent = new StringBuilder(); + personalContent.append("### 任务已自动分配给您,无需抢单 \n\n"); personalContent.append("**任务名称**:").append(task.getTitle()).append(" \n"); personalContent.append("**任务编号**:").append(task.getTaskNo()).append(" \n"); personalContent.append("**任务积分**:").append(task.getScore()).append(" 分 \n"); @@ -297,9 +298,11 @@ public class TaskApprovalService { personalContent.append(" \n**发起人**:").append(task.getPublisherName()).append(" \n"); } + personalContent.append(" \n> 💡 任务已开始计时,请前往【我的任务】查看详情"); + Notification notification = new Notification(); notification.setReceiverId(finalReceiverId); - notification.setTitle("您有新任务指派"); + notification.setTitle("任务已指派给您(已自动开始)"); notification.setContent(personalContent.toString()); notification.setNotificationType("TASK_ASSIGNED"); notification.setRelatedType("task"); @@ -308,35 +311,40 @@ public class TaskApprovalService { notificationService.sendNotification(notification); log.info("任务指派个人通知已发送给设计师: userId={}", finalReceiverId); - // 2. 发送群通知并@指定的设计师 - String title = "任务已指派"; - StringBuilder content = new StringBuilder(); - content.append("-------------------------------- \n"); - content.append(" 【 任 务 已 指 派 】 \n"); - content.append("-------------------------------- \n\n"); - - content.append("任务名称:").append(task.getTitle()).append(" \n"); - content.append("任务编号:").append(task.getTaskNo()).append(" \n"); - content.append("任务积分:").append(task.getScore()).append(" 分 \n"); - content.append("指派给:").append(receiverName).append(" \n"); - - if (task.getEstimatedHours() != null) { - content.append("预估工时:").append(task.getEstimatedHours().intValue()).append(" 小时 \n"); + // 2. 只有非预先指定的任务才发送群通知(预先指定的任务只发送个人通知) + if (!isPreAssigned) { + // 发送群通知并@指定的设计师 + String title = "任务已指派"; + StringBuilder content = new StringBuilder(); + content.append("-------------------------------- \n"); + content.append(" 【 任 务 已 指 派 】 \n"); + content.append("-------------------------------- \n\n"); + + content.append("任务名称:").append(task.getTitle()).append(" \n"); + content.append("任务编号:").append(task.getTaskNo()).append(" \n"); + content.append("任务积分:").append(task.getScore()).append(" 分 \n"); + content.append("指派给:").append(receiverName).append(" \n"); + + if (task.getEstimatedHours() != null) { + content.append("预估工时:").append(task.getEstimatedHours().intValue()).append(" 小时 \n"); + } + + if (task.getPublisherName() != null && !task.getPublisherName().isEmpty()) { + content.append("发起人:").append(task.getPublisherName()).append(" \n"); + } + + content.append(" \n"); + content.append("-------------------------------- \n"); + content.append("请尽快处理! \n"); + content.append("--------------------------------"); + + java.util.List atMobiles = receiverPhone != null ? + java.util.Arrays.asList(receiverPhone) : null; + dingTalkService.sendRobotMessage(title, content.toString(), atMobiles); + log.info("任务指派群通知已发送,@手机号: {}", receiverPhone); + } else { + log.info("任务【{}】为预先指定任务,只发送个人通知,不发送群通知", task.getTitle()); } - - if (task.getPublisherName() != null && !task.getPublisherName().isEmpty()) { - content.append("发起人:").append(task.getPublisherName()).append(" \n"); - } - - content.append(" \n"); - content.append("-------------------------------- \n"); - content.append("请尽快处理! \n"); - content.append("--------------------------------"); - - java.util.List atMobiles = receiverPhone != null ? - java.util.Arrays.asList(receiverPhone) : null; - dingTalkService.sendRobotMessage(title, content.toString(), atMobiles); - log.info("任务指派群通知已发送,@手机号: {}", receiverPhone); } catch (Exception e) { log.error("发送任务指派通知失败", e); } diff --git a/frontend/src/views/TaskHall.vue b/frontend/src/views/TaskHall.vue index ef784ab..819c76c 100644 --- a/frontend/src/views/TaskHall.vue +++ b/frontend/src/views/TaskHall.vue @@ -3889,10 +3889,12 @@ const loadInProgressTasks = async () => { // 接单部门用户(设计师):看子任务卡片 + 直接分配给自己的普通任务 const [itemResponse, taskResponse] = await Promise.all([ taskApi.getInProgressTaskItems(params), - // 获取直接分配给当前用户的普通任务(非流水线任务) - taskApi.getTasks({ - ...params, - role: 'receiver' // 以接单人身份查询 + // 获取直接分配给当前用户的普通任务(使用正确的 /my 接口) + taskApi.getMyTasks({ + role: 'receiver', + status: 'in_progress', + page: inProgressPagination.page, + pageSize: inProgressPagination.pageSize }) ])