From 6916f7a9f1a22764b6aaeb7f3a04031a320962ba Mon Sep 17 00:00:00 2001 From: liuzhaotian Date: Tue, 1 Apr 2025 10:47:37 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E9=85=8D=E7=BD=AE-=E5=B0=81?= =?UTF-8?q?=E8=BE=B9=E6=9D=A1=E6=A0=A1=E9=AA=8C=E8=A7=84=E5=88=99=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/enums/ErrorCodeConstants.java | 5 ++-- .../service/impl/SealedgeServiceHandler.java | 26 ++++++++++++++----- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/cf-module-system/cf-module-system-api/src/main/java/com/cf/imes/module/system/enums/ErrorCodeConstants.java b/cf-module-system/cf-module-system-api/src/main/java/com/cf/imes/module/system/enums/ErrorCodeConstants.java index c053e191a..78320bd7e 100644 --- a/cf-module-system/cf-module-system-api/src/main/java/com/cf/imes/module/system/enums/ErrorCodeConstants.java +++ b/cf-module-system/cf-module-system-api/src/main/java/com/cf/imes/module/system/enums/ErrorCodeConstants.java @@ -387,10 +387,11 @@ public class ErrorCodeConstants { public static final ErrorCode PROCESS_CONFIG_USED_ALREADY = new ErrorCode(1_002_040_021, "当前加工分线配置在加工方案组中已使用,无法删除"); public static final ErrorCode OPTIMIZATION_CONFIG_USED_ALREADY = new ErrorCode(1_002_040_022, "当前数据处理配置在加工方案组中已使用,无法删除"); public static final ErrorCode SEALEDGE_CONFIG_NOT_EXISTS = new ErrorCode(1_002_040_023, "第 {} 条配置中,有字段值为空,请添加数据"); - public static final ErrorCode SEALEDGE_CONFIG_MIN_VALUE_DATA_ERROR = new ErrorCode(1_002_040_024, "第 {} 条配置中,宽最小值大于宽取值,请修改数据"); - public static final ErrorCode SEALEDGE_CONFIG_MAX_VALUE_DATA_ERROR = new ErrorCode(1_002_040_025, "第 {} 条配置中,宽最大值小于宽取值,请修改数据"); + public static final ErrorCode SEALEDGE_CONFIG_MIN_VALUE_DATA_ERROR = new ErrorCode(1_002_040_024, "第 {} 条配置中,宽最小值:{} 要大于0,请修改数据"); + public static final ErrorCode SEALEDGE_CONFIG_MAX_VALUE_DATA_ERROR = new ErrorCode(1_002_040_025, "第 {} 条配置中,{} 要大于等于 {},请修改数据"); public static final ErrorCode SEALEDGE_CONFIG_DATA_ERROR = new ErrorCode(1_002_040_026, "当前封边条配置有误,请重新检查后新增"); public static final ErrorCode THIS_CONFIG_NAME_IS_EXISTS = new ErrorCode(1_002_040_027, "当前配置的名称已存在,请重新命名"); + public static final ErrorCode DECIMAL_PLACES_MAX_TWO = new ErrorCode(1_002_040_028, "第 {} 条配置中,小数位数最大为 2 位,请进行修改"); diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/systemconfig/factory/service/impl/SealedgeServiceHandler.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/systemconfig/factory/service/impl/SealedgeServiceHandler.java index 504c8b023..440de2d09 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/systemconfig/factory/service/impl/SealedgeServiceHandler.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/systemconfig/factory/service/impl/SealedgeServiceHandler.java @@ -20,6 +20,7 @@ import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.List; @@ -73,16 +74,29 @@ public class SealedgeServiceHandler extends AbstractSystemConfigServiceHandler { throw exception(SEALEDGE_CONFIG_NOT_EXISTS,(i+1)); } - if(Integer.parseInt(widthMin) > Integer.parseInt(widthValue) ){ - throw exception(SEALEDGE_CONFIG_MIN_VALUE_DATA_ERROR,(i+1)); + BigDecimal widthMin2 = BigDecimal.valueOf(Double.parseDouble(widthMin)); + + BigDecimal widthMax2 = BigDecimal.valueOf(Double.parseDouble(widthMax)); + + BigDecimal widthValue2 = BigDecimal.valueOf(Double.parseDouble(widthValue)); + + + if(widthMin2.scale() > 3 || widthMax2.scale() > 3 || widthValue2.scale() > 3 ){ + throw exception(DECIMAL_PLACES_MAX_TWO,(i+1)); } - if(Integer.parseInt(widthMax) < Integer.parseInt(widthValue) ){ - throw exception(SEALEDGE_CONFIG_MAX_VALUE_DATA_ERROR,(i+1)); + + if( widthMin2.compareTo(BigDecimal.ZERO) != 1 ){ + throw exception(SEALEDGE_CONFIG_MIN_VALUE_DATA_ERROR,(i+1),widthMin2.stripTrailingZeros().toPlainString()); + } + + if( widthValue2.compareTo(widthMax2) == -1 ){ + throw exception(SEALEDGE_CONFIG_MAX_VALUE_DATA_ERROR,(i+1),widthValue2.stripTrailingZeros().toPlainString(),widthMax2.stripTrailingZeros().toPlainString()); } } } + catch (ServiceException e){ throw e; }catch (Exception e){ @@ -120,12 +134,12 @@ public class SealedgeServiceHandler extends AbstractSystemConfigServiceHandler { @Override public void updateConfigStatus(ConfigUpdateStatusReqVO reqVO) { - + // TODO document why this method is empty } @Override public void updateConfigSort(List reqVO) { - + // TODO document why this method is empty }