diff --git a/Src/Dlhis.Basic/Organization/Response/GainfoAllPageResponse.cs b/Src/Dlhis.Basic/Organization/Response/GainfoAllPageResponse.cs index 3b6e5550..66aaa041 100644 --- a/Src/Dlhis.Basic/Organization/Response/GainfoAllPageResponse.cs +++ b/Src/Dlhis.Basic/Organization/Response/GainfoAllPageResponse.cs @@ -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 /// public string Name { get; set; } + + [JsonIgnore] + public string NameEn { get; set; } + /// /// 工号 /// diff --git a/Src/Dlhis.Basic/Organization/Response/GainfoDetailResponse.cs b/Src/Dlhis.Basic/Organization/Response/GainfoDetailResponse.cs index bbc747f3..1c6f0234 100644 --- a/Src/Dlhis.Basic/Organization/Response/GainfoDetailResponse.cs +++ b/Src/Dlhis.Basic/Organization/Response/GainfoDetailResponse.cs @@ -23,6 +23,10 @@ public class GainfoDetailResponse /// public string Name { get; set; } + + [JsonIgnore] + public string NameEn { get; set; } + /// /// 学工号 /// diff --git a/Src/Dlhis.Basic/Organization/Response/GainfoPageResponse.cs b/Src/Dlhis.Basic/Organization/Response/GainfoPageResponse.cs index 1538450a..21c9dcfe 100644 --- a/Src/Dlhis.Basic/Organization/Response/GainfoPageResponse.cs +++ b/Src/Dlhis.Basic/Organization/Response/GainfoPageResponse.cs @@ -27,6 +27,9 @@ public class GainfoPageResponse /// public string Name { get; set; } + [JsonIgnore] + public string NameEn { get; set; } + /// /// 工号 /// diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs index 9a6e06b2..355f8fff 100644 --- a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs +++ b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs @@ -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; diff --git a/Src/Dlhis.Canteen/Order/Response/BalanceRecordResponse.cs b/Src/Dlhis.Canteen/Order/Response/BalanceRecordResponse.cs index db8623a4..e478cd1f 100644 --- a/Src/Dlhis.Canteen/Order/Response/BalanceRecordResponse.cs +++ b/Src/Dlhis.Canteen/Order/Response/BalanceRecordResponse.cs @@ -32,6 +32,10 @@ public class BalanceRecordResponse : IExcelExportable [Excel("姓名")] public string Name { get; set; } + + [JsonIgnore] + public string NameEn { get; set; } + /// /// 学工号 /// diff --git a/Src/Dlhis.Canteen/Order/Services/Implements/BalanceService.cs b/Src/Dlhis.Canteen/Order/Services/Implements/BalanceService.cs index 3389b6e5..d5b9056f 100644 --- a/Src/Dlhis.Canteen/Order/Services/Implements/BalanceService.cs +++ b/Src/Dlhis.Canteen/Order/Services/Implements/BalanceService.cs @@ -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().Where(x => userCodes.Contains(x.Code)).Select(x => new { x.Code, x.Name, x.NameEn }).ToListAsync(); + var gainfoLeaves = await _dbContext.Queryable().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(); diff --git a/Src/Dlhis.ScheduledTask/DeviceUploadLog/Response/DeviceUploadLogResponse.cs b/Src/Dlhis.ScheduledTask/DeviceUploadLog/Response/DeviceUploadLogResponse.cs index 201cad78..c5ed9711 100644 --- a/Src/Dlhis.ScheduledTask/DeviceUploadLog/Response/DeviceUploadLogResponse.cs +++ b/Src/Dlhis.ScheduledTask/DeviceUploadLog/Response/DeviceUploadLogResponse.cs @@ -44,6 +44,10 @@ public class DeviceUploadLogResponse /// public string UserName { get; set; } + + [JsonIgnore] + public string UserNameEn { get; set; } + /// /// 上传时间 /// diff --git a/Src/Dlhis.ScheduledTask/DeviceUploadLog/Services/Implements/DeviceUploadLogService.cs b/Src/Dlhis.ScheduledTask/DeviceUploadLog/Services/Implements/DeviceUploadLogService.cs index 1e477af9..83a5e73c 100644 --- a/Src/Dlhis.ScheduledTask/DeviceUploadLog/Services/Implements/DeviceUploadLogService.cs +++ b/Src/Dlhis.ScheduledTask/DeviceUploadLog/Services/Implements/DeviceUploadLogService.cs @@ -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().Where(x => userCodes.Contains(x.Code)).Select(x => new { x.Code, x.Name }).ToListAsync(); + var gainfoLeaves = await _dbContext.Queryable().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})"; + } } });