Bitzsoft.Integrations.Finance.Payroll 1.0.0-alpha.10

This is a prerelease version of Bitzsoft.Integrations.Finance.Payroll.
dotnet add package Bitzsoft.Integrations.Finance.Payroll --version 1.0.0-alpha.10
                    
NuGet\Install-Package Bitzsoft.Integrations.Finance.Payroll -Version 1.0.0-alpha.10
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Bitzsoft.Integrations.Finance.Payroll" Version="1.0.0-alpha.10" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Bitzsoft.Integrations.Finance.Payroll" Version="1.0.0-alpha.10" />
                    
Directory.Packages.props
<PackageReference Include="Bitzsoft.Integrations.Finance.Payroll" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Bitzsoft.Integrations.Finance.Payroll --version 1.0.0-alpha.10
                    
#r "nuget: Bitzsoft.Integrations.Finance.Payroll, 1.0.0-alpha.10"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Bitzsoft.Integrations.Finance.Payroll@1.0.0-alpha.10
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Bitzsoft.Integrations.Finance.Payroll&version=1.0.0-alpha.10&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Bitzsoft.Integrations.Finance.Payroll&version=1.0.0-alpha.10&prerelease
                    
Install as a Cake Tool

Bitzsoft.Integrations.Finance.Payroll

薪酬社保服务抽象层 -- 定义薪资计算、个税计算、薪资代发、社保管理、工资单推送等统一接口与基础模型。

功能特性

  • 一站式薪酬能力:单接口 IPayrollProvider 覆盖薪资计算、个税计算、薪资代发、社保(参保 / 停保 / 申报)、工资单推送五大场景
  • 代发批次模型SalaryDisbursementRequest 支持多员工批次代发,SalaryDisbursementResult 暴露总笔数 / 成功 / 失败计数与 DisbursementStatus 状态机
  • 累计预扣个税TaxCalculationRequest 支持累计收入、专项附加扣除、社保公积金扣除与免征额(默认 5000),返回税率与速算扣除数
  • 社保全周期:参保(EnrollAsync)、停保(SuspendAsync)、申报(DeclareAsync)统一为 SocialInsuranceRequest / Result
  • 能力降级约定:受限于供应商 API,部分操作可能抛 NotSupportedException,调用方按需确认能力
  • 领域异常PayrollException 派生自 FinanceException,统一携带供应商名称与错误码

安装

.NET CLI

dotnet add package Bitzsoft.Integrations.Finance.Payroll

PackageReference

<PackageReference Include="Bitzsoft.Integrations.Finance.Payroll" Version="1.0.0" />

配置

本包为抽象层,不定义 Options 类,不读取配置节。各供应商的配置项由实现包定义。

注册服务

本包为抽象层,ServiceCollectionExtensions 仅作命名空间占位,不提供具体注册方法。具体供应商的注册由实现包或聚合包提供:

// 薪酬社保聚合包(详见聚合包文档)
using Bitzsoft.Integrations.Finance.Payroll.All;

services.AddBitzsoftPayrollAll(configuration);

或直接使用专用集成包,如 Bitzsoft.Integrations.Xft(薪福通)。

使用示例

计算薪资

using Bitzsoft.Integrations.Finance.Payroll.Interfaces;
using Bitzsoft.Integrations.Finance.Payroll.Models;

public class PayrollService
{
    private readonly IPayrollProvider _payroll;

    public PayrollService(IPayrollProvider payroll) => _payroll = payroll;

    public async Task<PayrollCalculationResult> RunAsync(string employeeId, string period)
    {
        var request = new PayrollCalculationRequest
        {
            EmployeeId = employeeId,
            Period = period,                 // 格式 yyyy-MM
            BaseSalary = 10000m,
            PerformanceBonus = 2000m,
            AdditionalItems =
            [
                new() { Name = "交通补贴", Amount = 500m }
            ]
        };

        var result = await _payroll.CalculateAsync(request);
        // result.GrossAmount           -- 应发金额
        // result.NetAmount             -- 实发金额
        // result.TaxAmount             -- 个人所得税额
        // result.SocialInsuranceAmount -- 社保个人部分
        // result.HousingFundAmount     -- 公积金个人部分
        return result;
    }
}

薪资代发并轮询结果

var disburse = await _payroll.DisburseAsync(new SalaryDisbursementRequest
{
    BatchId = "B2026070001",
    Period  = "2026-07",
    Items =
    [
        new() { EmployeeId = "E001", EmployeeName = "张三",
                BankAccount = "6222...", BankName = "工商银行", Amount = 11500m }
    ]
});

// 轮询批次状态
var status = await _payroll.GetDisbursementStatusAsync(disburse.BatchId);
// status.Status       -- DisbursementStatus(Submitted/Processing/Completed/...)
// status.SuccessCount -- 成功笔数

社保参保

await _payroll.EnrollAsync(new SocialInsuranceRequest
{
    EmployeeId     = "E001",
    EmployeeName   = "张三",
    IdCardNumber   = "110...",
    CityCode       = "440100",   // 广州
    BaseAmount     = 8000m,      // 社保基数
    OperationMonth = "202607"    // 格式 yyyyMM
});

核心类型一览

接口(位于 Interfaces/

接口 说明
IPayrollProvider 薪酬社保服务统一抽象接口(薪资 / 个税 / 代发 / 社保 / 工资单)
IPayrollConfigProvider 配置提供者接口(异步获取配置,实现类注册为 Singleton)

IPayrollProvider 方法分组

分组 方法
薪资计算 CalculateAsync / CalculateTaxAsync
薪资代发 DisburseAsync / GetDisbursementStatusAsync
社保管理 EnrollAsync / SuspendAsync / DeclareAsync
工资单 SendPayslipAsync

模型与枚举(位于 Models/

类型 说明
PayrollCalculationRequest 薪资计算请求(EmployeeId / Period / BaseSalary / PerformanceBonus / AdditionalItems)
PayrollCalculationResult 薪资计算结果(GrossAmount / NetAmount / TaxAmount / SocialInsuranceAmount / HousingFundAmount / Deductions)
PayrollItem 薪资项(Name / Amount)
TaxCalculationRequest 个税计算请求(GrossIncome / YearToDateIncome / SpecialDeduction / SocialAndHousingDeduction / Threshold 默认 5000)
TaxCalculationResult 个税计算结果(TaxableIncome / TaxRate / QuickDeduction / TaxAmount)
SalaryDisbursementRequest 薪资代发请求(BatchId / Period / Items)
DisbursementItem 代发明细(EmployeeId / EmployeeName / BankAccount / BankName / Amount)
SalaryDisbursementResult 代发结果(BatchId / Status / TotalCount / SuccessCount / FailedCount)
DisbursementStatus 代发状态枚举(Submitted / Processing / Completed / PartiallyCompleted / Failed)
SocialInsuranceRequest 社保操作请求(EmployeeId / IdCardNumber / CityCode / BaseAmount / OperationMonth)
SocialInsuranceResult 社保操作结果(EmployeeId / Success / Message)
PayslipInfo 工资单信息(GrossAmount / NetAmount / IncomeItems / DeductionItems)
PayrollException 薪酬社保领域异常(继承 FinanceException

依赖

说明
Bitzsoft.Integrations.Finance 财税管理公共基础(FinanceException 基类)

相关包

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Bitzsoft.Integrations.Finance.Payroll:

Package Downloads
Bitzsoft.Integrations.Finance.Payroll.All

薪酬社保服务聚合包 — 包含所有供应商实现

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-alpha.10 32 7/26/2026
1.0.0-alpha.9 60 7/12/2026
1.0.0-alpha.8 63 7/1/2026
1.0.0-alpha.7 81 6/16/2026
1.0.0-alpha.6 73 6/16/2026
1.0.0-alpha.5 70 6/14/2026