| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | */ |
| | | @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; |
| | | } |
| | | |