Files
jinko.yikatong/Src/Dlhis.ScheduledTask/TaskAssignment/Controllers/HangfireController.cs
2024-07-17 16:48:30 +08:00

56 lines
1.6 KiB
C#

using Dlhis.ScheduledTask.Common.Request;
using Dlhis.ScheduledTask.Common.Services;
using Dlhis.ScheduledTask.TaskAssignment.Request;
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace Dlhis.ScheduledTask.TaskAssignment.Controllers;
/// <summary>
/// 调度任务
/// </summary>
[Authorize(Roles = "admin")]
[Route("api/[controller]")]
[ApiController]
public class HangfireController : ControllerBase
{
private readonly IHangfireService _hangfireService;
private readonly IDbContext _dbContext;
public HangfireController(IHangfireService hangfireService, IDbContext dbContext)
{
_hangfireService = hangfireService;
_dbContext = dbContext;
}
/// <summary>
/// 手动获取人员
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[AllowAnonymous]
[HttpPost("sap/person/no")]
public async Task PersonManuallySync(SapNoRequest request)
{
await _hangfireService.CreateSapPersonSyncBackgroundJobAsync(request);
}
/// <summary>
/// 手动启动人事范围同步
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost("sap/werk/no")]
public async Task WerkManuallySync(SapNoRequest request)
{
await _hangfireService.CreateSapWerkSyncBackgroundJobAsync(request);
}
[AllowAnonymous]
[HttpPost("sap/face")]
public async Task FaceUploadToSapAsync(FaceUploadToSapRequest request)
{
await _hangfireService.FaceUploadToSapAsync(request);
}
}