fix 移除无用接口,数据权限增加tenant-admin过滤
This commit is contained in:
@@ -23,7 +23,8 @@ public class GetDataPermissionService : IGetDataPermissions, ISingletonDependenc
|
||||
public Dictionary<string, List<Guid>> GetData<T>()
|
||||
{
|
||||
var dict = new Dictionary<string, List<Guid>>(2);
|
||||
if (_currentUser.GetRole() == "admin")
|
||||
var currentRole = _currentUser.GetRole();
|
||||
if (currentRole is "admin" or "tenant-admin")
|
||||
{
|
||||
return dict;
|
||||
}
|
||||
|
||||
@@ -82,8 +82,7 @@ public class DevicesController : ControllerBase
|
||||
{
|
||||
return await _deviceConnectService.RegisterAsync(request);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 设备分页
|
||||
/// </summary>
|
||||
@@ -174,16 +173,6 @@ public class DevicesController : ControllerBase
|
||||
return await _deviceService.GetDeviceNumberAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取考勤设备详情列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("attendancestotal")]
|
||||
public async Task<Pagination<DevicePageResponse>> GetAttendanceTotalAsync([FromQuery] AttendanceTotalRequest request)
|
||||
{
|
||||
return await _deviceService.GetAttendanceTotalAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取考勤在线/离线设备详情列表
|
||||
/// </summary>
|
||||
@@ -194,16 +183,6 @@ public class DevicesController : ControllerBase
|
||||
return await _deviceService.GetOnlineStatusPageAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取近期30天考勤新增设备数
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("recentnumbers")]
|
||||
public async Task<List<RecentNumberResponse>> GetRecentNumbersAsync()
|
||||
{
|
||||
return await _deviceService.GetRecentNumbersAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量导入设备信息
|
||||
/// </summary>
|
||||
|
||||
@@ -16,12 +16,8 @@ public interface IDeviceService : IScopeDependency
|
||||
|
||||
Task<DeviceNumberResponse> GetDeviceNumberAsync();
|
||||
|
||||
Task<Pagination<DevicePageResponse>> GetAttendanceTotalAsync(AttendanceTotalRequest request);
|
||||
|
||||
Task<Pagination<DevicePageResponse>> GetOnlineStatusPageAsync(DeviceOnlineAndOfflineRequest request);
|
||||
|
||||
Task<List<RecentNumberResponse>> GetRecentNumbersAsync();
|
||||
|
||||
Task ImportAsync(List<DeviceImportRequest> request);
|
||||
|
||||
|
||||
|
||||
@@ -341,58 +341,13 @@ public class DeviceService : IDeviceService
|
||||
var list = devices.Where(x => offUniqueNos.Contains(x.UniqueNo)).ToList();
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
public async Task<Pagination<DevicePageResponse>> GetAttendanceTotalAsync(AttendanceTotalRequest request)
|
||||
{
|
||||
var page = await _dbContext.Queryable<DeviceEntity>()
|
||||
.LeftJoin<DeviceTemplateEntity>((d, dt) => d.TemplateCode == dt.Code)
|
||||
.Where(d => d.Type == DeviceTypeEnumType.Attendance || (d.Type == DeviceTypeEnumType.Door && d.AsAttendance))
|
||||
.Select((d, dt) => new DevicePageResponse
|
||||
{
|
||||
FuncsStr = d.Funcs.ToString(),
|
||||
Brand = dt.Brand,
|
||||
Type = d.Type,
|
||||
}, true)
|
||||
.ToPageListAsync(request);
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
public async Task<Pagination<DevicePageResponse>> GetOnlineStatusPageAsync(DeviceOnlineAndOfflineRequest request)
|
||||
{
|
||||
return await GetDeviceStatusPageAsync(request.IsOnline, request, request.Type);
|
||||
}
|
||||
|
||||
public async Task<List<RecentNumberResponse>> GetRecentNumbersAsync()
|
||||
{
|
||||
//获取近30天并转化为"yyyy-MM-dd"集合
|
||||
DateTime currentDate = DateTime.Now;
|
||||
var times = new List<string>();
|
||||
for (int i = 0; i < 30; i++)
|
||||
{
|
||||
DateTime date = currentDate.AddDays(-i);
|
||||
string dateString = date.ToString("yyyy-MM-dd");
|
||||
times.Add(dateString);
|
||||
}
|
||||
|
||||
var devices = await _dbContext.Queryable<DeviceEntity>().Where(x => x.Type == DeviceTypeEnumType.Attendance || (x.Type == DeviceTypeEnumType.Door && x.AsAttendance)).ToListAsync();
|
||||
|
||||
var list = new List<RecentNumberResponse>();
|
||||
times.ForEach(time =>
|
||||
{
|
||||
var count = devices.Count(x => x.CreateTime.ToString("yyyy-MM-dd") == time);
|
||||
var res = new RecentNumberResponse
|
||||
{
|
||||
Date = time,
|
||||
Num = count,
|
||||
};
|
||||
list.Add(res);
|
||||
});
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
//************************************************************* help methods ************************************************************************
|
||||
|
||||
private async Task<Pagination<DevicePageResponse>> GetDeviceStatusPageAsync(bool isOnline, PageDto pageDto, DeviceTypeEnumType type)
|
||||
|
||||
Reference in New Issue
Block a user