fix 字段名称
This commit is contained in:
@@ -79,14 +79,14 @@ public class DeviceEntity : SugarBaseEntity, ITenantId
|
||||
/// <summary>
|
||||
/// 最后使用人
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "最后使用人")]
|
||||
public DateTime LastLogId { get; set; }
|
||||
[SugarColumn(IsNullable = true, ColumnDescription = "最后使用人")]
|
||||
public DateTime? LastLogId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最后使用日期
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "最后使用日期")]
|
||||
public DateTime LastLogDateTime { get; set; }
|
||||
[SugarColumn(IsNullable = true, ColumnDescription = "最后使用日期")]
|
||||
public DateTime? LastLogDateTime { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -12,49 +12,55 @@ public class GainfoEntity : SugarBaseEntity
|
||||
/// 档案号
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "档案号")]
|
||||
public string Guestno { get; set; }
|
||||
public string No { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// SAP内部编号
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "SAP内部编号")]
|
||||
public string Ano { get; set; }
|
||||
public string SapNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 人员类型
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "人员类型")]
|
||||
public string Class { get; set; }
|
||||
public string GType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 姓名
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "姓名")]
|
||||
public string Gname { get; set; }
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 外文名字
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "外文名字")]
|
||||
public string NameEn { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工号
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "工号")]
|
||||
public string Ename { get; set; }
|
||||
public string Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 国家代码
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "国家代码")]
|
||||
public string Country { get; set; }
|
||||
public string CountryNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 证件类型代码
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "证件类型代码")]
|
||||
public string Idcls { get; set; }
|
||||
public string IdClass { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 身份证号
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "身份证号")]
|
||||
public string IdNO { get; set; }
|
||||
public string IdNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 身份证籍贯区域代码
|
||||
@@ -66,7 +72,7 @@ public class GainfoEntity : SugarBaseEntity
|
||||
/// 性别
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "性别")]
|
||||
public string Sex { get; set; }
|
||||
public string Gender { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 生日
|
||||
@@ -84,13 +90,13 @@ public class GainfoEntity : SugarBaseEntity
|
||||
/// 已婚/未婚
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "已婚/未婚")]
|
||||
public string Postcode { get; set; }
|
||||
public string Marital { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 部门编码
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "部门编码")]
|
||||
public string Appellation { get; set; }
|
||||
public string DepartmentNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 民族代码
|
||||
@@ -104,12 +110,6 @@ public class GainfoEntity : SugarBaseEntity
|
||||
[SugarColumn(ColumnDescription = "手机号码")]
|
||||
public string Phone { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 联系电话
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "联系电话")]
|
||||
public string Mobile { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 学历
|
||||
/// </summary>
|
||||
@@ -120,55 +120,7 @@ public class GainfoEntity : SugarBaseEntity
|
||||
/// 岗位
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "岗位")]
|
||||
public string Web { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "备注")]
|
||||
public string Remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作账号
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "操作账号")]
|
||||
public string Log_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作班次
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "操作班次")]
|
||||
public string Log_shift { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作时间
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "操作时间")]
|
||||
public DateTime Log_date { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作IP
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "操作IP")]
|
||||
public string Log_ip { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否在职 F 在职 T离职
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "是否在职 F 在职 T离职")]
|
||||
public string Isowner { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "创建时间")]
|
||||
public DateTime Createdate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 外文名字
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "外文名字")]
|
||||
public string Gname_en { get; set; }
|
||||
public string Position { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 卡号
|
||||
@@ -176,6 +128,12 @@ public class GainfoEntity : SugarBaseEntity
|
||||
[SugarColumn(ColumnDescription = "卡号")]
|
||||
public string CarNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "备注")]
|
||||
public string Remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 人事范围
|
||||
/// </summary>
|
||||
@@ -183,14 +141,8 @@ public class GainfoEntity : SugarBaseEntity
|
||||
public string Werks { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 人员号
|
||||
/// 在职状态
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "人员号")]
|
||||
public string Pernr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 邮箱
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "邮箱")]
|
||||
public string Email { get; set; }
|
||||
[SugarColumn(ColumnDescription = "在职状态")]
|
||||
public string Employed { get; set; }
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Dlhis.Entity.Basic.Enums;
|
||||
public enum GainfoStatusEnumType
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// 在职
|
||||
/// </summary>
|
||||
[Description("在职")]
|
||||
Working = 1,
|
||||
@@ -21,7 +21,7 @@ public enum GainfoStatusEnumType
|
||||
Leave = 2,
|
||||
|
||||
/// <summary>
|
||||
/// 外部人员
|
||||
/// 外部
|
||||
/// </summary>
|
||||
[Description("外部")]
|
||||
External = 3
|
||||
|
||||
@@ -12,10 +12,10 @@ namespace Dlhis.Entity.Sys.Entities;
|
||||
public class MenuPermissionEntity : SugarBaseEntity, ITenantId, ISoftDeleted
|
||||
{
|
||||
/// <summary>
|
||||
/// 权限类型
|
||||
/// 权限分配类型
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDataType = "varchar(50)", ColumnDescription = "权限类型", SqlParameterDbType = typeof(EnumToStringConvert))]
|
||||
public MenuPermissionTypeEnumType UniqueType { get; set; }
|
||||
[SugarColumn(ColumnDataType = "varchar(50)", ColumnDescription = "权限分配类型", SqlParameterDbType = typeof(EnumToStringConvert))]
|
||||
public MenuAssignmentTypeEnumType UniqueType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 类型值
|
||||
|
||||
@@ -5,8 +5,8 @@ namespace Dlhis.Entity.Sys.Enums;
|
||||
/// <summary>
|
||||
/// 权限类型
|
||||
/// </summary>
|
||||
[Description("权限类型")]
|
||||
public enum MenuPermissionTypeEnumType
|
||||
[Description("权限分配类型")]
|
||||
public enum MenuAssignmentTypeEnumType
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
namespace Dlhis.ScheduledTask.Configurations
|
||||
{
|
||||
//[Configuration]
|
||||
[Configuration]
|
||||
public class ServiceSettings
|
||||
{
|
||||
public string ServerUrl { get; private set; }
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
<PackageReference Include="Hangfire.Dashboard.BasicAuthorization" Version="1.0.2" />
|
||||
<PackageReference Include="Hangfire.MySqlStorage" Version="2.0.3" />
|
||||
<PackageReference Include="Kurisu.AspNetCore" Version="0.4.7" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.4" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -7,6 +7,7 @@ EXPOSE 80
|
||||
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
|
||||
WORKDIR /src
|
||||
COPY ["Src/Dlhis.ScheduledTask/Dlhis.ScheduledTask.csproj", "Src/Dlhis.ScheduledTask/"]
|
||||
COPY ["Src/Dlhis.Entity/Dlhis.Entity.csproj", "Src/Dlhis.Entity/"]
|
||||
RUN dotnet restore "Src/Dlhis.ScheduledTask/Dlhis.ScheduledTask.csproj"
|
||||
COPY . .
|
||||
WORKDIR "/src/Src/Dlhis.ScheduledTask"
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
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 { get; }
|
||||
|
||||
public override void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
|
||||
services.Configure<ServiceSettings>(Configuration.GetSection("ServiceSettings"));
|
||||
services.AddHangfire(configuration =>
|
||||
{
|
||||
var options = new MySqlStorageOptions
|
||||
{
|
||||
TablesPrefix = "Hangfire"
|
||||
};
|
||||
|
||||
configuration.UseSimpleAssemblyNameTypeSerializer()
|
||||
.UseRecommendedSerializerSettings()
|
||||
.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,
|
||||
DashboardTitle = "hangfire",
|
||||
Authorization = new[]
|
||||
{
|
||||
new BasicAuthAuthorizationFilter(new BasicAuthAuthorizationFilterOptions
|
||||
{
|
||||
RequireSsl = false,
|
||||
SslRedirect = false,
|
||||
Users = new []
|
||||
{
|
||||
new BasicAuthAuthorizationUser
|
||||
{
|
||||
Login ="admin",
|
||||
PasswordClear = "admin"
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
app.UseHangfireDashboard();
|
||||
BackgroundJob.Enqueue(() => Console.WriteLine("This is a background job."));
|
||||
RecurringJob.AddOrUpdate<SyncOrgInfoJob>("SyncOrgInfoJob_id", s => s.SyncOrgInfo(), "0 0 0 * * ?");
|
||||
RecurringJob.AddOrUpdate<SyncPositionJob>("SyncPositionJob_id", s =>s.SyncPositionInfo(), "0 0 1 * * ?");
|
||||
RecurringJob.AddOrUpdate<SyncPersonJob>("SyncPersonJob_id", s => s.SyncPersonInfo(), "0 0 2 * * ?");
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -22,9 +22,9 @@ namespace Dlhis.ScheduledTask.Job
|
||||
_dbContext = dbContext;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public async Task SyncOrgInfo()
|
||||
|
||||
public async Task SyncOrgInfo()
|
||||
{
|
||||
HttpClient httpClient = new HttpClient();
|
||||
httpClient.Timeout = TimeSpan.FromMinutes(10);
|
||||
@@ -32,8 +32,7 @@ namespace Dlhis.ScheduledTask.Job
|
||||
var headerValue = Convert.ToBase64String(Encoding.UTF8.GetBytes(credentials));
|
||||
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", headerValue);
|
||||
|
||||
string apiUrl =
|
||||
"http://sappidap.jinkosolar.cn:51000/RESTAdapter/Rest/EHR_ORGANIZATION/";
|
||||
string apiUrl = "http://sappidap.jinkosolar.cn:51000/RESTAdapter/Rest/EHR_ORGANIZATION/";
|
||||
|
||||
|
||||
string requestBody = "{\"I_DATE\":\"2021-01-01\",\"I_DATE_TO\":\"2022-05-29\",\"I_LANGU\":\"1\",\"T_ID\":{\"item\":[{\"OBJID\":\"50007967\"},{\"OBJID\":\"50008308\"}]}}";
|
||||
@@ -43,7 +42,7 @@ namespace Dlhis.ScheduledTask.Job
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
string responseData = await response.Content.ReadAsStringAsync();
|
||||
ZHRS_ORGResult orgResult = JsonSerializer.Deserialize<ZHRS_ORGResult>(responseData);
|
||||
ZHRS_ORGResult orgResult = JsonSerializer.Deserialize<ZHRS_ORGResult>(responseData);
|
||||
|
||||
if (orgResult.T_ORG != null && orgResult.T_ORG.item.Count > 0)
|
||||
{
|
||||
@@ -52,10 +51,10 @@ namespace Dlhis.ScheduledTask.Job
|
||||
// 使用 SQLSugar 将新数据同步到数据库
|
||||
await SaveOrg(modifiedOrgList);
|
||||
}
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// Console.WriteLine($"HTTP请求失败,状态码:{response.StatusCode}");
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// Console.WriteLine($"HTTP请求失败,状态码:{response.StatusCode}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,19 +69,17 @@ namespace Dlhis.ScheduledTask.Job
|
||||
return sapList.Except(needRemove, new ZHRS_ORGComparer()).ToList();
|
||||
}
|
||||
|
||||
private async Task SaveOrg(List<ZHRS_ORG> modifiedOrgList)
|
||||
private async Task SaveOrg(List<ZHRS_ORG> modifiedOrgList)
|
||||
{
|
||||
if (modifiedOrgList == null || modifiedOrgList.Count == 0) return;
|
||||
|
||||
foreach (ZHRS_ORG item in modifiedOrgList)
|
||||
{
|
||||
|
||||
|
||||
var existingOrgs = await _dbContext.Queryable<ZHRF_SYN_01Entity>().Where(x => x.OBJID == item.OBJID).FirstAsync();
|
||||
|
||||
if (existingOrgs != null)
|
||||
{
|
||||
var org = item.Adapt(existingOrgs);
|
||||
var org = item.Adapt(existingOrgs);
|
||||
await _dbContext.UpdateAsync(org);
|
||||
}
|
||||
else
|
||||
@@ -90,7 +87,7 @@ namespace Dlhis.ScheduledTask.Job
|
||||
var org = item.Adapt<ZHRF_SYN_01Entity>();
|
||||
await _dbContext.InsertAsync(org);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,8 +82,8 @@ namespace Dlhis.ScheduledTask.Job
|
||||
//var existsWorkCodes = conn.Query<string>($"select ename from gainfo_sap where ename in ( {string.Join(",", searchCodes.Select(x => $"'{x}'"))} )")
|
||||
// .ToList();
|
||||
var existsWorkCodes = _dbContext.Queryable<GainfoEntity>()
|
||||
.Where(x => searchCodes.Contains(x.Ename))
|
||||
.Select(x => x.Ename)
|
||||
.Where(x => searchCodes.Contains(x.Code))
|
||||
.Select(x => x.Code)
|
||||
.ToList();
|
||||
|
||||
var originUpdates = persons.Where(x => existsWorkCodes.Contains(x.ZWORKCODE)).ToList();
|
||||
@@ -120,7 +120,7 @@ namespace Dlhis.ScheduledTask.Job
|
||||
i++;
|
||||
try
|
||||
{
|
||||
await UpdatePerson(item);
|
||||
await UpdatePerson(item);
|
||||
//conn.Execute(SqlGeneration.UpdateSql, item);
|
||||
//log.Debug($"执行更新{i}/{currentTotal} name:{item.gname},ename:{item.ename}");
|
||||
}
|
||||
@@ -142,19 +142,18 @@ namespace Dlhis.ScheduledTask.Job
|
||||
|
||||
private async Task SavePerson(GainfoSap item)
|
||||
{
|
||||
var gainfo = await _dbContext.Queryable<GainfoEntity>().Where(x => x.IdNO == item.idno).FirstAsync();
|
||||
var gainfo = await _dbContext.Queryable<GainfoEntity>().Where(x => x.IdNo == item.idno).FirstAsync();
|
||||
if (gainfo != null)
|
||||
{
|
||||
gainfo.Pernr = item.PERNR;
|
||||
gainfo.Gname = item.gname;
|
||||
gainfo.Ename = item.ename;
|
||||
gainfo.Web = item.web;
|
||||
gainfo.SapNo = item.PERNR;
|
||||
gainfo.Name = item.gname;
|
||||
gainfo.Code = item.ename;
|
||||
gainfo.Position = item.web;
|
||||
gainfo.Phone = item.phone;
|
||||
gainfo.Appellation = item.appellation;
|
||||
gainfo.Isowner = item.isowner;
|
||||
gainfo.DepartmentNo = item.appellation;
|
||||
gainfo.Employed = item.isowner;
|
||||
gainfo.Remark = item.remark;
|
||||
gainfo.Email = item.email;
|
||||
gainfo.Createdate = (DateTime)item.createdate;
|
||||
gainfo.Degree = item.email;
|
||||
gainfo.Werks = item.WERKS;
|
||||
await _dbContext.UpdateAsync(gainfo);
|
||||
}
|
||||
@@ -162,30 +161,29 @@ namespace Dlhis.ScheduledTask.Job
|
||||
{
|
||||
var info = new GainfoEntity()
|
||||
{
|
||||
Ano = item.ano,
|
||||
Guestno = item.guestno,
|
||||
Class = item.@class,
|
||||
Gname = item.gname,
|
||||
Ename = item.ename,
|
||||
Country = item.country,
|
||||
Idcls = item.idcls,
|
||||
SapNo = item.ano,
|
||||
No = item.guestno,
|
||||
GType = item.@class,
|
||||
Name = item.gname,
|
||||
Code = item.ename,
|
||||
CountryNo = item.country,
|
||||
IdClass = item.idcls,
|
||||
Native = item.native,
|
||||
Sex = item.sex,
|
||||
Gender = item.sex,
|
||||
Birthday = (DateTime)item.birthday,
|
||||
Address = item.address,
|
||||
//Occupation = item.occupation,
|
||||
Appellation = item.appellation,
|
||||
DepartmentNo = item.appellation,
|
||||
Nation = item.nation,
|
||||
Phone = item.phone,
|
||||
Web = item.web,
|
||||
Log_id = item.log_id,
|
||||
Log_shift = item.log_shift,
|
||||
Log_date = (DateTime)item.log_date,
|
||||
Log_ip = item.log_ip,
|
||||
Isowner = item.isowner,
|
||||
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,
|
||||
Email = item.email,
|
||||
Createdate = (DateTime)item.createdate,
|
||||
Degree = item.email,
|
||||
Werks = item.WERKS,
|
||||
};
|
||||
await _dbContext.InsertAsync(info);
|
||||
@@ -193,46 +191,44 @@ namespace Dlhis.ScheduledTask.Job
|
||||
}
|
||||
private async Task UpdatePerson(GainfoSap item)
|
||||
{
|
||||
var gainfo = await _dbContext.Queryable<GainfoEntity>().Where(x => x.IdNO == item.idno).FirstAsync();
|
||||
var gainfo = await _dbContext.Queryable<GainfoEntity>().Where(x => x.IdNo == item.idno).FirstAsync();
|
||||
if (gainfo != null)
|
||||
{
|
||||
_dbContext.Updateable<GainfoEntity>().SetColumns(g => new GainfoEntity
|
||||
{
|
||||
Pernr = item.PERNR,
|
||||
Gname = item.gname,
|
||||
Ename = item.ename,
|
||||
Web = item.web,
|
||||
SapNo = item.PERNR,
|
||||
Name = item.gname,
|
||||
Code = item.ename,
|
||||
Position = item.web,
|
||||
Phone = item.phone,
|
||||
Appellation = item.appellation,
|
||||
Isowner = item.isowner,
|
||||
DepartmentNo = item.appellation,
|
||||
Employed = item.isowner,
|
||||
Remark = item.remark,
|
||||
Email = item.email,
|
||||
Createdate = (DateTime)item.createdate,
|
||||
Degree = item.email,
|
||||
Werks = item.WERKS
|
||||
})
|
||||
.Where(g => g.IdNO == item.idno
|
||||
&& !_dbContext.Queryable<GainfoEntity>().Any(g => g.IdNO == item.idno && g.Pernr != item.PERNR && g.Isowner == "T")
|
||||
&& !_dbContext.Queryable<GainfoEntity>().Any(g => g.IdNO == item.idno && int.Parse(g.Pernr) > int.Parse(item.PERNR) && g.Isowner == item.isowner));
|
||||
.Where(g => g.IdNo == item.idno
|
||||
&& !_dbContext.Queryable<GainfoEntity>().Any(g => g.IdNo == item.idno && g.SapNo != item.PERNR && g.Employed == "T")
|
||||
&& !_dbContext.Queryable<GainfoEntity>().Any(g => g.IdNo == item.idno && int.Parse(g.SapNo) > int.Parse(item.PERNR) && g.Employed == item.isowner));
|
||||
}
|
||||
else
|
||||
{
|
||||
_dbContext.Updateable<GainfoEntity>().SetColumns(g => new GainfoEntity
|
||||
{
|
||||
Pernr = item.PERNR,
|
||||
Gname = item.gname,
|
||||
Ename = item.ename,
|
||||
Web = item.web,
|
||||
SapNo = item.PERNR,
|
||||
Name = item.gname,
|
||||
Code = item.ename,
|
||||
Position = item.web,
|
||||
Phone = item.phone,
|
||||
Appellation = item.appellation,
|
||||
Isowner = item.isowner,
|
||||
DepartmentNo = item.appellation,
|
||||
Employed = item.isowner,
|
||||
Remark = item.remark,
|
||||
Email = item.email,
|
||||
Createdate = (DateTime)item.createdate,
|
||||
Degree = item.email,
|
||||
Werks = item.WERKS
|
||||
})
|
||||
.Where(g => g.Ano == item.PERNR
|
||||
&& !_dbContext.Queryable<GainfoEntity>().Any(g => g.Ename == item.ename && g.Isowner == "T")
|
||||
&& !_dbContext.Queryable<GainfoEntity>().Any(g => g.IdNO == item.idno && int.Parse(g.Pernr) > int.Parse(item.PERNR) && g.Isowner == item.isowner));
|
||||
.Where(g => g.SapNo == item.PERNR
|
||||
&& !_dbContext.Queryable<GainfoEntity>().Any(g => g.Code == item.ename && g.Employed == "T")
|
||||
&& !_dbContext.Queryable<GainfoEntity>().Any(g => g.IdNo == item.idno && int.Parse(g.SapNo) > int.Parse(item.PERNR) && g.Employed == item.isowner));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
67
Src/Dlhis.ScheduledTask/Packs/HangfirePack.cs
Normal file
67
Src/Dlhis.ScheduledTask/Packs/HangfirePack.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
using Dlhis.ScheduledTask.Configurations;
|
||||
using Dlhis.ScheduledTask.Job;
|
||||
using Hangfire;
|
||||
using Hangfire.Dashboard.BasicAuthorization;
|
||||
using Hangfire.MySql;
|
||||
using Kurisu.AspNetCore.Startup;
|
||||
|
||||
|
||||
namespace Dlhis.ScheduledTask.Packs;
|
||||
|
||||
public class HangfirePack : BaseAppPack
|
||||
{
|
||||
public override bool IsBeforeUseRouting { get; }
|
||||
|
||||
public override void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
|
||||
services.Configure<ServiceSettings>(Configuration.GetSection("ServiceSettings"));
|
||||
services.AddHangfire(configuration =>
|
||||
{
|
||||
var options = new MySqlStorageOptions
|
||||
{
|
||||
TablesPrefix = "Hangfire"
|
||||
};
|
||||
|
||||
configuration.UseSimpleAssemblyNameTypeSerializer()
|
||||
.UseRecommendedSerializerSettings()
|
||||
.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,
|
||||
DashboardTitle = "hangfire",
|
||||
Authorization = new[]
|
||||
{
|
||||
new BasicAuthAuthorizationFilter(new BasicAuthAuthorizationFilterOptions
|
||||
{
|
||||
RequireSsl = false,
|
||||
SslRedirect = false,
|
||||
Users = new []
|
||||
{
|
||||
new BasicAuthAuthorizationUser
|
||||
{
|
||||
Login ="admin",
|
||||
PasswordClear = "admin"
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
app.UseHangfireDashboard();
|
||||
|
||||
BackgroundJob.Enqueue(() => Console.WriteLine("This is a background job."));
|
||||
RecurringJob.AddOrUpdate<SyncOrgInfoJob>("SyncOrgInfoJob_id", s => s.SyncOrgInfo(), "0 0 0 * * ?");
|
||||
RecurringJob.AddOrUpdate<SyncPositionJob>("SyncPositionJob_id", s => s.SyncPositionInfo(), "0 0 1 * * ?");
|
||||
RecurringJob.AddOrUpdate<SyncPersonJob>("SyncPersonJob_id", s => s.SyncPersonInfo(), "0 0 2 * * ?");
|
||||
}
|
||||
}
|
||||
15
Src/Dlhis.ScheduledTask/Packs/SqlSugarPack.cs
Normal file
15
Src/Dlhis.ScheduledTask/Packs/SqlSugarPack.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using Kurisu.AspNetCore.Startup;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
|
||||
namespace Dlhis.ScheduledTask.Packs;
|
||||
|
||||
public class SqlSugarPack : BaseAppPack
|
||||
{
|
||||
public override bool IsBeforeUseRouting { get; }
|
||||
|
||||
public override void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddHttpContextAccessor();
|
||||
services.AddSqlSugar();
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,5 @@ public class Startup : DefaultStartup
|
||||
{
|
||||
public Startup(IConfiguration configuration) : base(configuration)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
using System.Linq;
|
||||
using Dlhis.ScheduledTask.Entities;
|
||||
|
||||
namespace Dlhis
|
||||
{
|
||||
public class SqlGeneration
|
||||
{
|
||||
private static string _insertSql;
|
||||
private static string _updateSql;
|
||||
|
||||
static SqlGeneration()
|
||||
{
|
||||
//""
|
||||
var properties = typeof(GainfoSap).GetProperties();
|
||||
|
||||
var insertFields = properties
|
||||
.Where(x => !x.IsDefined(typeof(IgnoreColumnAttribute), false))
|
||||
.Where(x => !x.IsDefined(typeof(PkColumnAttribute), false))
|
||||
.Select(x => x.Name);
|
||||
_insertSql = $" insert into gainfo_sap({string.Join(",", insertFields)}) \r\n values \r\n ({string.Join(",", insertFields.Select(x => $"@{x}"))})";
|
||||
|
||||
var updateFields = properties
|
||||
.Where(x => !x.IsDefined(typeof(IgnoreColumnAttribute), false))
|
||||
.Where(x => !x.IsDefined(typeof(PkColumnAttribute), false))
|
||||
.Where(x => !x.IsDefined(typeof(UpdateColumnAttribute), false))
|
||||
.Select(x => x.Name);
|
||||
_updateSql = $" update gainfo_sap set {string.Join(",", updateFields.Select(x => $"{x}=@{x}"))} \t\n where ename=@ename";
|
||||
}
|
||||
|
||||
public static string InsertSql => _insertSql;
|
||||
public static string UpdateSql => _updateSql;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
using Kurisu.AspNetCore.Startup;
|
||||
using Kurisu.AspNetCore;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Dlhis.ScheduledTask
|
||||
{
|
||||
public class SqlSugarPack : BaseAppPack
|
||||
{
|
||||
public override bool IsBeforeUseRouting { get; }
|
||||
|
||||
public override void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddHttpContextAccessor();
|
||||
services.AddSqlSugar();
|
||||
}
|
||||
|
||||
public override void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
{
|
||||
#if DEBUG
|
||||
using var scope = app.ApplicationServices.CreateScope();
|
||||
var db = scope.ServiceProvider.GetService<ISqlSugarClient>();
|
||||
var tables = App.ActiveTyps.Where(x => x.IsDefined(typeof(SugarTable), false)).ToArray();
|
||||
db.DbMaintenance.CreateDatabase();
|
||||
db.CodeFirst.InitTables(tables);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user