diff --git a/Src/Dlhis.Canteen/Order/Services/Implements/BalanceService.cs b/Src/Dlhis.Canteen/Order/Services/Implements/BalanceService.cs index e66033da..15d9544e 100644 --- a/Src/Dlhis.Canteen/Order/Services/Implements/BalanceService.cs +++ b/Src/Dlhis.Canteen/Order/Services/Implements/BalanceService.cs @@ -497,7 +497,9 @@ public class BalanceService : IBalanceService public async Task HainingImportAsync(BalanceHainingImportRequest request) { - var gainfo = await _dbContext.Queryable().Where(x => x.Code == request.UserCode).SingleAsync(); + var gainfo = await _dbContext.Queryable().Where(x => x.Code == request.UserCode).SingleAsync() + ?? await _dbContext.Queryable().Where(x => x.Code == request.UserCode).SingleAsync(); + gainfo.ThrowIfNull($"工号{request.UserCode}不存在"); var gainfoMeal = await _dbContext.Queryable().Where(x => x.UserCode == request.UserCode).SingleAsync(); if (gainfoMeal == null) @@ -558,7 +560,6 @@ public class BalanceService : IBalanceService DeviceUniqueNo = request.DeviceUniqueNo, IsDeleted = false, - }); var newBalance = gainfoMeal.Balance += request.Amount; diff --git a/Src/Dlhis.ScheduledTask/Common/Dto/SapPersonDepartmentStatus.cs b/Src/Dlhis.ScheduledTask/Common/Dto/SapPersonDepartmentStatus.cs index a4623016..5ec8a144 100644 --- a/Src/Dlhis.ScheduledTask/Common/Dto/SapPersonDepartmentStatus.cs +++ b/Src/Dlhis.ScheduledTask/Common/Dto/SapPersonDepartmentStatus.cs @@ -1,19 +1,19 @@ -namespace Dlhis.ScheduledTask.Common.Dto -{ - public class SapPersonDepartmentStatus - { - public string ZWORKCODE { get; set; } - - public DateTime BEGDA { get; set; } - - public DateTime ENDDA { get; set; } - - public string WERKS { get; set; } - - /// - /// 部门号 - /// - public string ORGEH { get; set; } - - } -} +// namespace Dlhis.ScheduledTask.Common.Dto +// { +// public class SapPersonDepartmentStatus +// { +// public string ZWORKCODE { get; set; } +// +// public DateTime BEGDA { get; set; } +// +// public DateTime ENDDA { get; set; } +// +// public string WERKS { get; set; } +// +// /// +// /// 部门号 +// /// +// public string ORGEH { get; set; } +// +// } +// } diff --git a/Src/Dlhis.ScheduledTask/Common/Dto/SapPersonJobStatus.cs b/Src/Dlhis.ScheduledTask/Common/Dto/SapPersonJobStatus.cs index 8f124a22..8ec20753 100644 --- a/Src/Dlhis.ScheduledTask/Common/Dto/SapPersonJobStatus.cs +++ b/Src/Dlhis.ScheduledTask/Common/Dto/SapPersonJobStatus.cs @@ -1,16 +1,16 @@ -namespace Dlhis.ScheduledTask.Common.Dto -{ - public class SapPersonJobStatus - { - public string ZWORKCODE { get; set; } - - public DateTime BEGDA { get; set; } - - public DateTime ENDDA { get; set; } - - /// - /// 0离职 - /// - public string STAT2 { get; set; } - } -} +// namespace Dlhis.ScheduledTask.Common.Dto +// { +// public class SapPersonJobStatus +// { +// public string ZWORKCODE { get; set; } +// +// public DateTime BEGDA { get; set; } +// +// public DateTime ENDDA { get; set; } +// +// /// +// /// 0离职 +// /// +// public string STAT2 { get; set; } +// } +// } diff --git a/Src/Dlhis.ScheduledTask/Common/Response/SapPersonResponse.cs b/Src/Dlhis.ScheduledTask/Common/Response/SapPersonResponse.cs index 3d9b14c8..294dca1c 100644 --- a/Src/Dlhis.ScheduledTask/Common/Response/SapPersonResponse.cs +++ b/Src/Dlhis.ScheduledTask/Common/Response/SapPersonResponse.cs @@ -11,16 +11,16 @@ public class SapPersonResponse [JsonProperty("T_PERSON")] public SapPerson Person { get; set; } - /// - /// 离职状态 - /// - [JsonProperty("T_0000")] - public SapPerson JobStatusInfo { get; set; } - - /// - /// 部门变更信息 - /// - [JsonProperty("T_0001")] - public SapPerson DepartmentInfo { get; set; } + // /// + // /// 离职状态 + // /// + // [JsonProperty("T_0000")] + // public SapPerson JobStatusInfo { get; set; } + // + // /// + // /// 部门变更信息 + // /// + // [JsonProperty("T_0001")] + // public SapPerson DepartmentInfo { get; set; } } diff --git a/Src/Dlhis.ScheduledTask/Common/Services/Implements/GainfoUpdateService.cs b/Src/Dlhis.ScheduledTask/Common/Services/Implements/GainfoUpdateService.cs index bf3bcb54..8ba336fb 100644 --- a/Src/Dlhis.ScheduledTask/Common/Services/Implements/GainfoUpdateService.cs +++ b/Src/Dlhis.ScheduledTask/Common/Services/Implements/GainfoUpdateService.cs @@ -22,8 +22,6 @@ public class GainfoUpdateService : IGainfoUpdateService private readonly IJinkoSapService _jinkoSapService; private List _tenants; - private List _departmentChanges; - private List _jobChanges; public GainfoUpdateService(IDbContext dbContext, ILogger logger, @@ -72,8 +70,6 @@ public class GainfoUpdateService : IGainfoUpdateService //}; var personResp = await _jinkoSapService.GetPersonsByWerkAsync(werk); var persons = personResp.Person.Items; - _departmentChanges = personResp.DepartmentInfo.Items; - _jobChanges = personResp.JobStatusInfo.Items; werkInfo.HandleMessage = "SAP人员数量" + persons.Count; werkInfo.Total = persons.Count; @@ -118,8 +114,6 @@ public class GainfoUpdateService : IGainfoUpdateService var personResp = await _jinkoSapService.GetPersonsByCodeAsync(code); var persons = personResp.Person.Items; - _departmentChanges = personResp.DepartmentInfo.Items; - _jobChanges = personResp.JobStatusInfo.Items; _logger.LogInformation("获取SAP人员数量为:{count}", persons.Count); if (persons.Count > 0) @@ -392,33 +386,6 @@ public class GainfoUpdateService : IGainfoUpdateService return sapList; } - var now = DateTime.Now; - foreach (var item in sapList) - { - var a = _jobChanges.OrderByDescending(x => x.BEGDA).FirstOrDefault(x => x.ZWORKCODE == item.ZWORKCODE); - if (a != null) - { - if (a.BEGDA >= now && a.ENDDA <= now) - { - if (a.STAT2 == "0") - { - item.STAT2 = "0"; - item.ZSTATUS = "5"; - } - } - } - - var b = _departmentChanges.OrderByDescending(x => x.BEGDA).FirstOrDefault(x => x.ZWORKCODE == item.ZWORKCODE); - if (b != null) - { - if (b.BEGDA >= now && b.ENDDA <= now) - { - item.ORGEH = b.ORGEH; - item.WERKS = b.WERKS; - } - } - } - var needRemove = sapList.Intersect(last, new SapPersonComparer()).ToList(); return sapList.Except(needRemove, new SapPersonComparer()).ToList(); } diff --git a/Src/Dlhis.ScheduledTask/Common/Services/Implements/JinkoSapService.cs b/Src/Dlhis.ScheduledTask/Common/Services/Implements/JinkoSapService.cs index 703407e3..5a03c131 100644 --- a/Src/Dlhis.ScheduledTask/Common/Services/Implements/JinkoSapService.cs +++ b/Src/Dlhis.ScheduledTask/Common/Services/Implements/JinkoSapService.cs @@ -95,37 +95,17 @@ public class JinkoSapService : IJinkoSapService var personResp = JsonConvert.DeserializeObject(jsonResponse); List persons = new(); - List jobInfos = new(); - List departmentInfos = new(); if (personResp?.Person?.Items?.Any() == true) { persons.AddRange(personResp.Person.Items); } - if (personResp?.JobStatusInfo?.Items?.Any() == true) - { - jobInfos.AddRange(personResp.JobStatusInfo.Items); - } - - if (personResp?.DepartmentInfo?.Items?.Any() == true) - { - departmentInfos.AddRange(personResp.DepartmentInfo.Items); - } - return new SapPersonResponse() { Person = new SapPerson { Items = persons - }, - JobStatusInfo = new SapPerson - { - Items = jobInfos, - }, - DepartmentInfo = new SapPerson - { - Items = departmentInfos } }; } @@ -160,37 +140,17 @@ public class JinkoSapService : IJinkoSapService var personResp = JsonConvert.DeserializeObject(jsonResponse); List persons = new(); - List jobInfos = new(); - List departmentInfos = new(); if (personResp?.Person?.Items?.Any() == true) { persons.AddRange(personResp.Person.Items); } - if (personResp?.JobStatusInfo?.Items?.Any() == true) - { - jobInfos.AddRange(personResp.JobStatusInfo.Items); - } - - if (personResp?.DepartmentInfo?.Items?.Any() == true) - { - departmentInfos.AddRange(personResp.DepartmentInfo.Items); - } - return new SapPersonResponse() { Person = new SapPerson { Items = persons - }, - JobStatusInfo = new SapPerson - { - Items = jobInfos, - }, - DepartmentInfo = new SapPerson - { - Items = departmentInfos } }; }