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,6 @@
namespace Dlhis.Basic.Organization.Response;
using Newtonsoft.Json;
namespace Dlhis.Basic.Organization.Response;
public class GainfoAllPageResponse
{
@@ -9,6 +11,10 @@ public class GainfoAllPageResponse
/// </summary>
public string Name { get; set; }
[JsonIgnore]
public string NameEn { get; set; }
/// <summary>
/// 工号
/// </summary>

View File

@@ -23,6 +23,10 @@ public class GainfoDetailResponse
/// </summary>
public string Name { get; set; }
[JsonIgnore]
public string NameEn { get; set; }
/// <summary>
/// 学工号
/// </summary>

View File

@@ -27,6 +27,9 @@ public class GainfoPageResponse
/// </summary>
public string Name { get; set; }
[JsonIgnore]
public string NameEn { get; set; }
/// <summary>
/// 工号
/// </summary>

View File

@@ -166,6 +166,12 @@ public class GainfoService : IGainfoService
gainfo.CardTypeName = gainfo.CardType is 1 or 0 or null
? "全时段"
: basicTypes.FirstOrDefault(x => x.Code == gainfo.CardType.ToString())?.Display;
if (gainfo.NameEn.IsPresent())
{
gainfo.Name = $"{gainfo.Name}({gainfo.NameEn})";
}
});
return page;
@@ -184,6 +190,11 @@ public class GainfoService : IGainfoService
{
x.Workplace = tenants.FirstOrDefault(item => item.Code == x.Workplace)?.Name;
x.Factory = tenants.FirstOrDefault(item => item.Code == x.Factory)?.Name;
if (x.NameEn.IsPresent())
{
x.Name = $"{x.Name}({x.NameEn})";
}
});
return page;
@@ -382,6 +393,7 @@ public class GainfoService : IGainfoService
No = ga.No,
InternalNo = ga.InternalNo,
Name = ga.Name,
NameEn = ga.NameEn,
Code = ga.Code,
IdClass = ga.IdClass,
IdNo = ga.IdNo,
@@ -438,6 +450,12 @@ public class GainfoService : IGainfoService
{
//ignore
}
if (info.NameEn.IsPresent())
{
info.Name = $"{info.Name}({info.NameEn})";
}
}
return info;

View File

@@ -32,6 +32,10 @@ public class BalanceRecordResponse : IExcelExportable
[Excel("姓名")]
public string Name { get; set; }
[JsonIgnore]
public string NameEn { get; set; }
/// <summary>
/// 学工号
/// </summary>

View File

@@ -93,6 +93,24 @@ public class BalanceService : IBalanceService
})
.ToPageListAsync(request);
var userCodes = page.Data.Select(x => x.UserCode).Distinct().ToList();
var gainfos = await _dbContext.Queryable<GainfoEntity>().Where(x => userCodes.Contains(x.Code)).Select(x => new { x.Code, x.Name, x.NameEn }).ToListAsync();
var gainfoLeaves = await _dbContext.Queryable<GainfoLeaveEntity>().Where(x => userCodes.Contains(x.Code)).Select(x => new { x.Code, x.Name, x.NameEn }).ToListAsync();
page.Data.ForEach(item =>
{
var nameEn = gainfos.FirstOrDefault(x => x.Code == item.UserCode)?.NameEn;
if (nameEn.IsEmpty())
{
nameEn = gainfoLeaves.FirstOrDefault(x => x.Code == item.UserCode)?.NameEn;
}
if (nameEn.IsPresent())
{
item.Name = $"{item.Name}({nameEn})";
}
});
try
{
var tenants = await _tenantApi.GetTenantsInternalAsync();

View File

@@ -44,6 +44,10 @@ public class DeviceUploadLogResponse
/// </summary>
public string UserName { get; set; }
[JsonIgnore]
public string UserNameEn { get; set; }
/// <summary>
/// 上传时间
/// </summary>

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})";
}
}
});