You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

109 lines
3.6 KiB
C#

using System.Net;
using DS.Module.Core;
using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Flow.Dtos;
using DS.WMS.Core.Op.Dtos.TaskInteraction;
using DS.WMS.Core.Op.Entity;
using DS.WMS.Core.Op.Interface.TaskInteraction;
using Microsoft.AspNetCore.Mvc;
namespace DS.WMS.OpApi.Controllers
{
/// <summary>
/// 海运出口任务API
/// </summary>
public class SeaExportTaskController : ApiController
{
readonly ISeaExportTaskService taskService;
/// <summary>
/// 构造函数
/// </summary>
/// <param name="service"></param>
public SeaExportTaskController(ISeaExportTaskService service)
{
taskService = service;
}
/// <summary>
/// 获取指定业务的关联任务
/// </summary>
/// <param name="businessId">业务ID</param>
/// <param name="businessType">业务类型</param>
/// <returns></returns>
[HttpGet, Route("GetList")]
public async Task<DataResult<List<BusinessTaskDto>>> GetListAsync([FromQuery]long businessId, [FromQuery] BusinessType businessType)
{
return await taskService.GetTasks(businessId, businessType);
}
/// <summary>
/// 创建关联任务
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost, Route("CreateTask")]
public async Task<DataResult> CreateTaskAsync([FromBody] TaskCreationRequest request)
{
return await taskService.CreateTaskAsync(request);
}
/// <summary>
/// 设置任务状态
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost, Route("SetTaskStatus")]
public async Task<DataResult> SetTaskStatusAsync([FromBody] TaskUpdateRequest request)
{
return await taskService.SetTaskStatusAsync(request);
}
/// <summary>
/// 手动发起任务审核(用于二次审核)
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost, Route("SubmitAudit")]
public async Task<DataResult> SubmitAuditAsync(TaskRequest request)
{
return await taskService.SubmitAuditAsync(request);
}
/// <summary>
/// 任务审核
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost, Route("Audit")]
public async virtual Task<DataResult> AuditAsync([FromBody] AuditRequest request)
{
return await taskService.AuditAsync(request);
}
/// <summary>
/// 审批完成回调更新(无需客户端手动调用)
/// </summary>
/// <param name="callback">回调信息</param>
/// <returns></returns>
[HttpPost, Route("UpdateBusiness")]
public async Task<IActionResult> UpdateBusinessAsync([FromBody] FlowCallback callback)
{
await taskService.UpdateBusinessAsync(callback);
return StatusCode((int)HttpStatusCode.NoContent);
}
/// <summary>
/// 通知审批执行人变更(无需客户端手动调用)
/// </summary>
/// <param name="callback">回调信息</param>
/// <returns></returns>
[HttpPost, Route("MarkerChanged")]
public virtual async Task<IActionResult> MarkerChangedAsync([FromBody] MarkerChangedCallback callback)
{
await taskService.MarkerChangedAsync(callback);
return StatusCode((int)HttpStatusCode.NoContent);
}
}
}