From 8267fad393598b6729108a3e0550d7e0d66611c4 Mon Sep 17 00:00:00 2001 From: liguoyang Date: Sat, 23 Mar 2024 19:05:42 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E8=B0=83=E6=95=B4=E9=A4=90=E8=A1=A5?= =?UTF-8?q?=E5=85=A5=E5=BA=93=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CommonJobs/MealSupplementHandlerJob.cs | 18 +++++++++++------- .../Services/Implements/JinkoJIPService.cs | 2 ++ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Src/Dlhis.ScheduledTask/CommonJobs/MealSupplementHandlerJob.cs b/Src/Dlhis.ScheduledTask/CommonJobs/MealSupplementHandlerJob.cs index 26972e13..682066d7 100644 --- a/Src/Dlhis.ScheduledTask/CommonJobs/MealSupplementHandlerJob.cs +++ b/Src/Dlhis.ScheduledTask/CommonJobs/MealSupplementHandlerJob.cs @@ -85,7 +85,7 @@ public class MealSupplementHandlerJob var effect = await _dbContext.Updateable() .SetColumns(x => x.Balance == b) .SetColumns(x => x.ModifiedTime == DateTime.Now) - .Where(x => x.Id == mealUser.Id && x.Version == mealUser.Version) + .Where(x => x.UserCode == mealUser.UserCode && x.Version == mealUser.Version) .ExecuteCommandAsync(); if (effect <= 0) @@ -95,9 +95,11 @@ public class MealSupplementHandlerJob }, 5); - mealSupplement.Status = MealSupplementStatusEnumtype.Sucess; - mealSupplement.Sync = true; - await _dbContext.UpdateAsync(mealSupplement); + await _dbContext.Updateable() + .SetColumns(x => x.Status == MealSupplementStatusEnumtype.Sucess) + .SetColumns(x => x.Sync == true) + .Where(x => x.UniqueId == mealSupplement.UniqueId) + .ExecuteCommandAsync(); //FAIL SUCCESS await _jinkoJIPService.SyncMealSupplementRecordsAsync(new List @@ -112,9 +114,11 @@ public class MealSupplementHandlerJob } catch (Exception ex) { - mealSupplement.Status = MealSupplementStatusEnumtype.Error; - mealSupplement.Result = ex.Message; - await _dbContext.UpdateAsync(mealSupplement); + await _dbContext.Updateable() + .SetColumns(x => x.Status == MealSupplementStatusEnumtype.Error) + .SetColumns(x => x.Result == ex.Message) + .Where(x => x.UniqueId == mealSupplement.UniqueId) + .ExecuteCommandAsync(); await _dbContext.Client.Ado.RollbackTranAsync(); } diff --git a/Src/Dlhis.ScheduledTask/SyncSapInfo/Services/Implements/JinkoJIPService.cs b/Src/Dlhis.ScheduledTask/SyncSapInfo/Services/Implements/JinkoJIPService.cs index e7db78bc..6ae18823 100644 --- a/Src/Dlhis.ScheduledTask/SyncSapInfo/Services/Implements/JinkoJIPService.cs +++ b/Src/Dlhis.ScheduledTask/SyncSapInfo/Services/Implements/JinkoJIPService.cs @@ -68,6 +68,8 @@ public class JinkoJIPService : IJinkoJIPService var response = await GetHttpClient().PostAsync(requestUrl, content); var responseJson = await response.Content.ReadAsStringAsync(); + _logger.LogInformation("餐补状态同步响应:{json}", responseJson); + var jobj = JObject.Parse(responseJson); jobj.ContainsKey("exp").ThrowIfTrue(jobj.GetValue("exp").Value());