From 259fdcbe3f9749cc1172c413694a1960298fd60b Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 4 Jan 2026 08:12:13 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=BE=A4=E9=80=9A=E7=9F=A5=E6=A0=87?= =?UTF-8?q?=E7=AD=BE=E5=A2=9E=E5=8A=A0=E4=BB=BB=E5=8A=A1=E9=9C=80=E6=B1=82?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/TaskApprovalService.java | 23 +++++++++++++++++++ .../designhub/service/TaskItemService.java | 23 +++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/backend/src/main/java/com/designhub/service/TaskApprovalService.java b/backend/src/main/java/com/designhub/service/TaskApprovalService.java index f1daadb..49c4c82 100644 --- a/backend/src/main/java/com/designhub/service/TaskApprovalService.java +++ b/backend/src/main/java/com/designhub/service/TaskApprovalService.java @@ -292,6 +292,29 @@ public class TaskApprovalService { content.append("任务数量:").append(task.getQuantity()).append(" 个 \n"); } + // 任务需求类型 + if (task.getTaskTypeIds() != null && !task.getTaskTypeIds().isEmpty()) { + StringBuilder typeNames = new StringBuilder(); + String[] typeIds = task.getTaskTypeIds().split(","); + for (String typeIdStr : typeIds) { + try { + Long typeId = Long.parseLong(typeIdStr.trim()); + DemandType demandType = configService.getDemandTypeById(typeId); + if (demandType != null) { + if (typeNames.length() > 0) { + typeNames.append("、"); + } + typeNames.append(demandType.getTypeName()); + } + } catch (NumberFormatException e) { + log.warn("解析任务类型ID失败:{}", typeIdStr); + } + } + if (typeNames.length() > 0) { + content.append("需求类型:").append(typeNames.toString()).append(" \n"); + } + } + content.append(" \n"); // 任务详情 diff --git a/backend/src/main/java/com/designhub/service/TaskItemService.java b/backend/src/main/java/com/designhub/service/TaskItemService.java index 0412649..acb0250 100644 --- a/backend/src/main/java/com/designhub/service/TaskItemService.java +++ b/backend/src/main/java/com/designhub/service/TaskItemService.java @@ -531,6 +531,29 @@ public class TaskItemService { int totalScore = groupItems.stream().mapToInt(item -> item.getTotalScore() != null ? item.getTotalScore() : 0).sum(); content.append("总积分:").append(totalScore).append(" 分 \n"); + // 任务需求类型 + if (mainTask.getTaskTypeIds() != null && !mainTask.getTaskTypeIds().isEmpty()) { + StringBuilder typeNames = new StringBuilder(); + String[] typeIds = mainTask.getTaskTypeIds().split(","); + for (String typeIdStr : typeIds) { + try { + Long typeId = Long.parseLong(typeIdStr.trim()); + com.designhub.entity.DemandType demandType = configService.getDemandTypeById(typeId); + if (demandType != null) { + if (typeNames.length() > 0) { + typeNames.append("、"); + } + typeNames.append(demandType.getTypeName()); + } + } catch (NumberFormatException e) { + log.warn("解析任务类型ID失败:{}", typeIdStr); + } + } + if (typeNames.length() > 0) { + content.append("需求类型:").append(typeNames.toString()).append(" \n"); + } + } + content.append(" \n"); // 任务详情