Bitzsoft.Integrations.EkuaiBao
1.0.0-alpha.7
This is a prerelease version of Bitzsoft.Integrations.EkuaiBao.
dotnet add package Bitzsoft.Integrations.EkuaiBao --version 1.0.0-alpha.7
NuGet\Install-Package Bitzsoft.Integrations.EkuaiBao -Version 1.0.0-alpha.7
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.EkuaiBao" Version="1.0.0-alpha.7" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Bitzsoft.Integrations.EkuaiBao" Version="1.0.0-alpha.7" />
<PackageReference Include="Bitzsoft.Integrations.EkuaiBao" />
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.EkuaiBao --version 1.0.0-alpha.7
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Bitzsoft.Integrations.EkuaiBao, 1.0.0-alpha.7"
#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.EkuaiBao@1.0.0-alpha.7
#: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.EkuaiBao&version=1.0.0-alpha.7&prerelease
#tool nuget:?package=Bitzsoft.Integrations.EkuaiBao&version=1.0.0-alpha.7&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Bitzsoft.Integrations.EkuaiBao
合思易快报费控系统集成客户端 — REST API 封装、OAuth Token 自动注入、批量操作分片。
功能特性
- REST API 全覆盖 — 封装 68+ 个端点,涵盖员工、部门、角色、自定义档案、费用报销、供应商、发票、附件、支付管理、借款管理、凭证汇率、审批流等模块
- OAuth Token 自动注入 — 内置
DelegatingHandler自动获取并附加 AccessToken,调用方无需手动管理认证 - 批量操作自动分片 — 超过
BatchSize的批量请求自动拆分执行,遵守合思 API 单次上限 - Resilience Pipeline — 基于
Microsoft.Extensions.Http.Resilience内置标准重试与熔断策略 - Typed Client 模式 — 通过
IHttpClientFactory管理HttpClient生命周期,避免端口耗尽 - DataAnnotations 验证 — 配置选项支持声明式校验,启动时即发现配置错误
- 第三方请求日志 — 内置 RequestLogging DelegatingHandler,记录所有出站 HTTP 请求与响应,便于问题排查
- 自定义 Token 存储 — 通过
IEkuaiBaoTokenProvider抽象 Token 缓存与凭证获取,宿主层自由选择存储方案
安装
dotnet add package Bitzsoft.Integrations.EkuaiBao
<PackageReference Include="Bitzsoft.Integrations.EkuaiBao" Version="*" />
配置
{
"EkuaiBao": {
"BaseUrl": "https://app.ekuaibao.com",
"TimeoutSeconds": 30,
"BatchSize": 190
}
}
| 配置项 | 类型 | 默认值 | 说明 |
|---|---|---|---|
BaseUrl |
string |
https://app.ekuaibao.com |
合思 API 基础地址 |
TimeoutSeconds |
int |
30 |
请求超时秒数(范围 5-300) |
BatchSize |
int |
190 |
批量操作单批上限(范围 1-200),合思 API 限制约 200 条 |
注册服务
using Bitzsoft.Integrations.EkuaiBao;
using Bitzsoft.Integrations.EkuaiBao.DependencyInjection;
// 方式一:使用默认配置
services.AddBitzsoftEkuaiBao();
// 方式二:自定义配置
services.AddBitzsoftEkuaiBao(options =>
{
options.BaseUrl = "https://app.ekuaibao.com";
options.TimeoutSeconds = 60;
options.BatchSize = 100;
});
// 方式三:同时扩展 HttpClient 管道
services.AddBitzsoftEkuaiBao(
configureOptions: options => options.TimeoutSeconds = 60,
configureClient: builder =>
{
builder.AddHttpMessageHandler<MyCustomHandler>();
});
// 必须注册 IEkuaiBaoTokenProvider 实现
services.AddScoped<IEkuaiBaoTokenProvider, MyTokenProvider>();
注意:
AddBitzsoftEkuaiBao会注册IEkuaiBaoClient(Typed Client)和EkuaiBaoOptions(支持 DataAnnotations 验证)。调用前需先注册IEkuaiBaoTokenProvider实现。
IEkuaiBaoTokenProvider
宿主层必须实现此接口以提供 Token 缓存与凭证获取能力:
public interface IEkuaiBaoTokenProvider
{
Task<string?> GetCachedTokenAsync(string tenantId, CancellationToken ct = default);
Task SetTokenAsync(string tenantId, string token, CancellationToken ct = default);
Task<(string AppKey, string AppSecret)> GetCredentialsAsync(string tenantId, CancellationToken ct = default);
string GetCurrentTenantId();
}
第三方请求日志
内置 Bitzsoft.Integrations.RequestLogging 出站请求记录管道,默认使用 NullRequestLogStore 不持久化。
// ① 默认:启用记录管道但不持久化(日志丢弃)
services.AddBitzsoftEkuaiBao(options => { /* ... */ });
// ② 持久化:宿主注册 IRequestLogStore 实现后,所有出站请求自动落库
services.AddRequestLogging<MyRequestLogStore>(opts =>
{
opts.MaxBodyLength = 8192;
opts.SensitiveFields.Add("mySecret");
});
services.AddBitzsoftEkuaiBao(options => { /* ... */ });
使用示例
批量创建员工
using Bitzsoft.Integrations.EkuaiBao;
using Bitzsoft.Integrations.EkuaiBao.Inputs;
public class EmployeeSyncService
{
private readonly IEkuaiBaoClient _client;
public EmployeeSyncService(IEkuaiBaoClient client)
{
_client = client;
}
public async Task SyncEmployeesAsync(CancellationToken ct)
{
// 构建员工列表(超过 BatchSize 时自动分片执行)
var employees = new List<StaffsCreateInput.Staff>
{
new()
{
Name = "张三",
Code = "EMP001",
Cellphone = "13800138001",
Email = "zhangsan@example.com",
DefaultDepartment = " dept-001",
Departments = new List<string> { "dept-001" }
},
new()
{
Name = "李四",
Code = "EMP002",
Cellphone = "13800138002",
Email = "lisi@example.com",
DefaultDepartment = "dept-002",
Departments = new List<string> { "dept-002" }
}
};
// 自动按 BatchSize 分片,无需手动拆分
var result = await _client.BatchCreateStaffsAsync(employees, ct);
Console.WriteLine($"成功创建 {result.Count} 名员工");
}
}
分页查询费用报销单
using Bitzsoft.Integrations.EkuaiBao;
public class ExpenseQueryService
{
private readonly IEkuaiBaoClient _client;
public ExpenseQueryService(IEkuaiBaoClient client)
{
_client = client;
}
public async Task QueryRecentExpensesAsync(CancellationToken ct)
{
var page = 1;
var pageSize = 50;
var offset = EkuaiBaoPaging.ToOffset(page, pageSize);
// 按创建时间倒序查询报销单
var result = await _client.GetApplyListAsync(
start: offset,
count: pageSize,
userId: null,
type: "expense",
orderByCreateTime: true,
ct: ct);
Console.WriteLine($"共 {result.Count} 条报销单,当前页 {result.Items.Count} 条");
// 获取单据详情
if (result.Items.Any())
{
var detail = await _client.GetApplyDetailAsync("flowId-001", ct);
}
}
}
发票验真与 OCR 识别
using Bitzsoft.Integrations.EkuaiBao;
using Bitzsoft.Integrations.EkuaiBao.Inputs;
public class InvoiceService
{
private readonly IEkuaiBaoClient _client;
public InvoiceService(IEkuaiBaoClient client)
{
_client = client;
}
public async Task ValidateAndOcrAsync(CancellationToken ct)
{
// 发票 OCR 识别
var ocrResult = await _client.RecognizeInvoiceOcrAsync(
"https://example.com/invoice.pdf", ct);
// 发票验真
var validateResult = await _client.ValidateInvoiceAsync(
new InvoiceValidateInput
{
// 填入验真参数
},
ct);
}
}
审批单据
using Bitzsoft.Integrations.EkuaiBao;
using Bitzsoft.Integrations.EkuaiBao.Inputs;
public class ApprovalService
{
private readonly IEkuaiBaoClient _client;
public ApprovalService(IEkuaiBaoClient client)
{
_client = client;
}
public async Task ApproveAsync(string flowId, CancellationToken ct)
{
// 审批通过
var result = await _client.ApproveFlowsAsync(
flowIds: flowId,
input: new FlowApprovalInput
{
// 填入审批参数
},
ct: ct);
}
}
API 一览
| 模块 | 方法 | 说明 |
|---|---|---|
| 员工管理 | GetStaffsAsync |
分页查询员工列表 |
BatchCreateStaffsAsync |
批量创建员工(自动分片) | |
UpdateStaffStatusAsync |
启用/禁用员工 | |
GetAuthorizedStaffsAsync |
获取已激活账号 | |
UpdateStaffAsync |
修改员工信息 | |
RelayStaffAsync |
员工离职交接 | |
| 部门管理 | GetDepartmentsAsync |
分页获取部门列表 |
BatchCreateDepartmentsAsync |
批量创建部门(自动分片) | |
GetDepartmentByPathAsync |
按路径查询部门 | |
| 角色管理 | GetRolesAsync |
获取角色列表 |
CreateRoleAsync |
创建角色 | |
| 自定义档案 | GetDimensionsAsync |
分页获取档案项 |
GetDimensionsCategoryListAsync |
获取档案类别列表 | |
AddDimensionAsync |
添加单个档案项 | |
BatchAddDimensionsAsync |
批量添加档案项(自动分片) | |
UpdateDimensionAsync |
更新档案项 | |
SetDimensionStatusAsync |
启用/禁用档案项 | |
| 档案关联 | AddRecordLinkAsync |
批量添加档案关联 |
DeleteRecordLinkAsync |
删除档案关联 | |
GetDimensionRelationsAsync |
查询关联关系 | |
| 费用报销 | GetApplyListAsync |
分页查询报销单 |
GetApplyDetailAsync |
获取单据详情 | |
GetSpecificationsAsync |
获取单据模板 | |
GetFeeTypesAsync |
获取费用类型 | |
| 供应商 | GetSuppliersAsync |
分页获取供应商 |
GetPayeeInfosAsync |
获取供应商收款账号 | |
| 发票 | SearchInvoiceDetailsAsync |
搜索发票信息 |
GetInvoiceDetailAsync |
获取发票详情 | |
GetInvoiceImagesAsync |
获取发票图片 URL | |
RecognizeInvoiceOcrAsync |
发票 OCR 识别 | |
ValidateInvoiceAsync |
发票验真 | |
BatchValidateInvoicesAsync |
批量发票验真 | |
DownloadInvoiceFilesAsync |
下载发票原件 | |
| 附件 | UploadAttachmentAsync |
上传附件(最大 30MB) |
GetAttachmentsAsync |
获取附件下载地址 | |
| 支付管理 | GetFlowByPaymentBatchAsync |
按支付批次号查询 |
SubmitPaymentResultsAsync |
提交支付结果 | |
| 借款管理 | GetLoanInfoByFlowIdAsync |
按单据 ID 获取借款信息 |
GetRepaymentRecordAsync |
获取还款记录 | |
| 凭证与汇率 | WriteBackVoucherAsync |
回写凭证信息 |
UpdateCurrencyRateAsync |
更新币种汇率 | |
GetCurrenciesAsync |
获取已启用币种 | |
| 付款账户 | SearchPayerAccountsAsync |
搜索付款账户 |
CreatePayerAccountAsync |
创建付款账户 | |
GetReceiptDownloadLinksAsync |
获取回单下载链接 | |
| 收款账户 | CreatePayeeInfoAsync |
创建收款账户 |
BatchCreatePayeeInfoAsync |
批量创建收款账户 | |
| 审批流 | ApproveFlowsAsync |
审批通过/拒绝/作废 |
ExecuteFlowActionAsync |
执行单据动作 | |
HangUpFlowsAsync |
暂挂单据 | |
CommentFlowAsync |
评论单据 | |
| 单据创建 | CreateAndSaveFlowAsync |
创建并保存单据 |
SubmitFlowAsync |
提交草稿审批 | |
UpdateFlowFormAsync |
更新单据表单 |
相关包
- Bitzsoft.Integrations.TencentCcc — 腾讯云呼叫中心集成客户端
- Bitzsoft.Integrations.Beisen — 北森 HRP 系统集成客户端
- Bitzsoft.Integrations.All — 全部集成包聚合引用
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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.RequestLogging (>= 1.0.0-alpha.7)
- Microsoft.Extensions.Http.Resilience (>= 10.7.0)
- Microsoft.Extensions.Options (>= 10.0.9)
- Microsoft.Extensions.Options.DataAnnotations (>= 10.0.9)
-
net8.0
- Bitzsoft.Integrations.RequestLogging (>= 1.0.0-alpha.7)
- Microsoft.Extensions.Http.Resilience (>= 10.7.0)
- Microsoft.Extensions.Options (>= 10.0.9)
- Microsoft.Extensions.Options.DataAnnotations (>= 10.0.9)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Bitzsoft.Integrations.EkuaiBao:
| Package | Downloads |
|---|---|
|
Bitzsoft.Integrations.All
Bitzsoft 第三方集成聚合包 — 包含全部 Integration 模块 |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0-alpha.7 | 53 | 6/16/2026 |
| 1.0.0-alpha.6 | 62 | 6/16/2026 |
| 1.0.0-alpha.5 | 51 | 6/14/2026 |
| 1.0.0-alpha.3 | 49 | 6/7/2026 |
| 1.0.0-alpha.2 | 57 | 5/29/2026 |
| 1.0.0-alpha.1 | 56 | 5/28/2026 |