From 3a9ccb0bf9f289505d0a7fc206e23e375943507e Mon Sep 17 00:00:00 2001 From: ludc Date: 星期一, 08 五月 2023 09:12:07 +0800 Subject: [PATCH] 提交code服务的流程模板相关内容 --- Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/AttributeServiceImpl.java | 28 +++++++++++++++++++++++++++- 1 files changed, 27 insertions(+), 1 deletions(-) diff --git a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/AttributeServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/AttributeServiceImpl.java index c61c7f3..a9bba71 100644 --- a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/AttributeServiceImpl.java +++ b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/AttributeServiceImpl.java @@ -1,5 +1,6 @@ package com.vci.ubcs.omd.service.impl; +import com.alibaba.cloud.commons.lang.StringUtils; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -12,6 +13,8 @@ import com.vci.ubcs.omd.vo.AttributeVO; import com.vci.ubcs.omd.wrapper.AttributeWrapper; import com.vci.ubcs.starter.exception.VciBaseException; +import com.vci.ubcs.starter.web.constant.OmdRegExpConstant; +import com.vci.ubcs.starter.web.enumpck.VciFieldTypeEnum; import com.vci.ubcs.starter.web.util.VciBaseUtil; import org.springblade.core.cache.utils.CacheUtil; import org.springblade.core.log.exception.ServiceException; @@ -125,7 +128,6 @@ return true; } - /** * 鏍规嵁鑻辨枃鍚嶇О闆嗗悎鎵归噺鑾峰彇灞炴�у璞� * @@ -180,6 +182,30 @@ */ @Override public boolean checkAttributePass(String id, String attrDataType, Integer attributeLength, String defaultValue) throws VciBaseException { + String attributeDataTypeText = VciFieldTypeEnum.getTextByValue(attrDataType); + if(StringUtils.isBlank(attributeDataTypeText)){ + throw new VciBaseException("鑻辨枃鍚嶇О涓簕0}鐨勫睘鎬х殑绫诲瀷涓嶇鍚堣姹�",new Object[]{id}); + } + //蹇呴』瑕佽緭鍏ラ暱搴� + if( VciBaseUtil.inArray(new String[] {VciFieldTypeEnum.VTString.name()},attrDataType) + && (attributeLength == null ||attributeLength < 1)){ + throw new VciBaseException("鑻辨枃鍚嶇О涓簕0}鐨勫睘鎬х殑涓簕1}绫诲瀷鏃讹紝蹇呴』瑕佽緭鍏ラ暱搴︾殑鍊�",new Object[]{id,attributeDataTypeText}); + } + //鍒ゆ柇榛樿鍊� + if(StringUtils.isNotBlank(defaultValue)){ + if(VciFieldTypeEnum.VTDouble.name().equalsIgnoreCase(attrDataType) + && !defaultValue.matches(OmdRegExpConstant.DOUBLE)){ + throw new VciBaseException("鑻辨枃鍚嶇О涓簕0}鐨勫睘鎬х殑榛樿鍊间笉鏄弻绮惧害绫诲瀷",new Object[]{id}); + } + if(VciFieldTypeEnum.VTInteger.name().equalsIgnoreCase(defaultValue) + && !defaultValue.matches(OmdRegExpConstant.INT)){ + throw new VciBaseException("鑻辨枃鍚嶇О涓簕0}鐨勫睘鎬х殑榛樿鍊间笉鏄暣鏁板瀷",new Object[]{id}); + } + if(VciFieldTypeEnum.VTLong.name().equalsIgnoreCase(defaultValue) + && !defaultValue.matches(OmdRegExpConstant.LONG)){ + throw new VciBaseException("鑻辨枃鍚嶇О涓簕0}鐨勫睘鎬х殑榛樿鍊间笉鏄暱鏁村舰",new Object[]{id}); + } + } return true; } -- Gitblit v1.9.3