using DS.Module.Core; using DS.Module.Core.Data; using DS.Module.UserModule; using DS.WMS.Core.Fee.Dtos; using DS.WMS.Core.Flow.Dtos; using DS.WMS.Core.Info.Entity; using DS.WMS.Core.Info.Interface; using Microsoft.AspNetCore.Mvc; namespace DS.WMS.MainApi.Controllers { /// /// 往来单位干系人API /// public class ClientStakeholderController : ApiController { readonly IUser _user; readonly IClientStakeholderService _invokeService; /// /// 构造函数 /// /// /// public ClientStakeholderController(IClientStakeholderService invokeService, IUser user) { _invokeService = invokeService; _user = user; } /// /// 提交审核 /// /// /// [HttpPost, Route("SubmitAudit")] public async Task SubmitAuditAsync([FromBody] IdModel idModel) { if (!ModelState.IsValid) return DataResult.Failed(ModelState.GetErrorMessage()); return await _invokeService.SubmitAuditAsync(idModel); } /// /// 执行审核 /// /// /// [HttpPost, Route("Audit")] public async Task AuditAsync([FromBody] AuditRequest request) { if (!ModelState.IsValid) return DataResult.Failed(ModelState.GetErrorMessage()); return await _invokeService.AuditAsync(request); } /// /// 撤销审核 /// /// /// [HttpPost, Route("Withdraw")] public async Task WithdrawAsync([FromBody] IdModel idModel) { if (!ModelState.IsValid) return DataResult.Failed(ModelState.GetErrorMessage()); return await _invokeService.WithdrawAsync(idModel); } /// /// 审核完成回调 /// /// 回调信息 /// [HttpPost, Route("AuditCallback")] public async Task AuditCallbackAsync([FromBody] FlowCallback callback) { return await _invokeService.AuditCallbackAsync(callback); } /// /// 列表 /// /// /// [HttpPost, Route("GetList")] public async Task>> GetListByPageAsync(PageRequest request) { return await _invokeService.GetListByPageAsync(request); } /// /// 获取客户干系人 /// /// /// [HttpGet, Route("Get")] public async Task> GetAsync([FromQuery] long id) { return await _invokeService.GetAsync(id); } /// /// 新增客户干系人 /// /// 客户ID /// [HttpPost, Route("Create")] public async Task EditAsync(long clientId) { var date = DateTime.Now.Date; return await _invokeService.EditAsync(new InfoClientStakeholder { ClientId = clientId, CreateBy = long.Parse(_user.UserId), CreateByName = _user.UserName, StartDate = date, EndDate = date.AddMonths(4), Status = StakeholderStatus.Uncommitted }); } /// /// 更新客户干系人 /// /// 干系人 /// [HttpPost, Route("Edit")] public async Task EditAsync([FromBody] InfoClientStakeholder stakeholder) { return await _invokeService.EditAsync(stakeholder); } } }