/// <summary>
 ///     根据资产id查询一个资产是否正确
 /// </summary>
 /// <param name="asseId"></param>
 /// <param name="reidsHelperSpecial"></param>
 /// <param name="dbNumber"></param>
 /// <returns></returns>
 private bool CheckAssetInfo(string asseId, int dbNumber, RedisHelperSpecial reidsHelperSpecial)
 {
     try
     {
         //获取Asset对象
         CloudTable assertIdsTable = this.tableClient.GetTableReference(this.loadAppSettings.SearchAssetAzureTable);
         TableQuery <OnSellAssetDto> queryOnSellAsset = new TableQuery <OnSellAssetDto>()
                                                        .Where($"RowKey eq '{asseId}' and IsLock eq false"); //
         //queryPurchaseOrder = new TableQuery<YemUserProductDto>()
         //    .Where($"PartitionKey eq '{yemUserPurchase}' and RemainingAmount gt 0 and IsLock eq false");
         OnSellAssetDto onSellAssetDto = assertIdsTable.ExecuteQuery(queryOnSellAsset).FirstOrDefault();
         //获取融资金额以及剩余金额
         if (onSellAssetDto == null)
         {
             //记录下来
             Logger.LoadData(@"CheckOneRedisUserAssetInfo\ErrorInfo.txt", $"{asseId}:根据assetid拉取AzureTable数据异常" + DateTime.UtcNow.ToChinaStandardTime());
             return(false);
         }
         long calculatedAmount = onSellAssetDto.PresentValue;
         long remainAmount     = onSellAssetDto.RemainderTotal;
         //再从redis中拉出所有的资产的下对应
         List <UserAssetRatio> listAssetUserInfos = new RedisHelperSpecial(dbNumber).GetRedisAssetUserRatiosAsync(asseId).ToList();
         long sumSellAmount = 0;
         if (listAssetUserInfos.Count > 0)
         {
             sumSellAmount += listAssetUserInfos.Sum(info => info.Capital);
         }
         //从收尾那边拉出所有的资产比例
         List <UserAssetRatio> listEndAssetUserInfos = reidsHelperSpecial.GetRedisAssetUserRatiosAsync(asseId).ToList();
         if (listEndAssetUserInfos.Count > 0)
         {
             sumSellAmount += listEndAssetUserInfos.Sum(info => info.Capital);
         }
         //List<UserAssetRatio>
         if (calculatedAmount - sumSellAmount != remainAmount)
         {
             //记录下来
             Logger.LoadData(@"CheckOneRedisUserAssetInfo\ErrorInfo.txt", $"{asseId}:该资产剩余金额不等于该资产总融资金额减去该资产下用户购买金额之和" + DateTime.UtcNow.ToChinaStandardTime());
             return(false);
         }
         return(true);
     }
     catch (Exception e)
     {
         Logger.LoadData(@"CheckOneRedisUserAssetInfo\Error.txt", $"{asseId}:该资产发生异常{e.Message}");
         return(false);
     }
 }
 /// <summary>
 ///     根据用户id查看用户购买订单是否正确
 /// </summary>
 /// <param name="userId"></param>
 /// <param name="dbNumber"></param>
 /// <param name="redisHelperSpecial"></param>
 /// <returns></returns>
 private bool CheckPurchaseOrderInfo(string userId, int dbNumber, List <YemUserProductDto> yemUserProductDtos, RedisHelperSpecial redisHelperSpecial)
 {
     try
     {
         //获取Asset对象
         //string oldPurchaseOrder = "OldPurchaseOrder";
         //CloudTable assertIdsTable = this.tableClient.GetTableReference(this.loadAppSettings.SearchUserInfoAzureTable);
         //TableQuery<YemUserProductDto> queryYemProduct = new TableQuery<YemUserProductDto>()
         //    .Where($"PartitionKey eq  '{oldPurchaseOrder}'  and IsLock eq false and UserId eq '{userId}'");
         //YemUserProductDto yemUserProductDto = assertIdsTable.ExecuteQuery(queryYemProduct).FirstOrDefault();
         YemUserProductDto yemUserProductDto = yemUserProductDtos.FirstOrDefault(p => p.UserId == userId);
         //获取融资金额以及剩余金额
         if (yemUserProductDto == null)
         {
             //记录下来
             Logger.LoadData(@"CheckOneRedisUserAssetInfo\ErrorInfoUserInfo.txt", $"{userId}:根据userId拉取AzureTable数据异常---" + DateTime.UtcNow.ToChinaStandardTime());
             return(false);
         }
         long purchaseAmount  = yemUserProductDto.PurchaseMoney;
         long remainingAmount = yemUserProductDto.RemainingAmount;
         //再从reedis中拉出所有的资产的下对应
         List <UserAssetRatio> listUserAssetInfos = new RedisHelperSpecial(dbNumber).GetRedisUserAssetRatiosAsync(userId).ToList();
         long sumPurchaseAmount = 0;
         if (listUserAssetInfos.Count > 0)
         {
             sumPurchaseAmount += listUserAssetInfos.Sum(info => info.Capital);
         }
         //最后的节点
         List <UserAssetRatio> listEndUserAssetinfos = redisHelperSpecial.GetRedisUserAssetRatiosAsync(userId).ToList();
         if (listEndUserAssetinfos.Count > 0)
         {
             sumPurchaseAmount += listEndUserAssetinfos.Sum(info => info.Capital);
         }
         if (purchaseAmount - sumPurchaseAmount != remainingAmount)
         {
             //记录下来
             Logger.LoadData(@"CheckOneRedisUserAssetInfo\ErrorInfoUserInfo.txt", $"{userId}:该用户购买订单总购买金额减去所有本金不等于剩余金额" + DateTime.UtcNow.ToChinaStandardTime());
             return(false);
         }
         return(true);
     }
     catch (Exception e)
     {
         Logger.LoadData(@"CheckOneRedisUserAssetInfo\Error.txt", $"{userId}:该资产发生异常{e.Message}");
         return(false);
     }
 }