From 6dcc725b48d06e3e37baab408a293bd11f551b16 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 3 Jan 2026 18:49:37 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E7=BE=A4=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E6=A8=A1=E6=9D=BF=EF=BC=8C=E6=98=BE=E7=A4=BA=E5=AE=8C?= =?UTF-8?q?=E6=95=B4=E4=BB=BB=E5=8A=A1=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加任务数量、品牌、类目、平台、SPU、子类型 - 添加预估工时、截止时间 - 添加发起人、发起部门信息 - 子任务组通知也添加完整信息 - 使用emoji图标和分隔线美化排版 --- .../service/TaskApprovalService.java | 65 +++++++++++++++---- .../designhub/service/TaskItemService.java | 64 ++++++++++++++---- 2 files changed, 102 insertions(+), 27 deletions(-) diff --git a/backend/src/main/java/com/designhub/service/TaskApprovalService.java b/backend/src/main/java/com/designhub/service/TaskApprovalService.java index be9740c..fe51e9b 100644 --- a/backend/src/main/java/com/designhub/service/TaskApprovalService.java +++ b/backend/src/main/java/com/designhub/service/TaskApprovalService.java @@ -277,24 +277,63 @@ public class TaskApprovalService { try { String title = "新任务发布"; StringBuilder content = new StringBuilder(); - content.append("--------------------------------\n"); + 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("━━━━━━━━━━━━━━━━━━━━\n\n"); - if (task.getBrandName() != null) { - content.append("品牌:").append(task.getBrandName()).append("\n"); - } - if (task.getCategoryName() != null) { - content.append("类目:").append(task.getCategoryName()).append("\n"); + // 基本信息 + content.append("📋 **任务名称**:").append(task.getTitle()).append("\n"); + content.append("🔢 **任务编号**:").append(task.getTaskNo()).append("\n"); + content.append("⭐ **任务积分**:").append(task.getScore()).append(" 分\n"); + + // 数量信息 + if (task.getQuantity() != null && task.getQuantity() > 0) { + content.append("📦 **任务数量**:").append(task.getQuantity()).append(" 个\n"); } - content.append("状态:待接单\n\n"); - content.append("--------------------------------\n"); + content.append("\n"); + + // 任务详情 + if (task.getBrandName() != null && !task.getBrandName().isEmpty()) { + content.append("🏷️ **品牌**:").append(task.getBrandName()).append("\n"); + } + if (task.getCategoryName() != null && !task.getCategoryName().isEmpty()) { + content.append("📁 **类目**:").append(task.getCategoryName()).append("\n"); + } + if (task.getPlatformName() != null && !task.getPlatformName().isEmpty()) { + content.append("💻 **平台**:").append(task.getPlatformName()).append("\n"); + } + if (task.getSpuInfo() != null && !task.getSpuInfo().isEmpty()) { + content.append("📦 **SPU**:").append(task.getSpuInfo()).append("\n"); + } + if (task.getTaskSubType() != null && !task.getTaskSubType().isEmpty()) { + content.append("📝 **子类型**:").append(task.getTaskSubType()).append("\n"); + } + + content.append("\n"); + + // 时间信息 + if (task.getEstimatedHours() != null) { + content.append("⏱️ **预估工时**:").append(task.getEstimatedHours().intValue()).append(" 小时\n"); + } + if (task.getDeadline() != null) { + content.append("⏰ **截止时间**:").append(task.getDeadline().format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"))).append("\n"); + } + + content.append("\n"); + + // 发起人信息 + if (task.getPublisherName() != null && !task.getPublisherName().isEmpty()) { + content.append("👤 **发起人**:").append(task.getPublisherName()).append("\n"); + } + if (task.getPublisherDeptName() != null && !task.getPublisherDeptName().isEmpty()) { + content.append("🏢 **发起部门**:").append(task.getPublisherDeptName()).append("\n"); + } + + content.append("\n"); + content.append("━━━━━━━━━━━━━━━━━━━━\n"); content.append(" 💡 请前往任务大厅抢单 \n"); - content.append("--------------------------------"); + content.append("━━━━━━━━━━━━━━━━━━━━"); log.info("准备调用钉钉机器人发送消息,title={}", title); boolean success = dingTalkService.sendRobotMessage(title, content.toString()); diff --git a/backend/src/main/java/com/designhub/service/TaskItemService.java b/backend/src/main/java/com/designhub/service/TaskItemService.java index 902bab3..64bd20a 100644 --- a/backend/src/main/java/com/designhub/service/TaskItemService.java +++ b/backend/src/main/java/com/designhub/service/TaskItemService.java @@ -514,25 +514,61 @@ public class TaskItemService { // 发送钉钉群机器人通知 try { - String title = "🎯 新子任务组发布"; + String title = "新子任务组发布"; StringBuilder content = new StringBuilder(); - content.append("--------------------------------\n"); - content.append(" 🎯 新 子 任 务 组 \n"); - content.append("--------------------------------\n\n"); + content.append("━━━━━━━━━━━━━━━━━━━━\n"); + content.append(" 🎯 新 子 任 务 组 发 布 \n"); + content.append("━━━━━━━━━━━━━━━━━━━━\n\n"); - content.append("主任务:").append(mainTask.getTitle()).append("\n"); - content.append("任务组:第 ").append(groupNo).append(" 组\n"); - content.append("数量:").append(groupItems.size()).append(" 个\n"); + // 主任务信息 + content.append("📋 **主任务**:").append(mainTask.getTitle()).append("\n"); + content.append("🔢 **任务编号**:").append(mainTask.getTaskNo()).append("\n"); + content.append("📦 **任务组**:第 ").append(groupNo).append(" 组\n"); + content.append("🔢 **子任务数量**:").append(groupItems.size()).append(" 个\n"); - // 列出子任务类型 - content.append("类型:\n"); - for (TaskItem item : groupItems) { - content.append("- ").append(item.getItemNo()) - .append(" (").append(item.getTotalScore()).append("分)\n"); + // 计算总积分 + int totalScore = groupItems.stream().mapToInt(item -> item.getTotalScore() != null ? item.getTotalScore() : 0).sum(); + content.append("⭐ **总积分**:").append(totalScore).append(" 分\n"); + + content.append("\n"); + + // 任务详情 + if (mainTask.getBrandName() != null && !mainTask.getBrandName().isEmpty()) { + content.append("🏷️ **品牌**:").append(mainTask.getBrandName()).append("\n"); + } + if (mainTask.getCategoryName() != null && !mainTask.getCategoryName().isEmpty()) { + content.append("📁 **类目**:").append(mainTask.getCategoryName()).append("\n"); + } + if (mainTask.getPlatformName() != null && !mainTask.getPlatformName().isEmpty()) { + content.append("💻 **平台**:").append(mainTask.getPlatformName()).append("\n"); + } + if (mainTask.getSpuInfo() != null && !mainTask.getSpuInfo().isEmpty()) { + content.append("📦 **SPU**:").append(mainTask.getSpuInfo()).append("\n"); } - content.append("状态:待接单\n"); - content.append("\n💡 赶快去任务大厅抢单吧!"); + content.append("\n"); + + // 列出子任务详情 + content.append("📝 **子任务列表**:\n"); + for (TaskItem item : groupItems) { + content.append(" • ").append(item.getItemNo()) + .append("(").append(item.getTotalScore() != null ? item.getTotalScore() : 0).append("分)\n"); + } + + content.append("\n"); + + // 发起人信息 + if (mainTask.getPublisherName() != null && !mainTask.getPublisherName().isEmpty()) { + content.append("👤 **发起人**:").append(mainTask.getPublisherName()).append("\n"); + } + if (mainTask.getPublisherDeptName() != null && !mainTask.getPublisherDeptName().isEmpty()) { + content.append("🏢 **发起部门**:").append(mainTask.getPublisherDeptName()).append("\n"); + } + + content.append("\n"); + content.append("━━━━━━━━━━━━━━━━━━━━\n"); + content.append(" 💡 请前往任务大厅抢单 \n"); + content.append("━━━━━━━━━━━━━━━━━━━━"); dingTalkService.sendRobotMessage(title, content.toString()); log.info("第 {} 组 {} 个子任务已发布到任务大厅,已发送钉钉群通知", groupNo, groupItems.size());