隐患排查记录批量修改排查人.
/// <summary>
/// 隐患排查记录批量修改排查人.
/// </summary>
/// <returns></returns>
[HttpGet("Yhpc")]
[AllowAnonymous]
[IgnoreLog]
public async Task<dynamic> Yhpc()
{
Random ran = new Random();
var dbLink = await _repository.AsSugarClient().Queryable<DbLinkEntity>().FirstAsync(it => it.Id.Equals("08dae333-158b-4fa1-832f-7d9876592a9e"));
_sqlSugarClient = _dataBaseManager.ChangeDataBase(dbLink);
List<HiddenScreenrecordEntity> hiddenScreenrecords = new List<HiddenScreenrecordEntity>();
var data = await _sqlSugarClient.Queryable<HiddenScreenrecordEntity>()
.Where(it => it.DeleteMark == 0)
.Where(it => it.OrganizeId == "08dab954-a0e9-4716-83b6-fb4817e89710")
.Where(it => it.CheckStatus == "2").ToListAsync();
await _repository.AsSugarClient().ThenMapperAsync(data, async item =>
{
if (item.CheckBy != null)
{
Random random = new Random();
int minute = random.Next(0, 30);
HiddenScreenrecordEntity hiddenScreenrecordEntity = new HiddenScreenrecordEntity();
var postLeaderUserSelect = item.CheckBy.ToObject<List<string>>();
hiddenScreenrecordEntity.RecordId = item.RecordId;
hiddenScreenrecordEntity.CheckBy = "[\"" + postLeaderUserSelect[ran.Next(0, postLeaderUserSelect.Count() - 1)] + "\"]";
hiddenScreenrecordEntity.CheckStatus = "0";
hiddenScreenrecordEntity.CheckTime = item.TaskStartTime.Value.AddMinutes(minute);
hiddenScreenrecords.Add(hiddenScreenrecordEntity);
}
});
var isok = await _sqlSugarClient.Updateable<HiddenScreenrecordEntity>(hiddenScreenrecords).UpdateColumns(it => new
{
it.CheckBy,
it.CheckStatus,
it.CheckTime
}).ExecuteCommandAsync();
return isok;
}