using MilitaryTrainingManagement.Models.Entities;
using MilitaryTrainingManagement.Models.Enums;
namespace MilitaryTrainingManagement.Services.Interfaces;
///
/// 人员管理服务接口
///
public interface IPersonnelService
{
Task GetByIdAsync(int id);
Task> GetByUnitAsync(int unitId, bool includeSubordinates = false);
Task CreateAsync(Personnel personnel);
Task UpdateAsync(Personnel personnel);
Task ApproveAsync(int personnelId, int approvedByUnitId, PersonnelLevel? level = null);
Task RejectAsync(int personnelId, int reviewedByUserId, int reviewedByUnitId, string? comments = null);
Task DeleteAsync(int id);
///
/// 提交人员数据(包含文件上传和验证)
///
Task SubmitPersonnelAsync(Personnel personnel, IFormFile? photo, IFormFile? supportingDocument);
///
/// 验证人员数据完整性
///
Task ValidatePersonnelDataAsync(Personnel personnel);
///
/// 获取审批路由的目标组织单位
///
Task GetApprovalTargetUnitAsync(int submittingUnitId);
///
/// 检查人员是否可以修改(未被审批)
///
Task CanModifyPersonnelAsync(int personnelId);
///
/// 请求修改已审批的人员记录
///
Task RequestPersonnelModificationAsync(int personnelId, int requestedByUserId, string reason, Personnel modifiedPersonnel);
///
/// 根据组织层级获取可见的人员列表
///
Task> GetVisiblePersonnelAsync(int unitId, OrganizationalLevel userLevel);
///
/// 实现跨层级人员转移
///
Task TransferPersonnelAsync(int personnelId, int targetUnitId, int approvedByUnitId);
///
/// 获取待审批的人员列表
///
Task> GetPendingApprovalPersonnelAsync(int unitId);
///
/// 批量审批人员
///
Task> BatchApprovePersonnelAsync(int[] personnelIds, int approvedByUnitId, PersonnelLevel level);
///
/// 批量拒绝人员
///
Task> BatchRejectPersonnelAsync(int[] personnelIds, int reviewedByUserId, int reviewedByUnitId, string reason);
///
/// 获取人员审批历史
///
Task> GetPersonnelApprovalHistoryAsync(int personnelId);
///
/// 验证审批权限
///
Task CanApprovePersonnelAsync(int userId, int personnelId);
///
/// 发起向上申报请求
///
Task RequestUpgradeAsync(int personnelId, int requestByUnitId);
///
/// 审批向上申报请求
///
Task ApproveUpgradeAsync(int personnelId, int approvedByUnitId);
///
/// 拒绝向上申报请求
///
Task RejectUpgradeAsync(int personnelId, int rejectedByUnitId, string comments);
///
/// 师部直接升级团级人才为师级
///
Task DirectUpgradeAsync(int personnelId, int divisionUnitId);
}
///
/// 人员验证结果
///
public class PersonnelValidationResult
{
public bool IsValid { get; set; }
public List Errors { get; set; } = new();
public static PersonnelValidationResult Success() => new() { IsValid = true };
public static PersonnelValidationResult Failure(params string[] errors) => new()
{
IsValid = false,
Errors = errors.ToList()
};
}