From 45dbd5ceeb176c2807e06db5c16dd2fe1a6f4fae Mon Sep 17 00:00:00 2001 From: cheche <717840555@qq.com> Date: Fri, 12 Jan 2024 12:40:35 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E9=85=8D=E7=BD=AE=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C=E5=88=86=E7=A7=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Implements/CanteenSettingService.cs | 32 ++++++++++++++++--- 1 file changed, 27 insertions(+), 5 deletions(-) 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) {