fix 岗位同步修改
This commit is contained in:
@@ -25,7 +25,7 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 岗位名称
|
/// 岗位名称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ZJOBANME { get; set; }
|
public string ZJOBNAME { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
using Dlhis.Entity.Basic.Entity;
|
using Dlhis.Entity.Basic.Entity;
|
||||||
using Dlhis.ScheduledTask.SyncSapInfo.Comparers;
|
|
||||||
using Dlhis.ScheduledTask.SyncSapInfo.Dto;
|
using Dlhis.ScheduledTask.SyncSapInfo.Dto;
|
||||||
using Dlhis.ScheduledTask.SyncSapInfo.Services;
|
using Dlhis.ScheduledTask.SyncSapInfo.Services;
|
||||||
using Kurisu.SqlSugar.Services;
|
using Kurisu.SqlSugar.Services;
|
||||||
using Mapster;
|
|
||||||
|
|
||||||
namespace Dlhis.ScheduledTask.SyncSapInfo.Job;
|
namespace Dlhis.ScheduledTask.SyncSapInfo.Job;
|
||||||
|
|
||||||
@@ -12,7 +10,6 @@ namespace Dlhis.ScheduledTask.SyncSapInfo.Job;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class SyncPositionJob
|
public class SyncPositionJob
|
||||||
{
|
{
|
||||||
private List<SapPositionItem> lastUpdatedPositionList = new List<SapPositionItem>();
|
|
||||||
private readonly IDbContext _dbContext;
|
private readonly IDbContext _dbContext;
|
||||||
private readonly IJinkoSapService _jinkoSapService;
|
private readonly IJinkoSapService _jinkoSapService;
|
||||||
|
|
||||||
@@ -28,25 +25,12 @@ public class SyncPositionJob
|
|||||||
|
|
||||||
if (positionResult.Position != null && positionResult.Position.Items.Count > 0)
|
if (positionResult.Position != null && positionResult.Position.Items.Count > 0)
|
||||||
{
|
{
|
||||||
var modifiedOrgList = GetModifiedPosition(positionResult.Position.Items);
|
await SaveOrg(positionResult.Position.Items);
|
||||||
await SaveOrg(modifiedOrgList);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<SapPositionItem> GetModifiedPosition(List<SapPositionItem> spaList)
|
|
||||||
{
|
|
||||||
if (lastUpdatedPositionList.Count <= 0)
|
|
||||||
{
|
|
||||||
return spaList;
|
|
||||||
}
|
|
||||||
var needRemove = spaList.Intersect(lastUpdatedPositionList, new SapPositionComparer());
|
|
||||||
return spaList.Except(needRemove, new SapPositionComparer()).ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task SaveOrg(List<SapPositionItem> modifiedPostList)
|
private async Task SaveOrg(List<SapPositionItem> modifiedPostList)
|
||||||
{
|
{
|
||||||
if (modifiedPostList == null || modifiedPostList.Count == 0) return;
|
|
||||||
|
|
||||||
var addItems = new List<PositionEntity>();
|
var addItems = new List<PositionEntity>();
|
||||||
var updateItems = new List<PositionEntity>();
|
var updateItems = new List<PositionEntity>();
|
||||||
|
|
||||||
@@ -57,8 +41,8 @@ public class SyncPositionJob
|
|||||||
{
|
{
|
||||||
position = new PositionEntity
|
position = new PositionEntity
|
||||||
{
|
{
|
||||||
No = item.ZJOBANME,
|
No = item.ZDEPID,
|
||||||
Name = item.ZJOBANME,
|
Name = item.ZJOBNAME,
|
||||||
DepartmentNo = item.ZDEPID,
|
DepartmentNo = item.ZDEPID,
|
||||||
Grade = item.ZZWID
|
Grade = item.ZZWID
|
||||||
};
|
};
|
||||||
@@ -67,7 +51,7 @@ public class SyncPositionJob
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
position.Name = item.ZJOBANME;
|
position.Name = item.ZJOBNAME;
|
||||||
position.DepartmentNo = item.ZDEPID;
|
position.DepartmentNo = item.ZDEPID;
|
||||||
position.Grade = item.ZZWID;
|
position.Grade = item.ZZWID;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user