| | |
| | | /** |
| | | * 表名前缀 |
| | | */ |
| | | public static final String PL = "PL"; |
| | | public static final String PL = "PLBT"; |
| | | |
| | | /** |
| | | * 设置平台本身的业务类型 |
| | |
| | | @Override |
| | | public BtmTypeVO getBtmTypeByOid(String pkBtmType) throws ServiceException { |
| | | Func.requireNotNull(pkBtmType,"业务类型主键不能为空"); |
| | | BtmTypeVO btmTypeVO = BtmTypeWrapper.build().entityVO(baseMapper.selectOne(Wrappers.<BtmType>query().lambda().eq(BtmType::getOid, pkBtmType))); |
| | | BtmType queryBtmType = baseMapper.selectOne(Wrappers.<BtmType>query().lambda().eq(BtmType::getOid, pkBtmType)); |
| | | if (queryBtmType == null){ |
| | | return null; |
| | | } |
| | | BtmTypeVO btmTypeVO = BtmTypeWrapper.build().entityVO(queryBtmType); |
| | | btmTypeVO.setAttributes(btmTypeAttributeService.getAttributeByBtmTypeOid(pkBtmType)); |
| | | return btmTypeVO; |
| | | } |
| | |
| | | if (!existFieldMap.containsKey(k)){ |
| | | BtmTypeLinkAttributesDTO attr = new BtmTypeLinkAttributesDTO(); |
| | | attr.setId(k); |
| | | attr.setName(v); |
| | | attr.setAttrDataType(VciFieldTypeEnum.VTString.name()); |
| | | attr.setAttributeLength(50); |
| | | attr.setNullableFlag(false); |
| | |
| | | afterAttributes = updateAttributeForBtm(btmTypeByOid.getOid(),beforeAttributes, attributes); |
| | | } |
| | | BtmTypeVO btmTypeVO = BtmTypeWrapper.build().entityVO(btmTypeDO); |
| | | //在创建表的时候还需要把默认的字段带上。 |
| | | List<BtmTypeAttributeVO> defaultAttribute = btmTypeAttributeService.getDefaultAttribute(btmTypeVO); |
| | | afterAttributes.addAll(defaultAttribute); |
| | | btmTypeVO.setAttributes(afterAttributes); |
| | | try { |
| | | if (autoCreateTable) { |
| | | checkTableSame(btmTypeVO); |
| | | // checkTableSame(btmTypeVO); |
| | | R result = DomainRepeater.submitBtmType(btmTypeDTO.getDomain(), btmTypeVO); |
| | | if (result.isSuccess()){ |
| | | List<ModifyAttributeInfo> infoList = new ArrayList<>(); |
| | |
| | | // 需要控制版本 |
| | | // 检查使用的版本规则是否存在 |
| | | if (StringUtils.isNotBlank(btmTypeDTO.getRevisionRuleId())) { |
| | | if (revisionRuleService.checkRevisionRuleExist(btmTypeDTO.getRevisionRuleId())) { |
| | | if (!revisionRuleService.checkRevisionRuleExist(btmTypeDTO.getRevisionRuleId())) { |
| | | throw new VciBaseException("版本规则{0}[{1}]在系统中不存在,请先查证", |
| | | new Object[]{btmTypeDTO.getRevisionRuleId(), btmTypeDTO.getRevisionRuleName()}); |
| | | } |
| | | } |
| | | btmTypeDTO.setAttributes(addAttributeByFieldMap(btmTypeDTO.getAttributes(),BtmTypeFieldConstant.REVISION_MANAGE_FIELD_MAP)); |
| | | // btmTypeDTO.setAttributes(addAttributeByFieldMap(btmTypeDTO.getAttributes(),BtmTypeFieldConstant.REVISION_MANAGE_FIELD_MAP)); |
| | | } |
| | | if (btmTypeDTO.isLifeCycleFlag()){ |
| | | // 需要控制生命周期 |
| | |
| | | // new Object[]{btmTypeDTO.getSubLifeCycleId(), btmTypeDTO.getSubLifeCycleName()}); |
| | | // } |
| | | // } |
| | | btmTypeDTO.setAttributes(addAttributeByFieldMap(btmTypeDTO.getAttributes(),BtmTypeFieldConstant.LIFECYCLE_MANAGE_FIELD_MAP)); |
| | | // btmTypeDTO.setAttributes(addAttributeByFieldMap(btmTypeDTO.getAttributes(),BtmTypeFieldConstant.LIFECYCLE_MANAGE_FIELD_MAP)); |
| | | } |
| | | if (btmTypeDTO.isSecretFlag()){ |
| | | // 需要控制密级 |
| | | btmTypeDTO.setAttributes(addAttributeByFieldMap(btmTypeDTO.getAttributes(),BtmTypeFieldConstant.SECRET_MANAGE_FIELD_MAP)); |
| | | // btmTypeDTO.setAttributes(addAttributeByFieldMap(btmTypeDTO.getAttributes(),BtmTypeFieldConstant.SECRET_MANAGE_FIELD_MAP)); |
| | | } |
| | | } |
| | | @Override |
| | |
| | | * @return 查询结果 |
| | | */ |
| | | @Override |
| | | public List<BtmTypeTreeVO> treeDomain() { |
| | | public List<BtmTreeVO> treeDomain() { |
| | | try { |
| | | Map<String, String> domain = Optional.ofNullable(DomainRepeater.getDomain()).orElseGet(ArrayList::new).stream().collect(Collectors.toMap(s -> s.getValue(), t -> t.getLabel())); |
| | | List<BtmTypeVO> vos = BtmTypeWrapper.build().listEntityVO(baseMapper.selectAll()); |
| | | Map<String, List<BtmTypeVO>> domainMap = vos.stream().collect(Collectors.groupingBy(BtmTypeVO::getDomain)); |
| | | List<BtmTypeTreeVO> treeList = new ArrayList<>(); |
| | | List<BtmTreeVO> treeList = new ArrayList<>(); |
| | | domainMap.forEach((k,v)-> { |
| | | if (domain.containsKey(k)){ |
| | | String label = domain.get(k); |
| | | BtmTypeTreeVO parent = new BtmTypeTreeVO(); |
| | | BtmTreeVO parent = new BtmTreeVO(); |
| | | parent.setName(label); |
| | | parent.setLabel(label); |
| | | parent.setId(k); |
| | | parent.setChildList(v.stream().map(s -> { |
| | | BtmTypeTreeVO child = new BtmTypeTreeVO(); |
| | | BtmTreeVO child = new BtmTreeVO(); |
| | | child.setOid(s.getOid()); |
| | | child.setName(s.getId() + " " + (s.getName() == null ? "" : s.getName())); |
| | | child.setName(s.getName()); |
| | | child.setId(s.getId()); |
| | | child.setLabel(s.getId() + (s.getName() == null ? "" : "(" + s.getName() + ")")); |
| | | return child; |
| | | }).collect(Collectors.toList())); |
| | | treeList.add(parent); |
| | |
| | | } |
| | | return BtmTypeWrapper.build().listEntityVO(btmList); |
| | | } |
| | | |
| | | /** |
| | | * 按照业务类型id获取默认属性 |
| | | * |
| | | * @param btmTypeId 业务类型id |
| | | * @return 业务类型 |
| | | */ |
| | | @Override |
| | | public BtmTypeVO getDefaultAttrByBtmId(String btmTypeId) { |
| | | BtmTypeVO btmType = getBtmTypeById(btmTypeId); |
| | | if (btmType == null){ |
| | | return null; |
| | | } |
| | | btmType.setAttributes(btmTypeAttributeService.getDefaultAttribute(btmType)); |
| | | return btmType; |
| | | } |
| | | |
| | | /** |
| | | * 按照业务类型id获取所有的属性 |
| | | * |
| | | * @param btmTypeId 业务类型id |
| | | * @return 业务类型 |
| | | */ |
| | | @Override |
| | | public BtmTypeVO getAllAttributeByBtmId(String btmTypeId) { |
| | | BtmTypeVO btmType = getBtmTypeById(btmTypeId); |
| | | if (btmType == null){ |
| | | return null; |
| | | } |
| | | btmType.setAttributes(btmTypeAttributeService.getAllAttribute(btmType)); |
| | | return btmType; |
| | | } |
| | | |
| | | /** |
| | | * 按照业务类型主键获取所有的属性 |
| | | * |
| | | * @param btmTypeOid 业务类型主键 |
| | | * @return 业务类型 |
| | | */ |
| | | @Override |
| | | public BtmTypeVO getAllAttributeByBtmOid(String btmTypeOid) { |
| | | BtmTypeVO btmType = getBtmTypeByOid(btmTypeOid); |
| | | if (btmType == null){ |
| | | return null; |
| | | } |
| | | btmType.setAttributes(btmTypeAttributeService.getAllAttribute(btmType)); |
| | | return btmType; |
| | | } |
| | | } |