feat(优先级):维度权重可配置并即时重算
- 新表 user_priority_weights(每用户一行,默认 0.35/0.25/0.20/0.10/0.10) - PriorityWeightsService:读取/保存权重,权重和必须为 1,保存后重算全部任务 - TaskController:GET/PUT /tasks/priority-weights - CalculatedPriorityTool 支持自定义权重 - 修复 updateTask 不重算优先级的问题
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
package com.guo.learningprogresstracker.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 用户自定义的任务优先级维度权重(每用户一行,依赖多租户拦截器隔离)
|
||||
*/
|
||||
@TableName(value = "user_priority_weights")
|
||||
@Data
|
||||
public class UserPriorityWeightsEntity extends BaseEntity implements Serializable {
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@TableField(value = "urgency_weight")
|
||||
private Double urgencyWeight;
|
||||
|
||||
@TableField(value = "importance_weight")
|
||||
private Double importanceWeight;
|
||||
|
||||
@TableField(value = "content_difficulty_weight")
|
||||
private Double contentDifficultyWeight;
|
||||
|
||||
@TableField(value = "future_value_weight")
|
||||
private Double futureValueWeight;
|
||||
|
||||
@TableField(value = "subjective_priority_weight")
|
||||
private Double subjectivePriorityWeight;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 系统默认权重 */
|
||||
public static UserPriorityWeightsEntity defaults() {
|
||||
UserPriorityWeightsEntity entity = new UserPriorityWeightsEntity();
|
||||
entity.setUrgencyWeight(0.35);
|
||||
entity.setImportanceWeight(0.25);
|
||||
entity.setContentDifficultyWeight(0.20);
|
||||
entity.setFutureValueWeight(0.10);
|
||||
entity.setSubjectivePriorityWeight(0.10);
|
||||
return entity;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user