示例#1
0
        private static OnSellAssetDto BuildOnSellAsset(OnSellAssetDto assetItem, long allocateAmount)
        {
            var newOnSellAsset = assetItem;

            newOnSellAsset.ValueStatus = true;
            newOnSellAsset.UpdatedTime = DateTime.UtcNow.ToChinaStandardTime();
            if (newOnSellAsset.BillAccrualDate != null && newOnSellAsset.BillAccrualDate.Value.Date <= new DateTime(1900, 1, 1).Date)
            {
                newOnSellAsset.BillAccrualDate = DateTime.UtcNow.ToChinaStandardTime();
            }

            if (newOnSellAsset.GrowthTime != null && newOnSellAsset.GrowthTime.Value.Date <= new DateTime(1900, 1, 1).Date)
            {
                newOnSellAsset.GrowthTime     = DateTime.UtcNow.ToChinaStandardTime(); //第一次增值时间
                newOnSellAsset.LastGrowthTime = newOnSellAsset.GrowthTime;             //上一次增值时间
            }
            newOnSellAsset.YemBidIsReported = true;
            newOnSellAsset.SellAmount      += allocateAmount;
            if (newOnSellAsset.RemainderTotal == 0)
            {
                if (newOnSellAsset.PresentValue == newOnSellAsset.SellAmount) //售卖金额等于融资金额
                {
                    newOnSellAsset.SellAmount     = newOnSellAsset.CalculatedAmount;
                    newOnSellAsset.RemainderTotal = 0;
                    newOnSellAsset.RaiseStatus    = true;
                    newOnSellAsset.Status         = 15; //用户回款状态
                    newOnSellAsset.SellOutTime    = DateTime.UtcNow.ToChinaStandardTime();
                }
            }
            return(newOnSellAsset);
        }
示例#2
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));
        }