diff --git a/Src/Dlhis.External/Dlhis.External.csproj b/Src/Dlhis.External/Dlhis.External.csproj
index 5574b14b..8d32d386 100644
--- a/Src/Dlhis.External/Dlhis.External.csproj
+++ b/Src/Dlhis.External/Dlhis.External.csproj
@@ -15,6 +15,7 @@
+
diff --git a/Src/Dlhis.External/OpenApi/Controllers/GainfosController.cs b/Src/Dlhis.External/OpenApi/Controllers/GainfosController.cs
new file mode 100644
index 00000000..36fe292e
--- /dev/null
+++ b/Src/Dlhis.External/OpenApi/Controllers/GainfosController.cs
@@ -0,0 +1,29 @@
+using Dlhis.External.OpenApi.Response;
+using Dlhis.External.OpenApi.Services;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+
+namespace Dlhis.External.OpenApi.Controllers;
+
+[Authorize]
+[Route("api/[controller]")]
+[ApiController]
+public class GainfosController : ControllerBase
+{
+ private readonly IGainfoService _gainfoService;
+
+ public GainfosController(IGainfoService gainfoService)
+ {
+ _gainfoService = gainfoService;
+ }
+
+ ///
+ /// 获取山西所有人员
+ ///
+ ///
+ [HttpGet("shanxi/all")]
+ public async Task> GetAllGainfosAsync()
+ {
+ return await _gainfoService.GetAllGainfosAsync();
+ }
+}
diff --git a/Src/Dlhis.External/OpenApi/Response/GainfoOpenResponse.cs b/Src/Dlhis.External/OpenApi/Response/GainfoOpenResponse.cs
new file mode 100644
index 00000000..0145ae61
--- /dev/null
+++ b/Src/Dlhis.External/OpenApi/Response/GainfoOpenResponse.cs
@@ -0,0 +1,18 @@
+using Dlhis.Entity.Basic.Enums;
+
+namespace Dlhis.External.OpenApi.Response;
+
+public class GainfoOpenResponse
+{
+ public string Code { get; set; }
+
+ public string Name { get; set; }
+
+ public GenderEnumType Gender { get; set; }
+
+ public string DepartmentNo { get; set; }
+
+ public string DepartmentName { get; set; }
+
+ public GainfoStatusEnumType Status { get; set; }
+}
diff --git a/Src/Dlhis.External/OpenApi/Services/IGainfoService.cs b/Src/Dlhis.External/OpenApi/Services/IGainfoService.cs
new file mode 100644
index 00000000..df584ad5
--- /dev/null
+++ b/Src/Dlhis.External/OpenApi/Services/IGainfoService.cs
@@ -0,0 +1,8 @@
+using Dlhis.External.OpenApi.Response;
+
+namespace Dlhis.External.OpenApi.Services;
+
+public interface IGainfoService : IScopeDependency
+{
+ Task> GetAllGainfosAsync();
+}
diff --git a/Src/Dlhis.External/OpenApi/Services/Implements/GainfoService.cs b/Src/Dlhis.External/OpenApi/Services/Implements/GainfoService.cs
new file mode 100644
index 00000000..83458286
--- /dev/null
+++ b/Src/Dlhis.External/OpenApi/Services/Implements/GainfoService.cs
@@ -0,0 +1,21 @@
+using Dlhis.External.OpenApi.Response;
+using Kurisu.AspNetCore.Utils;
+using Kurisu.AspNetCore.Utils.Extensions;
+
+namespace Dlhis.External.OpenApi.Services.Implements;
+
+public class GainfoService : IGainfoService
+{
+ private readonly RedisCache _redisCache;
+
+ public GainfoService(RedisCache redisCache)
+ {
+ _redisCache = redisCache;
+ }
+
+ public async Task> GetAllGainfosAsync()
+ {
+ var data = await _redisCache.ListRangeAsync("gainfo:shanxi");
+ return data.Select(x => x.ToString().ToObject()).ToList();
+ }
+}
diff --git a/Src/Dlhis.External/Program.cs b/Src/Dlhis.External/Program.cs
index 1b577676..d68d2a8f 100644
--- a/Src/Dlhis.External/Program.cs
+++ b/Src/Dlhis.External/Program.cs
@@ -1,4 +1,5 @@
using Kurisu.AspNetCore.Startup;
+using Kurisu.AspNetCore.Utils.Extensions;
using Kurisu.SqlSugar.Extensions;
using Kurisu.Startup;
using Microsoft.IdentityModel.Logging;
@@ -23,6 +24,6 @@ public class Startup : DefaultStartup
base.ConfigureServices(services);
services.AddSqlSugar();
- //services.AddEventBus();
+ services.AddRedis();
}
}
\ No newline at end of file
diff --git a/Src/Dlhis.External/appsettings.Development.json b/Src/Dlhis.External/appsettings.Development.json
index 0c208ae9..17b935d5 100644
--- a/Src/Dlhis.External/appsettings.Development.json
+++ b/Src/Dlhis.External/appsettings.Development.json
@@ -4,5 +4,28 @@
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
+ },
+ "SwaggerOptions": {
+ "Enable": true,
+ "Authority": "https://yikatong.isawesome.cn/oauth2",
+ "ClientId": "4fb184324eac4180",
+ "ClientSecret": "8ac8f235152f1524",
+ "Scopes": {
+ "openid": "openid",
+ "profile": "profile",
+ "yikatong": "yikatong"
+ }
+ },
+ "IdentityServerOptions": {
+ "Authority": "https://yikatong.isawesome.cn/oauth2",
+ "RequireHttpsMetadata": true,
+ "Issuer": "identity.isawesome.cn",
+ "Audience": "",
+ "Pat": {
+ "Enable": false,
+ "Scheme": "token",
+ "ClientId": "reference",
+ "ClientSecret": "123456"
+ }
}
}
diff --git a/Src/Dlhis.External/appsettings.json b/Src/Dlhis.External/appsettings.json
index 1b75d34f..07de2582 100644
--- a/Src/Dlhis.External/appsettings.json
+++ b/Src/Dlhis.External/appsettings.json
@@ -13,6 +13,9 @@
"SlowSqlTime": 1,
"EnableSqlLog": false
},
+ "RedisOptions": {
+ "ConnectionString": "192.168.199.30:30115,defaultDatabase=5,password=dlhis123"
+ },
"SwaggerOptions": {
"Enable": true,
"Authority": "http://identity.oauth.svc.cluster.local",
diff --git a/Src/Dlhis.ScheduledTask/Common/Dto/GainfoOpenResponse.cs b/Src/Dlhis.ScheduledTask/Common/Dto/GainfoOpenResponse.cs
new file mode 100644
index 00000000..ac745401
--- /dev/null
+++ b/Src/Dlhis.ScheduledTask/Common/Dto/GainfoOpenResponse.cs
@@ -0,0 +1,18 @@
+using Dlhis.Entity.Basic.Enums;
+
+namespace Dlhis.ScheduledTask.Common.Dto;
+
+public class GainfoOpenResponse
+{
+ public string Code { get; set; }
+
+ public string Name { get; set; }
+
+ public GenderEnumType Gender { get; set; }
+
+ public string DepartmentNo { get; set; }
+
+ public string DepartmentName { get; set; }
+
+ public GainfoStatusEnumType Status { get; set; }
+}
diff --git a/Src/Dlhis.ScheduledTask/Jobs/SyncShanxiGainfoJob.cs b/Src/Dlhis.ScheduledTask/Jobs/SyncShanxiGainfoJob.cs
new file mode 100644
index 00000000..dd5238bb
--- /dev/null
+++ b/Src/Dlhis.ScheduledTask/Jobs/SyncShanxiGainfoJob.cs
@@ -0,0 +1,66 @@
+using Dlhis.Entity.Basic.Entity;
+using Dlhis.Entity.Basic.Enums;
+using Dlhis.ScheduledTask.Common.Dto;
+using Kurisu.AspNetCore.Utils;
+using Kurisu.Scheduled;
+using Kurisu.Scheduled.Attributes;
+
+namespace Dlhis.ScheduledTask.Jobs;
+
+///
+/// 缓存山西档案数据
+///
+[RecurringJob(nameof(SyncShanxiGainfoJob), "0 0 3 * * ?", Name = "缓存山西档案数据")]
+public class SyncShanxiGainfoJob : BaseJob
+{
+ private readonly RedisCache _redisCache;
+
+ public SyncShanxiGainfoJob(IServiceProvider serviceProvider, RedisCache redisCache) : base(serviceProvider)
+ {
+ _redisCache = redisCache;
+ }
+
+ public override async Task RunAsync(IServiceProvider serviceProvider)
+ {
+ var key = "gainfo:shanxi";
+ await _redisCache.KeyDeleteAsync(key);
+
+ var gainfos = await DbContext.Queryable()
+ .LeftJoin((x, d) => x.DepartmentNo == d.No)
+ .Where(x => x.Factory == "2401")
+ .Select((x, d) => new GainfoOpenResponse
+ {
+ Code = x.Code,
+ DepartmentNo = x.DepartmentNo,
+ DepartmentName = d.Name,
+ Name = x.Name,
+ Gender = x.Gender,
+ Status = GainfoStatusEnumType.Working,
+ })
+ .ToListAsync();
+
+ foreach (var item in gainfos)
+ {
+ await _redisCache.ListLeftPushAsync(key, item);
+ }
+
+ var gainfoLeaves = await DbContext.Queryable().AS("GainfoLeave")
+ .LeftJoin((x, d) => x.DepartmentNo == d.No)
+ .Where(x => x.Factory == "2401")
+ .Select((x, d) => new GainfoOpenResponse
+ {
+ Code = x.Code,
+ DepartmentNo = x.DepartmentNo,
+ DepartmentName = d.Name,
+ Name = x.Name,
+ Gender = x.Gender,
+ Status = GainfoStatusEnumType.Leave,
+ })
+ .ToListAsync();
+
+ foreach (var item in gainfoLeaves)
+ {
+ await _redisCache.ListLeftPushAsync(key, item);
+ }
+ }
+}
diff --git a/Src/Dlhis.ScheduledTask/appsettings.Development.json b/Src/Dlhis.ScheduledTask/appsettings.Development.json
index e0f21b67..4466d061 100644
--- a/Src/Dlhis.ScheduledTask/appsettings.Development.json
+++ b/Src/Dlhis.ScheduledTask/appsettings.Development.json
@@ -24,13 +24,6 @@
"yikatong": "yikatong"
}
},
- "JinkoOptions": {
- "Jip": {
- "BaseUrl": "http://172.16.202.34:8000",
- "Key": "FACE-7409WIBX",
- "Secret": "be0a4b88-cd80-4509-b9b9-865205d0d3d8"
- }
- },
"IdentityServerOptions": {
"Authority": "https://yikatong.isawesome.cn/oauth2",
"RequireHttpsMetadata": true,
@@ -42,5 +35,12 @@
"ClientId": "reference",
"ClientSecret": "123456"
}
+ },
+ "JinkoOptions": {
+ "Jip": {
+ "BaseUrl": "http://172.16.202.34:8000",
+ "Key": "FACE-7409WIBX",
+ "Secret": "be0a4b88-cd80-4509-b9b9-865205d0d3d8"
+ }
}
}
diff --git a/Src/Dlhis.ScheduledTask/appsettings.json b/Src/Dlhis.ScheduledTask/appsettings.json
index 7ff6dba8..11ea038d 100644
--- a/Src/Dlhis.ScheduledTask/appsettings.json
+++ b/Src/Dlhis.ScheduledTask/appsettings.json
@@ -58,7 +58,7 @@
}
},
"RedisOptions": {
- "ConnectionString": "192.168.199.30:30115,defaultDatabase:1,password=dlhis123"
+ "ConnectionString": "192.168.199.30:30115,defaultDatabase=5,password=dlhis123"
},
"AllowedHosts": "*",
"Serilog": {