fix 人脸照片相同不产生任务
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
using Dlhis.Basic.Device.Services;
|
using Dlhis.Basic.Device.Services;
|
||||||
using Dlhis.Basic.Device.Services.Implements;
|
|
||||||
using Dlhis.Basic.Organization.Request;
|
using Dlhis.Basic.Organization.Request;
|
||||||
using Dlhis.Basic.Organization.Response;
|
using Dlhis.Basic.Organization.Response;
|
||||||
using Dlhis.Entity.Basic.Entity;
|
using Dlhis.Entity.Basic.Entity;
|
||||||
@@ -25,13 +24,18 @@ public class GainfoService : IGainfoService
|
|||||||
private readonly IDbContext _dbContext;
|
private readonly IDbContext _dbContext;
|
||||||
private readonly ICurrentUser _currentUser;
|
private readonly ICurrentUser _currentUser;
|
||||||
private readonly IDevicePermissionService _devicePermissionService;
|
private readonly IDevicePermissionService _devicePermissionService;
|
||||||
|
private readonly ILogger<GainfoService> _logger;
|
||||||
|
|
||||||
public GainfoService(IGainfoStore gainfoStore, IDbContext dbContext, ICurrentUser currentUser, IDevicePermissionService devicePermissionService)
|
public GainfoService(IGainfoStore gainfoStore,
|
||||||
|
IDbContext dbContext,
|
||||||
|
ICurrentUser currentUser,
|
||||||
|
IDevicePermissionService devicePermissionService, ILogger<GainfoService> logger)
|
||||||
{
|
{
|
||||||
_gainfoStore = gainfoStore;
|
_gainfoStore = gainfoStore;
|
||||||
_dbContext = dbContext;
|
_dbContext = dbContext;
|
||||||
_currentUser = currentUser;
|
_currentUser = currentUser;
|
||||||
_devicePermissionService = devicePermissionService;
|
_devicePermissionService = devicePermissionService;
|
||||||
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -212,9 +216,7 @@ public class GainfoService : IGainfoService
|
|||||||
dbContext.Client.CurrentConnectionConfig.ConnectionString = faceConnectionString;
|
dbContext.Client.CurrentConnectionConfig.ConnectionString = faceConnectionString;
|
||||||
var face = await dbContext.Queryable<GainfoFaceEntity>().Where(x => x.UserCode == gainfo.Code).SingleAsync();
|
var face = await dbContext.Queryable<GainfoFaceEntity>().Where(x => x.UserCode == gainfo.Code).SingleAsync();
|
||||||
|
|
||||||
//生成任务
|
var taskType = face == null ? DeviceTaskEnumType.Add : DeviceTaskEnumType.Update;
|
||||||
await _devicePermissionService.GenerateDeviceTasksAsync(gainfo.No, face == null ? DeviceTaskEnumType.Add : DeviceTaskEnumType.AddAfterDelete);
|
|
||||||
|
|
||||||
if (face == null)
|
if (face == null)
|
||||||
{
|
{
|
||||||
face = new GainfoFaceEntity
|
face = new GainfoFaceEntity
|
||||||
@@ -227,9 +229,18 @@ public class GainfoService : IGainfoService
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (face.Face == request.Face)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("相同的人脸照片更新忽略");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
face.Face = request.Face;
|
face.Face = request.Face;
|
||||||
await dbContext.UpdateAsync(face);
|
await dbContext.UpdateAsync(face);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//生成任务
|
||||||
|
await _devicePermissionService.GenerateDeviceTasksAsync(gainfo.No, taskType);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,8 +8,6 @@ namespace Dlhis.Entity.Device.Enums;
|
|||||||
[Description("设备任务类型")]
|
[Description("设备任务类型")]
|
||||||
public enum DeviceTaskEnumType
|
public enum DeviceTaskEnumType
|
||||||
{
|
{
|
||||||
// 状态:ADD-准备下发;ADDOK-下发成功;DEL-准备删除;DELOK-删除成功;AERR-下发错误;DERR-删除错误;UUU-先删除后下发;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 添加
|
/// 添加
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -23,8 +21,8 @@ public enum DeviceTaskEnumType
|
|||||||
Delete = 2,
|
Delete = 2,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 删除后添加
|
/// 更新
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Description("删除后添加")]
|
[Description("更新")]
|
||||||
AddAfterDelete = 3,
|
Update = 3,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user