using System.Collections.Generic; using System.Linq; namespace NPP.SmartSchedue.Api.Services.Integration.Models { /// /// 任务-人员匹配矩阵类 /// public class TaskPersonnelMatrix { /// /// 匹配评分字典 (任务ID -> 人员ID -> 评分) /// public Dictionary> MatchScores { get; set; } = new Dictionary>(); /// /// 设置评分 /// /// 任务ID /// 人员ID /// 评分 public void SetScore(long taskId, long personnelId, double score) { if (!MatchScores.ContainsKey(taskId)) MatchScores[taskId] = new Dictionary(); MatchScores[taskId][personnelId] = score; } /// /// 获取评分 /// /// 任务ID /// 人员ID /// 评分值 public double GetScore(long taskId, long personnelId) { return MatchScores.ContainsKey(taskId) && MatchScores[taskId].ContainsKey(personnelId) ? MatchScores[taskId][personnelId] : 0; } /// /// 获取所有人员ID /// /// 人员ID列表 public List GetAllPersonnelIds() { return MatchScores.SelectMany(kvp => kvp.Value.Keys).Distinct().ToList(); } } }