refactor 优化代码

This commit is contained in:
2024-11-26 15:26:12 +08:00
parent a32910f0d9
commit 623a5c4e49
88 changed files with 1820 additions and 941 deletions

View File

@@ -2,10 +2,9 @@
using Dlhis.Entity.Basic.Enums;
using Dlhis.Entity.Canteen.Entities;
using Dlhis.Entity.Canteen.Enums;
using Dlhis.Jip.Api;
using Dlhis.Jip.Api.Request;
using Dlhis.ScheduledTask.Attributes;
using Dlhis.ScheduledTask.Common.Request;
using Dlhis.ScheduledTask.Common.Services;
using Hangfire;
using Kurisu.AspNetCore.DataAccess.SqlSugar.Extensions;
using Kurisu.AspNetCore.Utils;
@@ -17,12 +16,12 @@ namespace Dlhis.ScheduledTask.Jobs;
[RecurringJob(nameof(MealSupplementHandlerJob), "0 0/30 * * * ?", Name = "餐补核算")]
public class MealSupplementHandlerJob : BaseJob
{
private readonly IJinkoJipService _jinkoJIPService;
private readonly IJinkoJipApi _jinkoJipApi;
public MealSupplementHandlerJob(IServiceProvider serviceProvider,
IJinkoJipService jinkoJIPService) : base(serviceProvider)
IJinkoJipApi jinkoJipApi) : base(serviceProvider)
{
_jinkoJIPService = jinkoJIPService;
_jinkoJipApi = jinkoJipApi;
}
protected override async Task RunAsync(IServiceProvider serviceProvider)
@@ -59,7 +58,7 @@ public class MealSupplementHandlerJob : BaseJob
{
try
{
var r = await _jinkoJIPService.SyncMealSupplementRecordsAsync(new List<SyncMealSupplementRecordRequest>
var r = await _jinkoJipApi.SyncMealSupplementRecordsAsync(new List<SyncMealSupplementRecordRequest>
{
new()
{
@@ -79,6 +78,7 @@ public class MealSupplementHandlerJob : BaseJob
}
catch
{
//ignore
}
continue;
@@ -121,8 +121,8 @@ public class MealSupplementHandlerJob : BaseJob
IsDeleted = false,
});
if (!await DbContext.Queryable<UserBalanceEntity>().Where(x => x.UserCode == gainfo.Code).AnyAsync())
{
await DbContext.InsertAsync(new UserBalanceEntity
@@ -153,8 +153,8 @@ public class MealSupplementHandlerJob : BaseJob
.Where(x => x.UserCode == gainfo.Code && x.Version == version)
.ExecuteCommandThrowVersionAsync();
}, 5);
var r = await _jinkoJIPService.SyncMealSupplementRecordsAsync(new List<SyncMealSupplementRecordRequest>
var r = await _jinkoJipApi.SyncMealSupplementRecordsAsync(new List<SyncMealSupplementRecordRequest>
{
new()
{