package com.guo.learningprogresstracker.utils; import com.guo.learningprogresstracker.dto.PriorityDto; import com.guo.learningprogresstracker.entity.UserPriorityWeightsEntity; /** * 加权优先级计算工具 */ public class CalculatedPriorityTool { /** * 使用系统默认权重计算加权优先级。 * 急迫性 0.35 / 重要性 0.25 / 内容难度 0.20 / 未来价值 0.10 / 主观优先级 0.10 */ public static Double calculatedPriority(PriorityDto priorityDto) { return calculatedPriority(priorityDto, UserPriorityWeightsEntity.defaults()); } /** * 使用用户自定义权重计算加权优先级。 */ public static Double calculatedPriority(PriorityDto priorityDto, UserPriorityWeightsEntity weights) { return (priorityDto.getUrgency() * weights.getUrgencyWeight()) + (priorityDto.getImportance() * weights.getImportanceWeight()) + (priorityDto.getContentDifficulty() * weights.getContentDifficultyWeight()) + (priorityDto.getFutureValue() * weights.getFutureValueWeight()) + (priorityDto.getSubjectivePriority() * weights.getSubjectivePriorityWeight()); } }