| | |
| | | { |
| | | private readonly IRepository<LifePayRechargeReceipts, Guid> _lifePayRechargeReceiptsRepository; |
| | | private readonly IRepository<LifePayExpensesReceipts, Guid> _lifePayExpensesReceiptsRepository; |
| | | private readonly IRepository<LifePayConsumption, Guid> _lifePayConsumption; |
| | | private readonly IRepository<LifePayChannlesRake, Guid> _lifePayChannlesRakeRepository; |
| | | private readonly IRepository<LifePayOrder, Guid> _lifePayOrderRepository; |
| | | private readonly IAliPayApi _aliPayApi; |
| | |
| | | public LifePayOrderService( |
| | | IRepository<LifePayRechargeReceipts, Guid> lifePayRechargeReceiptsRepository, |
| | | IRepository<LifePayExpensesReceipts, Guid> lifePayExpensesReceiptsRepository, |
| | | IRepository<LifePayConsumption, Guid> lifePayConsumptionRepository, |
| | | IRepository<LifePayChannlesRake, Guid> lifePayChannlesRakeRepository, |
| | | IRepository<LifePayOrder, Guid> lifePayOrderRepository, |
| | | IAliPayApi aliPayApi, |
| | |
| | | { |
| | | _lifePayRechargeReceiptsRepository = lifePayRechargeReceiptsRepository; |
| | | _lifePayExpensesReceiptsRepository = lifePayExpensesReceiptsRepository; |
| | | _lifePayConsumption = lifePayConsumptionRepository; |
| | | _lifePayChannlesRakeRepository = lifePayChannlesRakeRepository; |
| | | _lifePayOrderRepository = lifePayOrderRepository; |
| | | _aliPayApi = aliPayApi; |
| | |
| | | } |
| | | |
| | | #region 查询 |
| | | |
| | | /// <summary> |
| | | /// 获取消费流水 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | public async Task<PageOutput<LifePayConsumptionListOutput>> GetLifePayConsumptionPage(LifePayConsumptionPageInput input) |
| | | { |
| | | var list = await _lifePayConsumption.Where(x => x.IsDeleted == false) |
| | | .WhereIf(input.KeyWord.IsNotNullOrEmpty(), x => x.OrderNo.Contains(input.KeyWord) || x.OutOrderNo.Contains(input.KeyWord) || x.ChannelId.Contains(input.KeyWord)) |
| | | .WhereIf(input.Flow.HasValue, x => x.Flow == input.Flow) |
| | | .WhereIf(input.TimeBegin.HasValue, x => x.FinishTime >= input.TimeBegin) |
| | | .WhereIf(input.TimeEnd.HasValue, x => x.FinishTime <= input.TimeEnd) |
| | | .Select(x => new LifePayConsumptionListOutput() |
| | | { |
| | | Id = x.Id, |
| | | OrderNo = x.OrderNo, |
| | | OutOrderNo = x.OutOrderNo, |
| | | Amount = x.Amount, |
| | | FinishTime = x.FinishTime, |
| | | FrozenStatus = x.FrozenStatus, |
| | | Flow = x.Flow, |
| | | DeductionAmount = x.DeductionAmount, |
| | | FrozenAmount = x.FrozenAmount.Value |
| | | }) |
| | | .GetPageResult(input.PageModel); |
| | | |
| | | var totalDeductionAmount = await _lifePayConsumption.Where(x => x.IsDeleted == false).SumAsync(x => x.DeductionAmount); |
| | | var totalFrozenAmount = await _lifePayConsumption.Where(x => x.IsDeleted == false).SumAsync(x => x.FrozenAmount); |
| | | LifePayConsumptionStatistics objectData = new LifePayConsumptionStatistics(); |
| | | objectData.TotalDeductionAmount = totalDeductionAmount; |
| | | objectData.TotalFrozenAmount = totalFrozenAmount.Value; |
| | | list.ObjectData = objectData; |
| | | return list; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取充值流水 |
| | | /// </summary> |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 插入收支流水 |
| | | /// </summary> |
| | |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 统计所有消费流水 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public async Task GetAllLifePayConsumption() |
| | | { |
| | | var orderList = await _lifePayOrderRepository.Where(x => x.PayStatus == LifePayStatusEnum.已支付).ToListAsync(); |
| | | |
| | | foreach (var item in orderList) |
| | | { |
| | | LifePayConsumption lifePayConsumption = new LifePayConsumption() |
| | | { |
| | | OrderNo = item.OrderNo, |
| | | OutOrderNo = item.OutOrderNo, |
| | | //Amount = item.PayAmount, |
| | | |
| | | }; |
| | | //switch (item.ACOOLYStatus) |
| | | //{ |
| | | // case ACOOLYStatusEnum.充值中: |
| | | |
| | | // break; |
| | | // default:break; |
| | | //} |
| | | } |
| | | } |
| | | |
| | | public async Task GetAllLifePayExpensesReceipts() |
| | | { |
| | | var orderlist = await (from a in _lifePayOrderRepository.Where(x => x.PayStatus >= LifePayStatusEnum.已支付) |