fix: 换卡逻辑记录错误
This commit is contained in:
@@ -36,15 +36,27 @@ public class GainfoCardService : IGainfoCardService
|
|||||||
|
|
||||||
var gainfo = await _gainfoStore.Queryable().Where(x => x.No == request.UserNo).FirstAsync();
|
var gainfo = await _gainfoStore.Queryable().Where(x => x.No == request.UserNo).FirstAsync();
|
||||||
gainfo.ThrowIfNull("档案不存在");
|
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;
|
gainfo.CardNo = request.CardNo;
|
||||||
|
|
||||||
await _gainfoStore.UpdateAsync(gainfo);
|
await _gainfoStore.UpdateAsync(gainfo);
|
||||||
|
|
||||||
var cardRecord = request.Adapt<GainfoCardRecordEntity>();
|
|
||||||
cardRecord.TenantId = gainfo.Factory;
|
|
||||||
await _dbContext.InsertAsync(cardRecord);
|
|
||||||
|
|
||||||
await _gainfoPermissionService.ResetPermissionsAsync(gainfo.No, DeviceTaskEnumType.Update, null, null, "更新卡号下发");
|
await _gainfoPermissionService.ResetPermissionsAsync(gainfo.No, DeviceTaskEnumType.Update, null, null, "更新卡号下发");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user