Merge branch 'development' of https://git.dlhis.com/liguoyang/jinko.yikatong into development
This commit is contained in:
@@ -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
|
||||
/// 获取设备组树
|
||||
/// </summary>
|
||||
/// <param name="showDevices">是否显示设备</param>
|
||||
/// <param name="type">分组类型</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("tree")]
|
||||
public async Task<List<DeviceGroupTreeResponse>> GetTreeAsync(bool showDevices)
|
||||
public async Task<List<DeviceGroupTreeResponse>> GetTreeAsync(bool showDevices, DeviceTypeEnumType? type)
|
||||
{
|
||||
return await _deviceGroupService.GetTreeAsync(showDevices);
|
||||
return await _deviceGroupService.GetTreeAsync(showDevices, type);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 分组类型
|
||||
/// </summary>
|
||||
public DeviceTypeEnumType? Type { get; set; }
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ public class DeviceGroupSaveRequest
|
||||
/// <summary>
|
||||
/// 分类类型 DeviceTypeEnumType
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "分类不能为空")]
|
||||
[EnumDataType(typeof(DeviceTypeEnumType))]
|
||||
public DeviceTypeEnumType Type { get; set; }
|
||||
public DeviceTypeEnumType? Type { get; set; }
|
||||
}
|
||||
|
||||
@@ -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
|
||||
/// 是否启用
|
||||
/// </summary>
|
||||
public bool Enable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否作为考勤设备
|
||||
/// </summary>
|
||||
public bool AsAttendance { get; set; }
|
||||
|
||||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
||||
{
|
||||
if (Type != DeviceTypeEnumType.Door && AsAttendance)
|
||||
{
|
||||
yield return new ValidationResult($"{DeviceTypeEnumType.Door.GetDescription()}才可设置作为考勤设备", new[] { nameof(AsAttendance) });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
/// 设备组名称
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分组类型
|
||||
/// </summary>
|
||||
public DeviceTypeEnumType? Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分组类型描述
|
||||
/// </summary>
|
||||
public string TypeDesc
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!Type.HasValue)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
return Type.Value.GetDescription();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
/// </summary>
|
||||
public string Brand { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备类型
|
||||
/// </summary>
|
||||
public DeviceTypeEnumType Type { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用
|
||||
/// </summary>
|
||||
|
||||
@@ -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<Pagination<DeviceGroupPageResponse>> GetPageAsync(DeviceGroupPageRequest request);
|
||||
|
||||
Task<List<DeviceGroupTreeResponse>> GetTreeAsync(bool showDevices);
|
||||
Task<List<DeviceGroupTreeResponse>> GetTreeAsync(bool showDevices, DeviceTypeEnumType? type);
|
||||
|
||||
Task SaveAsync(DeviceGroupSaveRequest request);
|
||||
|
||||
|
||||
@@ -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<DeviceGroupEntity>()
|
||||
.WhereIF(request.Search.IsPresent(), x => x.Name.Contains(request.Search))
|
||||
.WhereIF(request.Type.HasValue, x => x.Type == request.Type)
|
||||
.Select<DeviceGroupPageResponse>()
|
||||
.ToPageListAsync(request);
|
||||
}
|
||||
|
||||
public async Task<List<DeviceGroupTreeResponse>> GetTreeAsync(bool showDevices)
|
||||
public async Task<List<DeviceGroupTreeResponse>> GetTreeAsync(bool showDevices, DeviceTypeEnumType? type)
|
||||
{
|
||||
var deviceGroups = await _dbContext.Queryable<DeviceGroupEntity>()
|
||||
.WhereIF(type.HasValue, x => x.Type == type)
|
||||
.Select<DeviceGroupTreeResponse>()
|
||||
.ToListAsync();
|
||||
|
||||
@@ -61,6 +64,18 @@ public class DeviceGroupService : IDeviceGroupService
|
||||
{
|
||||
var entity = await _dbContext.Queryable<DeviceGroupEntity>().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)
|
||||
{
|
||||
|
||||
@@ -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
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("gainfolist")]
|
||||
[HttpGet("list")]
|
||||
public async Task<Pagination<GainfoListResponse>> GetGainfoListTaskAsync([FromQuery]GainfoListRequest request)
|
||||
{
|
||||
return await _gainfoService.GetGainfoListTaskAsync(request);
|
||||
@@ -152,7 +150,7 @@ public class GainfosController : ControllerBase
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("gainfodetail")]
|
||||
[HttpGet("detail")]
|
||||
public async Task<GainfoDetailResponse> GetGainfoDetailTaskAsync([FromQuery] GainfoDetailRequest request)
|
||||
{
|
||||
return await _gainfoService.GetGainfoDetailTaskAsync(request);
|
||||
|
||||
@@ -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
|
||||
/// <summary>
|
||||
/// 性别
|
||||
/// </summary>
|
||||
public string Gender { get; set; }
|
||||
public GenderEnumType Gender { get; set; }
|
||||
public string GenderDesc => Gender.GetDescription();
|
||||
|
||||
/// <summary>
|
||||
/// 生日
|
||||
|
||||
@@ -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<GainfoPageResponse>()
|
||||
@@ -561,7 +561,7 @@ public class GainfoService : IGainfoService
|
||||
/// <returns></returns>
|
||||
private async Task<List<string>> GetRecursionDepartmentNosAsync(List<string> departmentNos)
|
||||
{
|
||||
if (departmentNos == null || departmentNos.Count == 0)
|
||||
if (departmentNos.IsEmpty())
|
||||
{
|
||||
return new List<string>();
|
||||
}
|
||||
|
||||
@@ -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<ISqlSugarClient>();
|
||||
//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<ISqlSugarClient>();
|
||||
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<ISqlSugarClient>();
|
||||
|
||||
@@ -84,5 +84,12 @@ public class DeviceEntity : SugarBaseEntity, ITenantId
|
||||
[SugarColumn(ColumnDataType = "bit", ColumnDescription = "是否启用")]
|
||||
public bool Enable { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否作为考勤设备
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDataType = "bit", ColumnDescription = "是否作为考勤设备")]
|
||||
public bool AsAttendance { get; set; }
|
||||
|
||||
public string TenantId { get; set; }
|
||||
}
|
||||
@@ -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;
|
||||
/// 档案组
|
||||
/// </summary>
|
||||
[SugarTable(TableName = "GainfoGroup", TableDescription = "档案组")]
|
||||
public class GainfoGroupEntity : SugarBaseEntity
|
||||
public class GainfoGroupEntity : SugarBaseEntity, ITenantId
|
||||
{
|
||||
/// <summary>
|
||||
/// 父级Code
|
||||
/// </summary>
|
||||
public Guid? PCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分组code
|
||||
/// </summary>
|
||||
@@ -26,4 +32,19 @@ public class GainfoGroupEntity : SugarBaseEntity
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "备注")]
|
||||
public string Remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否默认分组
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "是否默认分组")]
|
||||
public bool IsDefault { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否可编辑
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "是否可编辑")]
|
||||
public bool Editable { get; set; }
|
||||
|
||||
|
||||
public string TenantId { get; set; }
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ namespace Dlhis.Entity.Device.Entities;
|
||||
[SugarTable(TableName = "DeviceGroup", TableDescription = "设备组")]
|
||||
public class DeviceGroupEntity : SugarBaseEntity, ITenantId, ISoftDeleted
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 设备组功能类型
|
||||
/// </summary>
|
||||
|
||||
@@ -25,10 +25,4 @@ public enum DeviceTypeEnumType
|
||||
/// </summary>
|
||||
[Description("考勤")]
|
||||
Attendance = 3,
|
||||
|
||||
/// <summary>
|
||||
/// 门禁并作为考勤
|
||||
/// </summary>
|
||||
[Description("门禁并作为考勤")]
|
||||
DoorAndAttendance = 4,
|
||||
}
|
||||
|
||||
163
Src/Dlhis.ScheduledTask/CommonJobs/CreateDefinitelyGroupJob.cs
Normal file
163
Src/Dlhis.ScheduledTask/CommonJobs/CreateDefinitelyGroupJob.cs
Normal file
@@ -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<CreateDefinitelyGroupJob> _logger;
|
||||
private readonly ITenantApi _tenantApi;
|
||||
private readonly IDbContext _dbContext;
|
||||
|
||||
public CreateDefinitelyGroupJob(ILogger<CreateDefinitelyGroupJob> logger, ITenantApi tenantApi, IDbContext dbContext)
|
||||
{
|
||||
_logger = logger;
|
||||
_tenantApi = tenantApi;
|
||||
_dbContext = dbContext;
|
||||
}
|
||||
|
||||
public async Task RunAsync()
|
||||
{
|
||||
_dbContext.Client.QueryFilter.ClearAndBackup<ITenantId>();
|
||||
try
|
||||
{
|
||||
var tenantResult = await _tenantApi.GetTenantsInternalAsync();
|
||||
var tenants = tenantResult.Data;
|
||||
|
||||
foreach (var tenant in tenants)
|
||||
{
|
||||
if (!await _dbContext.Queryable<GainfoGroupEntity>().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<DeviceGroupEntity>().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<DeviceGroupEntity>().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<DeviceGroupEntity>().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<DeviceGroupEntity>().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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<CreateSyncServerDateTimeJob>("SyncServerDateTime", s => s.RunAsync(), "0 0 0/1 * * ?", new RecurringJobOptions
|
||||
{
|
||||
TimeZone = TimeZoneInfo.Local
|
||||
});
|
||||
|
||||
//创建设备获取考勤的任务
|
||||
RecurringJob.AddOrUpdate<CreateGetAttendanceJob>("CreateGetAttendance", s => s.RunAsync(), "0 0/1 * * * ?", new RecurringJobOptions
|
||||
{
|
||||
TimeZone = TimeZoneInfo.Local
|
||||
});
|
||||
|
||||
//创建系统默认分组
|
||||
RecurringJob.AddOrUpdate<CreateDefinitelyGroupJob>("CreateDefinitelyGroup", s => s.RunAsync(), "0 0 5 * * ?", new RecurringJobOptions
|
||||
{
|
||||
TimeZone = TimeZoneInfo.Local
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,16 +23,19 @@ public class CreateGetAttendanceJob
|
||||
_dbContext.Client.QueryFilter.ClearAndBackup<ITenantId>();
|
||||
try
|
||||
{
|
||||
var devices = await _dbContext.Queryable<DeviceEntity>().Where(x => x.Enable).ToListAsync();
|
||||
devices = devices.Where(x => x.Funcs.Contains(DeviceFuncEnumType.Attendance)).ToList();
|
||||
var devices = await _dbContext.Queryable<DeviceEntity>()
|
||||
.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<DeviceTaskEntity>()
|
||||
var b = await _dbContext.Queryable<DeviceTaskEntity>()
|
||||
.Where(x => ds.Contains(x.DeviceUniqueNo))
|
||||
.Where(x => x.Type == DeviceTaskEnumType.UploadRecord)
|
||||
.Where(x => x.Status == DeviceTaskStatusEnumType.Process)
|
||||
.AnyAsync();
|
||||
|
||||
if (b)
|
||||
{
|
||||
return;
|
||||
|
||||
@@ -34,6 +34,17 @@ public class RolesController : ControllerBase
|
||||
return await _roleService.GetPageAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 角色列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[Authorize(Roles = "admin")]
|
||||
[HttpGet("list")]
|
||||
public async Task<List<RoleRespone>> GetListAsync()
|
||||
{
|
||||
return await _roleService.GetListAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 分配角色
|
||||
/// </summary>
|
||||
|
||||
@@ -7,4 +7,9 @@ public class RoleRespone
|
||||
public string Name { get; set; }
|
||||
|
||||
public string NormalizedName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否可编辑
|
||||
/// </summary>
|
||||
public bool Editable => Id > 5;
|
||||
}
|
||||
|
||||
@@ -4,25 +4,58 @@ public class UserResponse
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 账号名称
|
||||
/// </summary>
|
||||
public string UserName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 规范化账号名称
|
||||
/// </summary>
|
||||
public string NormalizedUserName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 邮件
|
||||
/// </summary>
|
||||
public string Email { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 规范化邮件
|
||||
/// </summary>
|
||||
public string NormalizedEmail { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 邮件是否已确认
|
||||
/// </summary>
|
||||
public bool EmailConfirmed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 手机号
|
||||
/// </summary>
|
||||
public string PhoneNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 手机号是否已确认
|
||||
/// </summary>
|
||||
public bool PhoneNumberConfirmed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否开启双因素认证
|
||||
/// </summary>
|
||||
public bool TwoFactorEnabled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 账号锁定结束时间
|
||||
/// </summary>
|
||||
public DateTime? LockoutEnd { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否开启账号锁定功能
|
||||
/// </summary>
|
||||
public bool LockoutEnabled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 登陆失败次数
|
||||
/// </summary>
|
||||
public int AccessFailedCount { get; set; }
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@ public interface IRoleService : IScopeDependency
|
||||
{
|
||||
Task<Pagination<RoleRespone>> GetPageAsync(RolePageRequest request);
|
||||
|
||||
Task<List<RoleRespone>> GetListAsync();
|
||||
|
||||
Task SaveRoleAsync(RoleSaveRequest request);
|
||||
|
||||
Task<RoleRespone> GetMyRoleAsync();
|
||||
|
||||
@@ -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<List<RoleRespone>> GetListAsync()
|
||||
{
|
||||
return await Scoped.Request.Value.CreateAsync(async sp =>
|
||||
{
|
||||
var dbContext = sp.GetService<IDbContext>();
|
||||
var identityConnection = _configuration.GetSection("SqlSugarOptions:IdentityConnectionString").Value;
|
||||
dbContext.Client.CurrentConnectionConfig.ConnectionString = identityConnection;
|
||||
|
||||
|
||||
return await dbContext.Queryable<RoleEntity>()
|
||||
.Select<RoleRespone>()
|
||||
.ToListAsync();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user