| | |
| | | import com.vci.corba.omd.ltm.LinkType; |
| | | import com.vci.corba.omd.stm.StatePool; |
| | | import com.vci.corba.omd.vrm.VersionRule; |
| | | import com.vci.corba.portal.data.PLUILayout; |
| | | import com.vci.dto.OsBtmTypeDTO; |
| | | import com.vci.dto.OsBtmTypeLinkAttributesDTO; |
| | | import com.vci.model.IndexObject; |
| | |
| | | @Override |
| | | public List<OsBtmTypeVO> btmDO2VOs(Collection<BizType> btmItems,Map<String, OsAttributeVO> attributeVOMap) { |
| | | List<OsBtmTypeVO> VOS = new ArrayList<>(); |
| | | Optional.ofNullable(btmItems).orElseGet(() -> new ArrayList<>()).stream().forEach(btmItem -> { |
| | | Optional.ofNullable(btmItems).orElseGet(() -> new ArrayList<>()).parallelStream().forEach(btmItem -> { |
| | | OsBtmTypeVO vo = btmDO2VO(btmItem,attributeVOMap); |
| | | VOS.add(vo); |
| | | }); |
| | |
| | | vo.setTableName(VciBaseUtil.getTableName(vo.getId())); |
| | | vo.setInputRevisionFlag(btmItem.revInput); |
| | | vo.setDelimiter(btmItem.delimiter); |
| | | vo.setImageName(btmItem.imageName); |
| | | vo.setfName(btmItem.fName); |
| | | vo.setVersionRule(String.valueOf(btmItem.verRuleName)); |
| | | if (StringUtils.isNotBlank(vo.getRevisionRuleId()) || vo.isInputRevisionFlag()) { |
| | |
| | | if (CollectionUtils.isEmpty(btmIds)) { |
| | | return null; |
| | | } |
| | | Map<String, OsBtmTypeVO> btmTypeVOMap = self.selectAllBtmMap(); |
| | | //Map<String, OsBtmTypeVO> btmTypeVOMap = self.selectAllBtmMap(); |
| | | BtmDataFetcher btmDataFetcher = new BtmDataFetcher(); |
| | | List<OsBtmTypeVO> btmTypeVOS = new ArrayList<>(); |
| | | btmIds.stream().forEach(id -> { |
| | | if (btmTypeVOMap.containsKey(id.toLowerCase())) { |
| | | btmTypeVOS.add(btmTypeVOMap.get(id.toLowerCase())); |
| | | } |
| | | OsBtmTypeVO btmType = btmDataFetcher.getBtmType(id); |
| | | btmTypeVOS.add(btmType); |
| | | }); |
| | | return btmTypeVOS; |
| | | } |
| | |
| | | * @return 业务类型 |
| | | */ |
| | | @Override |
| | | public OsBtmTypeVO getBtmById(String id) { |
| | | public OsBtmTypeVO getBtmById(String id) throws PLException { |
| | | if (StringUtils.isBlank(id)) { |
| | | return null; |
| | | } |
| | | return self.selectAllBtmMap().getOrDefault(id.toLowerCase(), null); |
| | | BizType bizType = platformClientUtil.getBtmService().getBizTypeByName(id); |
| | | return btmDO2VO(bizType,null); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return 枚举的名称 |
| | | */ |
| | | @Override |
| | | public String getNameById(String id) { |
| | | public String getNameById(String id) throws PLException { |
| | | OsBtmTypeVO btmTypeVO = getBtmById(id); |
| | | if (btmTypeVO == null) { |
| | | throw new VciBaseException("业务类型[{0}]在系统里不存在", new String[]{id}); |
| | |
| | | * @param btmId 业务类型主键 |
| | | */ |
| | | @Override |
| | | public OsERVO createERDiagram(String btmId) { |
| | | public OsERVO createERDiagram(String btmId) throws PLException { |
| | | VciBaseUtil.alertNotNull(btmId, "业务类型编号"); |
| | | OsBtmTypeVO btmTypeVO = getBtmById(btmId); |
| | | List<OsERNodeVO> nodeVOList = new ArrayList<>(); |
| | |
| | | * @return 执行结果 |
| | | */ |
| | | @Override |
| | | public OsERVO createERUsed(String btmId) { |
| | | public OsERVO createERUsed(String btmId) throws PLException { |
| | | VciBaseUtil.alertNotNull(btmId, "业务类型编号"); |
| | | OsBtmTypeVO btmTypeVO = getBtmById(btmId); |
| | | //获取使用当前类型的属性 |
| | |
| | | tree.setParentName(null); |
| | | tree.setParentId(null); |
| | | tree.setLeaf(true); |
| | | tree.setIcon(osBtmTypeVO.getImageName()); |
| | | tree.setId(osBtmTypeVO.getId()); |
| | | tree.setText(osBtmTypeVO.getDescription()); |
| | | tree.setAttributes(WebUtil.objectToMapString(osBtmTypeVO)); |
| | |
| | | rootTreeList.add(tree); |
| | | } |
| | | } |
| | | |
| | | rootTreeList = rootTreeList.stream().sorted((o1, o2) -> o1.getId().compareTo(o2.getId())).collect(Collectors.toList()); |
| | | return rootTreeList; |
| | | } |
| | | |
| | |
| | | bizType.label = dto.getName(); |
| | | bizType.fName = dto.getfName(); |
| | | bizType.implClass = dto.getImplClass(); |
| | | bizType.imageName = dto.getImageName(); |
| | | bizType.shape = ""; |
| | | bizType.lifeCycle = dto.getLifeCycleId(); |
| | | List<String> lcList = Arrays.asList(dto.getSubLifeCycleId().split(",")); |
| | |
| | | bizType.revLevel = dto.getRevLevel(); |
| | | bizType.revRuleName = dto.getRevisionRuleId(); |
| | | bizType.revInput = dto.isInputRevisionFlag(); |
| | | |
| | | bizType.delimiter = (dto.getDelimiter() == null ? "" : dto.getDelimiter()); |
| | | |
| | | bizType.verRuleName = Func.isBlank(dto.getVersionRule()) ? 0 : Short.parseShort(dto.getVersionRule()); |
| | | |
| | | //bizType.imageName = dto.get; |
| | | //List<String> attrIdList = dto.getAttributesDTOList().stream().map(OsBtmTypeLinkAttributesDTO::getId).collect(Collectors.toList()); |
| | | |
| | | bizType.apNameArray = dto.getApNameArray().split(",");//attrIdList.toArray(new String[attrIdList.size()]); |
| | | String userId = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(); |
| | | long timeMillis = System.currentTimeMillis(); |
| | |
| | | //设置列名 |
| | | List<String> columns = new ArrayList<>( |
| | | Arrays.asList("类型名称", "标签", "继承自", "实现类", "描述", "版本规则", "版本号规则", |
| | | "是否手工输入", "分隔符", "版次号规则", "生命周期", "备选生命周期列表", "属性列表") |
| | | "是否手工输入", "分隔符", "版次号规则","图标", "生命周期", "备选生命周期列表", "属性列表") |
| | | ); |
| | | try { |
| | | new File(excelPath).createNewFile(); |
| | |
| | | excelDataList.add(new WriteExcelData(i + 1, 7, bizType.revInput)); |
| | | excelDataList.add(new WriteExcelData(i + 1, 8, bizType.delimiter)); |
| | | excelDataList.add(new WriteExcelData(i + 1, 9, bizType.verRuleName)); |
| | | excelDataList.add(new WriteExcelData(i + 1, 10, bizType.lifeCycle)); |
| | | excelDataList.add(new WriteExcelData(i + 1, 11, String.join(",", bizType.lifeCycles))); |
| | | excelDataList.add(new WriteExcelData(i + 1, 12, String.join(",", bizType.apNameArray))); |
| | | excelDataList.add(new WriteExcelData(i + 1, 10, bizType.imageName)); |
| | | excelDataList.add(new WriteExcelData(i + 1, 11, bizType.lifeCycle)); |
| | | excelDataList.add(new WriteExcelData(i + 1, 12, String.join(",", bizType.lifeCycles))); |
| | | excelDataList.add(new WriteExcelData(i + 1, 13, String.join(",", bizType.apNameArray))); |
| | | attributes.addAll(Arrays.asList(bizType.apNameArray)); |
| | | i++; |
| | | } |
| | |
| | | bizType.revInput = Boolean.parseBoolean(osBtmTypePO.getRevInput().toLowerCase(Locale.ROOT)); |
| | | bizType.delimiter = osBtmTypePO.getDelimiter(); |
| | | bizType.verRuleName = osBtmTypePO.getVerRuleName(); |
| | | bizType.imageName = osBtmTypePO.getImageName(); |
| | | bizType.lifeCycle = osBtmTypePO.getLifeCycle(); |
| | | bizType.lifeCycles = osBtmTypePO.getLifeCycles().split(","); |
| | | bizType.apNameArray = osBtmTypePO.getApNameArray().split(","); |
| | |
| | | tree.setParentName(parentBIzType.getfName()); |
| | | tree.setParentId(parentBIzType.getOid()); |
| | | tree.setLeaf(true); |
| | | tree.setIcon(bizType.getImageName()); |
| | | tree.setText(bizType.getDescription()); |
| | | tree.setAttributes(WebUtil.objectToMapString(bizType)); |
| | | tree.setChildren(getChildren(osBtmTypeVOS, bizType)); |
| | |
| | | itemList.add(nodePropertyVO); |
| | | //判断参照 |
| | | if (hasRefer) { |
| | | selectReferenceBtmType(attribute, btmTypeVO, nodeVOList, relationVOList); |
| | | try { |
| | | selectReferenceBtmType(attribute, btmTypeVO, nodeVOList, relationVOList); |
| | | } catch (PLException e) { |
| | | e.printStackTrace(); |
| | | String exceptionMessage = "判断业务类型的属性是不是参照类型时出现错误,原因:"+VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(exceptionMessage); |
| | | throw new VciBaseException(exceptionMessage); |
| | | } |
| | | } |
| | | }); |
| | | nodeVO.setItems(itemList); |
| | |
| | | * @param relationVOList 关系信息 |
| | | */ |
| | | private void selectReferenceBtmType(OsBtmTypeAttributeVO attribute, OsBtmTypeVO btmTypeVO, |
| | | List<OsERNodeVO> nodeVOList, List<OsERRelationVO> relationVOList) { |
| | | List<OsERNodeVO> nodeVOList, List<OsERRelationVO> relationVOList) throws PLException { |
| | | if (StringUtils.isNotBlank(attribute.getReferBtmTypeId())) { |
| | | //是参照类型的 |
| | | OsBtmTypeVO referenceBtmType = getBtmById(attribute.getReferBtmTypeId()); |
| | |
| | | items.add(nodePropertyVO); |
| | | //判断参照 |
| | | if (!used) { |
| | | selectReferenceLinkType(attr, link, nodeVOList, relationVOList); |
| | | try { |
| | | selectReferenceLinkType(attr, link, nodeVOList, relationVOList); |
| | | } catch (PLException e) { |
| | | e.printStackTrace(); |
| | | String exceptionMessage = "断链接类型的属性是不是参照类型时出现错误,原因:"+VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(exceptionMessage); |
| | | throw new VciBaseException(exceptionMessage); |
| | | } |
| | | } |
| | | }); |
| | | nodeVO.setItems(items); |
| | |
| | | * @param nodeVOList 节点对象 |
| | | * @param relationVOList 关系对象 |
| | | */ |
| | | private void selectReferenceLinkType(OsLinkTypeAttributeVO attr, OsLinkTypeVO linkTypeVO, List<OsERNodeVO> nodeVOList, List<OsERRelationVO> relationVOList) { |
| | | private void selectReferenceLinkType(OsLinkTypeAttributeVO attr, OsLinkTypeVO linkTypeVO, List<OsERNodeVO> nodeVOList, List<OsERRelationVO> relationVOList) throws PLException { |
| | | if (StringUtils.isNotBlank(attr.getReferBtmTypeId())) { |
| | | //是参照类型的 |
| | | OsBtmTypeVO referenceBtmType = getBtmById(attr.getReferBtmTypeId()); |
| | |
| | | |
| | | } |
| | | |
| | | private class BtmDataFetcher { |
| | | |
| | | //业务类型 |
| | | private Map<String, BizType> btmTypeVOMap = new HashMap<String, BizType>(); |
| | | |
| | | public BtmDataFetcher() { |
| | | initBtmDataFetcher(); |
| | | } |
| | | |
| | | private void initBtmDataFetcher(){ |
| | | try { |
| | | BizType[] bizTypes = platformClientUtil.getBtmService().getBizTypes(""); |
| | | //List<OsBtmTypeVO> osBtmTypeVOS = btmDO2VOs(Arrays.asList(bizTypes), null); |
| | | if(Func.isNotEmpty(bizTypes)){ |
| | | btmTypeVOMap = Arrays.stream(bizTypes).collect(Collectors.toMap(btm -> btm.name, btm -> btm)); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取业务类型 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | public OsBtmTypeVO getBtmType(String id) { |
| | | BizType bizType = btmTypeVOMap.get(id); |
| | | if(Func.isEmpty(bizType)){ |
| | | return null; |
| | | } |
| | | //获取的时候才赚VO对象,这样避免一次性全部Btm转VO太慢的问题 |
| | | return btmDO2VO(bizType,null); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |