From 4bc02bd170c7561dae44f248dc73b9ca529d5e76 Mon Sep 17 00:00:00 2001 From: cheche <717840555@qq.com> Date: Tue, 9 Jan 2024 09:07:47 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E5=91=A8=E6=9C=9F=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/Implements/MealUserService.cs | 2 +- Src/Dlhis.ScheduledTask/Job/SyncPersonJob.cs | 56 ++++++++++--------- Src/Dlhis.ScheduledTask/Packs/HangfirePack.cs | 16 ++++-- Src/Dlhis.ScheduledTask/appsettings.json | 2 +- 4 files changed, 43 insertions(+), 33 deletions(-) diff --git a/Src/Dlhis.Basic/MealUser/Services/Implements/MealUserService.cs b/Src/Dlhis.Basic/MealUser/Services/Implements/MealUserService.cs index 56bc97b1..00c933af 100644 --- a/Src/Dlhis.Basic/MealUser/Services/Implements/MealUserService.cs +++ b/Src/Dlhis.Basic/MealUser/Services/Implements/MealUserService.cs @@ -32,7 +32,7 @@ public class MealUserService : IMealUserService public async Task AddAsync(MealUserAddRequest request) { - //todo 获取档案信息 + // 获取档案信息 var gainfoEntity = await _gainfoStore.Queryable(GainfoStatusEnumType.Working) .Where(x => x.No.ToString() == request.UserId) diff --git a/Src/Dlhis.ScheduledTask/Job/SyncPersonJob.cs b/Src/Dlhis.ScheduledTask/Job/SyncPersonJob.cs index 833e07b5..c67e521d 100644 --- a/Src/Dlhis.ScheduledTask/Job/SyncPersonJob.cs +++ b/Src/Dlhis.ScheduledTask/Job/SyncPersonJob.cs @@ -11,6 +11,9 @@ using Dlhis.ScheduledTask.Configurations; using Kurisu.SqlSugar.Services; using Dlhis.Entity.Basic.Entity; using Dlhis.ScheduledTask.Wsproxy.Dlhis.JinkoHr.WsProxy; +using System.Net; +using System; +using Dlhis.Entity.Basic.Enums; namespace Dlhis.ScheduledTask.Job { @@ -159,32 +162,32 @@ namespace Dlhis.ScheduledTask.Job } else { - var info = new GainfoEntity() + var info = new GainfoEntity { - SapNo = item.ano, - No = item.guestno, - GType = item.@class, - Name = item.gname, - Code = item.ename, - CountryNo = item.country, - IdClass = item.idcls, - Native = item.native, - Gender = item.sex, - Birthday = (DateTime)item.birthday, - Address = item.address, - //Occupation = item.occupation, - DepartmentNo = item.appellation, - Nation = item.nation, - Phone = item.phone, - Position = item.web, - //Log_id = item.log_id, - //Log_shift = item.log_shift, - //Log_date = (DateTime)item.log_date, - //Log_ip = item.log_ip, - Employed = item.isowner, - Remark = item.remark, - Degree = item.email, - Werks = item.WERKS, + SapNo = item.ano, + No = item.guestno, + GType = item.@class, + Name = item.gname, + Code = item.ename, + CountryNo = item.country, + IdClass = item.idcls, + Native = item.native, + Gender = item.sex =="女性"? GenderEnumType.Female: GenderEnumType.Male, + Birthday = (DateTime)item.birthday, + Address = item.address, + //Occuption = item.occuption, + DepartmentNo = item.appellation, + Nation =item.nation, + Phone = item.phone, + Position = item.web, + //Log_id = item.log_id, + //Log_shift = item.log_shift, + //tLog_date = item.log_date, + //Log_ip = item.log_ip, + Employed = item.isowner, + Remark = item.remark, + Degree = item.email, + Werks = item.WERKS }; await _dbContext.InsertAsync(info); } @@ -440,4 +443,5 @@ namespace Dlhis.ScheduledTask.Job } } } -} + +} \ No newline at end of file diff --git a/Src/Dlhis.ScheduledTask/Packs/HangfirePack.cs b/Src/Dlhis.ScheduledTask/Packs/HangfirePack.cs index 5453da57..7cf91214 100644 --- a/Src/Dlhis.ScheduledTask/Packs/HangfirePack.cs +++ b/Src/Dlhis.ScheduledTask/Packs/HangfirePack.cs @@ -29,7 +29,7 @@ public class HangfirePack : BaseAppPack }); services.UseHangfireto(); - services.AddHangfireServer(); + services.AddHangfireServer(); } public override void Configure(IApplicationBuilder app, IWebHostEnvironment env) @@ -59,9 +59,15 @@ public class HangfirePack : BaseAppPack app.UseHangfireDashboard(); - BackgroundJob.Enqueue(() => Console.WriteLine("This is a background job.")); - RecurringJob.AddOrUpdate("SyncOrgInfoJob_id", s => s.SyncOrgInfo(), "0 0 0 * * ?"); - RecurringJob.AddOrUpdate("SyncPositionJob_id", s => s.SyncPositionInfo(), "0 0 1 * * ?"); - RecurringJob.AddOrUpdate("SyncPersonJob_id", s => s.SyncPersonInfo(), "0 0 2 * * ?"); + #region 周期任务 + //0:00 + RecurringJob.AddOrUpdate("SyncOrgInfoJob_id", s => s.SyncOrgInfo(), "0 0 16 * * ?"); + + //1:00 + RecurringJob.AddOrUpdate("SyncPositionJob_id", s => s.SyncPositionInfo(), "0 0 17 * * ?"); + + //2:00 + RecurringJob.AddOrUpdate("SyncPersonJob_id", s => s.SyncPersonInfo(), "0 0 18 * * ?"); + #endregion } } diff --git a/Src/Dlhis.ScheduledTask/appsettings.json b/Src/Dlhis.ScheduledTask/appsettings.json index 5bdf1af3..bd03a226 100644 --- a/Src/Dlhis.ScheduledTask/appsettings.json +++ b/Src/Dlhis.ScheduledTask/appsettings.json @@ -13,7 +13,7 @@ "EnableSqlLog": true }, "ConnectionStrings": { - "HangfireConnection": "server=192.168.199.124;port=3306;userid=root;password=dlhis123;database=Hangfire;charset=utf8mb4;Allow User Variables=true;" + "HangfireConnection": "server=192.168.199.124;port=3306;userid=root;password=dlhis123;database=HangFire;charset=utf8mb4;Allow User Variables=true;" }, "ServiceSettings": { "ServerUrl": "http://172.16.7.58:8125",