diff --git a/Src/Dlhis.Basic/Organization/Controllers/GainfosController.cs b/Src/Dlhis.Basic/Organization/Controllers/GainfosController.cs
index e5c23141..ed23f0ae 100644
--- a/Src/Dlhis.Basic/Organization/Controllers/GainfosController.cs
+++ b/Src/Dlhis.Basic/Organization/Controllers/GainfosController.cs
@@ -172,9 +172,9 @@ public class GainfosController : ControllerBase
///
[AllowAnonymous]
[HttpPost("check/idnoWithName")]
- public async Task CheckIdNoAndNameMatchAsync(GainfoCheckIdNoAndNameRequest request)
+ public async Task CheckIdNoAndNameMatchAsync(GainfoCheckIdNoAndNameRequest request)
{
- await _gainfoService.CheckIdNoAndNameMatchAsync(request);
+ return await _gainfoService.CheckIdNoAndNameMatchAsync(request);
}
}
diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs
index f0f9f9cd..ee5a9bba 100644
--- a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs
+++ b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs
@@ -1,5 +1,4 @@
-using System.Text.RegularExpressions;
-using Dlhis.Basic.Device.Services;
+using Dlhis.Basic.Device.Services;
using Dlhis.Basic.Organization.Request;
using Dlhis.Basic.Organization.Response;
using Dlhis.Entity.Basic.Entity;
@@ -336,7 +335,8 @@ public class GainfoService : IGainfoService
match.ThrowIfFalse("验证失败!");
- return request.IdNo;
+ var protector = _dataProtectionProvider.CreateProtector("gainfo:external:idno");
+ return protector.Protect(request.IdNo);
}
///
diff --git a/Src/Dlhis.Visitor/Appointment/Services/Implements/AppointmentService.cs b/Src/Dlhis.Visitor/Appointment/Services/Implements/AppointmentService.cs
index c1a65242..2e4a405b 100644
--- a/Src/Dlhis.Visitor/Appointment/Services/Implements/AppointmentService.cs
+++ b/Src/Dlhis.Visitor/Appointment/Services/Implements/AppointmentService.cs
@@ -7,9 +7,11 @@ using Dlhis.Entity.Visitor.Enums;
using Dlhis.Visitor.Appointment.Request;
using Dlhis.Visitor.Appointment.Response;
using Kurisu.AspNetCore.Utils.Extensions;
+using Kurisu.Core.CustomClass;
using Kurisu.Core.DataAccess.Dto;
using Kurisu.SqlSugar.Extensions;
using Kurisu.SqlSugar.Services;
+using Microsoft.AspNetCore.DataProtection;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
@@ -19,11 +21,13 @@ public class AppointmentService : IAppointmentService
{
private readonly IDbContext _dbContext;
private readonly IDeviceGroupApi _deviceGroupApi;
+ private readonly IDataProtectionProvider _dataProtectionProvider;
- public AppointmentService(IDbContext dbContext, IDeviceGroupApi deviceGroupApi)
+ public AppointmentService(IDbContext dbContext, IDeviceGroupApi deviceGroupApi, IDataProtectionProvider dataProtectionProvider)
{
_dbContext = dbContext;
_deviceGroupApi = deviceGroupApi;
+ _dataProtectionProvider = dataProtectionProvider;
}
public async Task ReceiveAsync(AppointmentReceiveRequest request)
@@ -131,7 +135,6 @@ public class AppointmentService : IAppointmentService
var detail = await _dbContext.Queryable().Where(x => x.Id == request.Id).SingleAsync();
detail.ThrowIfNull("预约信息不存在");
- //todo生成下发任务
var mst = await _dbContext.Queryable().Where(x => x.Id == detail.AppointmentId).FirstAsync();
var deviceGroup = await _dbContext.Queryable()
.Where(x => x.CustomCode == mst.AreaCustomCode)
@@ -141,7 +144,7 @@ public class AppointmentService : IAppointmentService
var deviceCodesResult = await _deviceGroupApi.GetDevicesByCodeAsync(deviceGroup);
var deviceCodes = deviceCodesResult.Data;
- var userNo = detail.IsExternal
+ var userNo = detail.IsExternal
? await _dbContext.Queryable().Where(x => x.IdNo == detail.IdNo).Select(x => x.No).FirstAsync()
: await _dbContext.Queryable().Where(x => x.IdNo == detail.IdNo).Select(x => x.No).FirstAsync();
@@ -166,6 +169,16 @@ public class AppointmentService : IAppointmentService
public async Task GetTodayByIdNoAsync(string idNo)
{
+ var protector = _dataProtectionProvider.CreateProtector("gainfo:external:idno");
+ try
+ {
+ idNo = protector.Unprotect(idNo);
+ }
+ catch (Exception)
+ {
+ throw new UserFriendlyException("凭证有误");
+ }
+
var detail = await _dbContext.Queryable()
.Where(x => x.IdNo == idNo)
.Where(x => SqlFunc.DateIsSame(x.Start, DateTime.Today, DateType.Day))
@@ -178,6 +191,16 @@ public class AppointmentService : IAppointmentService
public async Task> GetRecordPageByIdNoAsync([FromQuery] AppointmentIdNoPageRequest request)
{
+ var protector = _dataProtectionProvider.CreateProtector("gainfo:external:idno");
+ try
+ {
+ request.IdNo = protector.Unprotect(request.IdNo);
+ }
+ catch (Exception)
+ {
+ throw new UserFriendlyException("凭证有误");
+ }
+
var page = await _dbContext.Queryable()
.Where(x => x.IdNo == request.IdNo)
.OrderBy(x => x.Start)
diff --git a/Src/Dlhis.Visitor/appsettings.json b/Src/Dlhis.Visitor/appsettings.json
index 45833522..4946a1a3 100644
--- a/Src/Dlhis.Visitor/appsettings.json
+++ b/Src/Dlhis.Visitor/appsettings.json
@@ -16,6 +16,10 @@
"SlowSqlTime": 1,
"EnableSqlLog": false
},
+ "DataProtectionOptions": {
+ "Enable": true,
+ "AppName": "yiliantong"
+ },
"SwaggerOptions": {
"Enable": true,
"Authority": "http://identity.oauth.svc.cluster.local",