private static YemUserProductDto BuildYemUserProduct(YemUserProductDto yemUserProductDto, long allocateAmount) { var newYemUserProductDto = yemUserProductDto.MapToYemUserProductDto(); newYemUserProductDto.Allocated += allocateAmount; newYemUserProductDto.Status = newYemUserProductDto.PurchaseMoney == newYemUserProductDto.Allocated ? PurchaseOrderStatus.AllocationComplete.ToEnumInteger() : PurchaseOrderStatus.AllocationOn.ToEnumInteger(); newYemUserProductDto.WaitingBankBackAmount = 0; newYemUserProductDto.UpdatedTime = DateTime.UtcNow.ToChinaStandardTime(); return(newYemUserProductDto); }
//购买订单还原 public static async Task ResetPurchaseAsync(CloudTableClient tableClient, string writeYemUserProductAzureTable, YemUserProductDto yemUserProductDto, long currentDealPurchaseAmount) { var resetPurchase = yemUserProductDto.MapToYemUserProductDto(); resetPurchase.RemainingAmount += currentDealPurchaseAmount; resetPurchase.Allocated -= currentDealPurchaseAmount; resetPurchase.Status = resetPurchase.PurchaseMoney == resetPurchase.Allocated ? PurchaseOrderStatus.AllocationComplete.ToEnumInteger() : PurchaseOrderStatus.AllocationOn.ToEnumInteger(); resetPurchase.WaitingBankBackAmount = 0; resetPurchase.UpdatedTime = DateTime.UtcNow.ToChinaStandardTime(); await AddYemUserPurchase(tableClient, yemUserProductDto, writeYemUserProductAzureTable); }
/// <summary> /// 记错误日志 /// </summary> /// <param name="lastOnSellAssetDtos"></param> /// <param name="assetuserRatios"></param> /// <param name="yemUserProductDto"></param> /// <param name="currentDealPurchaseAmount"></param> /// <param name="userAssetRatios"></param> /// <returns></returns> private static async Task AddLogAsync(List <OnSellAssetDto> lastOnSellAssetDtos, List <UserAssetRatio> userAssetRatios, List <UserAssetRatio> assetuserRatios, YemUserProductDto yemUserProductDto, long currentDealPurchaseAmount) { ResetYemUserPurchase resetYemUserPurchase = new ResetYemUserPurchase(); resetYemUserPurchase.OrderId = yemUserProductDto.OrderId; resetYemUserPurchase.YemUserProductDto = yemUserProductDto.MapToYemUserProductDto(); resetYemUserPurchase.CurrentDealPurchaseAmount = currentDealPurchaseAmount; Logger.Logw("ErrorOldLastOnSellAsset", lastOnSellAssetDtos.ToJson()); Logger.Logw("ErrorOldYemUserPurchase", resetYemUserPurchase.ToJson()); Logger.Logw("ErrorOldUserAssetRatio", userAssetRatios.ToJson()); Logger.Logw("ErrorOldAssetUserRatio", assetuserRatios.ToJson()); //记Redis await RedisHelper.SetRedisOnSellAssetByOldAsync(lastOnSellAssetDtos); await RedisHelper.SetRedisUserAssetRatioByOldAsync(userAssetRatios); await RedisHelper.SetRedisAssetUserRatioByOldAsync(assetuserRatios); await RedisHelper.SetRedisYemUserPurchaseByOldAsync(resetYemUserPurchase); }