diff --git a/Src/Dlhis.Basic/BusinessPlace/Services/Implements/BusinessPlaceService.cs b/Src/Dlhis.Basic/BusinessPlace/Services/Implements/BusinessPlaceService.cs
index 0e46c6cc..6e60570a 100644
--- a/Src/Dlhis.Basic/BusinessPlace/Services/Implements/BusinessPlaceService.cs
+++ b/Src/Dlhis.Basic/BusinessPlace/Services/Implements/BusinessPlaceService.cs
@@ -4,7 +4,6 @@ using Dlhis.Entity.Basic.Entity;
using Dlhis.Entity.Canteen.Enums;
using Kurisu.AspNetCore.Utils.Extensions;
using Kurisu.Core.DataAccess.Dto;
-using Kurisu.SqlSugar.Attributes;
using Kurisu.SqlSugar.Extensions;
using Kurisu.SqlSugar.Services;
using Mapster;
diff --git a/Src/Dlhis.Entity/Basic/Entity/GainfoEntity.cs b/Src/Dlhis.Entity/Basic/Entity/GainfoEntity.cs
index 57bbb395..0aa10c72 100644
--- a/Src/Dlhis.Entity/Basic/Entity/GainfoEntity.cs
+++ b/Src/Dlhis.Entity/Basic/Entity/GainfoEntity.cs
@@ -175,4 +175,22 @@ public class GainfoEntity : SugarBaseEntity
///
[SugarColumn(ColumnDescription = "卡号")]
public string CarNo { get; set; }
+
+ ///
+ /// 人事范围
+ ///
+ [SugarColumn(ColumnDescription = "人事范围")]
+ public string Werks { get; set; }
+
+ ///
+ /// 人员号
+ ///
+ [SugarColumn(ColumnDescription = "人员号")]
+ public string Pernr { get; set; }
+
+ ///
+ /// 邮箱
+ ///
+ [SugarColumn(ColumnDescription = "邮箱")]
+ public string Email { get; set; }
}
diff --git a/Src/Dlhis.Entity/Basic/Entity/ZHRF_SYN_01Entity.cs b/Src/Dlhis.Entity/Basic/Entity/ZHRF_SYN_01Entity.cs
new file mode 100644
index 00000000..f7db41cb
--- /dev/null
+++ b/Src/Dlhis.Entity/Basic/Entity/ZHRF_SYN_01Entity.cs
@@ -0,0 +1,93 @@
+using Dlhis.Entity;
+using SqlSugar;
+
+namespace Dlhis.ScheduledTask.Entities
+{
+ ///
+ /// 部门
+ ///
+ [SugarTable(TableName = "T_ORG", TableDescription = "部门表")]
+ public class ZHRF_SYN_01Entity : SugarBaseEntity
+ {
+ ///
+ /// 开始日期
+ ///
+ [SugarColumn(ColumnDescription = "开始日期")]
+ public string BEGDA { get; set; }
+
+ ///
+ /// 结束日期
+ ///
+ [SugarColumn(ColumnDescription = "结束日期")]
+ public string ENDDA { get; set; }
+
+ ///
+ /// 语言代码
+ ///
+ [SugarColumn(ColumnDescription = "语言代码")]
+ public int LANGU { get; set; }
+
+ ///
+ /// 部门id
+ ///
+ [SugarColumn(ColumnDescription = "部门id")]
+ public int OBJID { get; set; }
+
+ ///
+ /// 部门名称
+ ///
+ [SugarColumn(ColumnDescription = "部门名称")]
+ public string STEXT { get; set; }
+
+ ///
+ /// 上级部门
+ ///
+ [SugarColumn(ColumnDescription = "上级部门")]
+ public string SOBID { get; set; }
+
+ ///
+ /// 部门层级
+ ///
+ [SugarColumn(ColumnDescription = "部门层级")]
+ public string ZZ_BMCJ { get; set; }
+
+ ///
+ /// 公司
+ ///
+ [SugarColumn(ColumnDescription = "公司")]
+ public string ORGID01 { get; set; }
+
+ ///
+ /// 事业部
+ ///
+ [SugarColumn(ColumnDescription = "事业部")]
+ public string ORGID02 { get; set; }
+
+ ///
+ /// 一级部门
+ ///
+ [SugarColumn(ColumnDescription = "一级部门")]
+ public string ORGID03 { get; set; }
+
+ ///
+ /// 二级部门
+ ///
+ [SugarColumn(ColumnDescription = "二级部门")]
+ public string ORGID04 { get; set; }
+
+ ///
+ /// 三级部门
+ ///
+ [SugarColumn(ColumnDescription = "三级部门")]
+ public string ORGID05 { get; set; }
+
+ ///
+ /// 四级部门
+ ///
+ [SugarColumn(ColumnDescription = "四级部门")]
+
+ public string ORGID06 { get; set; }
+ }
+
+
+}
diff --git a/Src/Dlhis.Entity/Basic/Entity/ZHRF_SYN_02Entity.cs b/Src/Dlhis.Entity/Basic/Entity/ZHRF_SYN_02Entity.cs
new file mode 100644
index 00000000..17841743
--- /dev/null
+++ b/Src/Dlhis.Entity/Basic/Entity/ZHRF_SYN_02Entity.cs
@@ -0,0 +1,54 @@
+using Dlhis.Entity;
+using SqlSugar;
+
+namespace Dlhis.ScheduledTask.Entities
+{
+ ///
+ /// 职位表
+ ///
+ [SugarTable(TableName = "T_POST", TableDescription = "职位表")]
+ public class ZHRF_SYN_02Entity : SugarBaseEntity
+ {
+ ///
+ /// 开始日期
+ ///
+ [SugarColumn(ColumnDescription = "开始日期")]
+ public string BEGDA { get; set; }
+
+ ///
+ /// 结束日期
+ ///
+ [SugarColumn(ColumnDescription = "结束日期")]
+ public string ENDDA { get; set; }
+
+ ///
+ /// 语言代码
+ ///
+ [SugarColumn(ColumnDescription = "语言代码")]
+ public int LANGU { get; set; }
+
+ ///
+ /// 岗位编码
+ ///
+ [SugarColumn(ColumnDescription = "岗位编码")]
+ public string ZJOBID { get; set; }
+
+ ///
+ /// 岗位名称
+ ///
+ [SugarColumn(ColumnDescription = "岗位名称")]
+ public string ZJOBANME { get; set; }
+
+ ///
+ /// 职等
+ ///
+ [SugarColumn(ColumnDescription = "职等")]
+ public string ZJOBACTID { get; set; }
+
+ ///
+ /// 所属部门ID
+ ///
+ [SugarColumn(ColumnDescription = "所属部门ID")]
+ public string ZDEPID { get; set; }
+ }
+}
diff --git a/Src/Dlhis.ScheduledTask/Comparers/ZHRS_ORGComparer.cs b/Src/Dlhis.ScheduledTask/Comparers/ZHRS_ORGComparer.cs
index a65d70a6..6b13097c 100644
--- a/Src/Dlhis.ScheduledTask/Comparers/ZHRS_ORGComparer.cs
+++ b/Src/Dlhis.ScheduledTask/Comparers/ZHRS_ORGComparer.cs
@@ -1,5 +1,5 @@
-using Dlhis.ScheduledTask.Extensions;
-using Dlhis.ScheduledTask.WsProxy;
+using Dlhis.ScheduledTask.Entities;
+using Dlhis.ScheduledTask.Extensions;
namespace Dlhis.ScheduledTask.Comparers
{
@@ -8,15 +8,26 @@ namespace Dlhis.ScheduledTask.Comparers
public bool Equals(ZHRS_ORG x, ZHRS_ORG y)
{
if (ReferenceEquals(x, y)) return true;
- if (ReferenceEquals(x, null)) return false;
- if (ReferenceEquals(y, null)) return false;
+ if (ReferenceEquals(x, null) || ReferenceEquals(y, null)) return false;
if (x.GetType() != y.GetType()) return false;
- return x.OBJID == y.OBJID && x.STEXT == y.STEXT && x.SOBID == y.SOBID;
+
+ return x.BEGDA == y.BEGDA
+ && x.ENDDA == y.ENDDA
+ && x.LANGU == y.LANGU
+ && x.OBJID == y.OBJID
+ && x.STEXT == y.STEXT
+ && x.SOBID == y.SOBID
+ && x.ORGID01 == y.ORGID01
+ && x.ORGID02 == y.ORGID02;
}
public int GetHashCode(ZHRS_ORG obj)
{
- return obj.OBJID.SafeGetHashCode() ^ obj.STEXT.SafeGetHashCode() ^ obj.SOBID.SafeGetHashCode();
+ return obj.BEGDA.SafeGetHashCode() ^ obj.ENDDA.SafeGetHashCode()
+ ^ obj.LANGU.SafeGetHashCode() ^ obj.OBJID.SafeGetHashCode()
+ ^ obj.STEXT.SafeGetHashCode() ^ obj.SOBID.SafeGetHashCode()
+ ^ obj.ORGID01.SafeGetHashCode() ^ obj.ORGID02.SafeGetHashCode();
}
}
+
}
diff --git a/Src/Dlhis.ScheduledTask/Comparers/ZHRS_PERSONComparer.cs b/Src/Dlhis.ScheduledTask/Comparers/ZHRS_PERSONComparer.cs
index 7fe514fb..3ac15c41 100644
--- a/Src/Dlhis.ScheduledTask/Comparers/ZHRS_PERSONComparer.cs
+++ b/Src/Dlhis.ScheduledTask/Comparers/ZHRS_PERSONComparer.cs
@@ -2,7 +2,7 @@
using Dlhis.ScheduledTask.Extensions;
using System.Text;
-namespace Dlhis.ScheduledTask
+namespace Dlhis.ScheduledTask.Comparers
{
internal class ZHRS_PERSONComparer : IEqualityComparer
{
diff --git a/Src/Dlhis.ScheduledTask/Comparers/ZHRS_POSTComparer.cs b/Src/Dlhis.ScheduledTask/Comparers/ZHRS_POSTComparer.cs
index d74e200e..a52890e3 100644
--- a/Src/Dlhis.ScheduledTask/Comparers/ZHRS_POSTComparer.cs
+++ b/Src/Dlhis.ScheduledTask/Comparers/ZHRS_POSTComparer.cs
@@ -1,4 +1,5 @@
-using Dlhis.ScheduledTask.WsProxy;
+using Dlhis.ScheduledTask.Entities;
+using Dlhis.ScheduledTask.Extensions;
namespace Dlhis.ScheduledTask.Comparers
{
@@ -7,15 +8,25 @@ namespace Dlhis.ScheduledTask.Comparers
public bool Equals(ZHRS_POST x, ZHRS_POST y)
{
if (ReferenceEquals(x, y)) return true;
- if (ReferenceEquals(x, null)) return false;
- if (ReferenceEquals(y, null)) return false;
+ if (ReferenceEquals(x, null) || ReferenceEquals(y, null)) return false;
if (x.GetType() != y.GetType()) return false;
- return x.ZJOBID == y.ZJOBID && x.ZJOBNAME == y.ZJOBNAME && x.ZJOBACTID == y.ZJOBACTID && x.ZDEPID == y.ZDEPID;
+
+ return x.BEGDA == y.BEGDA
+ && x.ENDDA == y.ENDDA
+ && x.LANGU == y.LANGU
+ && x.ZJOBID == y.ZJOBID
+ && x.ZJOBANME == y.ZJOBANME
+ && x.ZZWID == y.ZZWID
+ && x.ZDEPID == y.ZDEPID;
}
public int GetHashCode(ZHRS_POST obj)
{
- return obj.ZJOBID.SafeGetHashCode() ^ obj.ZJOBNAME.SafeGetHashCode() ^ obj.ZJOBACTID.SafeGetHashCode() ^ obj.ZDEPID.SafeGetHashCode();
+ return obj.BEGDA.SafeGetHashCode() ^ obj.ENDDA.SafeGetHashCode()
+ ^ obj.LANGU.SafeGetHashCode() ^ obj.ZJOBID.SafeGetHashCode()
+ ^ obj.ZJOBANME.SafeGetHashCode() ^ obj.ZZWID.SafeGetHashCode()
+ ^ obj.ZDEPID.SafeGetHashCode();
}
}
+
}
diff --git a/Src/Dlhis.ScheduledTask/Configurations/ServiceSettings.cs b/Src/Dlhis.ScheduledTask/Configurations/ServiceSettings.cs
index cdb1fba0..1c381ff1 100644
--- a/Src/Dlhis.ScheduledTask/Configurations/ServiceSettings.cs
+++ b/Src/Dlhis.ScheduledTask/Configurations/ServiceSettings.cs
@@ -3,7 +3,7 @@
namespace Dlhis.ScheduledTask.Configurations
{
- [Configuration]
+ //[Configuration]
public class ServiceSettings
{
public string ServerUrl { get; private set; }
@@ -43,27 +43,7 @@ namespace Dlhis.ScheduledTask.Configurations
/// REST密码
///
public string RestPassword { get; set; }
- public ServiceSettings()
- {
- //ServerUrl = ConfigurationManager.AppSettings[nameof(ServerUrl)];
- //UserName = ConfigurationManager.AppSettings[nameof(UserName)];
- //Password = ConfigurationManager.AppSettings[nameof(Password)];
- //SyncTime = ConfigurationManager.AppSettings[nameof(SyncTime)];
- //DlhisDatabase = ConfigurationManager.AppSettings[nameof(DlhisDatabase)];
- //AttendanceUploadUrl = ConfigurationManager.AppSettings[nameof(AttendanceUploadUrl)];
- //AttendanceUploadInterval = SafeParseInt(ConfigurationManager.AppSettings[nameof(AttendanceUploadInterval)]);
- //Werks = ConfigurationManager.AppSettings[nameof(Werks)];
- //BeginSyncDate = SafeParseDate(ConfigurationManager.AppSettings[nameof(BeginSyncDate)], DateTime.Today);
- //ApiPort = SafeParseInt(ConfigurationManager.AppSettings[nameof(ApiPort)], 8099);
- //EHRWebServiceUserName = ConfigurationManager.AppSettings[nameof(EHRWebServiceUserName)];
- //EHRWebServicePassword = ConfigurationManager.AppSettings[nameof(EHRWebServicePassword)];
- //EHRInsertRecordApiUrl = ConfigurationManager.AppSettings[nameof(EHRInsertRecordApiUrl)];
- //EHRDeleteRecordApiUrl = ConfigurationManager.AppSettings[nameof(EHRDeleteRecordApiUrl)];
- //EHRSavePhotoApiUrl = ConfigurationManager.AppSettings[nameof(EHRSavePhotoApiUrl)];
- //EHR_GET_WORK_CARD_INFOApiUrl = ConfigurationManager.AppSettings[nameof(EHR_GET_WORK_CARD_INFOApiUrl)];
- //RestUserName = ConfigurationManager.AppSettings[nameof(RestUserName)];
- //RestPassword = ConfigurationManager.AppSettings[nameof(RestPassword)];
- }
+
private static int SafeParseInt(string value, int defaultValue = 0)
{
diff --git a/Src/Dlhis.ScheduledTask/Dlhis.ScheduledTask.csproj b/Src/Dlhis.ScheduledTask/Dlhis.ScheduledTask.csproj
index 14b363be..024b57a4 100644
--- a/Src/Dlhis.ScheduledTask/Dlhis.ScheduledTask.csproj
+++ b/Src/Dlhis.ScheduledTask/Dlhis.ScheduledTask.csproj
@@ -2,7 +2,7 @@
net6.0
- disable
+ enable
enable
Linux
..\..
@@ -23,4 +23,8 @@
+
+
+
+
diff --git a/Src/Dlhis.ScheduledTask/Entities/ZHRS_ORG.cs b/Src/Dlhis.ScheduledTask/Entities/ZHRS_ORG.cs
new file mode 100644
index 00000000..387783d9
--- /dev/null
+++ b/Src/Dlhis.ScheduledTask/Entities/ZHRS_ORG.cs
@@ -0,0 +1,76 @@
+using System.Security.Cryptography;
+
+namespace Dlhis.ScheduledTask.Entities
+{
+ public partial class ZHRS_ORG
+ {
+ ///
+ /// 开始日期
+ ///
+ public string BEGDA { get; set; }
+
+ ///
+ /// 结束日期
+ ///
+ public string ENDDA { get; set; }
+
+ ///
+ /// 语言
+ ///
+ public int LANGU { get; set; }
+
+ ///
+ /// 部门id
+ ///
+ public int OBJID { get; set; }
+
+ ///
+ /// 部门名称
+ ///
+ public string STEXT { get; set; }
+
+ ///
+ /// 上级部门
+ ///
+ public string SOBID { get; set; }
+
+ ///
+ /// 公司
+ ///
+ public string ORGID01 { get; set; }
+
+ ///
+ /// 事业部
+ ///
+ public string ORGID02 { get; set; }
+ }
+ public partial class ZHRS_ORG : IEquatable
+ {
+ public bool Equals(ZHRS_ORG other)
+ {
+ if (other is null)
+ return false;
+
+ return this.BEGDA == other.BEGDA
+ && this.ENDDA == other.ENDDA
+ && this.LANGU == other.LANGU
+ && this.OBJID == other.OBJID
+ && this.STEXT == other.STEXT
+ && this.SOBID == other.SOBID
+ && this.ORGID01 == other.ORGID01
+ && this.ORGID02 == other.ORGID02;
+ }
+
+ public override bool Equals(object obj) => Equals(obj as ZHRS_ORG);
+ public override int GetHashCode() => (BEGDA, ENDDA, LANGU, OBJID, STEXT, SOBID, ORGID01, ORGID02).GetHashCode();
+ }
+ public class T_ORG
+ {
+ public List item { get; set; }
+ }
+
+ public class ZHRS_ORGResult
+ {
+ public T_ORG T_ORG { get; set; }
+ }
+}
diff --git a/Src/Dlhis.ScheduledTask/Entities/ZHRS_POST.cs b/Src/Dlhis.ScheduledTask/Entities/ZHRS_POST.cs
new file mode 100644
index 00000000..5788b8fa
--- /dev/null
+++ b/Src/Dlhis.ScheduledTask/Entities/ZHRS_POST.cs
@@ -0,0 +1,69 @@
+namespace Dlhis.ScheduledTask.Entities
+{
+ public partial class ZHRS_POST
+ {
+ ///
+ /// 开始日期
+ ///
+ public string BEGDA { get; set; }
+
+ ///
+ /// 结束日期
+ ///
+ public string ENDDA { get; set; }
+
+ ///
+ /// 语言代码
+ ///
+ public int LANGU { get; set; }
+
+ ///
+ /// 岗位编码
+ ///
+ public string ZJOBID { get; set; }
+
+ ///
+ /// 岗位名称
+ ///
+ public string ZJOBANME { get; set; }
+
+ ///
+ ///
+ ///
+ public string ZZWID { get; set; }
+
+ ///
+ /// 所属部门ID
+ ///
+ public string ZDEPID { get; set; }
+ }
+
+ public partial class ZHRS_POST : IEquatable
+ {
+ public bool Equals(ZHRS_POST other)
+ {
+ if (other is null)
+ return false;
+
+ return this.BEGDA == other.BEGDA
+ && this.ENDDA == other.ENDDA
+ && this.LANGU == other.LANGU
+ && this.ZJOBID == other.ZJOBID
+ && this.ZJOBANME == other.ZJOBANME
+ && this.ZZWID == other.ZZWID
+ && this.ZDEPID == other.ZDEPID;
+ }
+
+ public override bool Equals(object obj) => Equals(obj as ZHRS_POST);
+ public override int GetHashCode() => (BEGDA, ENDDA, LANGU, ZJOBID, ZJOBANME, ZZWID, ZDEPID).GetHashCode();
+ }
+ public class T_POST
+ {
+ public List item { get; set; }
+ }
+
+ public class ZHRS_POSTResult
+ {
+ public T_POST T_POST { get; set; }
+ }
+}
diff --git a/Src/Dlhis.ScheduledTask/HangfirePack.cs b/Src/Dlhis.ScheduledTask/HangfirePack.cs
index 4359a5c1..941cd109 100644
--- a/Src/Dlhis.ScheduledTask/HangfirePack.cs
+++ b/Src/Dlhis.ScheduledTask/HangfirePack.cs
@@ -1,16 +1,21 @@
-using Hangfire;
+using Dlhis.ScheduledTask.Configurations;
+using Dlhis.ScheduledTask.Job;
+using Hangfire;
using Hangfire.Dashboard.BasicAuthorization;
using Hangfire.MySql;
using Kurisu.AspNetCore.Startup;
+
namespace Dlhis.ScheduledTask
{
public class HangfirePack : BaseAppPack
{
- public override bool IsBeforeUseRouting => true;
+ public override bool IsBeforeUseRouting { get; }
public override void ConfigureServices(IServiceCollection services)
{
+
+ services.Configure(Configuration.GetSection("ServiceSettings"));
services.AddHangfire(configuration =>
{
var options = new MySqlStorageOptions
@@ -23,12 +28,13 @@ namespace Dlhis.ScheduledTask
.UseStorage(new MySqlStorage(Configuration.GetConnectionString("HangfireConnection"), options));
});
-
+ services.UseHangfireto();
services.AddHangfireServer();
}
-
+
public override void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
+
app.UseHangfireDashboard("/hangfire", new DashboardOptions
{
AppPath = null,
@@ -52,8 +58,12 @@ namespace Dlhis.ScheduledTask
});
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 * * ?");
}
+
+
}
}
diff --git a/Src/Dlhis.ScheduledTask/Job/HangfireActivator.cs b/Src/Dlhis.ScheduledTask/Job/HangfireActivator.cs
new file mode 100644
index 00000000..0ae96316
--- /dev/null
+++ b/Src/Dlhis.ScheduledTask/Job/HangfireActivator.cs
@@ -0,0 +1,19 @@
+using Hangfire;
+
+namespace Dlhis.ScheduledTask.Job
+{
+ public class HangfireActivator : JobActivator
+ {
+ private readonly IServiceProvider _serviceProvider;
+
+ public HangfireActivator(IServiceProvider serviceProvider)
+ {
+ _serviceProvider = serviceProvider;
+ }
+
+ public override object? ActivateJob(Type jobType)
+ {
+ return _serviceProvider.GetService(jobType);
+ }
+ }
+}
diff --git a/Src/Dlhis.ScheduledTask/Job/JinkoHrJob.cs b/Src/Dlhis.ScheduledTask/Job/JinkoHrJob.cs
deleted file mode 100644
index 4cbcdb01..00000000
--- a/Src/Dlhis.ScheduledTask/Job/JinkoHrJob.cs
+++ /dev/null
@@ -1,405 +0,0 @@
-using Dlhis.ScheduledTask.Configurations;
-using Dlhis.ScheduledTask.Dto;
-using Dlhis.ScheduledTask.Entities;
-using Dlhis.ScheduledTask.Response;
-using Hangfire.Logging;
-using Newtonsoft.Json;
-using Serilog;
-using System.Net.Http.Headers;
-using System.Text;
-using Dlhis.ScheduledTask.WsProxy;
-using Microsoft.Extensions.Options;
-
-namespace Dlhis.ScheduledTask.Job
-{
- public class JinkoHrJob
- {
- private List lastUpdatedPersonList = new List();
- private List lastUpdatedOrgList = new List();
- private List lastUpdatedPositionList = new List();
-
- public ServiceSettings Settings { get; }
- private readonly ZHRS_WERKS[] werks;
- private readonly ILogger _logger;
- private readonly ServiceSettings _serviceSettings;
-
- public JinkoHrJob(ILogger logger, IOptions options)
- {
- _logger = logger;
- _serviceSettings = options.Value;
- }
-
- private PersonResult GetPersons()
- {
- HttpClient httpClient = new HttpClient();
- httpClient.Timeout = TimeSpan.FromMinutes(10);
- var credentials = string.Format("{0}:{1}", "EHS_USER", "y3R1hd2h*RICAC");
- var headerValue = Convert.ToBase64String(Encoding.UTF8.GetBytes(credentials));
- httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", headerValue);
-
- List persons = new List();
-
- foreach (var item in werks)
- {
- try
- {
- var body = new
- {
- T_WERKS = new
- {
- item = new List