修复扣分不一致问题:排行榜也计算子任务延误扣分;增加弹窗宽度并修复滚动条样式

This commit is contained in:
Your Name 2026-01-14 10:19:12 +08:00
parent 7142cda20f
commit 665369bb17
2 changed files with 119 additions and 1 deletions

View File

@ -728,6 +728,102 @@ public class AnalyticsService {
}
}
// 计算子任务的延误扣分(与getDesignerDeductionDetails保持一致)
try {
// 查询已完成的子任务(按完成时间查询)
List<TaskItem> completedTaskItems = taskItemMapper.selectList(
new LambdaQueryWrapper<TaskItem>()
.eq(TaskItem::getReceiverId, designer.getId())
.eq(TaskItem::getStatus, "completed")
.isNotNull(TaskItem::getCompleteTime)
.ge(TaskItem::getCompleteTime, startTime)
.le(TaskItem::getCompleteTime, endTime)
);
// 查询进行中的子任务
List<TaskItem> inProgressTaskItems = taskItemMapper.selectList(
new LambdaQueryWrapper<TaskItem>()
.eq(TaskItem::getReceiverId, designer.getId())
.eq(TaskItem::getStatus, "in_progress")
.isNotNull(TaskItem::getEstimatedHours)
.isNotNull(TaskItem::getCreateTime)
);
// 处理已完成的子任务的延误扣分
for (TaskItem item : completedTaskItems) {
if (item.getEstimatedHours() != null && item.getEstimatedHours().compareTo(BigDecimal.ZERO) > 0
&& item.getCreateTime() != null && item.getCompleteTime() != null) {
// 计算子任务的预期deadline:createTime + estimatedHours
long estimatedMinutes = item.getEstimatedHours().multiply(BigDecimal.valueOf(60)).longValue();
LocalDateTime expectedDeadline = item.getCreateTime().plusMinutes(estimatedMinutes);
// 如果完成时间超过预期deadline,计算延误扣分
if (item.getCompleteTime().isAfter(expectedDeadline)) {
BigDecimal itemScore = item.getTotalScore() != null ? BigDecimal.valueOf(item.getTotalScore()) : BigDecimal.ZERO;
if (itemScore.compareTo(BigDecimal.ZERO) > 0) {
// 计算延误小时数
long overdueHours = Duration.between(expectedDeadline, item.getCompleteTime()).toHours();
if (overdueHours > 0) {
// 计算扣分
BigDecimal itemDeduction = itemScore
.multiply(BigDecimal.valueOf(overdueHours))
.multiply(deductionRate)
.divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP);
// 扣分不能超过任务积分
if (itemDeduction.compareTo(itemScore) > 0) {
itemDeduction = itemScore;
}
deductionScore = deductionScore.add(itemDeduction);
}
}
}
}
}
// 处理进行中的子任务的延误扣分
for (TaskItem item : inProgressTaskItems) {
if (item.getEstimatedHours() != null && item.getEstimatedHours().compareTo(BigDecimal.ZERO) > 0
&& item.getCreateTime() != null) {
// 计算子任务的预期deadline:createTime + estimatedHours
long estimatedMinutes = item.getEstimatedHours().multiply(BigDecimal.valueOf(60)).longValue();
LocalDateTime expectedDeadline = item.getCreateTime().plusMinutes(estimatedMinutes);
// 如果当前时间超过预期deadline,计算延误扣分
if (now.isAfter(expectedDeadline)) {
BigDecimal itemScore = item.getTotalScore() != null ? BigDecimal.valueOf(item.getTotalScore()) : BigDecimal.ZERO;
if (itemScore.compareTo(BigDecimal.ZERO) > 0) {
// 计算延误小时数(当前时间 - 预期deadline)
long overdueHours = Duration.between(expectedDeadline, now).toHours();
if (overdueHours > 0) {
// 计算扣分
BigDecimal itemDeduction = itemScore
.multiply(BigDecimal.valueOf(overdueHours))
.multiply(deductionRate)
.divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP);
// 扣分不能超过任务积分
if (itemDeduction.compareTo(itemScore) > 0) {
itemDeduction = itemScore;
}
deductionScore = deductionScore.add(itemDeduction);
}
}
}
}
}
} catch (Exception e) {
log.warn("计算子任务延误扣分失败: {}", e.getMessage());
}
// 添加进度未更新扣分
try {
if (progressDeductionLogMapper != null) {

View File

@ -435,7 +435,7 @@
<a-modal
v-model:open="deductionDetailVisible"
title="扣分明细"
width="800px"
width="1200px"
:footer="null"
wrap-class-name="deduction-detail-modal-wrap"
class="deduction-detail-modal"
@ -1939,6 +1939,28 @@ onMounted(() => {
border-left: none !important;
border-right: none !important;
}
// 修复滚动条样式 - 确保滚动条正常显示
.ant-table-body {
&::-webkit-scrollbar {
width: 8px !important;
height: 8px !important;
}
&::-webkit-scrollbar-track {
background: rgba(255, 255, 255, 0.05) !important;
border-radius: 4px !important;
}
&::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.2) !important;
border-radius: 4px !important;
&:hover {
background: rgba(255, 255, 255, 0.3) !important;
}
}
}
}
.deduction-detail-content {