feat: 处理触发

This commit is contained in:
2026-07-10 14:11:20 +08:00
parent 7d52540ebf
commit e0a2a9ea0d
3 changed files with 27 additions and 6 deletions

View File

@@ -36,6 +36,13 @@ public class SyncController : ControllerBase
await _gainfoUpdateService.TodoByWerkAsync(request.Code);
}
[HttpPost("/api/sync/gainfo/updateToLeave")]
[IgnoreTenant]
public async Task UpdatePersonAsync(CodeRequest request)
{
await _gainfoUpdateService.UpdatePersonAsync(request.Code);
}
[HttpPost("/api/sync/gainfo/user")]
[IgnoreTenant]
public async Task TodoByCodeAsync(CodeRequest request)

View File

@@ -1,8 +1,12 @@
namespace Dlhis.Basic.Organization.Services;
using Dlhis.Entity.Basic.Entity;
namespace Dlhis.Basic.Organization.Services;
public interface IGainfoUpdateService : IScopeDependency
{
Task TodoByWerkAsync(string werk);
Task TodoByCodeAsync(string code);
}
Task UpdatePersonAsync(string userCode);
}

View File

@@ -111,6 +111,16 @@ public class GainfoUpdateService : IGainfoUpdateService
}
}
public async Task UpdatePersonAsync(string userCode)
{
var gainfoSap = await _dbContext.Queryable<GainfoSapEntity>()
.Where(x => x.ename == userCode)
.Where(x => x.isowner == "F")
.OrderByDescending(x => x.logdate)
.FirstAsync();
await UpdatePersonAsync(gainfoSap);
}
private async Task SavePersonAsync(List<SapPersonItem> persons)
{
@@ -254,7 +264,7 @@ public class GainfoUpdateService : IGainfoUpdateService
return info;
}
private async Task UpdatePersonAsync(GainfoSapEntity item)
public async Task UpdatePersonAsync(GainfoSapEntity item)
{
await _dbContext.Client.Ado.BeginTranAsync();
try
@@ -510,7 +520,7 @@ public class GainfoUpdateService : IGainfoUpdateService
{
var first = modifiedPersons[0];
var historyCandidates = !string.IsNullOrWhiteSpace(first.ZWORKCODE)
&& lastMap.TryGetValue(first.ZWORKCODE, out var currentHistoryPerson)
&& lastMap.TryGetValue(first.ZWORKCODE, out var currentHistoryPerson)
? currentHistoryPerson
: null;
var hasHistory = historyCandidates != null;
@@ -596,7 +606,7 @@ public class GainfoUpdateService : IGainfoUpdateService
KOSTL = person.KOSTL_XJ,
ZZ_ZD = person.ZZ_ZD,
Z_ZJ = person.Z_ZJ,
STELL = person.PLANS,//person.STELL, 20251129变更
STELL = person.PLANS, //person.STELL, 20251129变更
STELL_NM = person.STELL_NM ?? string.Empty,
ZLZRQ = person.ZLZRQ,
MASSN = person.MASSN ?? string.Empty,
@@ -698,4 +708,4 @@ public class GainfoUpdateService : IGainfoUpdateService
private static string FormatDate(DateTime? value) => value?.ToString("yyyy-MM-dd HH:mm:ss") ?? string.Empty;
private static string FormatDate(DateTime value) => value.ToString("yyyy-MM-dd HH:mm:ss");
}
}