From 9c06f1650313b76c8e1c06ac35a18dce44664320 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期四, 21 十一月 2024 15:05:45 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsBtmServiceImpl.java | 88 +++++++++++++++++++++++++++++++++++--------
1 files changed, 71 insertions(+), 17 deletions(-)
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsBtmServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsBtmServiceImpl.java
index 4b60a12..ce3999a 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsBtmServiceImpl.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsBtmServiceImpl.java
@@ -22,6 +22,7 @@
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;
@@ -203,7 +204,7 @@
@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);
});
@@ -290,12 +291,12 @@
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;
}
@@ -307,11 +308,12 @@
* @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);
}
/**
@@ -443,9 +445,10 @@
if (attrVOs == null) {
attrVOs = new ArrayList<>();
}
- if (!CollectionUtils.isEmpty(attributeService.getDefaultAttributeVOs())) {
+ List<OsAttributeVO> defaultAttributeVOs = attributeService.getDefaultAttributeVOs();
+ if (!CollectionUtils.isEmpty(defaultAttributeVOs)) {
List<OsBtmTypeAttributeVO> finalAttrVOs = attrVOs;
- attributeService.getDefaultAttributeVOs().stream().forEach(attr -> {
+ defaultAttributeVOs.stream().forEach(attr -> {
OsBtmTypeAttributeVO attributeVO = new OsBtmTypeAttributeVO();
BeanUtil.convert(attr, attributeVO);
attributeVO.setAttributeDataType(attr.getAttributeDataType());
@@ -622,7 +625,7 @@
* @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});
@@ -636,7 +639,7 @@
* @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<>();
@@ -657,7 +660,7 @@
* @return 鎵ц缁撴灉
*/
@Override
- public OsERVO createERUsed(String btmId) {
+ public OsERVO createERUsed(String btmId) throws PLException {
VciBaseUtil.alertNotNull(btmId, "涓氬姟绫诲瀷缂栧彿");
OsBtmTypeVO btmTypeVO = getBtmById(btmId);
//鑾峰彇浣跨敤褰撳墠绫诲瀷鐨勫睘鎬�
@@ -719,7 +722,7 @@
rootTreeList.add(tree);
}
}
-
+ rootTreeList = rootTreeList.stream().sorted((o1, o2) -> o1.getId().compareTo(o2.getId())).collect(Collectors.toList());
return rootTreeList;
}
@@ -1653,7 +1656,14 @@
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);
@@ -1669,7 +1679,7 @@
* @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());
@@ -1758,7 +1768,14 @@
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);
@@ -1833,7 +1850,7 @@
* @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());
@@ -2084,4 +2101,41 @@
}
+ 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;
+ }
+ //鑾峰彇鐨勬椂鍊欐墠璧歏O瀵硅薄锛岃繖鏍烽伩鍏嶄竴娆℃�у叏閮˙tm杞琕O澶參鐨勯棶棰�
+ return btmDO2VO(bizType,null);
+ }
+
+ }
+
}
--
Gitblit v1.9.3