diff --git a/Src/Dlhis.Canteen/Setting/Request/CanteenSettingSaveRequest.cs b/Src/Dlhis.Canteen/Setting/Request/CanteenSettingSaveRequest.cs index 093c72cf..1d8fa4da 100644 --- a/Src/Dlhis.Canteen/Setting/Request/CanteenSettingSaveRequest.cs +++ b/Src/Dlhis.Canteen/Setting/Request/CanteenSettingSaveRequest.cs @@ -1,9 +1,12 @@ -using System.ComponentModel.DataAnnotations; +using System; +using System.ComponentModel.DataAnnotations; using Dlhis.Entity.Canteen.Enums; +using Kurisu.AspNetCore.Utils.Extensions; +using Org.BouncyCastle.Asn1.X509.SigI; namespace Dlhis.Canteen.Setting.Request; -public class CanteenSettingSaveRequest +public class CanteenSettingSaveRequest : IValidatableObject { public long? Id { get; set; } @@ -16,7 +19,6 @@ public class CanteenSettingSaveRequest /// /// 配置生效范围 /// - [Required(ErrorMessage = "配置生效范围不能为空")] public string UniqueValue { get; set; } /// @@ -35,4 +37,12 @@ public class CanteenSettingSaveRequest /// 参数值 /// public string Value { get; set; } + + public IEnumerable Validate(ValidationContext validationContext) + { + if (UniqueType != CanteenSettingUnqiueEnumType.Tenant && UniqueValue.IsEmpty()) + { + yield return new ValidationResult($"配置{UniqueType.GetDescription()}值不能为空", new string[] { nameof(UniqueValue) }); + } + } } diff --git a/Src/Dlhis.Entity/Canteen/Enums/CanteenSettingItemEnumType.cs b/Src/Dlhis.Entity/Canteen/Enums/CanteenSettingItemEnumType.cs index d24dc5bd..1b01b10f 100644 --- a/Src/Dlhis.Entity/Canteen/Enums/CanteenSettingItemEnumType.cs +++ b/Src/Dlhis.Entity/Canteen/Enums/CanteenSettingItemEnumType.cs @@ -8,28 +8,20 @@ namespace Dlhis.Entity.Canteen.Enums; [Description("就餐配置项")] public enum CanteenSettingItemEnumType { - //# BusinessSwitchTime varchar(255) not null comment '营业点切换时间 HH:00:00', - //# DayCostMax decimal(16, 2) not null comment '每日允许消费最高金额(存在普通模式)', - //# DayMarketCostMax decimal(16, 2) not null comment '每日超市允许消费最高金额', - //# AllowSendAtMeal bit not null comment '允许就餐下发', - //# DayEVoucherUseCountMax int not null comment '电子券每天使用最多次数', - //# Subsidies decimal(16, 2) not null comment '补贴', - //# AllowRepeatInOneShift bit not null comment '允许一餐次多次消费', - //# OnceCostMax decimal(16, 2) not null comment '一次最高消费金额', - //# AllowCrossTenant bit not null comment '允许跨基地消费', - //# InitBalance decimal(16, 2) not null comment '初始金额', - /// /// 营业点切换时间 /// [Description("营业点切换时间(HH:00:00)")] - BusinessSwitchTime = 1, + BusinessSwitchTime = 100, + + + //----------------------------------------------------------------[200,300)-------------------------------------------------------------------------------------- /// /// 每日允许消费最高金额 /// [Description("每日允许消费最高金额(decimal)")] - DayCostMax, + DayCostMax = 200, /// /// 每日超市允许消费最高金额 @@ -37,17 +29,18 @@ public enum CanteenSettingItemEnumType [Description("每日超市允许消费最高金额(decimal)")] DayMarketCostMax, - /// - /// 允许就餐下发 - /// - [Description("允许就餐下发(0/1)")] - AllowSendAtMeal, /// - /// 电子券每天使用最多次数 + /// 一次最高消费金额 /// - [Description("电子券每天使用最多次数(int)")] - DayEVoucherUseCountMax, + [Description("一次最高消费金额(decimal)")] + OnceCostMax, + + /// + /// 初始金额 + /// + [Description("初始金额(decimal)")] + InitBalance, /// /// 补贴 @@ -55,28 +48,35 @@ public enum CanteenSettingItemEnumType [Description("补贴(decimal)")] Subsidies, + + //--------------------------------------------------------------------[300,400)---------------------------------------------------------------------------------- + + /// + /// 允许就餐下发 + /// + [Description("允许就餐下发(0/1)")] + AllowSendAtMeal = 300, + + /// /// 允许一餐次多次消费 /// [Description("允许一餐次多次消费(0/1)")] AllowRepeatInOneShift, - /// - /// 一次最高消费金额 - /// - [Description("一次最高消费金额(decimal)")] - OnceCostMax, - - /// /// 允许跨基地消费 /// [Description("允许跨基地消费(0/1)")] AllowCrossTenant, + + //--------------------------------------------------------------------[400,500)---------------------------------------------------------------------------------- + /// - /// 初始金额 + /// 电子券每天使用最多次数 /// - [Description("初始金额(decimal)")] - InitBalance, + [Description("电子券每天使用最多次数(int)")] + DayEVoucherUseCountMax = 400, + }