feat 设置档案白名单
This commit is contained in:
@@ -19,6 +19,8 @@ public interface IGainfoService : IScopeDependency
|
||||
Task MigrationAsync(MigrationRequest request);
|
||||
|
||||
Task<object> CheckIdNoAndNameMatchAsync(GainfoCheckIdNoAndNameRequest request);
|
||||
|
||||
|
||||
Task ResignAsync(GainfoResignRequest request);
|
||||
}
|
||||
|
||||
Task SetSecurityWhiteAsync(string userCode);
|
||||
}
|
||||
@@ -3,6 +3,7 @@ using Dlhis.Basic.Organization.Request;
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Basic.Enums;
|
||||
using Dlhis.Entity.Device.Entities;
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Dlhis.Entity.Visitor.Entity;
|
||||
using Dlhis.Scheduled.Api;
|
||||
@@ -236,6 +237,37 @@ public class GainfoService : IGainfoService
|
||||
await _dbContext.DeleteReallyAsync(gainfo);
|
||||
}
|
||||
|
||||
public async Task SetSecurityWhiteAsync(string userCode)
|
||||
{
|
||||
var gainfo = await _gainfoStore.Queryable().Where(x => x.Code == userCode).SingleAsync();
|
||||
gainfo.ThrowIfNull("档案信息不存在");
|
||||
gainfo.Type = GainfoUserTypeEnumType.SecurityWhite;
|
||||
await _dbContext.UpdateAsync(gainfo);
|
||||
|
||||
var deviceCodes = await _devicePermissionService.GetAssignDeviceCodesAsync(gainfo.No);
|
||||
|
||||
var dhDevices = await _dbContext.Queryable<DeviceEntity>().LeftJoin<DeviceTemplateEntity>((x, xt) => x.TemplateCode == xt.Code)
|
||||
.Where((x, xt) => xt.Brand == "大华")
|
||||
.Where(x => deviceCodes.Contains(x.Code))
|
||||
.ToListAsync();
|
||||
|
||||
await _dbContext.InsertAsync(dhDevices.Select(x => new DeviceTaskEntity
|
||||
{
|
||||
Type = DeviceTaskEnumType.Update,
|
||||
DeviceType = x.Type,
|
||||
UserId = gainfo.Id,
|
||||
UserNo = gainfo.No,
|
||||
DeviceUniqueNo = x.UniqueNo,
|
||||
Status = DeviceTaskStatusEnumType.Wait,
|
||||
Version = 0,
|
||||
ResultMessage = null,
|
||||
CancellationId = 0,
|
||||
Source = null,
|
||||
Priority = 60,
|
||||
TenantId = x.TenantId
|
||||
}).ToList());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 档案列表
|
||||
/// </summary>
|
||||
|
||||
@@ -25,13 +25,13 @@ public class GainfoStore : IGainfoStore
|
||||
/// <returns></returns>
|
||||
public ISugarQueryable<GainfoEntity> Queryable(GainfoStatusEnumType? gainfoStatus)
|
||||
{
|
||||
if (gainfoStatus.HasValue && gainfoStatus != GainfoStatusEnumType.Working)
|
||||
if (gainfoStatus is null or GainfoStatusEnumType.Working)
|
||||
{
|
||||
var tableName = typeof(GainfoEntity).GetCustomAttribute<SugarTable>().TableName;
|
||||
return _dbContext.Queryable<GainfoEntity>().AS(tableName + gainfoStatus);
|
||||
return _dbContext.Queryable<GainfoEntity>();
|
||||
}
|
||||
|
||||
return _dbContext.Queryable<GainfoEntity>();
|
||||
var tableName = typeof(GainfoEntity).GetCustomAttribute<SugarTable>()!.TableName;
|
||||
return _dbContext.Queryable<GainfoEntity>().AS(tableName + gainfoStatus);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user