Bitzsoft.Integrations.HumanResources
1.0.2
dotnet add package Bitzsoft.Integrations.HumanResources --version 1.0.2
NuGet\Install-Package Bitzsoft.Integrations.HumanResources -Version 1.0.2
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.HumanResources" Version="1.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Bitzsoft.Integrations.HumanResources" Version="1.0.2" />
<PackageReference Include="Bitzsoft.Integrations.HumanResources" />
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.HumanResources --version 1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Bitzsoft.Integrations.HumanResources, 1.0.2"
#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.HumanResources@1.0.2
#: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.HumanResources&version=1.0.2
#tool nuget:?package=Bitzsoft.Integrations.HumanResources&version=1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Bitzsoft.Integrations.HumanResources
人力资源抽象层 — 统一接口定义、基础模型与结果包装。
屏蔽 Moka、薪人薪事等供应商差异,提供一致的员工、部门与考勤管理 API。
功能特性
- 统一供应商接口
IHumanResourcesService:10 个异步方法覆盖员工、部门与考勤管理全场景 - 统一结果包装:
HrResult、HrAttendanceResult携带成功标志与错误信息 - 统一异常
HumanResourcesException:封装供应商标识、错误码与请求 ID - 统一模型设计:集合返回
List<T>,覆盖员工档案、部门层级与考勤打卡
安装
dotnet add package Bitzsoft.Integrations.HumanResources
<PackageReference Include="Bitzsoft.Integrations.HumanResources" Version="1.0.0" />
接口
IHumanResourcesService
统一的人力资源服务供应商接口。
| 方法 | 返回类型 | 说明 |
|---|---|---|
ProviderName |
string |
供应商标识(如 Moka、Xinrenxinshi) |
CreateEmployeeAsync |
Task<HrEmployee> |
创建员工,返回员工信息 |
GetEmployeeAsync |
Task<HrEmployee> |
查询单个员工 |
UpdateEmployeeAsync |
Task<HrResult> |
更新员工信息 |
DeactivateEmployeeAsync |
Task<HrResult> |
停用员工 |
ListEmployeesAsync |
Task<List<HrEmployee>> |
分页查询员工列表 |
CreateDepartmentAsync |
Task<HrDepartment> |
创建部门,返回部门信息 |
ListDepartmentsAsync |
Task<List<HrDepartment>> |
查询部门列表 |
SubmitAttendanceAsync |
Task<HrAttendanceResult> |
提交考勤记录 |
ListAttendanceRecordsAsync |
Task<List<HrAttendanceRecord>> |
查询员工考勤记录 |
核心模型
| 类 | 关键字段 | 说明 |
|---|---|---|
CreateEmployeeRequest |
Name、Email、Phone、DepartmentId、Position、EmployeeNo、Gender、HireDate |
创建员工请求 |
UpdateEmployeeRequest |
EmployeeId、Name、Email、Phone、DepartmentId、Position |
更新员工请求 |
ListEmployeesRequest |
DepartmentId、Status、Search、PageIndex、PageSize |
员工列表查询参数 |
HrEmployee |
EmployeeId、EmployeeNo、Name、Email、Phone、DepartmentId、DepartmentName、Position、Status、HireDate、Gender、Avatar |
员工信息 |
HrDepartment |
DepartmentId、Name、ParentId、ManagerName、MemberCount |
部门信息 |
CreateDepartmentRequest |
Name、ParentId、ManagerName |
创建部门请求 |
SubmitAttendanceRequest |
EmployeeId、Date、CheckInTime、CheckOutTime |
提交考勤请求 |
HrAttendanceRecord |
RecordId、EmployeeId、Date、CheckInTime、CheckOutTime、Status、WorkHours |
考勤记录 |
HrResult |
Success、ErrorMessage |
员工操作结果 |
HrAttendanceResult |
Success、ErrorMessage |
考勤操作结果 |
HumanResourcesException |
— | 统一异常(继承 IntegrationException) |
枚举
| 枚举 | 说明 |
|---|---|
HrEmployeeStatus |
员工状态:Active / Inactive / OnLeave / Terminated |
HrGender |
性别:Unknown / Male / Female |
HrAttendanceStatus |
考勤状态:Present / Absent / Late / EarlyLeave / Leave |
使用示例
抽象层本身只定义接口与模型,具体实现由各供应商包提供。以下示例假设已注册某个供应商实现:
public class EmployeeService(IHumanResourcesService hr)
{
public async Task<string> OnboardAsync(string name, string email, string deptId)
{
var employee = await hr.CreateEmployeeAsync(new CreateEmployeeRequest
{
Name = name,
Email = email,
DepartmentId = deptId,
Gender = HrGender.Male,
HireDate = DateTimeOffset.UtcNow
});
return employee.EmployeeId;
}
public async Task<List<HrAttendanceRecord>> TimesheetAsync(
string employeeId, DateTimeOffset start, DateTimeOffset end)
=> await hr.ListAttendanceRecordsAsync(employeeId, start, end);
}
多供应商解析
同一应用注册多个供应商时,通过 IIntegrationProviderResolver<IHumanResourcesService> 按供应商 ID 解析:
var resolver = serviceProvider.GetRequiredService<IIntegrationProviderResolver<IHumanResourcesService>>();
var moka = resolver.GetRequired("Moka");
var employee = await moka.CreateEmployeeAsync(request);
依赖
- Bitzsoft.Integrations.Core:公共基座(
IntegrationException、IIntegrationProviderResolver<T>)
相关包
| 供应商 | 包名 |
|---|---|
| 统一抽象 | Bitzsoft.Integrations.HumanResources |
| Moka | Bitzsoft.Integrations.HumanResources.Moka |
| 薪人薪事 | Bitzsoft.Integrations.HumanResources.Xinrenxinshi |
| 聚合包 | Bitzsoft.Integrations.HumanResources.All |
| Product | Versions 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.
-
net10.0
- Bitzsoft.Integrations.Core (>= 1.0.2)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.10)
- Microsoft.Extensions.Options (>= 10.0.10)
-
net5.0
- Bitzsoft.Integrations.Core (>= 1.0.2)
- Microsoft.Extensions.Logging.Abstractions (>= 5.0.0)
- Microsoft.Extensions.Options (>= 5.0.0)
-
net8.0
- Bitzsoft.Integrations.Core (>= 1.0.2)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.10)
- Microsoft.Extensions.Options (>= 10.0.10)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Bitzsoft.Integrations.HumanResources:
| Package | Downloads |
|---|---|
|
Bitzsoft.Integrations.HumanResources.Moka
Moka 人力资源实现 — HTTP Basic Auth(API Key + Secret)鉴权 + HttpClient,实现 IHumanResourcesService 统一接口,支持员工/部门/考勤管理 |
|
|
Bitzsoft.Integrations.HumanResources.Xinrenxinshi
薪人薪事人力资源实现 — API Key + 签名(HMAC-SHA256)鉴权 + HttpClient,实现 IHumanResourcesService 统一接口,支持员工/部门/考勤管理 |
|
|
Bitzsoft.Integrations.HumanResources.All
人力资源服务聚合包 — 包含全部供应商实现(Moka / 薪人薪事) |
GitHub repositories
This package is not used by any popular GitHub repositories.