From 006e6389385e9a03e6d689b3a131214ebd28a68a Mon Sep 17 00:00:00 2001 From: liguoyang Date: Mon, 9 Sep 2024 14:49:28 +0800 Subject: [PATCH 1/6] =?UTF-8?q?fix=20=E6=A0=B9=E6=8D=AE=E7=BC=96=E7=A0=81?= =?UTF-8?q?=E5=88=A4=E6=96=AD=E5=8C=BA=E5=9F=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Appointment/Services/Implements/AppointmentService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Src/Dlhis.External/Appointment/Services/Implements/AppointmentService.cs b/Src/Dlhis.External/Appointment/Services/Implements/AppointmentService.cs index ff1b7951..8681c948 100644 --- a/Src/Dlhis.External/Appointment/Services/Implements/AppointmentService.cs +++ b/Src/Dlhis.External/Appointment/Services/Implements/AppointmentService.cs @@ -88,7 +88,7 @@ public class AppointmentService : IAppointmentService Phone = item.Phone, Remark = item.Remark, DoorStatus = areas.Where(x => x.Type == AppointmentAreaEnumType.Door) - .Select(x => x.Name) + .Select(x => x.CustomCode) .Contains(item.ApplyDoorArea) ? VisitorAppointmentDetailStatusEnumType.Wait : VisitorAppointmentDetailStatusEnumType.Obsolete, @@ -99,7 +99,7 @@ public class AppointmentService : IAppointmentService 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, From 5986a9540949009e17f8dcae2d280f7babd2157e Mon Sep 17 00:00:00 2001 From: liguoyang Date: Mon, 9 Sep 2024 18:00:31 +0800 Subject: [PATCH 2/6] =?UTF-8?q?feat=20=E8=8E=B7=E5=8F=96=E8=80=83=E5=8B=A4?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Src/Dlhis.External/Dlhis.External.csproj | 1 - .../OpenApi/Controllers/GainfosController.cs | 17 ++++++- .../Request/DeviceUploadLogMyRecordRequest.cs | 27 +++++++++++ .../Response/DeviceUploadLogResponse.cs | 48 +++++++++++++++++++ .../OpenApi/Services/IGainfoService.cs | 7 ++- .../Services/Implements/GainfoService.cs | 27 +++++++++++ 6 files changed, 123 insertions(+), 4 deletions(-) create mode 100644 Src/Dlhis.External/OpenApi/Request/DeviceUploadLogMyRecordRequest.cs create mode 100644 Src/Dlhis.External/OpenApi/Response/DeviceUploadLogResponse.cs 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 From e050d56496eddd754c9a4e65c931389bd976cd95 Mon Sep 17 00:00:00 2001 From: liguoyang Date: Tue, 10 Sep 2024 12:07:32 +0800 Subject: [PATCH 3/6] =?UTF-8?q?fix=20=E4=B8=B4=E6=97=B6=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E7=A4=BE=E4=BF=9D=E7=85=A7=E7=89=87=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Appointment/Services/Implements/AppointmentService.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Src/Dlhis.External/Appointment/Services/Implements/AppointmentService.cs b/Src/Dlhis.External/Appointment/Services/Implements/AppointmentService.cs index 8681c948..dcc8bbd8 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 { From 57ec12a1d3688eb902f46ddcfe271ca397f5bc2b Mon Sep 17 00:00:00 2001 From: liguoyang Date: Wed, 11 Sep 2024 10:40:26 +0800 Subject: [PATCH 4/6] =?UTF-8?q?fix=20=E5=A2=9E=E5=8A=A0=E5=AD=97=E6=AE=B5I?= =?UTF-8?q?sEnterDoorArea?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Visitor/Entity/VisitorAppointmentDetailEntity.cs | 5 +++++ .../Appointment/Dto/AppointmentReceiveItemDto.cs | 6 +++++- .../Appointment/Services/Implements/AppointmentService.cs | 3 ++- 3 files changed, 12 insertions(+), 2 deletions(-) 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..8710a565 100644 --- a/Src/Dlhis.External/Appointment/Dto/AppointmentReceiveItemDto.cs +++ b/Src/Dlhis.External/Appointment/Dto/AppointmentReceiveItemDto.cs @@ -45,6 +45,10 @@ public class AppointmentReceiveItemDto : IValidatableObject /// public string ImageUrl { get; set; } + /// + /// 进入门岗 + /// + public bool IsEnterDoorArea { get; set; } /// /// 预约门岗区域 @@ -63,7 +67,7 @@ public class AppointmentReceiveItemDto : IValidatableObject public DateTime DoorEnd { get; set; } /// - /// 是否进入车间 + /// 进入车间 /// public bool IsEnterWorkplace { get; set; } diff --git a/Src/Dlhis.External/Appointment/Services/Implements/AppointmentService.cs b/Src/Dlhis.External/Appointment/Services/Implements/AppointmentService.cs index dcc8bbd8..ff689b9f 100644 --- a/Src/Dlhis.External/Appointment/Services/Implements/AppointmentService.cs +++ b/Src/Dlhis.External/Appointment/Services/Implements/AppointmentService.cs @@ -88,12 +88,13 @@ public class AppointmentService : IAppointmentService Name = item.Name, Phone = item.Phone, Remark = item.Remark, - DoorStatus = areas.Where(x => x.Type == AppointmentAreaEnumType.Door) + 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, From 1b9591936e7fd99f6cca82769a2311f1368f62c2 Mon Sep 17 00:00:00 2001 From: liguoyang Date: Wed, 11 Sep 2024 14:19:23 +0800 Subject: [PATCH 5/6] =?UTF-8?q?fix=20=E5=AE=9E=E4=BD=93=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Appointment/Dto/AppointmentReceiveItemDto.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Src/Dlhis.External/Appointment/Dto/AppointmentReceiveItemDto.cs b/Src/Dlhis.External/Appointment/Dto/AppointmentReceiveItemDto.cs index 8710a565..f4552638 100644 --- a/Src/Dlhis.External/Appointment/Dto/AppointmentReceiveItemDto.cs +++ b/Src/Dlhis.External/Appointment/Dto/AppointmentReceiveItemDto.cs @@ -53,7 +53,6 @@ public class AppointmentReceiveItemDto : IValidatableObject /// /// 预约门岗区域 /// - [Required(ErrorMessage = "预约门岗区域不可为空")] public string ApplyDoorArea { get; set; } /// @@ -89,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) From 8535d7deda16e4c2ae8d061ed0cf626568962b95 Mon Sep 17 00:00:00 2001 From: liguoyang Date: Wed, 11 Sep 2024 14:28:33 +0800 Subject: [PATCH 6/6] =?UTF-8?q?fix=20=E5=AE=9E=E4=BD=93=E6=A3=80=E9=AA=8C?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Appointment/Dto/AppointmentReceiveItemDto.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Src/Dlhis.External/Appointment/Dto/AppointmentReceiveItemDto.cs b/Src/Dlhis.External/Appointment/Dto/AppointmentReceiveItemDto.cs index f4552638..10cab989 100644 --- a/Src/Dlhis.External/Appointment/Dto/AppointmentReceiveItemDto.cs +++ b/Src/Dlhis.External/Appointment/Dto/AppointmentReceiveItemDto.cs @@ -113,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) }); + } } } }