feat 设置档案白名单
This commit is contained in:
@@ -100,7 +100,7 @@ public class DevicePermissionService : IDevicePermissionService
|
||||
if (request.Values.IsPresent())
|
||||
{
|
||||
var gainfoNos = await _dbContext.Queryable<GainfoEntity>()
|
||||
.Where(x => request.Values.Contains(x.Code) || request.Values.Contains(x.No))
|
||||
.Where(x => request.Values.Contains(x.Code) || request.Values.Contains(x.No) || request.Values.Contains(x.IdNo))
|
||||
.Select(x => x.No)
|
||||
.ToListAsync();
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ public class GainfosController : ControllerBase
|
||||
{
|
||||
return await _gainfoService.GetPageAsync(request);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 档案详情
|
||||
/// </summary>
|
||||
@@ -199,4 +199,16 @@ public class GainfosController : ControllerBase
|
||||
{
|
||||
await _gainfoService.ResignAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置安检白名单
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
[HttpPost("setSecurityWhite")]
|
||||
[Transactional]
|
||||
[CrossTenant]
|
||||
public async Task SetSecurityWhiteAsync(GainfoSetSecurityWhiteRequest request)
|
||||
{
|
||||
await _gainfoService.SetSecurityWhiteAsync(request.UserCode);
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,7 @@ public class GainfoPageResponse
|
||||
/// <summary>
|
||||
/// 人员类型
|
||||
/// </summary>
|
||||
public string Type { get; set; }
|
||||
public GainfoUserTypeEnumType? Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 姓名
|
||||
@@ -120,8 +120,8 @@ public class GainfoPageResponse
|
||||
/// 人事范围
|
||||
/// </summary>
|
||||
public string Werks { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 卡类型
|
||||
/// </summary>
|
||||
|
||||
@@ -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