完善第三方签署
This commit is contained in:
@@ -43,6 +43,7 @@ public class OnboardingCompanyService : DbRepository<ObCompany>, IOnboardingComp
|
||||
/// </summary>
|
||||
public async Task Add(OnboardingCompanyAddInput input)
|
||||
{
|
||||
NormalizeAndValidateQiyuesuoConfig(input);
|
||||
await EnsureCodeUnique(input.CompanyCode, 0);
|
||||
await InsertAsync(input.Adapt<ObCompany>());
|
||||
}
|
||||
@@ -52,6 +53,7 @@ public class OnboardingCompanyService : DbRepository<ObCompany>, IOnboardingComp
|
||||
/// </summary>
|
||||
public async Task Edit(OnboardingCompanyEditInput input)
|
||||
{
|
||||
NormalizeAndValidateQiyuesuoConfig(input);
|
||||
await Detail(new BaseIdInput { Id = input.Id });
|
||||
await EnsureCodeUnique(input.CompanyCode, input.Id);
|
||||
await UpdateAsync(input.Adapt<ObCompany>());
|
||||
@@ -98,6 +100,24 @@ public class OnboardingCompanyService : DbRepository<ObCompany>, IOnboardingComp
|
||||
await DeleteByIdsAsync(input.Ids.Cast<object>().ToArray());
|
||||
}
|
||||
|
||||
private static void NormalizeAndValidateQiyuesuoConfig(ObCompany company)
|
||||
{
|
||||
company.QiyuesuoCategoryId = company.QiyuesuoCategoryId?.Trim();
|
||||
company.QiyuesuoSealId = company.QiyuesuoSealId?.Trim();
|
||||
|
||||
var hasCategoryId = !string.IsNullOrWhiteSpace(company.QiyuesuoCategoryId);
|
||||
var hasSealId = !string.IsNullOrWhiteSpace(company.QiyuesuoSealId);
|
||||
if (hasCategoryId != hasSealId)
|
||||
throw Oops.Bah("契约锁默认业务分类 Id 和企业印章 Id 必须同时填写");
|
||||
if (!hasCategoryId)
|
||||
return;
|
||||
if (!long.TryParse(company.QiyuesuoCategoryId, out _)
|
||||
|| !long.TryParse(company.QiyuesuoSealId, out _))
|
||||
{
|
||||
throw Oops.Bah("契约锁默认业务分类 Id 和企业印章 Id 只能填写数字");
|
||||
}
|
||||
}
|
||||
|
||||
private async Task EnsureCodeUnique(string code, long id)
|
||||
{
|
||||
var exists = await Context.Queryable<ObCompany>()
|
||||
|
||||
Reference in New Issue
Block a user