fix 数据状态处理
This commit is contained in:
@@ -549,6 +549,7 @@ public class BalanceService : IBalanceService
|
||||
.LeftJoin<DepartmentEntity>((record, ga, department) => ga.DepartmentNo == department.No)
|
||||
.LeftJoin<BusinessPlaceEntity>((record, ga, department, bplace) => record.BusinessPlaceCode == bplace.Code)
|
||||
.Where(record => record.Type == BalanceRecordTypeEnumType.Out)
|
||||
.Where(record => record.Status == BalanceRecordStatusEnumType.Valid)
|
||||
.WhereIF(request.SearchDateTimePeriod?.Start.HasValue == true, record => record.CostDate >= request.SearchDateTimePeriod.Start)
|
||||
.WhereIF(request.SearchDateTimePeriod?.End.HasValue == true, record => record.CostDate <= request.SearchDateTimePeriod.End)
|
||||
.WhereIF(request.ApplicationType.HasValue, record => record.ApplicationType == request.ApplicationType)
|
||||
|
||||
@@ -241,7 +241,13 @@ public class OrderService : BaseOrderService, IOrderService
|
||||
{
|
||||
if (!allowNoBalance)
|
||||
{
|
||||
var gainfoMeal = await DbContext.Queryable<GainfoMealEntity>().Where(x => x.UserNo == order.UserNo).FirstAsync();
|
||||
GainfoMealEntity gainfoMeal = null;
|
||||
|
||||
using (var handler = await _redisCache.LockAsync($"gainfo:meal:{order.UserNo}", retryInterval: TimeSpan.FromSeconds(1)))
|
||||
{
|
||||
if (handler.Acquired)
|
||||
{
|
||||
gainfoMeal = await DbContext.Queryable<GainfoMealEntity>().Where(x => x.UserNo == order.UserNo).FirstAsync();
|
||||
if (gainfoMeal == null)
|
||||
{
|
||||
gainfoMeal = new GainfoMealEntity
|
||||
@@ -262,6 +268,9 @@ public class OrderService : BaseOrderService, IOrderService
|
||||
|
||||
await DbContext.InsertAsync(gainfoMeal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//金额+-
|
||||
gainfoMeal.Balance += order.Amount;
|
||||
|
||||
|
||||
@@ -84,9 +84,6 @@ public class AssignmentService : IAssignmentService
|
||||
where = where.Or(x => x.Id == p.TaskId && x.Version == p.Version && x.Status != DeviceTaskStatusEnumType.Success);
|
||||
});
|
||||
|
||||
await _dbContext.Client.Ado.BeginTranAsync();
|
||||
try
|
||||
{
|
||||
var effecet = await _dbContext.Updateable<DeviceTaskEntity>()
|
||||
.SetColumns(x => x.Version == x.Version + 1)
|
||||
.SetColumns(x => x.Status == DeviceTaskStatusEnumType.Process)
|
||||
@@ -99,14 +96,6 @@ public class AssignmentService : IAssignmentService
|
||||
throw new VersionExceptions("更新错误");
|
||||
}
|
||||
|
||||
await _dbContext.Client.Ado.CommitTranAsync();
|
||||
}
|
||||
catch
|
||||
{
|
||||
await _dbContext.Client.Ado.RollbackTranAsync();
|
||||
throw;
|
||||
}
|
||||
|
||||
return page.Data;
|
||||
|
||||
}, 5);
|
||||
|
||||
Reference in New Issue
Block a user