示例#1
0
        /// <summary>
        /// 创建比例关系
        /// </summary>
        /// <param name="item"></param>
        /// <param name="onSellAssetDto"></param>
        /// <param name="allocateAmount"></param>
        /// <returns></returns>
        private static Tuple <UserAssetRatio, UserAssetRatio> CreateUserAssetRatio(YemUserProductDto item, OnSellAssetDto onSellAssetDto, long allocateAmount)
        {
            UserAssetRatio userAssetRatio = new UserAssetRatio
            {
                AssetCategoryCode        = onSellAssetDto.AssetCategoryCode,
                AssetId                  = onSellAssetDto.OnSellAssetId,
                BillDueDate              = onSellAssetDto.BillDueDate,
                Capital                  = allocateAmount,
                Cellphone                = item.Cellphone,
                CredentialNo             = item.CredentialNo,
                Denominator              = onSellAssetDto.PresentValue,
                IsInvestSuccess          = true, //用户资产已报备
                IsNotifyTradingSuccess   = true, //已通知交易系统
                IsReturned               = false,
                NotifyTradingRespInfo    = "Mock",
                NotifyTradingTime        = DateTime.UtcNow.ToChinaStandardTime(),
                Numerator                = allocateAmount,
                OrderId                  = item.OrderId,
                OrderTime                = item.OrderTime,
                OriginalUserAssetRatioId = Guid.NewGuid().ToGuidString(),
                PurchaseMoney            = item.PurchaseMoney,
                Reserve                  = "1", //放款成功
                Status           = 4,           //用户资产报备成功
                UserId           = item.UserId,
                UserName         = item.UserName,
                UserPresentValue = 0,
                CreatedBy        = "System",
                CreatedTime      = DateTime.UtcNow.ToChinaStandardTime(),
                UpdatedBy        = "System",
                UpdatedTime      = DateTime.UtcNow.ToChinaStandardTime(),
                PartitionKey     = item.UserId,
                ETag             = DateTime.UtcNow.ToChinaStandardTime().UnixTimestamp().ToString()
            };

            userAssetRatio.UserAssetRatioId = userAssetRatio.OriginalUserAssetRatioId;
            userAssetRatio.RowKey           = userAssetRatio.AssetId + "_" + userAssetRatio.UserAssetRatioId;

            //资产用户关系
            var assetUserRatio = MapToUserAssetRatio(userAssetRatio);

            return(Tuple.Create(userAssetRatio, assetUserRatio));
        }
示例#2
0
        /// <summary>
        ///     检查是否包含没有删除的用户资产比例
        /// </summary>
        /// <param name="userAssetRatios"></param>
        /// <returns></returns>
        public static async Task <bool> CheckRedisUserAssetRatioAsync(IEnumerable <UserAssetRatio> userAssetRatios)
        {
            try
            {
                foreach (UserAssetRatio subItem in userAssetRatios)
                {
                    UserAssetRatio userAssetItem = await database.HashGetFromCacheAsync <UserAssetRatio>("UserAssetRelation", subItem.UserId, subItem.UserAssetRatioId);

                    if (userAssetItem != null)
                    {
                        return(false);
                    }
                }
                return(true);
            }
            // ReSharper disable once EmptyGeneralCatchClause
            catch (Exception ex)
            {
                Logger.Logw(ex.Message + "------CheckRedisUserAssetRatioAsync", 3);
                return(false);
            }
        }
示例#3
0
        private static UserAssetRatio MapToUserAssetRatio(UserAssetRatio oldUserAssetRatio)
        {
            UserAssetRatio newAssetUserRatio = new UserAssetRatio
            {
                AssetCategoryCode        = oldUserAssetRatio.AssetCategoryCode,
                AssetId                  = oldUserAssetRatio.AssetId,
                BillDueDate              = oldUserAssetRatio.BillDueDate,
                Capital                  = oldUserAssetRatio.Capital,
                Cellphone                = oldUserAssetRatio.Cellphone,
                CredentialNo             = oldUserAssetRatio.CredentialNo,
                Denominator              = oldUserAssetRatio.Denominator,
                IsInvestSuccess          = oldUserAssetRatio.IsInvestSuccess,        //用户资产已报备
                IsNotifyTradingSuccess   = oldUserAssetRatio.IsNotifyTradingSuccess, //已通知交易系统
                IsReturned               = oldUserAssetRatio.IsReturned,
                NotifyTradingRespInfo    = oldUserAssetRatio.NotifyTradingRespInfo,
                NotifyTradingTime        = oldUserAssetRatio.NotifyTradingTime,
                Numerator                = oldUserAssetRatio.Numerator,
                OrderId                  = oldUserAssetRatio.OrderId,
                OrderTime                = oldUserAssetRatio.OrderTime,
                OriginalUserAssetRatioId = oldUserAssetRatio.OriginalUserAssetRatioId,
                PurchaseMoney            = oldUserAssetRatio.PurchaseMoney,
                Reserve                  = oldUserAssetRatio.Reserve, //放款成功
                Status           = oldUserAssetRatio.Status,          //用户资产报备成功
                UserId           = oldUserAssetRatio.UserId,
                UserName         = oldUserAssetRatio.UserName,
                UserPresentValue = oldUserAssetRatio.UserPresentValue,
                CreatedBy        = oldUserAssetRatio.CreatedBy,
                CreatedTime      = oldUserAssetRatio.CreatedTime,
                UpdatedBy        = oldUserAssetRatio.UpdatedBy,
                UpdatedTime      = oldUserAssetRatio.UpdatedTime,
                PartitionKey     = oldUserAssetRatio.AssetId,
                ETag             = DateTime.UtcNow.ToChinaStandardTime().UnixTimestamp().ToString()
            };

            newAssetUserRatio.UserAssetRatioId = oldUserAssetRatio.OriginalUserAssetRatioId;
            newAssetUserRatio.RowKey           = oldUserAssetRatio.UserId + "_" + oldUserAssetRatio.UserAssetRatioId;
            return(newAssetUserRatio);
        }