报名人数去重
This commit is contained in:
parent
1042e7a0a6
commit
6836fa235f
@ -749,7 +749,7 @@ public class UnifiedRegistrationService : ITransient
|
||||
|
||||
var regItems = new List<EventRegistrationItem>();
|
||||
var persons = new List<EventRegistrationPerson>();
|
||||
int totalPersonCount = 0;
|
||||
var uniqueUserIds = new HashSet<long>(); // 用于去重的用户ID集合
|
||||
|
||||
foreach (var item in input.Items)
|
||||
{
|
||||
@ -782,8 +782,6 @@ public class UnifiedRegistrationService : ITransient
|
||||
};
|
||||
regItems.Add(regItem);
|
||||
|
||||
totalPersonCount += team.Persons.Count;
|
||||
|
||||
foreach (var pInput in team.Persons)
|
||||
{
|
||||
persons.Add(new EventRegistrationPerson
|
||||
@ -806,6 +804,12 @@ public class UnifiedRegistrationService : ITransient
|
||||
CreatedUserId = input.CreatedUserId,
|
||||
CreatedTime = DateTime.Now
|
||||
});
|
||||
|
||||
// 将用户ID添加到去重集合中
|
||||
if (pInput.UserId.HasValue)
|
||||
{
|
||||
uniqueUserIds.Add(pInput.UserId.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -813,9 +817,10 @@ public class UnifiedRegistrationService : ITransient
|
||||
await _registrationItemRepository.InsertRangeAsync(regItems);
|
||||
await _registrationPersonRepository.InsertRangeAsync(persons);
|
||||
|
||||
var totalAmount = CalculateTotalAmount(feeConfig, eventProjects, input.Items, totalPersonCount);
|
||||
// 使用去重后的用户数量计算金额
|
||||
var totalAmount = CalculateTotalAmount(feeConfig, eventProjects, input.Items, uniqueUserIds.Count);
|
||||
|
||||
return (totalAmount, totalPersonCount);
|
||||
return (totalAmount, uniqueUserIds.Count);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user