diff --git a/Src/Dlhis.ScheduledTask/SyncSapInfo/Services/IJinkoSapService.cs b/Src/Dlhis.ScheduledTask/SyncSapInfo/Services/IJinkoSapService.cs index bd654f02..80bf045a 100644 --- a/Src/Dlhis.ScheduledTask/SyncSapInfo/Services/IJinkoSapService.cs +++ b/Src/Dlhis.ScheduledTask/SyncSapInfo/Services/IJinkoSapService.cs @@ -2,7 +2,7 @@ namespace Dlhis.ScheduledTask.SyncSapInfo.Services; -public interface IJinkoSapService : IScopeDependency +public interface IJinkoSapService : ISingletonDependency { Task GetSapOrganizationsAsync(); diff --git a/Src/Dlhis.ScheduledTask/SyncSapInfo/Services/Implements/JinkoSapService.cs b/Src/Dlhis.ScheduledTask/SyncSapInfo/Services/Implements/JinkoSapService.cs index 62ebf1f6..e1abe780 100644 --- a/Src/Dlhis.ScheduledTask/SyncSapInfo/Services/Implements/JinkoSapService.cs +++ b/Src/Dlhis.ScheduledTask/SyncSapInfo/Services/Implements/JinkoSapService.cs @@ -1,5 +1,4 @@ using System.Net.Http.Headers; -using System.Net.Http; using System.Text; using Dlhis.ScheduledTask.SyncSapInfo.Dto; using Dlhis.ScheduledTask.SyncSapInfo.Response; @@ -24,6 +23,8 @@ public class JinkoSapService : IJinkoSapService private HttpClient GetHttpClient() { var httpClient = _httpClientFactory.CreateClient("jinko:sap"); + //http://sappidap.jinkosolar.cn:51000 + httpClient.BaseAddress = new Uri("http://sappipap01.jinkosolar.cn:50100"); httpClient.Timeout = TimeSpan.FromMinutes(10); var credentials = string.Format("{0}:{1}", "EHS_USER", "y3R1hd2h*RICAC"); var headerValue = Convert.ToBase64String(Encoding.UTF8.GetBytes(credentials)); @@ -34,7 +35,7 @@ public class JinkoSapService : IJinkoSapService public async Task GetSapOrganizationsAsync() { - string apiUrl = "http://sappidap.jinkosolar.cn:51000/RESTAdapter/Rest/EHR_ORGANIZATION/"; + string apiUrl = "/RESTAdapter/Rest/EHR_ORGANIZATION/"; var response = await GetHttpClient().PostAsync(apiUrl, new StringContent("{}", Encoding.UTF8, "application/json")); response.EnsureSuccessStatusCode(); @@ -47,7 +48,7 @@ public class JinkoSapService : IJinkoSapService public async Task GetPositionsAsync() { - string apiUrl = "http://sappidap.jinkosolar.cn:51000/RESTAdapter/Rest/EHR_POSITION/"; + string apiUrl = "/RESTAdapter/Rest/EHR_POSITION/"; var response = await GetHttpClient().PostAsync(apiUrl, new StringContent("{}", Encoding.UTF8, "application/json")); response.EnsureSuccessStatusCode(); @@ -61,7 +62,7 @@ public class JinkoSapService : IJinkoSapService public async Task GetPersonsAsync() { - var apiUrl = "http://sappipap01.jinkosolar.cn:50100/RESTAdapter/Rest/EHR_PERSONNEL/"; + var apiUrl = "/RESTAdapter/Rest/EHR_PERSONNEL/"; var tenantResult = await _tenantApi.GetTenantsInternalAsync(); var tenants = tenantResult.Data;