fix 消费恢复为余额表
This commit is contained in:
@@ -86,7 +86,7 @@ public class OrderService : IOrderService
|
||||
var jinkoCode = _currentUser.GetUserClaim("jinko-code") ?? string.Empty;
|
||||
if (jinkoCode.IsPresent())
|
||||
{
|
||||
gainfo = await _dbContext.Queryable<GainfoEntity>().Where(x => x.Code == jinkoCode).FirstAsync();
|
||||
gainfo = await _dbContext.Queryable<GainfoEntity>().Where(x => x.Code == jinkoCode).SingleAsync();
|
||||
}
|
||||
|
||||
var pageResult = await _dbContext.Queryable<CanteenOrderEntity>().Where(x => x.UserNo == gainfo.No)
|
||||
@@ -319,6 +319,7 @@ public class OrderService : IOrderService
|
||||
await _dbContext.InsertAsync(order);
|
||||
var balanceRecord = order.Adapt<BalanceRecordEntity>();
|
||||
await _dbContext.InsertAsync(balanceRecord);
|
||||
await _balanceRepository.CalculateBalanceAsync(balanceRecord.UserCode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -347,7 +348,7 @@ public class OrderService : IOrderService
|
||||
//校验
|
||||
await Verify(order);
|
||||
|
||||
await _balanceRepository.CheckConsumableAsync(order.UserCode, order.TenantId, order.Amount);
|
||||
await _balanceRepository.ConsumeBalanceAsync(order.UserCode, order.Amount);
|
||||
|
||||
//写入记录
|
||||
var balanceRecord = order.Adapt<BalanceRecordEntity>();
|
||||
@@ -479,14 +480,7 @@ public class OrderService : IOrderService
|
||||
}
|
||||
}
|
||||
|
||||
//获取人员信息
|
||||
var currentFactory = await _dbContext.Queryable<DeviceEntity>()
|
||||
.Where(x => x.UniqueNo == request.DeviceUniqueNo)
|
||||
.Select(x => x.TenantId)
|
||||
.SingleAsync();
|
||||
|
||||
var balance = await _balanceRepository.GetBalanceAsync(gainfo.Code, currentFactory);
|
||||
var totalBalance = await _balanceRepository.GetBalanceAsync(gainfo.Code, string.Empty);
|
||||
var balance = await _balanceRepository.GetBalanceAsync(gainfo.Code);
|
||||
|
||||
var data = await _dbContext.Queryable<GainfoEntity>()
|
||||
.LeftJoin<DepartmentEntity>((x, department) => x.DepartmentNo == department.No)
|
||||
@@ -499,7 +493,7 @@ public class OrderService : IOrderService
|
||||
DepartmentName = department.Name,
|
||||
|
||||
CurrentBalance = balance,
|
||||
CurrentTotalBalance = totalBalance
|
||||
CurrentTotalBalance = balance
|
||||
})
|
||||
.SingleAsync();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user