using DS.Module.Core;
using DS.Module.Core.Data;
using DS.WMS.Core.Application.Dtos;
using DS.WMS.Core.Application.Interface;
using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Flow.Dtos;
using DS.WMS.Core.Op.Entity;
using Microsoft.AspNetCore.Mvc;
namespace DS.WMS.FeeApi.Controllers
{
///
/// 付费申请审核API
///
public class PaymentApplicationAuditController : ApiController
{
readonly IPaymentApplicationAuditService _auditService;
///
/// 初始化
///
///
public PaymentApplicationAuditController(IPaymentApplicationAuditService auditService)
{
_auditService = auditService;
}
///
/// 获取待审核列表
///
///
///
/// 注意!!【审核状态】需要通过 OtherQueryCondition 属性传入,取值范围请参考 AuditStatusForQuery 枚举
[HttpPost, Route("GetList")]
public async Task>> ListAsync([FromBody] PageRequest request)
{
return await _auditService.GetListAsync(request);
}
///
/// 获取申请单明细
///
/// 申请单ID
///
[HttpGet, Route("GetDetails")]
public async Task> GetDetailsAsync([FromQuery] long id)
{
return await _auditService.GetDetailsAsync(id);
}
///
/// 获取业务费用统计
///
/// 业务ID
/// 业务类型
/// 结算对象ID
///
[HttpGet, Route("GetFeeBiz")]
public async Task> GetFeeBizAsync([FromQuery] long id, [FromQuery] BusinessType businessType, [FromQuery] long customerId)
{
return await _auditService.GetFeeBizAsync(id, businessType, customerId);
}
///
/// 获取按票统计
///
/// 业务ID
/// 业务类型
///
[HttpGet, Route("GetStat")]
public async Task> GetStatAsync([FromQuery] long id, [FromQuery] BusinessType businessType)
{
return await _auditService.GetStatAsync(id, businessType);
}
///
/// 按申请单审核
///
///
///
[HttpPost, Route("Audit")]
public async Task AuditAsync([FromBody] AuditRequest request)
{
if (request.Ids.Length == 0 || (request.Result != 1 && request.Result != 2))
return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest);
return await _auditService.AuditAsync(request);
}
///
///一键审核当前登录用户的所有待审核项
///
/// 审批结果: 1=通过 2=驳回
/// 审批备注
///
[HttpPost, Route("OneClickAudit")]
public async Task OneClickAuditAsync(int status, string remark)
{
if (status != 1 && status != 2)
return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest);
return await _auditService.AuditAsync(status, remark);
}
///
/// 将申请单重置为未打印状态
///
/// 申请单ID
///
[HttpPost, Route("SetUnPrinted")]
public async Task SetUnPrinted(IdModel model)
{
if (model.Ids == null || model.Ids.Length == 0)
return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest);
return await _auditService.SetUnPrinted(model.Ids);
}
///
/// 变更申请单审批状态(用于工作流框架的回调)
///
/// 回调信息
///
[HttpPost, Route("ChangeStatus")]
public async Task ChangeStatusAsync([FromBody] FlowCallback callback)
{
if (callback == null)
return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest);
return await _auditService.UpdateStatusAsync(callback);
}
}
}