| | |
| | | @VciUnLog |
| | | public List<OsBtmTypeVO> selectAllBtm() { |
| | | try { |
| | | return btmDO2VOs(Arrays.stream(platformClientUtil.getBtmService().getBizTypes("")).collect(Collectors.toList())); |
| | | return btmDO2VOs(Arrays.stream(platformClientUtil.getBtmService().getBizTypes("")).collect(Collectors.toList()),null); |
| | | } catch (PLException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 查询所有的业务类型 |
| | | * |
| | | * @return 业务类型对象 |
| | | */ |
| | | @Override |
| | | @VciUnLog |
| | | public List<OsBtmTypeVO> selectAllBtm(Map<String, OsAttributeVO> attributeVOMap) { |
| | | try { |
| | | return btmDO2VOs(Arrays.stream(platformClientUtil.getBtmService().getBizTypes("")).collect(Collectors.toList()),attributeVOMap); |
| | | } catch (PLException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | |
| | | public Map<String, OsBtmTypeVO> selectAllBtmMap() { |
| | | return Optional.ofNullable(self.selectAllBtm()).orElseGet(() -> new ArrayList<OsBtmTypeVO>()).stream().collect(Collectors.toMap(s -> s.getId().toLowerCase(), t -> t, (o1, o2) -> o1)); |
| | | } |
| | | /** |
| | | * 查询所有的业务类型映射 |
| | | * |
| | | * @return key 是业务的英文名称的小写 |
| | | */ |
| | | @Override |
| | | @VciUnLog |
| | | public Map<String, OsBtmTypeVO> selectAllBtmMap(Map<String, OsAttributeVO> attributeVOMap) { |
| | | return Optional.ofNullable(self.selectAllBtm(attributeVOMap)).orElseGet(() -> new ArrayList<OsBtmTypeVO>()).stream().collect(Collectors.toMap(s -> s.getId().toLowerCase(), t -> t, (o1, o2) -> o1)); |
| | | } |
| | | |
| | | /** |
| | | * 数据对象转换为显示对象 |
| | |
| | | * @return 显示对象 |
| | | */ |
| | | @Override |
| | | public List<OsBtmTypeVO> btmDO2VOs(Collection<BizType> btmItems) { |
| | | 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 -> { |
| | | OsBtmTypeVO vo = btmDO2VO(btmItem); |
| | | OsBtmTypeVO vo = btmDO2VO(btmItem,attributeVOMap); |
| | | VOS.add(vo); |
| | | }); |
| | | return VOS; |
| | |
| | | * @return 显示对象 |
| | | */ |
| | | @Override |
| | | public OsBtmTypeVO btmDO2VO(BizType btmItem) { |
| | | public OsBtmTypeVO btmDO2VO(BizType btmItem, Map<String, OsAttributeVO> attributeVOMap) { |
| | | OsBtmTypeVO vo = new OsBtmTypeVO(); |
| | | if (btmItem != null) { |
| | | vo.setOid(btmItem.oid); |
| | |
| | | } |
| | | vo.setLifeCycleIds(Arrays.stream(btmItem.lifeCycles).collect(Collectors.joining(","))); |
| | | vo.setApNameArray(btmItem.apNameArray); |
| | | List<OsAttributeVO> attributeVOS = attributeService.listAttrByIds(Arrays.stream(btmItem.apNameArray).collect(Collectors.toList())); |
| | | List<OsAttributeVO> attributeVOS = attributeService.listAttrByIds(Arrays.stream(btmItem.apNameArray).collect(Collectors.toList()),attributeVOMap); |
| | | List<OsBtmTypeAttributeVO> btmTypeAttributeVOS = new ArrayList<>(); |
| | | Optional.ofNullable(attributeVOS).orElseGet(() -> new ArrayList<>()).stream().forEach(attributeVO -> { |
| | | OsBtmTypeAttributeVO btmTypeAttributeVO = new OsBtmTypeAttributeVO(); |
| | |
| | | return null; |
| | | } |
| | | return self.selectAllBtmMap().getOrDefault(id.toLowerCase(), null); |
| | | } |
| | | /** |
| | | * 使用编号获取业务类型 |
| | | * |
| | | * @param id 编号 |
| | | * @return 业务类型 |
| | | */ |
| | | @Override |
| | | public OsBtmTypeVO getBtmById(String id,Map<String, OsAttributeVO> attributeVOMap) { |
| | | if (StringUtils.isBlank(id)) { |
| | | return null; |
| | | } |
| | | return self.selectAllBtmMap(attributeVOMap).getOrDefault(id.toLowerCase(), null); |
| | | } |
| | | |
| | | /** |
| | |
| | | return new ArrayList<>(); |
| | | } |
| | | BizType bizType = bizTypes[0]; |
| | | OsBtmTypeVO btmTypeVO = btmDO2VO(bizType); |
| | | OsBtmTypeVO btmTypeVO = btmDO2VO(bizType,null); |
| | | List<OsBtmTypeAttributeVO> attributes = btmTypeVO.getAttributes(); |
| | | if (attributes == null) { |
| | | attributes = new ArrayList<>(); |
| | |
| | | List<Tree> rootTreeList = new ArrayList<>(); |
| | | BizType[] bizTypes = getBizTypes(""); |
| | | OsBtmTypeVO osBtmTypeVO = null; |
| | | List<OsBtmTypeVO> osBtmTypeVOS = btmDO2VOs(Arrays.asList(bizTypes)); |
| | | List<OsBtmTypeVO> osBtmTypeVOS = btmDO2VOs(Arrays.asList(bizTypes),null); |
| | | for (int i = 0; i < osBtmTypeVOS.size(); i++) { |
| | | osBtmTypeVO = osBtmTypeVOS.get(i); |
| | | |
| | |
| | | tree.setParentName(null); |
| | | tree.setParentId(null); |
| | | tree.setLeaf(true); |
| | | tree.setId(osBtmTypeVO.getId()); |
| | | tree.setText(osBtmTypeVO.getDescription()); |
| | | tree.setAttributes(WebUtil.objectToMapString(osBtmTypeVO)); |
| | | tree.setChildren(getChildren(osBtmTypeVOS, osBtmTypeVO)); |