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