From 7237a7ad23a70e359e8e85e97f40f6fc960f40b7 Mon Sep 17 00:00:00 2001 From: liguoyang Date: Wed, 4 Sep 2024 11:16:44 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E4=BA=BA=E5=91=98=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 --- Src/Dlhis.Middle/appsettings.Development.json | 7 ++-- .../Implements/GainfoUpdateService.cs | 38 ++++++++++++++++++- 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/Src/Dlhis.Middle/appsettings.Development.json b/Src/Dlhis.Middle/appsettings.Development.json index e9c3b230..efb527ae 100644 --- a/Src/Dlhis.Middle/appsettings.Development.json +++ b/Src/Dlhis.Middle/appsettings.Development.json @@ -5,7 +5,8 @@ "Microsoft.AspNetCore": "Warning" } }, - "Authority": "https://yikatong.isawesome.cn", - "Factory": "1234", - "HostName": "yikatong.isawesome.cn" + "Authority": "https://face.jinkosolar.com", + "Factory": "1201", + "HostName": "face.jinkosolar.com", + "Download":1 } diff --git a/Src/Dlhis.ScheduledTask/Common/Services/Implements/GainfoUpdateService.cs b/Src/Dlhis.ScheduledTask/Common/Services/Implements/GainfoUpdateService.cs index a8e12ff3..f2f57ee1 100644 --- a/Src/Dlhis.ScheduledTask/Common/Services/Implements/GainfoUpdateService.cs +++ b/Src/Dlhis.ScheduledTask/Common/Services/Implements/GainfoUpdateService.cs @@ -266,7 +266,7 @@ public class GainfoUpdateService : IGainfoUpdateService CostId = item.KOSTL, EntryDate = item.createdate, ResignationDate = item.ZLZRQ, - CardType = Convert.ToInt32(item.ZZ_KLX), + CardType = SafeParseCardType(item.ZZ_KLX), Workplace = _tenants.LastOrDefault(x => x.Name == item.ZZ_GZDJDNM)?.Code ?? item.ZZ_GZDJDNM, Factory = _tenants.FirstOrDefault(x => x.Name == item.ZZ_GZDCQNM)?.Code ?? item.ZZ_GZDCQNM, }; @@ -326,7 +326,7 @@ public class GainfoUpdateService : IGainfoUpdateService ResignationDate = item.ZLZRQ, Workplace = workplace, Factory = factory, - CardType = Convert.ToInt32(item.ZZ_KLX) + CardType = SafeParseCardType(item.ZZ_KLX) }).Where(x => x.Code == item.ename).ExecuteCommandAsync(); await _identityUserSyncService.SyncAccountAsync(gainfo.Code, gainfo.Name, gainfo.IdNo, factory); } @@ -375,6 +375,30 @@ public class GainfoUpdateService : IGainfoUpdateService { await _dbContext.Client.Insertable(info).AS("GainfoLeave").ExecuteCommandAsync(); } + else + { + var workplace = _tenants.FirstOrDefault(x => x.Name == item.ZZ_GZDJDNM)?.Code ?? item.ZZ_GZDJDNM; + var factory = _tenants.LastOrDefault(x => x.Name == item.ZZ_GZDCQNM)?.Code ?? item.ZZ_GZDCQNM; + await _dbContext.Updateable().SetColumns(g => new GainfoLeaveEntity + { + InternalNo = item.PERNR, + Name = item.gname, + PositionNo = item.STELL, + Grade = item.ZZ_ZD, + Title = item.Z_ZJ, + Phone = item.phone, + DepartmentNo = item.appellation, + Remark = item.remark, + Degree = item.email, + Werks = item.WERKS, + CostId = item.KOSTL, + EntryDate = item.createdate, + ResignationDate = item.ZLZRQ, + Workplace = workplace, + Factory = factory, + CardType = SafeParseCardType(item.ZZ_KLX) + }).Where(x => x.Code == item.ename).ExecuteCommandAsync(); + } } } @@ -500,4 +524,14 @@ public class GainfoUpdateService : IGainfoUpdateService idNo = idNo.TrimStart(); return idNo[..6]; } + + private static int? SafeParseCardType(string ZZ_KLX) + { + if (int.TryParse(ZZ_KLX, out var cardType)) + { + return cardType; + } + + return null; + } } \ No newline at end of file