ISalaryCalculationService.cs 4.45 KB
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using LqSalaryCalculationService.Models;

namespace LqSalaryCalculationService.Services
{
    /// <summary>
    /// 工资核算服务接口
    /// </summary>
    public interface ISalaryCalculationService
    {
        /// <summary>
        /// 初始化用户信息到工资表
        /// </summary>
        /// <param name="calculationMonth">计算月份 (格式: yyyy-MM)</param>
        /// <returns>初始化结果</returns>
        Task<UserInfoInitResult> InitializeUserInfoAsync(string calculationMonth);

        /// <summary>
        /// 执行工资核算
        /// </summary>
        /// <param name="calculationMonth">计算月份 (格式: yyyy-MM)</param>
        /// <returns>核算结果</returns>
        Task<SalaryCalculationResult> CalculateSalaryAsync(string calculationMonth);

        /// <summary>
        /// 获取员工业绩数据
        /// </summary>
        /// <param name="calculationMonth">计算月份</param>
        /// <returns>员工业绩列表</returns>
        Task<List<EmployeePerformance>> GetEmployeePerformanceAsync(string calculationMonth);

        /// <summary>
        /// 计算健康师工资
        /// </summary>
        /// <param name="performance">业绩数据</param>
        /// <returns>工资计算结果</returns>
        Task<EmployeeSalary> CalculateHealthWorkerSalaryAsync(EmployeePerformance performance);

        /// <summary>
        /// 计算金三角提成
        /// </summary>
        /// <param name="teamPerformance">团队业绩</param>
        /// <param name="memberCount">团队成员数</param>
        /// <returns>提成比例</returns>
        decimal CalculateTeamCommissionRate(decimal teamPerformance, int memberCount);

        /// <summary>
        /// 计算门店管理员工资
        /// </summary>
        /// <param name="performance">业绩数据</param>
        /// <returns>工资计算结果</returns>
        Task<EmployeeSalary> CalculateManagerSalaryAsync(EmployeePerformance performance);

        /// <summary>
        /// 导出工资报表
        /// </summary>
        /// <param name="salaries">工资列表</param>
        /// <param name="outputPath">输出路径</param>
        /// <returns>导出文件路径</returns>
        Task<string> ExportSalaryReportAsync(List<EmployeeSalary> salaries, string outputPath);

        /// <summary>
        /// 发送邮件通知
        /// </summary>
        /// <param name="result">核算结果</param>
        /// <returns>发送结果</returns>
        Task<bool> SendEmailNotificationAsync(SalaryCalculationResult result);
    }

    /// <summary>
    /// 员工业绩数据模型
    /// </summary>
    public class EmployeePerformance
    {
        public string EmployeeId { get; set; } = string.Empty;
        public string EmployeeName { get; set; } = string.Empty;
        public string StoreId { get; set; } = string.Empty;
        public string StoreName { get; set; } = string.Empty;
        public string Position { get; set; } = string.Empty;
        public string PositionCategory { get; set; } = string.Empty;
        public decimal TotalPerformance { get; set; }
        public decimal ConsumptionPerformance { get; set; }
        public int ProjectCount { get; set; }
        public int CustomerCount { get; set; }
        public decimal TeamPerformance { get; set; }
        public bool IsNewStore { get; set; }
        public decimal StoreLifeLine { get; set; }
        public string TeamId { get; set; } = string.Empty;
        public int TeamMemberCount { get; set; }
    }

    /// <summary>
    /// 工资核算结果
    /// </summary>
    public class SalaryCalculationResult
    {
        public bool Success { get; set; }
        public string Message { get; set; } = string.Empty;
        public List<EmployeeSalary> Salaries { get; set; } = new List<EmployeeSalary>();
        public string OutputFilePath { get; set; } = string.Empty;
        public DateTime CalculationTime { get; set; } = DateTime.Now;
        public string CalculationMonth { get; set; } = string.Empty;
    }

    /// <summary>
    /// 用户信息初始化结果
    /// </summary>
    public class UserInfoInitResult
    {
        public bool Success { get; set; }
        public string Message { get; set; } = string.Empty;
        public int UserCount { get; set; }
        public DateTime InitTime { get; set; } = DateTime.Now;
        public string CalculationMonth { get; set; } = string.Empty;
    }
}