| | |
| | | using LifePayment.Application.Contracts; |
| | | using Alipay.AopSdk.F2FPay.Model; |
| | | using LifePayment.Application.Contracts; |
| | | using LifePayment.Application.LifePay; |
| | | using LifePayment.Domain; |
| | | 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; |
| | | } |
| | | |
| | | #region 查询 |
| | | |
| | | /// <summary> |
| | | /// 获取顶部统计数据 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [AllowAnonymous] |
| | | public async Task<TopStatisticsOutput> GetTopStatistics(TopStatisticsInput input) |
| | | { |
| | | return await _statisticsService.GetTopStatistics(input.ChannleList); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取30日收款统计 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [AllowAnonymous] |
| | | public async Task<ReceiptsListOutPut> GetReceiptsList(TopStatisticsInput input) |
| | | { |
| | | return await _statisticsService.GetReceiptsList(input.ChannleList); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 渠道数据 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [AllowAnonymous] |
| | | public async Task<ChannelDataListOutPut> GetChannelDataList(TopStatisticsInput input) |
| | | { |
| | | return await _statisticsService.GetChannelDataList(input.ChannleList); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 30日佣金列表 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [AllowAnonymous] |
| | | public async Task<ChannlesRakeListOutPut> GetChannlesRakeList(TopStatisticsInput input) |
| | | { |
| | | return await _statisticsService.GetChannlesRakeList(input.ChannleList); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取电费面值 |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取燃气支持商户 |
| | | /// 添加日志 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | |
| | | |
| | | public async Task<int> AddLogger(LogErrorInput input) |
| | | { |
| | | Logger.LogError(input.Error); |
| | | Logger.LogError("前端错误:" + input.Error); |
| | | return Constant.SUCCESS; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取渠道折扣 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [AllowAnonymous] |
| | | public async Task<ChannelRateOutput> GetChannelRate(ChannelsBaseInput input) |
| | | { |
| | | return await _lifePayService.GetChannelRate(input); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取手续费费率 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | [AllowAnonymous] |
| | | public async Task<List<LifePayPremiumListOutput>> GetPremium() |
| | | { |
| | | return await _lifePayService.GetPremium(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取须知 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | [AllowAnonymous] |
| | | public async Task<List<LifePayIntroInfoOutput>> GetIntroInfo(LifePayOrderTypeEnum type) |
| | | { |
| | | return await _lifePayService.GetIntroInfo(type); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取在线客服 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | [AllowAnonymous] |
| | | public async Task<string> GetOnlineService() |
| | | { |
| | | return await _commonService.GetOnlineService(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取用户分页数据 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public async Task<PageOutput<UserListOutput>> GetUserPage(PageInput input) |
| | | public async Task<PageOutput<UserListOutput>> GetUserPage(QueryUserPageInput input) |
| | | { |
| | | return await _lifePayService.GetUserPage(input); |
| | | } |
| | |
| | | public async Task<PageOutput<LifePayOrderListOutput>> GetLifePayOrderPage(QueryLifePayOrderListInput input) |
| | | { |
| | | return await _lifePayService.GetLifePayOrderPage(input); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取退款订单分页数据 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public async Task<PageOutput<LifePayOrderListOutput>> GetLifePayRefundOrderPage(QueryLifePayRefundOrderListInput input) |
| | | { |
| | | return await _lifePayService.GetLifePayRefundOrderPage(input); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取订单详情 |
| | | /// </summary> |
| | | /// <param name="orderNo"></param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | public async Task<LifePayOrderOutput> GetLifePayOrderDetail(string orderNo) |
| | | { |
| | | return await _lifePayService.GetLifePayOrderDetail(orderNo); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取退款订单详情 |
| | | /// </summary> |
| | | /// <param name="orderNo"></param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | public async Task<LifePayRefundOrderOutput> GetLifePayRefundOrderDetail(string orderNo) |
| | | { |
| | | return await _lifePayService.GetLifePayRefundOrderDetail(orderNo); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | public async Task<PageOutput<CreateEditPayChannelsInput>> GetLifePayChannlesPage(PageInput input) |
| | | { |
| | | return await _lifePayService.GetLifePayChannlesPage(input); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取全部缴费渠道 |
| | | /// </summary> |
| | | [HttpGet] |
| | | public async Task<List<CreateEditPayChannelsInput>> GetLifePayChannlesAllList() |
| | | { |
| | | return await _lifePayService.GetLifePayChannlesAllList(); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | 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<LifePayConsumptionListOutput>> GetLifePayConsumptionPage(LifePayConsumptionPageInput input) |
| | | { |
| | | return await _lifePayOrderService.GetLifePayConsumptionPage(input); |
| | | } |
| | | |
| | | /// <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<LifePayChannlesRakeListOutput>> GetLifePayChannlesRakePage(LifePayChannlesRakePageInput input) |
| | | { |
| | | return await _lifePayOrderService.GetLifePayChannlesRakePage(input); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 导出渠道分佣Excel |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public async Task<ActionResult> GetLifePayChannlesRakePageExport(LifePayChannlesRakePageInput input) |
| | | { |
| | | var data = await _lifePayOrderService.GetLifePayChannlesRakePageExport(input); |
| | | if (data.Any()) |
| | | { |
| | | var bytes = ExcelHelper.ListToByteForExcel(data, "xlsx"); |
| | | return File(bytes, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "渠道分佣" + ".xlsx"); |
| | | } |
| | | return Json(default); |
| | | } |
| | | /// <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); |
| | | if (res.Code == WxpayResultCode.Success) |
| | | { |
| | | await _lifePayOrderService.AddLifePayExpensesReceipts(new AddLifePayExpensesReceiptsInput() |
| | | { |
| | | OrderNo = res.OutTradeNo, |
| | | OutRefundNo = res.RefundId, |
| | | 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(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 同步订单分佣信息 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | [AllowAnonymous] |
| | | public async Task GetAllChannlesRake() |
| | | { |
| | | await _lifePayOrderService.GetAllChannlesRake(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 统计交易流水 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | [AllowAnonymous] |
| | | public async Task GetAllLifePayConsumption() |
| | | { |
| | | await _lifePayOrderService.GetAllLifePayConsumption(); |
| | | } |
| | | #endregion |
| | | |
| | | #region 操作 |
| | |
| | | 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> CreateEditLifePayPremium(List<LifePayPremiumInput> input) |
| | | { |
| | | await _lifePayService.CreateEditLifePayPremium(input); |
| | | return Constant.SUCCESS; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 须知配置 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public async Task<int> EditIntroInfo(LifePayIntroInfoInput input) |
| | | { |
| | | await _lifePayService.EditIntroInfo(input); |
| | | return Constant.SUCCESS; |
| | | } |
| | | |
| | | /// <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> |