Bitzsoft.Integrations.LegalDatabase 1.0.0-alpha.10

This is a prerelease version of Bitzsoft.Integrations.LegalDatabase.
dotnet add package Bitzsoft.Integrations.LegalDatabase --version 1.0.0-alpha.10
                    
NuGet\Install-Package Bitzsoft.Integrations.LegalDatabase -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.LegalDatabase" 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.LegalDatabase" Version="1.0.0-alpha.10" />
                    
Directory.Packages.props
<PackageReference Include="Bitzsoft.Integrations.LegalDatabase" />
                    
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.LegalDatabase --version 1.0.0-alpha.10
                    
#r "nuget: Bitzsoft.Integrations.LegalDatabase, 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.LegalDatabase@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.LegalDatabase&version=1.0.0-alpha.10&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Bitzsoft.Integrations.LegalDatabase&version=1.0.0-alpha.10&prerelease
                    
Install as a Cake Tool

Bitzsoft.Integrations.LegalDatabase

法规案例库统一抽象层 — 通过 ILegalDatabaseProvider 接口屏蔽各供应商差异。

功能特性

  • 统一接口 ILegalDatabaseProvider:屏蔽各法规案例库供应商的差异,一套类型覆盖 SSO 跳转、API 检索、文档详情
  • SsoRedirectLegalDatabaseProvider 适配器:将大部分仅需 SSO 跳转的供应商桥接到 Bitzsoft.Integrations.SsoRedirect 配置驱动管道(URL 模板 / AES 加密 / API 重定向 / 自定义 Pipeline)
  • 功能标志 LegalDatabaseCapabilitiesAccessUrlSearchDocumentDetail,运行时可查询供应商支持哪些能力
  • 统一结果模型LegalDatabaseAccessUrl(Url + ExpiresAt)、LegalSearchResult(分页 + LegalDocument 列表)、LegalDocument(标准化文档)
  • LegalDatabaseResult<T> / LegalDatabaseException:统一封装成功/失败与供应商原始错误码
  • 第三方请求日志:API 调用型供应商接入 Bitzsoft.Integrations.RequestLogging 出站请求记录管道

安装

.NET CLI

dotnet add package Bitzsoft.Integrations.LegalDatabase

PackageReference

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

该包为抽象层,通常无需直接引用 — 安装具体供应商包(如 Bitzsoft.Integrations.LegalDatabase.WkInfo)即会传递依赖。

架构

ILegalDatabaseProvider
    ├── SsoRedirectLegalDatabaseProvider(适配器,配置驱动)
    │       └── 委托给 Bitzsoft.Integrations.SsoRedirect 管道
    │           ├── UrlTemplate 模式(法信 / 聚法 / 无讼 / 把手 / 律商联讯)
    │           ├── AesEncryption 模式(威科先行)
    │           ├── Pipeline 模式(见微数据:RSA → API → MD5)
    │           └── 本地签名(MetaLaw SM3)
    └── 专用 Provider(各供应商包内实现,支持 API 检索)
            ├── PkulawLegalDatabaseProvider(AlphaData / AlphaGPT / REST API)
            ├── YuandianLegalDatabaseProvider(REST API)
            ├── DelilegalLegalDatabaseProvider(AI 智能检索 API)
            └── IncopatLegalDatabaseProvider(专利检索 REST API)

大部分法规案例库供应商仅需 SSO 跳转,通过 SsoRedirectLegalDatabaseProvider 适配器桥接到 SsoRedirect 的配置驱动管道,各供应商包只需十几行 DI 注册代码。少数提供开放 API 的供应商(北大法宝、元典、得理法搜、incoPat)在各自包内实现专用 Provider。

供应商矩阵

供应商 认证模式 API 检索 实现形态
LegalDatabase.WkInfo 威科先行 AES-ECB 加密 SSO 跳转(本地加密,无 HTTP)
LegalDatabase.Faxin 法信 UrlTemplate SSO 跳转(模板拼接)
LegalDatabase.Jufaanli 聚法案例 UrlTemplate SSO 跳转(模板拼接)
LegalDatabase.Wusong 无讼 UrlTemplate SSO 跳转(模板拼接)
LegalDatabase.Lawsdata 把手案例 UrlTemplate SSO 跳转(模板拼接)
LegalDatabase.Lexisnexis 律商联讯 UrlTemplate SSO 跳转(模板拼接)
LegalDatabase.Metalaw MetaLaw SM3 签名 SSO 跳转(本地签名,无 HTTP)
LegalDatabase.Jianwei 见微数据 Pipeline(RSA → API → MD5) SSO 跳转管道(含 HttpClient)
LegalDatabase.Pkulaw 北大法宝 MD5 / RSA / AlphaGPT SSO 跳转 + REST API(含 HttpClient)
LegalDatabase.Yuandian 元典 Token 鉴权 SSO 跳转 + REST API(含 HttpClient)
LegalDatabase.Delilegal 得理法搜 Token 鉴权 SSO 跳转 + AI 检索 API(含 HttpClient)
LegalDatabase.Incopat incoPat MD5 签名 SSO 跳转 + 专利检索 REST API(含 HttpClient)

Jianwei、Pkulaw、Yuandian、Delilegal、Incopat 的 HttpClient 已接入 RequestLogging 出站请求日志。纯跳转型供应商(WkInfo、Faxin、Jufaanli、Wusong、Lawsdata、Lexisnexis、Metalaw)不涉及外部 HTTP 调用。

注册服务

AddBitzsoftSsoRedirectLegalDatabase 用于配置驱动的 SSO 跳转型供应商(UrlTemplate / AesEncryption / ApiRedirect / Pipeline):

using Bitzsoft.Integrations.LegalDatabase;

// 委托配置
builder.Services.AddBitzsoftSsoRedirectLegalDatabase(options =>
{
    options.ProviderName = "法天使";
    options.AuthMode = SsoAuthMode.UrlTemplate;
    options.SsoUrlTemplate = "https://example.com/sso?uid={userId}&token={token}&t={timestamp}";
    options.Token = "your-sso-token";
});

// 从 IConfiguration 绑定(默认节 LegalDatabase:SsoRedirect)
builder.Services.AddBitzsoftSsoRedirectLegalDatabase(
    builder.Configuration.GetSection("LegalDatabase:SsoRedirect"));

各具体供应商通过各自的 AddBitzsoft*LegalDatabase 扩展注册(详见各供应商包 README):

// 单个供应商(委托配置)
builder.Services.AddBitzsoftWkInfoLegalDatabase(options =>
{
    options.AppId = "your-app-id";
    options.AppSecret = "your-app-secret";
});

// 单个供应商(从 IConfiguration 绑定)
builder.Services.AddBitzsoftPkulawLegalDatabase(
    builder.Configuration.GetSection("LegalDatabase:Pkulaw"));

// 一键注册全部 12 家供应商
builder.Services.AddBitzsoftLegalDatabase(builder.Configuration);

使用示例

生成 SSO 访问链接

using Bitzsoft.Integrations.LegalDatabase;

public class LoginService
{
    private readonly ILegalDatabaseProvider _provider;

    public LoginService(ILegalDatabaseProvider provider) => _provider = provider;

    public async Task<string> GetAccessUrlAsync(string userId)
    {
        var access = await _provider.GenerateAccessUrlAsync(userId);
        return access.Url;        // 带 SSO 参数的访问链接
        // access.ExpiresAt;      // 链接过期时间
    }

    // 跳转到指定页面
    public async Task<string> GetAccessUrlAsync(string userId, string targetPage)
    {
        var access = await _provider.GenerateAccessUrlAsync(userId, targetPage);
        return access.Url;
    }
}

API 检索(仅 Search 能力供应商可用)

using Bitzsoft.Integrations.LegalDatabase.Enums;

// 运行时判断供应商是否支持检索
if ((_provider.Capabilities & LegalDatabaseCapabilities.Search) != 0)
{
    var result = await _provider.SearchAsync(
        "合同纠纷", LegalSearchType.Case, pageIndex: 1, pageSize: 20);

    Console.WriteLine($"共 {result.TotalCount} 条");
    foreach (var doc in result.Items)
    {
        Console.WriteLine($"{doc.Id}  {doc.Title}  ({doc.DocumentType})");
    }
}

获取文档详情(仅 DocumentDetail 能力供应商可用)

var doc = await _provider.GetDocumentAsync("DOC-123456");
Console.WriteLine(doc.Title);
Console.WriteLine(doc.Summary);
Console.WriteLine(doc.SourceUrl);

纯跳转型供应商调用 SearchAsync / GetDocumentAsync 会抛出 NotSupportedException

请求审计

API 调用型供应商(Jianwei、Pkulaw、Yuandian、Delilegal、Incopat)的命名 HttpClient 已接入 Bitzsoft.Integrations.RequestLogging 出站请求记录管道,默认使用 NullRequestLogStore 不持久化。宿主注册 IRequestLogStore 实现后,所有出站请求自动落库。

// 持久化:注册 IRequestLogStore 实现后,出站请求自动落库
services.AddRequestLogging<MyRequestLogStore>(opts =>
{
    opts.MaxInMemoryBodyBytes = 64 * 1024; // 仅控制内存/加密临时文件切换,不截断正文
    opts.SensitiveFields.Add("AppSecret");
});

核心类型一览

类型 说明
ILegalDatabaseProvider 法规案例库统一接口(访问链接 / 检索 / 文档详情)
ILegalDatabaseConfigProvider 配置提供器抽象(BaseUrl / HttpClientName / Token)
SsoRedirectLegalDatabaseProvider SSO 跳转型适配器,委托给 SsoRedirect 管道
LegalDatabaseCapabilities 功能标志枚举(AccessUrl / Search / DocumentDetail
LegalSearchType 检索类型(All / Law / Case / Patent / Journal
LegalDatabaseAccessUrl 访问链接结果(Url + ExpiresAt
LegalSearchResult 检索结果(Items + TotalCount + 分页信息)
LegalDocument 标准化法律文档(Id / Title / DocumentType / Summary / RawData
LegalDatabaseResult<T> 通用结果包装(IsSuccess / Data / ErrorCode / ErrorMessage
LegalDatabaseException 统一异常(含 ProviderName / ErrorCode / ProviderMessage
SsoRedirectOptions SSO 跳转配置(AuthMode / SsoUrlTemplate / AesKey / Pipeline 等)
SsoAuthMode 认证模式(UrlTemplate / AesEncryption / ApiRedirect / Pipeline

依赖

说明
Bitzsoft.Integrations.SsoRedirect SSO 跳转配置驱动管道(URL 模板 / AES / API 重定向 / Pipeline)
Bitzsoft.Integrations.Compatibility 基础工具库
Bitzsoft.Integrations.RequestLogging 出站请求记录管道
Microsoft.Extensions.Http IHttpClientFactory(HttpClient 连接池)

相关包

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 (12)

Showing the top 5 NuGet packages that depend on Bitzsoft.Integrations.LegalDatabase:

Package Downloads
Bitzsoft.Integrations.LegalDatabase.Delilegal

得理法搜法规案例库集成 — AI 智能检索与 REST API 接入

Bitzsoft.Integrations.LegalDatabase.Incopat

incoPat 专利数据库集成 — SSO 跳转与 REST API 检索

Bitzsoft.Integrations.LegalDatabase.Metalaw

MetaLaw 法规案例库 SSO 跳转集成 — SM3 签名认证

Bitzsoft.Integrations.LegalDatabase.Lawsdata

把手案例法规案例库 SSO 跳转集成

Bitzsoft.Integrations.LegalDatabase.WkInfo

威科先行(WkInfo)法规案例库 SSO 跳转集成

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-alpha.10 45 7/26/2026
1.0.0-alpha.9 99 7/12/2026
1.0.0-alpha.8 140 7/1/2026
1.0.0-alpha.7 128 6/16/2026
1.0.0-alpha.6 117 6/16/2026
1.0.0-alpha.5 119 6/14/2026
1.0.0-alpha.3 120 6/7/2026