From 1d294b6cf6d7dae7fefa16971ac89813c1df3928 Mon Sep 17 00:00:00 2001 From: liguoyang Date: Wed, 25 Dec 2024 15:15:30 +0800 Subject: [PATCH] =?UTF-8?q?log=20=E8=A1=A5=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Implements/GainfoUpdateService.cs | 37 +++++++++++-------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoUpdateService.cs b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoUpdateService.cs index 8a7df2b3..9a46d11a 100644 --- a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoUpdateService.cs +++ b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoUpdateService.cs @@ -90,21 +90,28 @@ public class GainfoUpdateService : IGainfoUpdateService { _logger.LogInformation("SAP根据学工号同步开始:{code}", code); - var personResp = await _jinkoSapService.GetPersonsByCodeAsync(code); - var persons = personResp.Person.Items; - - _logger.LogInformation("获取SAP人员数量为:{count}", persons.Count); - if (persons.Count > 0) + try { - var modifiedPersons = await GetModifiedPersonAsync(persons.OrderByDescending(x => x.ZSTATUS).ThenBy(x => x.ZRZRQ).ToList()); - _logger.LogInformation("SAP人员差异数量为:{count}", modifiedPersons.Count); - if (modifiedPersons.Count > 0) - { - await SavePersonAsync(modifiedPersons); - } - } + var personResp = await _jinkoSapService.GetPersonsByCodeAsync(code); + var persons = personResp.Person.Items; - _logger.LogInformation("SAP根据学工号同步结束:{code}", code); + _logger.LogInformation("获取SAP人员数量为:{count}", persons.Count); + if (persons.Count > 0) + { + var modifiedPersons = await GetModifiedPersonAsync(persons.OrderByDescending(x => x.ZSTATUS).ThenBy(x => x.ZRZRQ).ToList()); + _logger.LogInformation("SAP人员差异数量为:{count}", modifiedPersons.Count); + if (modifiedPersons.Count > 0) + { + await SavePersonAsync(modifiedPersons); + } + } + + _logger.LogInformation("SAP根据学工号同步结束:{code}", code); + } + catch (Exception e) + { + _logger.LogError(e, "同步人员异常:{msg}", e.Message); + } } @@ -289,7 +296,7 @@ public class GainfoUpdateService : IGainfoUpdateService try { await _gainfoPermissionService.ResetPermissionsAsync(info.No, DeviceTaskEnumType.Delete, null, "人员离职生成"); - + //先写入离职表 gainfo.IdentityUserId = (int)gainfo.Id; //记录原始id gainfo.Id = 0; @@ -305,7 +312,7 @@ public class GainfoUpdateService : IGainfoUpdateService gainfo.Id = gainfo.IdentityUserId; await _dbContext.DeleteReallyAsync(gainfo); - + await _dbContext.Client.Ado.CommitTranAsync(); } catch (Exception ex)