fix: 设计师大厅积分统计使用scoreReward,清理调试日志

This commit is contained in:
Your Name 2026-01-08 18:27:57 +08:00
parent 74ce489724
commit 8367786f34
2 changed files with 12 additions and 8 deletions

View File

@ -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<Integer> ratings = completedTasks.stream()

View File

@ -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 // 发布的任务数(当月)