fix 优化同步离职处理

This commit is contained in:
2024-04-07 21:43:50 +08:00
parent c3749ab5fc
commit ec8d6049b9

View File

@@ -171,16 +171,6 @@ public class GainfoUpdateService : IGainfoUpdateService
{
var no = await InsertPersonAsync(item);
_logger.LogWarning("执行新增成功 工号:{code},姓名:{name}", item.ename, item.gname);
var rResult = await _devicePermissionApi.RePermissionUsersInfoAsync(new PermissionUsersInfoDto
{
UserNos = new List<string> { no },
PermissionInfos = new Dictionary<string, List<UserTenantDeviceCodeDto>>
{
[no] = new List<UserTenantDeviceCodeDto>()
}
});
var r = rResult.Data;
}
catch (Exception ex)
{
@@ -234,6 +224,15 @@ public class GainfoUpdateService : IGainfoUpdateService
if (item.isowner == "T")
{
await _dbContext.InsertAsync(info);
await _devicePermissionApi.RePermissionUsersInfoAsync(new PermissionUsersInfoDto
{
UserNos = new List<string> { info.No },
PermissionInfos = new Dictionary<string, List<UserTenantDeviceCodeDto>>
{
[info.No] = new List<UserTenantDeviceCodeDto>()
}
});
return info.No;
}
else
@@ -362,23 +361,21 @@ public class GainfoUpdateService : IGainfoUpdateService
}
//先写入离职表
gainfo.IdentityUserId = (int)gainfo.Id;
gainfo.IdentityUserId = (int)gainfo.Id;//记录原始id
gainfo.Id = 0;
gainfo.ResignationDate = item.ZLZRQ;
await _dbContext.Client.Insertable(gainfo).AS("GainfoLeave").ExecuteCommandAsync();
await _dbContext.DeleteReallyAsync(gainfo);
}
else
{
var info = GainfoSapToGainfo(item);
await _dbContext.Client.Insertable(info).AS("GainfoLeave").ExecuteCommandAsync();
}
}
if (item.isowner == "T")
{
return gainfo?.No;
}
else
{
return null;
}
return item.isowner == "T" ? gainfo?.No : null;
}
private async Task<List<SapPersonItem>> GetModifiedPersonAsync(List<SapPersonItem> sapList)