diff --git a/Src/Dlhis.Basic/BusinessShift/Services/Implements/BusinessPlaceShiftService.cs b/Src/Dlhis.Basic/BusinessShift/Services/Implements/BusinessPlaceShiftService.cs
index 124833aa..00683db3 100644
--- a/Src/Dlhis.Basic/BusinessShift/Services/Implements/BusinessPlaceShiftService.cs
+++ b/Src/Dlhis.Basic/BusinessShift/Services/Implements/BusinessPlaceShiftService.cs
@@ -236,7 +236,7 @@ public class BusinessPlaceShiftService : IBusinessPlaceShiftService
foreach (var period in periods)
{
- period.IsDuplicate1(request.TimePeriod).ThrowIfTrue($"存在时间段重合[{period.Start}-{period.End}]");
+ period.IsDuplicate(request.TimePeriod).ThrowIfTrue($"存在时间段重合[{period.Start}-{period.End}]");
}
}
diff --git a/Src/Dlhis.Basic/BusinessShift/TimePeriodExtensions.cs b/Src/Dlhis.Basic/BusinessShift/TimePeriodExtensions.cs
deleted file mode 100644
index de255125..00000000
--- a/Src/Dlhis.Basic/BusinessShift/TimePeriodExtensions.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-using Kurisu.AspNetCore.CustomClass;
-
-namespace Dlhis.Basic.BusinessShift;
-
-///
-/// 临时的扩展类 todo: 嵌入框架
-///
-public static class TimePeriodExtensions
-{
- public static bool IsDuplicate1(this TimePeriod current, TimePeriod period)
- {
- return !Check();
-
- bool Check()
- {
- if (current.IsCrossDay())
- {
- if (period.IsCrossDay())
- {
- return true;
- }
- else
- {
- return period.Start > current.End && period.End < current.Start;
- }
- }
- else
- {
- if (period.IsCrossDay())
- {
- return period.Start > current.End && period.End < current.Start;
- }
- else
- {
- return period.Start > current.End || period.End < current.Start;
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/Src/Dlhis.Entity/Visitor/Entity/VisitorAppointmentDetailEntity.cs b/Src/Dlhis.Entity/Visitor/Entity/VisitorAppointmentDetailEntity.cs
index f45203f0..4f288a49 100644
--- a/Src/Dlhis.Entity/Visitor/Entity/VisitorAppointmentDetailEntity.cs
+++ b/Src/Dlhis.Entity/Visitor/Entity/VisitorAppointmentDetailEntity.cs
@@ -55,7 +55,7 @@ public class VisitorAppointmentDetailEntity : SugarBaseEntity
/// 状态
///
[SugarColumn(IsNullable = false, ColumnDescription = "状态", ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert))]
- public AppointmentDetailEnumType Status { get; set; }
+ public VisitorAppointmentDetailStatusEnumType Status { get; set; }
///
/// 备注
diff --git a/Src/Dlhis.Entity/Visitor/Entity/VisitorAppointmentEntity.cs b/Src/Dlhis.Entity/Visitor/Entity/VisitorAppointmentEntity.cs
index e2a59ff2..323449a0 100644
--- a/Src/Dlhis.Entity/Visitor/Entity/VisitorAppointmentEntity.cs
+++ b/Src/Dlhis.Entity/Visitor/Entity/VisitorAppointmentEntity.cs
@@ -1,5 +1,7 @@
-using Kurisu.AspNetCore.DataAccess.SqlSugar;
+using Dlhis.Entity.Visitor.Enums;
+using Kurisu.AspNetCore.DataAccess.SqlSugar;
using SqlSugar;
+using SqlSugar.DbConvert;
namespace Dlhis.Entity.Visitor.Entity;
@@ -39,7 +41,7 @@ public class VisitorAppointmentEntity : SugarBaseEntity
/// 预约门禁区域
///
public string ApplyDoorArea { get; set; }
-
+
///
/// 访客开始
@@ -59,7 +61,8 @@ public class VisitorAppointmentEntity : SugarBaseEntity
///
/// 申请车间区域
///
- public string ApplyWorkplaceArea { get; set; }
+ [SugarColumn(ColumnDescription = "车间区域", IsJson = true, DefaultValue = "[]")]
+ public List ApplyWorkplaceAreas { get; set; }
///
/// 车间访问开始
@@ -70,12 +73,12 @@ public class VisitorAppointmentEntity : SugarBaseEntity
/// 车间访问结束
///
public DateTime? WorkplaceEnd { get; set; }
-
+
///
/// 备注
///
public string Remark { get; set; }
-
+
///
/// 预约厂区
///
@@ -85,4 +88,10 @@ public class VisitorAppointmentEntity : SugarBaseEntity
/// 申请事由
///
public string Reason { get; set; }
+
+ ///
+ /// 状态
+ ///
+ [SugarColumn(IsNullable = false, ColumnDescription = "状态", ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert))]
+ public VisitorAppointmentStatusEnumType Status { get; set; }
}
\ No newline at end of file
diff --git a/Src/Dlhis.Entity/Visitor/Enums/AppointmentDetailEnumType.cs b/Src/Dlhis.Entity/Visitor/Enums/VisitorAppointmentDetailStatusEnumType.cs
similarity index 75%
rename from Src/Dlhis.Entity/Visitor/Enums/AppointmentDetailEnumType.cs
rename to Src/Dlhis.Entity/Visitor/Enums/VisitorAppointmentDetailStatusEnumType.cs
index dec16c8d..d89e45e1 100644
--- a/Src/Dlhis.Entity/Visitor/Enums/AppointmentDetailEnumType.cs
+++ b/Src/Dlhis.Entity/Visitor/Enums/VisitorAppointmentDetailStatusEnumType.cs
@@ -6,7 +6,7 @@ namespace Dlhis.Entity.Visitor.Enums;
/// 访客预约明细状态
///
[Description("预约状态")]
-public enum AppointmentDetailEnumType
+public enum VisitorAppointmentDetailStatusEnumType
{
///
/// 待来访
@@ -25,11 +25,16 @@ public enum AppointmentDetailEnumType
///
[Description("到达")]
Arrived = 10,
-
-
+
///
/// 离开
///
[Description("离开")]
- Leave = 99
+ Leave = 11,
+
+ ///
+ /// 作废
+ ///
+ [Description("作废")]
+ Obsolete = 99
}
diff --git a/Src/Dlhis.Entity/Visitor/Enums/VisitorAppointmentDetailEnumType.cs b/Src/Dlhis.Entity/Visitor/Enums/VisitorAppointmentStatusEnumType.cs
similarity index 70%
rename from Src/Dlhis.Entity/Visitor/Enums/VisitorAppointmentDetailEnumType.cs
rename to Src/Dlhis.Entity/Visitor/Enums/VisitorAppointmentStatusEnumType.cs
index fe0c852c..e8659094 100644
--- a/Src/Dlhis.Entity/Visitor/Enums/VisitorAppointmentDetailEnumType.cs
+++ b/Src/Dlhis.Entity/Visitor/Enums/VisitorAppointmentStatusEnumType.cs
@@ -6,17 +6,17 @@ namespace Dlhis.Entity.Visitor.Enums;
/// 访客预约明细状态
///
[Description("访客预约状态")]
-public enum VisitorAppointmentDetailEnumType
+public enum VisitorAppointmentStatusEnumType
{
///
/// 到达
///
[Description("到达")]
- Arrived = 1,
+ Valid = 1,
///
- /// 离开
+ /// 作废
///
- [Description("离开")]
- Leave = 99
+ [Description("作废")]
+ Obsolete = 99
}
diff --git a/Src/Dlhis.External/Appointment/Controllers/AppointmentsController.cs b/Src/Dlhis.External/Appointment/Controllers/AppointmentsController.cs
index 48b3237a..7ec97c52 100644
--- a/Src/Dlhis.External/Appointment/Controllers/AppointmentsController.cs
+++ b/Src/Dlhis.External/Appointment/Controllers/AppointmentsController.cs
@@ -30,7 +30,7 @@ public class AppointmentsController : ControllerBase
[Transactional]
[IgnoreTenant]
[HttpPost("receive")]
- public async Task ReceiveAsync(AppointmentReceiveRequest request)
+ public async Task ReceiveAsync(VisitorAppointmentReceiveRequest request)
{
await _appointmentService.ReceiveAsync(request);
}
diff --git a/Src/Dlhis.External/Appointment/Request/AppointmentReceiveRequest.cs b/Src/Dlhis.External/Appointment/Request/VisitorAppointmentReceiveRequest.cs
similarity index 67%
rename from Src/Dlhis.External/Appointment/Request/AppointmentReceiveRequest.cs
rename to Src/Dlhis.External/Appointment/Request/VisitorAppointmentReceiveRequest.cs
index ad46a4c9..c426c6a3 100644
--- a/Src/Dlhis.External/Appointment/Request/AppointmentReceiveRequest.cs
+++ b/Src/Dlhis.External/Appointment/Request/VisitorAppointmentReceiveRequest.cs
@@ -4,7 +4,7 @@ using Kurisu.AspNetCore.Utils.Extensions;
namespace Dlhis.External.Appointment.Request;
-public class AppointmentReceiveRequest : IValidatableObject
+public class VisitorAppointmentReceiveRequest : IValidatableObject
{
///
/// 流水号
@@ -59,7 +59,7 @@ public class AppointmentReceiveRequest : IValidatableObject
///
/// 申请车间区域
///
- public string ApplyWorkplaceArea { get; set; }
+ public List ApplyWorkplaceAreas { get; set; }
///
/// 车间访问开始
@@ -99,12 +99,35 @@ public class AppointmentReceiveRequest : IValidatableObject
{
if (DoorStart >= DoorEnd)
{
- yield return new ValidationResult("门禁来访时间不能大于等于离开时间", new[] { nameof(DoorStart), nameof(DoorEnd) });
+ yield return new ValidationResult("门禁来访时间有误", new[] { nameof(DoorStart) });
}
if (IsEnterWorkplace)
{
+ if (ApplyWorkplaceAreas.IsEmpty())
+ {
+ yield return new ValidationResult("车间区域不可为空", new[] { nameof(ApplyWorkplaceAreas) });
+ }
+ if (WorkplaceStart >= WorkplaceEnd)
+ {
+ yield return new ValidationResult("车间来访时间有误", new[] { nameof(WorkplaceStart) });
+ }
+
+ if (WorkplaceStart < DoorStart || WorkplaceStart > DoorEnd)
+ {
+ yield return new ValidationResult("车间来访时间需在门禁时间范围内", new[] { nameof(WorkplaceStart) });
+ }
+
+ if (WorkplaceEnd < DoorStart || WorkplaceEnd > DoorEnd)
+ {
+ yield return new ValidationResult("车间来访时间需在门禁时间范围内", new[] { nameof(WorkplaceStart) });
+ }
+
+ if (Items.Any(x => x.ImageUrl.IsEmpty()))
+ {
+ yield return new ValidationResult("请上传社保照片", new[] { nameof(WorkplaceStart) });
+ }
}
}
}
\ No newline at end of file
diff --git a/Src/Dlhis.External/Appointment/Services/IAppointmentService.cs b/Src/Dlhis.External/Appointment/Services/IAppointmentService.cs
index 1a730865..7dab3e68 100644
--- a/Src/Dlhis.External/Appointment/Services/IAppointmentService.cs
+++ b/Src/Dlhis.External/Appointment/Services/IAppointmentService.cs
@@ -4,5 +4,5 @@ namespace Dlhis.External.Appointment.Services;
public interface IAppointmentService : IScopeDependency
{
- Task ReceiveAsync(AppointmentReceiveRequest request);
+ Task ReceiveAsync(VisitorAppointmentReceiveRequest request);
}
\ No newline at end of file
diff --git a/Src/Dlhis.External/Appointment/Services/Implements/AppointmentService.cs b/Src/Dlhis.External/Appointment/Services/Implements/AppointmentService.cs
index 072069e1..5bc3edeb 100644
--- a/Src/Dlhis.External/Appointment/Services/Implements/AppointmentService.cs
+++ b/Src/Dlhis.External/Appointment/Services/Implements/AppointmentService.cs
@@ -21,12 +21,27 @@ public class AppointmentService : IAppointmentService
_redisCache = redisCache;
}
- public async Task ReceiveAsync(AppointmentReceiveRequest request)
+ public async Task ReceiveAsync(VisitorAppointmentReceiveRequest request)
{
var exists = await _dbContext.Queryable().Where(x => x.No == request.No).AnyAsync();
exists.ThrowIfTrue("已经存在申请");
- var id = await _dbContext.InsertReturnIdentityAsync(new VisitorAppointmentEntity
+ var existsDoorArea = await _dbContext.Queryable()
+ .Where(x => x.TenantId == request.Factory)
+ .Where(x => x.Name == request.ApplyDoorArea)
+ .AnyAsync();
+
+ var existsWorkplace = true;
+ if (request.IsEnterWorkplace)
+ {
+ var count = await _dbContext.Queryable().Where(x => x.TenantId == request.Factory)
+ .Where(x => request.ApplyWorkplaceAreas.Contains(x.Name))
+ .CountAsync();
+
+ existsWorkplace = request.ApplyWorkplaceAreas.Count == count;
+ }
+
+ var mst = new VisitorAppointmentEntity
{
Id = 0,
CreatedBy = 0,
@@ -45,10 +60,16 @@ public class AppointmentService : IAppointmentService
DoorEnd = request.DoorEnd,
Remark = request.Remark,
IsEnterWorkplace = request.IsEnterWorkplace,
- ApplyWorkplaceArea = request.ApplyWorkplaceArea,
+ ApplyWorkplaceAreas = request.ApplyWorkplaceAreas,
WorkplaceStart = request.WorkplaceStart,
WorkplaceEnd = request.WorkplaceEnd
- });
+ };
+ if (!existsDoorArea || !existsWorkplace)
+ {
+ mst.Status = VisitorAppointmentStatusEnumType.Obsolete;
+ }
+
+ await _dbContext.InsertAsync(mst);
foreach (var item in request.Items)
{
@@ -90,7 +111,9 @@ public class AppointmentService : IAppointmentService
Name = item.Name,
Phone = item.Phone,
Remark = item.Remark,
- Status = AppointmentDetailEnumType.Wait,
+ Status = mst.Status == VisitorAppointmentStatusEnumType.Valid
+ ? VisitorAppointmentDetailStatusEnumType.Wait
+ : VisitorAppointmentDetailStatusEnumType.Obsolete,
LicensePlate = item.LicensePlate
};
diff --git a/Src/Gateway/Properties/launchSettings.json b/Src/Gateway/Properties/launchSettings.json
index 34ddc54f..c9a8e63f 100644
--- a/Src/Gateway/Properties/launchSettings.json
+++ b/Src/Gateway/Properties/launchSettings.json
@@ -7,7 +7,7 @@
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": true,
- "applicationUrl": "http://*:6000"
+ "applicationUrl": "http://localhost:5000"
}
},
"$schema": "https://json.schemastore.org/launchsettings.json"
diff --git a/Src/Gateway/Startup.cs b/Src/Gateway/Startup.cs
index df6632a6..faa2187a 100644
--- a/Src/Gateway/Startup.cs
+++ b/Src/Gateway/Startup.cs
@@ -16,10 +16,7 @@ public class Startup
public void ConfigureServices(IServiceCollection services)
{
services.AddEndpointsApiExplorer();
- services.AddSwaggerGen(c =>
- {
- c.SwaggerDoc("v1", new OpenApiInfo { Title = "Gateway API", Version = "v1", Description = "gateway api" });
- });
+ services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "Gateway API", Version = "v1", Description = "gateway api" }); });
services.AddOcelot();
}
@@ -37,5 +34,4 @@ public class Startup
});
app.UseOcelot().Wait();
}
-
-}
+}
\ No newline at end of file
diff --git a/Src/Gateway/ocelot.Development.json b/Src/Gateway/ocelot.Development.json
index 45f461c0..810f246f 100644
--- a/Src/Gateway/ocelot.Development.json
+++ b/Src/Gateway/ocelot.Development.json
@@ -44,6 +44,17 @@
}
]
},
+ {
+ "UpstreamPathTemplate": "/basic/swagger/v1/swagger.json",
+ "DownstreamPathTemplate": "/swagger/v1/swagger.json",
+ "DownstreamScheme": "http",
+ "DownstreamHostAndPorts": [
+ {
+ "Host": "localhost",
+ "Port": 5002
+ }
+ ]
+ },
{
"UpstreamPathTemplate": "/api/scheduled/{url}",
"DownstreamPathTemplate": "/api/{url}",
@@ -66,14 +77,25 @@
}
]
},
+ {
+ "UpstreamPathTemplate": "/api/external/{url}",
+ "DownstreamPathTemplate": "/api/{url}",
+ "DownstreamScheme": "http",
+ "DownstreamHostAndPorts": [
+ {
+ "Host": "localhost",
+ "Port": 5020
+ }
+ ]
+ },
{
"UpstreamPathTemplate": "/{url}/swagger/v1/swagger.json",
"DownstreamPathTemplate": "/{url}/swagger/v1/swagger.json",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
- "Host": "192.168.199.115",
- "Port": 6000
+ "Host": "localhost",
+ "Port": 5000
}
]
}