证书单位赋值
This commit is contained in:
parent
1a62270421
commit
f823dfb7eb
@ -850,6 +850,22 @@ public class EventScoreService : BaseService<EventResult>, ITransient
|
|||||||
})
|
})
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
|
// 预加载所有相关的单位认证数据
|
||||||
|
var merchantCertIds = allPersonsWithTeam
|
||||||
|
.Where(p => p.MerchantCertificationId.HasValue)
|
||||||
|
.Select(p => p.MerchantCertificationId.Value)
|
||||||
|
.Distinct()
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
Dictionary<long, string> merchantNameDict = new Dictionary<long, string>();
|
||||||
|
if (merchantCertIds.Any())
|
||||||
|
{
|
||||||
|
var merchantCerts = await _merchantCertificationRepository.AsQueryable()
|
||||||
|
.Where(mc => merchantCertIds.Contains(mc.Id) && !mc.DeleteMark)
|
||||||
|
.ToListAsync();
|
||||||
|
merchantNameDict = merchantCerts.ToDictionary(mc => mc.Id, mc => mc.MerchantName);
|
||||||
|
}
|
||||||
|
|
||||||
// 处理 PersonIds:将负的 Id 转换为 UserId,然后尝试找到或创建对应的 EventRegistrationPerson
|
// 处理 PersonIds:将负的 Id 转换为 UserId,然后尝试找到或创建对应的 EventRegistrationPerson
|
||||||
var processedPersonIds = new List<long>();
|
var processedPersonIds = new List<long>();
|
||||||
var userIdToNewPersonId = new Dictionary<long, long>();
|
var userIdToNewPersonId = new Dictionary<long, long>();
|
||||||
@ -1135,8 +1151,16 @@ public class EventScoreService : BaseService<EventResult>, ITransient
|
|||||||
isNewCert = true;
|
isNewCert = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取单位名称
|
||||||
|
string unitName = string.Empty;
|
||||||
|
if (person.MerchantCertificationId.HasValue &&
|
||||||
|
merchantNameDict.TryGetValue(person.MerchantCertificationId.Value, out var merchantName))
|
||||||
|
{
|
||||||
|
unitName = merchantName;
|
||||||
|
}
|
||||||
|
|
||||||
// 构建占位符数据(传递合并后的姓名)
|
// 构建占位符数据(传递合并后的姓名)
|
||||||
var placeholderData = BuildPlaceholderData(person.Person, resultRecord, combinedNames);
|
var placeholderData = BuildPlaceholderData(person.Person, resultRecord, unitName, combinedNames);
|
||||||
|
|
||||||
// 生成 PDF 证书
|
// 生成 PDF 证书
|
||||||
try
|
try
|
||||||
@ -1200,8 +1224,16 @@ public class EventScoreService : BaseService<EventResult>, ITransient
|
|||||||
isNewCert = true;
|
isNewCert = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取单位名称
|
||||||
|
string unitName = string.Empty;
|
||||||
|
if (person.MerchantCertificationId.HasValue &&
|
||||||
|
merchantNameDict.TryGetValue(person.MerchantCertificationId.Value, out var merchantName))
|
||||||
|
{
|
||||||
|
unitName = merchantName;
|
||||||
|
}
|
||||||
|
|
||||||
// 构建占位符数据(教练/领队没有成绩记录)
|
// 构建占位符数据(教练/领队没有成绩记录)
|
||||||
var placeholderData = BuildPlaceholderDataForCoachLeader(person.Person);
|
var placeholderData = BuildPlaceholderDataForCoachLeader(person.Person, unitName);
|
||||||
|
|
||||||
// 生成 PDF 证书
|
// 生成 PDF 证书
|
||||||
try
|
try
|
||||||
@ -1288,7 +1320,7 @@ public class EventScoreService : BaseService<EventResult>, ITransient
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 构建运动员占位符数据
|
/// 构建运动员占位符数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private Dictionary<string, string> BuildPlaceholderData(EventRegistrationPerson person, EventResult result, string combinedNames = null)
|
private Dictionary<string, string> BuildPlaceholderData(EventRegistrationPerson person, EventResult result, string unitName, string combinedNames = null)
|
||||||
{
|
{
|
||||||
var displayName = string.IsNullOrEmpty(combinedNames) ? person.Name : combinedNames;
|
var displayName = string.IsNullOrEmpty(combinedNames) ? person.Name : combinedNames;
|
||||||
var data = new Dictionary<string, string>
|
var data = new Dictionary<string, string>
|
||||||
@ -1304,9 +1336,9 @@ public class EventScoreService : BaseService<EventResult>, ITransient
|
|||||||
["成绩"] = result.Score,
|
["成绩"] = result.Score,
|
||||||
["rank"] = result.Rank.ToString(),
|
["rank"] = result.Rank.ToString(),
|
||||||
["名次"] = GetRankText(result.Rank),
|
["名次"] = GetRankText(result.Rank),
|
||||||
["danwei"] = person.ProjectName ?? "个人",
|
["danwei"] = unitName ?? "个人",
|
||||||
["单位"] = "上海跃动文化科技有限公司",
|
["单位"] = unitName ?? "个人",
|
||||||
["参赛单位"] = "上海跃动文化科技有限公司"
|
["参赛单位"] = unitName ?? "个人"
|
||||||
};
|
};
|
||||||
|
|
||||||
// 添加日期信息
|
// 添加日期信息
|
||||||
@ -1323,7 +1355,7 @@ public class EventScoreService : BaseService<EventResult>, ITransient
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 构建教练/领队占位符数据
|
/// 构建教练/领队占位符数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private Dictionary<string, string> BuildPlaceholderDataForCoachLeader(EventRegistrationPerson person)
|
private Dictionary<string, string> BuildPlaceholderDataForCoachLeader(EventRegistrationPerson person, string unitName)
|
||||||
{
|
{
|
||||||
var data = new Dictionary<string, string>
|
var data = new Dictionary<string, string>
|
||||||
{
|
{
|
||||||
@ -1332,9 +1364,9 @@ public class EventScoreService : BaseService<EventResult>, ITransient
|
|||||||
["group"] = person.GroupName,
|
["group"] = person.GroupName,
|
||||||
["组别"] = person.GroupName,
|
["组别"] = person.GroupName,
|
||||||
["项目组别"] = person.GroupName,
|
["项目组别"] = person.GroupName,
|
||||||
["danwei"] = person.ProjectName ?? "个人",
|
["danwei"] = unitName ?? "个人",
|
||||||
["单位"] = person.ProjectName ?? "个人",
|
["单位"] = unitName ?? "个人",
|
||||||
["参赛单位"] = person.ProjectName ?? "个人"
|
["参赛单位"] = unitName ?? "个人"
|
||||||
};
|
};
|
||||||
|
|
||||||
// 添加日期信息
|
// 添加日期信息
|
||||||
|
|||||||
@ -8873,12 +8873,12 @@
|
|||||||
<param name="pageType">页面类型:1-运动员页面,2-教练页面,3-领队页面</param>
|
<param name="pageType">页面类型:1-运动员页面,2-教练页面,3-领队页面</param>
|
||||||
<returns>允许的人员类型列表</returns>
|
<returns>允许的人员类型列表</returns>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:YD_Event.Application.Event.EventScoreService.BuildPlaceholderData(YD_Event.Core.Entities.EventRegistrationPerson,YD_Event.Core.Entities.EventResult,System.String)">
|
<member name="M:YD_Event.Application.Event.EventScoreService.BuildPlaceholderData(YD_Event.Core.Entities.EventRegistrationPerson,YD_Event.Core.Entities.EventResult,System.String,System.String)">
|
||||||
<summary>
|
<summary>
|
||||||
构建运动员占位符数据
|
构建运动员占位符数据
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:YD_Event.Application.Event.EventScoreService.BuildPlaceholderDataForCoachLeader(YD_Event.Core.Entities.EventRegistrationPerson)">
|
<member name="M:YD_Event.Application.Event.EventScoreService.BuildPlaceholderDataForCoachLeader(YD_Event.Core.Entities.EventRegistrationPerson,System.String)">
|
||||||
<summary>
|
<summary>
|
||||||
构建教练/领队占位符数据
|
构建教练/领队占位符数据
|
||||||
</summary>
|
</summary>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user