public void ProcessPushBack(FutureDealOrderPushBack drsifi) { var tet = drsifi.StockIndexFuturesOrde; var deals = drsifi.FutureDealList; string entrustNumber = tet.EntrustNumber; if (!qhMessageCache.Contains(entrustNumber)) { LogHelper.WriteDebug("委托" + entrustNumber + "不存在缓存中"); return; } var message = qhMessageCache.Get(entrustNumber); message.EntrustAmount = tet.EntrustAmount.ToString(); message.TradeAmount = tet.TradeAmount.ToString(); message.CancelAmount = tet.CancelAmount.ToString(); message.OrderMessage = tet.OrderMessage; message.OrderStatus = Utils.GetOrderStateMsg(tet.OrderStatusId); if (deals.Count > 0) { message.TradeTime = deals[deals.Count - 1].TradeTime.ToString(); } HasChanged = true; }
/// <summary> /// 添加一个持仓id映射 /// </summary> /// <param name="hold"></param> private bool AddHoldID(XH_AccountHoldTableInfo hold) { string key = GetKey(hold.UserAccountDistributeLogo, hold.Code, hold.CurrencyTypeId); int val = hold.AccountHoldLogoId; if (holdIDCache.Contains(key)) { return(false); } holdIDCache.Add(key, val); string account = hold.UserAccountDistributeLogo; int id = hold.AccountHoldLogoId; if (holdAccountCache.Contains(account)) { SyncList <int> idList = holdAccountCache.Get(account); idList.Add(id); } else { SyncList <int> idList = new SyncList <int>(); idList.Add(id); holdAccountCache.Add(account, idList); } return(true); }
/// <summary> /// 获取资金表ID /// </summary> /// <param name="capitalAccount"></param> /// <param name="tradeCurrencyType"></param> /// <returns></returns> public int GetCapitalAccountLogo(string capitalAccount, int tradeCurrencyType) { string key = GetKey(capitalAccount, tradeCurrencyType); if (capitalIDCache.Contains(key)) { return(capitalIDCache.Get(key)); } #region add 2010-06-07 李健华 else { bool isAdd = false; //从数据库中获取再添加(同步到内存中) XH_CapitalAccountTableInfo model = persister.GetBaseFromDBByWhere(key); if (model != null) { isAdd = AddXHCapitalTableToMemory(model); } //不管添加是否成功都获取一次,因为有可能在添加的过程中有线程冲突 //if (isAdd) //{ if (capitalIDCache.Contains(key)) { return(capitalIDCache.Get(key)); } //} } #endregion return(-1); }
/// <summary> /// 根据用户ID获取基础用户信息 /// </summary> /// <param name="userId"></param> /// <returns></returns> public UA_UserBasicInformationTableInfo GetBasicUserByUserId(string userId) { if (basicUserCahce.Contains(userId)) { return(basicUserCahce.Get(userId)); } UA_UserBasicInformationTableInfo basicUser = null; try { basicUser = basicUserDal.GetModel(userId); } catch (System.Exception ex) { LogHelper.WriteError(ex.Message, ex); } if (basicUser != null) { AddUserBasicInfo(basicUser); //basicUserCahce.Add(userId, basicUser); //basicUserList.Add(basicUser); } return(basicUser); }
async Task ProcessExpiringOrExpiredAcmeCertsAsync(CancellationToken cancel) { IReadOnlyList <CertVaultCertificate> list = this.InternalCertList; AcmeClient? client = null; AcmeAccount?account = null; try { foreach (CertVaultCertificate cert in list) { if (cert.CertType == CertVaultCertType.Acme) { if (cert.Store != null) { string certHostName = cert.DirName !.GetThisDirectoryName(); if (AcmeExpiresUpdateFailedList.Get() !.Contains(certHostName) == false) { try { var certData = cert.Store.PrimaryContainer.CertificateList[0].CertData; if (IsCertificateDateTimeToUpdate(certData.NotBefore, certData.NotAfter)) { if (account == null) { client = new AcmeClient(new AcmeClientOptions(this.Settings.AcmeServiceDirectoryUrl !, this.TcpIp)); account = await client.LoginAccountAsync(this.AcmeAccountKey !, ("mailto:" + this.Settings.AcmeContactEmail)._SingleArray(), cancel); } try { await ProcessAcmeFqdnAsync(account, certHostName, cancel); } catch (Exception ex) { AcmeExpiresUpdateFailedList.Get() !.Add(certHostName); ex._Debug(); } } } catch (Exception ex) { ex._Debug(); } } } } } } finally { if (client != null) { client._DisposeSafe(); } } }
public void ProcessPushBack(HKDealOrderPushBack drsip) { var tet = drsip.HKOrderEntity; var deals = drsip.HKDealList; string entrustNumber = tet.EntrustNumber; //因为Type3的改单的改单回报有可能比这个pushback要迟,所以稍微延迟一下 //进行多次查找 bool canFind = false; for (int i = 0; i < 3; i++) { if (hkMessageCache.Contains(entrustNumber)) { canFind = true; break; } Thread.Sleep(1000); } if (!canFind) { if (!hkMessageCache.Contains(entrustNumber)) { LogHelper.WriteDebug("委托" + entrustNumber + "不存在缓存中"); return; } } var message = hkMessageCache.Get(entrustNumber); message.EntrustAmount = tet.EntrustAmount.ToString(); message.TradeAmount = tet.TradeAmount.ToString(); message.CancelAmount = tet.CancelAmount.ToString(); message.OrderMessage = tet.OrderMessage; message.OrderStatus = Utils.GetOrderStateMsg(tet.OrderStatusId); if (deals.Count > 0) { message.TradeTime = deals[deals.Count - 1].TradeTime.ToString(); } HasChanged = true; }
/// <summary> /// 获取持仓表ID /// </summary> /// <param name="holdAccount"></param> /// <param name="code"></param> /// <param name="tradeCurrencyType"></param> /// <returns></returns> public int GetAccountHoldLogoId(string holdAccount, string code, int tradeCurrencyType) { string key = GetKey(holdAccount, code, tradeCurrencyType); if (holdIDCache.Contains(key)) { return(holdIDCache.Get(key)); } return(-1); }
/// <summary> /// 类型3改单委托缓存是否存在对应的委托 /// </summary> /// <param name="entrustNumber"></param> /// <param name="request"></param> /// <returns></returns> public bool IsExistType3Request(string entrustNumber, out HKModifyOrderRequest request) { request = null; if (type3Cache.Contains(entrustNumber)) { request = type3Cache.Get(entrustNumber); return(true); } return(false); }
/// <summary> /// Create By:李健华 /// Create Date:2009-08-12 /// Title:更新缓存表中的数据用户账号状态 /// Desc.:因为用户账户信息主要有的是解冻和冻结状态的改变所以这里的更新方法主要是对 /// 解冻和冻结的更新 /// </summary> /// <param name="userID">用户ID</param> /// <param name="accountType">账号类型</param> /// <param name="state">状态</param> public void UpdateUser(string userID, int accountType, bool state) { UA_UserAccountAllocationTableInfo ua = GetAccountByUserIDAndAccountType(userID, accountType); if (ua != null) { ua.WhetherAvailable = state; accountCache.Delete(ua.UserAccountDistributeLogo); accountCache.Add(ua.UserAccountDistributeLogo, ua); } if (userCache.Contains(userID)) { var accountList = userCache.Get(userID).GetAll(); foreach (var item in accountList) { if (item.AccountTypeLogo == accountType) { item.WhetherAvailable = state; } } } }
///// <summary> ///// 获取所有的用户基础信息对象 ///// 注意:因为这里可能是没有全部加载的所以不一定是返回与数据库同步的所有用户列表所以这里注释此方法-- 注释 --李健华 2010-06-09 ///// </summary> ///// <returns></returns> //public List<UA_UserBasicInformationTableInfo> GetAllBasicUsers() //{ // return basicUserList; //} #endregion #region 用户账号信息 /// <summary> /// 根据任意账户获取账户信息 /// </summary> /// <param name="account"></param> /// <returns></returns> public UA_UserAccountAllocationTableInfo GetUserByAccount(string account) { try { account = account.Trim(); if (accountCache.Contains(account)) { return(accountCache.Get(account)); } string format = "UserAccountDistributeLogo='{0}'"; string where = string.Format(format, account); var userList = userDal.GetModel(account); if (userList != null) { //var user = userList[0]; // AddUser(user); #region 附值返回 UA_UserAccountAllocationTableInfo model = new UA_UserAccountAllocationTableInfo(); model.AccountTypeLogo = userList.AccountTypeLogo; model.UserAccountDistributeLogo = userList.UserAccountDistributeLogo; model.UserID = userList.UserID; model.WhetherAvailable = userList.WhetherAvailable; #endregion AddUser(userList); return(model); } } catch (Exception ex) { LogHelper.WriteError("根据任意账户获取账户信息" + ex.Message, ex); } return(null); }