系统配置-封边条校验规则修改

This commit is contained in:
liuzhaotian
2025-04-01 10:47:37 +08:00
parent 1ceb48e108
commit 6916f7a9f1
2 changed files with 23 additions and 8 deletions
@@ -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 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 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_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_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_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 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 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 位,请进行修改");
@@ -20,6 +20,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List; import java.util.List;
@@ -73,16 +74,29 @@ public class SealedgeServiceHandler extends AbstractSystemConfigServiceHandler {
throw exception(SEALEDGE_CONFIG_NOT_EXISTS,(i+1)); throw exception(SEALEDGE_CONFIG_NOT_EXISTS,(i+1));
} }
if(Integer.parseInt(widthMin) > Integer.parseInt(widthValue) ){ BigDecimal widthMin2 = BigDecimal.valueOf(Double.parseDouble(widthMin));
throw exception(SEALEDGE_CONFIG_MIN_VALUE_DATA_ERROR,(i+1));
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){ catch (ServiceException e){
throw e; throw e;
}catch (Exception e){ }catch (Exception e){
@@ -120,12 +134,12 @@ public class SealedgeServiceHandler extends AbstractSystemConfigServiceHandler {
@Override @Override
public void updateConfigStatus(ConfigUpdateStatusReqVO reqVO) { public void updateConfigStatus(ConfigUpdateStatusReqVO reqVO) {
// TODO document why this method is empty
} }
@Override @Override
public void updateConfigSort(List<ConfigUpdateSortReqVO> reqVO) { public void updateConfigSort(List<ConfigUpdateSortReqVO> reqVO) {
// TODO document why this method is empty
} }