feat: nameEn显示

This commit is contained in:
2026-06-09 16:03:51 +08:00
parent e9975af591
commit e720cefaf7
8 changed files with 72 additions and 4 deletions

View File

@@ -1,4 +1,5 @@
using Dlhis.Basic.Api;
using System.Xml.Linq;
using Dlhis.Basic.Api;
using Dlhis.Basic.Api.Requests;
using Dlhis.Constants;
using Dlhis.Dormitory.Api;
@@ -689,6 +690,7 @@ public class DeviceUploadLogService : IDeviceUploadLogService
UserNo = ga.No,
UserCode = x.UserUniqueNo,
UserName = ga.Name,
UserNameEn = ga.NameEn,
DeployPlace = device.DeployPlace,
NeedUpload = x.NeedUpload,
Sync = x.Sync,
@@ -697,12 +699,21 @@ public class DeviceUploadLogService : IDeviceUploadLogService
}).ToPageListAsync(request.PageIndex, request.PageSize);
var userCodes = r.Where(x => x.UserName.IsEmpty()).Select(x => x.UserCode).Distinct().ToList();
var gainfoLeaves = await _dbContext.Queryable<GainfoLeaveEntity>().Where(x => userCodes.Contains(x.Code)).Select(x => new { x.Code, x.Name }).ToListAsync();
var gainfoLeaves = await _dbContext.Queryable<GainfoLeaveEntity>().Where(x => userCodes.Contains(x.Code)).Select(x => new { x.Code, x.Name, x.NameEn }).ToListAsync();
r.ForEach(item =>
{
if (item.UserName.IsEmpty())
{
item.UserName = gainfoLeaves.FirstOrDefault(x => x.Code == item.UserCode)?.Name;
var name = gainfoLeaves.FirstOrDefault(x => x.Code == item.UserCode)?.Name;
var nameEn = gainfoLeaves.FirstOrDefault(x => x.Code == item.UserCode)?.NameEn;
item.UserName = nameEn.IsPresent() ? $"{name}({nameEn})" : name;
}
else
{
if (item.UserNameEn.IsPresent())
{
item.UserName = $"{item.UserName}({item.UserNameEn})";
}
}
});