fix 获取档案失败自动发起同步任务
This commit is contained in:
@@ -5,7 +5,7 @@ VisualStudioVersion = 17.7.34302.85
|
|||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Basic", "Basic", "{4EBCE46B-CE3A-4A47-9432-82A1854CA58A}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Basic", "Basic", "{4EBCE46B-CE3A-4A47-9432-82A1854CA58A}"
|
||||||
EndProject
|
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
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dlhis.Entity", "Src\Dlhis.Entity\Dlhis.Entity.csproj", "{53884925-C9B9-4965-8B0D-100076CA0F43}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dlhis.Entity", "Src\Dlhis.Entity\Dlhis.Entity.csproj", "{53884925-C9B9-4965-8B0D-100076CA0F43}"
|
||||||
EndProject
|
EndProject
|
||||||
@@ -37,7 +37,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "External", "External", "{48
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dlhis.External", "Src\Dlhis.External\Dlhis.External.csproj", "{8472596E-0DE7-4A17-93D6-F0FC7D44FDF5}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dlhis.External", "Src\Dlhis.External\Dlhis.External.csproj", "{8472596E-0DE7-4A17-93D6-F0FC7D44FDF5}"
|
||||||
EndProject
|
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
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
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}.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.ActiveCfg = Release|Any CPU
|
||||||
{961523DE-51BF-42A0-A294-708752C5718D}.Release|Any CPU.Build.0 = 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
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
@@ -113,6 +119,7 @@ Global
|
|||||||
{1F337648-8A22-4601-A842-0F634FBA2825} = {4EBCE46B-CE3A-4A47-9432-82A1854CA58A}
|
{1F337648-8A22-4601-A842-0F634FBA2825} = {4EBCE46B-CE3A-4A47-9432-82A1854CA58A}
|
||||||
{8472596E-0DE7-4A17-93D6-F0FC7D44FDF5} = {489252FB-A44B-46EE-B065-21CDCB724441}
|
{8472596E-0DE7-4A17-93D6-F0FC7D44FDF5} = {489252FB-A44B-46EE-B065-21CDCB724441}
|
||||||
{961523DE-51BF-42A0-A294-708752C5718D} = {3D8A98C1-83C9-4375-AEAB-4F72AFAF365B}
|
{961523DE-51BF-42A0-A294-708752C5718D} = {3D8A98C1-83C9-4375-AEAB-4F72AFAF365B}
|
||||||
|
{9EA85FB2-F320-4F97-B278-00652CF35BD8} = {AA987BDF-EF63-467B-AD04-59F9B10D9000}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {7439494A-E2FD-4FEA-8ABF-74AE57A4A5A0}
|
SolutionGuid = {7439494A-E2FD-4FEA-8ABF-74AE57A4A5A0}
|
||||||
|
|||||||
@@ -18,11 +18,13 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Kurisu.AspNetCore" Version="0.8.5" />
|
<PackageReference Include="Kurisu.AspNetCore" Version="0.8.5" />
|
||||||
|
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.5" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Dlhis.Common.Api\Dlhis.Common.Api.csproj" />
|
<ProjectReference Include="..\Dlhis.Common.Api\Dlhis.Common.Api.csproj" />
|
||||||
<ProjectReference Include="..\Dlhis.Entity\Dlhis.Entity.csproj" />
|
<ProjectReference Include="..\Dlhis.Entity\Dlhis.Entity.csproj" />
|
||||||
|
<ProjectReference Include="..\Dlhis.Scheduled.Api\Dlhis.Scheduled.Api.csproj" />
|
||||||
<ProjectReference Include="..\Dlhis.Sys.Api\Dlhis.Sys.Api.csproj" />
|
<ProjectReference Include="..\Dlhis.Sys.Api\Dlhis.Sys.Api.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -5,18 +5,21 @@ WORKDIR /app
|
|||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
|
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
|
||||||
|
ARG BUILD_CONFIGURATION=Release
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
COPY ["Src/Dlhis.Basic/Dlhis.Basic.csproj", "Src/Dlhis.Basic/"]
|
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.Common.Api/Dlhis.Common.Api.csproj", "Src/Dlhis.Common.Api/"]
|
||||||
COPY ["Src/Dlhis.Entity/Dlhis.Entity.csproj", "Src/Dlhis.Entity/"]
|
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/"]
|
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 . .
|
COPY . .
|
||||||
WORKDIR "/src/Src/Dlhis.Basic"
|
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
|
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
|
FROM base AS final
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ using Dlhis.Basic.Organization.Response;
|
|||||||
using Dlhis.Entity.Basic.Entity;
|
using Dlhis.Entity.Basic.Entity;
|
||||||
using Dlhis.Entity.Basic.Enums;
|
using Dlhis.Entity.Basic.Enums;
|
||||||
using Dlhis.Entity.Device.Enums;
|
using Dlhis.Entity.Device.Enums;
|
||||||
|
using Dlhis.Scheduled.Api;
|
||||||
|
using Dlhis.Scheduled.Api.Request;
|
||||||
using Dlhis.Sys.Api;
|
using Dlhis.Sys.Api;
|
||||||
using Kurisu.AspNetCore.Utils;
|
using Kurisu.AspNetCore.Utils;
|
||||||
using Kurisu.AspNetCore.Utils.Extensions;
|
using Kurisu.AspNetCore.Utils.Extensions;
|
||||||
@@ -27,6 +29,7 @@ public class GainfoService : IGainfoService
|
|||||||
private readonly IServiceProvider _serviceProvider;
|
private readonly IServiceProvider _serviceProvider;
|
||||||
private readonly IConfiguration _configuration;
|
private readonly IConfiguration _configuration;
|
||||||
private readonly ITenantApi _tenantApi;
|
private readonly ITenantApi _tenantApi;
|
||||||
|
private readonly IHangfireApi _hangfireApi;
|
||||||
private readonly ILogger<GainfoService> _logger;
|
private readonly ILogger<GainfoService> _logger;
|
||||||
|
|
||||||
public GainfoService(IGainfoStore gainfoStore,
|
public GainfoService(IGainfoStore gainfoStore,
|
||||||
@@ -37,6 +40,7 @@ public class GainfoService : IGainfoService
|
|||||||
IServiceProvider serviceProvider,
|
IServiceProvider serviceProvider,
|
||||||
IConfiguration configuration,
|
IConfiguration configuration,
|
||||||
ITenantApi tenantApi,
|
ITenantApi tenantApi,
|
||||||
|
IHangfireApi hangfireApi,
|
||||||
ILogger<GainfoService> logger)
|
ILogger<GainfoService> logger)
|
||||||
{
|
{
|
||||||
_gainfoStore = gainfoStore;
|
_gainfoStore = gainfoStore;
|
||||||
@@ -47,6 +51,7 @@ public class GainfoService : IGainfoService
|
|||||||
_serviceProvider = serviceProvider;
|
_serviceProvider = serviceProvider;
|
||||||
_configuration = configuration;
|
_configuration = configuration;
|
||||||
_tenantApi = tenantApi;
|
_tenantApi = tenantApi;
|
||||||
|
_hangfireApi = hangfireApi;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,7 +97,6 @@ public class GainfoService : IGainfoService
|
|||||||
.Select<GainfoAllPageResponse>()
|
.Select<GainfoAllPageResponse>()
|
||||||
.ToPageListAsync(new PageDto { PageIndex = 1, PageSize = 1 });
|
.ToPageListAsync(new PageDto { PageIndex = 1, PageSize = 1 });
|
||||||
|
|
||||||
|
|
||||||
var tenantsResult = await _tenantApi.GetTenantsInternalAsync();
|
var tenantsResult = await _tenantApi.GetTenantsInternalAsync();
|
||||||
var tenants = tenantsResult.Data;
|
var tenants = tenantsResult.Data;
|
||||||
|
|
||||||
@@ -179,13 +183,18 @@ public class GainfoService : IGainfoService
|
|||||||
|
|
||||||
public async Task<GainfoCurrentResponse> CurrentUserInfoAsync()
|
public async Task<GainfoCurrentResponse> CurrentUserInfoAsync()
|
||||||
{
|
{
|
||||||
var identityId = _currentUser.GetIntSubjectId();
|
|
||||||
var code = _currentUser.GetUserClaim("jinko-code");
|
var code = _currentUser.GetUserClaim("jinko-code");
|
||||||
var gainfo = await _gainfoStore.Queryable().Where(x => x.Code == code).FirstAsync()
|
if (code.IsEmpty())
|
||||||
?? await _gainfoStore.Queryable().Where(x => x.IdentityUserId == identityId).FirstAsync();
|
{
|
||||||
|
_logger.LogWarning("工号为空尝试获取人员信息");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
var gainfo = await _gainfoStore.Queryable().Where(x => x.Code == code).SingleAsync();
|
||||||
|
|
||||||
if (gainfo == null)
|
if (gainfo == null)
|
||||||
{
|
{
|
||||||
|
//开启同步处理
|
||||||
|
await _hangfireApi.SyncSapPersonAsync(new SapNoRequest { Code = "1231313" });
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -266,12 +275,9 @@ public class GainfoService : IGainfoService
|
|||||||
|
|
||||||
public async Task UploadFaceAsync(GainfoUploadFaceRequest request)
|
public async Task UploadFaceAsync(GainfoUploadFaceRequest request)
|
||||||
{
|
{
|
||||||
var gainfo = await _gainfoStore.Queryable(GainfoStatusEnumType.Working).Where(x => x.No == request.UserNo).FirstAsync();
|
var gainfo = await _gainfoStore.Queryable().Where(x => x.No == request.UserNo).FirstAsync();
|
||||||
gainfo ??= await _gainfoStore.Queryable(GainfoStatusEnumType.External).Where(x => x.No == request.UserNo).FirstAsync();
|
|
||||||
|
|
||||||
gainfo.ThrowIfNull("人员档案信息不存在");
|
gainfo.ThrowIfNull("人员档案信息不存在");
|
||||||
|
|
||||||
|
|
||||||
var userId = _currentUser.GetIntSubjectId();
|
var userId = _currentUser.GetIntSubjectId();
|
||||||
|
|
||||||
var faceContext = _dbContext.ChangeDb("face");
|
var faceContext = _dbContext.ChangeDb("face");
|
||||||
@@ -458,7 +464,7 @@ public class GainfoService : IGainfoService
|
|||||||
CountryName = ga.CountryNo,
|
CountryName = ga.CountryNo,
|
||||||
NationName = ga.Nation,
|
NationName = ga.Nation,
|
||||||
ClassName = ga.IdClass,
|
ClassName = ga.IdClass,
|
||||||
|
|
||||||
EntryDate = ga.EntryDate,
|
EntryDate = ga.EntryDate,
|
||||||
|
|
||||||
Workplace = ga.Workplace,
|
Workplace = ga.Workplace,
|
||||||
|
|||||||
@@ -8,6 +8,14 @@
|
|||||||
},
|
},
|
||||||
"dotnetRunMessages": true,
|
"dotnetRunMessages": true,
|
||||||
"applicationUrl": "http://localhost:5002"
|
"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"
|
"$schema": "https://json.schemastore.org/launchsettings.json"
|
||||||
|
|||||||
@@ -8,7 +8,8 @@
|
|||||||
"EightThirtyPM": "20:30:00",
|
"EightThirtyPM": "20:30:00",
|
||||||
"InternalRequest": {
|
"InternalRequest": {
|
||||||
"CommonRequestUrl": "http://localhost:5001",
|
"CommonRequestUrl": "http://localhost:5001",
|
||||||
"SysRequestUrl": "http://localhost:5003"
|
"SysRequestUrl": "http://localhost:5003",
|
||||||
|
"ScheduledRequestUrl": "http://localhost:5010"
|
||||||
},
|
},
|
||||||
"FaceUrlOptions": {
|
"FaceUrlOptions": {
|
||||||
"Url": "http://localhost:5002/api/gainfos/face?token=",
|
"Url": "http://localhost:5002/api/gainfos/face?token=",
|
||||||
|
|||||||
@@ -8,7 +8,8 @@
|
|||||||
"AllowedHosts": "*",
|
"AllowedHosts": "*",
|
||||||
"InternalRequest": {
|
"InternalRequest": {
|
||||||
"CommonRequestUrl": "http://common",
|
"CommonRequestUrl": "http://common",
|
||||||
"SysRequestUrl": "http://sys"
|
"SysRequestUrl": "http://sys",
|
||||||
|
"ScheduledRequestUrl": "http://Scheduled"
|
||||||
},
|
},
|
||||||
"FaceUrlOptions": {
|
"FaceUrlOptions": {
|
||||||
"Url": "https://yikatong.isawesome.cn/api/basic/gainfos/face?token=",
|
"Url": "https://yikatong.isawesome.cn/api/basic/gainfos/face?token=",
|
||||||
|
|||||||
13
Src/Dlhis.Scheduled.Api/Dlhis.Scheduled.Api.csproj
Normal file
13
Src/Dlhis.Scheduled.Api/Dlhis.Scheduled.Api.csproj
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>disable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Kurisu.RemoteCall" Version="0.2.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
17
Src/Dlhis.Scheduled.Api/IHangfireApi.cs
Normal file
17
Src/Dlhis.Scheduled.Api/IHangfireApi.cs
Normal file
@@ -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
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 同步人员
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[Post("api/hangfire/sap/person/no")]
|
||||||
|
Task<DefaultApiResult> SyncSapPersonAsync(SapNoRequest request);
|
||||||
|
}
|
||||||
12
Src/Dlhis.Scheduled.Api/Request/SapNoRequest.cs
Normal file
12
Src/Dlhis.Scheduled.Api/Request/SapNoRequest.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace Dlhis.Scheduled.Api.Request;
|
||||||
|
|
||||||
|
public class SapNoRequest
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Code
|
||||||
|
/// </summary>
|
||||||
|
[Required(ErrorMessage = "编号不能为空")]
|
||||||
|
public string Code { get; set; }
|
||||||
|
}
|
||||||
@@ -25,6 +25,7 @@ public class HangfireController : ControllerBase
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
[AllowAnonymous]
|
||||||
[HttpPost("sap/person/no")]
|
[HttpPost("sap/person/no")]
|
||||||
public async Task PersonManuallySync(SapNoRequest request)
|
public async Task PersonManuallySync(SapNoRequest request)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user