fix 数据处理
This commit is contained in:
@@ -62,7 +62,7 @@ public class HangfireController : ControllerBase
|
||||
|
||||
[IgnoreTenant]
|
||||
[HttpPost("recalc")]
|
||||
public async Task<object> ReCalc()
|
||||
public async Task ReCalc()
|
||||
{
|
||||
// select UserCode,Remark, count(1) count from balancerecord
|
||||
// where Status = 'Valid'
|
||||
@@ -77,13 +77,19 @@ public class HangfireController : ControllerBase
|
||||
.Having(x => SqlFunc.IsNull(x.Remark, "") != "" && SqlFunc.AggregateCount(1) > 1 && x.Remark != "用户取消" && x.Remark != "正常发放")
|
||||
.ToListAsync();
|
||||
|
||||
var row = ls.First();
|
||||
var code = row.UserCode;
|
||||
|
||||
var data = await _dbContext.Queryable<BalanceRecordEntity>().Where(x => x.UserCode == code).Where(x => x.Remark == row.Remark).ToListAsync();
|
||||
|
||||
if (data.Count > 1)
|
||||
foreach (var row in ls)
|
||||
{
|
||||
var data = await _dbContext.Queryable<BalanceRecordEntity>()
|
||||
.Where(x => x.UserCode == row.UserCode)
|
||||
.Where(x => x.ApplicationType == CanteenApplicaitonTypeEnumType.MealSupplement)
|
||||
.Where(x => x.Remark == row.Remark)
|
||||
.ToListAsync();
|
||||
|
||||
if (data.Count <= 1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var f = data.First();
|
||||
var others = data.Where(x => x.Id != f.Id).ToList();
|
||||
|
||||
@@ -93,7 +99,7 @@ public class HangfireController : ControllerBase
|
||||
var sum = await _dbContext.Queryable<BalanceRecordEntity>().Where(x => x.UserCode == f.UserCode)
|
||||
.Where(x => x.Status == BalanceRecordStatusEnumType.Valid)
|
||||
.SumAsync(x => x.Amount);
|
||||
|
||||
|
||||
var mealInfo = await _dbContext.Queryable<GainfoMealEntity>().Where(x => x.UserCode == f.UserCode).SingleAsync();
|
||||
await _dbContext.Updateable<GainfoMealEntity>()
|
||||
.SetColumns(x => x.Balance == sum)
|
||||
@@ -102,7 +108,5 @@ public class HangfireController : ControllerBase
|
||||
.Where(x => x.UserCode == f.UserCode && x.Version == mealInfo.Version)
|
||||
.ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user