Squashed commit of the following:
commit 528cdd51c05d26437f0b23f415e06311b667e9f7 Author: liguoyang <Ligy.97@foxmail.com> Date: Wed Apr 17 15:37:30 2024 +0800 feat 访客预约 commit e73a3fcd9307f86aba2c39578495c03cde1d41f9 Author: liguoyang <Ligy.97@foxmail.com> Date: Tue Apr 16 16:15:16 2024 +0800 feat 业务curd commit b98b6e2764fea875866e11f790f388ccf3c234b5 Merge: a3dcec3 965e84b Author: liguoyang <Ligy.97@foxmail.com> Date: Tue Apr 16 14:56:30 2024 +0800 Merge branch 'feat-visitorAppointments' of https://git.dlhis.com/liguoyang/jinko.yikatong into feat-visitorAppointments commit a3dcec30e1289fbb09de8f85009d3931d971337a Author: liguoyang <Ligy.97@foxmail.com> Date: Fri Apr 12 17:57:49 2024 +0800 fix appsettings commit 766fbec0c45a3852a75a7a37686b885ac3b0a77a Author: liguoyang <Ligy.97@foxmail.com> Date: Fri Apr 12 17:37:01 2024 +0800 add dockerfile commit 86731d41fee97ba073065ed1b807987760a371a7 Author: liguoyang <Ligy.97@foxmail.com> Date: Sun Apr 14 20:11:56 2024 +0800 fix 测试websocket链接 commit 1301b126a9ba9a7d97cf45967cf2915e1169c505 Author: liguoyang <Ligy.97@foxmail.com> Date: Fri Apr 12 17:57:49 2024 +0800 fix appsettings commit 081f3a67896c67891c3f80edde82a440b8736851 Author: liguoyang <Ligy.97@foxmail.com> Date: Fri Apr 12 17:37:01 2024 +0800 add dockerfile commit 271b6c5898b5732a35ccfa0629ce89442ac49143 Author: liguoyang <Ligy.97@foxmail.com> Date: Fri Apr 12 17:34:26 2024 +0800 test 提交测试代码 commit 965e84b6f3b7f925f8021c9b996cce961b896dea Merge: 578eb6a 6a6fad1 Author: liguoyang <Ligy.97@foxmail.com> Date: Mon Apr 15 17:06:45 2024 +0800 Merge branch 'feat-visitorAppointments' of https://git.dlhis.com/liguoyang/jinko.yikatong into feat-visitorAppointments commit 578eb6afbd96f0bfe4aaf8058fd4743309c74d62 Author: liguoyang <Ligy.97@foxmail.com> Date: Sun Apr 14 20:11:56 2024 +0800 fix 测试websocket链接 commit 114511f1daea64b7dbf9c3c38b73e28b6d0301e6 Author: liguoyang <Ligy.97@foxmail.com> Date: Fri Apr 12 17:57:49 2024 +0800 fix appsettings commit 5eacfa8af8087eade8553266a12a2cf42305716b Author: liguoyang <Ligy.97@foxmail.com> Date: Fri Apr 12 17:37:01 2024 +0800 add dockerfile commit b2ffff1f099be343d89690014d05cb859776acbb Author: liguoyang <Ligy.97@foxmail.com> Date: Fri Apr 12 17:34:26 2024 +0800 test 提交测试代码 commit 6a6fad1d1b8772eebf5df12cd74cfd5c955ff560 Author: liguoyang <Ligy.97@foxmail.com> Date: Sun Apr 14 20:11:56 2024 +0800 fix 测试websocket链接 commit 9ce3c4d6f63957c175d65370d9a6b80e10f4254f Author: liguoyang <Ligy.97@foxmail.com> Date: Fri Apr 12 17:57:49 2024 +0800 fix appsettings commit c637fd89850cf289d7da457c6c6f47354b5beed3 Author: liguoyang <Ligy.97@foxmail.com> Date: Fri Apr 12 17:37:01 2024 +0800 add dockerfile commit 58c39815b1c45a99aea0caf503fcb1365c957f03 Author: liguoyang <Ligy.97@foxmail.com> Date: Fri Apr 12 17:34:26 2024 +0800 test 提交测试代码
This commit is contained in:
@@ -1,32 +0,0 @@
|
||||
using Dlhis.Basic.Organization.Request;
|
||||
using Dlhis.Basic.Organization.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Controllers;
|
||||
|
||||
/// <summary>
|
||||
/// 人员face
|
||||
/// </summary>
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class GainfoFacesController : ControllerBase
|
||||
{
|
||||
private readonly IGainfoFaceService _gainfoFaceService;
|
||||
|
||||
public GainfoFacesController(IGainfoFaceService gainfoFaceService)
|
||||
{
|
||||
_gainfoFaceService = gainfoFaceService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 上传外部人员人脸照片
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[AllowAnonymous]
|
||||
[HttpPost("external/face")]
|
||||
public async Task UploadExternalFaceAsync(GainfoUploadFaceRequest request)
|
||||
{
|
||||
await _gainfoFaceService.UploadExternalFaceAsync(request);
|
||||
}
|
||||
}
|
||||
@@ -18,21 +18,12 @@ namespace Dlhis.Basic.MealUser.Controllers;
|
||||
public class GainfosController : ControllerBase
|
||||
{
|
||||
private readonly IGainfoService _gainfoService;
|
||||
private readonly IGainfoFaceService _gainfoFaceService;
|
||||
|
||||
public GainfosController(IGainfoService gainfoService)
|
||||
public GainfosController(IGainfoService gainfoService, IGainfoFaceService gainfoFaceService)
|
||||
{
|
||||
_gainfoService = gainfoService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 档案表保存
|
||||
/// </summary>
|
||||
/// <param name="requests"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("save")]
|
||||
public async Task SaveAsync(List<GainfoSaveRequest> requests)
|
||||
{
|
||||
await _gainfoService.SaveAsync(requests);
|
||||
_gainfoFaceService = gainfoFaceService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -80,6 +71,17 @@ public class GainfosController : ControllerBase
|
||||
await _gainfoService.UploadFaceAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 上传外部人员人脸照片
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[AllowAnonymous]
|
||||
[HttpPost("external/face")]
|
||||
public async Task UploadExternalFaceAsync(GainfoUploadFaceRequest request)
|
||||
{
|
||||
await _gainfoFaceService.UploadExternalFaceAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量上传人脸照片
|
||||
/// </summary>
|
||||
@@ -161,5 +163,18 @@ public class GainfosController : ControllerBase
|
||||
{
|
||||
await _gainfoService.MigrationAsync(request);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 检查idno和名称是否匹配
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[AllowAnonymous]
|
||||
[HttpPost("check/idnoWithName")]
|
||||
public async Task CheckIdNoAndNameMatchAsync(GainfoCheckIdNoAndNameRequest request)
|
||||
{
|
||||
await _gainfoService.CheckIdNoAndNameMatchAsync(request);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Request;
|
||||
|
||||
public class GainfoCheckIdNoAndNameRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 身份证
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "身份证不可为空")]
|
||||
[StringLength(18, ErrorMessage = "身份证位数错误", MinimumLength = 18)]
|
||||
public string IdNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 姓名
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "姓名不可为空")]
|
||||
public string Name { get; set; }
|
||||
}
|
||||
@@ -11,14 +11,6 @@ public interface IGainfoService : IScopeDependency
|
||||
|
||||
Task<Pagination<GainfoAllPageResponse>> GetPageByCodeAsync(string code);
|
||||
|
||||
Task SaveAsync(List<GainfoSaveRequest> requests);
|
||||
|
||||
Task UpdateAsync(GainfoSaveRequest request);
|
||||
|
||||
Task DimissionAsync(GainfoDimissionRequest request);
|
||||
|
||||
Task OnboardingAsync(GainfoDimissionRequest request);
|
||||
|
||||
Task<GainfoCurrentResponse> CurrentUserInfoAsync();
|
||||
|
||||
Task UploadFaceAsync(GainfoUploadFaceRequest request);
|
||||
@@ -37,4 +29,6 @@ public interface IGainfoService : IScopeDependency
|
||||
|
||||
|
||||
Task MigrationAsync(MigrationRequest request);
|
||||
|
||||
Task<string> CheckIdNoAndNameMatchAsync(GainfoCheckIdNoAndNameRequest request);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Dlhis.Basic.Device.Services;
|
||||
using System.Text.RegularExpressions;
|
||||
using Dlhis.Basic.Device.Services;
|
||||
using Dlhis.Basic.Organization.Request;
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
@@ -13,7 +14,6 @@ using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.Core.User.Abstractions;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.DataProtection;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
@@ -23,10 +23,10 @@ public class GainfoService : IGainfoService
|
||||
{
|
||||
private readonly IGainfoStore _gainfoStore;
|
||||
private readonly IDbContext _dbContext;
|
||||
private readonly IDataProtectionProvider _dataProtectionProvider;
|
||||
private readonly ICurrentUser _currentUser;
|
||||
private readonly IDevicePermissionService _devicePermissionService;
|
||||
private readonly RedisCache _redisCache;
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly ITenantApi _tenantApi;
|
||||
private readonly IHangfireApi _hangfireApi;
|
||||
@@ -34,10 +34,10 @@ public class GainfoService : IGainfoService
|
||||
|
||||
public GainfoService(IGainfoStore gainfoStore,
|
||||
IDbContext dbContext,
|
||||
IDataProtectionProvider dataProtectionProvider,
|
||||
ICurrentUser currentUser,
|
||||
IDevicePermissionService devicePermissionService,
|
||||
RedisCache redisCache,
|
||||
IServiceProvider serviceProvider,
|
||||
IConfiguration configuration,
|
||||
ITenantApi tenantApi,
|
||||
IHangfireApi hangfireApi,
|
||||
@@ -45,10 +45,10 @@ public class GainfoService : IGainfoService
|
||||
{
|
||||
_gainfoStore = gainfoStore;
|
||||
_dbContext = dbContext;
|
||||
_dataProtectionProvider = dataProtectionProvider;
|
||||
_currentUser = currentUser;
|
||||
_devicePermissionService = devicePermissionService;
|
||||
_redisCache = redisCache;
|
||||
_serviceProvider = serviceProvider;
|
||||
_configuration = configuration;
|
||||
_tenantApi = tenantApi;
|
||||
_hangfireApi = hangfireApi;
|
||||
@@ -80,10 +80,8 @@ public class GainfoService : IGainfoService
|
||||
.WhereIF(request.DepartmentSelections.IsEmpty(), gainfo => gainfo.Factory == currentTenantId)
|
||||
.WhereIF(request.Search.IsPresent(), gainfo =>
|
||||
gainfo.Name.Contains(request.Search)
|
||||
|| gainfo.Code.Contains(request.Search)
|
||||
|| gainfo.IdNo.Contains(request.Search)
|
||||
|| gainfo.Werks.Contains(request.Search)
|
||||
)
|
||||
|| gainfo.Code == request.Search
|
||||
|| gainfo.IdNo == request.Search)
|
||||
.Select<GainfoPageResponse>()
|
||||
.ToPageListAsync(request);
|
||||
|
||||
@@ -109,78 +107,6 @@ public class GainfoService : IGainfoService
|
||||
return page;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///保存档案号
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
public async Task SaveAsync(List<GainfoSaveRequest> request)
|
||||
{
|
||||
//todo check
|
||||
var entities = request.Adapt<List<GainfoEntity>>();
|
||||
entities.ForEach(x =>
|
||||
{
|
||||
if (x.No.IsEmpty())
|
||||
{
|
||||
x.No = "F" + Guid.NewGuid().ToString();
|
||||
}
|
||||
});
|
||||
|
||||
await _gainfoStore.InsertAsync(entities);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///修改档案号
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
public async Task UpdateAsync(GainfoSaveRequest request)
|
||||
{
|
||||
var gainfo = await _gainfoStore.Queryable(request.GainfoStatus).Where(x => x.Id == request.Id).FirstAsync();
|
||||
gainfo.ThrowIfNull("档案数据不存在,无法更新");
|
||||
|
||||
request.Adapt(gainfo);
|
||||
await _gainfoStore.UpdateAsync(gainfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 正式转离职
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
public async Task DimissionAsync(GainfoDimissionRequest request)
|
||||
{
|
||||
var gainfo = await _gainfoStore.Queryable(GainfoStatusEnumType.Working)
|
||||
.Where(x => x.No == request.UserNo)
|
||||
.FirstAsync();
|
||||
|
||||
gainfo.ThrowIfNull("该档案不存在");
|
||||
|
||||
//添加到离职表
|
||||
await _gainfoStore.InsertAsync(gainfo, GainfoStatusEnumType.Leave);
|
||||
//删除原数据
|
||||
await _gainfoStore.DeleteAsync(gainfo, GainfoStatusEnumType.Working);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 临时转正式
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public async Task OnboardingAsync(GainfoDimissionRequest request)
|
||||
{
|
||||
var gainfo = await _gainfoStore.Queryable(GainfoStatusEnumType.External)
|
||||
.Where(x => x.No == request.UserNo)
|
||||
.FirstAsync();
|
||||
|
||||
gainfo.ThrowIfNull($"该档案不存在");
|
||||
|
||||
//添加到正式表,不删除原数据,留档处理
|
||||
await _gainfoStore.InsertAsync(gainfo);
|
||||
}
|
||||
|
||||
public async Task<GainfoCurrentResponse> CurrentUserInfoAsync()
|
||||
{
|
||||
var code = _currentUser.GetUserClaim("jinko-code");
|
||||
@@ -239,9 +165,7 @@ public class GainfoService : IGainfoService
|
||||
|
||||
public async Task<IActionResult> GetFaceAsync(string token)
|
||||
{
|
||||
var timeLimitedDataProtector = _serviceProvider.GetService<IDataProtectionProvider>()
|
||||
.CreateProtector("down:face")
|
||||
.ToTimeLimitedDataProtector();
|
||||
var timeLimitedDataProtector = _dataProtectionProvider.CreateProtector("down:face").ToTimeLimitedDataProtector();
|
||||
|
||||
try
|
||||
{
|
||||
@@ -263,7 +187,6 @@ public class GainfoService : IGainfoService
|
||||
return new NotFoundResult();
|
||||
}
|
||||
|
||||
await _redisCache.HashSetAsync("faces", userCode, face.Face);
|
||||
return new FileContentResult(Convert.FromBase64String(face.Face), "image/png");
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -373,9 +296,7 @@ public class GainfoService : IGainfoService
|
||||
|
||||
face.ThrowIfNull("人脸照片尚未录入");
|
||||
|
||||
var timeLimitedDataProtector = _serviceProvider.GetService<IDataProtectionProvider>()
|
||||
.CreateProtector("down:face")
|
||||
.ToTimeLimitedDataProtector();
|
||||
var timeLimitedDataProtector = _dataProtectionProvider.CreateProtector("down:face").ToTimeLimitedDataProtector();
|
||||
|
||||
var faceUrl = _configuration.GetSection("FaceUrlOptions:Url").Value;
|
||||
var limit = _configuration.GetSection("FaceUrlOptions:Limit").Get<int>();
|
||||
@@ -404,6 +325,20 @@ public class GainfoService : IGainfoService
|
||||
return faceDictionary;
|
||||
}
|
||||
|
||||
|
||||
public async Task<string> CheckIdNoAndNameMatchAsync(GainfoCheckIdNoAndNameRequest request)
|
||||
{
|
||||
var match = await _gainfoStore.Queryable(GainfoStatusEnumType.External).AnyAsync(x => x.IdNo == request.IdNo && x.Name == request.Name);
|
||||
if (!match)
|
||||
{
|
||||
match = await _gainfoStore.Queryable(GainfoStatusEnumType.Working).AnyAsync(x => x.IdNo == request.IdNo && x.Name == request.Name);
|
||||
}
|
||||
|
||||
match.ThrowIfFalse("验证失败!");
|
||||
|
||||
return request.IdNo;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 档案列表
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user