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.

145 lines
4.7 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using DS.Module.Core;
using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Fee.Interface;
using DS.WMS.Core.Flow.Dtos;
using DS.WMS.Core.TaskPlat.Dtos;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using NLog;
using System.Net;
namespace DS.WMS.FeeApi.Controllers
{
/// <summary>
/// 报销模块相关API
/// </summary>
public class ReimbursementController : ApiController
{
readonly IReimbursementService _service;
private static readonly Logger _logger = LogManager.GetCurrentClassLogger();
/// <summary>
/// 初始化
/// </summary>
/// <param name="service"></param>
public ReimbursementController(IReimbursementService service)
{
_service = service;
}
/// <summary>
/// 获取报销单列表列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost]
[Route("GetReimbursementList")]
public DataResult<List<ReimbursementRes>> GetReimbursementList([FromBody] PageRequest request)
{
var res = _service.GetListByPage(request);
return res;
}
/// <summary>
/// 获取报销单详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
[Route("GetReimbursementInfo")]
public DataResult<GetReimbursementRes> GetReimbursementInfo([FromQuery] string id)
{
var res = _service.GetReimbursementInfo(id);
return res;
}
/// <summary>
/// 新增
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
[Route("AddReimbursement")]
public async Task<DataResult> AddReimbursement([FromBody] ReimbursementReq req)
{
var res =await _service.AddReimbursement(req);
return res;
}
/// <summary>
/// 提交报销单审核
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
[Route("SubmitReimbursement")]
public async Task<DataResult> SubmitReimbursement([FromBody] SubmitReimbursementReq req)
{
var res = await _service.SubmitReimbursement(req);
return res;
}
/// <summary>
/// 未审批的报销单撤销
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
[Route("ReimbursementRevoked")]
public async Task<DataResult> ReimbursementRevoked([FromBody] string id)
{
var res = await _service.ReimbursementRevoked(id);
return res;
}
/// <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 _service.AuditAsync(request);
}
/// <summary>
/// 回调变更申请单审批状态(用于工作流框架的回调)
/// </summary>
/// <param name="callback">回调信息</param>
/// <returns></returns>
[HttpPost, Route("ChangeStatus")]
public async Task<IActionResult> ChangeStatusAsync([FromBody] FlowCallback callback)
{
var str = JsonConvert.SerializeObject(callback);
_logger.Info($"变更申请单审批状态回调,请求参数为:{str}");
await _service.UpdateStatusAsync(callback);
return StatusCode((int)HttpStatusCode.NoContent);
}
/// <summary>
/// 回调通知审批执行人变更(无需客户端手动调用)
/// </summary>
/// <param name="callback">回调信息</param>
/// <returns></returns>
[HttpPost, Route("MarkerChanged")]
public async Task<IActionResult> MarkerChangedAsync([FromBody] MarkerChangedCallback callback)
{
var str = JsonConvert.SerializeObject(callback);
_logger.Info($"通知审批执行人变更回调,请求参数为:{str}");
await _service.MarkerChangedAsync(callback);
return StatusCode((int)HttpStatusCode.NoContent);
}
//9财务银企直连付款接口
//10钉钉开始审核同步到东胜,东胜审核同步到钉钉
//11钉钉配置相关接口
}
}