| | |
| | | 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.cache.EnumCache; |
| | | import com.vci.ubcs.omd.constant.BtmTypeConstant; |
| | | import com.vci.ubcs.omd.constant.BtmTypeFieldConstant; |
| | | import com.vci.ubcs.omd.dto.BtmAndLinkTypeDdlDTO; |
| | | import com.vci.ubcs.omd.entity.*; |
| | | import com.vci.ubcs.omd.enums.EnumEnum; |
| | | import com.vci.ubcs.omd.repeater.DomainRepeater; |
| | | import com.vci.ubcs.omd.service.*; |
| | | import com.vci.ubcs.omd.vo.*; |
| | |
| | | * @throws ServiceException 参数为空的时候会抛出异常 |
| | | */ |
| | | @Override |
| | | public String getTableName(String id,String domain) throws ServiceException { |
| | | public String getTableName(String id,String domain) throws VciBaseException { |
| | | VciBaseUtil.alertNotNull(id,"业务类型英文名称",domain,"领域名称"); |
| | | if (domain.contains("ubcs-")){ |
| | | domain = domain.split("ubcs-")[1]; |
| | |
| | | transaction = dataSourceTransactionManager.getTransaction(def); |
| | | // 获得事务状态 |
| | | }*/ |
| | | checkBtmTypeBeforeSave(btmTypeDTO); |
| | | //checkBtmTypeBeforeSave(btmTypeDTO); |
| | | BtmType btmTypeDO = Optional.ofNullable(BeanUtil.copy(btmTypeDTO, BtmType.class)).orElseGet(BtmType::new); |
| | | btmTypeDO.setBizDomain(btmTypeDTO.getBizDomain()); |
| | | List<BtmTypeLinkAttributesDTO> attributes = btmTypeDTO.getAttributes(); |
| | |
| | | }); |
| | | return total[0]; |
| | | } |
| | | |
| | | /** |
| | | * 获取默认属性 |
| | | * @param defaultAttrType |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<BtmTypeAttributeVO> getDefaultAttr(String defaultAttrType) { |
| | | List<BtmTypeAttributeVO> list = new ArrayList<>(); |
| | | // 业务类型的默认基本字段 |
| | | if(defaultAttrType.equals("defaultAttr")){ |
| | | BtmTypeFieldConstant.BASIC_FIELD_MAP.forEach((id,name) -> { |
| | | id = id.toLowerCase(Locale.ROOT); |
| | | BtmTypeAttributeVO vo = new BtmTypeAttributeVO(); |
| | | vo.setId(id); |
| | | vo.setName(name); |
| | | vo.setIsDefaultAttr(true); |
| | | if ("oid".equals(id)){ |
| | | vo.setNullableFlag(false); |
| | | } |
| | | if (Arrays.asList("createtime","lastmodifytime","ts").contains(id)){ |
| | | vo.setAttrDataType(VciFieldTypeEnum.VTDateTime.name()); |
| | | vo.setAttributeLength(6); |
| | | }else { |
| | | vo.setAttrDataType(VciFieldTypeEnum.VTString.name()); |
| | | vo.setAttributeLength(150); |
| | | } |
| | | list.add(vo); |
| | | }); |
| | | |
| | | BtmTypeFieldConstant.MASTERDATA_FIELD_MAP.forEach((id,name) -> { |
| | | id = id.toLowerCase(Locale.ROOT); |
| | | BtmTypeAttributeVO vo = new BtmTypeAttributeVO(); |
| | | vo.setId(id); |
| | | vo.setName(name); |
| | | vo.setIsDefaultAttr(false); |
| | | if (Arrays.asList("codeclsfpath").contains(id)){ |
| | | vo.setAttrDataType(VciFieldTypeEnum.VTString.name()); |
| | | vo.setAttributeLength(500); |
| | | }else { |
| | | vo.setAttrDataType(VciFieldTypeEnum.VTString.name()); |
| | | vo.setAttributeLength(255); |
| | | } |
| | | list.add(vo); |
| | | }); |
| | | } |
| | | |
| | | // 版本规则字段 |
| | | if (defaultAttrType.equals("reVersionRule")){ |
| | | BtmTypeFieldConstant.REVISION_MANAGE_FIELD_MAP.forEach((id,name) -> { |
| | | BtmTypeAttributeVO vo = new BtmTypeAttributeVO(); |
| | | vo.setId(id); |
| | | vo.setName(name); |
| | | vo.setAttrDataType(VciFieldTypeEnum.VTString.name()); |
| | | // 版本规则字段不能为空 |
| | | // vo.setNullableFlag(false); |
| | | vo.setAttributeLength(150); |
| | | vo.setIsDefaultAttr(true); |
| | | if (Arrays.asList("revisionseq","versionseq").contains(id)){ |
| | | vo.setAttributeLength(5); |
| | | vo.setAttrDataType(VciFieldTypeEnum.VTInteger.name()); |
| | | } |
| | | if (Arrays.asList("checkintime","checkouttime").contains(id)){ |
| | | vo.setAttrDataType(VciFieldTypeEnum.VTDateTime.name()); |
| | | vo.setAttributeLength(6); |
| | | } |
| | | list.add(vo); |
| | | }); |
| | | } |
| | | |
| | | // 生命周期字段 |
| | | if (defaultAttrType.equals("lifeCycle")){ |
| | | BtmTypeFieldConstant.LIFECYCLE_MANAGE_FIELD_MAP.forEach((id,name) -> { |
| | | BtmTypeAttributeVO vo = new BtmTypeAttributeVO(); |
| | | vo.setId(id); |
| | | vo.setName(name); |
| | | // vo.setNullableFlag(false); |
| | | vo.setIsDefaultAttr(true); |
| | | vo.setAttributeLength(50); |
| | | vo.setAttrDataType(VciFieldTypeEnum.VTString.name()); |
| | | list.add(vo); |
| | | }); |
| | | } |
| | | |
| | | // 设置字段类型中文显示值,和排序 |
| | | List<BtmTypeAttributeVO> sortedList = list.stream() |
| | | .sorted(Comparator.comparing(BtmTypeAttributeVO::getIsDefaultAttr)) |
| | | .map(item-> { |
| | | item.setAttrDataTypeText(EnumCache.getValue(EnumEnum.VCI_FIELD_TYPE, item.getAttrDataType())); |
| | | return item; |
| | | }).collect(Collectors.toList()); |
| | | return sortedList; |
| | | } |
| | | |
| | | } |