This commit is contained in:
2024-06-17 16:30:54 +08:00
parent a83d6b1702
commit 64359d62b3

View File

@@ -12,11 +12,13 @@ namespace Dlhis.ScheduledTask.Common.Services.Implements;
public class JinkoSapService : IJinkoSapService
{
private readonly IDbContext _dbContext;
private readonly ILogger<JinkoSapService> _logger;
private readonly IHttpClientFactory _httpClientFactory;
public JinkoSapService(IHttpClientFactory httpClientFactory, IDbContext dbContext)
public JinkoSapService(IHttpClientFactory httpClientFactory, IDbContext dbContext, ILogger<JinkoSapService> logger)
{
_dbContext = dbContext;
_logger = logger;
_httpClientFactory = httpClientFactory;
}
@@ -89,7 +91,7 @@ public class JinkoSapService : IJinkoSapService
var content = new StringContent(JsonConvert.SerializeObject(body), Encoding.UTF8, "application/json");
var response = await GetHttpClient().PostAsync(apiUrl, content);
response.EnsureSuccessStatusCode();
_logger.LogInformation("成功获取{Werk}人事范围数据", werk);
var jsonResponse = await response.Content.ReadAsStringAsync();
var personResp = JsonConvert.DeserializeObject<SapPersonResponse>(jsonResponse);