fix idno为空人员不执行insert
This commit is contained in:
@@ -167,24 +167,32 @@ public class GainfoUpdateService : IGainfoUpdateService
|
||||
|
||||
private async Task InsertPersonAsync(GainfoSapEntity item)
|
||||
{
|
||||
await _dbContext.UseTransactionAsync(async () =>
|
||||
var info = GainfoSapToGainfo(item);
|
||||
//只有身份证号存在才进行新增
|
||||
if (info.IdNo.IsPresent())
|
||||
{
|
||||
await _dbContext.InsertAsync(item);
|
||||
var info = GainfoSapToGainfo(item);
|
||||
await _dbContext.UseTransactionAsync(async () =>
|
||||
{
|
||||
await _dbContext.InsertAsync(item);
|
||||
|
||||
if (item.isowner == "T")
|
||||
{
|
||||
await _dbContext.InsertAsync(info);
|
||||
await _identityUserSyncService.SyncAccountAsync(info.Code, info.Name, info.IdNo, info.Factory);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!await _dbContext.Queryable<GainfoLeaveEntity>().AnyAsync(x => x.Code == item.ename))
|
||||
if (item.isowner == "T")
|
||||
{
|
||||
await _dbContext.Client.Insertable(info).AS("GainfoLeave").ExecuteCommandAsync();
|
||||
await _dbContext.InsertAsync(info);
|
||||
await _identityUserSyncService.SyncAccountAsync(info.Code, info.Name, info.IdNo, info.Factory);
|
||||
}
|
||||
}
|
||||
});
|
||||
else
|
||||
{
|
||||
if (!await _dbContext.Queryable<GainfoLeaveEntity>().AnyAsync(x => x.Code == item.ename))
|
||||
{
|
||||
await _dbContext.Client.Insertable(info).AS("GainfoLeave").ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogWarning("SAP新增人员失败,身份证号不存在:{userCode},{userName}", info.Code, info.Name);
|
||||
}
|
||||
}
|
||||
|
||||
private static GainfoEntity GainfoSapToGainfo(GainfoSapEntity item)
|
||||
|
||||
Reference in New Issue
Block a user