tangjiang 7 months ago
parent
commit
1258bc4775

+ 2 - 2
src/DataSharing.Host/Controllers/YiBin/ConvergenceMediaController.cs

@@ -602,8 +602,8 @@ namespace DataSharing.Host.Controllers.YiBin
                 return OpenResponse.Ok(ConvergenceMediaDeResponse<string>.Failed("编号、密码不能为空!", "0", "失败"));
 
             var dataRaw = await _dsReceiveMediaDataRepository.GetAsync(p => p.OrderCode == AcceptCode, HttpContext.RequestAborted);
-            if (dataRaw == null)
-                return OpenResponse.Ok(ConvergenceMediaDeResponse<string>.Failed("编号、密码错误!", "0", "失败"));
+            //if (dataRaw == null)
+            //    return OpenResponse.Ok(ConvergenceMediaDeResponse<string>.Failed("编号、密码错误!", "0", "失败"));
 
             IFormFileCollection files = formData.Files;//等价于Request.Form.Files
 

+ 23 - 23
src/DataSharing.Host/Controllers/ZiGong/TianQueController.cs

@@ -190,28 +190,28 @@ namespace DataSharing.Host.Controllers.ZiGong
                 var businessFile = _channelConfigurationManager.GetConfigurationBusinessFile();
                 foreach (var file in FilePath)
                 {
-                    //HttpWebRequest request = (HttpWebRequest)WebRequest.Create(file);
+                    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(file);
 
-                    //byte[] fileContentBytes;
-                    //using (Stream stream = request.GetResponse().GetResponseStream())
-                    //{
-                    //    using (MemoryStream mstream = new MemoryStream())
-                    //    {
-                    //        int count = 0;
-                    //        byte[] buffer = new byte[1024];
-                    //        int readNum = 0;
-                    //        while ((readNum = stream.Read(buffer, 0, 1024)) > 0)
-                    //        {
-                    //            count = count + readNum;
-                    //            mstream.Write(buffer, 0, readNum);
-                    //        }
-                    //        mstream.Position = 0;
-                    //        using (BinaryReader br = new BinaryReader(mstream))
-                    //        {
-                    //            fileContentBytes = br.ReadBytes(count);
-                    //        }
-                    //    }
-                    //}
+                    byte[] fileContentBytes;
+                    using (Stream stream = request.GetResponse().GetResponseStream())
+                    {
+                        using (MemoryStream mstream = new MemoryStream())
+                        {
+                            int count = 0;
+                            byte[] buffer = new byte[1024];
+                            int readNum = 0;
+                            while ((readNum = stream.Read(buffer, 0, 1024)) > 0)
+                            {
+                                count = count + readNum;
+                                mstream.Write(buffer, 0, readNum);
+                            }
+                            mstream.Position = 0;
+                            using (BinaryReader br = new BinaryReader(mstream))
+                            {
+                                fileContentBytes = br.ReadBytes(count);
+                            }
+                        }
+                    }
                     var fileName = "";
                     if (file.IndexOf('/') > 1)
                     {
@@ -219,7 +219,7 @@ namespace DataSharing.Host.Controllers.ZiGong
                         fileName = fileName.Substring(0, fileName.LastIndexOf("."));
                         fileName = "WGY_" + fileName;
                     }
-                    byte[] fileContentBytes = null;
+                    byte[] fileContentBytes1 = null;
                     using (var client = _httpClientFactory.CreateClient())
                     using (var response = await client.GetAsync(file))
                     {
@@ -229,7 +229,7 @@ namespace DataSharing.Host.Controllers.ZiGong
                             using var memoryStream = new MemoryStream();
                             await response.Content.CopyToAsync(memoryStream);
                             memoryStream.Seek(0, SeekOrigin.Begin);
-                            fileContentBytes = memoryStream.ToArray();
+                            fileContentBytes1 = memoryStream.ToArray();
                         }
                     }
                     //上传附件到业务服务器

+ 14 - 14
src/DataSharing/FwDataExchange/FwClient.cs

@@ -11,7 +11,7 @@ namespace DataSharing.FwDataExchange
     {
         private static readonly string KeyToken = "KeyFwToken";
         private readonly IServiceScopeFactory _scopeFactory;
-        private readonly ISharingConfigurationManager _sharingConfigurationManager;
+        //private readonly ISharingConfigurationManager _sharingConfigurationManager;
 
         /// <summary>
         /// 
@@ -20,7 +20,7 @@ namespace DataSharing.FwDataExchange
         public FwClient(IServiceScopeFactory scopeFactory)
         {
             _scopeFactory = scopeFactory;
-           // _sharingConfigurationManager = sharingConfigurationManager;
+            // _sharingConfigurationManager = sharingConfigurationManager;
         }
 
         /// <summary>
@@ -45,14 +45,12 @@ namespace DataSharing.FwDataExchange
                    TimeSpan.FromMinutes(598));
             // var configSendDataOld = sharingConfigurationManager.GetYiBinConfig().SendDataOld.AddressUrl;
             string configSendDataOld = "";
-            if (_sharingConfigurationManager.IsCity(ConfigurationConsts.YiBin))
-            {
-                configSendDataOld = _sharingConfigurationManager.GetYiBinConfig().SendDataOld.AddressUrl;
-            }
-            else if (_sharingConfigurationManager.IsCity(ConfigurationConsts.ZiGong))
-            {
-                configSendDataOld = _sharingConfigurationManager.GetZiGongConfig().SendDataOld.AddressUrl;
-            }
+            if (sharingConfigurationManager.IsCity(ConfigurationConsts.YiBin))
+                configSendDataOld = sharingConfigurationManager.GetYiBinConfig().SendDataOld.AddressUrl;
+            else if (sharingConfigurationManager.IsCity(ConfigurationConsts.ZiGong))
+                configSendDataOld = sharingConfigurationManager.GetZiGongConfig().SendDataOld.AddressUrl;
+            else if (sharingConfigurationManager.IsCity(ConfigurationConsts.LuZhou))
+                configSendDataOld = sharingConfigurationManager.GetLuZhouConfig().SendDataOld.AddressUrl;
 
             return await httpInvoker.RequestStringContentAsync<TResponse>(url, httpMethod, stringContent,
                 d => d.SetHttpClient(configSendDataOld, token?.Token ?? string.Empty), cancellationToken);
@@ -91,10 +89,12 @@ namespace DataSharing.FwDataExchange
             var sharingConfigurationManager = provider.GetRequiredService<ISharingConfigurationManager>();
             //var configSendDataOld = sharingConfigurationManager.GetYiBinConfig().SendDataOld;
             ConfigurationSendDataOld configSendDataOld = new();
-            if (_sharingConfigurationManager.IsCity(ConfigurationConsts.YiBin))
-                configSendDataOld = _sharingConfigurationManager.GetYiBinConfig().SendDataOld;
-            else if (_sharingConfigurationManager.IsCity(ConfigurationConsts.ZiGong))
-                configSendDataOld = _sharingConfigurationManager.GetZiGongConfig().SendDataOld;
+            if (sharingConfigurationManager.IsCity(ConfigurationConsts.YiBin))
+                configSendDataOld = sharingConfigurationManager.GetYiBinConfig().SendDataOld;
+            else if (sharingConfigurationManager.IsCity(ConfigurationConsts.ZiGong))
+                configSendDataOld = sharingConfigurationManager.GetZiGongConfig().SendDataOld;
+            else if (sharingConfigurationManager.IsCity(ConfigurationConsts.LuZhou))
+                configSendDataOld = sharingConfigurationManager.GetLuZhouConfig().SendDataOld;
 
             string url = $"api/token?ClientID={configSendDataOld.ClientID}&Secret={configSendDataOld.Secret}";