支付相关设置
This commit is contained in:
parent
8bd8961896
commit
49c0b8b6fa
@ -547,6 +547,21 @@ public class SubmitRegistrationInput
|
|||||||
[Required(ErrorMessage = "报名项目列表不能为空")]
|
[Required(ErrorMessage = "报名项目列表不能为空")]
|
||||||
[MinLength(1, ErrorMessage = "请至少选择一个项目")]
|
[MinLength(1, ErrorMessage = "请至少选择一个项目")]
|
||||||
public List<SubmitRegistrationItemInput> Items { get; set; }
|
public List<SubmitRegistrationItemInput> Items { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 支付方式:1-线下,2-线上
|
||||||
|
/// </summary>
|
||||||
|
public int PaymentMethod { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 具体支付方式
|
||||||
|
/// </summary>
|
||||||
|
public PaymentMethodType PaymentMethodType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 优惠码
|
||||||
|
/// </summary>
|
||||||
|
public string? CouponCode { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -998,6 +1013,11 @@ public class SelectPaymentMethodInput
|
|||||||
[MaxLength(50, ErrorMessage = "OpenId长度不能超过50个字符")]
|
[MaxLength(50, ErrorMessage = "OpenId长度不能超过50个字符")]
|
||||||
[RegularExpression(@"^[a-zA-Z0-9_-]+$", ErrorMessage = "OpenId格式不正确,只能包含字母、数字、下划线和连字符")]
|
[RegularExpression(@"^[a-zA-Z0-9_-]+$", ErrorMessage = "OpenId格式不正确,只能包含字母、数字、下划线和连字符")]
|
||||||
public string? OpenId { get; set; }
|
public string? OpenId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 具体支付方式
|
||||||
|
/// </summary>
|
||||||
|
public PaymentMethodType PaymentMethodType { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -703,6 +703,25 @@ public class EventClientController : IDynamicApiController
|
|||||||
// 调用统一报名服务
|
// 调用统一报名服务
|
||||||
var result = await _unifiedRegistrationService.ProcessRegistrationAsync(unifiedInput);
|
var result = await _unifiedRegistrationService.ProcessRegistrationAsync(unifiedInput);
|
||||||
|
|
||||||
|
// 如果用户在提交时已经选择了支付方式,立即处理支付方式设置
|
||||||
|
if (input.PaymentMethod > 0)
|
||||||
|
{
|
||||||
|
// 构建统一支付输入
|
||||||
|
var unifiedPaymentInput = new UnifiedPaymentInput
|
||||||
|
{
|
||||||
|
RegistrationId = result.RegistrationId,
|
||||||
|
PaymentMethod = input.PaymentMethod,
|
||||||
|
PaymentMethodType = input.PaymentMethodType,
|
||||||
|
CouponId = null,
|
||||||
|
OpenId = null,
|
||||||
|
PaymentProofUrl = null,
|
||||||
|
OperatorUserId = userId
|
||||||
|
};
|
||||||
|
|
||||||
|
// 调用统一支付服务处理支付方式
|
||||||
|
await _unifiedRegistrationService.ProcessPaymentAsync(unifiedPaymentInput);
|
||||||
|
}
|
||||||
|
|
||||||
return result.RegistrationId;
|
return result.RegistrationId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -738,6 +757,7 @@ public class EventClientController : IDynamicApiController
|
|||||||
{
|
{
|
||||||
RegistrationId = input.RegistrationId,
|
RegistrationId = input.RegistrationId,
|
||||||
PaymentMethod = paymentMethod,
|
PaymentMethod = paymentMethod,
|
||||||
|
PaymentMethodType = reg.PaymentMethodType,
|
||||||
CouponId = null,
|
CouponId = null,
|
||||||
OpenId = input.OpenId,
|
OpenId = input.OpenId,
|
||||||
PaymentProofUrl = null,
|
PaymentProofUrl = null,
|
||||||
@ -1042,7 +1062,31 @@ public class EventClientController : IDynamicApiController
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 调用统一支付服务(仅设置支付方式,不处理实际支付)
|
// 调用统一支付服务(仅设置支付方式,不处理实际支付)
|
||||||
reg.PaymentMethod = input.PaymentMethod;
|
// 处理支付方式转换逻辑
|
||||||
|
if (input.PaymentMethodType == PaymentMethodType.WeChatPay ||
|
||||||
|
input.PaymentMethodType == PaymentMethodType.AliPay)
|
||||||
|
{
|
||||||
|
reg.PaymentMethod = 2; // 线上支付
|
||||||
|
}
|
||||||
|
else if (input.PaymentMethodType == PaymentMethodType.BankTransfer)
|
||||||
|
{
|
||||||
|
reg.PaymentMethod = 1; // 线下支付
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 如果没有指定具体支付方式,使用输入的支付方式
|
||||||
|
reg.PaymentMethod = input.PaymentMethod;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置具体支付方式
|
||||||
|
reg.PaymentMethodType = input.PaymentMethodType;
|
||||||
|
|
||||||
|
// 线下支付订单状态设置为待审核
|
||||||
|
if (reg.PaymentMethod == 1)
|
||||||
|
{
|
||||||
|
reg.PaymentStatus = 0; // 待审核
|
||||||
|
}
|
||||||
|
|
||||||
reg.UpdatedTime = DateTime.Now;
|
reg.UpdatedTime = DateTime.Now;
|
||||||
reg.UpdatedUserId = userId;
|
reg.UpdatedUserId = userId;
|
||||||
|
|
||||||
|
|||||||
@ -10,6 +10,11 @@ public class EventRecordPageInput : Pagination
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public long? AppUserId { get; set; }
|
public long? AppUserId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 系统用户ID
|
||||||
|
/// </summary>
|
||||||
|
public long? SysUserId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 商户ID
|
/// 商户ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -237,6 +237,11 @@ public class UnifiedPaymentInput
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string? PaymentProofUrl { get; set; }
|
public string? PaymentProofUrl { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 具体支付方式
|
||||||
|
/// </summary>
|
||||||
|
public PaymentMethodType PaymentMethodType { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 操作用户ID
|
/// 操作用户ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -2,6 +2,8 @@ using YD_Event.Application.Event.Dtos;
|
|||||||
using YD_Event.Core.Entities;
|
using YD_Event.Core.Entities;
|
||||||
using YD_Event.Core.Enum;
|
using YD_Event.Core.Enum;
|
||||||
using AppUserEntity = YD_Event.Core.Entities.AppUser;
|
using AppUserEntity = YD_Event.Core.Entities.AppUser;
|
||||||
|
using SysUserEntity = YD_Event.Core.Entities.SysUser;
|
||||||
|
using MerchantEntity = YD_Event.Core.Entities.Merchant;
|
||||||
|
|
||||||
namespace YD_Event.Application.Event;
|
namespace YD_Event.Application.Event;
|
||||||
|
|
||||||
@ -14,18 +16,21 @@ public class EventRecordService : BaseService<EventRegistration>, ITransient
|
|||||||
private readonly ISqlSugarRepository<EventInfo> _eventRep;
|
private readonly ISqlSugarRepository<EventInfo> _eventRep;
|
||||||
private readonly ISqlSugarRepository<EventCertificate> _certificateRep;
|
private readonly ISqlSugarRepository<EventCertificate> _certificateRep;
|
||||||
private readonly ISqlSugarRepository<AppUserEntity> _appUserRep;
|
private readonly ISqlSugarRepository<AppUserEntity> _appUserRep;
|
||||||
private readonly ISqlSugarRepository<YD_Event.Core.Entities.Merchant> _merchantRep;
|
private readonly ISqlSugarRepository<SysUserEntity> _sysUserRep;
|
||||||
|
private readonly ISqlSugarRepository<MerchantEntity> _merchantRep;
|
||||||
|
|
||||||
public EventRecordService(ISqlSugarRepository<EventRegistration> registrationRep,
|
public EventRecordService(ISqlSugarRepository<EventRegistration> registrationRep,
|
||||||
ISqlSugarRepository<EventInfo> eventRep,
|
ISqlSugarRepository<EventInfo> eventRep,
|
||||||
ISqlSugarRepository<EventCertificate> certificateRep,
|
ISqlSugarRepository<EventCertificate> certificateRep,
|
||||||
ISqlSugarRepository<AppUserEntity> appUserRep,
|
ISqlSugarRepository<AppUserEntity> appUserRep,
|
||||||
ISqlSugarRepository<YD_Event.Core.Entities.Merchant> merchantRep) : base(registrationRep)
|
ISqlSugarRepository<SysUserEntity> sysUserRep,
|
||||||
|
ISqlSugarRepository<MerchantEntity> merchantRep) : base(registrationRep)
|
||||||
{
|
{
|
||||||
_registrationRep = registrationRep;
|
_registrationRep = registrationRep;
|
||||||
_eventRep = eventRep;
|
_eventRep = eventRep;
|
||||||
_certificateRep = certificateRep;
|
_certificateRep = certificateRep;
|
||||||
_appUserRep = appUserRep;
|
_appUserRep = appUserRep;
|
||||||
|
_sysUserRep = sysUserRep;
|
||||||
_merchantRep = merchantRep;
|
_merchantRep = merchantRep;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,20 +40,25 @@ public class EventRecordService : BaseService<EventRegistration>, ITransient
|
|||||||
[HttpGet("page")]
|
[HttpGet("page")]
|
||||||
public async Task<PageResult<EventRecordOutput>> Page([FromQuery] EventRecordPageInput input)
|
public async Task<PageResult<EventRecordOutput>> Page([FromQuery] EventRecordPageInput input)
|
||||||
{
|
{
|
||||||
|
// 参数验证
|
||||||
|
ValidateInput(input);
|
||||||
|
|
||||||
// Join EventRegistration and EventInfo
|
// Join EventRegistration and EventInfo
|
||||||
var query = _registrationRep.AsQueryable()
|
var query = _registrationRep.AsQueryable()
|
||||||
.LeftJoin<EventInfo>((r, e) => r.EventId == e.Id)
|
.LeftJoin<EventInfo>((r, e) => r.EventId == e.Id)
|
||||||
.LeftJoin<AppUserEntity>((r, e, u) => r.CreatedUserId == u.Id)
|
.LeftJoin<AppUserEntity>((r, e, u) => r.CreatedUserId == u.Id)
|
||||||
.LeftJoin<YD_Event.Core.Entities.Merchant>((r, e, u, m) => r.CreatedUserId == m.CreatedUserId)
|
.LeftJoin<SysUserEntity>((r, e, u, s) => r.CreatedUserId == s.Id)
|
||||||
.WhereIF(!string.IsNullOrWhiteSpace(input.EventName), (r, e, u, m) => e.EventName.Contains(input.EventName))
|
.LeftJoin<MerchantEntity>((r, e, u, s, m) => r.CreatedUserId == m.CreatedUserId)
|
||||||
.WhereIF(input.StartTime.HasValue, (r, e, u, m) => e.MatchStartTime >= input.StartTime)
|
.WhereIF(!string.IsNullOrWhiteSpace(input.EventName), (r, e, u, s, m) => e.EventName.Contains(input.EventName))
|
||||||
.WhereIF(input.EndTime.HasValue, (r, e, u, m) => e.MatchStartTime <= input.EndTime)
|
.WhereIF(input.StartTime.HasValue, (r, e, u, s, m) => e.MatchStartTime >= input.StartTime)
|
||||||
.WhereIF(input.PaymentStatus.HasValue, (r, e, u, m) => r.PaymentStatus == input.PaymentStatus)
|
.WhereIF(input.EndTime.HasValue, (r, e, u, s, m) => e.MatchStartTime <= input.EndTime)
|
||||||
// Filter by User ID (AppUser or Merchant)
|
.WhereIF(input.PaymentStatus.HasValue, (r, e, u, s, m) => r.PaymentStatus == input.PaymentStatus)
|
||||||
.WhereIF(input.AppUserId.HasValue, (r, e, u, m) => u.Id == input.AppUserId)
|
// Filter by User ID (AppUser, SysUser, or Merchant)
|
||||||
.WhereIF(input.MerchantId.HasValue, (r, e, u, m) => m.Id == input.MerchantId)
|
.WhereIF(input.AppUserId.HasValue, (r, e, u, s, m) => u.Id == input.AppUserId)
|
||||||
.OrderByDescending((r, e, u, m) => r.CreatedTime)
|
.WhereIF(input.SysUserId.HasValue, (r, e, u, s, m) => s.Id == input.SysUserId)
|
||||||
.Select((r, e, u, m) => new EventRecordOutput
|
.WhereIF(input.MerchantId.HasValue, (r, e, u, s, m) => m.CreatedUserId == input.MerchantId)
|
||||||
|
.OrderByDescending((r, e, u, s, m) => r.CreatedTime)
|
||||||
|
.Select((r, e, u, s, m) => new EventRecordOutput
|
||||||
{
|
{
|
||||||
Id = r.Id,
|
Id = r.Id,
|
||||||
EventName = e.EventName,
|
EventName = e.EventName,
|
||||||
@ -65,6 +75,39 @@ public class EventRecordService : BaseService<EventRegistration>, ITransient
|
|||||||
return await query.ToPagedListAsync(input);
|
return await query.ToPagedListAsync(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 验证输入参数
|
||||||
|
/// </summary>
|
||||||
|
private void ValidateInput(EventRecordPageInput input)
|
||||||
|
{
|
||||||
|
// 检查是否同时提供了多个用户ID类型
|
||||||
|
var userTypeCount = 0;
|
||||||
|
if (input.AppUserId.HasValue) userTypeCount++;
|
||||||
|
if (input.SysUserId.HasValue) userTypeCount++;
|
||||||
|
if (input.MerchantId.HasValue) userTypeCount++;
|
||||||
|
|
||||||
|
if (userTypeCount > 1)
|
||||||
|
{
|
||||||
|
throw Oops.Bah("只能提供一种用户类型ID参数(AppUserId、SysUserId或MerchantId)");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 验证用户ID有效性
|
||||||
|
if (input.AppUserId.HasValue && input.AppUserId.Value <= 0)
|
||||||
|
{
|
||||||
|
throw Oops.Bah("普通用户ID无效");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (input.SysUserId.HasValue && input.SysUserId.Value <= 0)
|
||||||
|
{
|
||||||
|
throw Oops.Bah("系统用户ID无效");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (input.MerchantId.HasValue && input.MerchantId.Value <= 0)
|
||||||
|
{
|
||||||
|
throw Oops.Bah("商户ID无效");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取证书列表
|
/// 获取证书列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -14,6 +14,7 @@ public class EventRegistrationService : BaseService<EventRegistration>, ITransie
|
|||||||
private readonly ISqlSugarRepository<EventRegistrationItem> _itemRepository;
|
private readonly ISqlSugarRepository<EventRegistrationItem> _itemRepository;
|
||||||
private readonly ISqlSugarRepository<EventRegistrationPerson> _personRepository;
|
private readonly ISqlSugarRepository<EventRegistrationPerson> _personRepository;
|
||||||
private readonly ISqlSugarRepository<EventRegistrationPayment> _paymentRepository;
|
private readonly ISqlSugarRepository<EventRegistrationPayment> _paymentRepository;
|
||||||
|
private readonly ISqlSugarRepository<YD_Event.Core.Entities.Order> _orderRepository;
|
||||||
private readonly AuthManager _authManager;
|
private readonly AuthManager _authManager;
|
||||||
|
|
||||||
public EventRegistrationService(
|
public EventRegistrationService(
|
||||||
@ -21,12 +22,14 @@ public class EventRegistrationService : BaseService<EventRegistration>, ITransie
|
|||||||
ISqlSugarRepository<EventRegistrationItem> itemRepository,
|
ISqlSugarRepository<EventRegistrationItem> itemRepository,
|
||||||
ISqlSugarRepository<EventRegistrationPerson> personRepository,
|
ISqlSugarRepository<EventRegistrationPerson> personRepository,
|
||||||
ISqlSugarRepository<EventRegistrationPayment> paymentRepository,
|
ISqlSugarRepository<EventRegistrationPayment> paymentRepository,
|
||||||
|
ISqlSugarRepository<YD_Event.Core.Entities.Order> orderRepository,
|
||||||
AuthManager authManager) : base(repository)
|
AuthManager authManager) : base(repository)
|
||||||
{
|
{
|
||||||
_repository = repository;
|
_repository = repository;
|
||||||
_itemRepository = itemRepository;
|
_itemRepository = itemRepository;
|
||||||
_personRepository = personRepository;
|
_personRepository = personRepository;
|
||||||
_paymentRepository = paymentRepository;
|
_paymentRepository = paymentRepository;
|
||||||
|
_orderRepository = orderRepository;
|
||||||
_authManager = authManager;
|
_authManager = authManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,12 +124,39 @@ public class EventRegistrationService : BaseService<EventRegistration>, ITransie
|
|||||||
{
|
{
|
||||||
if (input.Ids == null || !input.Ids.Any()) return;
|
if (input.Ids == null || !input.Ids.Any()) return;
|
||||||
|
|
||||||
|
// 更新报名记录的支付状态
|
||||||
await _repository.UpdateAsync(x => new EventRegistration
|
await _repository.UpdateAsync(x => new EventRegistration
|
||||||
{
|
{
|
||||||
PaymentStatus = input.PaymentStatus,
|
PaymentStatus = input.PaymentStatus,
|
||||||
ReviewRemark = input.ReviewRemark,
|
ReviewRemark = input.ReviewRemark,
|
||||||
ReviewTime = DateTime.Now
|
ReviewTime = DateTime.Now
|
||||||
}, x => input.Ids.Contains(x.Id));
|
}, x => input.Ids.Contains(x.Id));
|
||||||
|
|
||||||
|
// 如果审核通过(PaymentStatus = 1),同步更新相关订单的状态为已支付
|
||||||
|
if (input.PaymentStatus == 1)
|
||||||
|
{
|
||||||
|
// 获取需要更新的报名记录
|
||||||
|
var registrations = await _repository.GetListAsync(x => input.Ids.Contains(x.Id));
|
||||||
|
|
||||||
|
// 提取所有订单号
|
||||||
|
var orderNos = registrations
|
||||||
|
.Where(r => !string.IsNullOrEmpty(r.OrderNo))
|
||||||
|
.Select(r => r.OrderNo)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
if (orderNos.Any())
|
||||||
|
{
|
||||||
|
var now = DateTime.Now;
|
||||||
|
// 更新相关订单的状态为已支付
|
||||||
|
await _orderRepository.UpdateAsync(x => new YD_Event.Core.Entities.Order
|
||||||
|
{
|
||||||
|
OrderStatus = YD_Event.Core.Enum.OrderStatus.Paid,
|
||||||
|
PaymentTime = now,
|
||||||
|
UpdatedTime = now,
|
||||||
|
UpdatedUserId = _authManager.UserId
|
||||||
|
}, x => orderNos.Contains(x.OrderNo));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -190,19 +220,33 @@ public class EventRegistrationService : BaseService<EventRegistration>, ITransie
|
|||||||
throw Oops.Bah("该记录已完成支付审核,无需重复操作");
|
throw Oops.Bah("该记录已完成支付审核,无需重复操作");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var now = DateTime.Now;
|
||||||
registration.PaymentStatus = input.PaymentStatus;
|
registration.PaymentStatus = input.PaymentStatus;
|
||||||
registration.ReviewRemark = input.ReviewRemark;
|
registration.ReviewRemark = input.ReviewRemark;
|
||||||
registration.ReviewTime = DateTime.Now;
|
registration.ReviewTime = now;
|
||||||
registration.Reviewer = _authManager.Account;
|
registration.Reviewer = _authManager.Account;
|
||||||
registration.UpdatedTime = DateTime.Now;
|
registration.UpdatedTime = now;
|
||||||
registration.UpdatedUserId = _authManager.UserId;
|
registration.UpdatedUserId = _authManager.UserId;
|
||||||
|
|
||||||
if (input.PaymentStatus == 1)
|
if (input.PaymentStatus == 1)
|
||||||
{
|
{
|
||||||
registration.PaymentTime = DateTime.Now;
|
registration.PaymentTime = now;
|
||||||
}
|
}
|
||||||
|
|
||||||
await _repository.UpdateAsync(registration);
|
await _repository.UpdateAsync(registration);
|
||||||
|
|
||||||
|
// 如果审核通过(PaymentStatus = 1),同步更新相关订单的状态为已支付
|
||||||
|
if (input.PaymentStatus == 1 && !string.IsNullOrEmpty(registration.OrderNo))
|
||||||
|
{
|
||||||
|
// 更新相关订单的状态为已支付
|
||||||
|
await _orderRepository.UpdateAsync(x => new YD_Event.Core.Entities.Order
|
||||||
|
{
|
||||||
|
OrderStatus = YD_Event.Core.Enum.OrderStatus.Paid,
|
||||||
|
PaymentTime = now,
|
||||||
|
UpdatedTime = now,
|
||||||
|
UpdatedUserId = _authManager.UserId
|
||||||
|
}, x => x.OrderNo == registration.OrderNo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -236,5 +280,27 @@ public class EventRegistrationService : BaseService<EventRegistration>, ITransie
|
|||||||
UpdatedUserId = _authManager.UserId,
|
UpdatedUserId = _authManager.UserId,
|
||||||
PaymentTime = input.PaymentStatus == 1 ? now : x.PaymentTime
|
PaymentTime = input.PaymentStatus == 1 ? now : x.PaymentTime
|
||||||
}, x => input.Ids.Contains(x.Id));
|
}, x => input.Ids.Contains(x.Id));
|
||||||
|
|
||||||
|
// 如果审核通过(PaymentStatus = 1),同步更新相关订单的状态为已支付
|
||||||
|
if (input.PaymentStatus == 1)
|
||||||
|
{
|
||||||
|
// 提取所有订单号
|
||||||
|
var orderNos = registrations
|
||||||
|
.Where(r => !string.IsNullOrEmpty(r.OrderNo))
|
||||||
|
.Select(r => r.OrderNo)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
if (orderNos.Any())
|
||||||
|
{
|
||||||
|
// 更新相关订单的状态为已支付
|
||||||
|
await _orderRepository.UpdateAsync(x => new YD_Event.Core.Entities.Order
|
||||||
|
{
|
||||||
|
OrderStatus = YD_Event.Core.Enum.OrderStatus.Paid,
|
||||||
|
PaymentTime = now,
|
||||||
|
UpdatedTime = now,
|
||||||
|
UpdatedUserId = _authManager.UserId
|
||||||
|
}, x => orderNos.Contains(x.OrderNo));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -236,8 +236,38 @@ public class UnifiedRegistrationService : ITransient
|
|||||||
registration.OrderNo = await _orderNoGeneratorService.GenerateOrderNoAsync();
|
registration.OrderNo = await _orderNoGeneratorService.GenerateOrderNoAsync();
|
||||||
output.OrderNo = registration.OrderNo;
|
output.OrderNo = registration.OrderNo;
|
||||||
}
|
}
|
||||||
registration.PaymentMethod = input.PaymentMethod;
|
|
||||||
registration.PaymentStatus = 0;
|
// 处理支付方式转换逻辑
|
||||||
|
// 微信支付或支付宝支付 -> 线上支付
|
||||||
|
// 银行卡转账 -> 线下支付
|
||||||
|
if (input.PaymentMethodType == PaymentMethodType.WeChatPay ||
|
||||||
|
input.PaymentMethodType == PaymentMethodType.AliPay)
|
||||||
|
{
|
||||||
|
registration.PaymentMethod = 2; // 线上支付
|
||||||
|
}
|
||||||
|
else if (input.PaymentMethodType == PaymentMethodType.BankTransfer)
|
||||||
|
{
|
||||||
|
registration.PaymentMethod = 1; // 线下支付
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 如果没有指定具体支付方式,使用输入的支付方式
|
||||||
|
registration.PaymentMethod = input.PaymentMethod;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置具体支付方式
|
||||||
|
registration.PaymentMethodType = input.PaymentMethodType;
|
||||||
|
|
||||||
|
// 线下支付订单状态设置为待审核
|
||||||
|
if (registration.PaymentMethod == 1)
|
||||||
|
{
|
||||||
|
registration.PaymentStatus = 0; // 待审核
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
registration.PaymentStatus = 0; // 线上支付初始状态也是待支付
|
||||||
|
}
|
||||||
|
|
||||||
await _registrationRepository.UpdateAsync(registration);
|
await _registrationRepository.UpdateAsync(registration);
|
||||||
|
|
||||||
// 7. 创建订单记录
|
// 7. 创建订单记录
|
||||||
@ -675,7 +705,7 @@ public class UnifiedRegistrationService : ITransient
|
|||||||
Phone = pInput.Mobile,
|
Phone = pInput.Mobile,
|
||||||
Age = CalculateAge(pInput.BirthDate),
|
Age = CalculateAge(pInput.BirthDate),
|
||||||
PersonType = PersonType.Athlete,
|
PersonType = PersonType.Athlete,
|
||||||
UserId = pInput.UserId,
|
UserId = pInput.UserId ?? 0,
|
||||||
CreatedUserId = input.CreatedUserId,
|
CreatedUserId = input.CreatedUserId,
|
||||||
CreatedTime = DateTime.Now
|
CreatedTime = DateTime.Now
|
||||||
});
|
});
|
||||||
@ -880,11 +910,6 @@ public class UnifiedRegistrationService : ITransient
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private async Task<UnifiedPaymentOutput> HandleOfflinePaymentAsync(EventRegistration registration, UnifiedPaymentInput input)
|
private async Task<UnifiedPaymentOutput> HandleOfflinePaymentAsync(EventRegistration registration, UnifiedPaymentInput input)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(input.PaymentProofUrl))
|
|
||||||
{
|
|
||||||
throw Oops.Bah("线下支付需要上传付款凭证");
|
|
||||||
}
|
|
||||||
|
|
||||||
registration.PaymentProofUrl = input.PaymentProofUrl;
|
registration.PaymentProofUrl = input.PaymentProofUrl;
|
||||||
registration.PaymentStatus = 0; // 待审核
|
registration.PaymentStatus = 0; // 待审核
|
||||||
registration.UpdatedTime = DateTime.Now;
|
registration.UpdatedTime = DateTime.Now;
|
||||||
|
|||||||
@ -42,6 +42,16 @@ public class OrderListOutput
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string PaymentMethod { get; set; }
|
public string PaymentMethod { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 具体支付方式
|
||||||
|
/// </summary>
|
||||||
|
public PaymentMethodType PaymentMethodType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 具体支付方式文本
|
||||||
|
/// </summary>
|
||||||
|
public string PaymentMethodTypeText { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 支付凭证URL
|
/// 支付凭证URL
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -173,6 +183,16 @@ public class OrderDetailOutput
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string PaymentMethod { get; set; }
|
public string PaymentMethod { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 具体支付方式
|
||||||
|
/// </summary>
|
||||||
|
public PaymentMethodType PaymentMethodType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 具体支付方式文本
|
||||||
|
/// </summary>
|
||||||
|
public string PaymentMethodTypeText { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 支付凭证URL
|
/// 支付凭证URL
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -208,6 +208,11 @@ public class OrderService : BaseService<YD_Event.Core.Entities.Order>, ITransien
|
|||||||
OrderType = o.OrderType == 1 ? "收入" : "退款",
|
OrderType = o.OrderType == 1 ? "收入" : "退款",
|
||||||
RelatedOrderNo = ro.OrderNo,
|
RelatedOrderNo = ro.OrderNo,
|
||||||
PaymentMethod = r.PaymentMethod == 2 ? "线上" : "线下",
|
PaymentMethod = r.PaymentMethod == 2 ? "线上" : "线下",
|
||||||
|
PaymentMethodType = r.PaymentMethodType,
|
||||||
|
PaymentMethodTypeText =
|
||||||
|
r.PaymentMethodType == PaymentMethodType.WeChatPay ? "微信支付" :
|
||||||
|
r.PaymentMethodType == PaymentMethodType.AliPay ? "支付宝支付" :
|
||||||
|
r.PaymentMethodType == PaymentMethodType.BankTransfer ? "银行卡转账" : "未选择",
|
||||||
PaymentProofUrl = r.PaymentProofUrl,
|
PaymentProofUrl = r.PaymentProofUrl,
|
||||||
RegistrationMode = r.RegistrationMode == 1 ? "个人" : "团队",
|
RegistrationMode = r.RegistrationMode == 1 ? "个人" : "团队",
|
||||||
ContactName = r.ContactName,
|
ContactName = r.ContactName,
|
||||||
@ -289,6 +294,11 @@ public class OrderService : BaseService<YD_Event.Core.Entities.Order>, ITransien
|
|||||||
Items = itemDtos,
|
Items = itemDtos,
|
||||||
Persons = personDtos,
|
Persons = personDtos,
|
||||||
PaymentMethod = orderInfo.Registration?.PaymentMethod == 2 ? "线上" : "线下",
|
PaymentMethod = orderInfo.Registration?.PaymentMethod == 2 ? "线上" : "线下",
|
||||||
|
PaymentMethodType = orderInfo.Registration?.PaymentMethodType ?? PaymentMethodType.None,
|
||||||
|
PaymentMethodTypeText =
|
||||||
|
orderInfo.Registration?.PaymentMethodType == PaymentMethodType.WeChatPay ? "微信支付" :
|
||||||
|
orderInfo.Registration?.PaymentMethodType == PaymentMethodType.AliPay ? "支付宝支付" :
|
||||||
|
orderInfo.Registration?.PaymentMethodType == PaymentMethodType.BankTransfer ? "银行卡转账" : "未选择",
|
||||||
PaymentProofUrl = orderInfo.Registration?.PaymentProofUrl,
|
PaymentProofUrl = orderInfo.Registration?.PaymentProofUrl,
|
||||||
RegistrationMode = orderInfo.Registration?.RegistrationMode == 1 ? "个人" : "团队",
|
RegistrationMode = orderInfo.Registration?.RegistrationMode == 1 ? "个人" : "团队",
|
||||||
OriginalAmount = orderInfo.Order.OriginalAmount,
|
OriginalAmount = orderInfo.Order.OriginalAmount,
|
||||||
|
|||||||
@ -2117,6 +2117,21 @@
|
|||||||
报名项目列表
|
报名项目列表
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="P:YD_Event.Application.Client.Dtos.SubmitRegistrationInput.PaymentMethod">
|
||||||
|
<summary>
|
||||||
|
支付方式:1-线下,2-线上
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:YD_Event.Application.Client.Dtos.SubmitRegistrationInput.PaymentMethodType">
|
||||||
|
<summary>
|
||||||
|
具体支付方式
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:YD_Event.Application.Client.Dtos.SubmitRegistrationInput.CouponCode">
|
||||||
|
<summary>
|
||||||
|
优惠码
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="T:YD_Event.Application.Client.Dtos.SubmitRegistrationItemInput">
|
<member name="T:YD_Event.Application.Client.Dtos.SubmitRegistrationItemInput">
|
||||||
<summary>
|
<summary>
|
||||||
报名项目输入
|
报名项目输入
|
||||||
@ -2525,6 +2540,11 @@
|
|||||||
- 允许的字符:字母、数字、下划线、连字符
|
- 允许的字符:字母、数字、下划线、连字符
|
||||||
</remarks>
|
</remarks>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="P:YD_Event.Application.Client.Dtos.SelectPaymentMethodInput.PaymentMethodType">
|
||||||
|
<summary>
|
||||||
|
具体支付方式
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="T:YD_Event.Application.Client.Dtos.CancelRegistrationRefundInput">
|
<member name="T:YD_Event.Application.Client.Dtos.CancelRegistrationRefundInput">
|
||||||
<summary>
|
<summary>
|
||||||
取消报名退款输入DTO
|
取消报名退款输入DTO
|
||||||
@ -4555,6 +4575,11 @@
|
|||||||
普通用户ID
|
普通用户ID
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="P:YD_Event.Application.Event.Dtos.EventRecordPageInput.SysUserId">
|
||||||
|
<summary>
|
||||||
|
系统用户ID
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="P:YD_Event.Application.Event.Dtos.EventRecordPageInput.MerchantId">
|
<member name="P:YD_Event.Application.Event.Dtos.EventRecordPageInput.MerchantId">
|
||||||
<summary>
|
<summary>
|
||||||
商户ID
|
商户ID
|
||||||
@ -5780,6 +5805,11 @@
|
|||||||
支付凭证URL (线下支付时必填)
|
支付凭证URL (线下支付时必填)
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="P:YD_Event.Application.Event.Dtos.UnifiedPaymentInput.PaymentMethodType">
|
||||||
|
<summary>
|
||||||
|
具体支付方式
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="P:YD_Event.Application.Event.Dtos.UnifiedPaymentInput.OperatorUserId">
|
<member name="P:YD_Event.Application.Event.Dtos.UnifiedPaymentInput.OperatorUserId">
|
||||||
<summary>
|
<summary>
|
||||||
操作用户ID
|
操作用户ID
|
||||||
@ -7110,6 +7140,11 @@
|
|||||||
分页查询参赛记录
|
分页查询参赛记录
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:YD_Event.Application.Event.EventRecordService.ValidateInput(YD_Event.Application.Event.Dtos.EventRecordPageInput)">
|
||||||
|
<summary>
|
||||||
|
验证输入参数
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="M:YD_Event.Application.Event.EventRecordService.GetCertificates(System.Int64)">
|
<member name="M:YD_Event.Application.Event.EventRecordService.GetCertificates(System.Int64)">
|
||||||
<summary>
|
<summary>
|
||||||
获取证书列表
|
获取证书列表
|
||||||
@ -8830,6 +8865,16 @@
|
|||||||
支付方式
|
支付方式
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="P:YD_Event.Application.Order.Dtos.OrderListOutput.PaymentMethodType">
|
||||||
|
<summary>
|
||||||
|
具体支付方式
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:YD_Event.Application.Order.Dtos.OrderListOutput.PaymentMethodTypeText">
|
||||||
|
<summary>
|
||||||
|
具体支付方式文本
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="P:YD_Event.Application.Order.Dtos.OrderListOutput.PaymentProofUrl">
|
<member name="P:YD_Event.Application.Order.Dtos.OrderListOutput.PaymentProofUrl">
|
||||||
<summary>
|
<summary>
|
||||||
支付凭证URL
|
支付凭证URL
|
||||||
@ -8960,6 +9005,16 @@
|
|||||||
支付方式
|
支付方式
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="P:YD_Event.Application.Order.Dtos.OrderDetailOutput.PaymentMethodType">
|
||||||
|
<summary>
|
||||||
|
具体支付方式
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:YD_Event.Application.Order.Dtos.OrderDetailOutput.PaymentMethodTypeText">
|
||||||
|
<summary>
|
||||||
|
具体支付方式文本
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="P:YD_Event.Application.Order.Dtos.OrderDetailOutput.PaymentProofUrl">
|
<member name="P:YD_Event.Application.Order.Dtos.OrderDetailOutput.PaymentProofUrl">
|
||||||
<summary>
|
<summary>
|
||||||
支付凭证URL
|
支付凭证URL
|
||||||
|
|||||||
@ -62,6 +62,11 @@ public class EventRegistration : Entity<long>, ISoftDelete, ICreatedUserId, ICre
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int PaymentMethod { get; set; }
|
public int PaymentMethod { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 具体支付方式
|
||||||
|
/// </summary>
|
||||||
|
public PaymentMethodType PaymentMethodType { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 订单编号
|
/// 订单编号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
33
YD_Event.Core/Enum/PaymentMethodType.cs
Normal file
33
YD_Event.Core/Enum/PaymentMethodType.cs
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
|
namespace YD_Event.Core.Enum;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 具体支付方式
|
||||||
|
/// </summary>
|
||||||
|
public enum PaymentMethodType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 未选择
|
||||||
|
/// </summary>
|
||||||
|
[Description("未选择")]
|
||||||
|
None = 0,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 微信支付
|
||||||
|
/// </summary>
|
||||||
|
[Description("微信支付")]
|
||||||
|
WeChatPay = 1,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 支付宝支付
|
||||||
|
/// </summary>
|
||||||
|
[Description("支付宝支付")]
|
||||||
|
AliPay = 2,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 银行卡转账
|
||||||
|
/// </summary>
|
||||||
|
[Description("银行卡转账")]
|
||||||
|
BankTransfer = 3
|
||||||
|
}
|
||||||
@ -1714,6 +1714,11 @@
|
|||||||
支付方式:1-线下,2-线上
|
支付方式:1-线下,2-线上
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="P:YD_Event.Core.Entities.EventRegistration.PaymentMethodType">
|
||||||
|
<summary>
|
||||||
|
具体支付方式
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="P:YD_Event.Core.Entities.EventRegistration.OrderNo">
|
<member name="P:YD_Event.Core.Entities.EventRegistration.OrderNo">
|
||||||
<summary>
|
<summary>
|
||||||
订单编号
|
订单编号
|
||||||
@ -2061,7 +2066,12 @@
|
|||||||
</member>
|
</member>
|
||||||
<member name="P:YD_Event.Core.Entities.EventRegistrationPerson.UserId">
|
<member name="P:YD_Event.Core.Entities.EventRegistrationPerson.UserId">
|
||||||
<summary>
|
<summary>
|
||||||
关联的用户ID(可选)
|
关联的用户ID(必填)
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:YD_Event.Core.Entities.EventRegistrationPerson.User">
|
||||||
|
<summary>
|
||||||
|
关联的用户信息(导航属性)
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="P:YD_Event.Core.Entities.EventRegistrationPerson.Name">
|
<member name="P:YD_Event.Core.Entities.EventRegistrationPerson.Name">
|
||||||
@ -4512,6 +4522,31 @@
|
|||||||
退赛
|
退赛
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="T:YD_Event.Core.Enum.PaymentMethodType">
|
||||||
|
<summary>
|
||||||
|
具体支付方式
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:YD_Event.Core.Enum.PaymentMethodType.None">
|
||||||
|
<summary>
|
||||||
|
未选择
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:YD_Event.Core.Enum.PaymentMethodType.WeChatPay">
|
||||||
|
<summary>
|
||||||
|
微信支付
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:YD_Event.Core.Enum.PaymentMethodType.AliPay">
|
||||||
|
<summary>
|
||||||
|
支付宝支付
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:YD_Event.Core.Enum.PaymentMethodType.BankTransfer">
|
||||||
|
<summary>
|
||||||
|
银行卡转账
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="T:YD_Event.Core.Enum.PersonType">
|
<member name="T:YD_Event.Core.Enum.PersonType">
|
||||||
<summary>
|
<summary>
|
||||||
人员角色类型
|
人员角色类型
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user