diff --git a/Src/Dlhis.Basic/Device/Controllers/DevicesController.cs b/Src/Dlhis.Basic/Device/Controllers/DevicesController.cs
index 19d92f35..2e089366 100644
--- a/Src/Dlhis.Basic/Device/Controllers/DevicesController.cs
+++ b/Src/Dlhis.Basic/Device/Controllers/DevicesController.cs
@@ -145,7 +145,7 @@ public class DevicesController : ControllerBase
///
///
[HttpGet]
- public async Task> GetDeviceByNoAsync([FromQuery] DevicePageRequest request)
+ public async Task GetDeviceByNoAsync([FromQuery] DeviceByNoRequest request)
{
return await _deviceService.GetDeviceByNoAsync(request);
}
diff --git a/Src/Dlhis.Basic/Device/Request/DeviceByNoRequest.cs b/Src/Dlhis.Basic/Device/Request/DeviceByNoRequest.cs
new file mode 100644
index 00000000..46301f38
--- /dev/null
+++ b/Src/Dlhis.Basic/Device/Request/DeviceByNoRequest.cs
@@ -0,0 +1,10 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace Dlhis.Basic.Device.Request;
+
+public class DeviceByNoRequest
+{
+
+ [Required]
+ public string UniqueNo { get; set; }
+}
diff --git a/Src/Dlhis.Basic/Device/Response/DeviceResponse.cs b/Src/Dlhis.Basic/Device/Response/DeviceResponse.cs
index 628a35b4..d28b8650 100644
--- a/Src/Dlhis.Basic/Device/Response/DeviceResponse.cs
+++ b/Src/Dlhis.Basic/Device/Response/DeviceResponse.cs
@@ -1,6 +1,7 @@
using Dlhis.Entity.Device.Enums;
using Kurisu.AspNetCore.Utils.Extensions;
using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
namespace Dlhis.Basic.Device.Response;
@@ -72,7 +73,26 @@ public class DeviceResponse
///
/// 连接信息
///
- public string ConnectionInfo { get; set; }
+ public object ConnectionInfo
+ {
+ get
+ {
+ try
+ {
+ return JObject.Parse(ConnectionInfoStr);
+ }
+ catch (Exception)
+ {
+ return JObject.Parse("{}");
+ }
+ }
+ }
+
+ ///
+ /// 连接信息
+ ///
+ [JsonIgnore]
+ public string ConnectionInfoStr { get; set; }
///
/// 是否启用
diff --git a/Src/Dlhis.Basic/Device/Services/IDeviceService.cs b/Src/Dlhis.Basic/Device/Services/IDeviceService.cs
index 930db433..eb429293 100644
--- a/Src/Dlhis.Basic/Device/Services/IDeviceService.cs
+++ b/Src/Dlhis.Basic/Device/Services/IDeviceService.cs
@@ -12,7 +12,7 @@ public interface IDeviceService : IScopeDependency
Task CheckExistsAsync(string deviceUniqueNo);
- Task> GetDeviceByNoAsync(DevicePageRequest request);
+ Task GetDeviceByNoAsync(DeviceByNoRequest request);
Task> GetAttendanceDevicesAsync();
}
diff --git a/Src/Dlhis.Basic/Device/Services/Implements/DeviceService.cs b/Src/Dlhis.Basic/Device/Services/Implements/DeviceService.cs
index 92d90627..0e4f5dcb 100644
--- a/Src/Dlhis.Basic/Device/Services/Implements/DeviceService.cs
+++ b/Src/Dlhis.Basic/Device/Services/Implements/DeviceService.cs
@@ -152,18 +152,19 @@ public class DeviceService : IDeviceService
///
///
///
- public async Task> GetDeviceByNoAsync(DevicePageRequest request)
+ public async Task GetDeviceByNoAsync(DeviceByNoRequest request)
{
- var page = await _dbContext.Queryable()
+ var device = await _dbContext.Queryable()
.Where(x => x.UniqueNo == request.UniqueNo)
- .Select(device => new DeviceResponse
- {
- FuncsStr = device.Funcs.ToString()
+ .Select(device => new DeviceResponse
+ {
+ FuncsStr = device.Funcs.ToString(),
+ ConnectionInfoStr = device.ConnectionInfo
- }, true)
- .ToPageListAsync(request);
+ }, true)
+ .SingleAsync();
- return page;
+ return device;
}
public async Task> GetAttendanceDevicesAsync()
diff --git a/Src/Dlhis.Common/Packs/MinioPack.cs b/Src/Dlhis.Common/Packs/MinioPack.cs
index 636a2a7b..b9a97279 100644
--- a/Src/Dlhis.Common/Packs/MinioPack.cs
+++ b/Src/Dlhis.Common/Packs/MinioPack.cs
@@ -3,11 +3,11 @@ using Kurisu.SqlSugar.Extensions;
using Microsoft.Extensions.DependencyInjection;
using Minio;
-namespace Dlhis.Common.Packs
-{
- public class MinioPack : BaseAppPack
- {
- public override bool IsBeforeUseRouting { get; }
+//namespace Dlhis.Common.Packs
+//{
+// public class MinioPack : BaseAppPack
+// {
+// public override bool IsBeforeUseRouting { get; }
public override void ConfigureServices(IServiceCollection services)
{
diff --git a/Src/Dlhis.Entity/Device/Entities/DeviceUploadLogEntity.cs b/Src/Dlhis.Entity/Device/Entities/DeviceUploadLogEntity.cs
index 314f005f..6381a33e 100644
--- a/Src/Dlhis.Entity/Device/Entities/DeviceUploadLogEntity.cs
+++ b/Src/Dlhis.Entity/Device/Entities/DeviceUploadLogEntity.cs
@@ -1,5 +1,7 @@
-using Kurisu.Core.DataAccess.Entity;
+using Dlhis.Entity.Device.Enums;
+using Kurisu.Core.DataAccess.Entity;
using SqlSugar;
+using SqlSugar.DbConvert;
namespace Dlhis.Entity.Device.Entities;
@@ -12,6 +14,10 @@ public class DeviceUploadLogEntity : ITenantId
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
public long Id { get; set; }
+
+ [SugarColumn(IsNullable = true)]
+ public string SerialNo { get; set; }
+
///
/// 设备号
///
@@ -20,17 +26,20 @@ public class DeviceUploadLogEntity : ITenantId
///
/// 人员唯一号
///
+ [SugarColumn(IsNullable = true)]
public string UserUniqueNo { get; set; }
///
- /// 上传IP
+ /// 产生时间
///
- public string Ip { get; set; }
+ public DateTime RaiseDateTime { get; set; }
+
///
- /// 上传时间
+ /// 日志类型
///
- public DateTime UploadTime { get; set; }
+ [SugarColumn(ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert))]
+ public DeviceUploadLogTypeEnumType Type { get; set; }
[SugarColumn(IndexGroupNameList = new string[] { "idx_DeviceUploadLog_TenantId" })]
diff --git a/Src/Dlhis.Entity/Device/Enums/DeviceTaskEnumType.cs b/Src/Dlhis.Entity/Device/Enums/DeviceTaskEnumType.cs
index 3e0a520b..d642dcd5 100644
--- a/Src/Dlhis.Entity/Device/Enums/DeviceTaskEnumType.cs
+++ b/Src/Dlhis.Entity/Device/Enums/DeviceTaskEnumType.cs
@@ -50,4 +50,17 @@ public enum DeviceTaskEnumType
///
[Description("删除计划")]
ScheduleDelete,
+
+ ///
+ /// 同步时间
+ ///
+ [Description("同步时间")]
+ SyncDateTime = 400,
+
+
+ ///
+ /// 同步时间
+ ///
+ [Description("上传记录")]
+ UploadRecord = 500,
}
diff --git a/Src/Dlhis.Entity/Device/Enums/DeviceUploadLogTypeEnumType.cs b/Src/Dlhis.Entity/Device/Enums/DeviceUploadLogTypeEnumType.cs
new file mode 100644
index 00000000..a100e614
--- /dev/null
+++ b/Src/Dlhis.Entity/Device/Enums/DeviceUploadLogTypeEnumType.cs
@@ -0,0 +1,29 @@
+using System.ComponentModel;
+
+namespace Dlhis.Entity.Device.Enums;
+
+///
+/// 设别上传记录类型
+///
+[Description("设别上传记录类型")]
+public enum DeviceUploadLogTypeEnumType
+{
+ ///
+ /// 门记录
+ ///
+ [Description("门记录")]
+ Door = 1,
+
+ ///
+ /// 考勤记录
+ ///
+ [Description("考勤记录")]
+ Attendance = 2,
+
+ ///
+ /// 触发获取记录,对业务无作用
+ ///
+ [Description("触发获取记录")]
+ Raise = 100
+
+}
diff --git a/Src/Dlhis.ScheduledTask/DeviceUploadLog/Request/DeviceUploadLogUploadRequest.cs b/Src/Dlhis.ScheduledTask/DeviceUploadLog/Request/DeviceUploadLogUploadRequest.cs
index 42a43522..3407da8f 100644
--- a/Src/Dlhis.ScheduledTask/DeviceUploadLog/Request/DeviceUploadLogUploadRequest.cs
+++ b/Src/Dlhis.ScheduledTask/DeviceUploadLog/Request/DeviceUploadLogUploadRequest.cs
@@ -1,4 +1,5 @@
using System.ComponentModel.DataAnnotations;
+using Dlhis.Entity.Device.Enums;
namespace Dlhis.ScheduledTask.DeviceUploadLog.Request;
@@ -13,11 +14,22 @@ public class DeviceUploadLogUploadRequest
///
/// 用户学工号
///
- [Required(ErrorMessage = "人员唯一号不能为空")]
public string UserUniqueNo { get; set; }
///
- /// 上传时间
+ /// 产生时间
///
- public DateTime UploadTime { get; set; }
+ public DateTime RaiseDateTime { get; set; }
+
+ ///
+ /// 记录序号
+ ///
+ public string SerialNo { get; set; }
+
+
+ ///
+ /// 日志类型
+ ///
+ [EnumDataType(typeof(DeviceUploadLogTypeEnumType))]
+ public DeviceUploadLogTypeEnumType Type { get; set; } = DeviceUploadLogTypeEnumType.Door;
}
diff --git a/Src/Dlhis.ScheduledTask/DeviceUploadLog/Response/DeviceUploadLogResponse.cs b/Src/Dlhis.ScheduledTask/DeviceUploadLog/Response/DeviceUploadLogResponse.cs
index 1770a7e6..c8de21fd 100644
--- a/Src/Dlhis.ScheduledTask/DeviceUploadLog/Response/DeviceUploadLogResponse.cs
+++ b/Src/Dlhis.ScheduledTask/DeviceUploadLog/Response/DeviceUploadLogResponse.cs
@@ -25,13 +25,8 @@ public class DeviceUploadLogResponse
///
public string UserName { get; set; }
- ///
- /// 上传IP
- ///
- public string Ip { get; set; }
-
///
/// 上传时间
///
- public DateTime UploadTime { get; set; }
+ public DateTime RaiseDateTime { get; set; }
}
diff --git a/Src/Dlhis.ScheduledTask/DeviceUploadLog/Services/Implements/DeviceUploadLogService.cs b/Src/Dlhis.ScheduledTask/DeviceUploadLog/Services/Implements/DeviceUploadLogService.cs
index 43961c53..5e266701 100644
--- a/Src/Dlhis.ScheduledTask/DeviceUploadLog/Services/Implements/DeviceUploadLogService.cs
+++ b/Src/Dlhis.ScheduledTask/DeviceUploadLog/Services/Implements/DeviceUploadLogService.cs
@@ -23,14 +23,13 @@ public class DeviceUploadLogService : IDeviceUploadLogService
{
var page = await _dbContext.Queryable()
.LeftJoin((deviceUp, ga) => deviceUp.UserUniqueNo == ga.No)
- .WhereIF(request.SearchDateTimePeriod?.Start.HasValue == true, deviceUp => deviceUp.UploadTime >= request.SearchDateTimePeriod.Start)
- .WhereIF(request.SearchDateTimePeriod?.End.HasValue == true, deviceUp => deviceUp.UploadTime <= request.SearchDateTimePeriod.End)
+ .WhereIF(request.SearchDateTimePeriod?.Start.HasValue == true, deviceUp => deviceUp.RaiseDateTime >= request.SearchDateTimePeriod.Start)
+ .WhereIF(request.SearchDateTimePeriod?.End.HasValue == true, deviceUp => deviceUp.RaiseDateTime <= request.SearchDateTimePeriod.End)
.Select((deviceUp, ga) => new DeviceUploadLogResponse
{
DeviceUniqueNo = deviceUp.DeviceUniqueNo,
Id = deviceUp.Id,
- Ip = deviceUp.Ip,
- UploadTime = deviceUp.UploadTime,
+ RaiseDateTime = deviceUp.RaiseDateTime,
UserNo = ga.No,
UserCode = ga.Code,
UserName = ga.Name,
@@ -49,7 +48,7 @@ public class DeviceUploadLogService : IDeviceUploadLogService
var entity = new DeviceUploadLogEntity
{
DeviceUniqueNo = request.DeviceUniqueNo,
- UploadTime = request.UploadTime,
+ // UploadTime = request.UploadTime,
UserUniqueNo = request.UserUniqueNo,
TenantId = device.TenantId,
};
@@ -63,23 +62,26 @@ public class DeviceUploadLogService : IDeviceUploadLogService
var nos = requests.Select(x => x.DeviceUniqueNo).ToList();
var devices = await _dbContext.Queryable().Where(x => nos.Contains(x.UniqueNo)).ToListAsync();
- var records = requests.GroupBy(x => x.DeviceUniqueNo).Select(x =>
- {
- var device = devices.FirstOrDefault(item => item.UniqueNo == x.Key);
- if (device != null)
- {
- return x.AsEnumerable().Select(item => new DeviceUploadLogEntity
- {
- DeviceUniqueNo = x.Key,
- UserUniqueNo = item.UserUniqueNo,
- UploadTime = item.UploadTime,
- TenantId = device.TenantId,
+ var records = requests.GroupBy(x => x.DeviceUniqueNo).SelectMany(x =>
+ {
+ var device = devices.FirstOrDefault(item => item.UniqueNo == x.Key);
+ if (device != null)
+ {
+ return x.AsEnumerable().Select(item => new DeviceUploadLogEntity
+ {
+ DeviceUniqueNo = x.Key,
+ UserUniqueNo = item.UserUniqueNo,
+ RaiseDateTime = item.RaiseDateTime,
+ SerialNo = item.SerialNo,
+ Type = item.Type,
+ TenantId = device.TenantId,
- }).ToList();
- }
+ }).ToList();
+ }
- return null;
- }).Where(x => x != null).ToList();
+ return null;
+
+ }).Where(x => x != null).ToList();
await _dbContext.InsertAsync(records);
}
diff --git a/Src/Dlhis.ScheduledTask/Packs/JobPack.cs b/Src/Dlhis.ScheduledTask/Packs/JobPack.cs
index 59ae770e..1827ccb5 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.TaskAssignment.Job;
using Hangfire;
using Kurisu.AspNetCore.Startup;
@@ -16,5 +17,16 @@ 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/5 * * * ?", new RecurringJobOptions
+ {
+ TimeZone = TimeZoneInfo.Local
+ });
}
}
diff --git a/Src/Dlhis.ScheduledTask/TaskAssignment/Job/CreateGetAttendanceJob.cs b/Src/Dlhis.ScheduledTask/TaskAssignment/Job/CreateGetAttendanceJob.cs
new file mode 100644
index 00000000..de9b16e5
--- /dev/null
+++ b/Src/Dlhis.ScheduledTask/TaskAssignment/Job/CreateGetAttendanceJob.cs
@@ -0,0 +1,58 @@
+using Dlhis.Entity.Basic.Entity;
+using Dlhis.Entity.Device.Entities;
+using Dlhis.Entity.Device.Enums;
+using Kurisu.AspNetCore.Utils.Extensions;
+using Kurisu.SqlSugar.Services;
+
+namespace Dlhis.ScheduledTask.TaskAssignment.Job
+{
+ public class CreateGetAttendanceJob
+ {
+ private readonly IDbContext _dbContext;
+ private readonly ILogger _logger;
+
+ public CreateGetAttendanceJob(IDbContext dbContext, ILogger logger)
+ {
+ _logger = logger;
+ _dbContext = dbContext;
+ }
+
+ public async Task RunAsync()
+ {
+ _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 tasks = devices.Select(x => new DeviceTaskEntity
+ {
+ DeviceUniqueNo = x.UniqueNo,
+ Status = DeviceTaskStatusEnumType.Wait,
+
+ TenantId = x.TenantId,
+ Version = 0,
+ UserNo = string.Empty,
+ UserCode = string.Empty,
+ Type = DeviceTaskEnumType.UploadRecord,
+
+ CreatedBy = 1,
+ CreateTime = DateTime.Now,
+ ModifiedBy = 1,
+ ModifiedTime = DateTime.Now,
+
+ }).ToList();
+
+ await _dbContext.InsertAsync(tasks);
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, $"生成{DeviceTaskEnumType.UploadRecord.GetDescription()}任务失败:" + ex.Message);
+ }
+ finally
+ {
+ _dbContext.Client.QueryFilter.Restore();
+ }
+ }
+ }
+}
diff --git a/Src/Dlhis.ScheduledTask/TaskAssignment/Job/CreateSyncServerDateTimeJob.cs b/Src/Dlhis.ScheduledTask/TaskAssignment/Job/CreateSyncServerDateTimeJob.cs
new file mode 100644
index 00000000..44a2618c
--- /dev/null
+++ b/Src/Dlhis.ScheduledTask/TaskAssignment/Job/CreateSyncServerDateTimeJob.cs
@@ -0,0 +1,57 @@
+using Dlhis.Entity.Basic.Entity;
+using Dlhis.Entity.Device.Entities;
+using Dlhis.Entity.Device.Enums;
+using Kurisu.SqlSugar.Services;
+
+namespace Dlhis.ScheduledTask.TaskAssignment.Job
+{
+ public class CreateSyncServerDateTimeJob
+ {
+ private readonly IDbContext _dbContext;
+ private readonly ILogger _logger;
+
+ public CreateSyncServerDateTimeJob(IDbContext dbContext, ILogger logger)
+ {
+ _dbContext = dbContext;
+ _logger = logger;
+ }
+
+
+ public async Task RunAsync()
+ {
+ _dbContext.Client.QueryFilter.ClearAndBackup();
+ try
+ {
+ var devices = await _dbContext.Queryable().Where(x => x.Enable).ToListAsync();
+ var tasks = devices.Select(x => new DeviceTaskEntity
+ {
+
+ DeviceUniqueNo = x.UniqueNo,
+ Status = DeviceTaskStatusEnumType.Wait,
+
+ TenantId = x.TenantId,
+ Version = 0,
+ UserNo = string.Empty,
+ UserCode = string.Empty,
+ Type = DeviceTaskEnumType.SyncDateTime,
+
+ CreatedBy = 1,
+ CreateTime = DateTime.Now,
+ ModifiedBy = 1,
+ ModifiedTime = DateTime.Now,
+
+ }).ToList();
+
+ await _dbContext.InsertAsync(tasks);
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "生成同步时间任务失败:" + ex.Message);
+ }
+ finally
+ {
+ _dbContext.Client.QueryFilter.Restore();
+ }
+ }
+ }
+}
diff --git a/Src/Dlhis.ScheduledTask/TaskAssignment/Response/TimePeriodToDeviceResponse.cs b/Src/Dlhis.ScheduledTask/TaskAssignment/Response/TimePeriodToDeviceResponse.cs
index 3402e934..8af46fd7 100644
--- a/Src/Dlhis.ScheduledTask/TaskAssignment/Response/TimePeriodToDeviceResponse.cs
+++ b/Src/Dlhis.ScheduledTask/TaskAssignment/Response/TimePeriodToDeviceResponse.cs
@@ -9,13 +9,19 @@ public class TimePeriodToDeviceResponse
///
public int Id { get; set; }
- ///
- /// 星期
- ///
- public List Weeks { get; set; }
///
- /// 时段区间
+ /// 时段名称
///
- public TimePeriod TimePeriod { get; set; }
+ public string Name { get; set; }
+
+ ///
+ /// 使能
+ ///
+ public bool Enable { get; set; }
+
+ ///
+ /// 星期时段
+ ///
+ public List Sections { get; set; }
}
diff --git a/Src/Dlhis.ScheduledTask/TaskAssignment/Response/TimePeriodWeekDaySection.cs b/Src/Dlhis.ScheduledTask/TaskAssignment/Response/TimePeriodWeekDaySection.cs
new file mode 100644
index 00000000..99c6cb95
--- /dev/null
+++ b/Src/Dlhis.ScheduledTask/TaskAssignment/Response/TimePeriodWeekDaySection.cs
@@ -0,0 +1,16 @@
+using Kurisu.Core.CustomClass;
+
+namespace Dlhis.ScheduledTask.TaskAssignment.Response;
+
+public class TimePeriodWeekDaySection
+{
+ ///
+ /// 星期
+ ///
+ public DayOfWeek DayOfWeek { get; set; }
+
+ ///
+ /// 时段区间 最多4个
+ ///
+ public List TimePeriods { get; set; }
+}
diff --git a/Src/Dlhis.ScheduledTask/TaskAssignment/Response/UploadRecordToDeviceResponse.cs b/Src/Dlhis.ScheduledTask/TaskAssignment/Response/UploadRecordToDeviceResponse.cs
new file mode 100644
index 00000000..6f22adc1
--- /dev/null
+++ b/Src/Dlhis.ScheduledTask/TaskAssignment/Response/UploadRecordToDeviceResponse.cs
@@ -0,0 +1,8 @@
+using Kurisu.Core.CustomClass;
+
+namespace Dlhis.ScheduledTask.TaskAssignment.Response;
+
+public class UploadRecordToDeviceResponse
+{
+ public DateTimePeriod DateTimePeriod { get; set; }
+}
diff --git a/Src/Dlhis.ScheduledTask/TaskAssignment/Services/Implements/AssignmentService.cs b/Src/Dlhis.ScheduledTask/TaskAssignment/Services/Implements/AssignmentService.cs
index 333436f5..72b402f7 100644
--- a/Src/Dlhis.ScheduledTask/TaskAssignment/Services/Implements/AssignmentService.cs
+++ b/Src/Dlhis.ScheduledTask/TaskAssignment/Services/Implements/AssignmentService.cs
@@ -106,6 +106,30 @@ public class AssignmentService : IAssignmentService
return new List();
}
+ Dictionary deviceUploadInfos = null;
+ if (data.Any(x => x.Type == DeviceTaskEnumType.UploadRecord))
+ {
+ var deviceNos = data.Select(x => x.DeviceUniqueNo).Distinct();
+ deviceUploadInfos = new Dictionary(deviceNos.Count());
+
+ var logInfos = await _dbContext.Queryable().Select(it => new
+ {
+ Index2 = SqlFunc.RowNumber(SqlFunc.Desc(it.Id), it.DeviceUniqueNo),
+ it.DeviceUniqueNo,
+ it.RaiseDateTime
+ })
+ .MergeTable()
+ .Where(it => it.Index2 == 1)
+ .ToListAsync();
+
+ foreach (var item in deviceNos)
+ {
+ var logInfo = logInfos.FirstOrDefault(x => x.DeviceUniqueNo == item);
+ deviceUploadInfos.Add(item, logInfo?.RaiseDateTime);
+ }
+ }
+
+ //申请新的请求域
return Scoped.Request.Value.Create((sp) =>
{
var faceUrlOptions = sp.GetService>().Value;
@@ -137,9 +161,9 @@ public class AssignmentService : IAssignmentService
Tasks = x.AsEnumerable().Select(item =>
{
var key = $"face:{item.UserCode}";
- var token = item.Type == DeviceTaskEnumType.Add
- ? timeLimitedDataProtector.Protect(key, TimeSpan.FromSeconds(faceUrlOptions.Limit))
- : string.Empty;
+ var token = item.Type == DeviceTaskEnumType.Delete
+ ? string.Empty
+ : timeLimitedDataProtector.Protect(key, TimeSpan.FromSeconds(faceUrlOptions.Limit));
var dto = new TaskCombineDto
{
@@ -162,11 +186,11 @@ public class AssignmentService : IAssignmentService
UserName = item.UserName,
DepartmentNo = item.DepartmentNo,
DepartmentName = item.DepartmentName,
- CardNo = item.Type == DeviceTaskEnumType.Add ? item.CardNo : string.Empty,
- Face = item.Type == DeviceTaskEnumType.Add ? faceUrlOptions.Url + token : string.Empty,//下发才附带照片信息
+ CardNo = item.Type == DeviceTaskEnumType.Delete ? string.Empty : item.CardNo,
+ Face = item.Type == DeviceTaskEnumType.Delete ? string.Empty : faceUrlOptions.Url + token,//下发才附带照片信息
ValidDatePeriod = new DatePeriod
{
- Start = DateOnly.FromDateTime(DateTime.Now),
+ Start = DateOnly.FromDateTime(DateTime.Now.AddDays(-1)),
End = DateOnly.FromDateTime(DateTime.Now.AddYears(20)),
},
TimePeriods = new List { 1 },
@@ -181,15 +205,23 @@ public class AssignmentService : IAssignmentService
dto.Info = new TimePeriodToDeviceResponse
{
Id = 1,
- TimePeriod = new TimePeriod
+ Name = "小白领",
+ Enable = true,
+ Sections = new List()
{
- Start = TimeOnly.Parse("08:00:00"),
- End = TimeOnly.Parse("17:30:00"),
- },
- Weeks = new List
- {
- DayOfWeek.Monday, DayOfWeek.Tuesday, DayOfWeek.Wednesday, DayOfWeek.Thursday, DayOfWeek.Friday
- },
+ new TimePeriodWeekDaySection()
+ {
+ DayOfWeek= DayOfWeek.Monday,
+ TimePeriods = new List()
+ {
+ new TimePeriod
+ {
+ Start = TimeOnly.Parse("08:00:00"),
+ End = TimeOnly.Parse("17:30:00"),
+ },
+ }
+ }
+ }
};
}
break;
@@ -205,16 +237,30 @@ public class AssignmentService : IAssignmentService
{
new ScheduleDto
{
- Name = "国庆节",
+ Name = "国庆节",
DateTimePeriod = new DateTimePeriod
{
- Start = new DateTime(2024,10,1), End = new DateTime(2024,10,7)
+ Start = new DateTime(2024,10,1),
+ End = new DateTime(2024,10,7)
}
}
}
};
}
break;
+
+ case DeviceTaskEnumType.UploadRecord:
+ {
+ dto.Info = new UploadRecordToDeviceResponse
+ {
+ DateTimePeriod = new DateTimePeriod
+ {
+ Start = deviceUploadInfos[d] ?? DateTime.Now,
+ End = DateTime.Now.AddDays(1)
+ }
+ };
+ }
+ break;
default:
break;
}
diff --git a/Src/Dlhis.User.Api/Response/UserResponse.cs b/Src/Dlhis.User.Api/Response/UserResponse.cs
index 391341d2..da8b7164 100644
--- a/Src/Dlhis.User.Api/Response/UserResponse.cs
+++ b/Src/Dlhis.User.Api/Response/UserResponse.cs
@@ -20,7 +20,7 @@ public class UserResponse
public bool TwoFactorEnabled { get; set; }
- public bool LockoutEnd { get; set; }
+ public DateTime? LockoutEnd { get; set; }
public bool LockoutEnabled { get; set; }
diff --git a/Src/Dlhis.User/Identity/Response/UserResponse.cs b/Src/Dlhis.User/Identity/Response/UserResponse.cs
index c3be89b8..be3b78b1 100644
--- a/Src/Dlhis.User/Identity/Response/UserResponse.cs
+++ b/Src/Dlhis.User/Identity/Response/UserResponse.cs
@@ -20,7 +20,7 @@ public class UserResponse
public bool TwoFactorEnabled { get; set; }
- public bool LockoutEnd { get; set; }
+ public DateTime? LockoutEnd { get; set; }
public bool LockoutEnabled { get; set; }