From 8367786f3420d93fe48e9740a5b555ab6167779e Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 8 Jan 2026 18:27:57 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=AE=BE=E8=AE=A1=E5=B8=88=E5=A4=A7?= =?UTF-8?q?=E5=8E=85=E7=A7=AF=E5=88=86=E7=BB=9F=E8=AE=A1=E4=BD=BF=E7=94=A8?= =?UTF-8?q?scoreReward=EF=BC=8C=E6=B8=85=E7=90=86=E8=B0=83=E8=AF=95?= =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/designhub/service/DesignerService.java | 12 +++++++++++- frontend/src/views/TaskHall.vue | 8 +------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/backend/src/main/java/com/designhub/service/DesignerService.java b/backend/src/main/java/com/designhub/service/DesignerService.java index fec50b2..7b824c6 100644 --- a/backend/src/main/java/com/designhub/service/DesignerService.java +++ b/backend/src/main/java/com/designhub/service/DesignerService.java @@ -183,6 +183,8 @@ public class DesignerService { Integer inProgressCount = (mainInProgressCount != null ? mainInProgressCount.intValue() : 0) + (subInProgressCount != null ? subInProgressCount.intValue() : 0); stats.setInProgressCount(inProgressCount); + log.debug("设计师进行中任务统计: userId={}, mainInProgress={}, subInProgress={}, total={}", + userId, mainInProgressCount, subInProgressCount, inProgressCount); // 待接单任务数(队列)- 这里应该是用户已接收但还未开始的任务,实际上应该是0 // 因为一旦接收任务,状态就会变成 in_progress @@ -245,14 +247,22 @@ public class DesignerService { ); // 累计获得积分(主任务 + 子任务) + // 优先使用 scoreReward(实际获得积分),如果没有则使用 score(任务积分) Integer mainTaskScore = completedTasks.stream() - .mapToInt(task -> task.getScore() != null ? task.getScore() : 0) + .mapToInt(task -> { + if (task.getScoreReward() != null && task.getScoreReward() > 0) { + return task.getScoreReward(); + } + return task.getScore() != null ? task.getScore() : 0; + }) .sum(); Integer subTaskScore = completedSubTasks.stream() .mapToInt(item -> item.getTotalScore() != null ? item.getTotalScore() : 0) .sum(); Integer totalScore = mainTaskScore + subTaskScore; stats.setTotalScore(totalScore); + log.debug("设计师积分统计: userId={}, mainTaskScore={}, subTaskScore={}, totalScore={}", + userId, mainTaskScore, subTaskScore, totalScore); // 平均评分 List ratings = completedTasks.stream() diff --git a/frontend/src/views/TaskHall.vue b/frontend/src/views/TaskHall.vue index b68132e..3b3f0b4 100644 --- a/frontend/src/views/TaskHall.vue +++ b/frontend/src/views/TaskHall.vue @@ -2435,9 +2435,7 @@ const effectiveDeptType = computed(() => { // 获取当前有效的部门ID const effectiveDeptId = computed(() => { - const result = currentDeptView.value !== undefined ? currentDeptView.value : userDeptId.value - console.log('effectiveDeptId计算:', {currentDeptView: currentDeptView.value, userDeptId: userDeptId.value, result}) - return result + return currentDeptView.value !== undefined ? currentDeptView.value : userDeptId.value }) // 初始化部门视角数据 @@ -2462,7 +2460,6 @@ const initDeptViewData = async () => { } if (user) { - console.log('初始化部门视角 - 用户信息:', {deptId: user.deptId, deptName: user.deptName, deptType: user.deptType, managedDepartments: user.managedDepartments}) userDeptId.value = user.deptId userDeptName.value = user.deptName || '我的部门' userDeptType.value = user.deptType || 'demand' @@ -3947,13 +3944,10 @@ const loadDashboardStats = async () => { } catch (e) { /* ignore */ } } } - console.log('loadDashboardStats - effectiveDept:', effectiveDept, 'userDeptId:', userDeptId.value, 'currentDeptView:', currentDeptView.value) if (effectiveDept) { params.deptId = effectiveDept } - console.log('loadDashboardStats 调用参数:', params, 'effectiveDeptType:', effectiveDeptType.value) const response = await taskApi.getDashboardStats(Object.keys(params).length > 0 ? params : undefined) - console.log('loadDashboardStats 响应:', response.data) if (response.code === 200) { const data = response.data dataCards.value[0].value = data.publishedCount || 0 // 发布的任务数(当月)