fix 开放山西人员数据接口
This commit is contained in:
18
Src/Dlhis.ScheduledTask/Common/Dto/GainfoOpenResponse.cs
Normal file
18
Src/Dlhis.ScheduledTask/Common/Dto/GainfoOpenResponse.cs
Normal file
@@ -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; }
|
||||
}
|
||||
66
Src/Dlhis.ScheduledTask/Jobs/SyncShanxiGainfoJob.cs
Normal file
66
Src/Dlhis.ScheduledTask/Jobs/SyncShanxiGainfoJob.cs
Normal file
@@ -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;
|
||||
|
||||
/// <summary>
|
||||
/// 缓存山西档案数据
|
||||
/// </summary>
|
||||
[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<GainfoEntity>()
|
||||
.LeftJoin<DepartmentEntity>((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<GainfoEntity>().AS("GainfoLeave")
|
||||
.LeftJoin<DepartmentEntity>((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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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": {
|
||||
|
||||
Reference in New Issue
Block a user