| | |
| | | CheckExtensions.IfTrueThrowUserFriendlyException(input.OrderNo == null, "请输入业务订单号"); |
| | | CheckExtensions.IfTrueThrowUserFriendlyException(input.RechargeAmount <= 0, "充值金额应大于0"); |
| | | CheckExtensions.IfTrueThrowUserFriendlyException(input.Voucher == null, "请提交充值凭证"); |
| | | var repeat = await _lifePayRechargeReceiptsRepository.Where(x => x.OrderNo == input.OrderNo).FirstOrDefaultAsync(); |
| | | CheckExtensions.IfTrueThrowUserFriendlyException(repeat != null && repeat.Id != input.Id, "业务订单号重复"); |
| | | var repeat = await _lifePayRechargeReceiptsRepository.Where(x => x.OrderNo == input.OrderNo && x.Id != input.Id).AnyAsync(); |
| | | CheckExtensions.IfTrueThrowUserFriendlyException(repeat, "业务订单号重复"); |
| | | if (input.Id.HasValue) |
| | | { |
| | | var payRechargeReceipts = await _lifePayRechargeReceiptsRepository.Where(x => x.Id == input.Id.Value).FirstOrDefaultAsync(); |
| | |
| | | public async Task AddLifePayExpensesReceipts(AddLifePayExpensesReceiptsInput input) |
| | | { |
| | | var repeat = await _lifePayExpensesReceiptsRepository.Where(x => x.ExpensesReceiptsType == input.ExpensesReceiptsType |
| | | && x.OrderNo == input.OrderNo).FirstOrDefaultAsync(); |
| | | if (repeat == null) |
| | | && x.OrderNo == input.OrderNo).AnyAsync(); |
| | | if (repeat) |
| | | { |
| | | var data = new LifePayExpensesReceipts() |
| | | { |
| | |
| | | await AddLifePayExpensesReceipts(input); |
| | | |
| | | /// 出账 |
| | | AddLifePayExpensesReceiptsInput receipts = new AddLifePayExpensesReceiptsInput() |
| | | { |
| | | OrderNo = item.OrderNo, |
| | | OutOrderNo = item.OutOrderNo, |
| | | LifePayType = item.LifePayType, |
| | | Amount = item.Amount, |
| | | ExpensesReceiptsType = ExpensesReceiptsTypeEnum.Expenses |
| | | }; |
| | | if (item.RefundOrderNo.IsNotNullOrEmpty()) |
| | | { |
| | | input.OutRefundNo = item.OrderNo; |
| | | input.ExpensesReceiptsType = ExpensesReceiptsTypeEnum.Receipts; |
| | | await AddLifePayExpensesReceipts(input); |
| | | |
| | | input.OutRefundNo = item.RefundOrderNo; |
| | | input.ExpensesReceiptsType = ExpensesReceiptsTypeEnum.Receipts; |
| | | await AddLifePayExpensesReceipts(input); |
| | | receipts.OutRefundNo = item.RefundOrderNo; |
| | | receipts.ExpensesReceiptsType = ExpensesReceiptsTypeEnum.Receipts; |
| | | await AddLifePayExpensesReceipts(receipts); |
| | | } |
| | | } |
| | | } |
| | |
| | | FinishTime = item.FinishTime.Value, |
| | | ChannelId = item.ChannelId, |
| | | }; |
| | | var repeat = _lifePayChannlesRakeRepository.Where(x => x.OrderNo == item.OrderNo).FirstOrDefaultAsync(); |
| | | if (repeat != null) |
| | | var repeat = await _lifePayChannlesRakeRepository.Where(x => x.OrderNo == item.OrderNo).AnyAsync(); |
| | | if (repeat) |
| | | { |
| | | await _lifePayChannlesRakeRepository.InsertAsync(lifePayChannlesRake); |
| | | } |
| | |
| | | Amount = platformDeductionAmount, |
| | | ChannelId = channelId, |
| | | }; |
| | | LifePayConsumption repeat = new LifePayConsumption(); |
| | | switch (status) |
| | | { |
| | | case ACOOLYStatusEnum.充值中: |
| | |
| | | lifePayConsumption.Flow = ConsumptionFlowEnum.Unchanged; |
| | | lifePayConsumption.DeductionAmount = 0; |
| | | lifePayConsumption.FrozenAmount = lifePayConsumption.Amount; |
| | | |
| | | repeat = await _lifePayConsumption.Where(x => x.OrderNo == lifePayConsumption.OrderNo |
| | | && x.ACOOLYStatus == lifePayConsumption.ACOOLYStatus && x.Flow == lifePayConsumption.Flow).FirstOrDefaultAsync(); |
| | | if (repeat == null) |
| | | { |
| | | await _lifePayConsumption.InsertAsync(lifePayConsumption); |
| | | } |
| | | |
| | | break; |
| | | case ACOOLYStatusEnum.已完成: |
| | | if (orderFinishTime.HasValue) |
| | |
| | | lifePayConsumption.Flow = ConsumptionFlowEnum.Out; |
| | | lifePayConsumption.DeductionAmount = lifePayConsumption.Amount; |
| | | lifePayConsumption.FrozenAmount = 0; |
| | | |
| | | repeat = await _lifePayConsumption.Where(x => x.OrderNo == lifePayConsumption.OrderNo |
| | | && x.ACOOLYStatus == lifePayConsumption.ACOOLYStatus && x.Flow == lifePayConsumption.Flow).FirstOrDefaultAsync(); |
| | | if (repeat == null) |
| | | { |
| | | await _lifePayConsumption.InsertAsync(lifePayConsumption); |
| | | } |
| | | |
| | | break; |
| | | case ACOOLYStatusEnum.充值失败: |
| | | lifePayConsumption.FinishTime = orderCreationTime; |
| | |
| | | lifePayConsumption.Flow = ConsumptionFlowEnum.Unchanged; |
| | | lifePayConsumption.DeductionAmount = 0; |
| | | lifePayConsumption.FrozenAmount = lifePayConsumption.Amount; |
| | | |
| | | repeat = await _lifePayConsumption.Where(x => x.OrderNo == lifePayConsumption.OrderNo |
| | | && x.ACOOLYStatus == lifePayConsumption.ACOOLYStatus && x.Flow == lifePayConsumption.Flow).FirstOrDefaultAsync(); |
| | | if (repeat == null) |
| | | { |
| | | await _lifePayConsumption.InsertAsync(lifePayConsumption); |
| | | } |
| | | |
| | | break; |
| | | case ACOOLYStatusEnum.已退款: |
| | | lifePayConsumption.FinishTime = orderFinishTime.Value; |
| | | if (orderFinishTime.HasValue) |
| | | { |
| | | lifePayConsumption.FinishTime = orderFinishTime.Value; |
| | | } |
| | | |
| | | lifePayConsumption.ACOOLYStatus = ACOOLYStatusEnum.已退款; |
| | | lifePayConsumption.FrozenStatus = ConsumptionFrozenStatusEnum.Thaw; |
| | | lifePayConsumption.Flow = ConsumptionFlowEnum.Unchanged; |
| | | lifePayConsumption.DeductionAmount = 0; |
| | | lifePayConsumption.FrozenAmount = 0; |
| | | |
| | | repeat = await _lifePayConsumption.Where(x => x.OrderNo == lifePayConsumption.OrderNo |
| | | && x.ACOOLYStatus == lifePayConsumption.ACOOLYStatus && x.Flow == lifePayConsumption.Flow).FirstOrDefaultAsync(); |
| | | if (repeat == null) |
| | | { |
| | | await _lifePayConsumption.InsertAsync(lifePayConsumption); |
| | | } |
| | | |
| | | break; |
| | | |
| | | //case ACOOLYStatusEnum.部分充值成功: |
| | | // lifePayConsumption.FinishTime = orderCreationTime; |
| | | // lifePayConsumption.ACOOLYStatus = ACOOLYStatusEnum.部分充值成功; |
| | |
| | | // break; |
| | | default: break; |
| | | } |
| | | |
| | | var repeat = await _lifePayConsumption.Where(x => x.OrderNo == lifePayConsumption.OrderNo |
| | | && x.ACOOLYStatus == lifePayConsumption.ACOOLYStatus && x.Flow == lifePayConsumption.Flow).AnyAsync(); |
| | | if (repeat) |
| | | { |
| | | await _lifePayConsumption.InsertAsync(lifePayConsumption); |
| | | } |
| | | } |
| | | |
| | | private async Task<IQueryable<LifePayChannlesRakeListOutput>> GetLifePayChannlesRakeListFilter(LifePayChannlesRakePageInput input) |