fix 优化任务领取,任务状态更新

This commit is contained in:
2024-01-14 19:59:38 +08:00
parent 79bc32c959
commit 64c15ad305
9 changed files with 306 additions and 167 deletions

View File

@@ -0,0 +1,54 @@
using Dlhis.ScheduledTask.TaskAssignment.Request;
using Dlhis.ScheduledTask.TaskAssignment.Response;
using Dlhis.ScheduledTask.TaskAssignment.Services;
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>
[HttpGet("devicetasks")]
public async Task<List<DeviceTaskToDeviceByDeviceResponse>> DeviceGetTasksGetAsync([FromQuery] DeviceTaskGetRequest request)
{
return await _assignmentService.DeviceGetTasksAsync(request);
}
/// <summary>
/// 获取设备任务(按设备)
/// </summary>
/// <returns></returns>
[HttpPost("devicetasks")]
public async Task<List<DeviceTaskToDeviceByDeviceResponse>> DeviceGetTasksPostAsync(DeviceTaskGetRequest request)
{
return await _assignmentService.DeviceGetTasksAsync(request);
}
/// <summary>
/// 更新任务状态
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost("taskstatus")]
public async Task UpdateDeviceTaskStatusAsync(UpdateDeviceTaskStatusRequest request)
{
await _assignmentService.UpdateDeviceTaskStatusAsync(request);
}
}