fix 时间更新和结果返回
This commit is contained in:
@@ -4,7 +4,7 @@ using Dlhis.Basic.Organization.Response;
|
||||
using Dlhis.Basic.Organization.Services;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
|
||||
using Kurisu.AspNetCore.UnifyResultAndValidation.Abstractions;
|
||||
using Kurisu.AspNetCore.UnifyResultAndValidation;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
@@ -78,7 +78,7 @@ public class GainfosController : ControllerBase
|
||||
[HttpPost("face")]
|
||||
[IgnoreTenant]
|
||||
[Transactional]
|
||||
public async Task<IApiResult> UploadFaceAsync(GainfoUploadFaceRequest request)
|
||||
public async Task<DefaultApiResult<object>> UploadFaceAsync(GainfoUploadFaceRequest request)
|
||||
{
|
||||
return await _gainfoFaceService.UploadFaceAsync(request);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.UnifyResultAndValidation;
|
||||
using Kurisu.AspNetCore.UnifyResultAndValidation.Abstractions;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Services;
|
||||
@@ -17,7 +16,7 @@ public interface IGainfoFaceService : IScopeDependency
|
||||
|
||||
Task<IActionResult> GetFaceAsync(string token);
|
||||
|
||||
Task<IApiResult> UploadFaceAsync(GainfoUploadFaceRequest request);
|
||||
Task<DefaultApiResult<object>> UploadFaceAsync(GainfoUploadFaceRequest request);
|
||||
|
||||
Task UploadFacesAsync(List<GainfoUploadFaceRequest> request);
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ using Kurisu.AspNetCore.DataAccess.Extensions;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Extensions;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
||||
using Kurisu.AspNetCore.UnifyResultAndValidation;
|
||||
using Kurisu.AspNetCore.UnifyResultAndValidation.Abstractions;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.DataProtection;
|
||||
@@ -146,7 +145,11 @@ public class GainfoFaceService : IGainfoFaceService
|
||||
face = new GainfoFaceEntity
|
||||
{
|
||||
UserCode = gainfo.Code,
|
||||
Face = request.Face
|
||||
Face = request.Face,
|
||||
CreatedBy = 1,
|
||||
CreateTime = DateTime.Now,
|
||||
ModifiedBy = 1,
|
||||
ModifiedTime = DateTime.Now,
|
||||
};
|
||||
|
||||
await _faceDbContext.InsertAsync(face);
|
||||
@@ -198,7 +201,6 @@ public class GainfoFaceService : IGainfoFaceService
|
||||
public async Task<IActionResult> GetFaceAsync(string token)
|
||||
{
|
||||
var timeLimitedDataProtector = _dataProtectionProvider.CreateProtector("down:face").ToTimeLimitedDataProtector();
|
||||
|
||||
try
|
||||
{
|
||||
var password = timeLimitedDataProtector.Unprotect(token);
|
||||
@@ -220,11 +222,13 @@ public class GainfoFaceService : IGainfoFaceService
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<IApiResult> UploadFaceAsync(GainfoUploadFaceRequest request)
|
||||
public async Task<DefaultApiResult<object>> UploadFaceAsync(GainfoUploadFaceRequest request)
|
||||
{
|
||||
var gainfo = await _gainfoStore.Queryable().Where(x => x.No == request.UserNo || x.Code == request.UserNo).SingleAsync();
|
||||
gainfo.ThrowIfNull("人员档案信息不存在");
|
||||
|
||||
var userId = _currentUser.GetIntSubjectId();
|
||||
|
||||
await DetectFaceImageQualityAsync(request.Face, gainfo.Factory);
|
||||
|
||||
var face = await _faceDbContext.Queryable<GainfoFaceEntity>().Where(x => x.UserCode == gainfo.Code).SingleAsync();
|
||||
@@ -235,7 +239,11 @@ public class GainfoFaceService : IGainfoFaceService
|
||||
face = new GainfoFaceEntity
|
||||
{
|
||||
UserCode = gainfo.Code,
|
||||
Face = request.Face
|
||||
Face = request.Face,
|
||||
CreateTime = DateTime.Now,
|
||||
ModifiedTime = DateTime.Now,
|
||||
CreatedBy = userId,
|
||||
ModifiedBy = userId
|
||||
};
|
||||
|
||||
await _faceDbContext.InsertAsync(face);
|
||||
@@ -276,6 +284,8 @@ public class GainfoFaceService : IGainfoFaceService
|
||||
}
|
||||
|
||||
face.Face = request.Face;
|
||||
face.ModifiedTime = DateTime.Now;
|
||||
face.ModifiedBy = userId;
|
||||
await _faceDbContext.UpdateAsync(face);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,11 +24,11 @@ public class HikValidateResultEntity : SugarBaseEntity , ITenantId
|
||||
public double AcceptSimilarity { get; set; }
|
||||
|
||||
|
||||
[SugarColumn(ColumnDataType = "text")]
|
||||
[SugarColumn(ColumnDataType = "longtext")]
|
||||
public string CurrentFace { get; set; }
|
||||
|
||||
|
||||
[SugarColumn(ColumnDataType = "text")]
|
||||
[SugarColumn(ColumnDataType = "longtext")]
|
||||
public string UploadFace { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
Reference in New Issue
Block a user