diff --git a/Src/Dlhis.Basic/Device/Controllers/DeviceGroupsController.cs b/Src/Dlhis.Basic/Device/Controllers/DeviceGroupsController.cs
index bba3ae80..c05c41ba 100644
--- a/Src/Dlhis.Basic/Device/Controllers/DeviceGroupsController.cs
+++ b/Src/Dlhis.Basic/Device/Controllers/DeviceGroupsController.cs
@@ -1,6 +1,7 @@
using Dlhis.Basic.Device.Request;
using Dlhis.Basic.Device.Response;
using Dlhis.Basic.Device.Services;
+using Dlhis.Entity.Device.Enums;
using Kurisu.Core.DataAccess.Dto;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
@@ -37,11 +38,12 @@ public class DeviceGroupsController : ControllerBase
/// 获取设备组树
///
/// 是否显示设备
+ /// 分组类型
///
[HttpGet("tree")]
- public async Task> GetTreeAsync(bool showDevices)
+ public async Task> GetTreeAsync(bool showDevices, DeviceTypeEnumType? type)
{
- return await _deviceGroupService.GetTreeAsync(showDevices);
+ return await _deviceGroupService.GetTreeAsync(showDevices, type);
}
///
diff --git a/Src/Dlhis.Basic/Device/Request/DeviceGroupPageRequest.cs b/Src/Dlhis.Basic/Device/Request/DeviceGroupPageRequest.cs
index 419810f2..aee1a3d9 100644
--- a/Src/Dlhis.Basic/Device/Request/DeviceGroupPageRequest.cs
+++ b/Src/Dlhis.Basic/Device/Request/DeviceGroupPageRequest.cs
@@ -1,7 +1,12 @@
-using Kurisu.Core.DataAccess.Dto;
+using Dlhis.Entity.Device.Enums;
+using Kurisu.Core.DataAccess.Dto;
namespace Dlhis.Basic.Device.Request;
public class DeviceGroupPageRequest : PageDto
{
+ ///
+ /// 分组类型
+ ///
+ public DeviceTypeEnumType? Type { get; set; }
}
diff --git a/Src/Dlhis.Basic/Device/Request/DeviceGroupSaveRequest.cs b/Src/Dlhis.Basic/Device/Request/DeviceGroupSaveRequest.cs
index 35240dac..9cbf1ee9 100644
--- a/Src/Dlhis.Basic/Device/Request/DeviceGroupSaveRequest.cs
+++ b/Src/Dlhis.Basic/Device/Request/DeviceGroupSaveRequest.cs
@@ -21,7 +21,6 @@ public class DeviceGroupSaveRequest
///
/// 分类类型 DeviceTypeEnumType
///
- [Required(ErrorMessage = "分类不能为空")]
[EnumDataType(typeof(DeviceTypeEnumType))]
- public DeviceTypeEnumType Type { get; set; }
+ public DeviceTypeEnumType? Type { get; set; }
}
diff --git a/Src/Dlhis.Basic/Device/Request/DeviceSaveRequest.cs b/Src/Dlhis.Basic/Device/Request/DeviceSaveRequest.cs
index 10b3a65b..96bd0278 100644
--- a/Src/Dlhis.Basic/Device/Request/DeviceSaveRequest.cs
+++ b/Src/Dlhis.Basic/Device/Request/DeviceSaveRequest.cs
@@ -1,9 +1,10 @@
using System.ComponentModel.DataAnnotations;
using Dlhis.Entity.Device.Enums;
+using Kurisu.AspNetCore.Utils.Extensions;
namespace Dlhis.Basic.Device.Request;
-public class DeviceSaveRequest
+public class DeviceSaveRequest : IValidatableObject
{
public long? Id { get; set; }
@@ -70,4 +71,17 @@ public class DeviceSaveRequest
/// 是否启用
///
public bool Enable { get; set; }
+
+ ///
+ /// 是否作为考勤设备
+ ///
+ public bool AsAttendance { get; set; }
+
+ public IEnumerable Validate(ValidationContext validationContext)
+ {
+ if (Type != DeviceTypeEnumType.Door && AsAttendance)
+ {
+ yield return new ValidationResult($"{DeviceTypeEnumType.Door.GetDescription()}才可设置作为考勤设备", new[] { nameof(AsAttendance) });
+ }
+ }
}
diff --git a/Src/Dlhis.Basic/Device/Response/DeviceGroupPageResponse.cs b/Src/Dlhis.Basic/Device/Response/DeviceGroupPageResponse.cs
index 446557ed..8d81e4a4 100644
--- a/Src/Dlhis.Basic/Device/Response/DeviceGroupPageResponse.cs
+++ b/Src/Dlhis.Basic/Device/Response/DeviceGroupPageResponse.cs
@@ -1,4 +1,7 @@
-namespace Dlhis.Basic.Device.Response;
+using Dlhis.Entity.Device.Enums;
+using Kurisu.AspNetCore.Utils.Extensions;
+
+namespace Dlhis.Basic.Device.Response;
public class DeviceGroupPageResponse
{
@@ -11,4 +14,25 @@ public class DeviceGroupPageResponse
/// 设备组名称
///
public string Name { get; set; }
+
+ ///
+ /// 分组类型
+ ///
+ public DeviceTypeEnumType? Type { get; set; }
+
+ ///
+ /// 分组类型描述
+ ///
+ public string TypeDesc
+ {
+ get
+ {
+ if (!Type.HasValue)
+ {
+ return string.Empty;
+ }
+
+ return Type.Value.GetDescription();
+ }
+ }
}
diff --git a/Src/Dlhis.Basic/Device/Response/DeviceUnderGroupResponse.cs b/Src/Dlhis.Basic/Device/Response/DeviceUnderGroupResponse.cs
index 806a7d9b..c9d59404 100644
--- a/Src/Dlhis.Basic/Device/Response/DeviceUnderGroupResponse.cs
+++ b/Src/Dlhis.Basic/Device/Response/DeviceUnderGroupResponse.cs
@@ -1,4 +1,6 @@
-namespace Dlhis.Basic.Device.Response;
+using Dlhis.Entity.Device.Enums;
+
+namespace Dlhis.Basic.Device.Response;
public class DeviceUnderGroupResponse
{
@@ -14,6 +16,12 @@ public class DeviceUnderGroupResponse
///
public string Brand { get; set; }
+ ///
+ /// 设备类型
+ ///
+ public DeviceTypeEnumType Type { get; set; }
+
+
///
/// 是否启用
///
diff --git a/Src/Dlhis.Basic/Device/Services/IDeviceGroupService.cs b/Src/Dlhis.Basic/Device/Services/IDeviceGroupService.cs
index e759376e..13368b4f 100644
--- a/Src/Dlhis.Basic/Device/Services/IDeviceGroupService.cs
+++ b/Src/Dlhis.Basic/Device/Services/IDeviceGroupService.cs
@@ -1,5 +1,6 @@
using Dlhis.Basic.Device.Request;
using Dlhis.Basic.Device.Response;
+using Dlhis.Entity.Device.Enums;
using Kurisu.Core.DataAccess.Dto;
namespace Dlhis.Basic.Device.Services;
@@ -8,7 +9,7 @@ public interface IDeviceGroupService : IScopeDependency
{
Task> GetPageAsync(DeviceGroupPageRequest request);
- Task> GetTreeAsync(bool showDevices);
+ Task> GetTreeAsync(bool showDevices, DeviceTypeEnumType? type);
Task SaveAsync(DeviceGroupSaveRequest request);
diff --git a/Src/Dlhis.Basic/Device/Services/Implements/DeviceGroupService.cs b/Src/Dlhis.Basic/Device/Services/Implements/DeviceGroupService.cs
index 3047dc21..04722357 100644
--- a/Src/Dlhis.Basic/Device/Services/Implements/DeviceGroupService.cs
+++ b/Src/Dlhis.Basic/Device/Services/Implements/DeviceGroupService.cs
@@ -2,6 +2,7 @@
using Dlhis.Basic.Device.Response;
using Dlhis.Entity.Basic.Entity;
using Dlhis.Entity.Device.Entities;
+using Dlhis.Entity.Device.Enums;
using Kurisu.AspNetCore.Utils.Extensions;
using Kurisu.Core.DataAccess.Dto;
using Kurisu.SqlSugar.Attributes;
@@ -26,13 +27,15 @@ public class DeviceGroupService : IDeviceGroupService
{
return await _dbContext.Queryable()
.WhereIF(request.Search.IsPresent(), x => x.Name.Contains(request.Search))
+ .WhereIF(request.Type.HasValue, x => x.Type == request.Type)
.Select()
.ToPageListAsync(request);
}
- public async Task> GetTreeAsync(bool showDevices)
+ public async Task> GetTreeAsync(bool showDevices, DeviceTypeEnumType? type)
{
var deviceGroups = await _dbContext.Queryable()
+ .WhereIF(type.HasValue, x => x.Type == type)
.Select()
.ToListAsync();
@@ -61,6 +64,18 @@ public class DeviceGroupService : IDeviceGroupService
{
var entity = await _dbContext.Queryable().Where(x => x.Id == request.Id).FirstAsync();
entity.ThrowIfNull("设备组不存在,无法更新");
+
+ var nextDevices = await GetDevicesAsync(entity.Code);
+ if (!entity.Type.HasValue)
+ {
+ (request.Type.HasValue && nextDevices.Any(x => x.Type != request.Type)).ThrowIfTrue($"分组设备存在非{request.Type.Value.GetDescription()}类型的设备设备");
+ }
+ else
+ {
+ (request.Type.HasValue && request.Type != entity.Type && nextDevices.Any()).ThrowIfTrue("分组设备类型不匹配,无法修改类型");
+ }
+
+
await _dbContext.UpdateAsync(entity);
}
}
@@ -73,6 +88,7 @@ public class DeviceGroupService : IDeviceGroupService
await _dbContext.DeleteAsync(deviceGroup);
}
+
[Transactional]
public async Task AssignDevicesAsync(DeviceAssignRequest request)
{
diff --git a/Src/Dlhis.Basic/Organization/Controllers/GainfosController.cs b/Src/Dlhis.Basic/Organization/Controllers/GainfosController.cs
index b6c09d43..33e9307f 100644
--- a/Src/Dlhis.Basic/Organization/Controllers/GainfosController.cs
+++ b/Src/Dlhis.Basic/Organization/Controllers/GainfosController.cs
@@ -2,12 +2,10 @@
using Dlhis.Basic.Organization.Request;
using Dlhis.Basic.Organization.Response;
using Dlhis.Basic.Organization.Services;
-using Dlhis.Entity.Basic.Entity;
using Kurisu.AspNetCore.MVC;
using Kurisu.Core.DataAccess.Dto;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
-using Org.BouncyCastle.Asn1.Ocsp;
namespace Dlhis.Basic.MealUser.Controllers;
@@ -142,7 +140,7 @@ public class GainfosController : ControllerBase
///
///
///
- [HttpGet("gainfolist")]
+ [HttpGet("list")]
public async Task> GetGainfoListTaskAsync([FromQuery]GainfoListRequest request)
{
return await _gainfoService.GetGainfoListTaskAsync(request);
@@ -152,7 +150,7 @@ public class GainfosController : ControllerBase
///
///
///
- [HttpGet("gainfodetail")]
+ [HttpGet("detail")]
public async Task GetGainfoDetailTaskAsync([FromQuery] GainfoDetailRequest request)
{
return await _gainfoService.GetGainfoDetailTaskAsync(request);
diff --git a/Src/Dlhis.Basic/Organization/Response/GainfoPageResponse.cs b/Src/Dlhis.Basic/Organization/Response/GainfoPageResponse.cs
index df112cee..cb3c563c 100644
--- a/Src/Dlhis.Basic/Organization/Response/GainfoPageResponse.cs
+++ b/Src/Dlhis.Basic/Organization/Response/GainfoPageResponse.cs
@@ -1,4 +1,7 @@
-namespace Dlhis.Basic.Organization.Response;
+using Dlhis.Entity.Basic.Enums;
+using Kurisu.AspNetCore.Utils.Extensions;
+
+namespace Dlhis.Basic.Organization.Response;
public class GainfoPageResponse
{
@@ -52,7 +55,8 @@ public class GainfoPageResponse
///
/// 性别
///
- public string Gender { get; set; }
+ public GenderEnumType Gender { get; set; }
+ public string GenderDesc => Gender.GetDescription();
///
/// 生日
diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs
index ce14552e..78753d46 100644
--- a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs
+++ b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs
@@ -53,9 +53,9 @@ public class GainfoService : IGainfoService
var tenant = _currentUser.GetStringTenantId();
var page = await _gainfoStore.Queryable(request.Status)
- .WhereIF(request.DepartmentNos?.Any() == true, gainfo => request.DepartmentNos.Contains(gainfo.DepartmentNo))
+ .WhereIF(request.DepartmentNos.IsPresent(), gainfo => request.DepartmentNos.Contains(gainfo.DepartmentNo))
.WhereIF(request.Search.IsPresent(), gainfo =>
- gainfo.Name.Contains(request.Search)
+ gainfo.Name.Contains(request.Search)
|| gainfo.Code.Contains(request.Search))
.Where(gainfo => gainfo.Werks == tenant)
.Select()
@@ -561,7 +561,7 @@ public class GainfoService : IGainfoService
///
private async Task> GetRecursionDepartmentNosAsync(List departmentNos)
{
- if (departmentNos == null || departmentNos.Count == 0)
+ if (departmentNos.IsEmpty())
{
return new List();
}
diff --git a/Src/Dlhis.Basic/Packs/SqlSugarPack.cs b/Src/Dlhis.Basic/Packs/SqlSugarPack.cs
index f481ce85..d4467cae 100644
--- a/Src/Dlhis.Basic/Packs/SqlSugarPack.cs
+++ b/Src/Dlhis.Basic/Packs/SqlSugarPack.cs
@@ -17,14 +17,14 @@ public class SqlSugarPack : BaseAppPack
public override void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
- //using var scope = app.ApplicationServices.CreateScope();
- //var db = scope.ServiceProvider.GetService();
- //var tables = App.ActiveTyps.Where(x => x.IsDefined(typeof(SugarTable), false))
- // .Where(x => !x.IsDefined(typeof(SkipScanAttribute), false))
- // .ToArray();
+ using var scope = app.ApplicationServices.CreateScope();
+ var db = scope.ServiceProvider.GetService();
+ var tables = App.ActiveTyps.Where(x => x.IsDefined(typeof(SugarTable), false))
+ .Where(x => !x.IsDefined(typeof(SkipScanAttribute), false))
+ .ToArray();
- //db.DbMaintenance.CreateDatabase();
- //db.CodeFirst.InitTables(tables);
+ db.DbMaintenance.CreateDatabase();
+ db.CodeFirst.InitTables(tables);
//using var scopeFace = app.ApplicationServices.CreateScope();
//var dbFace = scopeFace.ServiceProvider.GetService();
diff --git a/Src/Dlhis.Entity/Basic/Entity/DeviceEntity.cs b/Src/Dlhis.Entity/Basic/Entity/DeviceEntity.cs
index 6c24630f..6bde31c3 100644
--- a/Src/Dlhis.Entity/Basic/Entity/DeviceEntity.cs
+++ b/Src/Dlhis.Entity/Basic/Entity/DeviceEntity.cs
@@ -84,5 +84,12 @@ public class DeviceEntity : SugarBaseEntity, ITenantId
[SugarColumn(ColumnDataType = "bit", ColumnDescription = "是否启用")]
public bool Enable { get; set; }
+
+ ///
+ /// 是否作为考勤设备
+ ///
+ [SugarColumn(ColumnDataType = "bit", ColumnDescription = "是否作为考勤设备")]
+ public bool AsAttendance { get; set; }
+
public string TenantId { get; set; }
}
\ No newline at end of file
diff --git a/Src/Dlhis.Entity/Basic/Entity/GainfoGroupEntity.cs b/Src/Dlhis.Entity/Basic/Entity/GainfoGroupEntity.cs
index 2243b9e5..b7e533c0 100644
--- a/Src/Dlhis.Entity/Basic/Entity/GainfoGroupEntity.cs
+++ b/Src/Dlhis.Entity/Basic/Entity/GainfoGroupEntity.cs
@@ -1,4 +1,5 @@
-using Kurisu.SqlSugar;
+using Kurisu.Core.DataAccess.Entity;
+using Kurisu.SqlSugar;
using SqlSugar;
namespace Dlhis.Entity.Basic.Entity;
@@ -7,8 +8,13 @@ namespace Dlhis.Entity.Basic.Entity;
/// 档案组
///
[SugarTable(TableName = "GainfoGroup", TableDescription = "档案组")]
-public class GainfoGroupEntity : SugarBaseEntity
+public class GainfoGroupEntity : SugarBaseEntity, ITenantId
{
+ ///
+ /// 父级Code
+ ///
+ public Guid? PCode { get; set; }
+
///
/// 分组code
///
@@ -26,4 +32,19 @@ public class GainfoGroupEntity : SugarBaseEntity
///
[SugarColumn(ColumnDescription = "备注")]
public string Remark { get; set; }
+
+ ///
+ /// 是否默认分组
+ ///
+ [SugarColumn(ColumnDescription = "是否默认分组")]
+ public bool IsDefault { get; set; }
+
+ ///
+ /// 是否可编辑
+ ///
+ [SugarColumn(ColumnDescription = "是否可编辑")]
+ public bool Editable { get; set; }
+
+
+ public string TenantId { get; set; }
}
diff --git a/Src/Dlhis.Entity/Device/Entities/DeviceGroupEntity.cs b/Src/Dlhis.Entity/Device/Entities/DeviceGroupEntity.cs
index 3c06d72e..6d037b6a 100644
--- a/Src/Dlhis.Entity/Device/Entities/DeviceGroupEntity.cs
+++ b/Src/Dlhis.Entity/Device/Entities/DeviceGroupEntity.cs
@@ -12,7 +12,6 @@ namespace Dlhis.Entity.Device.Entities;
[SugarTable(TableName = "DeviceGroup", TableDescription = "设备组")]
public class DeviceGroupEntity : SugarBaseEntity, ITenantId, ISoftDeleted
{
-
///
/// 设备组功能类型
///
diff --git a/Src/Dlhis.Entity/Device/Enums/DeviceTypeEnumType.cs b/Src/Dlhis.Entity/Device/Enums/DeviceTypeEnumType.cs
index 230e6e17..48c2ec70 100644
--- a/Src/Dlhis.Entity/Device/Enums/DeviceTypeEnumType.cs
+++ b/Src/Dlhis.Entity/Device/Enums/DeviceTypeEnumType.cs
@@ -25,10 +25,4 @@ public enum DeviceTypeEnumType
///
[Description("考勤")]
Attendance = 3,
-
- ///
- /// 门禁并作为考勤
- ///
- [Description("门禁并作为考勤")]
- DoorAndAttendance = 4,
}
diff --git a/Src/Dlhis.ScheduledTask/CommonJobs/CreateDefinitelyGroupJob.cs b/Src/Dlhis.ScheduledTask/CommonJobs/CreateDefinitelyGroupJob.cs
new file mode 100644
index 00000000..9390c884
--- /dev/null
+++ b/Src/Dlhis.ScheduledTask/CommonJobs/CreateDefinitelyGroupJob.cs
@@ -0,0 +1,163 @@
+using Dlhis.Entity.Basic.Entity;
+using Dlhis.Entity.Device.Entities;
+using Dlhis.Entity.Device.Enums;
+using Dlhis.Sys.Api;
+using Kurisu.Core.DataAccess.Entity;
+using Kurisu.SqlSugar.Services;
+
+namespace Dlhis.ScheduledTask.CommonJobs;
+
+public class CreateDefinitelyGroupJob
+{
+ private readonly ILogger _logger;
+ private readonly ITenantApi _tenantApi;
+ private readonly IDbContext _dbContext;
+
+ public CreateDefinitelyGroupJob(ILogger logger, ITenantApi tenantApi, IDbContext dbContext)
+ {
+ _logger = logger;
+ _tenantApi = tenantApi;
+ _dbContext = dbContext;
+ }
+
+ public async Task RunAsync()
+ {
+ _dbContext.Client.QueryFilter.ClearAndBackup();
+ try
+ {
+ var tenantResult = await _tenantApi.GetTenantsInternalAsync();
+ var tenants = tenantResult.Data;
+
+ foreach (var tenant in tenants)
+ {
+ if (!await _dbContext.Queryable().Where(x => x.TenantId == tenant.Code).AnyAsync(x => x.IsDefault))
+ {
+
+ var customGroup = new GainfoGroupEntity
+ {
+ PCode = null,
+ Code = Guid.NewGuid(),
+ Name = "*自定义人员分组",
+ IsDefault = true,
+ Editable = false,
+
+ CreatedBy = 1,
+ CreateTime = DateTime.Now,
+ ModifiedBy = 1,
+ ModifiedTime = DateTime.Now,
+ TenantId = tenant.Code
+ };
+ await _dbContext.InsertAsync(customGroup);
+
+
+ var groups = new[] { "*督查组", "*X3及以上领导组", "*外派人员组" };
+ foreach (var group in groups)
+ {
+ var grp = new GainfoGroupEntity
+ {
+ PCode = null,
+ Code = Guid.NewGuid(),
+ Name = group,
+ IsDefault = false,
+ Editable = false,
+
+ CreatedBy = 1,
+ CreateTime = DateTime.Now,
+ ModifiedBy = 1,
+ ModifiedTime = DateTime.Now,
+ TenantId = tenant.Code
+ };
+
+ await _dbContext.InsertAsync(grp);
+ }
+ }
+
+ //**************************************************************************************************************/
+
+ if (!await _dbContext.Queryable().Where(x => x.TenantId == tenant.Code).AnyAsync(x => x.Name == "*通用考勤设备组"))
+ {
+ await _dbContext.InsertAsync(new DeviceGroupEntity
+ {
+ PCode = null,
+ Code = Guid.NewGuid(),
+ Type = DeviceTypeEnumType.Attendance,
+ Name = "*通用考勤设备组",
+
+ CreatedBy = 1,
+ CreateTime = DateTime.Now,
+ ModifiedBy = 1,
+ ModifiedTime = DateTime.Now,
+ TenantId = tenant.Code,
+ });
+ }
+
+ if (!await _dbContext.Queryable().Where(x => x.TenantId == tenant.Code).AnyAsync(x => x.Name == "*专用考勤设备组"))
+ {
+ await _dbContext.InsertAsync(new DeviceGroupEntity
+ {
+ PCode = null,
+ Code = Guid.NewGuid(),
+ Type = DeviceTypeEnumType.Attendance,
+ Name = "*专用考勤设备组",
+
+ CreatedBy = 1,
+ CreateTime = DateTime.Now,
+ ModifiedBy = 1,
+ ModifiedTime = DateTime.Now,
+ TenantId = tenant.Code,
+ });
+ }
+
+ //**************************************************************************************************************/
+
+ if (!await _dbContext.Queryable().Where(x => x.TenantId == tenant.Code)
+ .Where(x => x.Type == DeviceTypeEnumType.Door)
+ .AnyAsync(x => x.Name == "*通用考勤设备组")
+ )
+ {
+ await _dbContext.InsertAsync(new DeviceGroupEntity
+ {
+ PCode = null,
+ Code = Guid.NewGuid(),
+ Type = DeviceTypeEnumType.Door,
+ Name = "*非公共区域",
+
+ CreatedBy = 1,
+ CreateTime = DateTime.Now,
+ ModifiedBy = 1,
+ ModifiedTime = DateTime.Now,
+ TenantId = tenant.Code,
+ });
+ }
+
+ if (!await _dbContext.Queryable().Where(x => x.TenantId == tenant.Code)
+ .Where(x => x.Type == DeviceTypeEnumType.Door)
+ .AnyAsync(x => x.Name == "*专用考勤设备组")
+ )
+ {
+ await _dbContext.InsertAsync(new DeviceGroupEntity
+ {
+ PCode = null,
+ Code = Guid.NewGuid(),
+ Type = DeviceTypeEnumType.Door,
+ Name = "*公共区域",
+
+ CreatedBy = 1,
+ CreateTime = DateTime.Now,
+ ModifiedBy = 1,
+ ModifiedTime = DateTime.Now,
+ TenantId = tenant.Code,
+ });
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "自动创建系统分组失败:{message}", ex.Message);
+ }
+ finally
+ {
+ _dbContext.Client.QueryFilter.Restore();
+ }
+ }
+}
diff --git a/Src/Dlhis.ScheduledTask/Packs/JobPack.cs b/Src/Dlhis.ScheduledTask/Packs/JobPack.cs
index 49f75fff..5bccbd46 100644
--- a/Src/Dlhis.ScheduledTask/Packs/JobPack.cs
+++ b/Src/Dlhis.ScheduledTask/Packs/JobPack.cs
@@ -1,4 +1,5 @@
-using Dlhis.ScheduledTask.SyncSapInfo.Job;
+using Dlhis.ScheduledTask.CommonJobs;
+using Dlhis.ScheduledTask.SyncSapInfo.Job;
using Dlhis.ScheduledTask.TaskAssignment.Job;
using Hangfire;
using Kurisu.AspNetCore.Startup;
@@ -23,14 +24,22 @@ public class JobPack : BaseAppPack
TimeZone = TimeZoneInfo.Local
});
+ //创建设备同步时间任务
RecurringJob.AddOrUpdate("SyncServerDateTime", s => s.RunAsync(), "0 0 0/1 * * ?", new RecurringJobOptions
{
TimeZone = TimeZoneInfo.Local
});
+ //创建设备获取考勤的任务
RecurringJob.AddOrUpdate("CreateGetAttendance", s => s.RunAsync(), "0 0/1 * * * ?", new RecurringJobOptions
{
TimeZone = TimeZoneInfo.Local
});
+
+ //创建系统默认分组
+ RecurringJob.AddOrUpdate("CreateDefinitelyGroup", s => s.RunAsync(), "0 0 5 * * ?", new RecurringJobOptions
+ {
+ TimeZone = TimeZoneInfo.Local
+ });
}
}
diff --git a/Src/Dlhis.ScheduledTask/TaskAssignment/Job/CreateGetAttendanceJob.cs b/Src/Dlhis.ScheduledTask/TaskAssignment/Job/CreateGetAttendanceJob.cs
index 90a1703a..2e57474d 100644
--- a/Src/Dlhis.ScheduledTask/TaskAssignment/Job/CreateGetAttendanceJob.cs
+++ b/Src/Dlhis.ScheduledTask/TaskAssignment/Job/CreateGetAttendanceJob.cs
@@ -23,16 +23,19 @@ public class CreateGetAttendanceJob
_dbContext.Client.QueryFilter.ClearAndBackup();
try
{
- var devices = await _dbContext.Queryable().Where(x => x.Enable).ToListAsync();
- devices = devices.Where(x => x.Funcs.Contains(DeviceFuncEnumType.Attendance)).ToList();
+ var devices = await _dbContext.Queryable()
+ .Where(x => x.Enable)
+ .Where(x => x.Type == DeviceTypeEnumType.Attendance || (x.Type == DeviceTypeEnumType.Door && x.AsAttendance))
+ .ToListAsync();
var ds = devices.Select(x => x.UniqueNo).ToList();
- var b = await _dbContext.Queryable()
+ var b = await _dbContext.Queryable()
.Where(x => ds.Contains(x.DeviceUniqueNo))
.Where(x => x.Type == DeviceTaskEnumType.UploadRecord)
.Where(x => x.Status == DeviceTaskStatusEnumType.Process)
.AnyAsync();
+
if (b)
{
return;
diff --git a/Src/Dlhis.Sys/Identity/Controllers/RolesController.cs b/Src/Dlhis.Sys/Identity/Controllers/RolesController.cs
index 8fa618fc..0924f7c3 100644
--- a/Src/Dlhis.Sys/Identity/Controllers/RolesController.cs
+++ b/Src/Dlhis.Sys/Identity/Controllers/RolesController.cs
@@ -34,6 +34,17 @@ public class RolesController : ControllerBase
return await _roleService.GetPageAsync(request);
}
+ ///
+ /// 角色列表
+ ///
+ ///
+ [Authorize(Roles = "admin")]
+ [HttpGet("list")]
+ public async Task> GetListAsync()
+ {
+ return await _roleService.GetListAsync();
+ }
+
///
/// 分配角色
///
diff --git a/Src/Dlhis.Sys/Identity/Response/RoleRespone.cs b/Src/Dlhis.Sys/Identity/Response/RoleRespone.cs
index 0b233448..03cd8c23 100644
--- a/Src/Dlhis.Sys/Identity/Response/RoleRespone.cs
+++ b/Src/Dlhis.Sys/Identity/Response/RoleRespone.cs
@@ -7,4 +7,9 @@ public class RoleRespone
public string Name { get; set; }
public string NormalizedName { get; set; }
+
+ ///
+ /// 是否可编辑
+ ///
+ public bool Editable => Id > 5;
}
diff --git a/Src/Dlhis.Sys/Identity/Response/UserResponse.cs b/Src/Dlhis.Sys/Identity/Response/UserResponse.cs
index d11dec11..45ff5c74 100644
--- a/Src/Dlhis.Sys/Identity/Response/UserResponse.cs
+++ b/Src/Dlhis.Sys/Identity/Response/UserResponse.cs
@@ -4,25 +4,58 @@ public class UserResponse
{
public int Id { get; set; }
+ ///
+ /// 账号名称
+ ///
public string UserName { get; set; }
+ ///
+ /// 规范化账号名称
+ ///
public string NormalizedUserName { get; set; }
+ ///
+ /// 邮件
+ ///
public string Email { get; set; }
+ ///
+ /// 规范化邮件
+ ///
public string NormalizedEmail { get; set; }
+ ///
+ /// 邮件是否已确认
+ ///
public bool EmailConfirmed { get; set; }
+ ///
+ /// 手机号
+ ///
public string PhoneNumber { get; set; }
+ ///
+ /// 手机号是否已确认
+ ///
public bool PhoneNumberConfirmed { get; set; }
+ ///
+ /// 是否开启双因素认证
+ ///
public bool TwoFactorEnabled { get; set; }
+ ///
+ /// 账号锁定结束时间
+ ///
public DateTime? LockoutEnd { get; set; }
+ ///
+ /// 是否开启账号锁定功能
+ ///
public bool LockoutEnabled { get; set; }
+ ///
+ /// 登陆失败次数
+ ///
public int AccessFailedCount { get; set; }
}
diff --git a/Src/Dlhis.Sys/Identity/Services/IRoleService.cs b/Src/Dlhis.Sys/Identity/Services/IRoleService.cs
index eb101cc1..3b789429 100644
--- a/Src/Dlhis.Sys/Identity/Services/IRoleService.cs
+++ b/Src/Dlhis.Sys/Identity/Services/IRoleService.cs
@@ -8,6 +8,8 @@ public interface IRoleService : IScopeDependency
{
Task> GetPageAsync(RolePageRequest request);
+ Task> GetListAsync();
+
Task SaveRoleAsync(RoleSaveRequest request);
Task GetMyRoleAsync();
diff --git a/Src/Dlhis.Sys/Identity/Services/Implements/RoleService.cs b/Src/Dlhis.Sys/Identity/Services/Implements/RoleService.cs
index 399b1d7f..38cd025a 100644
--- a/Src/Dlhis.Sys/Identity/Services/Implements/RoleService.cs
+++ b/Src/Dlhis.Sys/Identity/Services/Implements/RoleService.cs
@@ -9,6 +9,7 @@ using Kurisu.Core.DataAccess.Dto;
using Kurisu.Core.User.Abstractions;
using Kurisu.SqlSugar.Extensions;
using Kurisu.SqlSugar.Services;
+using Org.BouncyCastle.Asn1.Ocsp;
namespace Dlhis.Sys.Identity.Services.Implements;
@@ -172,4 +173,19 @@ public class RoleService : IRoleService
await dbContext.DeleteReallyAsync(role);
});
}
+
+ public async Task> GetListAsync()
+ {
+ return await Scoped.Request.Value.CreateAsync(async sp =>
+ {
+ var dbContext = sp.GetService();
+ var identityConnection = _configuration.GetSection("SqlSugarOptions:IdentityConnectionString").Value;
+ dbContext.Client.CurrentConnectionConfig.ConnectionString = identityConnection;
+
+
+ return await dbContext.Queryable()
+ .Select()
+ .ToListAsync();
+ });
+ }
}