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 }) ])