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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -25,13 +25,13 @@ public class GainfoEntity : SugarBaseEntity
|
||||
public string SapNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 人员类型
|
||||
/// 员类型
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "人员类型")]
|
||||
public string Type { get; set; }
|
||||
[SugarColumn(ColumnDescription = "人员类型", ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert))]
|
||||
public GainfoUserTypeEnumType? Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 姓名
|
||||
/// 姓名
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "姓名")]
|
||||
public string Name { get; set; }
|
||||
|
||||
22
Src/Dlhis.Entity/Basic/Enums/GainfoUserTypeEnumType.cs
Normal file
22
Src/Dlhis.Entity/Basic/Enums/GainfoUserTypeEnumType.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Dlhis.Entity.Basic.Enums;
|
||||
|
||||
/// <summary>
|
||||
/// 档案人员类型
|
||||
/// </summary>
|
||||
[Description("档案人员类型")]
|
||||
public enum GainfoUserTypeEnumType
|
||||
{
|
||||
/// <summary>
|
||||
/// 普通人员
|
||||
/// </summary>
|
||||
[Description("普通人员")]
|
||||
Normal = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 安检白名单
|
||||
/// </summary>
|
||||
[Description("安检白名单")]
|
||||
SecurityWhite = 99
|
||||
}
|
||||
@@ -155,7 +155,7 @@ public class GainfoUpdateService : IGainfoUpdateService
|
||||
var originInserts = persons.Where(x => searchCodes.Contains(x.ZWORKCODE)).Where(x => !existsUpdateWorkCodes.Contains(x.ZWORKCODE)).ToList();
|
||||
|
||||
var updates = ToGainfoSap(originUpdates);
|
||||
// _logger.LogWarning("SAP分批更新数:{count}", updates.Count);
|
||||
// _logger.LogWarning("SAP分批更新数:{count}", updates.Count);
|
||||
var inserts = ToGainfoSap(originInserts);
|
||||
//_logger.LogWarning("SAP分批新增数:{count}", inserts.Count);
|
||||
|
||||
@@ -244,7 +244,7 @@ public class GainfoUpdateService : IGainfoUpdateService
|
||||
{
|
||||
No = Guid.NewGuid().ToString(),
|
||||
SapNo = item.PERNR,
|
||||
Type = item.@class,
|
||||
Type = GainfoUserTypeEnumType.Normal,
|
||||
Name = item.gname,
|
||||
Code = item.ename,
|
||||
CountryNo = item.country,
|
||||
|
||||
@@ -389,7 +389,7 @@ public class AssignmentService : IAssignmentService
|
||||
.LeftJoin<BasicTypeEntity>((x, type) => x.CardType.ToString() == type.Code && type.Type == "timeperiod")
|
||||
.Where(x => (x.AssignType == DeviceTimePeriodAssignEnumType.Template && templateCodes.Contains(x.Value))
|
||||
|| (x.AssignType == DeviceTimePeriodAssignEnumType.Device && deviceCodes.Contains(x.Value)))
|
||||
.Select((x, type) => new DeviceTimePeriodDto()
|
||||
.Select((x, type) => new DeviceTimePeriodDto
|
||||
{
|
||||
CardName = type.Display
|
||||
}, true)
|
||||
|
||||
@@ -82,6 +82,7 @@ public class DeviceTaskAssignmentService : IDeviceTaskAssignmentService
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
//ignore
|
||||
}
|
||||
|
||||
return page;
|
||||
@@ -100,11 +101,9 @@ public class DeviceTaskAssignmentService : IDeviceTaskAssignmentService
|
||||
tasks.Any(x => x.ModifiedTime.AddMinutes(10) < now && x.Status == DeviceTaskStatusEnumType.Process).ThrowIfTrue("请等待任务处理完成");
|
||||
}
|
||||
|
||||
tasks.ForEach(x => x.Status = DeviceTaskStatusEnumType.Wait);
|
||||
|
||||
//更新任务状态
|
||||
await _dbContext.Updateable<DeviceTaskEntity>()
|
||||
.SetColumns(x => x.Status == DeviceTaskStatusEnumType.Wait)
|
||||
.SetColumns(x => x.ModifiedTime == DateTime.Now)
|
||||
.Where(x => request.Ids.Contains(x.Id))
|
||||
.ExecuteCommandAsync();
|
||||
await _dbContext.UpdateAsync(tasks);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user