From 26d548d495a3ba38ecf43d5d478845f2cc7a6a20 Mon Sep 17 00:00:00 2001 From: cjy Date: Mon, 22 Jul 2024 16:41:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=93=E5=8D=B0=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MultiLanguageMiddleware.cs | 1 + ds-wms-service/DS.WMS.Gateway/Program.cs | 2 +- ds-wms-service/DS.WMS.Gateway/ocelot.json | 33 +++++++++++++ .../Controllers/PrintController.cs | 46 +++++++++---------- .../Properties/launchSettings.json | 2 +- ds-wms-service/DS.WMS.PrintApi/Startup.cs | 3 +- .../DS.WMS.PrintApi/appsettings.json | 2 +- 7 files changed, 62 insertions(+), 27 deletions(-) diff --git a/ds-wms-service/DS.Module.MultiLanguage/MultiLanguageMiddleware.cs b/ds-wms-service/DS.Module.MultiLanguage/MultiLanguageMiddleware.cs index 82218bba..67ef712b 100644 --- a/ds-wms-service/DS.Module.MultiLanguage/MultiLanguageMiddleware.cs +++ b/ds-wms-service/DS.Module.MultiLanguage/MultiLanguageMiddleware.cs @@ -47,6 +47,7 @@ public class MultiLanguageMiddleware || context.Request.Path.Value.IndexOf("HealthCheck", StringComparison.InvariantCultureIgnoreCase) > -1 || context.Request.Path.Value.IndexOf("DownloadOpFileInfo", StringComparison.InvariantCultureIgnoreCase) > -1 || context.Request.Path.Value.IndexOf("LinkAttach", StringComparison.InvariantCultureIgnoreCase) > -1 + || context.Request.Path.Value.IndexOf("PrintTempFile", StringComparison.InvariantCultureIgnoreCase) > -1 || context.Request.Path.Value.IndexOf("GetOcrImg", StringComparison.InvariantCultureIgnoreCase) > -1 || context.Request.Path.Value.IndexOf("DownloadBookingOrClosingEDI", StringComparison.InvariantCultureIgnoreCase) > -1 ) diff --git a/ds-wms-service/DS.WMS.Gateway/Program.cs b/ds-wms-service/DS.WMS.Gateway/Program.cs index c5178adf..6a57c248 100644 --- a/ds-wms-service/DS.WMS.Gateway/Program.cs +++ b/ds-wms-service/DS.WMS.Gateway/Program.cs @@ -41,7 +41,7 @@ if (!policyName.IsNullOrEmpty()) // if (app.Environment.IsDevelopment()) // { - var apis = new List { "WmsMainAPI", "WmsAdminAPI", "WmsOpAPI", "WmsFeeAPI", "WmsCheckAPI", "WmsFinanceAPI", "TestApi" }; + var apis = new List { "WmsMainAPI", "WmsAdminAPI", "WmsOpAPI", "WmsFeeAPI", "WmsCheckAPI", "WmsFinanceAPI", "WmsPrintAPI", "TestApi" }; app .UseSwagger() diff --git a/ds-wms-service/DS.WMS.Gateway/ocelot.json b/ds-wms-service/DS.WMS.Gateway/ocelot.json index 76d043e2..49d632c6 100644 --- a/ds-wms-service/DS.WMS.Gateway/ocelot.json +++ b/ds-wms-service/DS.WMS.Gateway/ocelot.json @@ -234,6 +234,39 @@ "Type": "RoundRobin" } }, + { + "DownstreamPathTemplate": "/swagger/v1/swagger.json", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "localhost", + "Port": 2999 + } + ], + "UpstreamPathTemplate": "/WmsPrintAPI/swagger.json", + "UpstreamHttpMethod": [ + "Get", + "Post" + ] + }, + { + "DownstreamPathTemplate": "/printApi/{url}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "localhost", + "Port": 2999 + } + ], + "UpstreamPathTemplate": "/printApi/{url}", + "UpstreamHttpMethod": [ + "Get", + "Post" + ], + "LoadBalancerOptions": { + "Type": "RoundRobin" + } + }, { "DownstreamPathTemplate": "/PrintTempFile/{url}", "DownstreamScheme": "http", diff --git a/ds-wms-service/DS.WMS.MainApi/Controllers/PrintController.cs b/ds-wms-service/DS.WMS.MainApi/Controllers/PrintController.cs index d6242eb5..2899ffe1 100644 --- a/ds-wms-service/DS.WMS.MainApi/Controllers/PrintController.cs +++ b/ds-wms-service/DS.WMS.MainApi/Controllers/PrintController.cs @@ -152,30 +152,30 @@ namespace DS.WMS.MainApi.Controllers { return await _invokeService.GetOpenPrintTemplateList(req); } - /// - /// 获取Json本地打印信息 - /// - /// - /// - [HttpPost] - [Route("GetJsonPrintInfoAsync")] - public async Task> GetJsonPrintInfoAsync([FromBody] OpenJsonPrintReq req) - { + ///// + ///// 获取Json本地打印信息 + ///// + ///// + ///// + //[HttpPost] + //[Route("GetJsonPrintInfoAsync")] + //public async Task> GetJsonPrintInfoAsync([FromBody] OpenJsonPrintReq req) + //{ - var url = AppSetting.Configuration["PrintService:LocalPrintUrl"]; - if (url.IsNull()) - return await Task.FromResult(DataResult.Failed("未配置本地打印地址")); + // var url = AppSetting.Configuration["PrintService:LocalPrintUrl"]; + // if (url.IsNull()) + // return await Task.FromResult(DataResult.Failed("未配置本地打印地址")); - var res = await RequestHelper.PostJosnAsyncNoHeaders(url, req.ToJson()); - var result = JsonConvert.DeserializeObject>(res); - if (result.Succeeded) - { - return await Task.FromResult(DataResult.Success(result.Message)); - } - else - { - return await Task.FromResult(DataResult.Failed(result.Message)); - } - } + // var res = await RequestHelper.PostJosnAsyncNoHeaders(url, req.ToJson()); + // var result = JsonConvert.DeserializeObject>(res); + // if (result.Succeeded) + // { + // return await Task.FromResult(DataResult.Success(result.Message)); + // } + // else + // { + // return await Task.FromResult(DataResult.Failed(result.Message)); + // } + //} } } diff --git a/ds-wms-service/DS.WMS.PrintApi/Properties/launchSettings.json b/ds-wms-service/DS.WMS.PrintApi/Properties/launchSettings.json index 0a468c50..5ed5da9b 100644 --- a/ds-wms-service/DS.WMS.PrintApi/Properties/launchSettings.json +++ b/ds-wms-service/DS.WMS.PrintApi/Properties/launchSettings.json @@ -4,7 +4,7 @@ "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": { - "applicationUrl": "http://localhost:14242", + "applicationUrl": "http://localhost:2999", "sslPort": 0 } }, diff --git a/ds-wms-service/DS.WMS.PrintApi/Startup.cs b/ds-wms-service/DS.WMS.PrintApi/Startup.cs index 011cab5b..e79d7927 100644 --- a/ds-wms-service/DS.WMS.PrintApi/Startup.cs +++ b/ds-wms-service/DS.WMS.PrintApi/Startup.cs @@ -63,10 +63,11 @@ namespace DS.WMS.PrintApi // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { + var documentName = AppSetting.Configuration["SwaggerDoc:ContactName"]; // app.UseHttpsRedirection(); app.UseSwagger().UseSwaggerUI(c => { - c.SwaggerEndpoint("/swagger/v1/swagger.json", AppSetting.Configuration["SwaggerDoc:Version"]); + c.SwaggerEndpoint("/swagger/v1/swagger.json", documentName); }); app.UseRouting(); //̬ļ diff --git a/ds-wms-service/DS.WMS.PrintApi/appsettings.json b/ds-wms-service/DS.WMS.PrintApi/appsettings.json index 524a5e54..bf846f16 100644 --- a/ds-wms-service/DS.WMS.PrintApi/appsettings.json +++ b/ds-wms-service/DS.WMS.PrintApi/appsettings.json @@ -12,7 +12,7 @@ "Pro": "server=60.209.125.238;port=32006;uid=root;pwd=Djy@Mysql.test;database=shippingweb8_dev" }, "SwaggerDoc": { - "ContactName": "WmsPrint API.Core", + "ContactName": "WmsPrintAPI", "ContactEmail": "WmsPrint API.Core@xxx.com", "ContactUrl": "https://www.xxx.com", "Version": "1.0",