From bb80953da294da1f8e1c3bfb13fb9811720fa0ae Mon Sep 17 00:00:00 2001 From: liguoyang Date: Sat, 23 Mar 2024 21:15:49 +0800 Subject: [PATCH] fix job --- .../CommonJobs/MealSupplementHandlerJob.cs | 13 +++++++++++-- .../SyncSapInfo/Services/IJinkoJIPService.cs | 2 +- .../Services/Implements/JinkoJIPService.cs | 4 +++- .../appsettings.Development.json | 7 +++++++ Src/Dlhis.ScheduledTask/appsettings.json | 6 +++--- 5 files changed, 25 insertions(+), 7 deletions(-) diff --git a/Src/Dlhis.ScheduledTask/CommonJobs/MealSupplementHandlerJob.cs b/Src/Dlhis.ScheduledTask/CommonJobs/MealSupplementHandlerJob.cs index ccc6e9e1..4a2aa78a 100644 --- a/Src/Dlhis.ScheduledTask/CommonJobs/MealSupplementHandlerJob.cs +++ b/Src/Dlhis.ScheduledTask/CommonJobs/MealSupplementHandlerJob.cs @@ -98,11 +98,11 @@ public class MealSupplementHandlerJob await _dbContext.Updateable() .SetColumns(x => x.Status == MealSupplementStatusEnumtype.Sucess) .SetColumns(x => x.Sync == true) + .SetColumns(x => x.ModifiedTime == DateTime.Now) .Where(x => x.UniqueId == mealSupplement.UniqueId) .ExecuteCommandAsync(); - //FAIL SUCCESS - await _jinkoJIPService.SyncMealSupplementRecordsAsync(new List + var r = await _jinkoJIPService.SyncMealSupplementRecordsAsync(new List { new() { @@ -111,6 +111,14 @@ public class MealSupplementHandlerJob Msg = "操作成功" } }); + + await _dbContext.Updateable() + .SetColumns(x => x.Result == r) + .SetColumns(x => x.ModifiedTime == DateTime.Now) + .Where(x => x.UniqueId == mealSupplement.UniqueId) + .ExecuteCommandAsync(); + + await _dbContext.Client.Ado.CommitTranAsync(); } catch (Exception ex) { @@ -119,6 +127,7 @@ public class MealSupplementHandlerJob await _dbContext.Updateable() .SetColumns(x => x.Status == MealSupplementStatusEnumtype.Error) .SetColumns(x => x.Result == ex.Message) + .SetColumns(x => x.ModifiedTime == DateTime.Now) .Where(x => x.UniqueId == mealSupplement.UniqueId) .ExecuteCommandAsync(); } diff --git a/Src/Dlhis.ScheduledTask/SyncSapInfo/Services/IJinkoJIPService.cs b/Src/Dlhis.ScheduledTask/SyncSapInfo/Services/IJinkoJIPService.cs index 7991ea97..6d7917bc 100644 --- a/Src/Dlhis.ScheduledTask/SyncSapInfo/Services/IJinkoJIPService.cs +++ b/Src/Dlhis.ScheduledTask/SyncSapInfo/Services/IJinkoJIPService.cs @@ -6,5 +6,5 @@ public interface IJinkoJIPService : ISingletonDependency { Task UploadAttendancesAsync(List requests); - Task SyncMealSupplementRecordsAsync(List requests); + Task SyncMealSupplementRecordsAsync(List requests); } diff --git a/Src/Dlhis.ScheduledTask/SyncSapInfo/Services/Implements/JinkoJIPService.cs b/Src/Dlhis.ScheduledTask/SyncSapInfo/Services/Implements/JinkoJIPService.cs index 6ae18823..e9d7cf3b 100644 --- a/Src/Dlhis.ScheduledTask/SyncSapInfo/Services/Implements/JinkoJIPService.cs +++ b/Src/Dlhis.ScheduledTask/SyncSapInfo/Services/Implements/JinkoJIPService.cs @@ -58,7 +58,7 @@ public class JinkoJIPService : IJinkoJIPService } - public async Task SyncMealSupplementRecordsAsync(List requests) + public async Task SyncMealSupplementRecordsAsync(List requests) { var requestUrl = "/JIP/DHR/DHR_DL_CALLBACK"; @@ -76,6 +76,8 @@ public class JinkoJIPService : IJinkoJIPService jobj.ContainsKey("message").ThrowIfTrue(jobj.GetValue("message").Value()); (jobj.GetValue("code").Value() != 200).ThrowIfTrue(jobj.GetValue("message").Value()); + + return responseJson; } diff --git a/Src/Dlhis.ScheduledTask/appsettings.Development.json b/Src/Dlhis.ScheduledTask/appsettings.Development.json index 6e89eed4..e0f21b67 100644 --- a/Src/Dlhis.ScheduledTask/appsettings.Development.json +++ b/Src/Dlhis.ScheduledTask/appsettings.Development.json @@ -24,6 +24,13 @@ "yikatong": "yikatong" } }, + "JinkoOptions": { + "Jip": { + "BaseUrl": "http://172.16.202.34:8000", + "Key": "FACE-7409WIBX", + "Secret": "be0a4b88-cd80-4509-b9b9-865205d0d3d8" + } + }, "IdentityServerOptions": { "Authority": "https://yikatong.isawesome.cn/oauth2", "RequireHttpsMetadata": true, diff --git a/Src/Dlhis.ScheduledTask/appsettings.json b/Src/Dlhis.ScheduledTask/appsettings.json index 92cb3b23..354708ae 100644 --- a/Src/Dlhis.ScheduledTask/appsettings.json +++ b/Src/Dlhis.ScheduledTask/appsettings.json @@ -52,9 +52,9 @@ }, "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" } }, "RedisOptions": {