feat 获取人脸登记详情

This commit is contained in:
2024-06-07 22:17:26 +08:00
parent a3f4950df2
commit 114cd5d006
3 changed files with 31 additions and 2 deletions

View File

@@ -46,4 +46,14 @@ public class SummariesController : ControllerBase
{
return await _summaryService.GetDoorDataAsync();
}
}
/// <summary>
///
/// </summary>
/// <returns></returns>
[HttpGet("faceRecordDetail")]
public async Task<object> GetCurrentFactoryFaceDetailAsync()
{
return await _summaryService.GetCurrentFactoryFaceDetailAsync();
}
}

View File

@@ -9,4 +9,6 @@ public interface ISummaryService : IScopeDependency
Task<DoorHomeDataResponse> GetDoorHomeDataAsync();
Task<DoorDataResponse> GetDoorDataAsync();
}
Task<object> GetCurrentFactoryFaceDetailAsync();
}

View File

@@ -13,6 +13,7 @@ namespace Dlhis.Basic.Summary.Services.Implements;
public class SummaryService : ISummaryService
{
private readonly IDbContext _dbContext;
private readonly IDbContext _faceDbContext;
private readonly IGainfoStore _gainfoStore;
private readonly ICurrentUser _currentUser;
@@ -21,6 +22,8 @@ public class SummaryService : ISummaryService
_dbContext = dbContext;
_gainfoStore = gainfoStore;
_currentUser = currentUser;
_faceDbContext = dbContext.ChangeDb("face");
}
public async Task<AttendanceSummaryResponse> GetAttendanceSummaryAsync()
@@ -168,6 +171,20 @@ public class SummaryService : ISummaryService
return res;
}
/// <inheritdoc />
public async Task<object> GetCurrentFactoryFaceDetailAsync()
{
var currentTenantId = _currentUser.GetStringTenantId();
var userCodes = await _dbContext.Queryable<GainfoEntity>().Where(x => x.Factory == currentTenantId).Select(x => x.Code).ToListAsync();
var total = userCodes.Count;
var exists = await _faceDbContext.Queryable<GainfoFaceEntity>().Where(x => userCodes.Contains(x.UserCode)).CountAsync();
return new
{
total, exists
};
}
private static List<TrendDto> FixTrend(IEnumerable<TrendDto> dtos, DateTime start, DateTime end)
{
var result = dtos.ToList();