From ec8d6049b9363055600d1d030f1c8e70dda1be7a Mon Sep 17 00:00:00 2001 From: liguoyang Date: Sun, 7 Apr 2024 21:43:50 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E4=BC=98=E5=8C=96=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E7=A6=BB=E8=81=8C=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Implements/GainfoUpdateService.cs | 35 +++++++++---------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/Src/Dlhis.ScheduledTask/Common/Services/Implements/GainfoUpdateService.cs b/Src/Dlhis.ScheduledTask/Common/Services/Implements/GainfoUpdateService.cs index d8cbdcc2..4fa23cbf 100644 --- a/Src/Dlhis.ScheduledTask/Common/Services/Implements/GainfoUpdateService.cs +++ b/Src/Dlhis.ScheduledTask/Common/Services/Implements/GainfoUpdateService.cs @@ -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 { no }, - PermissionInfos = new Dictionary> - { - [no] = new List() - } - }); - 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 { info.No }, + PermissionInfos = new Dictionary> + { + [info.No] = new List() + } + }); + 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> GetModifiedPersonAsync(List sapList)