|  |  | 
 |  |  | using LifePayment.Application.Contracts; | 
 |  |  | using Alipay.AopSdk.F2FPay.Model; | 
 |  |  | using LifePayment.Application.Contracts; | 
 |  |  | using LifePayment.Application.LifePay; | 
 |  |  | using LifePayment.Domain.Common; | 
 |  |  | using LifePayment.Domain.Shared; | 
 |  |  | using Microsoft.AspNetCore.Authorization; | 
 |  |  | using Microsoft.AspNetCore.Mvc; | 
 |  |  | 
 |  |  |     public class LifePayController : AbpController | 
 |  |  |     { | 
 |  |  |         private readonly ILifePayService _lifePayService; | 
 |  |  |         private readonly IStatisticsService _statisticsService; | 
 |  |  |         private readonly IWebClientInfoProvider _webClientInfoProvider; | 
 |  |  |         private readonly ICommonService _commonService; | 
 |  |  |         private readonly ILifePayOrderService _lifePayOrderService; | 
 |  |  |         private readonly ILogger<LifePayController> _logger; | 
 |  |  |         public LifePayController( | 
 |  |  |               ILifePayService lifePayService, | 
 |  |  |               IWebClientInfoProvider webClientInfoProvider | 
 |  |  |             , ILogger<LifePayController> logger | 
 |  |  |               IStatisticsService statisticsService, | 
 |  |  |               IWebClientInfoProvider webClientInfoProvider, | 
 |  |  |               ICommonService commonService, | 
 |  |  |               ILifePayOrderService lifePayOrderService, | 
 |  |  |               ILogger<LifePayController> logger | 
 |  |  |               ) | 
 |  |  |         { | 
 |  |  |             _lifePayService = lifePayService; | 
 |  |  |             _statisticsService = statisticsService; | 
 |  |  |             _webClientInfoProvider = webClientInfoProvider; | 
 |  |  |             _commonService = commonService; | 
 |  |  |             _lifePayOrderService = lifePayOrderService; | 
 |  |  |             _logger = logger; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [HttpGet] | 
 |  |  |         [AllowAnonymous] | 
 |  |  |         public async Task<TopStatisticsOutput> GetTopStatistics() | 
 |  |  |         public async Task<TopStatisticsOutput> GetTopStatistics(string channleId = "") | 
 |  |  |         { | 
 |  |  |             return await _lifePayService.GetTopStatistics(); | 
 |  |  |             return await _statisticsService.GetTopStatistics(channleId); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 获取渠道折扣 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [HttpPost] | 
 |  |  |         [AllowAnonymous] | 
 |  |  |         public async Task<ChannelRateOutput> GetChannelRate(ChannelsBaseInput input) | 
 |  |  |         { | 
 |  |  |             return await _lifePayService.GetChannelRate(input); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 获取手续费费率 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <returns></returns> | 
 |  |  | 
 |  |  |             return await _lifePayService.GetIntroInfo(type); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 获取在线客服 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [HttpGet] | 
 |  |  |         [AllowAnonymous] | 
 |  |  |         public async Task<string> GetOnlineService() | 
 |  |  |         { | 
 |  |  |             return await _commonService.GetOnlineService(); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 获取用户分页数据 | 
 |  |  | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 获取订单分页数据 | 
 |  |  |         /// 获取退款订单分页数据 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <param name="input"></param> | 
 |  |  |         /// <returns></returns> | 
 |  |  | 
 |  |  |                 var bytes = ExcelHelper.ListToByteForExcel(data, "xlsx"); | 
 |  |  |                 return File(bytes, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "订单管理" + ".xlsx"); | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             return Json(default); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 导出退款订单Excel | 
 |  |  |         /// </summary> | 
 |  |  |         /// <param name="input"></param> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [HttpPost] | 
 |  |  |         public async Task<ActionResult> GetLifePayRefudOrderPageExport(QueryLifePayRefundOrderListInput input) | 
 |  |  |         { | 
 |  |  |             var data = await _lifePayService.GetLifePayRefudOrderPageExport(input); | 
 |  |  |             if (data.Any()) | 
 |  |  |             { | 
 |  |  |                 var bytes = ExcelHelper.ListToByteForExcel(data, "xlsx"); | 
 |  |  |                 return File(bytes, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "退款管理" + ".xlsx"); | 
 |  |  |             } | 
 |  |  |             return Json(default); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         [HttpGet] | 
 |  |  |         public async Task<string> GetBillErceiptExport(string orderNo) | 
 |  |  |         { | 
 |  |  |             var data = await _lifePayService.GetBillErceiptExport(orderNo); | 
 |  |  |             | 
 |  |  |  | 
 |  |  |             return data; | 
 |  |  |         } | 
 |  |  |         /// <summary> | 
 |  |  |         /// 获取充值流水分页数据 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <param name="input"></param> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [HttpPost] | 
 |  |  |         public async Task<PageOutput<LifePayRechargeReceiptsListOutput>> GetLifePayRechargeReceiptsPage(LifePayRechargeReceiptsPageInput input) | 
 |  |  |         { | 
 |  |  |             return await _lifePayOrderService.GetLifePayRechargeReceiptsPage(input); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 获取收支流水分页数据 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <param name="input"></param> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [HttpPost] | 
 |  |  |         public async Task<PageOutput<LifePayExpensesReceiptsListOutput>> GetLifePayExpensesReceiptsPage(LifePayExpensesReceiptsPageInput input) | 
 |  |  |         { | 
 |  |  |             return await _lifePayOrderService.GetLifePayExpensesReceiptsPage(input); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 查询支付宝支付订单信息 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <param name="input"></param> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [HttpPost] | 
 |  |  |         [AllowAnonymous] | 
 |  |  |         public async Task<Alipay.EasySDK.Payment.Common.Models.AlipayTradeQueryResponse> QueryAlipayTrade(OrderInQuiryInput input) | 
 |  |  |         { | 
 |  |  |             var res = await _lifePayService.QueryAlipayTrade(input); | 
 |  |  |             //await _lifePayOrderService.AddLifePayExpensesReceipts(new AddLifePayExpensesReceiptsInput() | 
 |  |  |             //{ | 
 |  |  |             //    OrderNo = input.OutTradeNo, | 
 |  |  |             //    OutOrderNo = res.TradeNo, | 
 |  |  |             //    LifePayType = LifePayTypeEnum.AliPay, | 
 |  |  |             //    ExpensesReceiptsType = ExpensesReceiptsTypeEnum.Expenses, | 
 |  |  |             //    Amount = Convert.ToDecimal(res.ReceiptAmount) | 
 |  |  |             //}); | 
 |  |  |             return res; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 查询支付宝退款订单信息 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <param name="input"></param> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [HttpPost] | 
 |  |  |         [AllowAnonymous] | 
 |  |  |         public async Task<Alipay.EasySDK.Payment.Common.Models.AlipayTradeFastpayRefundQueryResponse> QueryAlipayTradeRefund(OrderInQuiryInput input) | 
 |  |  |         { | 
 |  |  |             return await _lifePayService.QueryAlipayTradeRefund(input); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 查询微信退款信息 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <param name="outTradeNo"></param> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [HttpGet] | 
 |  |  |         [AllowAnonymous] | 
 |  |  |         public async Task<WxPayDomesticRefundsQueryReponse> WxPayDomesticRefundsQuery(string outTradeNo) | 
 |  |  |         { | 
 |  |  |             var res = await _lifePayService.WxPayDomesticRefundsQuery(outTradeNo); | 
 |  |  |             await _lifePayOrderService.AddLifePayExpensesReceipts(new AddLifePayExpensesReceiptsInput() | 
 |  |  |             { | 
 |  |  |                 OrderNo = res.OutTradeNo, | 
 |  |  |                 OutOrderNo = res.TransactionId, | 
 |  |  |                 LifePayType = LifePayTypeEnum.WxPay, | 
 |  |  |                 ExpensesReceiptsType = ExpensesReceiptsTypeEnum.Expenses, | 
 |  |  |                 Amount = Convert.ToDecimal(res.Amount.Total) | 
 |  |  |             }); | 
 |  |  |             return res; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 查询微信订单信息 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <param name="outTradeNo"></param> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [HttpGet] | 
 |  |  |         [AllowAnonymous] | 
 |  |  |         public async Task<WxPayTradeQueryReponse> WxPayTradeQuery(string outTradeNo) | 
 |  |  |         { | 
 |  |  |             var res = await _lifePayService.WxPayTradeQuery(outTradeNo); | 
 |  |  |             await _lifePayOrderService.AddLifePayExpensesReceipts(new AddLifePayExpensesReceiptsInput() | 
 |  |  |             { | 
 |  |  |                 OrderNo = res.OutTradeNo, | 
 |  |  |                 OutOrderNo = res.TransactionId, | 
 |  |  |                 LifePayType = LifePayTypeEnum.WxPay, | 
 |  |  |                 ExpensesReceiptsType = ExpensesReceiptsTypeEnum.Expenses, | 
 |  |  |                 Amount = Convert.ToDecimal(res.Amount.Total) | 
 |  |  |             }); | 
 |  |  |             return res; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 同步订单收支信息 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [HttpGet] | 
 |  |  |         [AllowAnonymous] | 
 |  |  |         public async Task GetAllLifePayExpensesReceipts() | 
 |  |  |         { | 
 |  |  |             await _lifePayOrderService.GetAllLifePayExpensesReceipts(); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |          | 
 |  |  |  | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  | 
 |  |  |         public async Task<CreateLifePayOrderOutput> CreateLifePayGasOrder(CreateLifePayOrderInput<LifeGasData> input) | 
 |  |  |         { | 
 |  |  |             return await _lifePayService.CreateLifePayGasOrder(input); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 修改实际到账金额 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <param name="input"></param> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [HttpPost] | 
 |  |  |         public async Task<int> UpdateLifePayOrderActualReceivedAmount(UpdateLifePayOrderInput input) | 
 |  |  |         { | 
 |  |  |             return await _lifePayService.UpdateLifePayOrderActualReceivedAmount(input); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 在线客服配置 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <param name="input"></param> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [HttpPost] | 
 |  |  |         public async Task<int> UpdateOnlineService(OnlineServiceInput input) | 
 |  |  |         { | 
 |  |  |             await _commonService.UpdateOnlineService(input); | 
 |  |  |             return Constant.SUCCESS; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 上传充值流水 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <param name="input"></param> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [HttpPost] | 
 |  |  |         public async Task<int> AddUpdatePayRechargeReceipts(AddUpdatePayRechargeReceiptsInput input) | 
 |  |  |         { | 
 |  |  |             await _lifePayOrderService.AddUpdatePayRechargeReceipts(input); | 
 |  |  |             return Constant.SUCCESS; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 设置生活缴费支付类型 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <param name="input"></param> |