feat 梯控相关

This commit is contained in:
2026-03-13 15:42:36 +08:00
parent 9d0600ebb8
commit f1cb0813db
34 changed files with 1112 additions and 320 deletions

View File

@@ -130,7 +130,7 @@ public class DevicePermissionsController : ControllerBase
[IgnoreTenant]
public async Task<List<Guid>> GetAssignDeviceCodesAsync(string userCode)
{
return await _devicePermissionService.GetUserDeviceCodesByNoAsync(userCode);
return await _devicePermissionService.GetUserDeviceCodesByNoOrCodeAsync(userCode);
}

View File

@@ -76,7 +76,7 @@ public class DevicesConnectController : ControllerBase
/// <param name="brand"></param>
/// <param name="factory"></param>
/// <returns></returns>
[DisableApiLog]
[DisableApiLog]
[HttpGet("brand-devices")]
[IgnoreTenant]
public async Task<List<DeviceUniqueWithConnectionInfoDto>> GetDeviceUniqueInfoByBrandAsync(

View File

@@ -0,0 +1,48 @@
using Dlhis.Basic.Device.Request;
using Dlhis.Basic.Device.Response;
using Dlhis.Basic.Device.Services;
using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace Dlhis.Basic.Device.Controllers;
/// <summary>
/// 梯控设备
/// </summary>
[Authorize]
[Route("api/[controller]")]
[ApiController]
public class ElevatorAcsController : ControllerBase
{
private readonly IElevatorAcsService _elevatorAcsService;
public ElevatorAcsController(IElevatorAcsService elevatorAcsService)
{
_elevatorAcsService = elevatorAcsService;
}
/// <summary>
/// 设备保存
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost("save")]
[Transactional]
public async Task SaveAsync(ElevatorAcsSaveRequest request)
{
await _elevatorAcsService.SaveAsync(request);
}
/// <summary>
/// 获取设备详情
/// </summary>
/// <param name="deviceUniqueNo"></param>
/// <returns></returns>
[HttpGet("detail")]
public async Task<ElevatorAcsDetailResponse> GetDetailsAsync(string deviceUniqueNo)
{
return await _elevatorAcsService.GetDetailsAsync(deviceUniqueNo);
}
}

View File

@@ -23,4 +23,9 @@ public class DevicePageRequest : PageDto
/// 启用状态
/// </summary>
public bool? Enable { get; set; }
/// <summary>
/// 是否为梯控
/// </summary>
public bool IsElevatorAcs { get; set; }
}

View File

@@ -1,7 +1,5 @@
using System.ComponentModel.DataAnnotations;
using System.Linq.Expressions;
using Dlhis.Entity.Device.Enums;
using Dlhis.Entity.Sys.Entities;
using Dlhis.Entity.Sys.Enums;
using Kurisu.AspNetCore.Utils.Extensions;

View File

@@ -0,0 +1,78 @@
using System.ComponentModel.DataAnnotations;
using Dlhis.Entity.Device.Enums;
namespace Dlhis.Basic.Device.Request;
public class ElevatorAcsSaveRequest
{
public bool IsEdit { get; set; }
/// <summary>
/// 设备唯一号
/// </summary>
[Required(ErrorMessage = "设备唯一号不能为空")]
public string UniqueNo { get; set; }
/// <summary>
/// 模板code
/// </summary>
[Required(ErrorMessage = "模板不能为空")]
public Guid TemplateCode { get; set; }
/// <summary>
/// 供应商信息
/// </summary>
[Required(ErrorMessage = "供应商信息不能为空")]
public string Supplier { get; set; }
/// <summary>
/// 设备功能 DeviceFuncEnumType
/// </summary>
[MinLength(1, ErrorMessage = "设备功能不能为空")]
[Required(ErrorMessage = "设备功能不能为空")]
public List<DeviceFuncEnumType> Funcs { get; set; }
/// <summary>
/// 心跳间隔
/// </summary>
public int HeartbeatInterval { get; set; }
/// <summary>
/// 部署点
/// </summary>
public string DeployPlace { get; set; }
/// <summary>
/// 部署坐标
/// </summary>
public string DeployPosition { get; set; }
/// <summary>
/// 部署方向 DeviceDeployDirectionEnumType
/// </summary>
public DeviceDeployDirectionEnumType? DeployDirection { get; set; }
/// <summary>
/// 连接信息
/// </summary>
[Required(ErrorMessage = "连接信息不能为空")]
public string ConnectionInfo { get; set; }
/// <summary>
/// 是否启用
/// </summary>
public bool Enable { get; set; }
/// <summary>
/// 楼层列表
/// </summary>
public List<FloorInfo> Floors { get; set; }
}
public class FloorInfo
{
/// <summary>
/// 楼层名称
/// </summary>
public string FloorName { get; set; }
}

View File

@@ -102,6 +102,33 @@ public class DevicePageResponse
/// </summary>
public bool EnableTimePeriod { get; set; }
/// <summary>
/// 是否作为梯控
/// </summary>
public bool IsElevatorAcs { get; set; }
/// <summary>
/// 同源标记
/// </summary>
public int SourceFlag
{
get
{
if (string.IsNullOrEmpty(RealDeviceUniqueNo))
{
return UniqueNo.GetHashCode();
}
return RealDeviceUniqueNo.GetHashCode();
}
}
/// <summary>
///
/// </summary>
[JsonIgnore]
public string RealDeviceUniqueNo { get; set; }
/// <summary>
/// 同步标志

View File

@@ -0,0 +1,112 @@
using Dlhis.DataPermission.Model;
using Dlhis.Entity.Device.Enums;
using Mapster;
using SqlSugar;
using SqlSugar.DbConvert;
namespace Dlhis.Basic.Device.Response;
public class ElevatorAcsDetailResponse
{
/// <summary>
/// 设备code
/// </summary>
[DeviceCode]
[SugarColumn(IsNullable = false, ColumnDescription = "设备code")]
public Guid Code { get; set; }
/// <summary>
/// 设备唯一码,IP/MAC/SNO
/// </summary>
[AdaptIgnore(MemberSide.Destination)]
[SugarColumn(IsNullable = false, ColumnDescription = "设备唯一码", UniqueGroupNameList = new[] { "Idx_Device_UniqueNo" })]
public string UniqueNo { get; set; }
/// <summary>
/// 心跳间隔
/// </summary>
[SugarColumn(IsNullable = false, ColumnDescription = "心跳检查间隔")]
public int HeartbeatInterval { get; set; } = 30;
/// <summary>
/// 供应商
/// </summary>
[SugarColumn(IsNullable = true, ColumnDescription = "供应商")]
public string Supplier { get; set; }
/// <summary>
/// 设备功能
/// </summary>
[SugarColumn(IsNullable = false, ColumnDataType = "varchar(150)", IsJson = true, ColumnDescription = "设备功能", DefaultValue = "[]")]
public List<DeviceFuncEnumType> Funcs { get; set; }
/// <summary>
/// 设备类型
/// </summary>
[SugarColumn(IsNullable = false, ColumnDescription = "设备类型", ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert))]
public DeviceTypeEnumType Type { get; set; }
/// <summary>
/// 部署点
/// </summary>
[SugarColumn(IsNullable = true, ColumnDescription = "部署点")]
public string DeployPlace { get; set; }
/// <summary>
/// 部署坐标
/// </summary>
[SugarColumn(IsNullable = true, ColumnDescription = "部署坐标")]
public string DeployPosition { get; set; }
/// <summary>
/// 部署方向
/// </summary>
[SugarColumn(IsNullable = true, ColumnDescription = "部署方向", ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert))]
public DeviceDeployDirectionEnumType? DeployDirection { get; set; }
/// <summary>
/// 模板code
/// </summary>
[SugarColumn(IsNullable = false, ColumnDescription = "模板code")]
public Guid TemplateCode { get; set; }
/// <summary>
/// 连接信息
/// </summary>
[SugarColumn(IsNullable = false, ColumnDescription = "连接信息")]
public string ConnectionInfo { get; set; }
/// <summary>
/// 是否启用
/// </summary>
[SugarColumn(IsNullable = false, ColumnDataType = "bit", ColumnDescription = "是否启用")]
public bool Enable { get; set; }
/// <summary>
/// 是否作为考勤设备
/// </summary>
[SugarColumn(IsNullable = false, ColumnDataType = "bit", ColumnDescription = "是否作为考勤设备")]
public bool AsAttendance { get; set; }
/// <summary>
/// 是否启用时段码
/// </summary>
[SugarColumn(IsNullable = false, ColumnDataType = "bit", ColumnDescription = "是否启用时段码", DefaultValue = "0")]
public bool EnableTimePeriod { get; set; } = false;
/// <summary>
/// 是否为电梯门禁设备
/// </summary>
[SugarColumn(IsNullable = false, ColumnDataType = "bit", ColumnDescription = "是否为电梯门禁设备", DefaultValue = "0")]
public bool IsElevatorAcs { get; set; }
public List<ElevatorAcsFloorResponse> Floors { get; set; }
}
public class ElevatorAcsFloorResponse
{
public string FloorName { get; set; }
public string AcsValue { get; set; }
}

View File

@@ -27,18 +27,18 @@ public interface IDevicePermissionService : IScopeDependency
/// <summary>
/// 生成下发任务(主动生成)
/// </summary>
/// <param name="userNo"></param>
/// <param name="userNoOrCode"></param>
/// <param name="taskType"></param>
/// <param name="source"></param>
/// <returns></returns>
Task GenerateDeviceTasksAsync(string userNo, DeviceTaskEnumType taskType, string source);
Task GenerateDeviceTasksAsync(string userNoOrCode, DeviceTaskEnumType taskType, string source);
/// <summary>
/// 获取用户所有设备权限
/// </summary>
/// <param name="userNo"></param>
/// <param name="userNoOrCode"></param>
/// <returns></returns>
Task<List<Guid>> GetUserDeviceCodesByNoAsync(string userNo);
Task<List<Guid>> GetUserDeviceCodesByNoOrCodeAsync(string userNoOrCode);
Task<Pagination<DeviceGainfoResponse>> GetGainfoPageByDeviceAsync(DeviceWithGainfoRequest request);
@@ -64,5 +64,6 @@ public interface IDevicePermissionService : IScopeDependency
Task<int> GenerateDeleteDeviceTasksAsync(string deviceUniqueNo);
[Obsolete("不建议使用,建议使用GetUserDeviceCodesByNoOrCodeAsync方法")]
Task<List<TempC>> GetUserDeviceCodesByNoAsync(List<string> userCodes);
}

View File

@@ -0,0 +1,10 @@
using Dlhis.Basic.Device.Request;
using Dlhis.Basic.Device.Response;
namespace Dlhis.Basic.Device.Services;
public interface IElevatorAcsService : IScopeDependency
{
Task SaveAsync(ElevatorAcsSaveRequest request);
Task<ElevatorAcsDetailResponse> GetDetailsAsync(string deviceUniqueNo);
}

View File

@@ -139,15 +139,35 @@ public class DeviceConnectService : IDeviceConnectService
{
var factories = factory.Split(",").ToList();
return await _dbContext.Queryable<DeviceEntity>()
.LeftJoin<DeviceTemplateEntity>((d, dt) => d.TemplateCode == dt.Code)
.Where((d, dt) => dt.Brand == brand && factories.Contains(d.TenantId))
.Select(d => new DeviceUniqueWithConnectionInfoDto
{
DeviceUnique = d.UniqueNo,
ConnectionInfo = d.ConnectionInfo
})
.ToListAsync();
var results = await _dbContext.Queryable<DeviceEntity>()
.LeftJoin<DeviceTemplateEntity>((d, dt) => d.TemplateCode == dt.Code)
.Where((d, dt) => dt.Brand == brand && factories.Contains(d.TenantId))
.Where(d => d.IsElevatorAcs == false)//先排除梯控
.Where(d => d.Enable == true)
.Select(d => new DeviceUniqueWithConnectionInfoDto
{
DeviceUnique = d.UniqueNo,
ConnectionInfo = d.ConnectionInfo
})
.ToListAsync();
var elevatorAcses = await _dbContext.Queryable<DeviceEntity>()
.LeftJoin<DeviceTemplateEntity>((d, dt) => d.TemplateCode == dt.Code)
.LeftJoin<ElevatorAcsFloorEntity>((d, dt, f) => d.UniqueNo == f.VirtualDeviceUniqueNo)
.Where((d, dt) => dt.Brand == brand && factories.Contains(d.TenantId))
.Where(d => d.IsElevatorAcs == true)
.Where(d => d.Enable == true)
.Select((d, dt, f) => new DeviceUniqueWithConnectionInfoDto
{
DeviceUnique = f.RealDeviceUniqueNo,
ConnectionInfo = d.ConnectionInfo
})
.ToListAsync();
results.AddRange(elevatorAcses.DistinctBy(x => x.DeviceUnique).ToList());
return results;
}

View File

@@ -298,9 +298,9 @@ public class DevicePermissionService : IDevicePermissionService
}
public async Task GenerateDeviceTasksAsync(string userNo, DeviceTaskEnumType taskType, string source)
public async Task GenerateDeviceTasksAsync(string userNoOrCode, DeviceTaskEnumType taskType, string source)
{
var deviceCodes = await GetUserDeviceCodesByNoAsync(userNo);
var deviceCodes = await GetUserDeviceCodesByNoOrCodeAsync(userNoOrCode);
if (deviceCodes.IsEmpty()) return;
var devices = await _dbContext.Queryable<DeviceEntity>()
@@ -308,13 +308,33 @@ public class DevicePermissionService : IDevicePermissionService
.Where(x => deviceCodes.Contains(x.Code))
.ToListAsync();
var gainfo = await _dbContext.Queryable<GainfoEntity>()
.Where(x => x.No == userNoOrCode || x.Code == userNoOrCode)
.Select(x => new
{
UserId = x.Id,
UserNo = x.No,
UserCode = x.Code
})
.SingleAsync()
?? await _dbContext.Queryable<GainfoLeaveEntity>()
.Where(x => x.No == userNoOrCode || x.Code == userNoOrCode)
.Select(x => new
{
UserId = (long)x.IdentityUserId,
UserNo = x.No,
UserCode = x.Code
})
.SingleAsync();
await _dbContext.InsertAsync(devices.Select(x => new DeviceTaskEntity
{
DeviceUniqueNo = x.UniqueNo,
Status = DeviceTaskStatusEnumType.Wait,
Type = taskType,
DeviceType = x.Type,
UserNo = userNo,
UserNo = gainfo.UserNo,
UserId = gainfo.UserId,
Priority = 0,
Version = 0,
TenantId = x.TenantId,
@@ -326,11 +346,14 @@ public class DevicePermissionService : IDevicePermissionService
/// <summary>
/// 获取用户所有设备权限
/// </summary>
/// <param name="userNo"></param>
/// <param name="userNoOrCode"></param>
/// <returns></returns>
public async Task<List<Guid>> GetUserDeviceCodesByNoAsync(string userNo)
public async Task<List<Guid>> GetUserDeviceCodesByNoOrCodeAsync(string userNoOrCode)
{
var no = await _dbContext.Queryable<GainfoEntity>().Where(x => x.No == userNo || x.Code == userNo).Select(x => x.No).SingleAsync();
var no = await _dbContext.Queryable<GainfoEntity>().Where(x => x.No == userNoOrCode || x.Code == userNoOrCode).Select(x => x.No).SingleAsync()
??
await _dbContext.Queryable<GainfoLeaveEntity>().Where(x => x.No == userNoOrCode || x.Code == userNoOrCode).Select(x => x.No).FirstAsync();
var result = await _devicePermissionAnalyzeService.GetUserAssignDeviceCodesWithTypeInTenantAsync(new List<string> { no });
var deviceCodes = result.First().Value.SelectMany(x => x.AssignTypes.SelectMany(p => p.Codes)).Distinct().ToList();

View File

@@ -38,24 +38,29 @@ public class DeviceService : IDeviceService
public async Task<Pagination<DevicePageResponse>> GetPageAsync(DevicePageRequest request)
{
var page = await _dbContext.Queryable<DeviceEntity>()
.LeftJoin<DeviceTemplateEntity>((d, dt) => d.TemplateCode == dt.Code)
.LeftJoin<DeviceRegistryEntity>((d, dt, dr) => d.UniqueNo == dr.DeviceUniqueNo)
.LeftJoin<BusinessPlaceEntity>((d, dt, dr, bp) => dr.BusinessPlaceCode == bp.Code)
.Where((d, dt) => d.Type == request.Type)
.WhereIF(request.Enable.HasValue, (d, dt) => d.Enable == request.Enable)
.WhereIF(request.Search.IsPresent(), d => d.UniqueNo == request.Search || d.DeployPlace.Contains(request.Search))
.WhereIF(request.Supplier.IsPresent(), d => d.Supplier.Contains(request.Supplier))
.Select((d, dt, dr, bp) => new DevicePageResponse
{
FuncsStr = d.Funcs.ToString(),
Brand = dt.Brand,
Type = d.Type,
BusinessPlaceCode = bp.Code,
BusinessPlaceName = bp.Name,
LastHeartbeatTime = dr.LastHeartbeatTime,
Factory = d.TenantId
}, true)
.ToPageListAsync(request);
.LeftJoin<DeviceTemplateEntity>((d, dt) => d.TemplateCode == dt.Code)
.LeftJoin<DeviceRegistryEntity>((d, dt, dr) => d.UniqueNo == dr.DeviceUniqueNo)
.LeftJoin<BusinessPlaceEntity>((d, dt, dr, bp) => dr.BusinessPlaceCode == bp.Code)
.LeftJoin<ElevatorAcsFloorEntity>((d, dt, dr, bp, ef) => d.UniqueNo == ef.VirtualDeviceUniqueNo)
.Where((d, dt) => d.Type == request.Type)
.Where(d => d.IsElevatorAcs == request.IsElevatorAcs)
.WhereIF(request.Enable.HasValue, (d, dt) => d.Enable == request.Enable)
.WhereIF(request.Search.IsPresent(), d => d.UniqueNo == request.Search || d.DeployPlace.Contains(request.Search))
.WhereIF(request.Supplier.IsPresent(), d => d.Supplier.Contains(request.Supplier))
.Select((d, dt, dr, bp, ef) => new DevicePageResponse
{
IsElevatorAcs = d.IsElevatorAcs,
FuncsStr = d.Funcs.ToString(),
Brand = dt.Brand,
Type = d.Type,
BusinessPlaceCode = bp.Code,
BusinessPlaceName = bp.Name,
LastHeartbeatTime = dr.LastHeartbeatTime,
RealDeviceUniqueNo = ef.RealDeviceUniqueNo,
Factory = d.TenantId,
}, true)
.ToPageListAsync(request);
//获取当前用户角色
var role = _currentUser.GetRole();
@@ -77,7 +82,6 @@ public class DeviceService : IDeviceService
}
}
var deviceUniqueNos = page.Data.Select(x => x.UniqueNo).ToList();
var deviceUsers = await _dbContext.Queryable<DeviceUserEntity>()
.Where(x => deviceUniqueNos.Contains(x.DeviceUniqueNo))

View File

@@ -0,0 +1,216 @@
using Dlhis.Basic.Device.Request;
using Dlhis.Basic.Device.Response;
using Dlhis.Entity.Basic.Entity;
using Dlhis.Entity.Device.Enums;
using Dlhis.Sys.Api;
using Kurisu.AspNetCore.Authentication.Abstractions;
using Kurisu.AspNetCore.CustomClass;
using Kurisu.AspNetCore.DataAccess.Entity;
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
using Kurisu.AspNetCore.Utils.Extensions;
using Mapster;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace Dlhis.Basic.Device.Services.Implements;
public class ElevatorAcsService : IElevatorAcsService
{
private readonly IDbContext _dbContext;
private readonly ICurrentUser _currentUser;
private readonly ITenantApi _tenantApi;
private const string DefaultPassword = "********";
private const string DefaultPasswordKey = "password";
public ElevatorAcsService(IDbContext dbContext, ICurrentUser currentUser, ITenantApi tenantApi)
{
_dbContext = dbContext;
_currentUser = currentUser;
_tenantApi = tenantApi;
}
public async Task SaveAsync(ElevatorAcsSaveRequest request)
{
await CheckUniqueNoExistsAsync(request);
await CheckTemplateExistsAsync(request.TemplateCode);
await CheckTemplateFieldAsync(request.TemplateCode, request.ConnectionInfo);
if (!request.IsEdit)
{
var password = GetJsonValue(request.ConnectionInfo, DefaultPasswordKey);
if (password.IsPresent())
{
(password == DefaultPassword).ThrowIfTrue("不支持错误的密码类型");
}
for (int i = 0; i < request.Floors.Count; i++)
{
var floor = request.Floors[i];
DeviceEntity entity = request.Adapt<DeviceEntity>();
entity.Code = Guid.NewGuid();
entity.Type = DeviceTypeEnumType.Door;
entity.IsElevatorAcs = true;
entity.Enable = true;
var virtualDeviceUniqueNo = $"{request.UniqueNo}-EACS-{floor.FloorName}";
entity.UniqueNo = virtualDeviceUniqueNo;
var elevatorAcsFloor = new ElevatorAcsFloorEntity
{
RealDeviceUniqueNo = request.UniqueNo,
FloorName = floor.FloorName,
AcsValue = i,
VirtualDeviceUniqueNo = virtualDeviceUniqueNo,
};
await _dbContext.InsertAsync(entity);
await _dbContext.InsertAsync(elevatorAcsFloor);
}
}
else
{
var prefix = request.UniqueNo + "-EACS-";
List<DeviceEntity> entities = await _dbContext.Queryable<DeviceEntity>().Where(x => x.UniqueNo.StartsWith(prefix)).ToListAsync();
foreach (var entity in entities)
{
//检查更新的密码字段是否为默认密码,如果是,则将原有密码从数据库实体中取出并替换到请求的连接信息中,防止默认密码被保存。
// 这样可以避免用户在未修改密码时,前端传递默认密码导致密码被覆盖为不可用的默认值。
var updatePassword = GetJsonValue(request.ConnectionInfo, DefaultPasswordKey);
if (updatePassword.IsPresent())
{
if (updatePassword == DefaultPassword)
{
var jObj = JObject.Parse(request.ConnectionInfo);
var password = GetJsonValue(entity.ConnectionInfo, DefaultPasswordKey);
jObj[DefaultPasswordKey] = password;
request.ConnectionInfo = jObj.ToString();
}
}
request.Adapt(entity);
await _dbContext.UpdateAsync(entity);
}
}
}
public async Task<ElevatorAcsDetailResponse> GetDetailsAsync(string deviceUniqueNo)
{
var floor = await _dbContext.Queryable<ElevatorAcsFloorEntity>().Where(x => x.VirtualDeviceUniqueNo == deviceUniqueNo).SingleAsync();
var floors = await _dbContext.Queryable<ElevatorAcsFloorEntity>().Where(x => x.RealDeviceUniqueNo == floor.RealDeviceUniqueNo).ToListAsync();
var deviceUniqueNos = floors.Select(x => x.VirtualDeviceUniqueNo).ToList();
var device = await _dbContext.Queryable<DeviceEntity>().Where(x => x.UniqueNo == deviceUniqueNo).SingleAsync();
var result = device.Adapt<ElevatorAcsDetailResponse>();
result.UniqueNo = floor.RealDeviceUniqueNo;
result.Floors = floors.Adapt<List<ElevatorAcsFloorResponse>>();
return result;
}
/// <summary>
/// 获取json的字段值
/// </summary>
/// <param name="json"></param>
/// <param name="key"></param>
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
private static string GetJsonValue(string json, string key)
{
try
{
var jObj = JObject.Parse(json);
return jObj.TryGetValue(key, out var value)
? value.Value<string>()
: string.Empty;
}
catch (JsonReaderException)
{
throw new UserFriendlyException("连接信息参数格式不正确");
}
}
/// <summary>
/// 检查设备模板是否存在
/// </summary>
/// <param name="templateCode"></param>
/// <returns></returns>
private async Task CheckTemplateExistsAsync(Guid templateCode)
{
var entity = await _dbContext.Queryable<DeviceTemplateEntity>().Where(x => x.Code == templateCode).FirstAsync();
entity.ThrowIfNull("设备模板不存在");
}
/// <summary>
/// 检查设备连接参数是否与模板设定一致
/// </summary>
/// <param name="templateCode"></param>
/// <param name="jsonContent"></param>
/// <returns></returns>
private async Task CheckTemplateFieldAsync(Guid templateCode, string jsonContent)
{
var template = await _dbContext.Queryable<DeviceTemplateEntity>().Where(x => x.Code == templateCode).SingleAsync();
template.ThrowIfNull("设备模板不存在");
try
{
var templateJObj = JObject.Parse(template.Template);
var jObj = JObject.Parse(jsonContent);
(templateJObj.Count == jObj.Count).ThrowIfFalse("连接参数字段数不一致");
foreach (var item in templateJObj)
{
jObj.ContainsKey(item.Key).ThrowIfFalse($"设备连接参数需要和模板一致.缺失{item.Key}");
}
}
catch (Exception ex) when (ex is JsonReaderException)
{
throw new UserFriendlyException("连接信息参数格式不正确");
}
}
/// <summary>
/// 检查唯一号是否存在
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
private async Task CheckUniqueNoExistsAsync(ElevatorAcsSaveRequest request)
{
await _dbContext.IgnoreAsync<ITenantId>(async () =>
{
var currentTenantId = _currentUser.GetStringTenantId();
var prefix = request.UniqueNo + "-EACS-";
//查询设备是否存在
var device = await _dbContext.Queryable<DeviceEntity>()
.Where(x => x.UniqueNo == request.UniqueNo)
.WhereIF(!request.IsEdit, x => x.UniqueNo.StartsWith(prefix))
.SingleAsync();
if (device != null)
{
(device.TenantId == currentTenantId).ThrowIfTrue("设备已经存在,请检查");
var factory = device.TenantId;
try
{
var tenant = await _tenantApi.GetTenantByCodeAsync(device.TenantId);
factory = tenant?.Name ?? string.Empty;
}
catch (Exception)
{
//ignore
}
true.ThrowIfTrue($"设备已添加{factory}厂区");
}
});
}
}

View File

@@ -29,6 +29,7 @@ public class GainfoCardsController : ControllerBase
/// <param name="request"></param>
/// <returns></returns>
[HttpPost("change")]
[IgnoreTenant]
[Transactional]
public async Task ChangeCardAsync(GainfoChangeCardRequest request)
{

View File

@@ -35,6 +35,19 @@ public class GainfoFingerprintsController : ControllerBase
await _gainfoFingerprintService.CollectFingerprintAsync(request.UserCode, request.FingerNum, request.Fingerprint);
}
/// <summary>
/// 批量采集
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost("batchCollect")]
[IgnoreTenant]
[Transactional]
public async Task CollectFingerprintAsync(FingerprintBatchCollectRequest request)
{
await _gainfoFingerprintService.CollectFingerprintAsync(request);
}
/// <summary>
/// 获取人员指纹数据
/// </summary>

View File

@@ -0,0 +1,20 @@
using System.ComponentModel.DataAnnotations;
namespace Dlhis.Basic.Organization.Request
{
public class FingerprintBatchCollectRequest
{
[Required(ErrorMessage = "工号不能为空")]
public string UserCode { get; set; }
[MinLength(1, ErrorMessage = "指纹列表不能为空")]
public List<FingerprintItem> Fingerprints { get; set; }
}
public class FingerprintItem
{
public int FingerNum { get; set; }
public string Fingerprint { get; set; }
}
}

View File

@@ -1,10 +1,12 @@
using Dlhis.Basic.Organization.Response;
using Dlhis.Basic.Organization.Request;
using Dlhis.Basic.Organization.Response;
namespace Dlhis.Basic.Organization.Services;
public interface IGainfoFingerprintService : IScopeDependency
{
Task CollectFingerprintAsync(string userCode, int fingerNum, string fingerprint);
Task CollectFingerprintAsync(FingerprintBatchCollectRequest request);
Task<GainfoFingerprintResponse> GetFingerprintAsync(string userCode, int? fingerNum);
}

View File

@@ -29,13 +29,23 @@ public class GainfoCardService : IGainfoCardService
public async Task ChangeCardAsync(GainfoChangeCardRequest request)
{
if (await _gainfoStore.Queryable().Where(x => x.CardNo == request.CardNo).AnyAsync())
{
true.ThrowIfTrue("卡号已分配");
}
var gainfo = await _gainfoStore.Queryable().Where(x => x.No == request.UserNo).FirstAsync();
gainfo.ThrowIfNull("档案不存在");
gainfo.CardNo = request.CardNo;
await _gainfoStore.UpdateAsync(gainfo);
await _dbContext.InsertAsync(request.Adapt<GainfoCardRecordEntity>());
var cardRecord = request.Adapt<GainfoCardRecordEntity>();
cardRecord.TenantId = gainfo.Factory;
await _dbContext.InsertAsync(cardRecord);
await _gainfoPermissionService.ResetPermissionsAsync(gainfo.No, DeviceTaskEnumType.Update, null, null, "更新卡号下发");
}
public async Task<List<ChangeCardResponse>> GetChangeRecordsAsync(string userNo)

View File

@@ -1,72 +1,117 @@
using Dlhis.Basic.Organization.Response;
using Dlhis.Basic.Device.Services;
using Dlhis.Basic.Organization.Request;
using Dlhis.Basic.Organization.Response;
using Dlhis.Entity.Basic.Entity;
using Dlhis.Entity.Device.Entities;
using Dlhis.Entity.Device.Enums;
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
using Kurisu.AspNetCore.Utils.Extensions;
namespace Dlhis.Basic.Organization.Services.Implements
namespace Dlhis.Basic.Organization.Services.Implements;
public class GainfoFingerprintService : IGainfoFingerprintService
{
public class GainfoFingerprintService : IGainfoFingerprintService
private readonly IDbContext _dbContext;
private readonly IDevicePermissionService _devicePermissionService;
public GainfoFingerprintService(IDbContext dbContext, IDevicePermissionService devicePermissionService)
{
private readonly IDbContext _dbContext;
public GainfoFingerprintService(IDbContext dbContext)
_dbContext = dbContext;
_devicePermissionService = devicePermissionService;
}
public async Task CollectFingerprintAsync(string userCode, int fingerNum, string fingerprint)
{
await CollectFingerprintAsync(new FingerprintBatchCollectRequest
{
_dbContext = dbContext;
}
public async Task CollectFingerprintAsync(string userCode, int fingerNum, string fingerprint)
{
if (!await _dbContext.Queryable<GainfoEntity>().Where(x => x.Code == userCode).AnyAsync())
UserCode = userCode,
Fingerprints = new List<FingerprintItem>
{
true.ThrowIfTrue("人员不存在");
new FingerprintItem
{
FingerNum = fingerNum,
Fingerprint = fingerprint
}
}
});
}
var gainfoFingerprint = await _dbContext.Queryable<GainfoFingerprintEntity>().Where(x => x.UserCode == userCode && x.FingerNum == fingerNum).FirstAsync();
public async Task CollectFingerprintAsync(FingerprintBatchCollectRequest request)
{
var gainfo = await _dbContext.Queryable<GainfoEntity>().Where(x => x.Code == request.UserCode).SingleAsync();
gainfo.ThrowIfNull("人员不存在");
gainfo.CardNo.IsEmpty().ThrowIfTrue("人员未绑定卡号,无法采集指纹");
foreach (var item in request.Fingerprints)
{
var gainfoFingerprint = await _dbContext.Queryable<GainfoFingerprintEntity>().Where(x => x.UserCode == request.UserCode && x.FingerNum == item.FingerNum).FirstAsync();
if (gainfoFingerprint == null)
{
gainfoFingerprint = new GainfoFingerprintEntity
{
UserCode = userCode,
FingerNum = fingerNum,
Fingerprint = fingerprint
UserCode = request.UserCode,
FingerNum = item.FingerNum,
Fingerprint = item.Fingerprint
};
await _dbContext.InsertAsync(gainfoFingerprint);
}
else
{
gainfoFingerprint.Fingerprint = fingerprint;
gainfoFingerprint.Fingerprint = item.Fingerprint;
await _dbContext.UpdateAsync(gainfoFingerprint);
}
}
public async Task<GainfoFingerprintResponse> GetFingerprintAsync(string userCode, int? fingerNum)
var deviceCodes = await _devicePermissionService.GetUserDeviceCodesByNoOrCodeAsync(request.UserCode);
var devices = await _dbContext.Queryable<DeviceEntity>()
.Where(x => x.IsElevatorAcs)
.Where(x => deviceCodes.Contains(x.Code))
.ToListAsync();
await _dbContext.InsertAsync(devices.Select(x => new DeviceTaskEntity
{
var gainfo = await _dbContext.Queryable<GainfoEntity>()
.LeftJoin<DepartmentEntity>((x, dept) => x.DepartmentNo == dept.No)
.Where(x => x.Code == userCode)
.Select((x, dept) => new
{
x.Code,
x.Name,
x.DepartmentNo,
DepartmentName = dept.Name
})
.FirstAsync();
gainfo.ThrowIfNull("人员不存在");
DeviceUniqueNo = x.UniqueNo,
Status = DeviceTaskStatusEnumType.Wait,
Type = DeviceTaskEnumType.Add,
DeviceType = x.Type,
UserNo = gainfo.No,
UserId = gainfo.Id,
Priority = 0,
Version = 0,
TenantId = x.TenantId,
Source = "指纹采集下发"
}).ToList());
}
var fingerprins = await _dbContext.Queryable<GainfoFingerprintEntity>().Where(x => x.UserCode == userCode).OrderBy(x => x.FingerNum).ToListAsync();
return new GainfoFingerprintResponse
public async Task<GainfoFingerprintResponse> GetFingerprintAsync(string userCode, int? fingerNum)
{
var gainfo = await _dbContext.Queryable<GainfoEntity>()
.LeftJoin<DepartmentEntity>((x, dept) => x.DepartmentNo == dept.No)
.Where(x => x.Code == userCode)
.Select((x, dept) => new
{
UserCode = gainfo.Code,
UserName = gainfo.Name,
DepartmentNo = gainfo.DepartmentNo,
DepartmentName = gainfo.DepartmentName,
Fingerprints = fingerprins.Select(x => new FingerprintResponse
{
FingerNum = x.FingerNum,
Fingerprint = x.Fingerprint
}).ToList()
};
}
x.Code,
x.Name,
x.DepartmentNo,
DepartmentName = dept.Name
})
.FirstAsync();
gainfo.ThrowIfNull("人员不存在");
var fingerprins = await _dbContext.Queryable<GainfoFingerprintEntity>().Where(x => x.UserCode == userCode).OrderBy(x => x.FingerNum).ToListAsync();
return new GainfoFingerprintResponse
{
UserCode = gainfo.Code,
UserName = gainfo.Name,
DepartmentNo = gainfo.DepartmentNo,
DepartmentName = gainfo.DepartmentName,
Fingerprints = fingerprins.Select(x => new FingerprintResponse
{
FingerNum = x.FingerNum,
Fingerprint = x.Fingerprint
}).ToList()
};
}
}

View File

@@ -19,11 +19,15 @@ namespace Dlhis.Basic.Organization.Services.Implements;
public class GainfoPermissionService : IGainfoPermissionService
{
private readonly IDevicePermissionAnalyzeService _devicePermissionAnalyzeService;
private readonly IDevicePermissionService _devicePermissionService;
private readonly IDbContext _dbContext;
public GainfoPermissionService(IDevicePermissionAnalyzeService devicePermissionAnalyzeService, IDbContext dbContext)
public GainfoPermissionService(IDevicePermissionAnalyzeService devicePermissionAnalyzeService,
IDevicePermissionService devicePermissionService,
IDbContext dbContext)
{
_devicePermissionAnalyzeService = devicePermissionAnalyzeService;
_devicePermissionService = devicePermissionService;
_dbContext = dbContext;
}
@@ -102,81 +106,81 @@ public class GainfoPermissionService : IGainfoPermissionService
}).ToList());
}
public async Task<Pagination<GainfoDevicePermissionResponse>> GetAssignDeviceCodes2Async(DeviceAssRequest request)
{
var result = await _devicePermissionAnalyzeService.GetUserAssignDeviceCodesWithTypeInTenantAsync(new List<string> { request.UserNo });
if (!result.TryGetValue(request.UserNo, out var permissions))
{
return new Pagination<GainfoDevicePermissionResponse>();
}
//public async Task<Pagination<GainfoDevicePermissionResponse>> GetAssignDeviceCodes2Async(DeviceAssRequest request)
//{
// var result = await _devicePermissionAnalyzeService.GetUserAssignDeviceCodesWithTypeInTenantAsync(new List<string> { request.UserNo });
// if (!result.TryGetValue(request.UserNo, out var permissions))
// {
// return new Pagination<GainfoDevicePermissionResponse>();
// }
var expandResult = await ExpandUserAssignDeviceCodesWithTypeInTenantAsync(result);
// var expandResult = await ExpandUserAssignDeviceCodesWithTypeInTenantAsync(result);
var deviceCodes = permissions.SelectMany(x => x.AssignTypes.SelectMany(p => p.Codes)).Distinct().ToList();
// var deviceCodes = permissions.SelectMany(x => x.AssignTypes.SelectMany(p => p.Codes)).Distinct().ToList();
var list = await _dbContext.Queryable<DeviceEntity>()
.LeftJoin<DeviceRegistryEntity>((d, dr) => d.UniqueNo == dr.DeviceUniqueNo)
.WhereIF(request.Search.IsPresent(), d => d.UniqueNo == request.Search)
.Where(d => deviceCodes.Contains(d.Code))
.Select((d, dr) => new GainfoDevicePermissionResponse { Factory = d.TenantId }, true)
.ToListAsync();
// var list = await _dbContext.Queryable<DeviceEntity>()
// .LeftJoin<DeviceRegistryEntity>((d, dr) => d.UniqueNo == dr.DeviceUniqueNo)
// .WhereIF(request.Search.IsPresent(), d => d.UniqueNo == request.Search)
// .Where(d => deviceCodes.Contains(d.Code))
// .Select((d, dr) => new GainfoDevicePermissionResponse { Factory = d.TenantId }, true)
// .ToListAsync();
var deviceGroups = await _dbContext.Queryable<DeviceGroupEntity>().Select(x => new { x.Code, x.Name }).ToListAsync();
var departments = permissions.Any(x => x.AssignTypes.Any(p => p.AssignType == AssignTypeEnumType.Department))
? await _dbContext.Queryable<DepartmentEntity>().Select(x => new { x.No, x.Name }).ToListAsync()
: new[] { new { No = string.Empty, Name = string.Empty } }.ToList();
// var deviceGroups = await _dbContext.Queryable<DeviceGroupEntity>().Select(x => new { x.Code, x.Name }).ToListAsync();
// var departments = permissions.Any(x => x.AssignTypes.Any(p => p.AssignType == AssignTypeEnumType.Department))
// ? await _dbContext.Queryable<DepartmentEntity>().Select(x => new { x.No, x.Name }).ToListAsync()
// : new[] { new { No = string.Empty, Name = string.Empty } }.ToList();
var userGroups = permissions.Any(x => x.AssignTypes.Any(p => p.AssignType == AssignTypeEnumType.Group))
? await _dbContext.Queryable<GainfoGroupEntity>().Select(x => new { x.Code, x.Name }).ToListAsync()
: new[] { new { Code = Guid.Empty, Name = string.Empty } }.ToList();
// var userGroups = permissions.Any(x => x.AssignTypes.Any(p => p.AssignType == AssignTypeEnumType.Group))
// ? await _dbContext.Queryable<GainfoGroupEntity>().Select(x => new { x.Code, x.Name }).ToListAsync()
// : new[] { new { Code = Guid.Empty, Name = string.Empty } }.ToList();
list.ForEach(item =>
{
var permission = permissions.FirstOrDefault(x => x.Tenant == item.Factory);
if (permission != null)
{
item.Source = new DevicePermissionSourceDto
{
Factory = item.Factory,
Types = permission.AssignTypes.Where(x => x.Codes.Any(p => p == item.Code)).Select(x =>
{
var codeDesc = x.UniqueType == DeviceAssignmentTypeEnumType.Device
? item.DeployPlace
: deviceGroups.FirstOrDefault(p => p.Code == x.OriginalCodes.First())?.Name;
// list.ForEach(item =>
// {
// var permission = permissions.FirstOrDefault(x => x.Tenant == item.Factory);
// if (permission != null)
// {
// item.Source = new DevicePermissionSourceDto
// {
// Factory = item.Factory,
// Types = permission.AssignTypes.Where(x => x.Codes.Any(p => p == item.Code)).Select(x =>
// {
// var codeDesc = x.UniqueType == DeviceAssignmentTypeEnumType.Device
// ? item.DeployPlace
// : deviceGroups.FirstOrDefault(p => p.Code == x.OriginalCodes.First())?.Name;
var currentAssignValue = x.AssignValue;
// var currentAssignValue = x.AssignValue;
currentAssignValue = x.AssignType switch
{
AssignTypeEnumType.Department => departments.FirstOrDefault(p => p.No == x.AssignValue.Split(":")[1])?.Name,
AssignTypeEnumType.Group => userGroups.FirstOrDefault(p => p.Code == Guid.Parse(currentAssignValue))?.Name,
AssignTypeEnumType.User => "自己",
_ => currentAssignValue
};
// currentAssignValue = x.AssignType switch
// {
// AssignTypeEnumType.Department => departments.FirstOrDefault(p => p.No == x.AssignValue.Split(":")[1])?.Name,
// AssignTypeEnumType.Group => userGroups.FirstOrDefault(p => p.Code == Guid.Parse(currentAssignValue))?.Name,
// AssignTypeEnumType.User => "自己",
// _ => currentAssignValue
// };
var r = new DevicePermissionSourceTypeDto
{
AssignType = x.AssignType,
AssignValue = currentAssignValue,
UniqueType = x.UniqueType,
Codes = x.UniqueType == DeviceAssignmentTypeEnumType.Device
? x.Codes.Where(p => p == item.Code)
: x.Codes.Take(1),
CodeDesc = codeDesc
};
// var r = new DevicePermissionSourceTypeDto
// {
// AssignType = x.AssignType,
// AssignValue = currentAssignValue,
// UniqueType = x.UniqueType,
// Codes = x.UniqueType == DeviceAssignmentTypeEnumType.Device
// ? x.Codes.Where(p => p == item.Code)
// : x.Codes.Take(1),
// CodeDesc = codeDesc
// };
return r;
})
};
}
});
// return r;
// })
// };
// }
// });
var page = list.Where(x => x.Type == request.DeviceType).ToPage(request);
page.Total = list.Where(x => x.Type == request.DeviceType).Count();
// var page = list.Where(x => x.Type == request.DeviceType).ToPage(request);
// page.Total = list.Where(x => x.Type == request.DeviceType).Count();
return page;
}
// return page;
//}
private void HandleNext(Guid current, List<Guid> links, List<DeviceGroupEntity> deviceGroups, List<DeviceGroupRelationshipEntity> deviceGroupRelationships, List<TenantAssignTypeDeviceCodeExpanded> result)
{
@@ -270,99 +274,34 @@ public class GainfoPermissionService : IGainfoPermissionService
}
//
// public async Task<Pagination<GainfoDevicePermissionResponse>> GetAllUserAssignDeviceCodesAsync()
// {
// var result = await _devicePermissionAnalyzeService.GetUserAssignDeviceCodesWithTypeInTenantAsync(null);
//
// var codes = permissions.SelectMany(x => x.AssignTypes.SelectMany(p => p.Codes)).Distinct().ToList();
//
// var page = await _dbContext.Queryable<DeviceEntity>()
// .LeftJoin<DeviceRegistryEntity>((d, dr) => d.UniqueNo == dr.DeviceUniqueNo)
// .WhereIF(request.DeviceType.HasValue, d => d.Type == request.DeviceType)
// .WhereIF(request.Search.IsPresent(), d => d.UniqueNo == request.Search)
// .Where(d => codes.Contains(d.Code))
// .Select((d, dr) => new GainfoDevicePermissionResponse { Factory = d.TenantId }, true)
// .ToPageListAsync(request);
//
// var deviceGroups = await _dbContext.Queryable<DeviceGroupEntity>().Select(x => new { x.Code, x.Name }).ToListAsync();
// var departments = permissions.Any(x => x.AssignTypes.Any(p => p.AssignType == AssignTypeEnumType.Department))
// ? await _dbContext.Queryable<DepartmentEntity>().Select(x => new { x.No, x.Name }).ToListAsync()
// : new[] { new { No = string.Empty, Name = string.Empty } }.ToList();
//
// var userGroups = permissions.Any(x => x.AssignTypes.Any(p => p.AssignType == AssignTypeEnumType.Group))
// ? await _dbContext.Queryable<GainfoGroupEntity>().Select(x => new { x.Code, x.Name }).ToListAsync()
// : new[] { new { Code = Guid.Empty, Name = string.Empty } }.ToList();
//
// page.Data.ForEach(item =>
// {
// var permission = permissions.FirstOrDefault(x => x.Tenant == item.Factory);
// if (permission != null)
// {
// item.Source = new DevicePermissionSourceDto
// {
// Factory = item.Factory,
// Types = permission.AssignTypes.Where(x => x.Codes.Any(p => p == item.Code)).Select(x =>
// {
// var codeDesc = x.UniqueType == DeviceAssignmentTypeEnumType.Device
// ? item.DeployPlace
// : deviceGroups.FirstOrDefault(p => p.Code == x.OriginalCodes.First())?.Name;
//
// var currentAssignValue = x.AssignValue;
//
// currentAssignValue = x.AssignType switch
// {
// AssignTypeEnumType.Department => departments.FirstOrDefault(p => p.No == x.AssignValue.Split(":")[1])?.Name,
// AssignTypeEnumType.Group => userGroups.FirstOrDefault(p => p.Code == Guid.Parse(currentAssignValue))?.Name,
// AssignTypeEnumType.User => "自己",
// _ => currentAssignValue
// };
//
// var r = new DevicePermissionSourceTypeDto
// {
// AssignType = x.AssignType,
// AssignValue = currentAssignValue,
// UniqueType = x.UniqueType,
// Codes = x.UniqueType == DeviceAssignmentTypeEnumType.Device
// ? x.Codes.Where(p => p == item.Code)
// : x.Codes.Take(1),
// CodeDesc = codeDesc
// };
//
// return r;
// })
// };
// }
// });
//
// return page;
// }
public async Task<DevicePermissionAssignResponse> ResetPermissionsAsync(string userNo, DeviceTaskEnumType type, DeviceTypeEnumType? deviceType, List<Guid> deviceCodes, string source)
{
var gainfo = await _dbContext.Queryable<GainfoEntity>()
.Where(x => x.No == userNo)
.SingleAsync();
if (gainfo == null)
{
gainfo = await _dbContext.Queryable<GainfoEntity>().AS("GainfoLeave")
.Where(x => x.No == userNo)
.SingleAsync();
if (gainfo != null)
.Where(x => x.No == userNo || x.Code == userNo)
.Select(x => new
{
UserId = x.Id,
UserNo = x.No,
UserCode = x.Code
})
.SingleAsync()
?? await _dbContext.Queryable<GainfoLeaveEntity>()
.Where(x => x.No == userNo || x.Code == userNo)
.Select(x => new
{
gainfo.Id = gainfo.IdentityUserId;
}
}
UserId = (long)x.IdentityUserId,
UserNo = x.No,
UserCode = x.Code
})
.SingleAsync();
gainfo.ThrowIfNull("档案数据不存在");
//获取人员的设备权限
if (deviceCodes.IsEmpty())
{
deviceCodes = await _devicePermissionAnalyzeService.GetUserPermissionDeviceCodesAsync(gainfo!.No);
deviceCodes = await _devicePermissionService.GetUserDeviceCodesByNoOrCodeAsync(gainfo.UserCode);
}
var devices = await _dbContext.Queryable<DeviceEntity>()
@@ -372,11 +311,11 @@ public class GainfoPermissionService : IGainfoPermissionService
var tasks = devices.Select(x => new DeviceTaskEntity
{
UserId = gainfo!.Id,
UserId = gainfo!.UserId,
UserNo = userNo,
DeviceUniqueNo = x.UniqueNo,
Status = DeviceTaskStatusEnumType.Wait,
Version = 0,
UserNo = userNo,
Type = type,
DeviceType = x.Type,
TenantId = x.TenantId,

View File

@@ -313,7 +313,7 @@ public class GainfoService : IGainfoService
await _dbContext.UpdateAsync(gainfo);
var deviceCodes = await _devicePermissionService.GetUserDeviceCodesByNoAsync(gainfo.No);
var deviceCodes = await _devicePermissionService.GetUserDeviceCodesByNoOrCodeAsync(gainfo.No);
var dhDevices = await _dbContext.Queryable<DeviceEntity>().LeftJoin<DeviceTemplateEntity>((x, xt) => x.TemplateCode == xt.Code)
.Where((x, xt) => xt.Name == "大华人脸机")

View File

@@ -365,7 +365,7 @@ public class GainfoUpdateService : IGainfoUpdateService
}
}
}
else
else
{
await _gainfoPermissionService.ResetPermissionsAsync(gainfo.No, DeviceTaskEnumType.Delete, null, null, "人员离职生成");

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- https://go.microsoft.com/fwlink/?LinkID=208121. -->
<Project>
<PropertyGroup>
<DeleteExistingFiles>false</DeleteExistingFiles>
<ExcludeApp_Data>false</ExcludeApp_Data>
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<PublishProvider>FileSystem</PublishProvider>
<PublishUrl>bin\Release\net6.0\publish\</PublishUrl>
<WebPublishMethod>FileSystem</WebPublishMethod>
<_TargetId>Folder</_TargetId>
</PropertyGroup>
</Project>