| | |
| | | private readonly IRepository<LifePayRechargeReceipts, Guid> _lifePayRechargeReceiptsRepository; |
| | | private readonly IRepository<LifePayExpensesReceipts, Guid> _lifePayExpensesReceiptsRepository; |
| | | private readonly IRepository<LifePayConsumption, Guid> _lifePayConsumption; |
| | | private readonly IRepository<LifePayChannles, Guid> _lifePayChannlesRep; |
| | | private readonly IRepository<LifePayChannlesRake, Guid> _lifePayChannlesRakeRepository; |
| | | private readonly IRepository<LifePayOrder, Guid> _lifePayOrderRepository; |
| | | private readonly IAliPayApi _aliPayApi; |
| | |
| | | IRepository<LifePayExpensesReceipts, Guid> lifePayExpensesReceiptsRepository, |
| | | IRepository<LifePayConsumption, Guid> lifePayConsumptionRepository, |
| | | IRepository<LifePayChannlesRake, Guid> lifePayChannlesRakeRepository, |
| | | IRepository<LifePayChannles, Guid> lifePayChannlesRep, |
| | | IRepository<LifePayOrder, Guid> lifePayOrderRepository, |
| | | IAliPayApi aliPayApi, |
| | | IWxPayApi wxPayApi) |
| | |
| | | _lifePayExpensesReceiptsRepository = lifePayExpensesReceiptsRepository; |
| | | _lifePayConsumption = lifePayConsumptionRepository; |
| | | _lifePayChannlesRakeRepository = lifePayChannlesRakeRepository; |
| | | _lifePayChannlesRep = lifePayChannlesRep; |
| | | _lifePayOrderRepository = lifePayOrderRepository; |
| | | _aliPayApi = aliPayApi; |
| | | _wxPayApi = wxPayApi; |
| | |
| | | /// <returns></returns> |
| | | public async Task<PageOutput<LifePayConsumptionListOutput>> GetLifePayConsumptionPage(LifePayConsumptionPageInput input) |
| | | { |
| | | var channles = await _lifePayChannlesRep.Where(x => x.ChannlesName.Contains(input.KeyWord)).Select(x => x.ChannlesNum).ToListAsync(); |
| | | 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.KeyWord.IsNotNullOrEmpty(), x => x.OrderNo.Contains(input.KeyWord) || x.AcoolyOrderNo.Contains(input.KeyWord) || channles.Contains(x.ChannelId)) |
| | | .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, |
| | | AcoolyOrderNo = x.AcoolyOrderNo, |
| | | Amount = x.Amount, |
| | | ACOOLYStatus = x.ACOOLYStatus, |
| | | FinishTime = x.FinishTime, |
| | | FrozenStatus = x.FrozenStatus, |
| | | Flow = x.Flow, |
| | | DeductionAmount = x.DeductionAmount, |
| | | FrozenAmount = x.FrozenAmount.Value |
| | | }) |
| | | .GetPageResult(input.PageModel); |
| | | |
| | | var total = await _lifePayRechargeReceiptsRepository.Where(x => x.IsDeleted == false).SumAsync(x => x.RechargeAmount); |
| | | LifePayRechargeReceiptsStatistics objectData = new LifePayRechargeReceiptsStatistics(); |
| | | objectData.TotalRechargeAmount = total; |
| | | 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> |
| | | /// <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, |
| | | AcoolyOrderNo = item.ACOOLYOrderNo, |
| | | Amount = item.PlatformDeductionAmount.Value, |
| | | }; |
| | | |
| | | switch (item.ACOOLYStatus) |
| | | { |
| | | case ACOOLYStatusEnum.充值中: |
| | | lifePayConsumption.FinishTime = item.CreationTime; |
| | | lifePayConsumption.ACOOLYStatus = ACOOLYStatusEnum.充值中; |
| | | lifePayConsumption.FrozenStatus = ConsumptionFrozenStatusEnum.Frozen; |
| | | lifePayConsumption.Flow = ConsumptionFlowEnum.Unchanged; |
| | | lifePayConsumption.DeductionAmount = 0; |
| | | lifePayConsumption.FrozenAmount = lifePayConsumption.Amount; |
| | | break; |
| | | default: break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | public async Task GetAllLifePayExpensesReceipts() |
| | | { |
| | | var orderlist = await (from a in _lifePayOrderRepository.Where(x => x.PayStatus >= LifePayStatusEnum.已支付) |