zhou.xiaoning vor 4 Jahren
Ursprung
Commit
283a0a3d5a

+ 6 - 5
Muchinfo.MTPClient/Fx4.0/Main/03.UI/Modules/Muchinfo.MTPClient.Analysis/ViewModels/CChartViewModel.cs

@@ -466,14 +466,14 @@ namespace Muchinfo.MTPClient.Analysis.ViewModels
         {
             WareAttributeClass war = new WareAttributeClass();
             war.Name = goods.Name;
-            war.Ware = goods.GoodsCode;
+            war.Ware = goods.GoodsCode.ToUpper();
             war.Type = "0";
             war.HqKind = "1";
             war.Rate = (double)1;
             war.SellPoint = (double)0;
             war.PriceDigit = 7;
             war.PriceType = "1";
-            war.HqWare = goods.GoodsCode;
+            war.HqWare = goods.GoodsCode.ToUpper();
             war.Logo = goods.MarketCode;
             war.HqDecimal = Math.Pow(10, -goods.DecimalPlaces); //GetWareTailLength(goods.DecimalPlaces.ToString());
             war.ShowDecimal = Math.Pow(10, -goods.DecimalPlaces); //GetWareTailLength(goods.DecimalPlaces.ToString());
@@ -848,7 +848,8 @@ namespace Muchinfo.MTPClient.Analysis.ViewModels
             }
             else
             {
-                _financeChart.UpdateWareOfView2(_controlHandle, goods.GoodsCode, exchange);
+                //_financeChart.UpdateWareOfView2(_controlHandle, goods.GoodsCode, exchange);
+                _financeChart.UpdateWareOfView2(_controlHandle, goods.GoodsCode.ToUpper(), exchange);
             }
 
             if (CacheManager.TradeDayPlan.ContainsKey(goods.GoodsParameters.GoodsId))
@@ -902,7 +903,7 @@ namespace Muchinfo.MTPClient.Analysis.ViewModels
                             }
                         }
                     }
-                    if (_currentGoods.Symbol.ToLower() == item.Symbol.ToLower() && item.CurrentPrice != 0)
+                    if (_currentGoods.Symbol.ToUpper() == item.Symbol.ToUpper() && item.CurrentPrice != 0)
                     {
                         //交易所代码
                         string exchangeCode = _currentGoods.ExchHqCode;
@@ -916,7 +917,7 @@ namespace Muchinfo.MTPClient.Analysis.ViewModels
                         //    }
                         //}
                         //商品代码
-                        string goodCode = _currentGoods.GoodsCode;
+                        string goodCode = _currentGoods.GoodsCode.ToUpper();
 
                         //if (goods.HasVolume)
                         //{

+ 2 - 1
Muchinfo.MTPClient/Fx4.0/Main/03.UI/Muchinfo.TASClient.UI/ViewModelLocator.cs

@@ -61,6 +61,8 @@ namespace Muchinfo.MTPClient.UI
             SimpleIoc.Default.Register<IAnalysisService, AnalysisService>();//new 2.0
 
             SimpleIoc.Default.Register<ICommonQueryService, CommonQueryService>();//new 2.0
+
+            SimpleIoc.Default.Register<IErmcpService, ErmcpService>();// 风管云平台
         }
 
         /// <summary>
@@ -152,7 +154,6 @@ namespace Muchinfo.MTPClient.UI
 
             ////五档历史
             SimpleIoc.Default.Register<HistoryCommissionsListViewModel>();
-            
         }
 
         /// <summary>

+ 18 - 4
Muchinfo.MTPClient/Fx4.0/Main/03.UI/Muchinfo.TASClient.UI/ViewModels/LoginViewModel.cs

@@ -73,6 +73,9 @@ namespace Muchinfo.MTPClient.UI.ViewModels
         private string _progressText;
         private bool _connectResult;  ////连接是否成功
 
+        // 风管云平台
+        private IErmcpService _ermcpService;
+
         #endregion
 
         #region 绑定属性
@@ -540,6 +543,8 @@ namespace Muchinfo.MTPClient.UI.ViewModels
             CurrentLoginType = LoginTypeList.FirstOrDefault(k => k.Value == 0);
             SystemName = ApplicationParameter.TradeSystemName;
 
+            _ermcpService = SimpleIoc.Default.GetInstance<IErmcpService>();
+
             MessengerHelper.DefaultRegister<bool>(this, MessengerTokens.TradeCreateConnect, ((result) =>
             {
                 _connectResult = result;
@@ -627,10 +632,19 @@ namespace Muchinfo.MTPClient.UI.ViewModels
                                 if (_connectResult)
                                 {
                                     LogInfoHelper.WriteInfo("登陆开始...账号:" + TradeAccount.Trim());
-                                    var password = EncryptHelper.SHA256(TradeAccount.Trim() + TradePassword.Trim()).ToLower();
-                                    _loginService.TradeAccountLogin((LoginType)CurrentLoginType.Value, Convert.ToUInt64(TradeAccount.Trim()),
-                                        TradeAccount.Trim(), password, LoginCallBack, LoginErrorFunc);
-                                    //LoginCallBack(new TradeAccount() { LoginID = 310020000 });
+
+                                    // 风管云平台增加登录代码和手机号码登录
+                                    _ermcpService.GetLoginId(TradeAccount.Trim(), new Action<string>((loginId) =>
+                                    {
+                                        var password = EncryptHelper.SHA256(loginId + TradePassword.Trim()).ToLower();
+                                        _loginService.TradeAccountLogin((LoginType)CurrentLoginType.Value, Convert.ToUInt64(loginId),
+                                        loginId, password, LoginCallBack, LoginErrorFunc);
+                                        //LoginCallBack(new TradeAccount() { LoginID = 310020000 });
+                                    }), null);
+
+                                    //var password = EncryptHelper.SHA256(TradeAccount.Trim() + TradePassword.Trim()).ToLower();
+                                    //_loginService.TradeAccountLogin((LoginType)CurrentLoginType.Value, Convert.ToUInt64(TradeAccount.Trim()),
+                                    //    TradeAccount.Trim(), password, LoginCallBack, LoginErrorFunc);
                                 }
                                 else
                                 {

+ 9 - 1
Muchinfo.MTPClient/Fx4.0/Main/03.UI/Muchinfo.TASClient/App.xaml.cs

@@ -82,7 +82,15 @@ namespace Muchinfo.MTPClient
             ApplicationParameter.InitializeSystemConfig();
 
             // 风管云平台服务地址
-            ApplicationParameter.UpdateErmcpParamete();
+            if (!ApplicationParameter.UpdateErmcpParamete())
+            {
+                if (MessageBoxHelper.ShowInfo("获取服务配置信息失败,请稍后重试", "提示") == MessageBoxResult.OK)
+                {
+                    WindowHelper.RerunApplication(false);
+                }
+
+                return;
+            }
 
             base.OnStartup(e);
             ApplicationParameter.LoginGuid = System.Guid.NewGuid().ToString();

+ 2 - 2
Muchinfo.MTPClient/Fx4.0/Main/03.UI/Muchinfo.TASClient/Config/Config.xml

@@ -5,8 +5,8 @@
   <BizAddress>192.168.20.151:35001</BizAddress>
   <QuoteAddress>192.168.20.151:35002</QuoteAddress>-->
   
-  <BizAddress>192.168.31.175:5001</BizAddress>
-  <QuoteAddress>192.168.31.175:5002</QuoteAddress>
+  <!--BizAddress>192.168.31.175:5001</BizAddress>
+  <QuoteAddress>192.168.31.175:5002</QuoteAddress>-->
     <!--uat外网环境-->
   <!--<BizAddress>103.40.249.124:6010</BizAddress>
   <QuoteAddress>103.40.249.124:6020</QuoteAddress>-->

+ 5 - 0
Muchinfo.MTPClient/Fx4.0/Main/04.Infrastructure/Muchinfo.TASClient.Infrastructure/LinkProxy/LinkManager.cs

@@ -19,6 +19,11 @@ namespace Muchinfo.MTPClient.Infrastructure.LinkProxy
         public LinkType TradeLinkeType { get; set; }
         public DatagramType TradeDatagramType { get; set; }
 
+        /// <summary>
+        /// GO服务地址
+        /// </summary>
+        public string GoCommonSearchUrl { get; set; }
+
         public string GuestQuotationHost { get; set; }
         public int GuestQuotationPort { get; set; }
     }

+ 23 - 9
Muchinfo.MTPClient/Fx4.0/Main/04.Infrastructure/Muchinfo.TASClient.Infrastructure/Utilities/ApplicationParameter.cs

@@ -12,9 +12,13 @@ using System.Text.RegularExpressions;
 using System.Threading.Tasks;
 using System.Windows;
 using System.Xml.Linq;
+using GalaSoft.MvvmLight.Ioc;
 using Muchinfo.MTPClient.Data.Model;
 using Muchinfo.MTPClient.Data.Model.Account;
 using Muchinfo.MTPClient.Infrastructure.Cache;
+using Muchinfo.MTPClient.Infrastructure.Helpers;
+using Muchinfo.MTPClient.Infrastructure.MessageBox;
+using Muchinfo.MTPClient.IService;
 
 namespace Muchinfo.MTPClient.Infrastructure.Utilities
 {
@@ -690,17 +694,27 @@ namespace Muchinfo.MTPClient.Infrastructure.Utilities
         /// <summary>
         /// 风管云平台参数更新方法,主要是通过GO服务更新相关配置信息
         /// </summary>
-        public static void UpdateErmcpParamete()
+        public static bool UpdateErmcpParamete()
         {
             // 获取交易与行情 Host
-            String jsonString = HttpUtility.HttpGet(ErmcpAddress);
-            Dictionary<String, Object> dicJson = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<String, Object>>(jsonString);
-            Dictionary<String, String> dataJson = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<String, String>>(dicJson["data"].ToString());
-
-            LinkManager.Instance.Parameters.TradeHost = dataJson["tradeHost"];
-            LinkManager.Instance.Parameters.TradePort = int.Parse(dataJson["tradePort"]);
-            LinkManager.Instance.Parameters.QuotationHost = dataJson["quoteHost"];
-            LinkManager.Instance.Parameters.QuotationPort = int.Parse(dataJson["quotePort"]);
+            var jsonString = HttpUtility.HttpGet(ErmcpAddress);
+            if (jsonString != null)
+            {
+                Dictionary<String, Object> dicJson =
+                    Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<String, Object>>(jsonString);
+                Dictionary<String, String> dataJson =
+                    Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<String, String>>(dicJson["data"].ToString());
+
+                LinkManager.Instance.Parameters.TradeHost = dataJson["tradeHost"];
+                LinkManager.Instance.Parameters.TradePort = int.Parse(dataJson["tradePort"]);
+                LinkManager.Instance.Parameters.QuotationHost = dataJson["quoteHost"];
+                LinkManager.Instance.Parameters.QuotationPort = int.Parse(dataJson["quotePort"]);
+                LinkManager.Instance.Parameters.GoCommonSearchUrl = dataJson["goCommonSearchUrl"];
+
+                return true;
+            }
+
+            return false;
         }
 #endregion
 

+ 18 - 9
Muchinfo.MTPClient/Fx4.0/Main/04.Infrastructure/Muchinfo.TASClient.Infrastructure/Utilities/HttpUtility.cs

@@ -1,4 +1,5 @@
-using System.IO;
+using System;
+using System.IO;
 using System.Net;
 
 namespace Muchinfo.MTPClient.Infrastructure.Utilities
@@ -14,16 +15,24 @@ namespace Muchinfo.MTPClient.Infrastructure.Utilities
         {
             var request = CreateGetRequest(url);
 
-            var response = (HttpWebResponse)request.GetResponse();
-            var stream = response.GetResponseStream();
-            if (stream == null) return string.Empty;
-            var streamReader = new StreamReader(stream);
-            string responseContent = streamReader.ReadToEnd();
+            try
+            {
+                var response = (HttpWebResponse)request.GetResponse();
+                var stream = response.GetResponseStream();
+                if (stream == null) return string.Empty;
+                var streamReader = new StreamReader(stream);
+                string responseContent = streamReader.ReadToEnd();
 
-            response.Close();
-            streamReader.Close();
+                response.Close();
+                streamReader.Close();
 
-            return responseContent;
+                return responseContent;
+            }
+            catch (Exception e)
+            {
+                Console.WriteLine(e.ToString());
+                return null;
+            }
         }
 
         private static HttpWebRequest CreateGetRequest(string url)

+ 1 - 1
Muchinfo.MTPClient/Fx4.0/Main/05.Services/Muchinfo.TASClient.Adapter/Quote/QuoteDateAdapter.cs

@@ -66,7 +66,7 @@ namespace Muchinfo.MTPClient.Adapter.Quote
                 Int16 exchangeCode = Convert.ToInt16(goods.ExchHqCode.Substring(0, 3));
                 block = BitConverter.GetBytes(IPAddress.HostToNetworkOrder(exchangeCode));
                 ms.Write(block, 0, block.Length);
-                block = Encoding.UTF8.GetBytes(goods.GoodsHqCode.PadRight(64, '\0'));
+                block = Encoding.UTF8.GetBytes(goods.GoodsHqCode.ToUpper().PadRight(64, '\0'));
                 ms.Write(block, 0, block.Length);
                 block = BitConverter.GetBytes(IPAddress.HostToNetworkOrder((short)type));
                 ms.Write(block, 0, block.Length);

+ 9 - 1
Muchinfo.MTPClient/Fx4.0/Main/05.Services/Muchinfo.TASClient.IService/IErmcpService.cs

@@ -2,10 +2,18 @@
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
+using Muchinfo.MTPClient.Data;
 
 namespace Muchinfo.MTPClient.IService
 {
-    interface IErmcpService
+    public interface IErmcpService
     {
+        /// <summary>
+        /// 获取登录ID
+        /// </summary>
+        /// <param name="username">可传入“登录账号”、“登录代码”和“手机号码”</param>
+        /// <param name="successAction">成功能回调</param>
+        /// <param name="errorAction">失败回调</param>
+        void GetLoginId(string username, Action<string> successAction, Action<ErrorEntity> errorAction);
     }
 }

+ 23 - 2
Muchinfo.MTPClient/Fx4.0/Main/05.Services/Muchinfo.TASClient.Service/ErmcpService.cs

@@ -2,15 +2,36 @@
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
+using Muchinfo.MTPClient.Infrastructure.LinkProxy;
+using Muchinfo.MTPClient.Infrastructure.Utilities;
+using Muchinfo.MTPClient.IService;
 
 namespace Muchinfo.MTPClient.Service
 {
     /// <summary>
     /// 风管云平台专用服务
     /// </summary>
-    class ErmcpService
+    public class ErmcpService: IErmcpService
     {
-        
 
+        public void GetLoginId(string username, Action<string> successAction, Action<Data.ErrorEntity> errorAction)
+        {
+            var url = string.Format("{0}{1}?username={2}", LinkManager.Instance.Parameters.GoCommonSearchUrl, 
+                "/User/GetLoginID", 
+                username);
+            var jsonString = HttpUtility.HttpGet(url);
+            if (jsonString != null)
+            {
+                Dictionary<String, Object> dicJson =
+                    Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<String, Object>>(jsonString);
+                if (dicJson["code"].ToString() == "200")
+                {
+                    successAction(dicJson["data"].ToString());
+                    return;
+                }
+            }
+
+            successAction(username);
+        }
     }
 }

+ 4 - 0
Muchinfo.MTPClient/Fx4.0/Main/05.Services/Muchinfo.TASClient.Service/Muchinfo.MTPClient.Service.csproj

@@ -45,6 +45,10 @@
     <Reference Include="GalaSoft.MvvmLight.WPF4">
       <HintPath>..\..\02.Libs\GalaSoft.MvvmLight.WPF4.dll</HintPath>
     </Reference>
+    <Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\02.Libs\Newtonsoft.Json.dll</HintPath>
+    </Reference>
     <Reference Include="PresentationCore" />
     <Reference Include="PresentationFramework" />
     <Reference Include="protobuf-net">