From 735289a568f42156ff453bc41a619900ce5f8992 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B5=87=E6=96=87=E9=BE=99?= Date: Thu, 10 Oct 2024 10:15:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=80=E6=9D=A5=E5=8D=95=E4=BD=8D=E5=B9=B2?= =?UTF-8?q?=E7=B3=BB=E4=BA=BAAPI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DS.WMS.Core/Fee/Method/FeeCodeService.cs | 12 +- .../DS.WMS.Core/Fee/Method/FeeServiceBase.cs | 2 +- .../Interface/IClientStakeholderService.cs | 31 ++++ .../ClientStakeholderController.cs | 137 ++++++++++++++++++ 4 files changed, 176 insertions(+), 6 deletions(-) create mode 100644 ds-wms-service/DS.WMS.MainApi/Controllers/ClientStakeholderController.cs diff --git a/ds-wms-service/DS.WMS.Core/Fee/Method/FeeCodeService.cs b/ds-wms-service/DS.WMS.Core/Fee/Method/FeeCodeService.cs index 1fa607a2..eebc725e 100644 --- a/ds-wms-service/DS.WMS.Core/Fee/Method/FeeCodeService.cs +++ b/ds-wms-service/DS.WMS.Core/Fee/Method/FeeCodeService.cs @@ -1,20 +1,22 @@ using DS.Module.Core; +using DS.Module.Core.Extensions; using DS.Module.SqlSugar; using DS.Module.UserModule; +using DS.WMS.Core.Code.Dtos; using DS.WMS.Core.Fee.Dtos; using DS.WMS.Core.Fee.Entity; using DS.WMS.Core.Fee.Interface; -using DS.WMS.Core.Sys.Entity; -using Microsoft.Extensions.DependencyInjection; -using SqlSugar; using Mapster; -using DS.Module.Core.Extensions; -using DS.WMS.Core.Code.Dtos; using Microsoft.AspNetCore.Http; +using Microsoft.Extensions.DependencyInjection; using MiniExcelLibs; +using SqlSugar; namespace DS.WMS.Core.Fee.Method { + /// + /// + /// public class FeeCodeService: IFeeCodeService { private readonly IServiceProvider _serviceProvider; diff --git a/ds-wms-service/DS.WMS.Core/Fee/Method/FeeServiceBase.cs b/ds-wms-service/DS.WMS.Core/Fee/Method/FeeServiceBase.cs index 2370f4b6..32840dc1 100644 --- a/ds-wms-service/DS.WMS.Core/Fee/Method/FeeServiceBase.cs +++ b/ds-wms-service/DS.WMS.Core/Fee/Method/FeeServiceBase.cs @@ -205,7 +205,7 @@ namespace DS.WMS.Core.Fee.Method /// protected internal async Task FetchExchangeRateAsync(IEnumerable items) { - var exRecords = items.Where(x => x.Currency != x.LocalCurrency); + var exRecords = items.Where(x => x.Currency != x.LocalCurrency && x.ExchangeRate == null); if (exRecords.Any()) { var exchanges = exRecords.GroupBy(x => new diff --git a/ds-wms-service/DS.WMS.Core/Info/Interface/IClientStakeholderService.cs b/ds-wms-service/DS.WMS.Core/Info/Interface/IClientStakeholderService.cs index 11e3210e..f898787c 100644 --- a/ds-wms-service/DS.WMS.Core/Info/Interface/IClientStakeholderService.cs +++ b/ds-wms-service/DS.WMS.Core/Info/Interface/IClientStakeholderService.cs @@ -1,4 +1,7 @@ using DS.Module.Core; +using DS.Module.Core.Data; +using DS.WMS.Core.Fee.Dtos; +using DS.WMS.Core.Flow.Dtos; using DS.WMS.Core.Info.Entity; namespace DS.WMS.Core.Info.Interface @@ -8,6 +11,34 @@ namespace DS.WMS.Core.Info.Interface /// public interface IClientStakeholderService { + /// + /// 提交审核 + /// + /// + /// + Task SubmitAuditAsync(IdModel idModel); + + /// + /// 执行审核 + /// + /// + /// + Task AuditAsync(AuditRequest request); + + /// + /// 撤销审核 + /// + /// + /// + Task WithdrawAsync(IdModel idModel); + + /// + /// 审核完成回调 + /// + /// 回调信息 + /// + Task AuditCallbackAsync(FlowCallback callback); + /// /// 列表 /// diff --git a/ds-wms-service/DS.WMS.MainApi/Controllers/ClientStakeholderController.cs b/ds-wms-service/DS.WMS.MainApi/Controllers/ClientStakeholderController.cs new file mode 100644 index 00000000..3581d1e3 --- /dev/null +++ b/ds-wms-service/DS.WMS.MainApi/Controllers/ClientStakeholderController.cs @@ -0,0 +1,137 @@ +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); + } + } +}