feat 数据敏感分配角色可见,切换基地,定时任务lock
This commit is contained in:
@@ -37,7 +37,7 @@ public class GainfoMealController : ControllerBase
|
||||
/// <summary>
|
||||
/// 迁移
|
||||
/// </summary>
|
||||
[Authorize(Roles = "admin")]
|
||||
/// <param name="request"></param>
|
||||
[Transactional]
|
||||
[Authorize(Roles = "admin,tenant-admin")]
|
||||
[HttpPost("migration")]
|
||||
|
||||
@@ -54,6 +54,7 @@ public class MealUserService : IMealUserService
|
||||
/// <inheritdoc />
|
||||
public async Task MigrationAsync(GainfoBalanceMigrationRequest request)
|
||||
{
|
||||
//只能针对离职人员
|
||||
var gainfoLeave = await _dbContext.Queryable<GainfoLeaveEntity>().Where(x => x.Code == request.BeforeCode).SingleAsync();
|
||||
gainfoLeave.ThrowIfNull("需要对已离职人员迁移");
|
||||
|
||||
@@ -63,9 +64,6 @@ public class MealUserService : IMealUserService
|
||||
return;
|
||||
}
|
||||
|
||||
var gainfo = await _dbContext.Queryable<GainfoEntity>().Where(x => x.Code == request.NowCode).SingleAsync();
|
||||
gainfo.ThrowIfNull("目标人员不存在");
|
||||
|
||||
//清空余额
|
||||
await _dbContext.Updateable<GainfoMealEntity>()
|
||||
.SetColumns(x => x.Balance == 0)
|
||||
@@ -73,6 +71,10 @@ public class MealUserService : IMealUserService
|
||||
.SetColumns(x => x.Version == x.Version + 1)
|
||||
.Where(x => x.UserCode == request.BeforeCode) //不需要判断version
|
||||
.ExecuteCommandAsync();
|
||||
|
||||
//转移到现有人员
|
||||
var gainfo = await _dbContext.Queryable<GainfoEntity>().Where(x => x.Code == request.NowCode).SingleAsync();
|
||||
gainfo.ThrowIfNull("目标人员不存在");
|
||||
|
||||
var now = DateTime.Now;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user