From f17fb62a72f4c911da6e412e3aa0c64b233da3f2 Mon Sep 17 00:00:00 2001 From: liguoyang Date: Fri, 18 Oct 2024 18:42:23 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E6=A0=A1=E9=AA=8C=E8=A1=A5=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/Implements/AppointmentService.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Src/Dlhis.External/Appointment/Services/Implements/AppointmentService.cs b/Src/Dlhis.External/Appointment/Services/Implements/AppointmentService.cs index 35055588..abb8cddd 100644 --- a/Src/Dlhis.External/Appointment/Services/Implements/AppointmentService.cs +++ b/Src/Dlhis.External/Appointment/Services/Implements/AppointmentService.cs @@ -3,6 +3,7 @@ using Dlhis.Entity.Basic.Enums; using Dlhis.Entity.Visitor.Entity; using Dlhis.Entity.Visitor.Enums; using Dlhis.External.Appointment.Request; +using Kurisu.AspNetCore.CustomClass; using Kurisu.AspNetCore.DataAccess.SqlSugar.Services; using Kurisu.AspNetCore.Utils; using Kurisu.AspNetCore.Utils.Extensions; @@ -44,6 +45,23 @@ public class AppointmentService : IAppointmentService foreach (var item in request.Items) { + if (item.IsEnterDoorArea && areas.Where(x => x.Type == AppointmentAreaEnumType.Door) + .Select(x => x.CustomCode) + .Contains(item.ApplyDoorArea) == false) + { + throw new UserFriendlyException($"门岗区域{item.ApplyDoorArea}无效"); + } + + if (item.IsEnterWorkplace && + item.ApplyWorkplaceAreas.All(p => areas.Where(x => x.Type == AppointmentAreaEnumType.Workplace) + .Select(x => x.CustomCode) + .Contains(p)) == false) + { + var workplaceAreas = areas.Where(x => x.Type == AppointmentAreaEnumType.Workplace).Select(x => x.CustomCode); + var notExistsAreas = workplaceAreas.Where(x => !item.ApplyWorkplaceAreas.Contains(x)); + throw new UserFriendlyException($"车间区域{notExistsAreas.Join(",")}无效"); + } + var gainfo = await _dbContext.Queryable().Where(x => x.IdNo == item.IdNo || x.Code == item.IdNo).SingleAsync(); //外部人员 if (gainfo == null)