From 9a6773f49a29533e966794618e38427aec2576f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B5=87=E6=96=87=E9=BE=99?= Date: Tue, 23 Jul 2024 17:06:36 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=8F=91=E7=A5=A8=E6=98=8E=E7=BB=86?= =?UTF-8?q?=E6=80=BB=E9=87=91=E9=A2=9D=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Application/Method/InvoiceApplicationService.cs | 3 ++- ds-wms-service/DS.WMS.Core/Invoice/Method/ApiFox.cs | 5 ++++- .../DS.WMS.Core/Invoice/Method/InvoiceIssuanceService.cs | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ds-wms-service/DS.WMS.Core/Application/Method/InvoiceApplicationService.cs b/ds-wms-service/DS.WMS.Core/Application/Method/InvoiceApplicationService.cs index 34989896..00e23034 100644 --- a/ds-wms-service/DS.WMS.Core/Application/Method/InvoiceApplicationService.cs +++ b/ds-wms-service/DS.WMS.Core/Application/Method/InvoiceApplicationService.cs @@ -555,12 +555,13 @@ namespace DS.WMS.Core.Application.Method ApplicationId = application.Id, Name = item.Name, TaxRate = application.TaxRate, + Quantity = 1, TaxUnitPrice = application.Details.FindAll(x => item.FeeIds.Contains(x.FeeId)).Sum(x => x.ApplyAmount), Category = DetailCategory.InvoiceApplication }; invDetail.TaxAmount = invDetail.TaxUnitPrice * application.TaxRate; invDetail.UnitPrice = invDetail.TaxUnitPrice - invDetail.TaxAmount; - + invDetail.Amount = invDetail.TaxUnitPrice * invDetail.Quantity; application.InvoiceDetails.Add(invDetail); } } diff --git a/ds-wms-service/DS.WMS.Core/Invoice/Method/ApiFox.cs b/ds-wms-service/DS.WMS.Core/Invoice/Method/ApiFox.cs index 7e2b4bce..6218840b 100644 --- a/ds-wms-service/DS.WMS.Core/Invoice/Method/ApiFox.cs +++ b/ds-wms-service/DS.WMS.Core/Invoice/Method/ApiFox.cs @@ -8,6 +8,9 @@ using Newtonsoft.Json; namespace DS.WMS.Core.Invoice.Method { + /// + /// 提供对HTTP请求的低级别访问 + /// internal class ApiFox { /// @@ -93,7 +96,7 @@ namespace DS.WMS.Core.Invoice.Method /// /// 请求结果的类型 /// 请求Url - /// 查询字符串的键值对 + /// 请求参数对象 /// /// 为null或空字符串 public async Task> PostAsync(string url, object? requestParams = null) diff --git a/ds-wms-service/DS.WMS.Core/Invoice/Method/InvoiceIssuanceService.cs b/ds-wms-service/DS.WMS.Core/Invoice/Method/InvoiceIssuanceService.cs index af6b19b1..272695f5 100644 --- a/ds-wms-service/DS.WMS.Core/Invoice/Method/InvoiceIssuanceService.cs +++ b/ds-wms-service/DS.WMS.Core/Invoice/Method/InvoiceIssuanceService.cs @@ -70,6 +70,7 @@ namespace DS.WMS.Core.Invoice.Method goodsCode = "", //商品和服务税收分类合并编码 invoiceLineProperty = "00" }).ToList() + }).ToList(); var result = await api.PostAsync>("/api/Invoice/services", request); From c1bee4dfee4b70ce00b8a37f2cbe9f53db5f58ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B5=87=E6=96=87=E9=BE=99?= Date: Tue, 23 Jul 2024 17:40:09 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=8F=91=E7=A5=A8=E7=94=B3=E8=AF=B7?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=A2=9E=E5=8A=A0=E5=90=88=E8=AE=A1=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ds-wms-service/DS.Module.Core/Data/DataResult.cs | 5 +++++ .../Application/Method/InvoiceApplicationService.cs | 10 ++++++++-- ds-wms-service/DS.WMS.FeeApi/Logs/internal-nlog.txt | 7 +++++++ .../PublishProfiles/FolderProfile1.pubxml.user | 2 +- 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/ds-wms-service/DS.Module.Core/Data/DataResult.cs b/ds-wms-service/DS.Module.Core/Data/DataResult.cs index 1bb9590a..f1a57846 100644 --- a/ds-wms-service/DS.Module.Core/Data/DataResult.cs +++ b/ds-wms-service/DS.Module.Core/Data/DataResult.cs @@ -266,6 +266,11 @@ public class DataResult : IDataResult public TData Data { get; set; } + /// + /// 附加数据 + /// + public Dictionary? AdditionalData { get; set; } + /// /// 返回成功的结果 /// diff --git a/ds-wms-service/DS.WMS.Core/Application/Method/InvoiceApplicationService.cs b/ds-wms-service/DS.WMS.Core/Application/Method/InvoiceApplicationService.cs index 00e23034..8865dfe9 100644 --- a/ds-wms-service/DS.WMS.Core/Application/Method/InvoiceApplicationService.cs +++ b/ds-wms-service/DS.WMS.Core/Application/Method/InvoiceApplicationService.cs @@ -80,6 +80,12 @@ namespace DS.WMS.Core.Application.Method { item.CreateByName = users.Find(x => x.Id == item.CreateBy)?.UserName; } + + result.AdditionalData = new Dictionary + { + { "ApplyAmountSum", result.Data.Sum(x => x.ApplyAmount) }, + { "InvoiceAmountSum", result.Data.Sum(x => x.InvoiceAmount.GetValueOrDefault()) } + }; } return result; @@ -392,7 +398,7 @@ namespace DS.WMS.Core.Application.Method /// /// 发票明细ID /// - public async Task DeleteInvoiceDetailAsync(params long[] ids) + public async Task DeleteInvoiceDetailAsync(params long[] ids) { int rows = await TenantDb.Deleteable().Where(x => ids.Contains(x.Id)).ExecuteCommandAsync(); return rows > 0 ? DataResult.Success : DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed)); @@ -622,7 +628,7 @@ namespace DS.WMS.Core.Application.Method x.AmountUppercase }).ExecuteCommandAsync(); } - + } diff --git a/ds-wms-service/DS.WMS.FeeApi/Logs/internal-nlog.txt b/ds-wms-service/DS.WMS.FeeApi/Logs/internal-nlog.txt index 6588c064..57a0523b 100644 --- a/ds-wms-service/DS.WMS.FeeApi/Logs/internal-nlog.txt +++ b/ds-wms-service/DS.WMS.FeeApi/Logs/internal-nlog.txt @@ -3120,3 +3120,10 @@ 2024-07-22 08:57:09.9055 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config 2024-07-22 08:57:09.9055 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile 2024-07-22 08:57:09.9319 Info Configuration initialized. +2024-07-23 17:37:40.2936 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-23 17:37:40.3330 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-23 17:37:40.3386 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-23 17:37:40.3551 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-23 17:37:40.3551 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config +2024-07-23 17:37:40.3551 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-23 17:37:40.3714 Info Configuration initialized. diff --git a/ds-wms-service/DS.WMS.FeeApi/Properties/PublishProfiles/FolderProfile1.pubxml.user b/ds-wms-service/DS.WMS.FeeApi/Properties/PublishProfiles/FolderProfile1.pubxml.user index 82d1a4c9..68366bf1 100644 --- a/ds-wms-service/DS.WMS.FeeApi/Properties/PublishProfiles/FolderProfile1.pubxml.user +++ b/ds-wms-service/DS.WMS.FeeApi/Properties/PublishProfiles/FolderProfile1.pubxml.user @@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. <_PublishTargetUrl>D:\Publish\DS8\FeeApi - True|2024-07-22T00:59:23.3235603Z||;True|2024-07-12T17:35:11.1225017+08:00||;True|2024-07-11T11:40:17.3581147+08:00||;True|2024-07-04T17:20:50.0175739+08:00||;True|2024-07-02T11:26:14.2092751+08:00||;True|2024-07-02T09:21:51.3513605+08:00||;True|2024-07-01T17:47:56.0407256+08:00||;True|2024-07-01T16:42:55.7374984+08:00||;True|2024-07-01T15:49:58.9266967+08:00||;True|2024-07-01T14:35:48.1117178+08:00||;True|2024-07-01T11:41:52.2969338+08:00||;True|2024-07-01T11:13:02.6561160+08:00||;True|2024-06-28T15:28:43.1470725+08:00||;True|2024-06-28T15:16:20.1999596+08:00||;True|2024-06-28T15:14:56.2534743+08:00||;True|2024-06-28T15:02:41.3033806+08:00||;True|2024-06-28T13:37:28.2462742+08:00||;True|2024-06-28T11:06:30.7400535+08:00||;True|2024-06-26T15:24:17.1939896+08:00||;True|2024-06-26T14:33:06.3530466+08:00||;True|2024-06-26T09:45:24.4055568+08:00||;True|2024-06-25T15:45:57.6052473+08:00||;True|2024-06-25T10:17:17.7408916+08:00||;False|2024-06-25T10:16:23.5639654+08:00||;False|2024-06-25T10:15:28.3857721+08:00||;False|2024-06-25T10:10:59.5536995+08:00||;False|2024-06-25T10:07:10.4050937+08:00||;True|2024-06-24T15:22:18.2672769+08:00||;True|2024-06-24T15:01:04.8153621+08:00||;False|2024-06-24T15:00:29.9618848+08:00||;True|2024-06-24T14:07:19.9401637+08:00||;False|2024-06-24T14:06:36.1250570+08:00||;True|2024-06-21T15:13:57.4273503+08:00||;True|2024-06-21T15:04:37.8218608+08:00||;True|2024-06-21T14:12:48.0266638+08:00||;True|2024-06-21T13:52:30.0950155+08:00||;True|2024-06-20T11:02:42.9508506+08:00||;True|2024-06-19T11:43:01.1899282+08:00||;True|2024-06-19T11:23:01.2938141+08:00||;True|2024-06-18T08:51:21.6222152+08:00||;True|2024-06-17T09:20:35.0804494+08:00||;True|2024-06-17T08:41:58.1319484+08:00||;True|2024-06-17T08:38:09.0137102+08:00||;True|2024-06-14T15:19:45.7395180+08:00||;True|2024-06-14T14:38:49.7094421+08:00||;True|2024-06-14T14:27:39.2815370+08:00||;True|2024-06-14T09:42:21.5397525+08:00||;True|2024-06-13T16:03:39.8475642+08:00||;True|2024-06-13T14:12:10.1725629+08:00||;True|2024-06-13T10:46:52.6971321+08:00||;True|2024-06-11T17:03:44.8328978+08:00||;True|2024-06-06T17:41:51.1810315+08:00||;True|2024-06-06T10:57:27.8273617+08:00||;True|2024-06-04T14:23:21.3742450+08:00||;True|2024-05-31T17:01:42.4717460+08:00||;True|2024-05-31T13:56:03.0734064+08:00||;True|2024-05-31T08:45:52.3549394+08:00||;True|2024-05-30T17:16:32.8907958+08:00||;True|2024-05-30T16:18:06.9957657+08:00||;True|2024-05-29T15:44:18.4051203+08:00||;True|2024-05-29T15:11:03.1518632+08:00||;True|2024-05-29T14:52:26.0823495+08:00||;True|2024-05-29T11:17:20.2245101+08:00||;True|2024-05-29T08:36:28.9569161+08:00||;True|2024-05-28T08:44:31.4427261+08:00||;False|2024-05-28T08:44:02.5254826+08:00||;True|2024-05-27T15:16:32.9413631+08:00||;True|2024-05-27T15:03:42.9803879+08:00||;True|2024-05-27T08:49:54.3933663+08:00||;True|2024-05-27T08:46:13.5862236+08:00||;True|2024-05-23T17:19:32.8154451+08:00||;True|2024-05-23T17:19:01.4587615+08:00||;True|2024-05-22T16:52:42.2166228+08:00||;True|2024-05-22T15:19:49.1773202+08:00||;True|2024-05-22T15:13:31.9485525+08:00||;True|2024-05-22T13:29:02.1355808+08:00||;True|2024-05-22T09:48:40.8753914+08:00||;True|2024-05-22T09:25:06.2068137+08:00||;True|2024-05-22T09:18:53.0759815+08:00||;True|2024-05-21T17:13:36.4091775+08:00||;True|2024-05-21T14:41:18.8486299+08:00||;True|2024-05-21T11:04:27.3649637+08:00||; + True|2024-07-23T09:25:11.8773492Z||;True|2024-07-23T17:07:16.5460273+08:00||;True|2024-07-22T08:59:23.3235603+08:00||;True|2024-07-12T17:35:11.1225017+08:00||;True|2024-07-11T11:40:17.3581147+08:00||;True|2024-07-04T17:20:50.0175739+08:00||;True|2024-07-02T11:26:14.2092751+08:00||;True|2024-07-02T09:21:51.3513605+08:00||;True|2024-07-01T17:47:56.0407256+08:00||;True|2024-07-01T16:42:55.7374984+08:00||;True|2024-07-01T15:49:58.9266967+08:00||;True|2024-07-01T14:35:48.1117178+08:00||;True|2024-07-01T11:41:52.2969338+08:00||;True|2024-07-01T11:13:02.6561160+08:00||;True|2024-06-28T15:28:43.1470725+08:00||;True|2024-06-28T15:16:20.1999596+08:00||;True|2024-06-28T15:14:56.2534743+08:00||;True|2024-06-28T15:02:41.3033806+08:00||;True|2024-06-28T13:37:28.2462742+08:00||;True|2024-06-28T11:06:30.7400535+08:00||;True|2024-06-26T15:24:17.1939896+08:00||;True|2024-06-26T14:33:06.3530466+08:00||;True|2024-06-26T09:45:24.4055568+08:00||;True|2024-06-25T15:45:57.6052473+08:00||;True|2024-06-25T10:17:17.7408916+08:00||;False|2024-06-25T10:16:23.5639654+08:00||;False|2024-06-25T10:15:28.3857721+08:00||;False|2024-06-25T10:10:59.5536995+08:00||;False|2024-06-25T10:07:10.4050937+08:00||;True|2024-06-24T15:22:18.2672769+08:00||;True|2024-06-24T15:01:04.8153621+08:00||;False|2024-06-24T15:00:29.9618848+08:00||;True|2024-06-24T14:07:19.9401637+08:00||;False|2024-06-24T14:06:36.1250570+08:00||;True|2024-06-21T15:13:57.4273503+08:00||;True|2024-06-21T15:04:37.8218608+08:00||;True|2024-06-21T14:12:48.0266638+08:00||;True|2024-06-21T13:52:30.0950155+08:00||;True|2024-06-20T11:02:42.9508506+08:00||;True|2024-06-19T11:43:01.1899282+08:00||;True|2024-06-19T11:23:01.2938141+08:00||;True|2024-06-18T08:51:21.6222152+08:00||;True|2024-06-17T09:20:35.0804494+08:00||;True|2024-06-17T08:41:58.1319484+08:00||;True|2024-06-17T08:38:09.0137102+08:00||;True|2024-06-14T15:19:45.7395180+08:00||;True|2024-06-14T14:38:49.7094421+08:00||;True|2024-06-14T14:27:39.2815370+08:00||;True|2024-06-14T09:42:21.5397525+08:00||;True|2024-06-13T16:03:39.8475642+08:00||;True|2024-06-13T14:12:10.1725629+08:00||;True|2024-06-13T10:46:52.6971321+08:00||;True|2024-06-11T17:03:44.8328978+08:00||;True|2024-06-06T17:41:51.1810315+08:00||;True|2024-06-06T10:57:27.8273617+08:00||;True|2024-06-04T14:23:21.3742450+08:00||;True|2024-05-31T17:01:42.4717460+08:00||;True|2024-05-31T13:56:03.0734064+08:00||;True|2024-05-31T08:45:52.3549394+08:00||;True|2024-05-30T17:16:32.8907958+08:00||;True|2024-05-30T16:18:06.9957657+08:00||;True|2024-05-29T15:44:18.4051203+08:00||;True|2024-05-29T15:11:03.1518632+08:00||;True|2024-05-29T14:52:26.0823495+08:00||;True|2024-05-29T11:17:20.2245101+08:00||;True|2024-05-29T08:36:28.9569161+08:00||;True|2024-05-28T08:44:31.4427261+08:00||;False|2024-05-28T08:44:02.5254826+08:00||;True|2024-05-27T15:16:32.9413631+08:00||;True|2024-05-27T15:03:42.9803879+08:00||;True|2024-05-27T08:49:54.3933663+08:00||;True|2024-05-27T08:46:13.5862236+08:00||;True|2024-05-23T17:19:32.8154451+08:00||;True|2024-05-23T17:19:01.4587615+08:00||;True|2024-05-22T16:52:42.2166228+08:00||;True|2024-05-22T15:19:49.1773202+08:00||;True|2024-05-22T15:13:31.9485525+08:00||;True|2024-05-22T13:29:02.1355808+08:00||;True|2024-05-22T09:48:40.8753914+08:00||;True|2024-05-22T09:25:06.2068137+08:00||;True|2024-05-22T09:18:53.0759815+08:00||;True|2024-05-21T17:13:36.4091775+08:00||;True|2024-05-21T14:41:18.8486299+08:00||;True|2024-05-21T11:04:27.3649637+08:00||; \ No newline at end of file From 4f815bdf729dab76ee4871d737bea73d9f967fad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B5=87=E6=96=87=E9=BE=99?= Date: Wed, 24 Jul 2024 10:08:06 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=8F=B0=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Method => DS.Module.Core/Utils}/ApiFox.cs | 76 ++++----- .../Invoice/Method/InvoiceApiFox.cs | 46 ++++++ .../Invoice/Method/InvoiceIssuanceService.cs | 14 +- .../Op/Dtos/TaskInteraction/TaskCreation.cs | 149 ++++++++++++++++++ .../FolderProfile1.pubxml.user | 2 +- 5 files changed, 240 insertions(+), 47 deletions(-) rename ds-wms-service/{DS.WMS.Core/Invoice/Method => DS.Module.Core/Utils}/ApiFox.cs (73%) create mode 100644 ds-wms-service/DS.WMS.Core/Invoice/Method/InvoiceApiFox.cs create mode 100644 ds-wms-service/DS.WMS.Core/Op/Dtos/TaskInteraction/TaskCreation.cs diff --git a/ds-wms-service/DS.WMS.Core/Invoice/Method/ApiFox.cs b/ds-wms-service/DS.Module.Core/Utils/ApiFox.cs similarity index 73% rename from ds-wms-service/DS.WMS.Core/Invoice/Method/ApiFox.cs rename to ds-wms-service/DS.Module.Core/Utils/ApiFox.cs index 6218840b..e595f31a 100644 --- a/ds-wms-service/DS.WMS.Core/Invoice/Method/ApiFox.cs +++ b/ds-wms-service/DS.Module.Core/Utils/ApiFox.cs @@ -1,48 +1,31 @@ using System.Collections.Specialized; -using System.Security; using System.Text; -using DS.Module.Core; using DS.Module.Core.Extensions; -using Microsoft.Extensions.Configuration; using Newtonsoft.Json; -namespace DS.WMS.Core.Invoice.Method +namespace DS.Module.Core { /// /// 提供对HTTP请求的低级别访问 /// - internal class ApiFox + public class ApiFox { /// - /// 发票API的基URL + /// 基URI /// - public string? BaseUrl { get; set; } + public Uri? BaseUri { get; set; } /// - /// 用户Key + /// 默认请求头 /// - public string? UserKey { get; set; } + public IDictionary DefaultHeaders { get; private set; } /// - /// 用户密钥 + /// 初始化 /// - public SecureString? UserSecret { get; private set; } - - public ApiFox(IConfiguration config) + public ApiFox() { - BaseUrl = config.GetValue("InvoiceApi:BaseUrl"); - UserKey = config.GetValue("InvoiceApi:UserKey"); - - string? us = config.GetValue("InvoiceApi:UserSecret"); - if (!us.IsNullOrEmpty()) - { - UserSecret = new SecureString(); - for (int i = 0; i < us.Length; i++) - UserSecret.AppendChar(us[i]); - - UserSecret.MakeReadOnly(); - } - us = null; + DefaultHeaders = new Dictionary(); } /// @@ -55,9 +38,7 @@ namespace DS.WMS.Core.Invoice.Method /// 为null或空字符串 public async Task> GetAsync(string url, NameValueCollection? keyValues = null) { - ArgumentException.ThrowIfNullOrEmpty(nameof(url)); - - string? queryString = null; + string queryString = string.Empty; if (keyValues != null && keyValues.Count > 0) { StringBuilder sb = new StringBuilder(); @@ -101,8 +82,6 @@ namespace DS.WMS.Core.Invoice.Method /// 为null或空字符串 public async Task> PostAsync(string url, object? requestParams = null) { - ArgumentException.ThrowIfNullOrEmpty(nameof(url)); - var result = await SendRequestAsync(HttpMethod.Post, url, requestParams); if (!result.Succeeded) return DataResult.Failed(result.Message, result.MultiCode); @@ -113,27 +92,42 @@ namespace DS.WMS.Core.Invoice.Method } /// - /// 发起请求 + /// 发起HTTP请求 /// /// 请求方法 /// 请求Url /// 请求参数 /// - public async Task> SendRequestAsync(HttpMethod method, string url, object? requestParams = null) + /// 为null + /// 为null或空字符串 + public virtual async Task> SendRequestAsync(HttpMethod method, string url, object? requestParams = null) { - if (!Uri.TryCreate(BaseUrl, UriKind.RelativeOrAbsolute, out Uri? uri)) - return DataResult.FailedWithDesc(nameof(MultiLanguageConst.InvoiceAPIUrlNull)); + ArgumentNullException.ThrowIfNull(method); + ArgumentException.ThrowIfNullOrEmpty(url); + + Uri? reqUri = default; + if (BaseUri == null) + { + if (!Uri.TryCreate(url, UriKind.RelativeOrAbsolute, out Uri? uri)) + throw new ArgumentException("给定的URL格式无效", nameof(url)); + + reqUri = new Uri(url); + } + else + { + reqUri = new(BaseUri, url); + } HttpClient http = new(); - http.DefaultRequestHeaders.Add("User-Agent", "X-HttpClient"); + http.DefaultRequestHeaders.Add("User-Agent", $"X-{nameof(ApiFox)}"); - if (!UserKey.IsNullOrEmpty()) - http.DefaultRequestHeaders.Add("USER_KEY", UserKey); + if (DefaultHeaders.Count > 0) + foreach (var header in DefaultHeaders) + http.DefaultRequestHeaders.Add(header.Key, header.Value); - if (UserSecret != null) - http.DefaultRequestHeaders.Add("USER_SECRET", UserSecret.ToString()); + if (!http.DefaultRequestHeaders.Contains("Accept")) + http.DefaultRequestHeaders.Add("Accept", "application/json, text/plain"); - Uri reqUri = new(uri, url); try { HttpResponseMessage? response = null; diff --git a/ds-wms-service/DS.WMS.Core/Invoice/Method/InvoiceApiFox.cs b/ds-wms-service/DS.WMS.Core/Invoice/Method/InvoiceApiFox.cs new file mode 100644 index 00000000..6986cffc --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Invoice/Method/InvoiceApiFox.cs @@ -0,0 +1,46 @@ +using System.Security; +using DS.Module.Core; +using DS.Module.Core.Extensions; +using Microsoft.Extensions.Configuration; + +namespace DS.WMS.Core.Invoice.Method +{ + /// + /// 提供对HTTP请求的低级别访问 + /// + internal sealed class InvoiceApiFox : ApiFox + { + /// + /// 用户Key + /// + public string? UserKey { get; set; } + + /// + /// 用户密钥 + /// + public SecureString? UserSecret { get; private set; } + + + public InvoiceApiFox(IConfiguration config) + { + BaseUri = new Uri(config.GetValue("InvoiceApi:BaseUrl")); + UserKey = config.GetValue("InvoiceApi:UserKey"); + + string? us = config.GetValue("InvoiceApi:UserSecret"); + if (!us.IsNullOrEmpty()) + { + UserSecret = new SecureString(); + for (int i = 0; i < us.Length; i++) + UserSecret.AppendChar(us[i]); + + UserSecret.MakeReadOnly(); + } + us = null; + + DefaultHeaders.Add("USER_KEY", UserKey ?? string.Empty); + DefaultHeaders.Add("USER_SECRET", UserSecret?.ToString()); + } + + + } +} diff --git a/ds-wms-service/DS.WMS.Core/Invoice/Method/InvoiceIssuanceService.cs b/ds-wms-service/DS.WMS.Core/Invoice/Method/InvoiceIssuanceService.cs index 272695f5..2d2bbb76 100644 --- a/ds-wms-service/DS.WMS.Core/Invoice/Method/InvoiceIssuanceService.cs +++ b/ds-wms-service/DS.WMS.Core/Invoice/Method/InvoiceIssuanceService.cs @@ -11,7 +11,7 @@ namespace DS.WMS.Core.Invoice.Method /// public sealed class InvoiceIssuanceService : ApplicationServiceBase { - readonly ApiFox api; + readonly InvoiceApiFox api; /// /// 初始化并加载配置 @@ -20,7 +20,7 @@ namespace DS.WMS.Core.Invoice.Method public InvoiceIssuanceService(IServiceProvider provider) : base(provider) { var config = provider.GetRequiredService(); - api = new ApiFox(config); + api = new InvoiceApiFox(config); } /// @@ -78,15 +78,19 @@ namespace DS.WMS.Core.Invoice.Method return DataResult.Failed(result.Message, result.MultiCode); var invResult = result.Data; - if (!invResult.Success) + if (invResult.Success) + { + + + return DataResult.Success(invResult.Data); + } + else { if (invResult.Code == 1) return await InitiateAsync(invoices); return DataResult.Failed(invResult.Message); } - - return DataResult.Success(invResult.Data); } /// diff --git a/ds-wms-service/DS.WMS.Core/Op/Dtos/TaskInteraction/TaskCreation.cs b/ds-wms-service/DS.WMS.Core/Op/Dtos/TaskInteraction/TaskCreation.cs new file mode 100644 index 00000000..cb640fa0 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Op/Dtos/TaskInteraction/TaskCreation.cs @@ -0,0 +1,149 @@ +using System.Runtime.Serialization; +using DS.Module.Core; + +namespace DS.WMS.Core.Op.Dtos.TaskInteraction +{ + /// + /// 任务台创建参数 + /// + public class TaskCreation + { + [DataMember(Name = "head")] + public TaskHeader Head { get; set; } + + [DataMember(Name = "main")] + public TaskMain Main { get; set; } + + public TaskCreation() + { + Head = new TaskHeader(); + Main = new TaskMain(); + } + } + + /// + /// 任务标头 + /// + public class TaskHeader + { + /// + /// 流水ID + /// + [DataMember(Name = "gid")] + public Guid GID { get; set; } = Guid.NewGuid(); + + /// + /// 订单Id + /// + [DataMember(Name = "bsno")] + public long BSNO { get; set; } + + /// + /// 消息类型 + /// + [DataMember(Name = "messageType")] + public string MessageType { get; set; } = "WORK_FLOW_TASK"; + + [DataMember(Name = "senderId")] + public string SenderId { get; set; } = "WorkFlow"; + + [DataMember(Name = "senderName")] + public string SenderName { get; set; } = "工作流平台"; + + [DataMember(Name = "receiverId")] + public string ReceiverId { get; set; } = "TaskManage"; + + [DataMember(Name = "receiverName")] + public string ReceiverName { get; set; } = "任务管理平台"; + + /// + /// 标识符 + /// + [DataMember(Name = "token")] + public string? Token { get; set; } + + /// + /// 版本 + /// + [DataMember(Name = "version")] + public string? Version { get; set; } = "1.0"; + + /// + /// 请求时间 + /// + [DataMember(Name = "requestDate")] + public DateTime RequestDate { get; set; } = DateTime.Now; + + [DataMember(Name = "senderKey")] + public string? SenderKey { get; set; } + + [DataMember(Name = "requestAction")] + public string? RequestAction { get; set; } = "Add"; + } + + /// + /// 任务主信息 + /// + public class TaskMain + { + /// + /// 任务类型 + /// + [DataMember(Name = "taskType")] + public TaskBaseTypeEnum TaskType { get; set; } + + /// + /// 任务来源 + /// + [DataMember(Name = "taskSource")] + public int TaskSource { get; set; } = 9; + + /// + /// 任务标题 + /// + [DataMember(Name = "taskTitle")] + public string TaskTitle { get; set; } = string.Empty; + + /// + /// 任务描述 + /// + [DataMember(Name = "taskDesp")] + public string? TaskDescription { get; set; } + + /// + /// 任务创建者ID + /// + [DataMember(Name = "taskUserId")] + public long TaskUserId { get; set; } + + /// + /// 任务创建者 + /// + [DataMember(Name = "taskUserName")] + public string? TaskUserName { get; set; } + + /// + /// 任务接收者ID + /// + [DataMember(Name = "recvUserId")] + public long RecvUserId { get; set; } + + /// + /// 任务创建者 + /// + [DataMember(Name = "recvUserName")] + public string? RecvUserName { get; set; } + + /// + /// 任务租户ID + /// + [DataMember(Name = "taskTenatId")] + public long TaskTenatId { get; set; } + + /// + /// 任务租户 + /// + [DataMember(Name = "taskTenatName")] + public string? TaskTenatName { get; set; } + } +} diff --git a/ds-wms-service/DS.WMS.FeeApi/Properties/PublishProfiles/FolderProfile1.pubxml.user b/ds-wms-service/DS.WMS.FeeApi/Properties/PublishProfiles/FolderProfile1.pubxml.user index 68366bf1..2b7bb4f0 100644 --- a/ds-wms-service/DS.WMS.FeeApi/Properties/PublishProfiles/FolderProfile1.pubxml.user +++ b/ds-wms-service/DS.WMS.FeeApi/Properties/PublishProfiles/FolderProfile1.pubxml.user @@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. <_PublishTargetUrl>D:\Publish\DS8\FeeApi - True|2024-07-23T09:25:11.8773492Z||;True|2024-07-23T17:07:16.5460273+08:00||;True|2024-07-22T08:59:23.3235603+08:00||;True|2024-07-12T17:35:11.1225017+08:00||;True|2024-07-11T11:40:17.3581147+08:00||;True|2024-07-04T17:20:50.0175739+08:00||;True|2024-07-02T11:26:14.2092751+08:00||;True|2024-07-02T09:21:51.3513605+08:00||;True|2024-07-01T17:47:56.0407256+08:00||;True|2024-07-01T16:42:55.7374984+08:00||;True|2024-07-01T15:49:58.9266967+08:00||;True|2024-07-01T14:35:48.1117178+08:00||;True|2024-07-01T11:41:52.2969338+08:00||;True|2024-07-01T11:13:02.6561160+08:00||;True|2024-06-28T15:28:43.1470725+08:00||;True|2024-06-28T15:16:20.1999596+08:00||;True|2024-06-28T15:14:56.2534743+08:00||;True|2024-06-28T15:02:41.3033806+08:00||;True|2024-06-28T13:37:28.2462742+08:00||;True|2024-06-28T11:06:30.7400535+08:00||;True|2024-06-26T15:24:17.1939896+08:00||;True|2024-06-26T14:33:06.3530466+08:00||;True|2024-06-26T09:45:24.4055568+08:00||;True|2024-06-25T15:45:57.6052473+08:00||;True|2024-06-25T10:17:17.7408916+08:00||;False|2024-06-25T10:16:23.5639654+08:00||;False|2024-06-25T10:15:28.3857721+08:00||;False|2024-06-25T10:10:59.5536995+08:00||;False|2024-06-25T10:07:10.4050937+08:00||;True|2024-06-24T15:22:18.2672769+08:00||;True|2024-06-24T15:01:04.8153621+08:00||;False|2024-06-24T15:00:29.9618848+08:00||;True|2024-06-24T14:07:19.9401637+08:00||;False|2024-06-24T14:06:36.1250570+08:00||;True|2024-06-21T15:13:57.4273503+08:00||;True|2024-06-21T15:04:37.8218608+08:00||;True|2024-06-21T14:12:48.0266638+08:00||;True|2024-06-21T13:52:30.0950155+08:00||;True|2024-06-20T11:02:42.9508506+08:00||;True|2024-06-19T11:43:01.1899282+08:00||;True|2024-06-19T11:23:01.2938141+08:00||;True|2024-06-18T08:51:21.6222152+08:00||;True|2024-06-17T09:20:35.0804494+08:00||;True|2024-06-17T08:41:58.1319484+08:00||;True|2024-06-17T08:38:09.0137102+08:00||;True|2024-06-14T15:19:45.7395180+08:00||;True|2024-06-14T14:38:49.7094421+08:00||;True|2024-06-14T14:27:39.2815370+08:00||;True|2024-06-14T09:42:21.5397525+08:00||;True|2024-06-13T16:03:39.8475642+08:00||;True|2024-06-13T14:12:10.1725629+08:00||;True|2024-06-13T10:46:52.6971321+08:00||;True|2024-06-11T17:03:44.8328978+08:00||;True|2024-06-06T17:41:51.1810315+08:00||;True|2024-06-06T10:57:27.8273617+08:00||;True|2024-06-04T14:23:21.3742450+08:00||;True|2024-05-31T17:01:42.4717460+08:00||;True|2024-05-31T13:56:03.0734064+08:00||;True|2024-05-31T08:45:52.3549394+08:00||;True|2024-05-30T17:16:32.8907958+08:00||;True|2024-05-30T16:18:06.9957657+08:00||;True|2024-05-29T15:44:18.4051203+08:00||;True|2024-05-29T15:11:03.1518632+08:00||;True|2024-05-29T14:52:26.0823495+08:00||;True|2024-05-29T11:17:20.2245101+08:00||;True|2024-05-29T08:36:28.9569161+08:00||;True|2024-05-28T08:44:31.4427261+08:00||;False|2024-05-28T08:44:02.5254826+08:00||;True|2024-05-27T15:16:32.9413631+08:00||;True|2024-05-27T15:03:42.9803879+08:00||;True|2024-05-27T08:49:54.3933663+08:00||;True|2024-05-27T08:46:13.5862236+08:00||;True|2024-05-23T17:19:32.8154451+08:00||;True|2024-05-23T17:19:01.4587615+08:00||;True|2024-05-22T16:52:42.2166228+08:00||;True|2024-05-22T15:19:49.1773202+08:00||;True|2024-05-22T15:13:31.9485525+08:00||;True|2024-05-22T13:29:02.1355808+08:00||;True|2024-05-22T09:48:40.8753914+08:00||;True|2024-05-22T09:25:06.2068137+08:00||;True|2024-05-22T09:18:53.0759815+08:00||;True|2024-05-21T17:13:36.4091775+08:00||;True|2024-05-21T14:41:18.8486299+08:00||;True|2024-05-21T11:04:27.3649637+08:00||; + True|2024-07-23T09:41:01.7494842Z||;True|2024-07-23T17:25:11.8773492+08:00||;True|2024-07-23T17:07:16.5460273+08:00||;True|2024-07-22T08:59:23.3235603+08:00||;True|2024-07-12T17:35:11.1225017+08:00||;True|2024-07-11T11:40:17.3581147+08:00||;True|2024-07-04T17:20:50.0175739+08:00||;True|2024-07-02T11:26:14.2092751+08:00||;True|2024-07-02T09:21:51.3513605+08:00||;True|2024-07-01T17:47:56.0407256+08:00||;True|2024-07-01T16:42:55.7374984+08:00||;True|2024-07-01T15:49:58.9266967+08:00||;True|2024-07-01T14:35:48.1117178+08:00||;True|2024-07-01T11:41:52.2969338+08:00||;True|2024-07-01T11:13:02.6561160+08:00||;True|2024-06-28T15:28:43.1470725+08:00||;True|2024-06-28T15:16:20.1999596+08:00||;True|2024-06-28T15:14:56.2534743+08:00||;True|2024-06-28T15:02:41.3033806+08:00||;True|2024-06-28T13:37:28.2462742+08:00||;True|2024-06-28T11:06:30.7400535+08:00||;True|2024-06-26T15:24:17.1939896+08:00||;True|2024-06-26T14:33:06.3530466+08:00||;True|2024-06-26T09:45:24.4055568+08:00||;True|2024-06-25T15:45:57.6052473+08:00||;True|2024-06-25T10:17:17.7408916+08:00||;False|2024-06-25T10:16:23.5639654+08:00||;False|2024-06-25T10:15:28.3857721+08:00||;False|2024-06-25T10:10:59.5536995+08:00||;False|2024-06-25T10:07:10.4050937+08:00||;True|2024-06-24T15:22:18.2672769+08:00||;True|2024-06-24T15:01:04.8153621+08:00||;False|2024-06-24T15:00:29.9618848+08:00||;True|2024-06-24T14:07:19.9401637+08:00||;False|2024-06-24T14:06:36.1250570+08:00||;True|2024-06-21T15:13:57.4273503+08:00||;True|2024-06-21T15:04:37.8218608+08:00||;True|2024-06-21T14:12:48.0266638+08:00||;True|2024-06-21T13:52:30.0950155+08:00||;True|2024-06-20T11:02:42.9508506+08:00||;True|2024-06-19T11:43:01.1899282+08:00||;True|2024-06-19T11:23:01.2938141+08:00||;True|2024-06-18T08:51:21.6222152+08:00||;True|2024-06-17T09:20:35.0804494+08:00||;True|2024-06-17T08:41:58.1319484+08:00||;True|2024-06-17T08:38:09.0137102+08:00||;True|2024-06-14T15:19:45.7395180+08:00||;True|2024-06-14T14:38:49.7094421+08:00||;True|2024-06-14T14:27:39.2815370+08:00||;True|2024-06-14T09:42:21.5397525+08:00||;True|2024-06-13T16:03:39.8475642+08:00||;True|2024-06-13T14:12:10.1725629+08:00||;True|2024-06-13T10:46:52.6971321+08:00||;True|2024-06-11T17:03:44.8328978+08:00||;True|2024-06-06T17:41:51.1810315+08:00||;True|2024-06-06T10:57:27.8273617+08:00||;True|2024-06-04T14:23:21.3742450+08:00||;True|2024-05-31T17:01:42.4717460+08:00||;True|2024-05-31T13:56:03.0734064+08:00||;True|2024-05-31T08:45:52.3549394+08:00||;True|2024-05-30T17:16:32.8907958+08:00||;True|2024-05-30T16:18:06.9957657+08:00||;True|2024-05-29T15:44:18.4051203+08:00||;True|2024-05-29T15:11:03.1518632+08:00||;True|2024-05-29T14:52:26.0823495+08:00||;True|2024-05-29T11:17:20.2245101+08:00||;True|2024-05-29T08:36:28.9569161+08:00||;True|2024-05-28T08:44:31.4427261+08:00||;False|2024-05-28T08:44:02.5254826+08:00||;True|2024-05-27T15:16:32.9413631+08:00||;True|2024-05-27T15:03:42.9803879+08:00||;True|2024-05-27T08:49:54.3933663+08:00||;True|2024-05-27T08:46:13.5862236+08:00||;True|2024-05-23T17:19:32.8154451+08:00||;True|2024-05-23T17:19:01.4587615+08:00||;True|2024-05-22T16:52:42.2166228+08:00||;True|2024-05-22T15:19:49.1773202+08:00||;True|2024-05-22T15:13:31.9485525+08:00||;True|2024-05-22T13:29:02.1355808+08:00||;True|2024-05-22T09:48:40.8753914+08:00||;True|2024-05-22T09:25:06.2068137+08:00||;True|2024-05-22T09:18:53.0759815+08:00||;True|2024-05-21T17:13:36.4091775+08:00||;True|2024-05-21T14:41:18.8486299+08:00||;True|2024-05-21T11:04:27.3649637+08:00||; \ No newline at end of file From 9236fb9b637016cbde07de7f22212ad99837579f Mon Sep 17 00:00:00 2001 From: cjy Date: Wed, 24 Jul 2024 11:14:42 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E9=82=AE=E7=AE=B1=E5=8F=8A=E5=AE=A2=E6=88=B7=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=20=EF=BC=8C=E6=B7=BB=E5=8A=A0=E7=A7=9F?= =?UTF-8?q?=E6=88=B7=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DS.Module.Core/Data/BaseTenantModel.cs | 6 ++++ .../DS.Module.Core/Data/UserTenantModel.cs | 6 ++++ .../DS.Module.Core/Utils/JwtHelper.cs | 7 ++++- .../DS.Module.UserModule/AspNetUser.cs | 17 ++++++++++ ds-wms-service/DS.Module.UserModule/IUser.cs | 5 +++ .../Sys/Interface/IClientCommonService.cs | 15 +++++++-- .../Sys/Method/ClientCommonService.cs | 31 ++++++++++++++++++- .../DS.WMS.Core/Sys/Method/CommonService.cs | 4 +++ .../Controllers/ClientCommonController.cs | 24 ++++++++++++++ 9 files changed, 111 insertions(+), 4 deletions(-) diff --git a/ds-wms-service/DS.Module.Core/Data/BaseTenantModel.cs b/ds-wms-service/DS.Module.Core/Data/BaseTenantModel.cs index ec3ecd38..912c56d1 100644 --- a/ds-wms-service/DS.Module.Core/Data/BaseTenantModel.cs +++ b/ds-wms-service/DS.Module.Core/Data/BaseTenantModel.cs @@ -19,4 +19,10 @@ public abstract class BaseTenantModel : BaseModel, ITenantId /// [SqlSugar.SugarColumn(ColumnDescription = "租户Id", IsOnlyIgnoreUpdate = true)] public long TenantId { get; set; } = 0; + + /// + /// 租户名称 + /// + [SqlSugar.SugarColumn(ColumnDescription = "租户名称", IsOnlyIgnoreUpdate = true,Length = 150)] + public string TenantName { get; set; } } \ No newline at end of file diff --git a/ds-wms-service/DS.Module.Core/Data/UserTenantModel.cs b/ds-wms-service/DS.Module.Core/Data/UserTenantModel.cs index 5084b3d3..28f3a3f3 100644 --- a/ds-wms-service/DS.Module.Core/Data/UserTenantModel.cs +++ b/ds-wms-service/DS.Module.Core/Data/UserTenantModel.cs @@ -19,4 +19,10 @@ public abstract class UserTenantModel : BaseModel, ITenantId /// [SqlSugar.SugarColumn(ColumnDescription = "租户Id")] public long TenantId { get; set; } = 0; + + /// + /// 租户名称 + /// + [SqlSugar.SugarColumn(ColumnDescription = "租户名称", Length = 150)] + public string TenantName { get; set; } } \ No newline at end of file diff --git a/ds-wms-service/DS.Module.Core/Utils/JwtHelper.cs b/ds-wms-service/DS.Module.Core/Utils/JwtHelper.cs index ef06c086..deed8e80 100644 --- a/ds-wms-service/DS.Module.Core/Utils/JwtHelper.cs +++ b/ds-wms-service/DS.Module.Core/Utils/JwtHelper.cs @@ -77,7 +77,7 @@ public class JwtHelper // new Claim("OrgId", data.OrgId), // 公司ID new Claim("UserName", data.Name), // UserName new Claim("TenantId", data.TenantId), // 租户ID - + new Claim("TenantName", data.TenantName), // 租户名称 }; // 添加机构信息 if (isClient) @@ -168,5 +168,10 @@ public class JwtHelper /// 租户ID /// public string TenantId { get; set; } + + /// + /// 租户名称 + /// + public string TenantName { get; set; } } } \ No newline at end of file diff --git a/ds-wms-service/DS.Module.UserModule/AspNetUser.cs b/ds-wms-service/DS.Module.UserModule/AspNetUser.cs index 0dc9f680..757753bf 100644 --- a/ds-wms-service/DS.Module.UserModule/AspNetUser.cs +++ b/ds-wms-service/DS.Module.UserModule/AspNetUser.cs @@ -60,6 +60,23 @@ public class AspNetUser : IUser _userName = value; } } + private string _tenantName; + public string TenantName + { + get + { + if (_tenantName == null) + { + var claimValue = GetClaimValueByType("TenantName").FirstOrDefault(); + _tenantName = claimValue != null ? claimValue.ObjToString() : "系统租户"; + } + return _tenantName; + } + set + { + _tenantName = value; + } + } public long GetTenantId() { var token = GetToken(); diff --git a/ds-wms-service/DS.Module.UserModule/IUser.cs b/ds-wms-service/DS.Module.UserModule/IUser.cs index b284d4bc..0b527100 100644 --- a/ds-wms-service/DS.Module.UserModule/IUser.cs +++ b/ds-wms-service/DS.Module.UserModule/IUser.cs @@ -30,6 +30,11 @@ public interface IUser /// 租户ID /// string TenantId { get; } + + /// + /// 租户名称 + /// + string TenantName { get; } /// /// 机构ID /// diff --git a/ds-wms-service/DS.WMS.Core/Sys/Interface/IClientCommonService.cs b/ds-wms-service/DS.WMS.Core/Sys/Interface/IClientCommonService.cs index fd1ac156..b37774e2 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Interface/IClientCommonService.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Interface/IClientCommonService.cs @@ -13,8 +13,19 @@ namespace DS.WMS.Core.Sys.Interface; /// /// public interface IClientCommonService -{ - +{ + /// + /// 根据id获取往来单位参数信息 + /// + /// + /// + public Task>> GetClientParamListById(string id); + /// + /// 根据用户ids获取用户邮箱信息 + /// + /// + /// + public Task>> GetUseEmailListByIds(long[] ids); /// /// 根据类型获取用户下拉列表 /// diff --git a/ds-wms-service/DS.WMS.Core/Sys/Method/ClientCommonService.cs b/ds-wms-service/DS.WMS.Core/Sys/Method/ClientCommonService.cs index a17e59f5..7088e70e 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Method/ClientCommonService.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Method/ClientCommonService.cs @@ -1,4 +1,5 @@ using DS.Module.Core; +using DS.Module.Core.Data; using DS.Module.Core.Extensions; using DS.Module.Core.Log; using DS.Module.SqlSugar; @@ -9,6 +10,7 @@ using DS.WMS.Core.Fee.Dtos; using DS.WMS.Core.Fee.Entity; using DS.WMS.Core.Info.Dtos; using DS.WMS.Core.Info.Entity; +using DS.WMS.Core.Invoice.Dtos; using DS.WMS.Core.Op.Dtos; using DS.WMS.Core.Op.EDI; using DS.WMS.Core.Op.Entity; @@ -43,7 +45,34 @@ public class ClientCommonService : IClientCommonService user = _serviceProvider.GetRequiredService(); saasService = _serviceProvider.GetRequiredService(); } - + /// + /// 根据id获取往来单位参数信息 + /// + /// + /// + public async Task>> GetClientParamListById(string id) + { + var tenantDb = saasService.GetBizDbScopeById(user.TenantId); + var data = await tenantDb.Queryable() + .Where(x => x.CustomerId == long.Parse(id) && x.Status == StatusEnum.Enable) + .Select() + .ToListAsync(); + return await Task.FromResult(DataResult>.Success(data)); + } + /// + /// 根据用户ids获取用户邮箱信息 + /// + /// + /// + public async Task>> GetUseEmailListByIds(long[] ids) + { + var data = await db.Queryable() + .Where(a => a.Status == StatusEnum.Enable.ToEnumInt() && ids.Contains(a.Id)) + .Select() + .ToListAsync(); + return await Task.FromResult(DataResult>.Success(data)); + } + /// /// 根据类型获取用户下拉列表 /// diff --git a/ds-wms-service/DS.WMS.Core/Sys/Method/CommonService.cs b/ds-wms-service/DS.WMS.Core/Sys/Method/CommonService.cs index 74ce81a4..97119c2a 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Method/CommonService.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Method/CommonService.cs @@ -78,6 +78,7 @@ public class CommonService : ICommonService // OrgId = userInfo.OrgId, // GID = userInfo.GID, TenantId = userInfo.TenantId.ToString(), + TenantName = userInfo.TenantName, }; var token = JwtHelper.Encrypt(tokenModel); @@ -377,6 +378,7 @@ public class CommonService : ICommonService Name = userInfo.UserName, OrgId = userInfo.DefaultOrgId.ToString(), TenantId = userInfo.TenantId.ToString(), + TenantName = userInfo.TenantName, }; var token = JwtHelper.Encrypt(tokenModel, false, true); @@ -417,6 +419,7 @@ public class CommonService : ICommonService Name = db.Queryable().Filter(null, true).First(x => x.Id == userId).UserName, OrgId = user.GetOrgId().ToString(), TenantId = tenantId.ToString(), + TenantName = user.TenantName }; var refreshToken = JwtHelper.Encrypt(tokenModel, true, true); @@ -477,6 +480,7 @@ public class CommonService : ICommonService OrgId = id, Name = sysUser.UserName, TenantId = tenantId.ToString(), + TenantName = sysUser.TenantName, }; var token = new RefreshTokenRes { diff --git a/ds-wms-service/DS.WMS.MainApi/Controllers/ClientCommonController.cs b/ds-wms-service/DS.WMS.MainApi/Controllers/ClientCommonController.cs index 7f94de00..4c56d4a1 100644 --- a/ds-wms-service/DS.WMS.MainApi/Controllers/ClientCommonController.cs +++ b/ds-wms-service/DS.WMS.MainApi/Controllers/ClientCommonController.cs @@ -29,6 +29,30 @@ public class ClientCommonController : ApiController _invokeService = invokeService; } /// + /// 根据id获取往来单位参数信息 + /// + /// + /// + [HttpGet] + [Route("GetClientParamListById")] + public async Task>> GetClientParamListById([FromQuery] string id) + { + var res = await _invokeService.GetClientParamListById(id); + return res; + } + /// + /// 根据用户ids获取用户邮箱信息 + /// + /// 用户Ids + /// + [HttpGet] + [Route("GetUseEmailListByIds")] + public async Task>> GetUseEmailListByIds([FromQuery] long[] ids) + { + var res = await _invokeService.GetUseEmailListByIds(ids); + return res; + } + /// /// 根据类型获取用户下拉列表 /// ///