feat 数据敏感分配角色可见,切换基地,定时任务lock

This commit is contained in:
2024-06-05 17:54:41 +08:00
parent f27d044c1d
commit c8b232ee66
2 changed files with 6 additions and 4 deletions

View File

@@ -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")]

View File

@@ -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;