fix 同步离职异常问题

This commit is contained in:
2024-06-15 12:08:51 +08:00
parent 7097f2360c
commit 24d4608f72
6 changed files with 49 additions and 121 deletions

View File

@@ -497,7 +497,9 @@ public class BalanceService : IBalanceService
public async Task HainingImportAsync(BalanceHainingImportRequest request)
{
var gainfo = await _dbContext.Queryable<GainfoEntity>().Where(x => x.Code == request.UserCode).SingleAsync();
var gainfo = await _dbContext.Queryable<GainfoEntity>().Where(x => x.Code == request.UserCode).SingleAsync()
?? await _dbContext.Queryable<GainfoLeaveEntity>().Where(x => x.Code == request.UserCode).SingleAsync();
gainfo.ThrowIfNull($"工号{request.UserCode}不存在");
var gainfoMeal = await _dbContext.Queryable<GainfoMealEntity>().Where(x => x.UserCode == request.UserCode).SingleAsync();
if (gainfoMeal == null)
@@ -558,7 +560,6 @@ public class BalanceService : IBalanceService
DeviceUniqueNo = request.DeviceUniqueNo,
IsDeleted = false,
});
var newBalance = gainfoMeal.Balance += request.Amount;