diff --git a/Src/Dlhis.Basic.Api/ClientHandler/LongRunClientHandler.cs b/Src/Dlhis.Basic.Api/ClientHandler/LongRunClientHandler.cs
new file mode 100644
index 00000000..c6d30176
--- /dev/null
+++ b/Src/Dlhis.Basic.Api/ClientHandler/LongRunClientHandler.cs
@@ -0,0 +1,15 @@
+using Kurisu.RemoteCall.Abstractions;
+using Microsoft.Extensions.DependencyInjection;
+
+namespace Dlhis.Basic.Api.ClientHandler;
+
+public class LongRunClientHandler : IHttpRemoteCallPolicyHandler
+{
+ ///
+ public IHttpClientBuilder ConfigureHttpClient(IHttpClientBuilder builder)
+ {
+ builder.ConfigureHttpClient(x => { x.Timeout = TimeSpan.FromHours(1); });
+
+ return builder;
+ }
+}
\ No newline at end of file
diff --git a/Src/Dlhis.Basic.Api/IGainfoApi.cs b/Src/Dlhis.Basic.Api/IGainfoApi.cs
deleted file mode 100644
index 86b6a3cf..00000000
--- a/Src/Dlhis.Basic.Api/IGainfoApi.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using Kurisu.RemoteCall.Attributes;
-
-namespace Dlhis.Basic.Api;
-
-[RequestResultHandler]
-[EnableRemoteClient(Name = "basic-service", BaseUrl = "${InternalRequest:BasicRequestUrl}")]
-public interface IGainfoApi
-{
- ///
- /// 外包自动离职处理
- ///
- ///
- [Post("/api/gainfoOutsource/autoResign")]
- Task OutsourceAutoResignAsync();
-}
\ No newline at end of file
diff --git a/Src/Dlhis.Basic.Api/ISyncApi.cs b/Src/Dlhis.Basic.Api/ISyncApi.cs
index e02a8064..d4990776 100644
--- a/Src/Dlhis.Basic.Api/ISyncApi.cs
+++ b/Src/Dlhis.Basic.Api/ISyncApi.cs
@@ -1,3 +1,4 @@
+using Dlhis.Basic.Api.ClientHandler;
using Dlhis.Basic.Api.ContentHandlers;
using Dlhis.Basic.Api.Response;
using Kurisu.RemoteCall.Attributes;
@@ -5,7 +6,7 @@ using Kurisu.RemoteCall.Attributes;
namespace Dlhis.Basic.Api;
[RequestResultHandler]
-[EnableRemoteClient(Name = "basic-service", BaseUrl = "${InternalRequest:BasicRequestUrl}")]
+[EnableRemoteClient(Name = "longRun-service", BaseUrl = "${InternalRequest:BasicRequestUrl}", PolicyHandler = typeof(LongRunClientHandler))]
public interface ISyncApi
{
[Post("/api/sync/gainfo/werk")]
@@ -27,4 +28,11 @@ public interface ISyncApi
[Post("/api/sync/businessTrips")]
[RequestContentHandler(typeof(CodeContentHandler))]
Task HandlerBusinessTripsAsync(string code);
+
+ ///
+ /// 外包自动离职处理
+ ///
+ ///
+ [Post("/api/gainfoOutsource/autoResign")]
+ Task OutsourceAutoResignAsync();
}
\ No newline at end of file
diff --git a/Src/Dlhis.Basic/Device/Services/Implements/DevicePermissionService.cs b/Src/Dlhis.Basic/Device/Services/Implements/DevicePermissionService.cs
index e059f83f..a5eba6ef 100644
--- a/Src/Dlhis.Basic/Device/Services/Implements/DevicePermissionService.cs
+++ b/Src/Dlhis.Basic/Device/Services/Implements/DevicePermissionService.cs
@@ -219,7 +219,7 @@ public class DevicePermissionService : IDevicePermissionService
var waitAddTasks = new ConcurrentBag();
var waitDeleteTasks = new ConcurrentBag();
- Parallel.ForEach(userNos, new ParallelOptions() { MaxDegreeOfParallelism = 100 }, userNo =>
+ Parallel.ForEach(userNos, new ParallelOptions { MaxDegreeOfParallelism = 100 }, userNo =>
{
before.TryGetValue(userNo, out var beforeTenantDeviceCodes);
beforeTenantDeviceCodes ??= new List();
diff --git a/Src/Dlhis.Basic/Organization/Controllers/SyncController.cs b/Src/Dlhis.Basic/Organization/Controllers/SyncController.cs
index 14af77d0..b2b1c7f1 100644
--- a/Src/Dlhis.Basic/Organization/Controllers/SyncController.cs
+++ b/Src/Dlhis.Basic/Organization/Controllers/SyncController.cs
@@ -1,6 +1,7 @@
using Dlhis.Basic.Organization.Request;
using Dlhis.Basic.Organization.Services;
using Dlhis.Jip.Api.Responses;
+using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
@@ -23,12 +24,14 @@ public class SyncController : ControllerBase
}
[HttpPost("/api/sync/gainfo/werk")]
+ [IgnoreTenant]
public async Task TodoByWerkAsync(CodeRequest request)
{
await _gainfoUpdateService.TodoByWerkAsync(request.Code);
}
[HttpPost("/api/sync/gainfo/user")]
+ [IgnoreTenant]
public async Task TodoByCodeAsync(CodeRequest request)
{
await _gainfoUpdateService.TodoByCodeAsync(request.Code);
@@ -46,8 +49,9 @@ public class SyncController : ControllerBase
{
return await _jinkoSapService.GetPositionsAsync();
}
-
+
[HttpPost("/api/sync/businessTrips")]
+ [IgnoreTenant]
public async Task GetPositionsAsync(CodeRequest request)
{
await _sapBusinessTripService.HandlerBusinessTripsByFactoryAsync(request.Code);
diff --git a/Src/Dlhis.ScheduledTask/Jobs/OutsourceAutoResignJob.cs b/Src/Dlhis.ScheduledTask/Jobs/OutsourceAutoResignJob.cs
index a0cf2791..72a607fb 100644
--- a/Src/Dlhis.ScheduledTask/Jobs/OutsourceAutoResignJob.cs
+++ b/Src/Dlhis.ScheduledTask/Jobs/OutsourceAutoResignJob.cs
@@ -9,17 +9,17 @@ namespace Dlhis.ScheduledTask.Jobs;
[RecurringJob(nameof(OutsourceAutoResignJob), "0 0 1 1/1 * ? ", Name = "自动处理外包离职")]
public class OutsourceAutoResignJob : BaseJob
{
- private readonly IGainfoApi _gainfoApi;
+ private readonly ISyncApi _syncApi;
///
- public OutsourceAutoResignJob(IServiceProvider serviceProvider, IGainfoApi gainfoApi) : base(serviceProvider)
+ public OutsourceAutoResignJob(IServiceProvider serviceProvider, ISyncApi syncApi) : base(serviceProvider)
{
- _gainfoApi = gainfoApi;
+ _syncApi = syncApi;
}
///
protected override async Task RunAsync(IServiceProvider serviceProvider)
{
- await _gainfoApi.OutsourceAutoResignAsync();
+ await _syncApi.OutsourceAutoResignAsync();
}
}
\ No newline at end of file
diff --git a/Src/Dlhis.ScheduledTask/Jobs/SyncPersonJob.cs b/Src/Dlhis.ScheduledTask/Jobs/SyncPersonJob.cs
index 0539701b..abf781d6 100644
--- a/Src/Dlhis.ScheduledTask/Jobs/SyncPersonJob.cs
+++ b/Src/Dlhis.ScheduledTask/Jobs/SyncPersonJob.cs
@@ -26,13 +26,13 @@ public class SyncPersonJob : BaseJob
{
if (!werk.BackgroundJobKey.IsEmpty())
{
+ var jobKey = BackgroundJob.Enqueue(x => x.SyncGainfoByWerkAsync(werk.Werk));
+ werk.BackgroundJobKey = jobKey;
+ await DbContext.UpdateAsync(werk);
+
continue;
}
- var jobKey = BackgroundJob.Enqueue(x => x.SyncGainfoByWerkAsync(werk.Werk));
- werk.BackgroundJobKey = jobKey;
- await DbContext.UpdateAsync(werk);
-
Logger.LogInformation("SAP创建人事范围{werk}后台调度任务", werk.Werk);
}
}