fix 注释,下发任务状态分页
This commit is contained in:
@@ -10,19 +10,18 @@ using System.Text;
|
||||
using Dlhis.ScheduledTask.Configurations;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.ScheduledTask.Wsproxy.Dlhis.JinkoHr.WsProxy;
|
||||
using Dlhis.Entity.Basic.Enums;
|
||||
|
||||
namespace Dlhis.ScheduledTask.Job
|
||||
{
|
||||
public class SyncPersonJob
|
||||
public class SyncPersonJob
|
||||
{
|
||||
|
||||
private List<PersonDetail> lastUpdatedPersonList = new List<PersonDetail>();
|
||||
private List<ZHRS_ORG> lastUpdatedOrgList = new List<ZHRS_ORG>();
|
||||
private List<ZHRS_POST> lastUpdatedPositionList = new List<ZHRS_POST>();
|
||||
private readonly ServiceSettings serviceSettings;
|
||||
private readonly ZHRS_WERKS[] werks;
|
||||
|
||||
private readonly IDbContext _dbContext;
|
||||
public SyncPersonJob(IDbContext dbContext)
|
||||
{
|
||||
@@ -242,58 +241,58 @@ namespace Dlhis.ScheduledTask.Job
|
||||
var headerValue = Convert.ToBase64String(Encoding.UTF8.GetBytes(credentials));
|
||||
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", headerValue);
|
||||
|
||||
List<PersonDetail> persons = new List<PersonDetail>();
|
||||
foreach (var item in werks)
|
||||
{
|
||||
try
|
||||
{
|
||||
var body = new
|
||||
{
|
||||
T_WERKS = new
|
||||
{
|
||||
item = new List<object>
|
||||
{
|
||||
new
|
||||
{
|
||||
item.WERKS
|
||||
}
|
||||
}
|
||||
},
|
||||
T_PERSON = Array.Empty<string>(),
|
||||
T_PNO = Array.Empty<string>(),
|
||||
};
|
||||
var content = new StringContent(JsonConvert.SerializeObject(body), Encoding.UTF8, "application/json");
|
||||
List<PersonDetail> persons = new();
|
||||
//foreach (var item in werks)
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// var body = new
|
||||
// {
|
||||
// T_WERKS = new
|
||||
// {
|
||||
// item = new List<object>
|
||||
// {
|
||||
// new
|
||||
// {
|
||||
// item.WERKS
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// T_PERSON = Array.Empty<string>(),
|
||||
// T_PNO = Array.Empty<string>(),
|
||||
// };
|
||||
// var content = new StringContent(JsonConvert.SerializeObject(body), Encoding.UTF8, "application/json");
|
||||
|
||||
var response = httpClient.PostAsync("http://sappipap01.jinkosolar.cn:50100/RESTAdapter/Rest/EHR_PERSONNEL/", content).Result;
|
||||
// var response = httpClient.PostAsync("http://sappipap01.jinkosolar.cn:50100/RESTAdapter/Rest/EHR_PERSONNEL/", content).Result;
|
||||
|
||||
var jsonResponse = response.Content.ReadAsStringAsync().Result;
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
PersonResult personResp = JsonConvert.DeserializeObject<PersonResult>(jsonResponse);
|
||||
if (personResp?.T_PERSON?.item?.Any() == true)
|
||||
{
|
||||
persons.AddRange(personResp.T_PERSON.item);
|
||||
//log.Info($"人事范围[{item.WERKS}]获取{personResp.T_PERSON.item.Count}条数据");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception($"请求异常:{response.StatusCode}:" + jsonResponse);
|
||||
}
|
||||
// this is webservice call
|
||||
//var personResp = archivesClient.ZHRF_SYN_03(new ZHRF_SYN_03()
|
||||
//{
|
||||
// //I_DATE = Settings.BeginSyncDate.ToString("yyy-MM-dd"),
|
||||
// T_PERSON = Array.Empty<ZHRS_PERSON>(),
|
||||
// T_PNO = Array.Empty<ZHRS_PNO>(),
|
||||
// T_WERKS = new ZHRS_WERKS[] { item },
|
||||
//});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//log.Error($"人事范围[{item.WERKS}]获取失败:{ex.Message}", ex);
|
||||
}
|
||||
}
|
||||
// var jsonResponse = response.Content.ReadAsStringAsync().Result;
|
||||
// if (response.IsSuccessStatusCode)
|
||||
// {
|
||||
// PersonResult personResp = JsonConvert.DeserializeObject<PersonResult>(jsonResponse);
|
||||
// if (personResp?.T_PERSON?.item?.Any() == true)
|
||||
// {
|
||||
// persons.AddRange(personResp.T_PERSON.item);
|
||||
// //log.Info($"人事范围[{item.WERKS}]获取{personResp.T_PERSON.item.Count}条数据");
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// throw new Exception($"请求异常:{response.StatusCode}:" + jsonResponse);
|
||||
// }
|
||||
// // this is webservice call
|
||||
// //var personResp = archivesClient.ZHRF_SYN_03(new ZHRF_SYN_03()
|
||||
// //{
|
||||
// // //I_DATE = Settings.BeginSyncDate.ToString("yyy-MM-dd"),
|
||||
// // T_PERSON = Array.Empty<ZHRS_PERSON>(),
|
||||
// // T_PNO = Array.Empty<ZHRS_PNO>(),
|
||||
// // T_WERKS = new ZHRS_WERKS[] { item },
|
||||
// //});
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// //log.Error($"人事范围[{item.WERKS}]获取失败:{ex.Message}", ex);
|
||||
// }
|
||||
//}
|
||||
|
||||
return new PersonResult()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user