diff --git a/.gitignore b/.gitignore index f8f1c339..b0e15423 100644 --- a/.gitignore +++ b/.gitignore @@ -212,3 +212,6 @@ ServiceFabricBackup/ *.ldf *.ndf +/Src/Dlhis.Basic/App/App +/Src/Dlhis.Basic/App +/Src/Dlhis.Sys/App diff --git a/Src/Dlhis.Basic/Dlhis.Basic.csproj b/Src/Dlhis.Basic/Dlhis.Basic.csproj index 00d979c2..dd101846 100644 --- a/Src/Dlhis.Basic/Dlhis.Basic.csproj +++ b/Src/Dlhis.Basic/Dlhis.Basic.csproj @@ -14,9 +14,13 @@ + + + + appsettings.json diff --git a/Src/Dlhis.Canteen/Dlhis.Canteen.csproj b/Src/Dlhis.Canteen/Dlhis.Canteen.csproj index 42d85d59..401c1fc5 100644 --- a/Src/Dlhis.Canteen/Dlhis.Canteen.csproj +++ b/Src/Dlhis.Canteen/Dlhis.Canteen.csproj @@ -10,9 +10,13 @@ + + + + diff --git a/Src/Dlhis.ScheduledTask/Jobs/CostUploadJob.cs b/Src/Dlhis.ScheduledTask/Jobs/CostUploadJob.cs index 96511477..cd016f03 100644 --- a/Src/Dlhis.ScheduledTask/Jobs/CostUploadJob.cs +++ b/Src/Dlhis.ScheduledTask/Jobs/CostUploadJob.cs @@ -3,6 +3,7 @@ using Dlhis.Entity.Canteen.Enums; using Dlhis.Jip.Api; using Dlhis.Jip.Api.Requests; using Dlhis.ScheduledTask.Attributes; +using Newtonsoft.Json; using SqlSugar; namespace Dlhis.ScheduledTask.Jobs; @@ -78,49 +79,56 @@ public class CostUploadJob : BaseJob }).ToList() }; - var response = await jipApi.UploadCostAsync(request); - var handleData = response.Data.Where(x => x.Success == "S").ToList(); - Logger.LogInformation("CostUploadJob消费上传成功人员:{count}", handleData.Count); - if (!handleData.Any()) + try { - continue; - } - var workCodes = handleData.Select(x => x.WorkCode).ToList(); - - var records = await DbContext.Queryable() - .Where(x => workCodes.Contains(x.UserCode)) - .Where(x => x.Year == s.Year && x.Month == s.Month) - .ToListAsync(); - - var updatedRecords = new List(); - var newRecords = new List(); - foreach (var item in handleData) - { - var record = records.FirstOrDefault(x => x.UserCode == item.WorkCode); - if (record != null) + var response = await jipApi.UploadCostAsync(request); + var handleData = response.Data.Where(x => x.Success == "S").ToList(); + Logger.LogInformation("CostUploadJob消费上传成功人员:{count}", handleData.Count); + if (!handleData.Any()) { - record.Cost = dict[item.WorkCode]; - updatedRecords.Add(record); + continue; } - else + var workCodes = handleData.Select(x => x.WorkCode).ToList(); + + var records = await DbContext.Queryable() + .Where(x => workCodes.Contains(x.UserCode)) + .Where(x => x.Year == s.Year && x.Month == s.Month) + .ToListAsync(); + + var updatedRecords = new List(); + var newRecords = new List(); + foreach (var item in handleData) { - newRecords.Add(new UserBalanceUploadRecordEntity + var record = records.FirstOrDefault(x => x.UserCode == item.WorkCode); + if (record != null) { - UserCode = item.WorkCode, - Year = s.Year, - Month = s.Month, - Cost = dict[item.WorkCode] - }); + record.Cost = dict[item.WorkCode]; + updatedRecords.Add(record); + } + else + { + newRecords.Add(new UserBalanceUploadRecordEntity + { + UserCode = item.WorkCode, + Year = s.Year, + Month = s.Month, + Cost = dict[item.WorkCode] + }); + } + } + if (updatedRecords.Any()) + { + await DbContext.UpdateAsync(updatedRecords); + } + + if (newRecords.Any()) + { + await DbContext.InsertAsync(newRecords); } } - if (updatedRecords.Any()) + catch (Exception ex) { - await DbContext.UpdateAsync(updatedRecords); - } - - if (newRecords.Any()) - { - await DbContext.InsertAsync(newRecords); + Logger.LogError(ex, "BirthdayCostUploadJob上传消费数据失败-{userCode}:{error}", JsonConvert.SerializeObject(request), ex.Message); } } } diff --git a/Src/Dlhis.Sys/Dlhis.Sys.csproj b/Src/Dlhis.Sys/Dlhis.Sys.csproj index ff5b9084..66a4fe24 100644 --- a/Src/Dlhis.Sys/Dlhis.Sys.csproj +++ b/Src/Dlhis.Sys/Dlhis.Sys.csproj @@ -10,9 +10,13 @@ + + + +