feat: 群通知标签增加任务需求类型

This commit is contained in:
Your Name 2026-01-04 08:12:13 +08:00
parent 7f6bef38cb
commit 259fdcbe3f
2 changed files with 46 additions and 0 deletions

View File

@ -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");
// 任务详情

View File

@ -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");
// 任务详情