fix idno加密
This commit is contained in:
@@ -172,9 +172,9 @@ public class GainfosController : ControllerBase
|
||||
/// <returns></returns>
|
||||
[AllowAnonymous]
|
||||
[HttpPost("check/idnoWithName")]
|
||||
public async Task CheckIdNoAndNameMatchAsync(GainfoCheckIdNoAndNameRequest request)
|
||||
public async Task<string> CheckIdNoAndNameMatchAsync(GainfoCheckIdNoAndNameRequest request)
|
||||
{
|
||||
await _gainfoService.CheckIdNoAndNameMatchAsync(request);
|
||||
return await _gainfoService.CheckIdNoAndNameMatchAsync(request);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -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<VisitorAppointmentDetailEntity>().Where(x => x.Id == request.Id).SingleAsync();
|
||||
detail.ThrowIfNull("预约信息不存在");
|
||||
|
||||
//todo生成下发任务
|
||||
var mst = await _dbContext.Queryable<VisitorAppointmentEntity>().Where(x => x.Id == detail.AppointmentId).FirstAsync();
|
||||
var deviceGroup = await _dbContext.Queryable<AppointmentAreaAssignmentEntity>()
|
||||
.Where(x => x.CustomCode == mst.AreaCustomCode)
|
||||
@@ -166,6 +169,16 @@ public class AppointmentService : IAppointmentService
|
||||
|
||||
public async Task<AppointmentDetailResponse> 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<VisitorAppointmentDetailEntity>()
|
||||
.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<Pagination<AppointmentDetailResponse>> 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<VisitorAppointmentDetailEntity>()
|
||||
.Where(x => x.IdNo == request.IdNo)
|
||||
.OrderBy(x => x.Start)
|
||||
|
||||
@@ -16,6 +16,10 @@
|
||||
"SlowSqlTime": 1,
|
||||
"EnableSqlLog": false
|
||||
},
|
||||
"DataProtectionOptions": {
|
||||
"Enable": true,
|
||||
"AppName": "yiliantong"
|
||||
},
|
||||
"SwaggerOptions": {
|
||||
"Enable": true,
|
||||
"Authority": "http://identity.oauth.svc.cluster.local",
|
||||
|
||||
Reference in New Issue
Block a user