mahao
1 year ago
8 changed files with 127 additions and 14 deletions
@ -0,0 +1,42 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Authorization; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Microsoft.Extensions.Hosting; |
|||
using Volo.Abp.Application.Services; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs; |
|||
|
|||
/// <summary>
|
|||
/// 手动同步
|
|||
/// </summary>
|
|||
[AllowAnonymous] |
|||
[Route("api/settleaccount/[controller]/[action]")]
|
|||
public class HandSeSyncAppService : ApplicationService |
|||
{ |
|||
private readonly IServiceProvider _applicationServices; |
|||
|
|||
public HandSeSyncAppService(IHost host) |
|||
{ |
|||
_applicationServices = host.Services ?? throw new ArgumentNullException(); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 同步
|
|||
/// </summary>
|
|||
[HttpPost] |
|||
public async Task SyncAsync([FromBody] EnumBusinessType businessType) |
|||
{ |
|||
using var scope = this._applicationServices.CreateScope(); |
|||
JitSeSyncAppService jitSeSyncAppService = businessType switch |
|||
{ |
|||
EnumBusinessType.ZhiGongJianBBAC => scope.ServiceProvider.GetRequiredService<ZhiGongBBACSeSyncAppService>(), |
|||
EnumBusinessType.ZhiGongJianHBPO => scope.ServiceProvider.GetRequiredService<ZhiGongBBACSeSyncAppService>(), |
|||
EnumBusinessType.BeiJian => scope.ServiceProvider.GetRequiredService<BeiSeSyncAppService>(), |
|||
EnumBusinessType.YinDuJian => scope.ServiceProvider.GetRequiredService<YinDuSeSyncAppService>(), |
|||
_ => throw new ArgumentOutOfRangeException(nameof(businessType), $"Not expected direction value: {businessType}"), |
|||
}; |
|||
await jitSeSyncAppService.Invoke(); |
|||
} |
|||
} |
Loading…
Reference in new issue