From 2000ea3a0e2eb83a056b7667a294e68e3bf41d36 Mon Sep 17 00:00:00 2001
From: cheche <717840555@qq.com>
Date: Wed, 17 Jan 2024 18:39:56 +0800
Subject: [PATCH] =?UTF-8?q?feat=20=E6=89=B9=E9=87=8F=E8=8E=B7=E5=8F=96?=
=?UTF-8?q?=E4=BA=BA=E5=8F=A3post?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Organization/Controllers/GainfosController.cs | 8 ++++----
.../Organization/Request/GetFaceByUserCodesRequest.cs | 7 +++++++
Src/Dlhis.Basic/Organization/Services/IGainfoService.cs | 2 +-
.../Organization/Services/Implements/GainfoService.cs | 7 +++----
4 files changed, 15 insertions(+), 9 deletions(-)
create mode 100644 Src/Dlhis.Basic/Organization/Request/GetFaceByUserCodesRequest.cs
diff --git a/Src/Dlhis.Basic/Organization/Controllers/GainfosController.cs b/Src/Dlhis.Basic/Organization/Controllers/GainfosController.cs
index 9af1208d..6842e25e 100644
--- a/Src/Dlhis.Basic/Organization/Controllers/GainfosController.cs
+++ b/Src/Dlhis.Basic/Organization/Controllers/GainfosController.cs
@@ -127,12 +127,12 @@ public class GainfosController : ControllerBase
///
/// 批量获取人脸照片
///
- ///
+ ///
///
- [HttpGet("faces")]
- public async Task> GetFaceByUserCodesAsync([FromQuery] List userCodes)
+ [HttpPost("faces")]
+ public async Task> GetFaceByUserCodesAsync(GetFaceByUserCodesRequest request)
{
- return await _gainfoService.GetFaceByUserCodesAsync(userCodes);
+ return await _gainfoService.GetFaceByUserCodesAsync(request);
}
}
diff --git a/Src/Dlhis.Basic/Organization/Request/GetFaceByUserCodesRequest.cs b/Src/Dlhis.Basic/Organization/Request/GetFaceByUserCodesRequest.cs
new file mode 100644
index 00000000..fae5fcd1
--- /dev/null
+++ b/Src/Dlhis.Basic/Organization/Request/GetFaceByUserCodesRequest.cs
@@ -0,0 +1,7 @@
+namespace Dlhis.Basic.Organization.Request
+{
+ public class GetFaceByUserCodesRequest
+ {
+ public List UserCodes { get; set; }
+ }
+}
diff --git a/Src/Dlhis.Basic/Organization/Services/IGainfoService.cs b/Src/Dlhis.Basic/Organization/Services/IGainfoService.cs
index 7db8ce6d..9411be5d 100644
--- a/Src/Dlhis.Basic/Organization/Services/IGainfoService.cs
+++ b/Src/Dlhis.Basic/Organization/Services/IGainfoService.cs
@@ -25,5 +25,5 @@ public interface IGainfoService : IScopeDependency
Task GetFaceByUserCodeAsync(string userCode);
- Task> GetFaceByUserCodesAsync(List userCodes);
+ Task> GetFaceByUserCodesAsync(GetFaceByUserCodesRequest request);
}
diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs
index 2b385b60..b10dc745 100644
--- a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs
+++ b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs
@@ -292,7 +292,7 @@ public class GainfoService : IGainfoService
public async Task GetFaceByUserCodeAsync(string userCode)
{
var gainfo = await _dbContext.Queryable().Where(x => x.Code == userCode).SingleAsync();
- gainfo.ThrowIfNull("人员信息不存在");
+ gainfo.ThrowIfNull($"{userCode}人员信息不存在");
return await Scoped.Request.Value.CreateAsync(async (sp) =>
{
@@ -328,16 +328,15 @@ public class GainfoService : IGainfoService
return faceUrl + token;
});
}
- public async Task> GetFaceByUserCodesAsync(List userCodes)
+ public async Task> GetFaceByUserCodesAsync(GetFaceByUserCodesRequest request)
{
var faceDictionary = new Dictionary();
- foreach (var userCode in userCodes)
+ foreach (var userCode in request.UserCodes)
{
var faceUrl = await GetFaceByUserCodeAsync(userCode);
faceDictionary.Add(userCode, faceUrl);
}
-
return faceDictionary;
}
}