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