diff --git a/Src/Dlhis.Entity/Visitor/Entity/VisitorAppointmentDetailEntity.cs b/Src/Dlhis.Entity/Visitor/Entity/VisitorAppointmentDetailEntity.cs
index ee427536..a73e98aa 100644
--- a/Src/Dlhis.Entity/Visitor/Entity/VisitorAppointmentDetailEntity.cs
+++ b/Src/Dlhis.Entity/Visitor/Entity/VisitorAppointmentDetailEntity.cs
@@ -51,6 +51,11 @@ public class VisitorAppointmentDetailEntity : SugarBaseEntity
[SugarColumn(ColumnDescription = "车牌")]
public string LicensePlate { get; set; }
+ ///
+ /// 进入门岗
+ ///
+ public bool IsEnterDoorArea { get; set; }
+
///
/// 预约门禁区域
///
diff --git a/Src/Dlhis.External/Appointment/Dto/AppointmentReceiveItemDto.cs b/Src/Dlhis.External/Appointment/Dto/AppointmentReceiveItemDto.cs
index bd0fd1b5..10cab989 100644
--- a/Src/Dlhis.External/Appointment/Dto/AppointmentReceiveItemDto.cs
+++ b/Src/Dlhis.External/Appointment/Dto/AppointmentReceiveItemDto.cs
@@ -45,11 +45,14 @@ public class AppointmentReceiveItemDto : IValidatableObject
///
public string ImageUrl { get; set; }
+ ///
+ /// 进入门岗
+ ///
+ public bool IsEnterDoorArea { get; set; }
///
/// 预约门岗区域
///
- [Required(ErrorMessage = "预约门岗区域不可为空")]
public string ApplyDoorArea { get; set; }
///
@@ -63,7 +66,7 @@ public class AppointmentReceiveItemDto : IValidatableObject
public DateTime DoorEnd { get; set; }
///
- /// 是否进入车间
+ /// 进入车间
///
public bool IsEnterWorkplace { get; set; }
@@ -85,9 +88,17 @@ public class AppointmentReceiveItemDto : IValidatableObject
///
public IEnumerable Validate(ValidationContext validationContext)
{
- if (DoorStart >= DoorEnd)
+ if (IsEnterDoorArea)
{
- yield return new ValidationResult($"{Name}门禁来访时间有误", new[] { nameof(DoorStart) });
+ if (ApplyDoorArea.IsEmpty())
+ {
+ yield return new ValidationResult($"{Name}门岗区域不可为空", new[] { nameof(ApplyWorkplaceAreas) });
+ }
+
+ if (DoorStart >= DoorEnd)
+ {
+ yield return new ValidationResult($"{Name}门禁来访时间有误", new[] { nameof(DoorStart) });
+ }
}
if (IsEnterWorkplace)
@@ -102,14 +113,17 @@ public class AppointmentReceiveItemDto : IValidatableObject
yield return new ValidationResult($"{Name}车间来访时间有误", new[] { nameof(WorkplaceStart) });
}
- if (WorkplaceStart < DoorStart || WorkplaceStart > DoorEnd)
+ if (IsEnterDoorArea)
{
- yield return new ValidationResult($"{Name}车间来访时间需在门禁时间范围内", new[] { nameof(WorkplaceStart) });
- }
+ if (WorkplaceStart < DoorStart || WorkplaceStart > DoorEnd)
+ {
+ yield return new ValidationResult($"{Name}车间来访时间需在门禁时间范围内", new[] { nameof(WorkplaceStart) });
+ }
- if (WorkplaceEnd < DoorStart || WorkplaceEnd > DoorEnd)
- {
- yield return new ValidationResult($"{Name}车间来访时间需在门禁时间范围内", new[] { nameof(WorkplaceStart) });
+ if (WorkplaceEnd < DoorStart || WorkplaceEnd > DoorEnd)
+ {
+ yield return new ValidationResult($"{Name}车间来访时间需在门禁时间范围内", new[] { nameof(WorkplaceStart) });
+ }
}
}
}
diff --git a/Src/Dlhis.External/Appointment/Services/Implements/AppointmentService.cs b/Src/Dlhis.External/Appointment/Services/Implements/AppointmentService.cs
index ff1b7951..ff689b9f 100644
--- a/Src/Dlhis.External/Appointment/Services/Implements/AppointmentService.cs
+++ b/Src/Dlhis.External/Appointment/Services/Implements/AppointmentService.cs
@@ -76,7 +76,8 @@ public class AppointmentService : IAppointmentService
}
}
- (gainfo.Type == GainfoUserTypeEnumType.External && item.IsEnterWorkplace && item.ImageUrl.IsEmpty()).ThrowIfTrue($"{item.Name}的社保照片不可为空");
+ //todo
+ //(gainfo.Type == GainfoUserTypeEnumType.External && item.IsEnterWorkplace && item.ImageUrl.IsEmpty()).ThrowIfTrue($"{item.Name}的社保照片不可为空");
var detail = new VisitorAppointmentDetailEntity
{
@@ -87,19 +88,20 @@ public class AppointmentService : IAppointmentService
Name = item.Name,
Phone = item.Phone,
Remark = item.Remark,
- DoorStatus = areas.Where(x => x.Type == AppointmentAreaEnumType.Door)
- .Select(x => x.Name)
+ DoorStatus = item.IsEnterDoorArea && areas.Where(x => x.Type == AppointmentAreaEnumType.Door)
+ .Select(x => x.CustomCode)
.Contains(item.ApplyDoorArea)
? VisitorAppointmentDetailStatusEnumType.Wait
: VisitorAppointmentDetailStatusEnumType.Obsolete,
LicensePlate = item.LicensePlate,
+ IsEnterDoorArea = item.IsEnterDoorArea,
ApplyDoorArea = item.ApplyDoorArea,
DoorStart = item.DoorStart,
DoorEnd = item.DoorEnd,
IsEnterWorkplace = item.IsEnterWorkplace,
WorkplaceStatus = item.IsEnterWorkplace &&
item.ApplyWorkplaceAreas.All(p => areas.Where(x => x.Type == AppointmentAreaEnumType.Workplace)
- .Select(x => x.Name)
+ .Select(x => x.CustomCode)
.Contains(p))
? VisitorAppointmentDetailStatusEnumType.Wait
: VisitorAppointmentDetailStatusEnumType.Obsolete,
diff --git a/Src/Dlhis.External/Dlhis.External.csproj b/Src/Dlhis.External/Dlhis.External.csproj
index 464fd921..97bdf51e 100644
--- a/Src/Dlhis.External/Dlhis.External.csproj
+++ b/Src/Dlhis.External/Dlhis.External.csproj
@@ -23,7 +23,6 @@
-
diff --git a/Src/Dlhis.External/OpenApi/Controllers/GainfosController.cs b/Src/Dlhis.External/OpenApi/Controllers/GainfosController.cs
index 36fe292e..c1cb4bf9 100644
--- a/Src/Dlhis.External/OpenApi/Controllers/GainfosController.cs
+++ b/Src/Dlhis.External/OpenApi/Controllers/GainfosController.cs
@@ -1,5 +1,7 @@
-using Dlhis.External.OpenApi.Response;
+using Dlhis.External.OpenApi.Request;
+using Dlhis.External.OpenApi.Response;
using Dlhis.External.OpenApi.Services;
+using Kurisu.AspNetCore.DataAccess.Dto;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
@@ -26,4 +28,15 @@ public class GainfosController : ControllerBase
{
return await _gainfoService.GetAllGainfosAsync();
}
-}
+
+ ///
+ /// 获取考勤数据
+ ///
+ ///
+ ///
+ [HttpGet("attendance/pagination")]
+ public async Task> GetAttendanceRecordPageAsync([FromQuery] DeviceUploadLogMyRecordRequest request)
+ {
+ return await _gainfoService.GetAttendanceRecordPageAsync(request);
+ }
+}
\ No newline at end of file
diff --git a/Src/Dlhis.External/OpenApi/Request/DeviceUploadLogMyRecordRequest.cs b/Src/Dlhis.External/OpenApi/Request/DeviceUploadLogMyRecordRequest.cs
new file mode 100644
index 00000000..fba32ae4
--- /dev/null
+++ b/Src/Dlhis.External/OpenApi/Request/DeviceUploadLogMyRecordRequest.cs
@@ -0,0 +1,27 @@
+using System.ComponentModel.DataAnnotations;
+using Kurisu.AspNetCore.CustomClass;
+using Kurisu.AspNetCore.DataAccess.Dto;
+
+namespace Dlhis.External.OpenApi.Request;
+
+public class DeviceUploadLogMyRecordRequest : PageDto, IValidatableObject
+{
+ public DateTimePeriod DateTimePeriod { get; set; }
+
+ [Required(ErrorMessage = "工号不能为空")]
+ public string UserCode { get; set; }
+
+ ///
+ public IEnumerable Validate(ValidationContext validationContext)
+ {
+ DateTimePeriod ??= new DateTimePeriod();
+
+ if (DateTimePeriod.Start != null)
+ {
+ DateTimePeriod.End = DateTimePeriod.Start.Value.AddDays(1);
+ }
+
+
+ yield break;
+ }
+}
\ No newline at end of file
diff --git a/Src/Dlhis.External/OpenApi/Response/DeviceUploadLogResponse.cs b/Src/Dlhis.External/OpenApi/Response/DeviceUploadLogResponse.cs
new file mode 100644
index 00000000..a4bd318c
--- /dev/null
+++ b/Src/Dlhis.External/OpenApi/Response/DeviceUploadLogResponse.cs
@@ -0,0 +1,48 @@
+namespace Dlhis.External.OpenApi.Response;
+
+public class DeviceUploadLogResponse
+{
+ public long Id { get; set; }
+
+ ///
+ /// 设备号
+ ///
+ public string DeviceUniqueNo { get; set; }
+
+ ///
+ /// 设备部署点
+ ///
+ public string DeployPlace { get; set; }
+
+ ///
+ /// 用户学工号
+ ///
+ public string UserCode { get; set; }
+
+ ///
+ /// 用户名称
+ ///
+ public string UserName { get; set; }
+
+ ///
+ /// 上传时间
+ ///
+ public DateTime RaiseDateTime { get; set; }
+
+
+ ///
+ /// 序列号
+ ///
+ public string SerialNo { get; set; }
+
+
+ ///
+ /// 是否同步sap
+ ///
+ public bool Sync { get; set; }
+
+ ///
+ /// 是否有效
+ ///
+ public bool Status { get; set; }
+}
\ No newline at end of file
diff --git a/Src/Dlhis.External/OpenApi/Services/IGainfoService.cs b/Src/Dlhis.External/OpenApi/Services/IGainfoService.cs
index 12dcbadd..5385b488 100644
--- a/Src/Dlhis.External/OpenApi/Services/IGainfoService.cs
+++ b/Src/Dlhis.External/OpenApi/Services/IGainfoService.cs
@@ -1,4 +1,6 @@
-using Dlhis.External.OpenApi.Response;
+using Dlhis.External.OpenApi.Request;
+using Dlhis.External.OpenApi.Response;
+using Kurisu.AspNetCore.DataAccess.Dto;
namespace Dlhis.External.OpenApi.Services;
@@ -7,4 +9,7 @@ public interface IGainfoService : IScopeDependency
Task> GetAllGainfosAsync();
Task> GetDepartmentsAsync();
+
+
+ Task> GetAttendanceRecordPageAsync(DeviceUploadLogMyRecordRequest request);
}
diff --git a/Src/Dlhis.External/OpenApi/Services/Implements/GainfoService.cs b/Src/Dlhis.External/OpenApi/Services/Implements/GainfoService.cs
index 1028ce32..98aa385f 100644
--- a/Src/Dlhis.External/OpenApi/Services/Implements/GainfoService.cs
+++ b/Src/Dlhis.External/OpenApi/Services/Implements/GainfoService.cs
@@ -1,6 +1,12 @@
using Dlhis.Entity.Basic.Entity;
using Dlhis.Entity.Basic.Enums;
+using Dlhis.Entity.Device.Entities;
+using Dlhis.Entity.Device.Enums;
+using Dlhis.External.OpenApi.Request;
using Dlhis.External.OpenApi.Response;
+using Kurisu.AspNetCore.CustomClass;
+using Kurisu.AspNetCore.DataAccess.Dto;
+using Kurisu.AspNetCore.DataAccess.SqlSugar.Extensions;
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
namespace Dlhis.External.OpenApi.Services.Implements;
@@ -57,4 +63,25 @@ public class GainfoService : IGainfoService
PNo = x.PNo
}).ToListAsync();
}
+
+ public async Task> GetAttendanceRecordPageAsync(DeviceUploadLogMyRecordRequest request)
+ {
+ return await _dbContext.Queryable()
+ .LeftJoin((log, d) => log.DeviceUniqueNo == d.UniqueNo)
+ .Where(log => log.UserUniqueNo == request.UserCode)
+ .WhereIF(request.DateTimePeriod.HasValue(), log => log.RaiseDateTime >= request.DateTimePeriod.Start && log.RaiseDateTime <= request.DateTimePeriod.End)
+ .Where((log, d) => d.Type == DeviceTypeEnumType.Attendance || (d.Type == DeviceTypeEnumType.Door && d.AsAttendance))
+ .OrderBy(log => log.RaiseDateTime)
+ .Select((log, d) => new DeviceUploadLogResponse
+ {
+ DeviceUniqueNo = log.DeviceUniqueNo,
+ Id = log.Id,
+ RaiseDateTime = log.RaiseDateTime,
+ SerialNo = log.SerialNo,
+ DeployPlace = d.DeployPlace,
+ Sync = log.Sync,
+ Status = log.Status
+ })
+ .ToPageListAsync(request);
+ }
}
\ No newline at end of file