diff --git a/backend/src/main/java/com/designhub/service/TaskService.java b/backend/src/main/java/com/designhub/service/TaskService.java index 81b05ea..e4ba5af 100644 --- a/backend/src/main/java/com/designhub/service/TaskService.java +++ b/backend/src/main/java/com/designhub/service/TaskService.java @@ -251,9 +251,10 @@ public class TaskService { throw new BusinessException(ResultCode.PARAM_ERROR, "流水线任务至少需要一个子任务"); } - // 计算总积分和工时(使用BigDecimal保留小数精度) + // 计算总积分、工时和数量(使用BigDecimal保留小数精度) BigDecimal totalScoreDecimal = BigDecimal.ZERO; double totalHours = 0; + int totalQuantity = 0; for (com.designhub.dto.PipelineTaskDTO.TaskItemDTO itemDto : dto.getItems()) { var demandType = configService.getDemandTypeById(itemDto.getTaskTypeId()); if (demandType == null) { @@ -265,6 +266,7 @@ public class TaskService { totalScoreDecimal = totalScoreDecimal.add(itemScore); totalHours += itemHours; + totalQuantity += itemDto.getQuantity(); } // 保留2位小数 @@ -297,6 +299,7 @@ public class TaskService { task.setPipelineMode(dto.getPipelineMode()); task.setScore(totalScoreDecimal); task.setEstimatedHours(BigDecimal.valueOf(totalHours)); + task.setQuantity(totalQuantity); task.setBrandId(dto.getBrandId()); task.setCategoryId(dto.getCategoryId()); task.setPlatformId(dto.getPlatformId()); @@ -1337,9 +1340,10 @@ public class TaskService { throw new BusinessException(ResultCode.PARAM_ERROR, "流水线任务至少需要一个子任务"); } - // 计算总积分和工时(使用BigDecimal保留小数精度) + // 计算总积分、工时和数量(使用BigDecimal保留小数精度) BigDecimal totalScoreDecimal = BigDecimal.ZERO; double totalHours = 0; + int totalQuantity = 0; for (com.designhub.dto.PipelineTaskDTO.TaskItemDTO itemDto : dto.getItems()) { var demandType = configService.getDemandTypeById(itemDto.getTaskTypeId()); if (demandType == null) { @@ -1352,6 +1356,7 @@ public class TaskService { totalScoreDecimal = totalScoreDecimal.add(itemScore); totalHours += itemHours; + totalQuantity += itemDto.getQuantity(); } // 保留2位小数 @@ -1375,6 +1380,7 @@ public class TaskService { existTask.setPipelineMode(dto.getPipelineMode()); existTask.setScore(totalScoreDecimal); existTask.setEstimatedHours(BigDecimal.valueOf(totalHours)); + existTask.setQuantity(totalQuantity); existTask.setBrandId(dto.getBrandId()); existTask.setCategoryId(dto.getCategoryId()); existTask.setPlatformId(dto.getPlatformId()); diff --git a/frontend/src/views/CreateTask.vue b/frontend/src/views/CreateTask.vue index 390dfac..02ace8f 100644 --- a/frontend/src/views/CreateTask.vue +++ b/frontend/src/views/CreateTask.vue @@ -98,7 +98,7 @@