fix 统计人数调整,移除无用接口
This commit is contained in:
@@ -148,17 +148,6 @@ public class DevicesController : ControllerBase
|
|||||||
return await _deviceService.CheckExistsAsync(deviceUniqueNo);
|
return await _deviceService.CheckExistsAsync(deviceUniqueNo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获取设备
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="request"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpGet]
|
|
||||||
public async Task<DeviceResponse> GetDeviceByNoAsync([FromQuery] DeviceByNoRequest request)
|
|
||||||
{
|
|
||||||
return await _deviceService.GetDeviceByNoAsync(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取考勤设备
|
/// 获取考勤设备
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using Dlhis.Basic.Device.Response;
|
using Dlhis.Basic.Summary.Response;
|
||||||
using Dlhis.Basic.Summary.Response;
|
|
||||||
using Dlhis.Basic.Summary.Services;
|
using Dlhis.Basic.Summary.Services;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
using Dlhis.Basic.Device.Response;
|
using Dlhis.Basic.Organization.Services;
|
||||||
using Dlhis.Basic.Organization.Services;
|
|
||||||
using Dlhis.Basic.Summary.Dto;
|
using Dlhis.Basic.Summary.Dto;
|
||||||
using Dlhis.Basic.Summary.Response;
|
using Dlhis.Basic.Summary.Response;
|
||||||
using Dlhis.Entity.Basic.Entity;
|
using Dlhis.Entity.Basic.Entity;
|
||||||
using Dlhis.Entity.Basic.Enums;
|
using Dlhis.Entity.Basic.Enums;
|
||||||
using Dlhis.Entity.Device.Entities;
|
using Dlhis.Entity.Device.Entities;
|
||||||
using Dlhis.Entity.Device.Enums;
|
using Dlhis.Entity.Device.Enums;
|
||||||
|
using Kurisu.Core.User.Abstractions;
|
||||||
using Kurisu.SqlSugar.Services;
|
using Kurisu.SqlSugar.Services;
|
||||||
|
|
||||||
namespace Dlhis.Basic.Summary.Services.Implements;
|
namespace Dlhis.Basic.Summary.Services.Implements;
|
||||||
@@ -14,22 +14,26 @@ public class SummaryService : ISummaryService
|
|||||||
{
|
{
|
||||||
private readonly IDbContext _dbContext;
|
private readonly IDbContext _dbContext;
|
||||||
private readonly IGainfoStore _gainfoStore;
|
private readonly IGainfoStore _gainfoStore;
|
||||||
|
private readonly ICurrentUser _currentUser;
|
||||||
|
|
||||||
public SummaryService(IDbContext dbContext, IGainfoStore gainfoStore)
|
public SummaryService(IDbContext dbContext, IGainfoStore gainfoStore, ICurrentUser currentUser)
|
||||||
{
|
{
|
||||||
_dbContext = dbContext;
|
_dbContext = dbContext;
|
||||||
_gainfoStore = gainfoStore;
|
_gainfoStore = gainfoStore;
|
||||||
|
_currentUser = currentUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<AttendanceSummaryResponse> GetAttendanceSummaryAsync()
|
public async Task<AttendanceSummaryResponse> GetAttendanceSummaryAsync()
|
||||||
{
|
{
|
||||||
var now = DateTime.Now;
|
var now = DateTime.Now;
|
||||||
|
var tenantId = _currentUser.GetStringTenantId();
|
||||||
|
|
||||||
var currentDay = DateTime.Today.AddDays(1).AddSeconds(-1);
|
var currentDay = DateTime.Today.AddDays(1).AddSeconds(-1);
|
||||||
var before30Day = DateTime.Today.AddDays(-29);
|
var before30Day = DateTime.Today.AddDays(-29);
|
||||||
var before7Day = DateTime.Today.AddDays(-6);
|
var before7Day = DateTime.Today.AddDays(-6);
|
||||||
|
|
||||||
var devices = await _dbContext.Queryable<DeviceEntity>().Where(x => x.Type == DeviceTypeEnumType.Attendance || (x.Type == DeviceTypeEnumType.Door && x.AsAttendance)).ToListAsync();
|
var devices = await _dbContext.Queryable<DeviceEntity>().Where(x => x.Type == DeviceTypeEnumType.Attendance || (x.Type == DeviceTypeEnumType.Door && x.AsAttendance))
|
||||||
|
.ToListAsync();
|
||||||
var deviceUniqueNos = devices.Select(x => x.UniqueNo).ToList();
|
var deviceUniqueNos = devices.Select(x => x.UniqueNo).ToList();
|
||||||
|
|
||||||
var deviceRegistries = await _dbContext.Queryable<DeviceRegistryEntity>()
|
var deviceRegistries = await _dbContext.Queryable<DeviceRegistryEntity>()
|
||||||
@@ -42,8 +46,8 @@ public class SummaryService : ISummaryService
|
|||||||
})
|
})
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
var workingGainfos = await _gainfoStore.Queryable(GainfoStatusEnumType.Working).ToListAsync();
|
var workingGainfos = await _gainfoStore.Queryable(GainfoStatusEnumType.Working).Where(x => x.Factory == tenantId).ToListAsync();
|
||||||
var leaveGainfos = await _gainfoStore.Queryable(GainfoStatusEnumType.Leave).ToListAsync();
|
var leaveGainfos = await _gainfoStore.Queryable(GainfoStatusEnumType.Leave).Where(x => x.Factory == tenantId).ToListAsync();
|
||||||
|
|
||||||
return new AttendanceSummaryResponse
|
return new AttendanceSummaryResponse
|
||||||
{
|
{
|
||||||
@@ -160,7 +164,7 @@ public class SummaryService : ISummaryService
|
|||||||
ginfoTrendResponse.UnemployedTrend = unemployedTrend;
|
ginfoTrendResponse.UnemployedTrend = unemployedTrend;
|
||||||
res.GainfoTrend = ginfoTrendResponse;
|
res.GainfoTrend = ginfoTrendResponse;
|
||||||
employedTrend.ForEach(x => res.WeekEmployed += x.Count);
|
employedTrend.ForEach(x => res.WeekEmployed += x.Count);
|
||||||
unemployedTrend.ForEach(x => res.WeekUnemployed+=x.Count);
|
unemployedTrend.ForEach(x => res.WeekUnemployed += x.Count);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user