fix 获取差异数据调试

This commit is contained in:
2024-04-03 16:19:39 +08:00
parent 89cfe87093
commit 2776ac5218

View File

@@ -1,13 +1,13 @@
using Dlhis.Basic.Api;
using Dlhis.Entity.Basic.Entity;
using Dlhis.Entity.Basic.Enums;
using System.Text;
using Dlhis.Sys.Api;
using Kurisu.SqlSugar.Services;
using SqlSugar;
using Dlhis.Sys.Api.Response;
using Dlhis.ScheduledTask.Common.Dto;
using Dlhis.ScheduledTask.Common.Comparers;
using Kurisu.AspNetCore.Utils.Extensions;
namespace Dlhis.ScheduledTask.Common.Services.Implements;
@@ -66,6 +66,9 @@ public class GainfoUpdateService : IGainfoUpdateService
if (modifiedPersons.Count > 0)
{
var d = modifiedPersons.First();
_logger.LogInformation("差异信息:{json}", d.ToJson());
_logger.LogInformation("差异信息:{json}", (await _dbContext.Queryable<GainfoSapEntity>().Where(x => x.ename == d.ZWORKCODE).FirstAsync())?.ToJson());
var tenantResult = await _tenantApi.GetTenantsInternalAsync();
_tenants = tenantResult.Data;
@@ -239,7 +242,6 @@ public class GainfoUpdateService : IGainfoUpdateService
{
PERNR = item.PERNR,
gname = item.gname,
web = item.web,
phone = item.phone,
appellation = item.appellation,
isowner = item.isowner,
@@ -310,7 +312,7 @@ public class GainfoUpdateService : IGainfoUpdateService
var now = DateTime.Now;
foreach (var item in sapList)
{
var a = _jobChanges.FirstOrDefault(x => x.ZWORKCODE == item.ZWORKCODE);
var a = _jobChanges.OrderByDescending(x => x.BEGDA).FirstOrDefault(x => x.ZWORKCODE == item.ZWORKCODE);
if (a != null)
{
if (a.BEGDA >= now && a.ENDDA <= now)
@@ -323,7 +325,7 @@ public class GainfoUpdateService : IGainfoUpdateService
}
}
var b = _departmentChanges.FirstOrDefault(x => x.ZWORKCODE == item.ZWORKCODE);
var b = _departmentChanges.OrderByDescending(x => x.BEGDA).FirstOrDefault(x => x.ZWORKCODE == item.ZWORKCODE);
if (b != null)
{
if (b.BEGDA >= now && b.ENDDA <= now)
@@ -348,7 +350,7 @@ public class GainfoUpdateService : IGainfoUpdateService
NAME = x.gname,
ZWORKCODE = x.ename,
ZZ_SFZH = x.idno,
GBDAT = x.birthday?.ToString("yyyy-MM-dd") ?? "0000-00-00",
GBDAT = x.birthday?.ToString("yyyy-MM-dd"),
ZZ_KLX = x.ZZ_KLX,
ZXUELI = x.email?.Trim() ?? string.Empty,
ORGEH = x.appellation,
@@ -402,7 +404,7 @@ public class GainfoUpdateService : IGainfoUpdateService
{
gname = person.NAME,
ename = person.ZWORKCODE,
idno = SubString(person.ZZ_SFZH, 18),
idno = person.ZZ_SFZH,
birthday = SafeParseDate(person.GBDAT).Value,
ZZ_KLX = person.ZZ_KLX,
email = person.ZXUELI,
@@ -423,7 +425,6 @@ public class GainfoUpdateService : IGainfoUpdateService
remark = rmk,
native = native,
sex = sex,
web = person.PLANS,
logdate = DateTime.Now,
isowner = int.Parse(person.ZSTATUS) < 5 ? "T" : "F",
@class = "C",
@@ -475,21 +476,4 @@ public class GainfoUpdateService : IGainfoUpdateService
}
return null;
}
private static string SubString(string s, int len)
{
if (string.IsNullOrWhiteSpace(s))
{
return s?.Trim() ?? "";
}
s = s.Trim();
var bs = Encoding.UTF8.GetBytes(s);
if (bs.Length <= len)
{
return s;
}
var bytes = new byte[len];
Buffer.BlockCopy(bs, 0, bytes, 0, len);
return Encoding.UTF8.GetString(bytes);
}
}