fix 日期范围

This commit is contained in:
2024-11-26 17:02:11 +08:00
parent 73dd0f9765
commit 7d76fc59ff
5 changed files with 52 additions and 7 deletions

View File

@@ -40,7 +40,7 @@ public class SapBusinessTripService : ISapBusinessTripService
try
{
var tripResponse = await _jinkoJipApi.GetBusinessTripInfosByFactoryAsync(factory, today, today);
var tripResponse = await _jinkoJipApi.GetBusinessTripInfosByFactoryAsync(factory, yesterday, today);
if (!tripResponse.Items.Any())
{
return;

View File

@@ -23,8 +23,15 @@ public class SyncBusinessTripJob : BaseJob
var factories = await identityDbContext.Queryable<TenantEntity>().Where(x => !SqlFunc.IsNullOrEmpty(x.PCode)).ToListAsync();
foreach (var factory in factories)
{
try
{
await _syncApi.HandlerBusinessTripsAsync(factory.Code);
}
catch (Exception e)
{
Logger.LogError(e, "同步出差人员异常:{msg}", e.Message);
}
}
}
}

View File

@@ -22,4 +22,20 @@ public class Startup : DefaultStartup
base.ConfigureServices(services);
services.AddRedis();
}
/// <inheritdoc />
public override void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
base.Configure(app, env);
var a = app.ApplicationServices.GetService<IJinkoJipApi>().SyncMealSupplementRecordsAsync(new List<SyncMealSupplementRecordRequest>()
{
new SyncMealSupplementRecordRequest
{
UniqueId = null,
Status = null,
Msg = null
}
}).GetAwaiter().GetResult();
}
}

View File

@@ -1,4 +1,5 @@
using Dlhis.Basic.Api;
using Dlhis.Jip.Api;
using Dlhis.Jip.Api.Request;
using Hangfire;
using Kurisu.AspNetCore.Utils;
@@ -16,10 +17,12 @@ namespace Dlhis.ScheduledTask.TaskAssignment.Controllers;
public class HangfireController : ControllerBase
{
private readonly RedisCache _redisCache;
private readonly IJinkoJipApi _jinkoJipApi;
public HangfireController( RedisCache redisCache)
public HangfireController(RedisCache redisCache, IJinkoJipApi jinkoJipApi)
{
_redisCache = redisCache;
_jinkoJipApi = jinkoJipApi;
}
/// <summary>
@@ -53,4 +56,16 @@ public class HangfireController : ControllerBase
BackgroundJob.Enqueue<ISyncApi>(x => x.SyncGainfoByWerkAsync(request.Code));
}
}
[HttpPost("test")]
public async Task<object> TestAsync()
{
return await _jinkoJipApi.SyncMealSupplementRecordsAsync(new List<SyncMealSupplementRecordRequest>()
{
new()
{
UniqueId = "Dl-Test01", Msg = "成功", Status = "SUCCESS"
}
});
}
}

View File

@@ -36,11 +36,18 @@
"ClientSecret": "123456"
}
},
// "JinkoOptions": {
// "Jip": {
// "BaseUrl": "http://172.16.202.34:8000",
// "Key": "FACE-7409WIBX",
// "Secret": "be0a4b88-cd80-4509-b9b9-865205d0d3d8"
// }
// },
"JinkoOptions": {
"Jip": {
"BaseUrl": "http://172.16.202.34:8000",
"Key": "FACE-7409WIBX",
"Secret": "be0a4b88-cd80-4509-b9b9-865205d0d3d8"
}
"BaseUrl": "http://jip.jinkosolar.com",
"Key": "FACE-CUOJG9N7",
"Secret": "130c2f2d-03a0-4720-8e25-538ffac7a7cb"
}
},
}