log 补充

This commit is contained in:
2024-12-25 15:15:30 +08:00
parent 3586a456d2
commit 1d294b6cf6

View File

@@ -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)