| | |
| | | using LifePayment.Application.Contracts; |
| | | using LifePayment.Domain; |
| | | using LifePayment.Domain.Shared; |
| | | using Microsoft.AspNetCore.Authorization; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using Newtonsoft.Json; |
| | | using Microsoft.Extensions.Logging; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | |
| | | using Volo.Abp; |
| | | using Volo.Abp.AspNetCore.Mvc; |
| | | using Volo.Abp.AspNetCore.WebClientInfo; |
| | | using Volo.Abp.EventBus.Distributed; |
| | | using Volo.Abp.Identity; |
| | | using Volo.Abp.Uow; |
| | | using ZeroD.Util; |
| | | using ZeroD.Util.Fadd; |
| | | using LifePayment.Application.Contracts; |
| | | |
| | | namespace LifePayment.HttpApi |
| | | { |
| | |
| | | public class LifePayController : AbpController |
| | | { |
| | | private readonly ILifePayService _lifePayService; |
| | | private readonly IStatisticsService _statisticsService; |
| | | private readonly IWebClientInfoProvider _webClientInfoProvider; |
| | | private readonly ILogger<LifePayController> _logger; |
| | | public LifePayController( |
| | | ILifePayService lifePayService, |
| | | IStatisticsService statisticsService, |
| | | IWebClientInfoProvider webClientInfoProvider |
| | | , ILogger<LifePayController> logger |
| | | ) |
| | | { |
| | | _lifePayService = lifePayService; |
| | | _statisticsService = statisticsService; |
| | | _webClientInfoProvider = webClientInfoProvider; |
| | | _logger = logger; |
| | | } |
| | | |
| | | #region 查询 |
| | | |
| | | /// <summary> |
| | | /// 获取电费面值 |
| | | /// 获取顶部统计数据 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | [AllowAnonymous] |
| | | public async Task<ElectricParValueResponse> GetElectricParValue() |
| | | public async Task<TopStatisticsOutput> GetTopStatistics() |
| | | { |
| | | return await _statisticsService.GetTopStatistics(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取电费面值 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [AllowAnonymous] |
| | | [ChannelFilter] |
| | | public async Task<ElectricParValueResponse> GetElectricParValue(ChannelsBaseInput input) |
| | | { |
| | | return await _lifePayService.GetElectricParValue(); |
| | | } |
| | |
| | | /// 获取电费充值区域 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | [HttpPost] |
| | | [AllowAnonymous] |
| | | public async Task<ElectricSupportAreaResponse> GetElectricSupportArea() |
| | | [ChannelFilter] |
| | | public async Task<ElectricSupportAreaResponse> GetElectricSupportArea(ChannelsBaseInput input) |
| | | { |
| | | var aresResult = await _lifePayService.GetElectricSupportArea(); |
| | | var parValues = await _lifePayService.GetElectricParValue(); |
| | | |
| | | foreach(var item in aresResult.ElectricAreaList) |
| | | CheckExtensions.IfTrueThrowUserFriendlyException(aresResult == null, "电费充值区域不存在"); |
| | | CheckExtensions.IfTrueThrowUserFriendlyException(parValues == null, "电费面额不存在"); |
| | | foreach (var item in aresResult.ElectricAreaList) |
| | | { |
| | | var paritem = parValues.ElectricParValue.Where(r=>r.AreaName == item.CityName).FirstOrDefault(); |
| | | if(paritem != null) |
| | | var paritem = parValues.ElectricParValue.Where(r => r.AreaName == item.CityName).FirstOrDefault(); |
| | | if (paritem != null) |
| | | { |
| | | item.ElectricType = paritem.ElectricType; |
| | | item.ParValue = paritem.ParValue; |
| | |
| | | /// 获取话费面值 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | [HttpPost] |
| | | [AllowAnonymous] |
| | | public async Task<PhoneParValueResponse> GetPhoneParValue() |
| | | [ChannelFilter] |
| | | public async Task<PhoneParValueResponse> GetPhoneParValue(ChannelsBaseInput input) |
| | | { |
| | | return await _lifePayService.GetPhoneParValue(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取燃气面值 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [AllowAnonymous] |
| | | [ChannelFilter] |
| | | public async Task<GasParValueResponse> GetGasParValue(ChannelsBaseInput input) |
| | | { |
| | | return await _lifePayService.GetGasParValue(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取燃气支持商户 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [AllowAnonymous] |
| | | [ChannelFilter] |
| | | public async Task<GasOrgTypeValueResponse> GetGasOrgType(ChannelsBaseInput input) |
| | | { |
| | | return await _lifePayService.GetGasOrgType(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 添加日志 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [AllowAnonymous] |
| | | |
| | | public async Task<int> AddLogger(LogErrorInput input) |
| | | { |
| | | Logger.LogError("前端错误:" + input.Error); |
| | | return Constant.SUCCESS; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 获取折扣 |
| | |
| | | } |
| | | |
| | | /// <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> |
| | | /// <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); |
| | | } |
| | |
| | | } |
| | | |
| | | /// <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> |
| | | /// 获取我的订单分页数据 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [AllowAnonymous] |
| | | [ChannelFilter] |
| | | public async Task<PageOutput<UserLifePayOrderOutput>> GetUserLifePayOrderPage(QueryLifePayOrderListInput input) |
| | | { |
| | | return await _lifePayService.GetUserLifePayOrderPage(input); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 根据订单号获取支付状态 |
| | | /// 获取我的订单详情 |
| | | /// </summary> |
| | | /// <param name="orderNo"></param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | [AllowAnonymous] |
| | | public async Task<LifePayStatusEnum> GetPayStatusByOrderNo(string orderNo) |
| | | public async Task<UserLifePayOrderOutput> GetUserLifePayOrderDetail(string orderNo) |
| | | { |
| | | return await _lifePayService.GetPayStatusByOrderNo(orderNo); |
| | | return await _lifePayService.GetUserLifePayOrderDetail(orderNo); |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 根据订单号获取支付状态 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [AllowAnonymous] |
| | | [ChannelFilter] |
| | | public async Task<LifePayStatusEnum> GetPayStatusByOrderNo(GetPayStatusByOrderNoInput input) |
| | | { |
| | | return await _lifePayService.GetPayStatusByOrderNo(input.OrderNo); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取缴费渠道列表 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | 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> |
| | | /// 获取渠道详情 |
| | | /// </summary> |
| | | /// <param name="id"></param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | public async Task<CreateEditPayChannelsInput> GetLifePayChannlesDto(Guid id) |
| | | { |
| | | return await _lifePayService.GetLifePayChannlesDto(id); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 用户查看生活缴费退款失败详情 |
| | | /// </summary> |
| | | /// <param name="id"></param> |
| | | /// <returns></returns> |
| | | /// <exception cref="UserFriendlyException"></exception> |
| | | [HttpGet] |
| | | [AllowAnonymous] |
| | | public async Task<UserLifePayOrderRefundOutput> GetUserLifePayOrderRefund(Guid id) |
| | | { |
| | | return await _lifePayService.GetUserLifePayOrderRefund(id); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取用户户号分页数据 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public async Task<PageOutput<UserAccountOutput>> GetAccountPage(QueryUserAccountListInput input) |
| | | { |
| | | return await _lifePayService.GetAccountPage(input); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取我的户号列表 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [AllowAnonymous] |
| | | [ChannelFilter] |
| | | public async Task<PageOutput<UserAccountOutput>> GetUserAccountList(QueryUserAccountListInput input) |
| | | { |
| | | return await _lifePayService.GetUserAccountList(input); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取我的全部户号列表 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [AllowAnonymous] |
| | | [ChannelFilter] |
| | | public async Task<List<UserAccountOutput>> GetUserAccountAllList(QueryUserAccountAllListInput input) |
| | | { |
| | | return await _lifePayService.GetUserAccountAllList(input); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取我的户号详情 |
| | | /// </summary> |
| | | /// <param name="id"></param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | [AllowAnonymous] |
| | | public async Task<UserAccountOutput> GetUserAccountDetail(Guid id) |
| | | { |
| | | return await _lifePayService.GetUserAccountDetail(id); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 导出订单Excel |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public async Task<ActionResult> GetLifePayOrderPageExport(QueryLifePayOrderListInput input) |
| | | { |
| | | var data = await _lifePayService.GetLifePayOrderPageExport(input); |
| | | if (data.Any()) |
| | | { |
| | | 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; |
| | | } |
| | | |
| | | #endregion |
| | |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [AllowAnonymous] |
| | | [ChannelFilter] |
| | | public async Task<CreateLifePayOrderOutput> CreateLifePayPhoneOrder(CreateLifePayOrderInput<LifePhoneData> input) |
| | | { |
| | | return await _lifePayService.CreateLifePayPhoneOrder(input); |
| | |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [AllowAnonymous] |
| | | [ChannelFilter] |
| | | public async Task<CreateLifePayOrderOutput> CreateLifePayElectricOrder(CreateLifePayOrderInput<LifeElectricData> input) |
| | | { |
| | | return await _lifePayService.CreateLifePayElectricOrder(input); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 创建生活缴费燃气订单 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [AllowAnonymous] |
| | | [ChannelFilter] |
| | | public async Task<CreateLifePayOrderOutput> CreateLifePayGasOrder(CreateLifePayOrderInput<LifeGasData> input) |
| | | { |
| | | return await _lifePayService.CreateLifePayGasOrder(input); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 用户发起生活缴费退款 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | /// <exception cref="UserFriendlyException"></exception> |
| | | [HttpPost] |
| | | [AllowAnonymous] |
| | | [ChannelFilter] |
| | | public async Task<int> RefundUserLifePayOrder(RefundUserLifePayOrderInput input) |
| | | { |
| | | await _lifePayService.RefundUserLifePayOrder(input); |
| | | return Constant.SUCCESS; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 添加或修改我的户号 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [AllowAnonymous] |
| | | [ChannelFilter] |
| | | public async Task<int> AddUpdateUserAccount(AddUpdateUserAccountInput input) |
| | | { |
| | | await _lifePayService.AddUpdateUserAccount(input); |
| | | return Constant.SUCCESS; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 删除我的户号 |
| | | /// </summary> |
| | | /// <param name="id"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [AllowAnonymous] |
| | | public async Task<int> DeleteUserAccount(Guid id) |
| | | { |
| | | await _lifePayService.DeleteUserAccount(id); |
| | | return Constant.SUCCESS; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 退款驳回 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public async Task<int> RejectRefundLifePayOrder(RefundLifePayOrderInput input) |
| | | { |
| | | await _lifePayService.RejectRefundLifePayOrder(input); |
| | | return Constant.SUCCESS; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 渠道管理 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public async Task<int> CreateEditPayChannels(CreateEditPayChannelsInput input) |
| | | { |
| | | await _lifePayService.CreateEditPayChannels(input); |
| | | return Constant.SUCCESS; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 设置渠道启用状态 |
| | | /// </summary> |
| | | /// <param name="id"></param> |
| | | /// <param name="status"></param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | public async Task<int> SetLifePayChannelsStatus(Guid id, LifePayChannelsStatsEnum status) |
| | | { |
| | | await _lifePayService.SetLifePayChannelsStatus(id, status); |
| | | return Constant.SUCCESS; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 折扣配置 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public async Task<int> CreateEditLifePayRate(List<LifePayRateInput> input) |
| | | { |
| | | await _lifePayService.CreateEditLifePayRate(input); |
| | | return Constant.SUCCESS; |
| | | } |
| | | |
| | | /// <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] |
| | | [AllowAnonymous] |
| | | [ChannelFilter] |
| | | public async Task<string> SetLifePayOrderPayType(SetLifePayOrderPayTypeInput input) |
| | | { |
| | | |
| | |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [AllowAnonymous] |
| | | [ChannelFilter] |
| | | public async Task<ModelPaymentMiniPay> GetPayOrderForJsAPI(GetPayOrderForJsAPIInput input) |
| | | { |
| | | return await _lifePayService.GetPayOrderForJsAPI(input, _webClientInfoProvider.ClientIpAddress); |