Files
jinko.yikatong/Src/Dlhis.ScheduledTask/TaskAssignment/Controllers/AssignmentsController.cs
2024-07-31 17:01:47 +08:00

62 lines
1.8 KiB
C#

using Dlhis.ScheduledTask.TaskAssignment.Request;
using Dlhis.ScheduledTask.TaskAssignment.Response;
using Dlhis.ScheduledTask.TaskAssignment.Services;
using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
using Kurisu.AspNetCore.UnifyResultAndValidation.Aop;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace Dlhis.ScheduledTask.TaskAssignment.Controllers;
/// <summary>
/// 任务分配
/// </summary>
[Authorize]
[Route("api/[controller]")]
[ApiController]
public class AssignmentsController : ControllerBase
{
private readonly IAssignmentService _assignmentService;
public AssignmentsController(IAssignmentService assignmentService)
{
_assignmentService = assignmentService;
}
/// <summary>
/// 获取设备任务(按设备)
/// </summary>
/// <returns></returns>
[DisableApiLog]
[IgnoreTenant]
[HttpGet("deviceTasks")]
public async Task<List<DeviceTaskToDeviceByDeviceResponse>> DeviceGetTasksGetAsync([FromQuery] DeviceTaskGetRequest request)
{
return await _assignmentService.DeviceGetTasksAsync(request);
}
/// <summary>
/// 获取设备任务(按设备)
/// </summary>
/// <returns></returns>
[DisableApiLog]
[HttpPost("deviceTasks")]
[IgnoreTenant]
public async Task<List<DeviceTaskToDeviceByDeviceResponse>> DeviceGetTasksPostAsync(DeviceTaskGetRequest request)
{
return await _assignmentService.DeviceGetTasksAsync(request);
}
/// <summary>
/// 更新任务状态
/// </summary>
/// <param name="requests"></param>
/// <returns></returns>
[DisableApiLog]
[HttpPost("taskStatus")]
[IgnoreTenant]
public async Task UpdateDeviceTaskStatusAsync(List<UpdateDeviceTaskStatusRequest> requests)
{
await _assignmentService.UpdateDeviceTaskStatusAsync(requests);
}
}