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>> GetListAsync(PageRequest request) { return await _invokeService.GetListAsync(request); } /// /// 获取客户干系人 /// /// /// [HttpGet, Route("Get")] public async Task> GetAsync([FromQuery] long id) { return await _invokeService.GetAsync(id); } /// /// 创建客户干系人并提交审核 /// /// 客户ID /// [HttpPost, Route("CreateSubmit")] public async Task AddSubmitAsync(long clientId) { var date = DateTime.Now.Date; return await _invokeService.AddSubmitAsync(new InfoClientStakeholder { ClientId = clientId, UserId = long.Parse(_user.UserId), UserName = _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); } /// /// 【批量】创建/更新客户干系人 /// /// 干系人 /// [HttpPost, Route("BulkEdit")] public async Task EditAsync([FromBody] InfoClientStakeholder[] stakeholders) { return await _invokeService.EditAsync(stakeholders); } /// /// 删除干系人 /// /// /// [HttpPost, Route("Delete")] public async Task DeleteAsync(IdModel idModel) { return await _invokeService.DeleteAsync(idModel.Ids); } } }