diff --git a/Dlhis.Jinko.Face.sln b/Dlhis.Jinko.Face.sln
index 8c3027a2..fcddfbee 100644
--- a/Dlhis.Jinko.Face.sln
+++ b/Dlhis.Jinko.Face.sln
@@ -5,7 +5,7 @@ VisualStudioVersion = 17.7.34302.85
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Basic", "Basic", "{4EBCE46B-CE3A-4A47-9432-82A1854CA58A}"
EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "RechargeAndSpend", "RechargeAndSpend", "{3D8A98C1-83C9-4375-AEAB-4F72AFAF365B}"
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Canteen", "Canteen", "{3D8A98C1-83C9-4375-AEAB-4F72AFAF365B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dlhis.Entity", "Src\Dlhis.Entity\Dlhis.Entity.csproj", "{53884925-C9B9-4965-8B0D-100076CA0F43}"
EndProject
@@ -37,7 +37,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "External", "External", "{48
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dlhis.External", "Src\Dlhis.External\Dlhis.External.csproj", "{8472596E-0DE7-4A17-93D6-F0FC7D44FDF5}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dlhis.Canteen.Api", "Src\Dlhis.Canteen.Api\Dlhis.Canteen.Api.csproj", "{961523DE-51BF-42A0-A294-708752C5718D}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dlhis.Canteen.Api", "Src\Dlhis.Canteen.Api\Dlhis.Canteen.Api.csproj", "{961523DE-51BF-42A0-A294-708752C5718D}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dlhis.Scheduled.Api", "Src\Dlhis.Scheduled.Api\Dlhis.Scheduled.Api.csproj", "{9EA85FB2-F320-4F97-B278-00652CF35BD8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -97,6 +99,10 @@ Global
{961523DE-51BF-42A0-A294-708752C5718D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{961523DE-51BF-42A0-A294-708752C5718D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{961523DE-51BF-42A0-A294-708752C5718D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {9EA85FB2-F320-4F97-B278-00652CF35BD8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {9EA85FB2-F320-4F97-B278-00652CF35BD8}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {9EA85FB2-F320-4F97-B278-00652CF35BD8}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {9EA85FB2-F320-4F97-B278-00652CF35BD8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -113,6 +119,7 @@ Global
{1F337648-8A22-4601-A842-0F634FBA2825} = {4EBCE46B-CE3A-4A47-9432-82A1854CA58A}
{8472596E-0DE7-4A17-93D6-F0FC7D44FDF5} = {489252FB-A44B-46EE-B065-21CDCB724441}
{961523DE-51BF-42A0-A294-708752C5718D} = {3D8A98C1-83C9-4375-AEAB-4F72AFAF365B}
+ {9EA85FB2-F320-4F97-B278-00652CF35BD8} = {AA987BDF-EF63-467B-AD04-59F9B10D9000}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7439494A-E2FD-4FEA-8ABF-74AE57A4A5A0}
diff --git a/Src/Dlhis.Basic/Dlhis.Basic.csproj b/Src/Dlhis.Basic/Dlhis.Basic.csproj
index 31536476..401adcbf 100644
--- a/Src/Dlhis.Basic/Dlhis.Basic.csproj
+++ b/Src/Dlhis.Basic/Dlhis.Basic.csproj
@@ -18,11 +18,13 @@
+
+
diff --git a/Src/Dlhis.Basic/Dockerfile b/Src/Dlhis.Basic/Dockerfile
index de53e08e..ca3a29e6 100644
--- a/Src/Dlhis.Basic/Dockerfile
+++ b/Src/Dlhis.Basic/Dockerfile
@@ -5,18 +5,21 @@ WORKDIR /app
EXPOSE 80
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
+ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["Src/Dlhis.Basic/Dlhis.Basic.csproj", "Src/Dlhis.Basic/"]
COPY ["Src/Dlhis.Common.Api/Dlhis.Common.Api.csproj", "Src/Dlhis.Common.Api/"]
COPY ["Src/Dlhis.Entity/Dlhis.Entity.csproj", "Src/Dlhis.Entity/"]
+COPY ["Src/Dlhis.Scheduled.Api/Dlhis.Scheduled.Api.csproj", "Src/Dlhis.Scheduled.Api/"]
COPY ["Src/Dlhis.Sys.Api/Dlhis.Sys.Api.csproj", "Src/Dlhis.Sys.Api/"]
-RUN dotnet restore "Src/Dlhis.Basic/Dlhis.Basic.csproj"
+RUN dotnet restore "./Src/Dlhis.Basic/./Dlhis.Basic.csproj"
COPY . .
WORKDIR "/src/Src/Dlhis.Basic"
-RUN dotnet build "Dlhis.Basic.csproj" -c Release -o /app/build
+RUN dotnet build "./Dlhis.Basic.csproj" -c $BUILD_CONFIGURATION -o /app/build
FROM build AS publish
-RUN dotnet publish "Dlhis.Basic.csproj" -c Release -o /app/publish /p:UseAppHost=false
+ARG BUILD_CONFIGURATION=Release
+RUN dotnet publish "./Dlhis.Basic.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app
diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs
index 8e152fb7..a786146d 100644
--- a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs
+++ b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs
@@ -4,6 +4,8 @@ using Dlhis.Basic.Organization.Response;
using Dlhis.Entity.Basic.Entity;
using Dlhis.Entity.Basic.Enums;
using Dlhis.Entity.Device.Enums;
+using Dlhis.Scheduled.Api;
+using Dlhis.Scheduled.Api.Request;
using Dlhis.Sys.Api;
using Kurisu.AspNetCore.Utils;
using Kurisu.AspNetCore.Utils.Extensions;
@@ -27,6 +29,7 @@ public class GainfoService : IGainfoService
private readonly IServiceProvider _serviceProvider;
private readonly IConfiguration _configuration;
private readonly ITenantApi _tenantApi;
+ private readonly IHangfireApi _hangfireApi;
private readonly ILogger _logger;
public GainfoService(IGainfoStore gainfoStore,
@@ -37,6 +40,7 @@ public class GainfoService : IGainfoService
IServiceProvider serviceProvider,
IConfiguration configuration,
ITenantApi tenantApi,
+ IHangfireApi hangfireApi,
ILogger logger)
{
_gainfoStore = gainfoStore;
@@ -47,6 +51,7 @@ public class GainfoService : IGainfoService
_serviceProvider = serviceProvider;
_configuration = configuration;
_tenantApi = tenantApi;
+ _hangfireApi = hangfireApi;
_logger = logger;
}
@@ -92,7 +97,6 @@ public class GainfoService : IGainfoService
.Select()
.ToPageListAsync(new PageDto { PageIndex = 1, PageSize = 1 });
-
var tenantsResult = await _tenantApi.GetTenantsInternalAsync();
var tenants = tenantsResult.Data;
@@ -179,13 +183,18 @@ public class GainfoService : IGainfoService
public async Task CurrentUserInfoAsync()
{
- var identityId = _currentUser.GetIntSubjectId();
var code = _currentUser.GetUserClaim("jinko-code");
- var gainfo = await _gainfoStore.Queryable().Where(x => x.Code == code).FirstAsync()
- ?? await _gainfoStore.Queryable().Where(x => x.IdentityUserId == identityId).FirstAsync();
+ if (code.IsEmpty())
+ {
+ _logger.LogWarning("工号为空尝试获取人员信息");
+ return null;
+ }
+ var gainfo = await _gainfoStore.Queryable().Where(x => x.Code == code).SingleAsync();
if (gainfo == null)
{
+ //开启同步处理
+ await _hangfireApi.SyncSapPersonAsync(new SapNoRequest { Code = "1231313" });
return null;
}
@@ -266,12 +275,9 @@ public class GainfoService : IGainfoService
public async Task UploadFaceAsync(GainfoUploadFaceRequest request)
{
- var gainfo = await _gainfoStore.Queryable(GainfoStatusEnumType.Working).Where(x => x.No == request.UserNo).FirstAsync();
- gainfo ??= await _gainfoStore.Queryable(GainfoStatusEnumType.External).Where(x => x.No == request.UserNo).FirstAsync();
-
+ var gainfo = await _gainfoStore.Queryable().Where(x => x.No == request.UserNo).FirstAsync();
gainfo.ThrowIfNull("人员档案信息不存在");
-
var userId = _currentUser.GetIntSubjectId();
var faceContext = _dbContext.ChangeDb("face");
@@ -458,7 +464,7 @@ public class GainfoService : IGainfoService
CountryName = ga.CountryNo,
NationName = ga.Nation,
ClassName = ga.IdClass,
-
+
EntryDate = ga.EntryDate,
Workplace = ga.Workplace,
diff --git a/Src/Dlhis.Basic/Properties/launchSettings.json b/Src/Dlhis.Basic/Properties/launchSettings.json
index 2321b0e1..9a6f2460 100644
--- a/Src/Dlhis.Basic/Properties/launchSettings.json
+++ b/Src/Dlhis.Basic/Properties/launchSettings.json
@@ -8,6 +8,14 @@
},
"dotnetRunMessages": true,
"applicationUrl": "http://localhost:5002"
+ },
+ "Docker": {
+ "commandName": "Docker",
+ "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger/index.html",
+ "environmentVariables": {
+ "ASPNETCORE_URLS": "http://+:80"
+ },
+ "publishAllPorts": true
}
},
"$schema": "https://json.schemastore.org/launchsettings.json"
diff --git a/Src/Dlhis.Basic/appsettings.Development.json b/Src/Dlhis.Basic/appsettings.Development.json
index 0701613f..e3e356f0 100644
--- a/Src/Dlhis.Basic/appsettings.Development.json
+++ b/Src/Dlhis.Basic/appsettings.Development.json
@@ -8,7 +8,8 @@
"EightThirtyPM": "20:30:00",
"InternalRequest": {
"CommonRequestUrl": "http://localhost:5001",
- "SysRequestUrl": "http://localhost:5003"
+ "SysRequestUrl": "http://localhost:5003",
+ "ScheduledRequestUrl": "http://localhost:5010"
},
"FaceUrlOptions": {
"Url": "http://localhost:5002/api/gainfos/face?token=",
diff --git a/Src/Dlhis.Basic/appsettings.json b/Src/Dlhis.Basic/appsettings.json
index 7c564ae2..ba7dc14f 100644
--- a/Src/Dlhis.Basic/appsettings.json
+++ b/Src/Dlhis.Basic/appsettings.json
@@ -8,7 +8,8 @@
"AllowedHosts": "*",
"InternalRequest": {
"CommonRequestUrl": "http://common",
- "SysRequestUrl": "http://sys"
+ "SysRequestUrl": "http://sys",
+ "ScheduledRequestUrl": "http://Scheduled"
},
"FaceUrlOptions": {
"Url": "https://yikatong.isawesome.cn/api/basic/gainfos/face?token=",
diff --git a/Src/Dlhis.Scheduled.Api/Dlhis.Scheduled.Api.csproj b/Src/Dlhis.Scheduled.Api/Dlhis.Scheduled.Api.csproj
new file mode 100644
index 00000000..45601c93
--- /dev/null
+++ b/Src/Dlhis.Scheduled.Api/Dlhis.Scheduled.Api.csproj
@@ -0,0 +1,13 @@
+
+
+
+ net6.0
+ enable
+ disable
+
+
+
+
+
+
+
diff --git a/Src/Dlhis.Scheduled.Api/IHangfireApi.cs b/Src/Dlhis.Scheduled.Api/IHangfireApi.cs
new file mode 100644
index 00000000..5119a1f2
--- /dev/null
+++ b/Src/Dlhis.Scheduled.Api/IHangfireApi.cs
@@ -0,0 +1,17 @@
+using Dlhis.Scheduled.Api.Request;
+using Kurisu.Core.Result;
+using Kurisu.RemoteCall.Attributes;
+
+namespace Dlhis.Scheduled.Api;
+
+[EnableRemoteClient(Name = "hangfire-service", BaseUrl = "${InternalRequest:ScheduledRequestUrl}")]
+public interface IHangfireApi
+{
+ ///
+ /// 同步人员
+ ///
+ ///
+ ///
+ [Post("api/hangfire/sap/person/no")]
+ Task SyncSapPersonAsync(SapNoRequest request);
+}
diff --git a/Src/Dlhis.Scheduled.Api/Request/SapNoRequest.cs b/Src/Dlhis.Scheduled.Api/Request/SapNoRequest.cs
new file mode 100644
index 00000000..ab0674c2
--- /dev/null
+++ b/Src/Dlhis.Scheduled.Api/Request/SapNoRequest.cs
@@ -0,0 +1,12 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace Dlhis.Scheduled.Api.Request;
+
+public class SapNoRequest
+{
+ ///
+ /// Code
+ ///
+ [Required(ErrorMessage = "编号不能为空")]
+ public string Code { get; set; }
+}
diff --git a/Src/Dlhis.ScheduledTask/Common/Request/SapPersonNoRequest.cs b/Src/Dlhis.ScheduledTask/Common/Request/SapNoRequest.cs
similarity index 100%
rename from Src/Dlhis.ScheduledTask/Common/Request/SapPersonNoRequest.cs
rename to Src/Dlhis.ScheduledTask/Common/Request/SapNoRequest.cs
diff --git a/Src/Dlhis.ScheduledTask/TaskAssignment/Controllers/HangfireController.cs b/Src/Dlhis.ScheduledTask/TaskAssignment/Controllers/HangfireController.cs
index 7b736b0c..fad7d5cd 100644
--- a/Src/Dlhis.ScheduledTask/TaskAssignment/Controllers/HangfireController.cs
+++ b/Src/Dlhis.ScheduledTask/TaskAssignment/Controllers/HangfireController.cs
@@ -25,6 +25,7 @@ public class HangfireController : ControllerBase
///
///
///
+ [AllowAnonymous]
[HttpPost("sap/person/no")]
public async Task PersonManuallySync(SapNoRequest request)
{