完善第三方签署

This commit is contained in:
fuenmao
2026-09-08 17:48:30 +08:00
parent da777327f5
commit c015bc356c
22 changed files with 961 additions and 62 deletions
@@ -103,9 +103,9 @@ public class QiyuesuoClient : IQiyuesuoClient
new
{
type = "COMPANY",
name = "企业自动盖章",
name = "企业人工盖章",
serialNo = 0,
autoSign = true,
autoSign = false,
sealId = input.SealId,
corpSealIds = new[] { sealId },
actionNo = "company_seal"
@@ -185,6 +185,33 @@ public class QiyuesuoClient : IQiyuesuoClient
throw Oops.Bah("契约锁未返回员工签署页面地址");
}
/// <inheritdoc />
public async Task<string> GetViewPageUrl(
QiyuesuoViewPageInput input)
{
var result = await GetJsonElement(
"/v2/contract/viewurl",
new Dictionary<string, string>
{
["contractId"] = input.ContractId,
["documentId"] = input.DocumentId,
["tenantName"] = input.CompanyName,
["downloadButton"] = "false",
["printButton"] = "false"
});
if (result.ValueKind == JsonValueKind.String)
return result.GetString();
if (TryGetString(result, "url", out var url)
|| TryGetString(result, "viewUrl", out url)
|| TryGetString(result, "pageUrl", out url))
{
return url;
}
throw Oops.Bah("契约锁未返回合同浏览页面地址");
}
/// <inheritdoc />
public Task<QiyuesuoContractResult> GetContractDetail(string contractId)
{
@@ -212,14 +239,27 @@ public class QiyuesuoClient : IQiyuesuoClient
}
/// <inheritdoc />
public async Task Invalid(string contractId, string reason)
public async Task CompanySign(QiyuesuoCompanySignInput input)
{
await PostJsonElement(
"/v2/contract/companysign",
new
{
contractId = input.ContractId,
tenantName = input.CompanyName,
sealId = input.SealId
});
}
/// <inheritdoc />
public async Task Invalid(string contractId, string sealId, string reason)
{
await PostJsonElement(
"/v2/contract/invalid",
new
{
contractId,
sealId = _setting.SealId,
sealId,
reason,
deleteDoc = false,
autoSign = true
@@ -318,6 +358,15 @@ public class QiyuesuoClient : IQiyuesuoClient
private async Task<T> GetJson<T>(
string path,
Dictionary<string, string> query)
{
var result = await GetJsonElement(path, query);
return result.Deserialize<T>(JsonOptions)
?? throw Oops.Bah("契约锁返回数据为空");
}
private async Task<JsonElement> GetJsonElement(
string path,
Dictionary<string, string> query)
{
ValidateSettings();
using var request = new HttpRequestMessage(
@@ -328,9 +377,7 @@ public class QiyuesuoClient : IQiyuesuoClient
path,
HttpMethod.Get,
query);
var result = await SendForJsonResult(request);
return result.Deserialize<T>(JsonOptions)
?? throw Oops.Bah("契约锁返回数据为空");
return await SendForJsonResult(request);
}
private async Task<byte[]> Download(