fix: 没有gainfo也属于差异数据

This commit is contained in:
2026-06-04 15:18:10 +08:00
parent c81dd84d76
commit be90d98ee1
4 changed files with 13 additions and 5 deletions

View File

@@ -30,9 +30,9 @@ public class GainfoGroupsController : ControllerBase
[HttpGet("tree")] [HttpGet("tree")]
[IgnoreTenant] [IgnoreTenant]
[DataPermission] [DataPermission]
public async Task<List<GainfoGroupTreeResponse>> GetTreeAsync() public async Task<List<GainfoGroupTreeResponse>> GetTreeAsync(string search)
{ {
return await _gainfoGroupService.GetTreeAsync(); return await _gainfoGroupService.GetTreeAsync(search);
} }
/// <summary> /// <summary>

View File

@@ -6,7 +6,7 @@ namespace Dlhis.Basic.Organization.Services;
public interface IGainfoGroupService : IScopeDependency public interface IGainfoGroupService : IScopeDependency
{ {
Task<List<GainfoGroupTreeResponse>> GetTreeAsync(); Task<List<GainfoGroupTreeResponse>> GetTreeAsync(string search);
Task SaveAsync(GainfoGroupSaveRequest request); Task SaveAsync(GainfoGroupSaveRequest request);

View File

@@ -34,7 +34,7 @@ public class GainfoGroupService : IGainfoGroupService
_devicePermissionAnalyzeService = devicePermissionAnalyzeService; _devicePermissionAnalyzeService = devicePermissionAnalyzeService;
} }
public async Task<List<GainfoGroupTreeResponse>> GetTreeAsync() public async Task<List<GainfoGroupTreeResponse>> GetTreeAsync(string search)
{ {
var gainfoGroups = await _dbContext.Queryable<GainfoGroupEntity>() var gainfoGroups = await _dbContext.Queryable<GainfoGroupEntity>()
.Select<GainfoGroupTreeResponse>() .Select<GainfoGroupTreeResponse>()
@@ -129,7 +129,7 @@ public class GainfoGroupService : IGainfoGroupService
.Any()) .Any())
.Select(x => x.No) .Select(x => x.No)
.ToListAsync(); .ToListAsync();
presentUserNos.AddRange(businessUserNos); presentUserNos.AddRange(businessUserNos);
} }
finally finally

View File

@@ -475,9 +475,17 @@ public class GainfoUpdateService : IGainfoUpdateService
.GroupBy(x => x.ZWORKCODE) .GroupBy(x => x.ZWORKCODE)
.ToDictionary(x => x.Key, x => x.First()); .ToDictionary(x => x.Key, x => x.First());
var existingCodes = await _dbContext.Queryable<GainfoEntity>().Where(x => workCodes.Contains(x.Code)).Select(x => x.Code).ToListAsync();
var modifiedPersons = new List<SapPersonItem>(); var modifiedPersons = new List<SapPersonItem>();
foreach (var person in sapList) foreach (var person in sapList)
{ {
if (!existingCodes.Contains(person.ZWORKCODE))
{
modifiedPersons.Add(person);
continue;
}
if (string.IsNullOrWhiteSpace(person.ZWORKCODE)) if (string.IsNullOrWhiteSpace(person.ZWORKCODE))
{ {
modifiedPersons.Add(person); modifiedPersons.Add(person);