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.

133 lines
4.7 KiB
C#

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
{
/// <summary>
/// 付费申请审核API
/// </summary>
public class PaymentApplicationAuditController : ApiController
{
readonly IPaymentApplicationAuditService _auditService;
/// <summary>
/// 初始化
/// </summary>
/// <param name="auditService"></param>
public PaymentApplicationAuditController(IPaymentApplicationAuditService auditService)
{
_auditService = auditService;
}
/// <summary>
/// 获取待审核列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost, Route("GetList")]
public async Task<DataResult<List<PaymentApplicationDto>>> ListAsync([FromBody] PageRequest request)
{
return await _auditService.GetListAsync(request);
}
/// <summary>
/// 获取申请单明细
/// </summary>
/// <param name="id">申请单ID</param>
/// <returns></returns>
[HttpGet, Route("GetDetails")]
public async Task<DataResult<ApplicationSummary>> GetDetailsAsync([FromQuery] long id)
{
return await _auditService.GetDetailsAsync(id);
}
/// <summary>
/// 获取业务费用统计
/// </summary>
/// <param name="id">业务ID</param>
/// <param name="businessType">业务类型</param>
/// <param name="customerId">结算对象ID</param>
/// <returns></returns>
[HttpGet, Route("GetFeeBiz")]
public async Task<DataResult<FeeBiz>> GetFeeBizAsync([FromQuery] long id, [FromQuery] BusinessType businessType, [FromQuery] long customerId)
{
return await _auditService.GetFeeBizAsync(id, businessType, customerId);
}
/// <summary>
/// 获取按票统计
/// </summary>
/// <param name="id">业务ID</param>
/// <param name="businessType">业务类型</param>
/// <returns></returns>
[HttpGet, Route("GetStat")]
public async Task<DataResult<BizFeeStat>> GetStatAsync([FromQuery] long id, [FromQuery] BusinessType businessType)
{
return await _auditService.GetStatAsync(id, businessType);
}
/// <summary>
/// 按申请单审核
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost, Route("Audit")]
public async Task<DataResult> 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);
}
/// <summary>
///一键审核当前登录用户的所有待审核项
/// </summary>
/// <param name="status">审批结果: 1=通过 2=驳回</param>
/// <param name="remark">审批备注</param>
/// <returns></returns>
[HttpPost, Route("OneClickAudit")]
public async Task<DataResult> OneClickAuditAsync(int status, string remark)
{
if (status != 1 && status != 2)
return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest);
return await _auditService.AuditAsync(status, remark);
}
/// <summary>
/// 将申请单重置为未打印状态
/// </summary>
/// <param name="model">申请单ID</param>
/// <returns></returns>
[HttpPost, Route("SetUnPrinted")]
public async Task<DataResult> SetUnPrinted(IdModel model)
{
if (model.Ids == null || model.Ids.Length == 0)
return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest);
return await _auditService.SetUnPrinted(model.Ids);
}
/// <summary>
/// 变更申请单审批状态(用于工作流框架的回调)
/// </summary>
/// <param name="callback">回调信息</param>
/// <returns></returns>
[HttpPost, Route("ChangeStatus")]
public async Task<DataResult> ChangeStatusAsync([FromBody] FlowCallback callback)
{
if (callback == null)
return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest);
return await _auditService.UpdateStatusAsync(callback);
}
}
}