From c659560c7ee8d8f8278b938421de13bf65d1e1b1 Mon Sep 17 00:00:00 2001
From: ludc <ludc@vci-tech.com>
Date: 星期三, 15 一月 2025 14:28:25 +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 |  944 +++++++++++++++++++++++++++++++++++-----------------------
 1 files changed, 566 insertions(+), 378 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 e46d9c8..fcba915 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
@@ -6,10 +6,8 @@
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.vci.client.common.oq.OQTool;
 import com.vci.client.common.providers.ClientServiceProvider;
-import com.vci.client.mw.ClientSessionUtility;
 import com.vci.common.qt.object.Condition;
 import com.vci.common.qt.object.QueryTemplate;
-import com.vci.common.utility.ObjectUtility;
 import com.vci.constant.FrameWorkLangCodeConstant;
 import com.vci.corba.common.PLException;
 import com.vci.corba.omd.atm.AttributeDef;
@@ -21,9 +19,9 @@
 import com.vci.corba.omd.lcm.LifeCycle;
 import com.vci.corba.omd.ltm.LinkType;
 import com.vci.corba.omd.stm.StatePool;
+import com.vci.corba.omd.tim.TypeIndexDef;
 import com.vci.corba.omd.vrm.VersionRule;
 import com.vci.dto.OsBtmTypeDTO;
-import com.vci.dto.OsBtmTypeLinkAttributesDTO;
 import com.vci.model.IndexObject;
 import com.vci.omd.constants.AttributeConstants;
 import com.vci.omd.constants.FileObjectType;
@@ -31,14 +29,12 @@
 import com.vci.omd.utils.ObjectTool;
 import com.vci.pagemodel.*;
 import com.vci.po.OsBtmTypePO;
-import com.vci.po.OsLinkTypePO;
 import com.vci.starter.poi.bo.ReadExcelOption;
 import com.vci.starter.poi.bo.WriteExcelData;
 import com.vci.starter.poi.bo.WriteExcelOption;
 import com.vci.starter.poi.constant.ExcelLangCodeConstant;
 import com.vci.starter.poi.util.ExcelUtil;
 import com.vci.starter.web.annotation.log.VciUnLog;
-import com.vci.starter.web.constant.QueryOptionConstant;
 import com.vci.starter.web.enumpck.BooleanEnum;
 import com.vci.starter.web.exception.VciBaseException;
 import com.vci.starter.web.pagemodel.BaseResult;
@@ -46,9 +42,13 @@
 import com.vci.starter.web.pagemodel.PageHelper;
 import com.vci.starter.web.pagemodel.Tree;
 import com.vci.starter.web.util.*;
-import com.vci.starter.web.util.BeanUtil;
+import com.vci.starter.web.util.Lcm.ConcurrentDateFormat;
+import com.vci.starter.web.util.Lcm.DateUtil;
+import com.vci.starter.web.util.Lcm.Func;
+import com.vci.web.other.AllOsEnumVOMapThreadLocal;
 import com.vci.web.service.*;
-import com.vci.web.util.*;
+import com.vci.web.util.PlatformClientUtil;
+import com.vci.web.util.WebUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -59,7 +59,6 @@
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletResponse;
-import javax.swing.*;
 import java.io.File;
 import java.io.IOException;
 import java.text.ParseException;
@@ -152,8 +151,23 @@
     @VciUnLog
     public List<OsBtmTypeVO> selectAllBtm() {
         try {
-            return btmDO2VOs(Arrays.stream(platformClientUtil.getBtmService().getBizTypes("")).collect(Collectors.toList()));
-        }  catch (PLException e) {
+            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);
         }
     }
@@ -166,7 +180,17 @@
     @Override
     @VciUnLog
     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 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));
     }
 
     /**
@@ -176,12 +200,16 @@
      * @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);
+//        Optional.ofNullable(btmItems).orElseGet(() -> new ArrayList<>()).parallelStream().forEach(btmItem -> {
+//            OsBtmTypeVO vo = btmDO2VO(btmItem,attributeVOMap);
+//            VOS.add(vo);
+//        });
+        for (BizType btmItem : btmItems) {
+            OsBtmTypeVO vo = btmDO2VO(btmItem,attributeVOMap);
             VOS.add(vo);
-        });
+        }
         return VOS;
     }
 
@@ -192,9 +220,9 @@
      * @return 鏄剧ず瀵硅薄
      */
     @Override
-    public OsBtmTypeVO btmDO2VO(BizType btmItem) {
+    public OsBtmTypeVO btmDO2VO(BizType btmItem, Map<String, OsAttributeVO> attributeVOMap) {
         OsBtmTypeVO vo = new OsBtmTypeVO();
-        if(btmItem !=null){
+        if (btmItem != null) {
             vo.setOid(btmItem.oid);
             vo.setCreator(btmItem.creator);
             vo.setLastModifier(btmItem.modifier);
@@ -202,7 +230,7 @@
                 // btmItem.createTime鎷垮埌鐨勬槸鏃堕棿鎴筹紝浣嗘槸杩欏効瑕佺殑鏄緥濡�2017-12-27 09:32:20.034杩欐牱鐨勬牸寮忥紝鎵�浠ヤ笉璋冪敤杩欎釜鏂规硶锛屾敼璋冪敤鍏朵粬鏂规硶
                 //vo.setCreateTime(VciDateUtil.str2Date(String.valueOf(btmItem.createTime),VciDateUtil.DateTimeFormat));
                 vo.setCreateTime(Func.parse(btmItem.createTime, ConcurrentDateFormat.of(VciDateUtil.DateTimeFormat)));
-                vo.setLastModifyTime( Func.parse(btmItem.modifyTime, ConcurrentDateFormat.of(VciDateUtil.DateTimeFormat)));
+                vo.setLastModifyTime(Func.parse(btmItem.modifyTime, ConcurrentDateFormat.of(VciDateUtil.DateTimeFormat)));
                 vo.setTs(Func.parse(btmItem.ts, ConcurrentDateFormat.of(VciDateUtil.DateTimeMillFormat)));
             } catch (Exception e) {
                 e.printStackTrace();
@@ -219,36 +247,39 @@
             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.getRevisionRuleName()) || vo.isInputRevisionFlag()){
+            if (StringUtils.isNotBlank(vo.getRevisionRuleId()) || vo.isInputRevisionFlag()) {
                 vo.setRevisionFlag(true);
             }
             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->{
+//            Optional.ofNullable(attributeVOS).orElseGet(() -> new ArrayList<>()).stream().forEach(attributeVO -> {
+            for (OsAttributeVO attributeVO : attributeVOS) {
                 OsBtmTypeAttributeVO btmTypeAttributeVO = new OsBtmTypeAttributeVO();
-                BeanUtil.convert(attributeVO,btmTypeAttributeVO);
+                BeanUtilForVCI.convert(attributeVO, btmTypeAttributeVO);
                 btmTypeAttributeVO.setPkBtmType(vo.getOid());
                 btmTypeAttributeVO.setBtmTypeId(vo.getId());
                 btmTypeAttributeVO.setAttributeDataType(attributeVO.getAttributeDataType());
                 btmTypeAttributeVO.setAttributeLength(attributeVO.getAttrLength());
                 btmTypeAttributeVO.setDefaultValue(attributeVO.getDefaultValue());
-                if("secretgrade".equalsIgnoreCase(attributeVO.getId())){
+                if ("secretgrade".equalsIgnoreCase(attributeVO.getId())) {
                     vo.setSecretFlag(true);
                 }
-                if(StringUtils.isNotBlank(attributeVO.getBtmTypeId())){
+                if (StringUtils.isNotBlank(attributeVO.getBtmTypeId())) {
                     btmTypeAttributeVO.setReferFlag(true);
                     btmTypeAttributeVO.setReferBtmTypeId(attributeVO.getBtmTypeId());
                 }
-                if(StringUtils.isNotBlank(attributeVO.getEnumId())){
+                if (StringUtils.isNotBlank(attributeVO.getEnumId())) {
                     btmTypeAttributeVO.setEnumFlag(true);
                     btmTypeAttributeVO.setEnumItemMap(enumService.getEnumValueMap(btmTypeAttributeVO.getEnumId()));
                 }
                 btmTypeAttributeVOS.add(btmTypeAttributeVO);
-            });
+//            });
+            }
             vo.setAttributes(btmTypeAttributeVOS);
         }
         return vo;
@@ -262,15 +293,15 @@
      */
     @Override
     public List<OsBtmTypeVO> listBtmByIds(Collection<String> btmIds) {
-        if(CollectionUtils.isEmpty(btmIds)){
+        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()));
-            }
+        btmIds.stream().forEach(id -> {
+            OsBtmTypeVO btmType = btmDataFetcher.getBtmType(id);
+            btmTypeVOS.add(btmType);
         });
         return btmTypeVOS;
     }
@@ -282,11 +313,44 @@
      * @return 涓氬姟绫诲瀷
      */
     @Override
-    public OsBtmTypeVO getBtmById(String id) {
-        if(StringUtils.isBlank(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);
+    }
+
+    /**
+     * 浣跨敤绫诲瀷鍚嶈幏鍙栦笟鍔$被鍨�,鏌ヤ笉鍒扮洿鎺ユ姤閿�
+     * @param btmName 绫诲瀷鍚�
+     * @return 涓氬姟绫诲瀷
+     * @throws
+     */
+    @Override
+    public OsBtmTypeVO getBtmByName(String btmName) throws PLException{
+        if(Func.isBlank(btmName)){
+            throw new PLException("500",new String[]{"鏌ヨ鏉′欢绫诲瀷鍚嶄笉鑳戒负绌猴紒"});
+        }
+        BizType bizType = platformClientUtil.getBtmService().getBizTypeByName(btmName);
+        if(Func.isEmpty(bizType) || Func.isBlank(bizType.oid)){
+            throw new PLException("500",new String[]{"鏍规嵁銆�"+btmName+"銆戞湭鏌ヨ鍒板搴斾笟鍔$被鍨嬶紒"});
+        }
+        return btmDO2VO(bizType,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);
     }
 
     /**
@@ -297,33 +361,33 @@
      */
     @Override
     public List<OsUsedAttributeVO> listBtmUsedInfo(String btmName) {
-        return listBtmUsedInfo(btmName,false);
+        return listBtmUsedInfo(btmName, false);
     }
 
     /**
      * 鑾峰彇涓氬姟绫诲瀷鐨勫湪鍝釜灞炴�т腑浣跨敤
      *
-     * @param btmId 涓氬姟绫诲瀷
+     * @param btmId   涓氬姟绫诲瀷
      * @param hasLink 鏄惁鍖呭惈閾炬帴绫诲瀷涓�
      * @return 寮曠敤鐨勪俊鎭�
      */
     @Override
-    public List<OsUsedAttributeVO> listBtmUsedInfo(String btmId, boolean hasLink){
-        VciBaseUtil.alertNotNull(btmId,"涓氬姟绫诲瀷鐨勫悕绉�");
-        List<OsAttributeVO> allReferThisBtmAttributes = Optional.ofNullable(attributeService.selectAllAttribute()).orElseGet(()->new ArrayList<>()).stream().filter(s->btmId.equalsIgnoreCase(s.getBtmTypeId())).collect(Collectors.toList());
-        if(CollectionUtils.isEmpty(allReferThisBtmAttributes)){
+    public List<OsUsedAttributeVO> listBtmUsedInfo(String btmId, boolean hasLink) {
+        VciBaseUtil.alertNotNull(btmId, "涓氬姟绫诲瀷鐨勫悕绉�");
+        List<OsAttributeVO> allReferThisBtmAttributes = Optional.ofNullable(attributeService.selectAllAttribute()).orElseGet(() -> new ArrayList<>()).stream().filter(s -> btmId.equalsIgnoreCase(s.getBtmTypeId())).collect(Collectors.toList());
+        if (CollectionUtils.isEmpty(allReferThisBtmAttributes)) {
             return null;
         }
         //鏍规嵁杩欎簺灞炴�э紝鎵惧畠浣跨敤鐨勪笟鍔$被鍨�
-        List<OsUsedAttributeVO> usedInfos= new ArrayList<>();
+        List<OsUsedAttributeVO> usedInfos = new ArrayList<>();
         List<OsBtmTypeVO> btmTypeVOMap = self.selectAllBtmMap().values().stream().collect(Collectors.toList());
         List<OsLinkTypeVO> linkTypeVOS = linkTypeService.selectAllLinkMap().values().stream().collect(Collectors.toList());
-        allReferThisBtmAttributes.stream().forEach(attribute->{
+        allReferThisBtmAttributes.stream().forEach(attribute -> {
             //鍏朵粬鐨勪笟鍔$被鍨嬪寘鍚簡杩欎釜灞炴�х殑
             List<OsBtmTypeVO> usedBtms = btmTypeVOMap.stream().filter(btmTypeVO -> !CollectionUtils.isEmpty(btmTypeVO.getAttributes()) && btmTypeVO.getAttributes().stream().anyMatch(s -> attribute.getId().equalsIgnoreCase(s.getId()))).collect(Collectors.toList());
-            if(!CollectionUtils.isEmpty(usedBtms)){
-                usedBtms.stream().forEach(btm->{
-                    btm.getAttributes().stream().filter(s->attribute.getId().equalsIgnoreCase(s.getId())).forEach(attrInBtm->{
+            if (!CollectionUtils.isEmpty(usedBtms)) {
+                usedBtms.stream().forEach(btm -> {
+                    btm.getAttributes().stream().filter(s -> attribute.getId().equalsIgnoreCase(s.getId())).forEach(attrInBtm -> {
                         OsUsedAttributeVO usedAttributeVO = new OsUsedAttributeVO();
                         usedAttributeVO.setId(attrInBtm.getId());
                         usedAttributeVO.setName(attrInBtm.getName());
@@ -333,11 +397,11 @@
                     });
                 });
             }
-            if(hasLink){
-                List<OsLinkTypeVO> usedLinks = linkTypeVOS.stream().filter(linkTypeVO -> !CollectionUtils.isEmpty(linkTypeVO.getAttributes()) &&linkTypeVO.getAttributes().stream().anyMatch(s->attribute.getId().equalsIgnoreCase(s.getId())) ).collect(Collectors.toList());
-                if(!CollectionUtils.isEmpty(usedLinks)){
-                    usedLinks.stream().forEach(link->{
-                        link.getAttributes().stream().filter(s->attribute.getId().equalsIgnoreCase(s.getId())).forEach(attrInBtm->{
+            if (hasLink) {
+                List<OsLinkTypeVO> usedLinks = linkTypeVOS.stream().filter(linkTypeVO -> !CollectionUtils.isEmpty(linkTypeVO.getAttributes()) && linkTypeVO.getAttributes().stream().anyMatch(s -> attribute.getId().equalsIgnoreCase(s.getId()))).collect(Collectors.toList());
+                if (!CollectionUtils.isEmpty(usedLinks)) {
+                    usedLinks.stream().forEach(link -> {
+                        link.getAttributes().stream().filter(s -> attribute.getId().equalsIgnoreCase(s.getId())).forEach(attrInBtm -> {
                             OsUsedAttributeVO usedAttributeVO = new OsUsedAttributeVO();
                             usedAttributeVO.setId(attrInBtm.getId());
                             usedAttributeVO.setName(attrInBtm.getName());
@@ -360,15 +424,15 @@
      */
     @Override
     public List<OsBtmTypeAttributeVO> listAttributeByBtmId(String btmId) throws PLException {
-        VciBaseUtil.alertNotNull(btmId,"涓氬姟绫诲瀷鐨勭紪鍙�");
+        VciBaseUtil.alertNotNull(btmId, "涓氬姟绫诲瀷鐨勭紪鍙�");
         BizType[] bizTypes = platformClientUtil.getBtmService().getBizTypes(btmId);
-        if(Func.isEmpty(bizTypes)){
+        if (Func.isEmpty(bizTypes)) {
             return new ArrayList<>();
         }
         BizType bizType = bizTypes[0];
-        OsBtmTypeVO btmTypeVO = btmDO2VO(bizType);
+        OsBtmTypeVO btmTypeVO = btmDO2VO(bizType,null);
         List<OsBtmTypeAttributeVO> attributes = btmTypeVO.getAttributes();
-        if(attributes == null){
+        if (attributes == null) {
             attributes = new ArrayList<>();
         }
         return attributes.stream().sorted(((o1, o2) -> o1.getId().toLowerCase(Locale.ROOT).compareTo(o2.getId().toLowerCase(Locale.ROOT)))).collect(Collectors.toList());
@@ -383,14 +447,15 @@
     @Override
     public List<OsBtmTypeAttributeVO> listAttributeByBtmIdHasDefault(String btmId) throws PLException {
         List<OsBtmTypeAttributeVO> attrVOs = listAttributeByBtmId(btmId);
-        if(attrVOs == null){
+        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);
+                BeanUtilForVCI.convert(attr, attributeVO);
                 attributeVO.setAttributeDataType(attr.getAttributeDataType());
                 attributeVO.setAttributeLength(attr.getAttrLength());
                 attributeVO.setReferBtmTypeId(attr.getBtmTypeId());
@@ -399,7 +464,8 @@
             });
             attrVOs = finalAttrVOs;
         }
-        return attrVOs;
+        // TODO: 2024/12/2 Ludc 杩斿洖鍊兼帓搴�
+        return attrVOs.stream().sorted(Comparator.comparing(o->o.getId(),String.CASE_INSENSITIVE_ORDER)).collect(Collectors.toList());
     }
 
     /**
@@ -412,6 +478,7 @@
 
     /**
      * 淇敼涓氬姟绫诲瀷涓搴斿睘鎬у悕鐨勫睘鎬�
+     *
      * @param apName
      * @return
      * @throws PLException
@@ -426,7 +493,7 @@
         } catch (PLException e1) {
             e1.printStackTrace();
         }
-        if(abItem == null || abItem.equals("")){
+        if (abItem == null || abItem.equals("")) {
             return true;
         }
         try {
@@ -434,21 +501,21 @@
         } catch (PLException e) {
             e.printStackTrace();
         }
-        if(btmNames == null || btmNames.length <= 0){
+        if (btmNames == null || btmNames.length <= 0) {
             return true;
         }
 
         btmNameList = Arrays.asList(btmNames);
-        for(Iterator<String> i = btmNameList.iterator(); i.hasNext();){
+        for (Iterator<String> i = btmNameList.iterator(); i.hasNext(); ) {
             String btmName = i.next();
             try {
                 platformClientUtil.getBtmService().modifyBTAttribute(btmName, apName);
             } catch (PLException e) {
                 // TODO Auto-generated catch block
                 e.printStackTrace();
-                String erreMsg = "璋冩暣涓氬姟绫诲瀷涓��"+apName+"銆戝睘鎬ф椂鍑虹幇閿欒锛屽師鍥狅細"+e.getMessage();
+                String erreMsg = "璋冩暣涓氬姟绫诲瀷涓��" + apName + "銆戝睘鎬ф椂鍑虹幇閿欒锛屽師鍥狅細" + e.getMessage();
                 logger.error(erreMsg);
-                throw new PLException("500",new String[]{erreMsg});
+                throw new PLException("500", new String[]{erreMsg});
             }
         }
         return false;
@@ -463,14 +530,14 @@
     @Override
     public boolean hasInstance(String abName) throws PLException {
         String[] btmNames = platformClientUtil.getBtmService().getBTNamesByAPName(abName);
-        if(btmNames == null || btmNames.length == 0){
+        if (btmNames == null || btmNames.length == 0) {
             return false;
         }
-        for(int i = 0; i < btmNames.length; i++){
+        for (int i = 0; i < btmNames.length; i++) {
             String btmName = btmNames[i];
             boolean flag;
             flag = platformClientUtil.getBtmService().hasData(btmName);
-            if(flag){
+            if (flag) {
                 return flag;
             }
         }
@@ -480,16 +547,55 @@
     /**
      * 鑾峰彇鍚嶅瓧浠ilter寮�濮嬬殑涓氬姟绫诲瀷(for 鏌ヨ)锛屼富瑕佺敤浜庡睘鎬ф睜鐨勪笟鍔$被鍨嬮�夋嫨瀵硅瘽妗�
      * 鑾峰彇鍏ㄩ儴涓氬姟绫诲瀷锛屼紶鍙俧ilter涓�""
+     *
      * @param btmName
      * @return
      * @throws PLException
      */
     @Override
     public BizType[] getBizTypes(String btmName) throws PLException {
-        if(null == btmName){
+        if (null == btmName) {
             btmName = "";
         }
         return platformClientUtil.getBtmService().getBizTypes(btmName);
+    }
+
+    /**
+     * 涓氬姟绫诲瀷鍒楄〃鏌ヨ锛岄潪鏍戠粨鏋勶細鐢ㄤ簬UI瀹氫箟宸︿晶涓氬姟绫诲瀷鏌ヨ锛屽彧杩斿洖name鍜宭able
+     *
+     * @param btmName
+     * @return
+     * @throws PLException
+     */
+    @Override
+    public Tree getBizTree(String btmName) throws PLException {
+        if (null == btmName) {
+            btmName = "";
+        }
+        Tree returnTree = new Tree();
+        BizType[] bizTypes = platformClientUtil.getBtmService().getBizTypes(btmName);
+        if (Func.isEmpty(bizTypes)) {
+            return returnTree;
+        }
+        returnTree.setOid("");
+        returnTree.setText("涓氬姟绫诲瀷");
+        returnTree.setLeaf(false);
+        List<Tree> trees = new ArrayList<>();
+        Arrays.stream(bizTypes).forEach(bizType -> {
+            Tree tree = new Tree();
+            tree.setText(bizType.name + " " + bizType.label);
+            tree.setOid(bizType.oid);
+            tree.setLeaf(true);
+            tree.setParentName(bizType.fName);
+            tree.setIcon(bizType.imageName);
+            Map<String, String> atrrMap = new HashMap<>();
+            atrrMap.put("name", bizType.name);
+            atrrMap.put("label", bizType.label);
+            tree.setAttributes(atrrMap);
+            trees.add(tree);
+        });
+        returnTree.setChildren(trees);
+        return returnTree;
     }
 
     /**
@@ -501,7 +607,7 @@
      */
     @Override
     public DataGrid<OsBtmTypeVO> referDataGrid(Map<String, String> conditionMap, PageHelper pageHelper) {
-        DataGrid<OsBtmTypeVO> dataGrid = queryObjectServiceInfoBySql(conditionMap, pageHelper, "plbtmtype",OsBtmTypeVO.class,((data, obj) -> {
+        DataGrid<OsBtmTypeVO> dataGrid = queryObjectServiceInfoBySql(conditionMap, pageHelper, "plbtmtype", OsBtmTypeVO.class, ((data, obj) -> {
             obj.setTableName(VciBaseUtil.getTableName(obj.getId()));
         }));
         return dataGrid;
@@ -516,7 +622,7 @@
     @Override
     public OsBtmTypeVO selectByOid(String oid) {
         List<OsBtmTypeVO> btmTypeVOS = self.selectAllBtmMap().values().stream().collect(Collectors.toList());
-        return Optional.ofNullable(btmTypeVOS).orElseGet(()->new ArrayList<>()).stream().filter(s->s.getOid().equalsIgnoreCase(oid)).findFirst().orElseGet(()->null);
+        return Optional.ofNullable(btmTypeVOS).orElseGet(() -> new ArrayList<>()).stream().filter(s -> s.getOid().equalsIgnoreCase(oid)).findFirst().orElseGet(() -> null);
     }
 
     /**
@@ -526,10 +632,10 @@
      * @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});
+        if (btmTypeVO == null) {
+            throw new VciBaseException("涓氬姟绫诲瀷[{0}]鍦ㄧ郴缁熼噷涓嶅瓨鍦�", new String[]{id});
         }
         return btmTypeVO.getName();
     }
@@ -540,13 +646,13 @@
      * @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<>();
         List<OsERRelationVO> relationVOList = new ArrayList<>();
         //鐪嬪綋鍓嶈繖涓笟鍔$被鍨嬶紝鍙傜収浜嗗叾浠栫殑鍝簺涓氬姟绫诲瀷 .鎴戜滑涓嶆樉绀哄紩鐢ㄥ綋鍓嶄笟鍔$被鍨嬬殑涓氬姟绫诲瀷
-        splicingBtmType2Json(nodeVOList, relationVOList, btmTypeVO,true);
+        splicingBtmType2Json(nodeVOList, relationVOList, btmTypeVO, true);
         loadAllLinkTypeByBtmType(nodeVOList, relationVOList, btmTypeVO);
         OsERVO osERVO = new OsERVO();
         osERVO.setTabViewList(nodeVOList);
@@ -561,32 +667,32 @@
      * @return 鎵ц缁撴灉
      */
     @Override
-    public OsERVO createERUsed(String btmId) {
+    public OsERVO createERUsed(String btmId) throws PLException {
         VciBaseUtil.alertNotNull(btmId, "涓氬姟绫诲瀷缂栧彿");
         OsBtmTypeVO btmTypeVO = getBtmById(btmId);
         //鑾峰彇浣跨敤褰撳墠绫诲瀷鐨勫睘鎬�
         List<OsUsedAttributeVO> usedAttributeVOS = listBtmUsedInfo(btmTypeVO.getId());
         List<OsERNodeVO> nodeVOList = new ArrayList<>();
         List<OsERRelationVO> relationVOList = new ArrayList<>();
-        splicingBtmType2Json(nodeVOList, relationVOList, btmTypeVO,false);
-        if(!CollectionUtils.isEmpty(usedAttributeVOS)){
-            usedAttributeVOS.stream().forEach(usedAttr->{
+        splicingBtmType2Json(nodeVOList, relationVOList, btmTypeVO, false);
+        if (!CollectionUtils.isEmpty(usedAttributeVOS)) {
+            usedAttributeVOS.stream().forEach(usedAttr -> {
                 //涓氬姟绫诲瀷鍜岄摼鎺ョ被鍨嬮兘鏈夊彲鑳�
-                if(BooleanEnum.TRUE.getValue().equalsIgnoreCase(usedAttr.getBusinessType())){
+                if (BooleanEnum.TRUE.getValue().equalsIgnoreCase(usedAttr.getBusinessType())) {
                     //涓氬姟绫诲瀷
                     OsBtmTypeVO linkBtmVO = self.selectAllBtmMap().get(usedAttr.getPkBtmType().toLowerCase(Locale.ROOT));
-                    splicingBtmType2Json(nodeVOList, relationVOList, linkBtmVO,false);
+                    splicingBtmType2Json(nodeVOList, relationVOList, linkBtmVO, false);
                     OsERRelationVO relationVO = new OsERRelationVO();
                     relationVO.setTo(btmTypeVO.getId() + " " + btmTypeVO.getName());
                     relationVO.setFrom(linkBtmVO.getId() + " " + linkBtmVO.getName());
                     relationVO.setToText("寮曠敤");
                     relationVOList.add(relationVO);
-                }else{
+                } else {
                     //鏄摼鎺ョ被鍨�
                     OsLinkTypeVO linkTypeVO = linkTypeService.selectAllLinkMap().get(usedAttr.getPkBtmType().toLowerCase(Locale.ROOT));
                     List<OsLinkTypeVO> linkTypeVOList = new ArrayList<>();
                     linkTypeVOList.add(linkTypeVO);
-                    splicingLinkType2Json(nodeVOList, relationVOList,linkTypeVOList,btmTypeVO,true);
+                    splicingLinkType2Json(nodeVOList, relationVOList, linkTypeVOList, btmTypeVO, true);
                 }
             });
         }
@@ -598,6 +704,7 @@
 
     /**
      * 鑾峰彇鎵�鏈変笟鍔$被鍨嬶紙鏍戝舰缁撴瀯锛�
+     *
      * @return 鏌ヨ缁撴灉
      */
     @Override
@@ -605,34 +712,44 @@
         List<Tree> rootTreeList = new ArrayList<>();
         BizType[] bizTypes = getBizTypes("");
         OsBtmTypeVO osBtmTypeVO = null;
-        List<OsBtmTypeVO> osBtmTypeVOS = btmDO2VOs(Arrays.asList(bizTypes));
-        for(int i = 0; i < osBtmTypeVOS.size(); i++){
+        Map<String, OsAttributeVO> attributeVOMap = null;
+        if(bizTypes.length > 0){
+            //鍏堝皢鎵�闇�瑕佺殑灞炴�с�佹灇涓炬暟鎹叏閮ㄥ姞杞藉嚭鏉ワ紝閬垮厤鍚庣画杩涜閲嶅鍔犺浇
+            attributeVOMap = attributeService.selectAllAttributeMap();
+            AllOsEnumVOMapThreadLocal.set(enumService.selectAllEnumMap());
+        }
+        List<OsBtmTypeVO> osBtmTypeVOS = btmDO2VOs(Arrays.asList(bizTypes),attributeVOMap);
+        for (int i = 0; i < osBtmTypeVOS.size(); i++) {
             osBtmTypeVO = osBtmTypeVOS.get(i);
 
-            if(osBtmTypeVO.getfName().equals("")){
+            if (osBtmTypeVO.getfName().equals("")) {
                 Tree tree = new Tree();
                 tree.setOid(osBtmTypeVO.getOid());
                 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));
-                tree.setChildren(getChildren(osBtmTypeVOS,osBtmTypeVO));
+                tree.setChildren(getChildren(osBtmTypeVOS, osBtmTypeVO));
                 rootTreeList.add(tree);
             }
         }
-
+        AllOsEnumVOMapThreadLocal.remove();
+        rootTreeList = rootTreeList.stream().sorted((o1, o2) -> o1.getId().compareTo(o2.getId())).collect(Collectors.toList());
         return rootTreeList;
     }
 
     /**
      * 鑾峰彇鎵�鏈変笟鍔$被鍨嬪悕绉伴泦鍚�
+     *
      * @return
      */
     @Override
     public List<String> getAllBtmName() throws PLException {
         BizType[] bizTypes = platformClientUtil.getBtmService().getBizTypes("");
-        if(null != bizTypes && bizTypes.length > 0){
+        if (null != bizTypes && bizTypes.length > 0) {
             return Arrays.stream(bizTypes).map(bizType -> bizType.name).collect(Collectors.toList());
         }
         return null;
@@ -640,6 +757,7 @@
 
     /**
      * 鑾峰彇涓氬姟鍏ㄩ儴灞炴�х被鍨�
+     *
      * @param btmName 涓氬姟绫诲瀷鍚嶇О
      * @return 灞炴�х殑淇℃伅
      */
@@ -687,7 +805,7 @@
             vo.setOwner(attribute.creator);
             vo.setLastModifyTime(new Date(attribute.modifyTime));
             String maxLength = AttributeConstants.getOtherValueByType(attribute.other, AttributeConstants.LENGTH);
-            if(StringUtils.isNotBlank(maxLength)){
+            if (StringUtils.isNotBlank(maxLength)) {
                 vo.setAttributeLength(Integer.valueOf(maxLength));
             }
             osBtms.add(vo);
@@ -697,16 +815,18 @@
 
     /**
      * dto杞琩o瀵硅薄
+     *
      * @return
      */
-    private BizType dto2BizType(OsBtmTypeDTO dto){
+    private BizType dto2BizType(OsBtmTypeDTO dto) {
         BizType bizType = new BizType();
         bizType.oid = dto.getOid();
-        bizType.name =dto.getId();
+        bizType.name = dto.getId();
         bizType.isAbstract = dto.isAbstractFlag();
         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(","));
@@ -719,33 +839,29 @@
         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;
+        bizType.verRuleName = Func.isBlank(dto.getVersionRule()) ? 0 : Short.parseShort(dto.getVersionRule());
         //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();
-        bizType.creator = Func.isBlank(dto.getCreator()) ? userId:dto.getCreator();
-        bizType.createTime = Func.isEmpty(dto.getCreateTime()) ? timeMillis:dto.getCreateTime().getTime();
+        bizType.creator = Func.isBlank(dto.getCreator()) ? userId : dto.getCreator();
+        bizType.createTime = Func.isEmpty(dto.getCreateTime()) ? timeMillis : dto.getCreateTime().getTime();
         bizType.modifier = userId;
         bizType.modifyTime = timeMillis;
-        bizType.ts = Func.isEmpty(dto.getTs())? timeMillis:dto.getTs().getTime();
+        bizType.ts = Func.isEmpty(dto.getTs()) ? timeMillis : dto.getTs().getTime();
         return bizType;
     }
 
     /**
      * 鍒涘缓鏂扮殑涓氬姟绫诲瀷
+     *
      * @return
      * @throws PLException
      */
     @Override
     public boolean addBtmType(OsBtmTypeDTO btmTypeDTO) throws PLException {
-        VciBaseUtil.alertNotNull(btmTypeDTO,"鍒涘缓鐨勪笟鍔$被鍨嬪璞�");
+        VciBaseUtil.alertNotNull(btmTypeDTO, "鍒涘缓鐨勪笟鍔$被鍨嬪璞�");
         //涓氬姟绫诲瀷鍚嶇О妫�鏌�
         checkName(btmTypeDTO.getId());
         //鐢熷懡鍛ㄦ湡妫�鏌�
@@ -779,26 +895,27 @@
 
     /**
      * 妫�鏌ヤ笟鍔$被鍨嬪悕绉版槸鍚﹀悎瑙�
+     *
      * @param btmName
      * @throws PLException
      */
     private void checkName(String btmName) throws PLException {
         if (Func.isBlank(btmName)) {
-            throw new PLException("500",new String[]{"涓氬姟绫诲瀷鍚嶄笉鑳戒负绌�!"});
+            throw new PLException("500", new String[]{"涓氬姟绫诲瀷鍚嶄笉鑳戒负绌�!"});
         }
 
         if (!btmName.matches("[a-z A-Z]*")) {
-            throw new PLException("500",new String[]{"涓氬姟绫诲瀷鍚嶅彧鑳戒负鑻辨枃瀛楁瘝!"});
+            throw new PLException("500", new String[]{"涓氬姟绫诲瀷鍚嶅彧鑳戒负鑻辨枃瀛楁瘝!"});
         }
 
         int maxLength = platformClientUtil.getBtmService().getBTNameMaxLength();
 
         if (btmName.length() > maxLength) {
-            throw new PLException("500",new String[]{"涓氬姟绫诲瀷鍚嶉暱搴︿笉鑳借秴杩�" + maxLength});
+            throw new PLException("500", new String[]{"涓氬姟绫诲瀷鍚嶉暱搴︿笉鑳借秴杩�" + maxLength});
         }
 
         if (platformClientUtil.getBtmService().checkRowIsExists(btmName)) {
-            throw new PLException("500",new String[]{"涓氬姟绫诲瀷鍚嶅凡缁忓瓨鍦�"});
+            throw new PLException("500", new String[]{"涓氬姟绫诲瀷鍚嶅凡缁忓瓨鍦�"});
         }
     }
 
@@ -809,19 +926,20 @@
      */
     private void checkLifeCycle(OsBtmTypeDTO btmTypeDTO) throws PLException {
         if (Func.isBlank(btmTypeDTO.getLifeCycleId())) {
-            throw new PLException("500",new String[]{"鐢熷懡鍛ㄦ湡涓嶈兘涓虹┖"});
+            throw new PLException("500", new String[]{"鐢熷懡鍛ㄦ湡涓嶈兘涓虹┖"});
         }
     }
 
     /**
      * 閫夋嫨涓�绾х増鏈細蹇呴』閫夋嫨鎴栨墜宸ヨ緭鍏ョ増鏈彿瑙勫垯; 閫夋嫨浜岀骇鐗堟湰锛氬繀椤婚�夋嫨鎴栨墜宸ヨ緭鍏ョ増鏈彿瑙勫垯, (鐗堟鍙峰凡缁忛粯璁ら�夋嫨).
+     *
      * @return
      */
     private void checkVersionInfo(OsBtmTypeDTO dto) throws PLException {
         //闇�瑕佹墜鍔ㄨ緭鍏ョ増鏈椂revisionRuleId涓嶈兘涓虹┖
         if (dto.getRevLevel() == 1 || dto.getRevLevel() == 2) {
             if (Func.isBlank(dto.getRevisionRuleId()) && !dto.isInputRevisionFlag()) {
-                throw new PLException("500",new String[]{"鐗堟湰鍙疯鍒欎笉鑳戒负绌�"});
+                throw new PLException("500", new String[]{"鐗堟湰鍙疯鍒欎笉鑳戒负绌�"});
             }
         }
     }
@@ -829,38 +947,40 @@
     /**
      * 鐗堟湰鏈哄埗淇敼: 浠呭厑璁哥被鍨嬩粠"涓嶅彲淇"鍙樻洿鑷�"涓�绾х増鏈鐞嗘満鍒�","浜岀骇鐗堟湰绠$悊鏈哄埗杩涜璋冩暣"; "涓�绾х増鏈鐞嗘満鍒�"鍙樻洿鑷�"浜岀骇鐗堟湰绠$悊鏈哄埗";
      * 涓ょ鏂瑰紡.
+     *
      * @param dbBizType 褰撳墠淇敼鍓嶇殑涓氬姟绫诲瀷锛堝簱涓瓨鍌ㄧ殑锛�
-     * @param dto 褰撳墠淇敼涓氬姟绫诲瀷
+     * @param dto       褰撳墠淇敼涓氬姟绫诲瀷
      * @throws PLException
      */
-    private void checkRevLevel(BizType dbBizType,OsBtmTypeDTO dto) throws PLException {
-        if (dbBizType.revLevel == 1 && dto.getRevLevel()==0) {
-            throw new PLException("500",new String[]{"鐗堟湰鍙樻洿閿欒锛氫笉鑳戒粠涓�绾у彉涓轰笉鍙慨璁�"});
+    private void checkRevLevel(BizType dbBizType, OsBtmTypeDTO dto) throws PLException {
+        if (dbBizType.revLevel == 1 && dto.getRevLevel() == 0) {
+            throw new PLException("500", new String[]{"鐗堟湰鍙樻洿閿欒锛氫笉鑳戒粠涓�绾у彉涓轰笉鍙慨璁�"});
         }
         if (dbBizType.revLevel == 2 && (dto.getRevLevel() == 1 || dto.getRevLevel() == 0)) {
-            throw new PLException("500",new String[]{"鐗堟湰鍙樻洿閿欒锛氫笉鑳戒粠浜岀骇鍙樹负涓�绾ф垨涓嶅彲淇"});
+            throw new PLException("500", new String[]{"鐗堟湰鍙樻洿閿欒锛氫笉鑳戒粠浜岀骇鍙樹负涓�绾ф垨涓嶅彲淇"});
         }
     }
 
     /**
      * 淇敼涓氬姟绫诲瀷
+     *
      * @param btmTypeDTO
      * @return
      * @throws PLException
      */
     @Override
     public boolean updateBtmType(OsBtmTypeDTO btmTypeDTO) throws PLException {
-        VciBaseUtil.alertNotNull(btmTypeDTO,"淇敼鐨勪笟鍔$被鍨嬪璞�");
+        VciBaseUtil.alertNotNull(btmTypeDTO, "淇敼鐨勪笟鍔$被鍨嬪璞�");
         //妫�鏌ョ敓鍛藉懆鏈熸槸鍚﹀悎瑙�
         checkLifeCycle(btmTypeDTO);
         //鏌ヨ鏁版嵁搴撲腑鐨勪笟鍔$被鍨�
         String id = btmTypeDTO.getId();
         BizType dbBizType = platformClientUtil.getBtmService().getBizTypeByName(id);
-        if(Func.isEmpty(dbBizType) || Func.isBlank(dbBizType.oid)){
-            throw new PLException("500",new String[]{"褰撳墠淇敼鐨勪笟鍔$被鍨嬩笉瀛樺湪锛�"});
+        if (Func.isEmpty(dbBizType) || Func.isBlank(dbBizType.oid)) {
+            throw new PLException("500", new String[]{"褰撳墠淇敼鐨勪笟鍔$被鍨嬩笉瀛樺湪锛�"});
         }
         //妫�鏌ョ増鏈鍒欎慨鏀规槸鍚﹀悎瑙�
-        checkRevLevel(dbBizType,btmTypeDTO);
+        checkRevLevel(dbBizType, btmTypeDTO);
         checkVersionInfo(btmTypeDTO);
         //澶勭悊涓氬姟绫诲瀷涓嬬殑灞炴��
         List<String> lastAttrList = new ArrayList<>(Arrays.asList(btmTypeDTO.getApNameArray().split(",")));
@@ -868,14 +988,14 @@
         String[] unRemovableFields = null;
         List<String> unRemovableFields_ = null;
         //闇�瑕佺Щ闄ょ殑灞炴��
-        List<String> removableFields = null;
+        List<String> removableFields = new ArrayList<>();
         //淇敼鍓嶄笟鍔$被鍨嬪湪鏁版嵁搴撲腑宸插瓨鍦ㄧ殑鎵�鏈夊睘鎬�
-        String[] apNameArray = btmTypeDTO.getApNameArray().split(",");
+        List<String> apNameArray = Func.toStrList(btmTypeDTO.getApNameArray());
         Set<String> dbApNameArray = Arrays.stream(dbBizType.apNameArray)
                 .collect(Collectors.toSet());
         //杩囨护鍑洪渶瑕佺Щ闄ょ殑灞炴��
-        removableFields = Arrays.stream(apNameArray)
-                .filter(ap -> !dbApNameArray.contains(ap))   // 杩囨护涓嶅湪 dbApSet 涓殑鍏冪礌
+        removableFields = dbApNameArray.stream()
+                .filter(ap -> !apNameArray.contains(ap))   // 杩囨护涓嶅湪 dbApSet 涓殑鍏冪礌
                 .collect(Collectors.toList());
         // 褰撲笟鍔$被鍨嬭〃涓煇灞炴�у凡缁忔湁鍊�, 涓嶅垹闄よ灞炴��, 灏嗗凡缁忕Щ闄ょ殑灞炴�ф坊鍔犲洖鏉�
         unRemovableFields = platformClientUtil.getBtmService().getUnRemovableFields(id, removableFields.toArray(new String[0]));
@@ -884,7 +1004,9 @@
             if (this.hasInstanceByBtmName(id)) {
                 //涓氬姟绫诲瀷宸叉湁瀹炰緥, 鍙兘鍒犻櫎娌℃湁鏁版嵁鐨勫垪
                 if (unRemovableFields != null && unRemovableFields.length > 0) {
-                    unRemovableFields_ = Arrays.asList(unRemovableFields);
+                    //绉婚櫎浜嗕笉鍙慨鏀圭殑灞炴�х洿鎺ユ姤閿欙紝灏变笉寰�涓嬫墽琛屼簡
+                    throw new VciBaseException("涓氬姟绫诲瀷宸叉湁瀹炰緥, 鍙兘鍒犻櫎娌℃湁鏁版嵁鐨勫垪锛屾湁鏁版嵁鐨勫垪鍚嶄负锛�" + removableFields);
+                    /*unRemovableFields_ = Arrays.asList(unRemovableFields);
                     for (int i = 0; i < removableFields.size(); i++) {
                         String abName = removableFields.get(i);
                         if (unRemovableFields_.contains(abName)) {
@@ -892,7 +1014,7 @@
                                 lastAttrList.add(abName);
                             }
                         }
-                    }
+                    }*/
                 }
             }
         }
@@ -903,28 +1025,29 @@
 
     /**
      * 鍒犻櫎涓氬姟绫诲瀷
+     *
      * @param btmTypeDTO
      * @return
      * @throws PLException
      */
     @Override
     public boolean deleteBtmType(OsBtmTypeDTO btmTypeDTO) throws PLException {
-        VciBaseUtil.alertNotNull(btmTypeDTO,"鍒犻櫎鐨勪笟鍔$被鍨�");
+        VciBaseUtil.alertNotNull(btmTypeDTO, "鍒犻櫎鐨勪笟鍔$被鍨�");
         String btmName = btmTypeDTO.getId();
         //鍙兘鍒犻櫎鍙跺瓙鑺傜偣
-        if(Func.isNotBlank(btmTypeDTO.getfName())){
-            throw new PLException("500",new String[]{"鍙兘鍒犻櫎鍙跺瓙鑺傜偣"});
+        if (Func.isNotBlank(btmTypeDTO.getfName())) {
+            throw new PLException("500", new String[]{"鍙兘鍒犻櫎鍙跺瓙鑺傜偣"});
         }
         // 涓氬姟绫诲瀷琚摼鎺ョ被鍨嬩娇鐢�, 涓嶈兘鍒犻櫎
         List<String> usedNameList = linkTypeService.getUsedBtmLinkList(btmName);
         if (usedNameList != null && usedNameList.size() > 0) {
-            throw new PLException("500",new String[]{"璇ョ被鍨嬪凡琚摼鎺ョ被鍨嬩娇鐢紝绂佹鍒犻櫎"});
+            throw new PLException("500", new String[]{"璇ョ被鍨嬪凡琚摼鎺ョ被鍨嬩娇鐢紝绂佹鍒犻櫎"});
         }
         // 涓氬姟绫诲瀷宸茬粡鐢熸垚浜嗕笟鍔″璞�, 涓嶈兘鍒犻櫎
         if (hasInstanceByBtmName(btmName)) {
-            throw new PLException("500",new String[]{"璇ョ被鍨嬪凡鏈夊疄渚嬶紝绂佹鍒犻櫎"});
+            throw new PLException("500", new String[]{"璇ョ被鍨嬪凡鏈夊疄渚嬶紝绂佹鍒犻櫎"});
         }
-        
+
         BizType bizType = new BizType();
         bizType.ts = btmTypeDTO.getTs().getTime();
         bizType.oid = btmTypeDTO.getOid();
@@ -934,6 +1057,7 @@
 
     /**
      * 涓�鑷存�ф鏌�
+     *
      * @return
      * @throws PLException
      */
@@ -941,9 +1065,9 @@
     public BaseResult checkBtmConsistency() throws PLException {
         String[] result = platformClientUtil.getBtmService().btmConsistencyCheck();
         Map<String, String> dbCheckMap = new HashMap<String, String>();
-        for(int i = 0; i < result.length; i++){
+        for (int i = 0; i < result.length; i++) {
             String info = result[i];
-            if(info.equals("")){
+            if (info.equals("")) {
                 continue;
             }
             String[] infos = info.split("/DML");
@@ -951,9 +1075,9 @@
             String dml = infos[1];
             dbCheckMap.put(typeName, dml);
         }
-        if(dbCheckMap.size() < 1){
+        if (dbCheckMap.size() < 1) {
             return BaseResult.successMsg("鏁版嵁搴撲腑鐨勮〃缁撴瀯涓庣被鍨嬩竴鑷�,鏃犻渶淇!!");
-        }else{
+        } else {
             //闇�瑕佷慨澶嶆椂灏遍渶瑕佺晫闈㈠敜璧峰璇濇杩涜澶勭悊
             List<Map> list = new ArrayList<>();
             list.add(dbCheckMap);
@@ -965,26 +1089,29 @@
 
     /**
      * 涓�鑷存�ф鏌ヤ慨澶嶅姛鑳�
+     *
      * @param repairData
      * @return
      */
     @Override
     public BaseResult executeRepair(String repairData) throws Exception {
-        Map<String, String> dbCheckMap = new ObjectMapper().readValue(repairData, new TypeReference<Map<String,String>>(){});
+        Map<String, String> dbCheckMap = new ObjectMapper().readValue(repairData, new TypeReference<Map<String, String>>() {
+        });
         List<String> list = this.getRepairDML(dbCheckMap);
-        if(list.size() < 1){
+        if (list.size() < 1) {
             return BaseResult.success();
         }
         try {
             String[] result = platformClientUtil.getBtmService().executeRepair(list.toArray(new String[0]));
             return BaseResult.success(result);
-        }catch (PLException e){
-            return BaseResult.fail("涓氬姟绫诲瀷淇澶辫触锛屽師鍥狅細"+VciBaseUtil.getExceptionMessage(e));
+        } catch (PLException e) {
+            return BaseResult.fail("涓氬姟绫诲瀷淇澶辫触锛屽師鍥狅細" + VciBaseUtil.getExceptionMessage(e));
         }
     }
 
     /**
      * 鍒涘缓瑙嗗浘
+     *
      * @return
      * @throws PLException
      */
@@ -995,6 +1122,7 @@
 
     /**
      * 鍒犻櫎鏁版嵁鐣岄潰鐨勬煡璇�
+     *
      * @return 涓氬姟绫诲瀷锛岄摼鎺ョ被鍨�
      */
     @Override
@@ -1003,11 +1131,11 @@
         List<String> allBtmName = this.getAllBtmName();
         //鑾峰彇閾炬帴绫诲瀷鍚嶇О闆嗗悎
         List<String> allLinkType = linkTypeService.getAllLtName();
-        Map<String,List> map = new HashMap<>();
-        map.put("btmType",allBtmName);
-        map.put("linkType",allLinkType);
-        map.put("table",tableList);
-        map.put("workFlow",workFlowTableList);
+        Map<String, List> map = new HashMap<>();
+        map.put("btmType", allBtmName);
+        map.put("linkType", allLinkType);
+        map.put("table", tableList);
+        map.put("workFlow", workFlowTableList);
         List<Map> list = new ArrayList<>();
         list.add(map);
         return BaseResult.dataList(list);
@@ -1015,24 +1143,25 @@
 
     /**
      * 鍒犻櫎鏁版嵁
-     * @param btmNames 涓氬姟绫诲瀷鍚�
+     *
+     * @param btmNames  涓氬姟绫诲瀷鍚�
      * @param linkNames 閾炬帴绫诲瀷鍚�
      * @return
      * @throws PLException
      */
     @Override
-    public List<Map> truncateTable(String[] btmNames,String[] linkNames) throws PLException {
+    public List<Map> truncateTable(String[] btmNames, String[] linkNames) throws PLException {
         List<Map> returnMapList = new ArrayList<>();
         Map<String, List<String>> map = new HashMap<>();
-        map.put("btmSuccess",new ArrayList<>());
-        map.put("btmFail",new ArrayList<>());
-        map.put("linkSuccess",new ArrayList<>());
-        map.put("linkFail",new ArrayList<>());
-        if(Func.isNotEmpty(btmNames)){
-            for(int i = 0; i < btmNames.length; i++){
+        map.put("btmSuccess", new ArrayList<>());
+        map.put("btmFail", new ArrayList<>());
+        map.put("linkSuccess", new ArrayList<>());
+        map.put("linkFail", new ArrayList<>());
+        if (Func.isNotEmpty(btmNames)) {
+            for (int i = 0; i < btmNames.length; i++) {
                 String btName = btmNames[i];
                 try {
-                    if(platformClientUtil.getBtmService().truncateTable(btName)){
+                    if (platformClientUtil.getBtmService().truncateTable(btName)) {
                         //淇敼鎴愬姛璁板綍涓嬫垚鍔熺殑涓氬姟绫诲瀷鍚�
                         map.get("btmSuccess").add(btName);
                     }
@@ -1044,12 +1173,12 @@
                 }
             }
         }
-        if(Func.isNotEmpty(linkNames)){
+        if (Func.isNotEmpty(linkNames)) {
             //truncate閾炬帴绫诲瀷鏁版嵁
-            for(int i = 0; i < linkNames.length; i++){
+            for (int i = 0; i < linkNames.length; i++) {
                 String ltName = linkNames[i];
                 try {
-                    if(platformClientUtil.getLinkTypeService().truncateTable(ltName)){
+                    if (platformClientUtil.getLinkTypeService().truncateTable(ltName)) {
                         map.get("linkSuccess").add(ltName);
                     }
                 } catch (PLException e1) {
@@ -1065,6 +1194,7 @@
 
     /**
      * 鍒犻櫎鍏ㄩ儴绫诲瀷
+     *
      * @return
      * @throws PLException
      */
@@ -1072,7 +1202,7 @@
     public BaseResult deleteAllType() throws PLException {
         DeleteType deleteType = new DeleteType();
         //鑾峰彇寰呭垹闄ょ殑涓氬姟绫诲瀷
-        List<BizType> delBtList =  deleteType.getDelBtList();
+        List<BizType> delBtList = deleteType.getDelBtList();
         //鑾峰彇寰呭垹闄ょ殑閾炬帴绫诲瀷
         List<LinkType> ltNames = deleteType.getDelLtList();
         //鑾峰彇寰呭垹闄ょ殑灞炴��
@@ -1089,7 +1219,7 @@
             platformClientUtil.getBtmService().deleteBtsAndTables(delBtList.toArray(new BizType[0]));
         } catch (PLException e) {
             e.printStackTrace();
-            String exceptionMessage = "娓呴櫎涓氬姟绫诲瀷鍜屽搴旇〃鏍兼椂鍑虹幇寮傚父锛屽師鍥狅細"+VciBaseUtil.getExceptionMessage(e);
+            String exceptionMessage = "娓呴櫎涓氬姟绫诲瀷鍜屽搴旇〃鏍兼椂鍑虹幇寮傚父锛屽師鍥狅細" + VciBaseUtil.getExceptionMessage(e);
             logger.error(exceptionMessage);
             return BaseResult.fail(exceptionMessage);
         }
@@ -1097,7 +1227,7 @@
             ClientServiceProvider.getOMDService().getLinkTypeService().deleteLtsAndTables(ltNames.toArray(new LinkType[0]));
         } catch (PLException e) {
             e.printStackTrace();
-            String exceptionMessage = "娓呴櫎閾炬帴绫诲瀷鏃跺嚭鐜板紓甯革紝鍘熷洜锛�"+VciBaseUtil.getExceptionMessage(e);
+            String exceptionMessage = "娓呴櫎閾炬帴绫诲瀷鏃跺嚭鐜板紓甯革紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e);
             logger.error(exceptionMessage);
             return BaseResult.fail(exceptionMessage);
         }
@@ -1106,7 +1236,7 @@
             platformClientUtil.getAttributeService().deleteAttributeDefs(abs);
         } catch (PLException e) {
             e.printStackTrace();
-            String exceptionMessage = "娓呴櫎灞炴�ф睜灞炴�ф椂鍑虹幇寮傚父锛屽師鍥狅細"+VciBaseUtil.getExceptionMessage(e);
+            String exceptionMessage = "娓呴櫎灞炴�ф睜灞炴�ф椂鍑虹幇寮傚父锛屽師鍥狅細" + VciBaseUtil.getExceptionMessage(e);
             logger.error(exceptionMessage);
             return BaseResult.fail(exceptionMessage);
         }
@@ -1114,7 +1244,7 @@
             platformClientUtil.getEnumService().deleteEnumTypes(delEnumList.toArray(new EnumType[0]));
         } catch (PLException e) {
             e.printStackTrace();
-            String exceptionMessage = "娓呴櫎鏋氫妇绫诲瀷鏃跺嚭鐜板紓甯革紝鍘熷洜锛�"+VciBaseUtil.getExceptionMessage(e);
+            String exceptionMessage = "娓呴櫎鏋氫妇绫诲瀷鏃跺嚭鐜板紓甯革紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e);
             logger.error(exceptionMessage);
             return BaseResult.fail(exceptionMessage);
         }
@@ -1122,7 +1252,7 @@
             platformClientUtil.getLifeCycleService().deleteLifeCycles(delLCList.toArray(new LifeCycle[0]));
         } catch (PLException e) {
             e.printStackTrace();
-            String exceptionMessage = "娓呴櫎鐢熷懡鍛ㄦ湡鏃跺嚭鐜板紓甯革紝鍘熷洜锛�"+VciBaseUtil.getExceptionMessage(e);
+            String exceptionMessage = "娓呴櫎鐢熷懡鍛ㄦ湡鏃跺嚭鐜板紓甯革紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e);
             logger.error(exceptionMessage);
             return BaseResult.fail(exceptionMessage);
         }
@@ -1130,7 +1260,7 @@
             platformClientUtil.getStatePoolService().deleteStatePools(delStateList.toArray(new StatePool[0]));
         } catch (PLException e) {
             e.printStackTrace();
-            String exceptionMessage = "娓呴櫎鐘舵�佹睜鐘舵�佹椂鍑虹幇寮傚父锛屽師鍥狅細"+VciBaseUtil.getExceptionMessage(e);
+            String exceptionMessage = "娓呴櫎鐘舵�佹睜鐘舵�佹椂鍑虹幇寮傚父锛屽師鍥狅細" + VciBaseUtil.getExceptionMessage(e);
             logger.error(exceptionMessage);
             return BaseResult.fail(exceptionMessage);
         }
@@ -1138,7 +1268,7 @@
             platformClientUtil.getVersionService().deleteVersionRules(delVRList.toArray(new VersionRule[0]));
         } catch (PLException e) {
             e.printStackTrace();
-            String exceptionMessage = "娓呴櫎鐗堟湰瑙勫垯鏃跺嚭鐜板紓甯革紝鍘熷洜锛�"+VciBaseUtil.getExceptionMessage(e);
+            String exceptionMessage = "娓呴櫎鐗堟湰瑙勫垯鏃跺嚭鐜板紓甯革紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e);
             logger.error(exceptionMessage);
             return BaseResult.fail(exceptionMessage);
         }
@@ -1147,37 +1277,27 @@
 
     /**
      * 鏍规嵁涓氬姟绫诲瀷鍚嶇О鍜屽叾涓嬬殑灞炴�у悕绉拌幏鍙栧凡鏈夌殑绱㈠紩
+     *
      * @param conditionMap 鏍规嵁鏌ヨ鏉′欢浼犲弬: typename:涓氬姟绫诲瀷鍚�;
      * @return
      */
     @Override
-    public List<IndexObject> getIndexByCondition(Map<String,String> conditionMap) throws PLException {
-        if(Func.isEmpty(conditionMap)){
+    public List<IndexObject> getIndexByCondition(Map<String, String> conditionMap) throws PLException {
+        if (Func.isEmpty(conditionMap)) {
             return new ArrayList<>();
         }
-        List<String> indexNameList = new ArrayList<String>();
-        QueryTemplate qtl = new QueryTemplate();
-        List<String> list = new ArrayList<String>();
-        list.add("*");
-        qtl.setBtmType("indexobject");
-        qtl.setClauseList(list);
-        qtl.setId("p");
-        qtl.setType("btm");
-        qtl.setRightFlag(false);
-        Condition condition = OQTool.getCondition(conditionMap);
-        qtl.setCondition(condition);
-        //HashMap<String, String> indexmap = new HashMap<String, String>();
-        BusinessObject findBTMObjects[] = platformClientUtil.getQueryService().findBTMObjects(qtl.getId(), OQTool.qtTOXMl(qtl).asXML());
         List<IndexObject> indexObjects = new ArrayList<>();
-        for(int i = 0; i < findBTMObjects.length; i++) {
-            BusinessObject findBTMObject = findBTMObjects[i];
+        TypeIndexDef[] typenames = ClientServiceProvider.getOMDService().getTypeIndexService().getBTIndexDefs(conditionMap.get("typename"));
+
+        for (int i = 0; i < typenames.length; i++) {
+            TypeIndexDef typename = typenames[i];
             IndexObject indexObject = new IndexObject();
-            indexObject.setOid(findBTMObject.oid);
-            indexObject.setDescription(findBTMObject.description);
-            indexObject.setCreateTime(Func.format(new Date(findBTMObject.createTime),DateUtil.PATTERN_DATE));
-            indexObject.setIndexName(ObjectTool.getBOAttributeValue(findBTMObject,"indexname"));
-            indexObject.setTypeName(ObjectTool.getBOAttributeValue(findBTMObject,"typename"));
-            indexObject.setAttrNames(ObjectTool.getBOAttributeValue(findBTMObject,"attrname"));
+            indexObject.setOid(typename.oid);
+            indexObject.setDescription(typename.description);
+            indexObject.setCreateTime(Func.format(new Date(typename.createTime), DateUtil.PATTERN_DATE));
+            indexObject.setIndexName(typename.name);
+            indexObject.setTypeName(typename.typeName);
+            indexObject.setAttrNames(typename.attributes);
             indexObjects.add(indexObject);
         }
         return indexObjects;
@@ -1185,18 +1305,16 @@
 
     /**
      * 鏍规嵁涓氬姟绫诲瀷鍚嶇О鍜屽叾涓嬬殑灞炴�у悕绉板垹闄ょ储寮�
+     *
      * @param btmName
      * @param indexName
      * @return
      */
     @Override
     public boolean delIndex(String btmName, String indexName) throws PLException {
-        VciBaseUtil.alertNotNull(btmName,"涓氬姟绫诲瀷鍚�",indexName,"绱㈠紩鍚�");
-        Map<String, String> conditionMap = new HashMap<>();
-        conditionMap.put("typename",btmName);
-        conditionMap.put("indexname",indexName);
-        List<IndexObject> bo2 = getIndexByCondition(conditionMap);
-        if(bo2!=null && bo2.size()>0) {
+        VciBaseUtil.alertNotNull(btmName, "涓氬姟绫诲瀷鍚�", indexName, "绱㈠紩鍚�");
+        TypeIndexDef[] typeIndexDef= ClientServiceProvider.getOMDService().getTypeIndexService().getBTIndexDefs(btmName);
+        if( typeIndexDef != null && typeIndexDef.length > 0 ){
             String[] indexAttr = {indexName};
 
             boolean alterFlag = platformClientUtil.getBtmService().dropIndex(btmName, indexAttr);
@@ -1204,10 +1322,12 @@
             if (!alterFlag) {
                 return false;
             }
-            for (int i = 0; i < bo2.size(); i++) {
-                String oid = bo2.get(i).getOid();
-                BusinessObject bo = platformClientUtil.getBOFactoryService().readBusinessObject(oid, "indexobject");
-                platformClientUtil.getBOFactoryService().deleteBusinessObject(bo,1);
+            for (int i = 0; i < typeIndexDef.length; i++) {
+                if(!typeIndexDef[i].name.equals(indexName)) {
+                    continue;
+                }
+                String oid = typeIndexDef[i].oid;
+                ClientServiceProvider.getOMDService().getTypeIndexService().delIndexDef(oid);
             }
         }
         return true;
@@ -1215,64 +1335,67 @@
 
     /**
      * 缁欎笟鍔$被鍨嬩笅鐨勬寚瀹氬睘鎬ф柊澧炵储寮�
+     *
      * @param indexObjectList
      * @return
      */
     @Override
     public boolean addIndex(List<IndexObject> indexObjectList) throws PLException {
-        VciBaseUtil.alertNotNull(indexObjectList,"鏂板鐨勭储寮曚俊鎭�");
+        VciBaseUtil.alertNotNull(indexObjectList, "鏂板鐨勭储寮曚俊鎭�");
         String btmName = indexObjectList.get(0).getTypeName();
         String indexNames = indexObjectList.stream().map(IndexObject::getIndexName).collect(Collectors.joining(","));
         String[] oldindexAttr = {indexNames};
-        BusinessObject bo;
-        List<BusinessObject> boList = new ArrayList<>();
-        //鍏堟煡璇㈠綋鍓嶆坊鍔犵储寮曟槸鍚﹀凡缁忓瓨鍦紝濡傛灉瀛樺湪灏卞厛鍒犻櫎鍐嶆柊澧炲疄鐜版浛鎹㈡搷浣�
-        Map<String, String> conditionMap = new HashMap<>();
-        conditionMap.put("typename",btmName);
-        //鍏堣繖鏍峰鐞嗭紝鍓嶇鐜板湪鍙仛浜嗗崟娆′繚瀛橈紝鎵�浠ヤ笉鐢╥n
-        conditionMap.put("indexname", indexNames);
-        List<IndexObject> indexObjects = getIndexByCondition(conditionMap);
-        if(indexObjects!=null && indexObjects.size()>0){
-            //绱㈠紩涓嶅瓨鍦ㄦ椂鍒犻櫎灏变細鎶ラ敊绱㈠紩涓嶅瓨鍦紝鎵�浠ヨ繖閲屾湁绱㈠紩鎵嶅幓鍒犻櫎
-            boolean b = platformClientUtil.getBtmService().dropIndex(btmName, oldindexAttr);
-            if(b){
-                for(int i = 0; i < indexObjects.size(); i ++){
-                    String oid = (String) indexObjects.get(i).getOid();
-                    bo = platformClientUtil.getBOFactoryService().readBusinessObject(oid,"indexobject");
-                    platformClientUtil.getBOFactoryService().deleteBusinessObject(bo,1);
-                }
-            }
-        }
+//        BusinessObject bo;
+//        List<BusinessObject> boList = new ArrayList<>();
+//        //鍏堟煡璇㈠綋鍓嶆坊鍔犵储寮曟槸鍚﹀凡缁忓瓨鍦紝濡傛灉瀛樺湪灏卞厛鍒犻櫎鍐嶆柊澧炲疄鐜版浛鎹㈡搷浣�
+//        Map<String, String> conditionMap = new HashMap<>();
+//        conditionMap.put("typename", btmName);
+//        //鍏堣繖鏍峰鐞嗭紝鍓嶇鐜板湪鍙仛浜嗗崟娆′繚瀛橈紝鎵�浠ヤ笉鐢╥n
+//        conditionMap.put("indexname", indexNames);
+        TypeIndexDef[] typeIndexDefs = platformClientUtil.getTypeIndexService().getBTIndexDefs(btmName);
 
-        for(int i = 0; i < indexObjectList.size(); i ++){
-            IndexObject indexObject = indexObjectList.get(i);
-            //bo = platformClientUtil.getBOFService().initBusinessObject("indexobject");
-            bo = boService.createCBOByBtmName("indexobject");
-            List<AttributeValue> attributeValues = new ArrayList<>();
-            attributeValues.add(new AttributeValue("typename", btmName));
-            attributeValues.add(new AttributeValue("indexname", indexObject.getIndexName()));
-            attributeValues.add(new AttributeValue("attrname", indexObject.getAttrNames()));
-            bo.newAttrValList = attributeValues.toArray(new AttributeValue[attributeValues.size()]);
-            bo.description = indexObject.getDescription();
-            String[] indexAttr = {indexObject.getIndexName(),indexObject.getAttrNames()};
-            //缁欐寚瀹氫笟鍔$被鍨嬬殑鎸囧畾灞炴�у垱寤虹储寮�
-            boolean alterFlag = platformClientUtil.getBtmService().addIndex(btmName, indexAttr);
-            //绱㈠紩鍒涘缓鎴愬姛涔嬪悗锛岄渶瑕佸瓨鍌ㄦ垚鍔熺储寮曞埌绱㈠紩琛ㄤ腑
-            if(!alterFlag){
-                return false;
+        if(typeIndexDefs!=null && typeIndexDefs.length>0){
+            boolean hasIndex = false;
+            for(int i = 0; i < typeIndexDefs.length; i ++){
+                if(!typeIndexDefs[i].name.equals(indexNames)) {
+                    continue;
+                }
+                String oid = typeIndexDefs[i].oid;
+                platformClientUtil.getTypeIndexService().delIndexDef(oid);
+                hasIndex = true;
             }
-            boList.add(bo);
-            //娣诲姞绱㈠紩淇℃伅鍒扮储寮曠殑涓氬姟琛ㄤ腑
-            //platformClientUtil.getBOFactoryService().createBusinessObject(bo,false,false);
+            //绱㈠紩涓嶅瓨鍦ㄦ椂鍒犻櫎灏变細鎶ラ敊绱㈠紩涓嶅瓨鍦紝鎵�浠ヨ繖閲屾湁绱㈠紩鎵嶅幓鍒犻櫎
+            if(hasIndex) {
+                platformClientUtil.getBtmService().dropIndex(btmName, oldindexAttr);
+            }
         }
-        //娣诲姞绱㈠紩淇℃伅鍒扮储寮曠殑涓氬姟琛ㄤ腑
-        platformClientUtil.getBOFactoryService().batchCreateBusinessObject(boList.toArray(new BusinessObject[boList.size()]),false,false);
+        StringBuilder sb = new StringBuilder();
+        List<TypeIndexDef> saveDefs = new ArrayList<>();
+        for(int i = 0; i < indexObjectList.size(); i ++){
+            TypeIndexDef saveDef = new TypeIndexDef();
+            saveDef.typeName = indexObjectList.get(i).getTypeName();
+            saveDef.name = indexObjectList.get(i).getIndexName();
+            saveDef.description = indexObjectList.get(i).getDescription();
+            saveDef.attributes = indexObjectList.get(i).getAttrNames();
+            sb.append(indexObjectList.get(i).getAttrNames());
+            if(i<indexObjectList.size()-1){
+                sb.append(",");
+            }
+            saveDefs.add(saveDef);
+        }
+        String[] indexAttr = {indexObjectList.get(0).getIndexName(),sb.toString()};
+        boolean alterFlag = platformClientUtil.getBtmService().addIndex(btmName, indexAttr);
+        if(!alterFlag) {
+            return false;
+        }
+        ClientServiceProvider.getOMDService().getTypeIndexService().saveIndexDefs(saveDefs.toArray(new TypeIndexDef[saveDefs.size()]));
         return true;
     }
 
     /**
      * 瀵煎嚭涓氬姟绫诲瀷
      * oid 涓氬姟绫诲瀷鍚嶇О
+     *
      * @return 鍒涘缓缁撴灉
      */
     @Override
@@ -1283,7 +1406,7 @@
         //璁剧疆鍒楀悕
         List<String> columns = new ArrayList<>(
                 Arrays.asList("绫诲瀷鍚嶇О", "鏍囩", "缁ф壙鑷�", "瀹炵幇绫�", "鎻忚堪", "鐗堟湰瑙勫垯", "鐗堟湰鍙疯鍒�",
-                        "鏄惁鎵嬪伐杈撳叆","鍒嗛殧绗�", "鐗堟鍙疯鍒�","鐢熷懡鍛ㄦ湡", "澶囬�夌敓鍛藉懆鏈熷垪琛�","灞炴�у垪琛�")
+                        "鏄惁鎵嬪伐杈撳叆", "鍒嗛殧绗�", "鐗堟鍙疯鍒�","鍥炬爣", "鐢熷懡鍛ㄦ湡", "澶囬�夌敓鍛藉懆鏈熷垪琛�", "灞炴�у垪琛�")
         );
         try {
             new File(excelPath).createNewFile();
@@ -1291,25 +1414,26 @@
             List<WriteExcelData> excelDataList = new ArrayList<>();
             //璁剧疆鍒楀ご
             for (int index = 0; index < columns.size(); index++) {
-                excelDataList.add(new WriteExcelData(0,index, columns.get(index)));
+                excelDataList.add(new WriteExcelData(0, index, columns.get(index)));
             }
             HashSet<String> attributes = new HashSet<>();
             int i = 0;
             for (String name : names.split(",")) {
                 BizType bizType = platformClientUtil.getBtmService().getBizTypeByName(name);
-                excelDataList.add(new WriteExcelData(i+1,0, bizType.name));
-                excelDataList.add(new WriteExcelData(i+1,1, bizType.label));
-                excelDataList.add(new WriteExcelData(i+1,2, bizType.fName));
-                excelDataList.add(new WriteExcelData(i+1,3, bizType.implClass));
-                excelDataList.add(new WriteExcelData(i+1,4, bizType.description));
-                excelDataList.add(new WriteExcelData(i+1,5, bizType.revLevel));
-                excelDataList.add(new WriteExcelData(i+1,6, bizType.revRuleName));
-                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, 0, bizType.name));
+                excelDataList.add(new WriteExcelData(i + 1, 1, bizType.label));
+                excelDataList.add(new WriteExcelData(i + 1, 2, bizType.fName));
+                excelDataList.add(new WriteExcelData(i + 1, 3, bizType.implClass));
+                excelDataList.add(new WriteExcelData(i + 1, 4, bizType.description));
+                excelDataList.add(new WriteExcelData(i + 1, 5, bizType.revLevel));
+                excelDataList.add(new WriteExcelData(i + 1, 6, bizType.revRuleName));
+                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.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++;
             }
@@ -1317,20 +1441,21 @@
             ExcelUtil.writeDataToFile(excelPath, excelOption);
             //瀵煎嚭灞炴��
             String attrPath = attributeService.exportAttributes("btmattr",
-                    attributes.stream().collect(Collectors.joining(",")),true);
+                    attributes.stream().collect(Collectors.joining(",")), true);
             //绉诲姩灞炴�у埌閾炬帴绫诲瀷鏂囦欢澶归噷闈㈠幓
-            FileUtil.move(new File(attrPath), new File(defaultTempFolder),true);
-            FileUtil.del(attrPath.substring(0,attrPath.lastIndexOf("\\")));
-        }catch (IOException e) {
+            FileUtil.move(new File(attrPath), new File(defaultTempFolder), true);
+            FileUtil.del(attrPath.substring(0, attrPath.lastIndexOf("\\")));
+        } catch (IOException e) {
             throw new RuntimeException(e);
         }
         File zip = ZipUtil.zip(defaultTempFolder);
         FileUtil.del(defaultTempFolder + File.separator);
-        ControllerUtil.writeFileToResponse(response,zip.getAbsoluteFile());
+        ControllerUtil.writeFileToResponse(response, zip.getAbsoluteFile());
     }
 
     /**
      * 瀵煎叆涓氬姟绫诲瀷
+     *
      * @param file 涓婁紶鐨勬枃浠�
      * @return
      */
@@ -1356,8 +1481,8 @@
             }
         }
         //TODO锛氬鍏ュ睘鎬э紝浣嗘槸杩欎釜閫昏緫瀹為檯涓婂瓨鍦ㄤ竴浜涢棶棰橈紝瀵煎叆鐨勫睘鎬у彧鏄笟鍔$被鍨嬬殑灞炴�т笉搴旇鍘荤粰灞炴�ф睜瀵煎叆锛屽彲鑳芥槸鎯崇殑灞炴�т笉瀛樺湪鐨勫氨鏂板涓�娆�
-        BaseResult baseResult = attributeService.importAttributes(attrExcel,true);
-        if(!baseResult.isSuccess()){
+        BaseResult baseResult = attributeService.importAttributes(attrExcel, true);
+        if (!baseResult.isSuccess()) {
             //鍒犻櫎涓婁紶鐨勬枃浠跺す
             FileUtil.del(defaultTempFolder + File.separator);
             return baseResult;
@@ -1372,13 +1497,14 @@
                 return BaseResult.fail(FrameWorkLangCodeConstant.IMPORT_FAIL, new String[]{"娌℃湁瀵煎叆鐨勯摼鎺ユ枃浠躲�傚鍏ョ粓姝紒"});
             }
         }
-        try{
+        try {
             //1銆佽鍙杄xcel涓殑鏁版嵁锛岀粍鎴愬璞�
             ReadExcelOption excelOption = new ReadExcelOption();
-            List<OsBtmTypePO> poList = ExcelUtil.readDataObjectFromExcel(btmExcel, OsBtmTypePO.class,excelOption,(value, po, fieldName)->{});
+            List<OsBtmTypePO> poList = ExcelUtil.readDataObjectFromExcel(btmExcel, OsBtmTypePO.class, excelOption, (value, po, fieldName) -> {
+            });
             //鍘婚櫎閮芥槸绌虹殑鎯呭喌
-            if(CollectionUtils.isEmpty(poList)){
-                return BaseResult.fail(ExcelLangCodeConstant.IMPORT_CONTENT_NULL,new String[]{});
+            if (CollectionUtils.isEmpty(poList)) {
+                return BaseResult.fail(ExcelLangCodeConstant.IMPORT_CONTENT_NULL, new String[]{});
             }
             //褰撳墠excel涓槸鍚﹂噸澶嶇敤鐨勫垽閲峂ap:锛坘ey锛氬垽閲嶅睘鎬э紝value锛氳鍙凤級
             Map<String, String> excelReapeat = new HashMap<>();
@@ -1386,25 +1512,25 @@
 
             //鍒ゆ柇蹇呭~灞炴�ф槸鍚︿负绌猴紝鐢ㄦ埛鏄惁宸插瓨鍦紝浠ュ強閮ㄩ棬鏄惁濉敊绛夋牎楠岄�昏緫
             poList.stream().forEach(osBtmTypePO -> {
-                if(Func.isBlank(osBtmTypePO.getName())){//灞炴�у悕鍒ょ┖
-                    throw new VciBaseException("绗��"+osBtmTypePO.getRowIndex()+"銆戣锛宯ame");
-                }else if(osBtmTypePO.getName().length() > maxLength){
-                    throw new VciBaseException("绗��"+osBtmTypePO.getRowIndex()+"銆戣锛屼笟鍔$被鍨嬪悕闀垮害涓嶈兘瓒呰繃" + maxLength);
-                }else if(!osBtmTypePO.getName().matches("^[A-Za-z]+$")){
-                    throw new VciBaseException("绗��"+osBtmTypePO.getRowIndex()+"銆戣锛屼笟鍔$被鍨嬪悕绉板彧鑳戒负鑻辨枃瀛楁瘝");
-                }else if (osBtmTypePO.getName().length() > maxLength) {
-                    throw new VciBaseException("绗��"+osBtmTypePO.getRowIndex()+"銆戣锛屼笟鍔$被鍨嬪悕闀垮害涓嶈兘瓒呰繃" + maxLength);
-                }else if(excelReapeat.containsKey(osBtmTypePO.getName())){//涓氬姟绫诲瀷鍚嶅湪琛ㄦ牸涓垽閲�
-                    throw new VciBaseException("绗��"+excelReapeat.get(osBtmTypePO.getName())+"銆戣鍜岀銆�"+osBtmTypePO.getRowIndex()+"銆戣鏁版嵁锛屼笟鍔$被鍨嬪悕閲嶅");
-                }else if (Func.isBlank(osBtmTypePO.getLifeCycle())) {
-                    throw new VciBaseException("绗��"+osBtmTypePO.getRowIndex()+"銆戣锛岀敓鍛藉懆鏈熶笉鑳戒负绌�");
-                }else if ("true".equalsIgnoreCase(osBtmTypePO.getRevInput()) && Func.isBlank(osBtmTypePO.getRevRuleName())) {
-                    throw new VciBaseException("绗��"+osBtmTypePO.getRowIndex()+"銆戣锛岀増鏈彿瑙勫垯涓嶈兘涓虹┖");
+                if (Func.isBlank(osBtmTypePO.getName())) {//灞炴�у悕鍒ょ┖
+                    throw new VciBaseException("绗��" + osBtmTypePO.getRowIndex() + "銆戣锛宯ame");
+                } else if (osBtmTypePO.getName().length() > maxLength) {
+                    throw new VciBaseException("绗��" + osBtmTypePO.getRowIndex() + "銆戣锛屼笟鍔$被鍨嬪悕闀垮害涓嶈兘瓒呰繃" + maxLength);
+                } else if (!osBtmTypePO.getName().matches("^[A-Za-z]+$")) {
+                    throw new VciBaseException("绗��" + osBtmTypePO.getRowIndex() + "銆戣锛屼笟鍔$被鍨嬪悕绉板彧鑳戒负鑻辨枃瀛楁瘝");
+                } else if (osBtmTypePO.getName().length() > maxLength) {
+                    throw new VciBaseException("绗��" + osBtmTypePO.getRowIndex() + "銆戣锛屼笟鍔$被鍨嬪悕闀垮害涓嶈兘瓒呰繃" + maxLength);
+                } else if (excelReapeat.containsKey(osBtmTypePO.getName())) {//涓氬姟绫诲瀷鍚嶅湪琛ㄦ牸涓垽閲�
+                    throw new VciBaseException("绗��" + excelReapeat.get(osBtmTypePO.getName()) + "銆戣鍜岀銆�" + osBtmTypePO.getRowIndex() + "銆戣鏁版嵁锛屼笟鍔$被鍨嬪悕閲嶅");
+                } else if (Func.isBlank(osBtmTypePO.getLifeCycle())) {
+                    throw new VciBaseException("绗��" + osBtmTypePO.getRowIndex() + "銆戣锛岀敓鍛藉懆鏈熶笉鑳戒负绌�");
+                } else if ("true".equalsIgnoreCase(osBtmTypePO.getRevInput()) && Func.isBlank(osBtmTypePO.getRevRuleName())) {
+                    throw new VciBaseException("绗��" + osBtmTypePO.getRowIndex() + "銆戣锛岀増鏈彿瑙勫垯涓嶈兘涓虹┖");
                 }
                 try {
                     BizType historyBtm = platformClientUtil.getBtmService().getBizTypeByName(osBtmTypePO.getName());
                     //宸叉湁姝ゆ暟鎹繘琛屽垹闄よ鐩�
-                    if(historyBtm != null && !historyBtm.name.equals("")){
+                    if (historyBtm != null && !historyBtm.name.equals("")) {
                         platformClientUtil.getBtmService().deleteBizType(historyBtm);
                     }
                 } catch (PLException e) {
@@ -1412,10 +1538,10 @@
                 }
 
                 //灞炴�у悕excel涓垽閲嶅鐞�
-                excelReapeat.put(osBtmTypePO.getName(),osBtmTypePO.getRowIndex());
+                excelReapeat.put(osBtmTypePO.getName(), osBtmTypePO.getRowIndex());
                 BizType bizType = new BizType();
                 bizType.name = osBtmTypePO.getName();
-                bizType.label = osBtmTypePO.getLable();
+                bizType.label = osBtmTypePO.getLabel();
                 bizType.description = osBtmTypePO.getDescription();
                 bizType.fName = osBtmTypePO.getFName();
                 bizType.implClass = osBtmTypePO.getImplClass();
@@ -1424,6 +1550,7 @@
                 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(",");
@@ -1436,12 +1563,12 @@
                     throw new RuntimeException(e);
                 }
             });
-        }catch (Exception e){
-            if(logger.isErrorEnabled()){
-                logger.error("璇诲彇excel鍐呭鏃舵垨淇濆瓨涓氬姟绫诲瀷淇℃伅鏃跺嚭鐜颁簡閿欒锛屽叿浣撳師鍥狅細",VciBaseUtil.getExceptionMessage(e));
+        } catch (Exception e) {
+            if (logger.isErrorEnabled()) {
+                logger.error("璇诲彇excel鍐呭鏃舵垨淇濆瓨涓氬姟绫诲瀷淇℃伅鏃跺嚭鐜颁簡閿欒锛屽叿浣撳師鍥狅細", VciBaseUtil.getExceptionMessage(e));
             }
             e.printStackTrace();
-            return BaseResult.fail(VciBaseUtil.getExceptionMessage(e),new String[]{},e);
+            return BaseResult.fail(VciBaseUtil.getExceptionMessage(e), new String[]{}, e);
         }
         //鍒犻櫎涓婁紶鐨勬枃浠跺す
         FileUtil.del(defaultTempFolder + File.separator);
@@ -1450,12 +1577,13 @@
 
     /**
      * 鑾峰彇闇�瑕佷慨澶嶇殑浼猻ql
+     *
      * @param dbCheckMap
      * @return
      */
     private List<String> getRepairDML(Map<String, String> dbCheckMap) {
         List<String> list = new ArrayList<String>();
-        for(Iterator<String> ite = dbCheckMap.keySet().iterator(); ite.hasNext();){
+        for (Iterator<String> ite = dbCheckMap.keySet().iterator(); ite.hasNext(); ) {
             String type = ite.next();
             String dml = dbCheckMap.get(type);
             list.add(type + "/DML" + dml);
@@ -1473,32 +1601,33 @@
         //boolean flag = DDLToolClient.getService().hasInstanceOralce(tableName);
         boolean flag = false;
         try {
-            flag = ClientServiceProvider.getOMDService().getBTMService().hasData(btmName);
+            flag = platformClientUtil.getBtmService().hasData(btmName);
         } catch (PLException e) {
             // TODO Auto-generated catch block
             e.printStackTrace();
             String exceptionMessage = VciBaseUtil.getExceptionMessage(e);
             logger.error(exceptionMessage);
-            throw new PLException("500",new String[]{exceptionMessage});
+            throw new PLException("500", new String[]{exceptionMessage});
         }
         return flag;
     }
 
-    private List<Tree> getChildren(List<OsBtmTypeVO> osBtmTypeVOS,OsBtmTypeVO parentBIzType){
-        List<Tree> trees= new ArrayList<>();
+    private List<Tree> getChildren(List<OsBtmTypeVO> osBtmTypeVOS, OsBtmTypeVO parentBIzType) {
+        List<Tree> trees = new ArrayList<>();
         for (OsBtmTypeVO bizType : osBtmTypeVOS) {
-            if(StringUtils.isBlank(bizType.getfName())){
+            if (StringUtils.isBlank(bizType.getfName())) {
                 continue;
             }
-            if(bizType.getfName().equals(parentBIzType.getId())){
+            if (bizType.getfName().equals(parentBIzType.getId())) {
                 Tree tree = new Tree();
                 tree.setOid(bizType.getOid());
                 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));
+                tree.setChildren(getChildren(osBtmTypeVOS, bizType));
                 trees.add(tree);
             }
         }
@@ -1508,12 +1637,12 @@
     /**
      * 灏嗕笟鍔$被鍨嬫嫾鎺son
      *
-     * @param nodeVOList  瀵硅薄鑺傜偣鐨勪俊鎭�
-     * @param relationVOList  鍏崇郴鐨勪俊鎭�
-     * @param btmTypeVO 涓氬姟绫诲瀷鏄剧ず瀵硅薄
-     * @param hasRefer 鍖呭惈鍙傜収
+     * @param nodeVOList     瀵硅薄鑺傜偣鐨勪俊鎭�
+     * @param relationVOList 鍏崇郴鐨勪俊鎭�
+     * @param btmTypeVO      涓氬姟绫诲瀷鏄剧ず瀵硅薄
+     * @param hasRefer       鍖呭惈鍙傜収
      */
-    private void splicingBtmType2Json(List<OsERNodeVO> nodeVOList, List<OsERRelationVO> relationVOList, OsBtmTypeVO btmTypeVO,boolean hasRefer) {
+    private void splicingBtmType2Json(List<OsERNodeVO> nodeVOList, List<OsERRelationVO> relationVOList, OsBtmTypeVO btmTypeVO, boolean hasRefer) {
         OsERNodeVO nodeVO = new OsERNodeVO();
         nodeVO.setKey(btmTypeVO.getId() + " " + btmTypeVO.getName());
         List<OsERNodePropertyVO> itemList = new ArrayList<>();
@@ -1521,16 +1650,23 @@
             OsERNodePropertyVO nodePropertyVO = new OsERNodePropertyVO();
             nodePropertyVO.setName(attribute.getId() + " " + attribute.getName());
             nodePropertyVO.setKey("oid".equals(attribute.getId().toLowerCase()));
-            if(StringUtils.isNotBlank(attribute.getReferBtmTypeId())){
+            if (StringUtils.isNotBlank(attribute.getReferBtmTypeId())) {
                 //鍙傜収鐨勫睘鎬э紝璁剧疆涓洪粍鑹�
                 nodePropertyVO.setColor("#FEDD32FF");
-            }else{
+            } else {
                 nodePropertyVO.setColor("#000");
             }
             itemList.add(nodePropertyVO);
             //鍒ゆ柇鍙傜収
-            if(hasRefer) {
-                selectReferenceBtmType(attribute, btmTypeVO, nodeVOList, relationVOList);
+            if (hasRefer) {
+                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);
@@ -1540,13 +1676,13 @@
     /**
      * 鍒ゆ柇涓氬姟绫诲瀷鐨勫睘鎬ф槸涓嶆槸鍙傜収绫诲瀷锛屽苟灏嗗弬鐓ф坊鍔犲埌ER鍥句腑
      *
-     * @param attribute     涓氬姟绫诲瀷灞炴��
-     * @param nodeVOList  鑺傜偣淇℃伅
-     * @param btmTypeVO 涓氬姟绫诲瀷
+     * @param attribute      涓氬姟绫诲瀷灞炴��
+     * @param nodeVOList     鑺傜偣淇℃伅
+     * @param btmTypeVO      涓氬姟绫诲瀷
      * @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());
@@ -1556,14 +1692,14 @@
             nodeVO.setKey(referenceBtmType.getId() + " " + referenceBtmType.getName());
 
             List<OsERNodePropertyVO> items = new ArrayList<>();
-            if(referenceBtmType.getId().equalsIgnoreCase(btmTypeVO.getId())){
+            if (referenceBtmType.getId().equalsIgnoreCase(btmTypeVO.getId())) {
                 //鍙傜収鑷繁鐨勫唴瀹�
                 OsERRelationVO relationVO = new OsERRelationVO();
                 relationVO.setTo(referenceBtmType.getId() + " " + referenceBtmType.getName());
                 relationVO.setFrom(btmTypeVO.getId() + " " + btmTypeVO.getName());
                 relationVO.setToText("鑷弬鐓�");
                 relationVOList.add(relationVO);
-            }else {
+            } else {
                 referenceBtmAttributes.forEach(attr -> {
                     OsERNodePropertyVO nodePropertyVO = new OsERNodePropertyVO();
                     nodePropertyVO.setName(attr.getId() + " " + attr.getName());
@@ -1586,23 +1722,23 @@
     /**
      * 鍔犺浇涓氬姟绫诲瀷鎵�鍏宠仈鐨勯摼鎺ョ被鍨�
      *
-     * @param nodeVOList  鑺傜偣淇℃伅
+     * @param nodeVOList     鑺傜偣淇℃伅
      * @param relationVOList 鍏崇郴鐨勪俊鎭�
-     * @param btmTypeVO    涓氬姟绫诲瀷
+     * @param btmTypeVO      涓氬姟绫诲瀷
      */
     private void loadAllLinkTypeByBtmType(List<OsERNodeVO> nodeVOList, List<OsERRelationVO> relationVOList, OsBtmTypeVO btmTypeVO) {
         Map<String, OsLinkTypeVO> linkTypeVOMap = linkTypeService.selectAllLinkMap();
         Collection<OsLinkTypeVO> linkTypeVOS = linkTypeVOMap.values();
         Set<OsLinkTypeVO> fromLinkTypeVOList = linkTypeVOS.stream().filter(link ->
-            Arrays.stream(link.getFromBtmType().split(",")).anyMatch(s->s.equalsIgnoreCase(btmTypeVO.getId()))
+                Arrays.stream(link.getFromBtmType().split(",")).anyMatch(s -> s.equalsIgnoreCase(btmTypeVO.getId()))
         ).collect(Collectors.toSet());
         Set<OsLinkTypeVO> toLinkTypeList = linkTypeVOS.stream().filter(link ->
-                Arrays.stream(link.getToBtmType().split(",")).anyMatch(s->s.equalsIgnoreCase(btmTypeVO.getId()))).collect(Collectors.toSet());
+                Arrays.stream(link.getToBtmType().split(",")).anyMatch(s -> s.equalsIgnoreCase(btmTypeVO.getId()))).collect(Collectors.toSet());
         List<OsLinkTypeVO> linkTypeVOList = new ArrayList<>();
         linkTypeVOList.addAll(fromLinkTypeVOList);
         linkTypeVOList.addAll(toLinkTypeList);
         if (!CollectionUtils.isEmpty(linkTypeVOList)) {
-            splicingLinkType2Json(nodeVOList, relationVOList,linkTypeVOList,btmTypeVO,false);
+            splicingLinkType2Json(nodeVOList, relationVOList, linkTypeVOList, btmTypeVO, false);
         }
 
     }
@@ -1610,32 +1746,39 @@
     /**
      * 灏嗛摼鎺ョ被鍨嬫嫾鎺ユ垚json
      *
-     * @param nodeVOList  鑺傜偣淇℃伅
-     * @param relationVOList  鍏崇郴淇℃伅
-     * @param linkTypeVOs 閾炬帴绫诲瀷
-     * @param btmTypeVO 涓氬姟绫诲瀷鐨勬樉绀哄璞�
-     * @param used 鏄惁涓鸿浣跨敤
+     * @param nodeVOList     鑺傜偣淇℃伅
+     * @param relationVOList 鍏崇郴淇℃伅
+     * @param linkTypeVOs    閾炬帴绫诲瀷
+     * @param btmTypeVO      涓氬姟绫诲瀷鐨勬樉绀哄璞�
+     * @param used           鏄惁涓鸿浣跨敤
      */
     private void splicingLinkType2Json(List<OsERNodeVO> nodeVOList, List<OsERRelationVO> relationVOList,
-                                       List<OsLinkTypeVO> linkTypeVOs,OsBtmTypeVO btmTypeVO,boolean used) {
+                                       List<OsLinkTypeVO> linkTypeVOs, OsBtmTypeVO btmTypeVO, boolean used) {
         linkTypeVOs.forEach(link -> {
             List<OsLinkTypeAttributeVO> attributeList = link.getAttributes();
-            OsERNodeVO nodeVO= new OsERNodeVO();
+            OsERNodeVO nodeVO = new OsERNodeVO();
             nodeVO.setKey(link.getId() + " " + link.getName());
             List<OsERNodePropertyVO> items = new ArrayList<>();
             attributeList.forEach(attr -> {
                 OsERNodePropertyVO nodePropertyVO = new OsERNodePropertyVO();
                 nodePropertyVO.setName(attr.getId() + " " + attr.getName());
                 nodePropertyVO.setKey("oid".equals(attr.getId().toLowerCase()));
-                if(StringUtils.isNotBlank(attr.getReferBtmTypeId())) {
+                if (StringUtils.isNotBlank(attr.getReferBtmTypeId())) {
                     nodePropertyVO.setColor("#FEDD32FF");
-                }else {
+                } else {
                     nodePropertyVO.setColor("#1c446f");
                 }
                 items.add(nodePropertyVO);
                 //鍒ゆ柇鍙傜収
-                if(!used) {
-                    selectReferenceLinkType(attr, link, nodeVOList, relationVOList);
+                if (!used) {
+                    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);
@@ -1646,26 +1789,26 @@
 
             nodeVOList.add(nodeVO);
 
-            if(used){
+            if (used) {
                 relationVO.setText("琚紩鐢�");
             }
             //濡傛灉褰撳墠鐨刦rom绔紝閭d箞灏辨樉绀簍o绔殑
             //濡傛灉褰撳墠鐨勬槸to绔殑锛岄偅涔堝氨鏄剧ずfrom绔殑鍐呭
-            if(Arrays.stream(link.getFromBtmType().split(",")).anyMatch(s->s.equalsIgnoreCase(btmTypeVO.getId()))){
+            if (Arrays.stream(link.getFromBtmType().split(",")).anyMatch(s -> s.equalsIgnoreCase(btmTypeVO.getId()))) {
                 //杩欎釜鏄痜rom绔�
-               if(!used) {
-                   relationVO.setToText("from绔�");
-               }
+                if (!used) {
+                    relationVO.setToText("from绔�");
+                }
                 //鎵捐繖涓摼鎺ョ被鍨嬬殑to绔殑涓氬姟绫诲瀷
-               link.getToBtmTypeVOS().stream().forEach(toBtm->{
-                    splicingBtmType2JsonForLink(nodeVOList,relationVOList,link,toBtm,true);
-               });
-            }else{
-                if(!used) {
+                link.getToBtmTypeVOS().stream().forEach(toBtm -> {
+                    splicingBtmType2JsonForLink(nodeVOList, relationVOList, link, toBtm, true);
+                });
+            } else {
+                if (!used) {
                     relationVO.setToText("to绔�");
                 }
-                link.getFromBtmTypeVOS().stream().forEach(fromBtm->{
-                    splicingBtmType2JsonForLink(nodeVOList,relationVOList,link,fromBtm,false);
+                link.getFromBtmTypeVOS().stream().forEach(fromBtm -> {
+                    splicingBtmType2JsonForLink(nodeVOList, relationVOList, link, fromBtm, false);
                 });
             }
             relationVOList.add(relationVO);
@@ -1674,11 +1817,12 @@
 
     /**
      * 閾炬帴绫诲瀷鍏抽敭鐨勪笟鍔$被鍨�
-     * @param nodeVOList 瀵硅薄鍒楄〃
+     *
+     * @param nodeVOList     瀵硅薄鍒楄〃
      * @param relationVOList 鍏宠仈鍏崇郴鍒楄〃
-     * @param link 閾炬帴绫诲瀷
-     * @param btmTypeVO 涓氬姟绫诲瀷
-     * @param to 鏄惁涓簍o绔�
+     * @param link           閾炬帴绫诲瀷
+     * @param btmTypeVO      涓氬姟绫诲瀷
+     * @param to             鏄惁涓簍o绔�
      */
     private void splicingBtmType2JsonForLink(List<OsERNodeVO> nodeVOList, List<OsERRelationVO> relationVOList, OsLinkTypeVO link, OsBtmTypeVO btmTypeVO, boolean to) {
         OsERNodeVO nodeVO = new OsERNodeVO();
@@ -1696,7 +1840,7 @@
         OsERRelationVO relationVO = new OsERRelationVO();
         relationVO.setFrom(link.getId() + " " + link.getName());
         relationVO.setTo(btmTypeVO.getId() + " " + btmTypeVO.getName());
-        relationVO.setToText(to?"to绔�":"from绔�");
+        relationVO.setToText(to ? "to绔�" : "from绔�");
         relationVOList.add(relationVO);
         nodeVOList.add(nodeVO);
     }
@@ -1704,12 +1848,12 @@
     /**
      * 鍒ゆ柇閾炬帴绫诲瀷鐨勫睘鎬ф槸涓嶆槸鍙傜収绫诲瀷锛屽苟灏嗗弬鐓ф坊鍔犲埌ER鍥句腑
      *
-     * @param attr          閾炬帴绫诲瀷鐨勫睘鎬�
-     * @param linkTypeVO 閾炬帴绫诲瀷鐨勫唴瀹�
-     * @param nodeVOList 鑺傜偣瀵硅薄
+     * @param attr           閾炬帴绫诲瀷鐨勫睘鎬�
+     * @param linkTypeVO     閾炬帴绫诲瀷鐨勫唴瀹�
+     * @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());
@@ -1739,7 +1883,7 @@
     /**
      * 灏佽鍒犻櫎鍏ㄩ儴绫诲瀷鐩稿叧鐨勬煡璇㈡柟娉曠殑鍐呴儴绫�
      */
-    private class DeleteType{
+    private class DeleteType {
 
         private List<String> exceptBts, exceptAbs, exceptEnums, exceptRev, exceptLCs, exceptStates;
 
@@ -1750,20 +1894,21 @@
 
         /**
          * 鑾峰彇闇�瑕佸垹闄ょ殑涓氬姟绫诲瀷
+         *
          * @return
          */
         public List<BizType> getDelBtList() throws PLException {
             List<BizType> list = new ArrayList<>();
             BizType[] bts = platformClientUtil.getBtmService().getBizTypes("");
-            for(BizType bt : bts){
+            for (BizType bt : bts) {
                 boolean exceptFlag = false;
-                for(String except : exceptBts){
-                    if(except.equalsIgnoreCase(bt.name)){
+                for (String except : exceptBts) {
+                    if (except.equalsIgnoreCase(bt.name)) {
                         exceptFlag = true;
                         break;
                     }
                 }
-                if(!exceptFlag){
+                if (!exceptFlag) {
                     list.add(bt);
                 }
             }
@@ -1772,6 +1917,7 @@
 
         /**
          * 鑾峰彇闇�瑕佸垹闄ょ殑閾炬帴绫诲瀷
+         *
          * @return
          */
         public List<LinkType> getDelLtList() throws PLException {
@@ -1781,6 +1927,7 @@
 
         /**
          * 鑾峰彇寰呭垹闄ょ殑灞炴��
+         *
          * @return
          */
         public List<String> getDelAbList() {
@@ -1793,26 +1940,26 @@
             }
             //渚濇嵁淇濈暀鐨勭被鍨嬫瀯閫犱繚鐣欑殑灞炴��
             exceptAbs = new ArrayList<String>();
-            for(String except : exceptBts){
+            for (String except : exceptBts) {
                 String[] btmApNameArray = null;
                 try {
                     btmApNameArray = platformClientUtil.getBtmService().getAttributeNames(except);
                 } catch (PLException e) {
                     e.printStackTrace();
                 }
-                if(btmApNameArray != null){
-                    for(String abName : btmApNameArray){
-                        if(!exceptAbs.contains(abName)){
+                if (btmApNameArray != null) {
+                    for (String abName : btmApNameArray) {
+                        if (!exceptAbs.contains(abName)) {
                             exceptAbs.add(abName);
                         }
                     }
                 }
             }
             //鏋勯�犲彲鍒犻櫎鐨勫睘鎬�
-            if(attribItems != null){
-                for(AttributeDef ab : attribItems){
+            if (attribItems != null) {
+                for (AttributeDef ab : attribItems) {
                     String abName = ab.name;
-                    if(!exceptAbs.contains(abName)){
+                    if (!exceptAbs.contains(abName)) {
                         list.add(abName);
                     }
                 }
@@ -1822,6 +1969,7 @@
 
         /**
          * 鑾峰彇寰呭垹闄ょ殑鏋氫妇绫诲瀷
+         *
          * @return
          */
         public List<EnumType> getDelEnumList() {
@@ -1831,15 +1979,15 @@
                 exceptEnums = new ArrayList<String>();
                 EnumType[] emItems = ClientServiceProvider.getOMDService().getEnumService().getEnumTypes("", 0, 0);
                 AttributeDef[] abs = platformClientUtil.getAttributeService().getAttributeDefsByNames(exceptAbs.toArray(new String[0]));
-                for(AttributeDef ab : abs){
+                for (AttributeDef ab : abs) {
                     OtherInfo otherInfo = OtherInfo.getOtherInfoByText(ab.other);
                     String enumName = otherInfo.getEnumName();
-                    if(enumName != null && !enumName.equals("") && !exceptEnums.contains(enumName)){
+                    if (enumName != null && !enumName.equals("") && !exceptEnums.contains(enumName)) {
                         exceptEnums.add(enumName);
                     }
                 }
-                for(EnumType em : emItems){
-                    if(!exceptEnums.contains(em.name)){
+                for (EnumType em : emItems) {
+                    if (!exceptEnums.contains(em.name)) {
                         list.add(em);
                     }
                 }
@@ -1851,17 +1999,18 @@
 
         /**
          * 鑾峰彇寰呭垹闄ょ殑鐢熷懡鍛ㄦ湡
+         *
          * @return
          */
-        public List<LifeCycle> getDelLCList(){
+        public List<LifeCycle> getDelLCList() {
             List<LifeCycle> list = new ArrayList<LifeCycle>();
             exceptLCs = new ArrayList<String>();
             exceptStates = new ArrayList<String>();
-            for(String btName : exceptBts){
+            for (String btName : exceptBts) {
                 try {
                     BizType bt = platformClientUtil.getBtmService().getBizTypeByName(btName);
                     String lcName = bt.lifeCycle;
-                    if(lcName != null && !lcName.equals("") && !exceptLCs.contains(lcName)){
+                    if (lcName != null && !lcName.equals("") && !exceptLCs.contains(lcName)) {
                         exceptLCs.add(lcName);
                     }
                 } catch (PLException e) {
@@ -1875,15 +2024,15 @@
             } catch (PLException e) {
                 e.printStackTrace();
             }
-            if(lcs != null){
-                for(LifeCycle lc : lcs){
+            if (lcs != null) {
+                for (LifeCycle lc : lcs) {
                     String name = lc.name;
-                    if(name != null && !name.equals("") && !exceptLCs.contains(name)){
+                    if (name != null && !name.equals("") && !exceptLCs.contains(name)) {
                         list.add(lc);
-                    }else{
+                    } else {
                         //淇濈暀鐨勭姸鎬佹睜
                         Bound[] bounds = lc.bounds;
-                        for(Bound bound : bounds){
+                        for (Bound bound : bounds) {
                             String sName = bound.name;
                             exceptStates.add(sName);
                         }
@@ -1895,9 +2044,10 @@
 
         /**
          * 鑾峰彇寰呭垹闄ょ殑鐘舵��
+         *
          * @return
          */
-        public List<StatePool> getDelSPList(){
+        public List<StatePool> getDelSPList() {
             List<StatePool> list = new ArrayList<StatePool>();
             StatePool[] states = null;
             try {
@@ -1905,10 +2055,10 @@
             } catch (PLException e) {
                 e.printStackTrace();
             }
-            if(states != null){
-                for(StatePool state : states){
+            if (states != null) {
+                for (StatePool state : states) {
                     String name = state.name;
-                    if(name != null && !name.equals("") && !exceptStates.contains(name)){
+                    if (name != null && !name.equals("") && !exceptStates.contains(name)) {
                         list.add(state);
                     }
                 }
@@ -1918,16 +2068,17 @@
 
         /**
          * 鑾峰彇寰呭垹闄ょ殑鐗堟湰瑙勫垯
+         *
          * @return
          */
-        public List<VersionRule> getDelVRList(){
+        public List<VersionRule> getDelVRList() {
             List<VersionRule> list = new ArrayList<VersionRule>();
             exceptRev = new ArrayList<String>();
-            for(String btName : exceptBts){
+            for (String btName : exceptBts) {
                 try {
                     BizType bt = platformClientUtil.getBtmService().getBizTypeByName(btName);
                     String revName = bt.revRuleName;
-                    if(revName != null && !revName.equals("") && !exceptRev.contains(revName)){
+                    if (revName != null && !revName.equals("") && !exceptRev.contains(revName)) {
                         exceptRev.add(revName);
                     }
                 } catch (PLException e) {
@@ -1940,10 +2091,10 @@
             } catch (PLException e) {
                 e.printStackTrace();
             }
-            if(revs != null){
-                for(VersionRule rev : revs){
+            if (revs != null) {
+                for (VersionRule rev : revs) {
                     String name = rev.name;
-                    if(name != null && !name.equals("") && !exceptRev.contains(name)){
+                    if (name != null && !name.equals("") && !exceptRev.contains(name)) {
                         list.add(rev);
                     }
                 }
@@ -1953,4 +2104,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