From aaa5491b374c0304978e32f29f29b882fecd2a03 Mon Sep 17 00:00:00 2001 From: liguoyang Date: Wed, 6 May 2026 18:37:33 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=8D=A2=E5=8D=A1=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/Implements/GainfoCardService.cs | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoCardService.cs b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoCardService.cs index ab5abeeb..fe50aada 100644 --- a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoCardService.cs +++ b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoCardService.cs @@ -36,15 +36,27 @@ public class GainfoCardService : IGainfoCardService var gainfo = await _gainfoStore.Queryable().Where(x => x.No == request.UserNo).FirstAsync(); gainfo.ThrowIfNull("档案不存在"); + if (gainfo.CardNo == request.CardNo) + { + true.ThrowIfTrue("卡号未发生变化"); + } + + if (gainfo.CardNo.IsPresent()) + { + var oldCardRecord = new GainfoCardRecordEntity + { + UserNo = gainfo.No, + CardNo = gainfo.CardNo, + Reason = "换卡", + Remark = $"换卡前卡号:{gainfo.CardNo}" + }; + oldCardRecord.TenantId = gainfo.Factory; + await _dbContext.InsertAsync(oldCardRecord); + } gainfo.CardNo = request.CardNo; - await _gainfoStore.UpdateAsync(gainfo); - var cardRecord = request.Adapt(); - cardRecord.TenantId = gainfo.Factory; - await _dbContext.InsertAsync(cardRecord); - await _gainfoPermissionService.ResetPermissionsAsync(gainfo.No, DeviceTaskEnumType.Update, null, null, "更新卡号下发"); }