diff --git a/Src/Dlhis.Canteen/Setting/Services/Implements/CanteenSettingService.cs b/Src/Dlhis.Canteen/Setting/Services/Implements/CanteenSettingService.cs index d3dfde7c..7622a450 100644 --- a/Src/Dlhis.Canteen/Setting/Services/Implements/CanteenSettingService.cs +++ b/Src/Dlhis.Canteen/Setting/Services/Implements/CanteenSettingService.cs @@ -9,6 +9,7 @@ using Kurisu.SqlSugar.Extensions; using Kurisu.SqlSugar.Services; using Mapster; using Newtonsoft.Json.Linq; +using System; using System.ComponentModel.DataAnnotations; using System.Globalization; @@ -75,7 +76,7 @@ public class CanteenSettingService : ICanteenSettingService var result = request.Item switch { //TimeOnly - CanteenSettingItemEnumType.BusinessSwitchTime => IsValidFormat(value), + CanteenSettingItemEnumType.BusinessSwitchTime => IsValidFormat(value, request.Item), //int CanteenSettingItemEnumType.DayEVoucherUseCountMax => IsValidFormat(value), @@ -88,9 +89,9 @@ public class CanteenSettingService : ICanteenSettingService CanteenSettingItemEnumType.InitBalance => IsValidFormat(value), //bool - CanteenSettingItemEnumType.AllowSendAtMeal => IsValidFormat(value), - CanteenSettingItemEnumType.AllowRepeatInOneShift => IsValidFormat(value), - CanteenSettingItemEnumType.AllowCrossTenant => IsValidFormat(value), + CanteenSettingItemEnumType.AllowSendAtMeal => IsValidFormat(value, request.Item), + CanteenSettingItemEnumType.AllowRepeatInOneShift => IsValidFormat(value,request.Item), + CanteenSettingItemEnumType.AllowCrossTenant => IsValidFormat(value, request.Item), _ => throw new NotImplementedException(), }; @@ -162,8 +163,29 @@ public class CanteenSettingService : ICanteenSettingService { try { + //判断0/1 + if (type == CanteenSettingItemEnumType.AllowSendAtMeal || + type == CanteenSettingItemEnumType.AllowRepeatInOneShift || + type == CanteenSettingItemEnumType.AllowCrossTenant) + { + var intvaule = int.Parse(value); + if (intvaule == 0 || intvaule == 1) + { + return true; + } + else + { + return false; + } + } + if(type == CanteenSettingItemEnumType.BusinessSwitchTime) + { + var timeOnly = value.Adapt(); + return timeOnly.Minute == 0 && timeOnly.Second == 0; + } //mapster - value.Adapt(); + value.Adapt(); + } catch (Exception) {