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); 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")] [HttpPost("/api/sync/gainfo/user")]
[IgnoreTenant] [IgnoreTenant]
public async Task TodoByCodeAsync(CodeRequest request) 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 public interface IGainfoUpdateService : IScopeDependency
{ {
Task TodoByWerkAsync(string werk); Task TodoByWerkAsync(string werk);
Task TodoByCodeAsync(string code); 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) private async Task SavePersonAsync(List<SapPersonItem> persons)
{ {
@@ -254,7 +264,7 @@ public class GainfoUpdateService : IGainfoUpdateService
return info; return info;
} }
private async Task UpdatePersonAsync(GainfoSapEntity item) public async Task UpdatePersonAsync(GainfoSapEntity item)
{ {
await _dbContext.Client.Ado.BeginTranAsync(); await _dbContext.Client.Ado.BeginTranAsync();
try try