From 3dd88eb315a90c2b793e10b0b987a6c3b09a8650 Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期三, 14 八月 2024 16:44:35 +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/OsLifeCycleServiceImpl.java  |    2 
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebBtmTypeController.java      |   83 +++
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsAttributeServiceI.java          |    3 
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsQuereyTemplateServiceI.java     |    8 
 Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/model/IndexObject.java                    |   28 +
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsBtmServiceImpl.java        |  367 +++++++++++++-
 Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/QTInfoDTO.java                        |   33 
 Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/OsBtmTypeVO.java                |   26 +
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsBtmServiceI.java                |   34 +
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsQueryTemplateController.java |   24 
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsAttributeController.java     |    2 
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsQueryTemplateImpl.java     |  628 ++++++++++++++++++++++++++
 Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsBtmTypePO.java                       |  108 ++++
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java  |   32 +
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLinkTypeServiceImpl.java   |    6 
 15 files changed, 1,306 insertions(+), 78 deletions(-)

diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/QTInfoDTO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/QTInfoDTO.java
index fa2f615..094b3db 100644
--- a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/QTInfoDTO.java
+++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/QTInfoDTO.java
@@ -1,16 +1,12 @@
 package com.vci.dto;
 
 
-import com.alibaba.fastjson.annotation.JSONField;
 import com.vci.common.qt.object.QueryTemplate;
-import com.vci.model.BaseLinkModel;
-import com.vci.starter.web.annotation.Column;
 import lombok.Data;
 
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 /**
  * 鏌ヨ妯℃澘鍒楄〃浼犺緭瀵硅薄
@@ -19,13 +15,24 @@
  */
 @Data
 public class QTInfoDTO {
-    public String qtName;
-    public String btmName;
-    public String creator;
-    public long createTime;
-    public String createTimeText;
-    public short levelFlag;
-    public String qtUIText;
-    public String qtText;
-    public QueryTemplate queryTemplate;
+    //鏌ヨ妯℃澘鍚�
+    private String qtName;
+    //绫诲瀷鍚�
+    private String btmName;
+    //鍒涘缓浜�
+    private String creator;
+    //鍒涘缓鏃堕棿
+    private long createTime;
+    private String createTimeText;
+    //"0:鏅�氭煡璇㈡ā鏉�; 1:楂樼骇鏌ヨ妯℃澘"
+    private short levelFlag;
+    //鏌ヨ妯℃澘鐣岄潰锛岃繖鏄珮绾ф煡璇㈢殑
+    private String qtUIText;
+    //鏌ヨ妯℃澘鍚�
+    private String qtText;
+    //鏌ヨ妯℃澘淇℃伅
+    private QueryTemplate queryTemplate;
+    //鏌ヨ鏉′欢锛屽悗绔繘琛岀浉鍏宠В鏋�
+    private List<HashMap<String,String>> condition;
+    private HashMap<String,Object> tree = new HashMap<>();
 }
diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/model/IndexObject.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/model/IndexObject.java
new file mode 100644
index 0000000..c4d6f1b
--- /dev/null
+++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/model/IndexObject.java
@@ -0,0 +1,28 @@
+package com.vci.model;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * @author ludc
+ * @date 2024/8/13 13:26
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class IndexObject {
+
+    private String oid;
+
+    private String typeName;
+
+    private String attrNames;
+
+    private String description;
+
+    private String indexName;
+
+    private String createTime;
+
+}
diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/OsBtmTypeVO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/OsBtmTypeVO.java
index 6dc7487..94ff8ad 100644
--- a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/OsBtmTypeVO.java
+++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/OsBtmTypeVO.java
@@ -36,6 +36,11 @@
     private String tableName;
 
     /**
+     * 鐖朵笟鍔$被鍨�
+     */
+    private String fName;
+
+    /**
      * 鎻忚堪
      */
     private String description;
@@ -176,10 +181,31 @@
     private Date ts;
 
     /**
+     * 鍖呭惈灞炴�у悕绉�
+     */
+    private String[] apNameArray;
+
+    /**
      * 鍖呭惈灞炴��
      */
     private List<OsBtmTypeAttributeVO> attributes;
 
+    public void setApNameArray(String[] apNameArray) {
+        this.apNameArray = apNameArray;
+    }
+
+    public String[] getApNameArray() {
+        return apNameArray;
+    }
+
+    public void setfName(String fName) {
+        this.fName = fName;
+    }
+
+    public String getfName() {
+        return fName;
+    }
+
     public void setDelimiter(String delimiter) {
         this.delimiter = delimiter;
     }
diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsBtmTypePO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsBtmTypePO.java
new file mode 100644
index 0000000..2d42882
--- /dev/null
+++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsBtmTypePO.java
@@ -0,0 +1,108 @@
+package com.vci.po;
+
+import com.vci.starter.poi.annotation.ExcelColumn;
+import com.vci.starter.web.pagemodel.BaseModelVO;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 涓氬姟绫诲瀷瀵煎叆瀵硅薄
+ * @author yuxc
+ * @date 2024/7/30 16:27
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class OsBtmTypePO extends BaseModelVO {
+
+    /**
+     * 绂佹淇敼杩欎釜鍊�
+     */
+    private static final long serialVersionUID = -2239512786206928201L;
+
+    /**
+     * 鎵�鍦ㄦ暟鎹
+     */
+    @ExcelColumn(rowIndexColumn = true,value = "")
+    private String rowIndex;
+
+    /**
+     * 鍚嶇О
+     */
+    @ExcelColumn(value="鍚嶇О",nullable = false)
+    private String name;
+
+    /**
+     * 鏍囩
+     */
+    @ExcelColumn(value="鏍囩")
+    private String lable;
+
+    /**
+     * 鎻忚堪
+     */
+    @ExcelColumn(value="鎻忚堪")
+    private String description;
+
+    /**
+     * 缁ф壙鑷�
+     */
+    @ExcelColumn(value="缁ф壙鑷�")
+    private String fName;
+
+    /**
+     * 瀹炵幇绫�
+     */
+    @ExcelColumn(value="瀹炵幇绫�")
+    private String implClass;
+
+    /**
+     * 鐗堟湰瑙勫垯
+     */
+    @ExcelColumn(value="鐗堟湰瑙勫垯")
+    private short revLevel;
+
+    /**
+     * 鐗堟湰鍙疯鍒�
+     */
+    @ExcelColumn(value="鐗堟湰鍙疯鍒�")
+    private String revRuleName;
+
+    /**
+     * 鏄惁鎵嬪伐杈撳叆
+     */
+    @ExcelColumn(value="鏄惁鎵嬪伐杈撳叆")
+    private String revInput;
+
+    /**
+     * 鍒嗛殧绗�
+     */
+    @ExcelColumn(value="鍒嗛殧绗�")
+    private String delimiter;
+
+    /**
+     * 鐗堟鍙疯鍒�
+     */
+    @ExcelColumn(value="鐗堟鍙疯鍒�")
+    private short verRuleName;
+
+    /**
+     * btmItemsTo
+     */
+    @ExcelColumn(value="鐢熷懡鍛ㄦ湡")
+    private String lifeCycle;
+
+    /**
+     * 澶囬�夌敓鍛藉懆鏈熷垪琛�
+     */
+    @ExcelColumn(value="澶囬�夌敓鍛藉懆鏈熷垪琛�",nullable = false)
+    private String lifeCycles;
+
+    /**
+     * 灞炴�у垪琛�
+     */
+    @ExcelColumn(value="灞炴�у垪琛�")
+    private String apNameArray;
+
+}
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsAttributeController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsAttributeController.java
index ae35b5d..e4a6f13 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsAttributeController.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsAttributeController.java
@@ -214,7 +214,7 @@
         try {
             file.transferTo(new File(excelFileName));
             if (file != null) {
-                return attributeService.importAttributes(file1);
+                return attributeService.importAttributes(file1,false);
             } else {
                 return BaseResult.fail(FrameWorkLangCodeConstant.IMPORT_FAIL, new String[]{"鏃犲鍏ョ殑鏂囦欢"});
             }
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsQueryTemplateController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsQueryTemplateController.java
index 8202ace..7eaabfb 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsQueryTemplateController.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsQueryTemplateController.java
@@ -3,6 +3,7 @@
 import com.vci.corba.common.PLException;
 import com.vci.corba.omd.ltm.LinkType;
 import com.vci.corba.omd.qtm.QTD;
+import com.vci.dto.QTInfoDTO;
 import com.vci.pagemodel.OsBtmTypeAttributeVO;
 import com.vci.pagemodel.OsBtmTypeVO;
 import com.vci.pagemodel.OsLinkTypeAttributeVO;
@@ -160,7 +161,11 @@
             objectBaseResult.setMsg(Arrays.toString(e.messages));
             return objectBaseResult;
         } catch (DocumentException e) {
-            throw new RuntimeException(e);
+            e.printStackTrace();
+            BaseResult objectBaseResult = new BaseResult<>();
+            objectBaseResult.setCode(500);
+            objectBaseResult.setMsg(Arrays.toString(e.getMessage().toCharArray()));
+            return objectBaseResult;
         }
     }
 
@@ -180,4 +185,21 @@
             return objectBaseResult;
         }
     }
+
+    /**
+     * 閾炬帴绫诲瀷鏌ヨ妯℃澘淇濆瓨
+     * @param qtInfoDTO 淇濆瓨浼犺緭瀵硅薄
+     * @return 淇濆瓨缁撴灉
+     */
+    @PostMapping("/linkSave")
+    public BaseResult linkSave(@RequestBody QTInfoDTO qtInfoDTO){
+        try {
+            return quereyTemplateServiceI.linkSave(qtInfoDTO);
+        } catch (PLException e) {
+            BaseResult objectBaseResult = new BaseResult<>();
+            objectBaseResult.setCode(Integer.parseInt(e.code));
+            objectBaseResult.setMsg(Arrays.toString(e.messages));
+            return objectBaseResult;
+        }
+    }
 }
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebBtmTypeController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebBtmTypeController.java
index 7e6b5cf..5e6f1f0 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebBtmTypeController.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebBtmTypeController.java
@@ -4,6 +4,7 @@
 import com.vci.corba.omd.btm.BizType;
 import com.vci.corba.omd.ltm.LinkType;
 import com.vci.dto.OsBtmTypeDTO;
+import com.vci.model.IndexObject;
 import com.vci.starter.web.annotation.controller.VciUnCheckRight;
 import com.vci.starter.web.annotation.log.VciBusinessLog;
 import com.vci.starter.web.enumpck.BooleanEnum;
@@ -30,6 +31,7 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletResponse;
 import java.io.FileNotFoundException;
@@ -39,6 +41,7 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
+import java.util.Map;
 import java.util.stream.Collectors;
 
 import static com.vci.constant.FrameWorkBusLangCodeConstant.DATA_OID_NOT_EXIST;
@@ -171,7 +174,7 @@
      * btmTypeDTO 閾炬帴绫诲瀷鐨勪繚瀛樺璞�
      * @return 淇濆瓨缁撴灉
      */
-    @PostMapping("/addBtmTypes")
+    /*@PostMapping("/addBtmTypes")
     public BaseResult addBtmTypes(@RequestBody List<BizType> bizTypes){
         try {
             return btmService.addBtmTypes(bizTypes) ? BaseResult.success("涓氬姟绫诲瀷鎵归噺鍒涘缓鎴愬姛锛�"):BaseResult.fail("涓氬姟绫诲瀷鎵归噺鍒涘缓澶辫触锛�");
@@ -181,7 +184,7 @@
             logger.error(exceptionMessage);
             return BaseResult.fail(exceptionMessage);
         }
-    }
+    }*/
 
     /**
      * 淇敼涓氬姟绫诲瀷
@@ -318,6 +321,82 @@
     }
 
     /**
+     * 鑾峰彇褰撳墠涓氬姟绫诲瀷涓嬬殑绱㈠紩
+     * @return
+     * @throws PLException
+     */
+    @GetMapping("/getIndexByCondition")
+    public BaseResult getIndexByCondition(BaseQueryObject baseQueryObject){
+        try {
+            return BaseResult.dataList(btmService.getIndexByCondition(baseQueryObject.getConditionMap()));
+        } catch (Exception e) {
+            e.printStackTrace();
+            String exceptionMessage = "鏌ヨ褰撳墠涓氬姟绫诲瀷涓嬬殑绱㈠紩鏃舵椂鍑虹幇閿欒锛屽師鍥狅細" + VciBaseUtil.getExceptionMessage(e);
+            logger.error(exceptionMessage);
+            return BaseResult.fail(exceptionMessage);
+        }
+    }
+
+    /**
+     * 鍒涘缓绱㈠紩
+     * @param indexObjectList
+     * @return
+     */
+    @PostMapping("/addIndex")
+    public BaseResult addIndex(@RequestBody List<IndexObject> indexObjectList){
+        try {
+            return btmService.addIndex(indexObjectList) ? BaseResult.success("鍒涘缓绱㈠紩鎴愬姛!"):BaseResult.fail("鍒涘缓绱㈠紩澶辫触!");
+        } catch (Exception e) {
+            e.printStackTrace();
+            String exceptionMessage = "鍒涘缓绱㈠紩鏃舵椂鍑虹幇閿欒锛屽師鍥狅細" + VciBaseUtil.getExceptionMessage(e);
+            logger.error(exceptionMessage);
+            return BaseResult.fail(exceptionMessage);
+        }
+    }
+
+    /**
+     * 鍒犻櫎绱㈠紩
+     * @param btmName
+     * @param indexName
+     * @return
+     */
+    @DeleteMapping("/delIndex")
+    public BaseResult delIndex(String btmName,String indexName){
+        try {
+            return btmService.delIndex(btmName,indexName) ? BaseResult.success("鍒犻櫎绱㈠紩鎴愬姛!"):BaseResult.fail("鍒犻櫎绱㈠紩澶辫触!");
+        } catch (Exception e) {
+            e.printStackTrace();
+            String exceptionMessage = "鍒犻櫎绱㈠紩鏃舵椂鍑虹幇閿欒锛屽師鍥狅細" + VciBaseUtil.getExceptionMessage(e);
+            logger.error(exceptionMessage);
+            return BaseResult.fail(exceptionMessage);
+        }
+    }
+
+    /**
+     * 瀵煎嚭涓氬姟绫诲瀷
+     * name 閾炬帴绫诲瀷鍚嶇О
+     * @return
+     */
+    @GetMapping("/expData")
+    public void expData(String name,HttpServletResponse response) throws PLException, IOException {
+        btmService.expData(name, response);
+    }
+
+    /**
+     * 瀵煎叆涓氬姟绫诲瀷
+     * @param file 涓婁紶鐨勬枃浠�
+     * @return
+     */
+    @PostMapping("/impData")
+    @VciUnCheckRight
+    public BaseResult impData(MultipartFile file){try {
+        return btmService.impData(file);
+    }catch (Throwable e) {
+        throw new VciBaseException(VciBaseUtil.getExceptionMessage(e),new String[0],e);
+    }
+    }
+
+    /**
      * 鑾峰彇涓氬姟绫诲瀷鍖呭惈鐨勫睘鎬у叏閮ㄤ负灏忓啓
      * @param btmId 涓氬姟绫诲瀷鍚嶇О
      * @return 灞炴�х殑淇℃伅
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsAttributeServiceI.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsAttributeServiceI.java
index 2f45519..f2c91dc 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsAttributeServiceI.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsAttributeServiceI.java
@@ -166,9 +166,10 @@
 	/**
 	 * 瀵煎叆灞炴��
 	 * @param file
+	 * @param isContinue 绯荤粺涓嚭鐜伴噸澶嶆槸鍚﹁烦杩囨姤閿欑户缁墽琛�
 	 * @return
 	 */
-	BaseResult importAttributes(File file) throws Exception;
+	BaseResult importAttributes(File file,boolean isContinue/*绯荤粺涓嚭鐜伴噸澶嶆槸鍚﹁烦杩囨姤閿欑户缁墽琛�*/) throws Exception;
 
 	/**
 	 * 鏄惁榛樿鐨勫睘鎬�
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsBtmServiceI.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsBtmServiceI.java
index e8abcb5..1256d2a 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsBtmServiceI.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsBtmServiceI.java
@@ -3,6 +3,7 @@
 import com.vci.corba.common.PLException;
 import com.vci.corba.omd.btm.BizType;
 import com.vci.dto.OsBtmTypeDTO;
+import com.vci.model.IndexObject;
 import com.vci.pagemodel.OsBtmTypeAttributeVO;
 import com.vci.pagemodel.OsBtmTypeVO;
 import com.vci.pagemodel.OsERVO;
@@ -11,7 +12,9 @@
 import com.vci.starter.web.pagemodel.DataGrid;
 import com.vci.starter.web.pagemodel.PageHelper;
 import com.vci.starter.web.pagemodel.Tree;
+import org.springframework.web.multipart.MultipartFile;
 
+import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.text.ParseException;
 import java.util.Collection;
@@ -187,7 +190,7 @@
      * @param bizTypes
      * @return
      */
-    boolean addBtmTypes(List<BizType> bizTypes);
+    //boolean addBtmTypes(List<BizType> bizTypes);
 
     /**
      * 淇敼涓氬姟绫诲瀷
@@ -249,26 +252,39 @@
     BaseResult deleteAllType() throws PLException;
 
     /**
-     * 鏍规嵁涓氬姟绫诲瀷鍚嶇О鍜屽叾涓嬬殑灞炴�у悕绉拌幏鍙栦篃鏈夌殑绱㈠紩
-     * @param btmName
-     * @param attrName
+     * 鏍规嵁涓氬姟绫诲瀷鍚嶇О鍜岀储寮曞悕绉版煡璇㈣幏鍙栧凡鏈夌殑绱㈠紩
+     * @param conditionMap 鏍规嵁鏌ヨ鏉′欢浼犲弬: typename:涓氬姟绫诲瀷鍚�;indexname:绱㈠紩鍚�
      * @return
      */
-    List<String> getIndexByBtmAndAttrName(String btmName,String attrName);
+    List<IndexObject> getIndexByCondition(Map<String,String> conditionMap) throws PLException;
 
     /**
      * 鏍规嵁涓氬姟绫诲瀷鍚嶇О鍜屽叾涓嬬殑灞炴�у悕绉板垹闄ょ储寮�
      * @param btmName
-     * @param attrName
+     * @param indexName
      * @return
      */
-    boolean delIndexByBtmAndAttrName(String btmName,String attrName);
+    boolean delIndex(String btmName,String indexName) throws PLException;
 
     /**
      * 缁欎笟鍔$被鍨嬩笅鐨勬寚瀹氬睘鎬ф柊澧炵储寮�
-     * @param addMap 濡傦細(btmName:part  attrName:name  indexName: PARTNAMEINDEX)
+     * @param indexObjectList
      * @return
      */
-    boolean addIndex(Map<String,String> addMap);
+    boolean addIndex(List<IndexObject> indexObjectList) throws PLException;
+
+    /**
+     * 瀵煎嚭涓氬姟绫诲瀷
+     * name 涓氬姟绫诲瀷鍚嶇О
+     * @return 鍒涘缓缁撴灉
+     */
+    void expData(String oid, HttpServletResponse response) throws PLException, IOException;
+
+    /**
+     * 瀵煎叆涓氬姟绫诲瀷
+     * @param file 涓婁紶鐨勬枃浠�
+     * @return
+     */
+    BaseResult impData(MultipartFile file) throws Exception;
 
 }
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsQuereyTemplateServiceI.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsQuereyTemplateServiceI.java
index e071a29..4cd367d 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsQuereyTemplateServiceI.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsQuereyTemplateServiceI.java
@@ -3,6 +3,7 @@
 import com.vci.corba.common.PLException;
 import com.vci.corba.omd.ltm.LinkType;
 import com.vci.corba.omd.qtm.QTD;
+import com.vci.dto.QTInfoDTO;
 import com.vci.pagemodel.OsBtmTypeAttributeVO;
 import com.vci.pagemodel.OsLinkTypeAttributeVO;
 import com.vci.pagemodel.OsLinkTypeVO;
@@ -75,4 +76,11 @@
      * @return 鏌ヨ缁撴灉
      */
     BaseResult isExistsQT(String name) throws PLException;
+
+    /**
+     * 閾炬帴绫诲瀷鏌ヨ妯℃澘淇濆瓨
+     * @param qtInfoDTO 淇濆瓨浼犺緭瀵硅薄
+     * @return 淇濆瓨缁撴灉
+     */
+    BaseResult linkSave(QTInfoDTO qtInfoDTO) throws PLException;
 }
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java
index c95d0bf..302d878 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java
@@ -479,6 +479,10 @@
 		);
 		//灞炴�ц嫳鏂囧悕绉版牎楠岋紙鍒ょ┖銆佺郴缁熶腑鍒ら噸銆佹槸鍚﹀叧閿瓧銆佹槸鍚﹀悎瑙勭瓑锛�
 		checkName(osAttributeDTO.getId());
+		//妫�鏌ュ睘鎬у悕鏄惁宸插瓨鍦ㄤ笌绯荤粺涓�
+		if(platformClientUtil.getAttributeService().checkRowIsExists(osAttributeDTO.getId())){
+			throw new PLException("500",new String[]{"灞炴�у悕绉般��" + osAttributeDTO.getId() + "銆戝湪绯荤粺涓凡瀛樺湪!"});
+		}
 		//妫�鏌ラ粯璁ゅ�间笌灞炴�х被鍨嬫槸鍚﹀尮閰�
 		checkDefValue(osAttributeDTO);
 		//osAttributeDTO.setOid(VciBaseUtil.getPk().toUpperCase(Locale.ROOT));
@@ -693,9 +697,9 @@
 			throw new PLException("500",new String[]{"灞炴�у悕鏃犳晥,鍘熷洜锛氬睘鎬у悕鏄暟鎹簱鍏抽敭瀛�!"});
 		}
 		//妫�鏌ュ睘鎬у悕鏄惁宸插瓨鍦ㄤ笌绯荤粺涓�
-		if(platformClientUtil.getAttributeService().checkRowIsExists(abName)){
+		/*if(platformClientUtil.getAttributeService().checkRowIsExists(abName)){
 			throw new PLException("500",new String[]{"灞炴�у悕绉般��" + abName + "銆戝湪绯荤粺涓凡瀛樺湪!"});
-		}
+		}*/
 	}
 
 	/**
@@ -997,10 +1001,12 @@
 	/**
 	 * 瀵煎叆灞炴��
 	 * @param file
+	 * @param isContinue 绯荤粺涓嚭鐜伴噸澶嶆槸鍚﹁烦杩囨姤閿欑户缁墽琛�
 	 * @return
+	 * @throws Exception
 	 */
 	@Override
-	public BaseResult importAttributes(File file) throws Exception{
+	public BaseResult importAttributes(File file, boolean isContinue) throws Exception{
 		VciBaseUtil.alertNotNull(file,"excel鏂囦欢");
 		if(!file.exists()){
 			throw new VciBaseException("瀵煎叆鐨別xcel鏂囦欢涓嶅瓨鍦�,{0}",new String[]{file.getPath()});
@@ -1017,13 +1023,29 @@
 			List<OsAttributeDTO> dtoList = new ArrayList<>();
 			//褰撳墠excel涓槸鍚﹂噸澶嶇敤鐨勫垽閲峂ap:锛坘ey锛氬垽閲嶅睘鎬э紝value锛氳鍙凤級
 			Map<String, String> excelReapeat = new HashMap<>();
-			poList.stream().forEach(osAttributePO -> {
+			for (int i = 0; i < poList.size(); i++) {
+				OsAttributePO osAttributePO = poList.get(i);
 				if(Func.isBlank(osAttributePO.getId())){//灞炴�у悕鍒ょ┖
 					throw new VciBaseException("绗��"+osAttributePO.getRowIndex()+"銆戣锛宎ttrnameerror");
 				}else if(Func.isBlank(osAttributePO.getAttributeDataType())){
 					throw new VciBaseException("绗��"+osAttributePO.getRowIndex()+"銆戣锛宼ypeerror");
 				}else if(excelReapeat.containsKey(osAttributePO.getId())){//灞炴�у悕琛ㄦ牸涓垽閲�
 					throw new VciBaseException("绗��"+excelReapeat.get(osAttributePO.getId())+"銆戣鍜岀銆�"+osAttributePO.getRowIndex()+"銆戣鏁版嵁锛屽睘鎬у悕閲嶅");
+				}else {
+					try {
+						if(platformClientUtil.getAttributeService().checkRowIsExists(osAttributePO.getId())){
+							throw new PLException("500",new String[]{"灞炴�у悕绉般��" + osAttributePO.getId() + "銆戝湪绯荤粺涓凡瀛樺湪!"});
+						}
+					} catch (PLException e) {
+						e.printStackTrace();
+						String errorMsg = "涓庣郴缁熶腑灞炴�у悕鏌ラ噸鏃跺嚭鐜伴敊璇�,鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e);
+						logger.error(errorMsg);
+						//鏄惁璺宠繃褰撴湡閲嶅鏁版嵁
+						if(isContinue){
+							continue;
+						}
+						throw new VciBaseException(errorMsg);
+					}
 				}
 				//灞炴�у悕鏍¢獙
 				try {
@@ -1076,7 +1098,7 @@
 					throw new VciBaseException(VciBaseUtil.getExceptionMessage(e));
 				}
 				dtoList.add(osAttributeDTO);
-			});
+			}
 			//鎵ц淇濆瓨鎿嶄綔
 			dtoList.stream().forEach(dto->{
 				try {
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 22c0296..aace24a 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
@@ -1,12 +1,21 @@
 package com.vci.web.service.impl;
 
+import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.util.ZipUtil;
 import com.fasterxml.jackson.core.type.TypeReference;
 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;
 import com.vci.corba.omd.btm.BizType;
+import com.vci.corba.omd.data.AttributeValue;
+import com.vci.corba.omd.data.BusinessObject;
 import com.vci.corba.omd.etm.EnumType;
 import com.vci.corba.omd.lcm.Bound;
 import com.vci.corba.omd.lcm.LifeCycle;
@@ -15,10 +24,19 @@
 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;
 import com.vci.omd.objects.OtherInfo;
+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.enumpck.BooleanEnum;
 import com.vci.starter.web.exception.VciBaseException;
@@ -26,15 +44,10 @@
 import com.vci.starter.web.pagemodel.DataGrid;
 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.VciBaseUtil;
-import com.vci.starter.web.util.VciDateUtil;
-import com.vci.starter.web.util.WebThreadLocalUtil;
 import com.vci.web.service.*;
-import com.vci.web.util.ConcurrentDateFormat;
-import com.vci.web.util.Func;
-import com.vci.web.util.PlatformClientUtil;
-import com.vci.web.util.WebUtil;
+import com.vci.web.util.*;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -42,8 +55,11 @@
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
+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;
 import java.text.SimpleDateFormat;
@@ -192,7 +208,7 @@
             }
             vo.setDescription(btmItem.description);
             vo.setId(btmItem.name);
-             vo.setName(btmItem.label);
+            vo.setName(btmItem.label);
             vo.setLifeCycleId(btmItem.lifeCycle);
             vo.setAbstractFlag(btmItem.isAbstract);
             vo.setImplClass(btmItem.implClass);
@@ -202,11 +218,13 @@
             vo.setTableName(VciBaseUtil.getTableName(vo.getId()));
             vo.setInputRevisionFlag(btmItem.revInput);
             vo.setDelimiter(btmItem.delimiter);
+            vo.setfName(btmItem.fName);
             if(StringUtils.isNotBlank(vo.getRevisionRuleId()) || vo.isInputRevisionFlag()){
                 vo.setRevisionFlag(true);
             }
             vo.setVersionRule(String.valueOf(btmItem.verRuleName));
             vo.setSubLifeCycleId(Arrays.stream(btmItem.lifeCycles).collect(Collectors.joining(",")));
+            vo.setApNameArray(btmItem.apNameArray);
             List<OsAttributeVO> attributeVOS = attributeService.listAttrByIds(Arrays.stream(btmItem.apNameArray).collect(Collectors.toList()));
             List<OsBtmTypeAttributeVO> btmTypeAttributeVOS = new ArrayList<>();
             Optional.ofNullable(attributeVOS).orElseGet(()->new ArrayList<>()).stream().forEach(attributeVO->{
@@ -580,18 +598,20 @@
     public List<Tree> getTreeBizTypes() throws PLException {
         List<Tree> rootTreeList = new ArrayList<>();
         BizType[] bizTypes = getBizTypes("");
-        BizType btItem = null;
-        for(int i = 0; i < bizTypes.length; i++){
-            btItem = bizTypes[i];
-            if(btItem.fName.equals("")){
+        OsBtmTypeVO osBtmTypeVO = null;
+        List<OsBtmTypeVO> osBtmTypeVOS = btmDO2VOs(Arrays.asList(bizTypes));
+        for(int i = 0; i < osBtmTypeVOS.size(); i++){
+            osBtmTypeVO = osBtmTypeVOS.get(i);
+
+            if(osBtmTypeVO.getfName().equals("")){
                 Tree tree = new Tree();
-                tree.setOid(btItem.oid);
+                tree.setOid(osBtmTypeVO.getOid());
                 tree.setParentName(null);
                 tree.setParentId(null);
                 tree.setLeaf(true);
-                tree.setText(btItem.description);
-                tree.setAttributes(WebUtil.objectToMapString(btItem));
-                tree.setChildren(getChildren(bizTypes,btItem));
+                tree.setText(osBtmTypeVO.getDescription());
+                tree.setAttributes(WebUtil.objectToMapString(osBtmTypeVO));
+                tree.setChildren(getChildren(osBtmTypeVOS,osBtmTypeVO));
                 rootTreeList.add(tree);
             }
         }
@@ -734,7 +754,7 @@
      * @param bizTypes
      * @return
      */
-    @Override
+/*    @Override
     public boolean addBtmTypes(List<BizType> bizTypes) {
         VciBaseUtil.alertNotNull(bizTypes,"鍒涘缓鐨勪笟鍔$被鍨嬪璞″垪琛�");
         bizTypes.stream().forEach(bizType->{
@@ -747,9 +767,8 @@
                 throw new VciBaseException(exceptionMessage);
             }
         });
-
         return true;
-    }
+    }*/
 
     /**
      * 妫�鏌ヤ笟鍔$被鍨嬪悕绉版槸鍚﹀悎瑙�
@@ -809,7 +828,6 @@
         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[]{"鐗堟湰鍙樻洿閿欒锛氫笉鑳戒粠浜岀骇鍙樹负涓�绾ф垨涓嶅彲淇"});
         }
@@ -1119,35 +1137,304 @@
     }
 
     /**
-     * 鏍规嵁涓氬姟绫诲瀷鍚嶇О鍜屽叾涓嬬殑灞炴�у悕绉拌幏鍙栦篃鏈夌殑绱㈠紩
-     * @param btmName
-     * @param attrName
+     * 鏍规嵁涓氬姟绫诲瀷鍚嶇О鍜屽叾涓嬬殑灞炴�у悕绉拌幏鍙栧凡鏈夌殑绱㈠紩
+     * @param conditionMap 鏍规嵁鏌ヨ鏉′欢浼犲弬: typename:涓氬姟绫诲瀷鍚�;
      * @return
      */
     @Override
-    public List<String> getIndexByBtmAndAttrName(String btmName, String attrName) {
-        return null;
+    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];
+            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"));
+            indexObjects.add(indexObject);
+        }
+        return indexObjects;
     }
 
     /**
      * 鏍规嵁涓氬姟绫诲瀷鍚嶇О鍜屽叾涓嬬殑灞炴�у悕绉板垹闄ょ储寮�
      * @param btmName
-     * @param attrName
+     * @param indexName
      * @return
      */
     @Override
-    public boolean delIndexByBtmAndAttrName(String btmName, String attrName) {
-        return false;
+    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) {
+            String[] indexAttr = {indexName};
+
+            boolean alterFlag = platformClientUtil.getBtmService().dropIndex(btmName, indexAttr);
+
+            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);
+            }
+        }
+        return true;
     }
 
     /**
      * 缁欎笟鍔$被鍨嬩笅鐨勬寚瀹氬睘鎬ф柊澧炵储寮�
-     * @param addMap 濡傦細(btmName:part  attrName:name  indexName: PARTNAMEINDEX)
+     * @param indexObjectList
      * @return
      */
     @Override
-    public boolean addIndex(Map<String, String> addMap) {
-        return false;
+    public boolean addIndex(List<IndexObject> indexObjectList) throws PLException {
+        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);
+        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);
+                }
+            }
+        }
+
+        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;
+            }
+            boList.add(bo);
+            //娣诲姞绱㈠紩淇℃伅鍒扮储寮曠殑涓氬姟琛ㄤ腑
+            //platformClientUtil.getBOFactoryService().createBusinessObject(bo,false,false);
+        }
+        //娣诲姞绱㈠紩淇℃伅鍒扮储寮曠殑涓氬姟琛ㄤ腑
+        platformClientUtil.getBOFactoryService().batchCreateBusinessObject(boList.toArray(new BusinessObject[boList.size()]),false,false);
+        return true;
+    }
+
+    /**
+     * 瀵煎嚭涓氬姟绫诲瀷
+     * name 涓氬姟绫诲瀷鍚嶇О
+     * @return 鍒涘缓缁撴灉
+     */
+    @Override
+    public void expData(String names, HttpServletResponse response) throws PLException, IOException {
+        String defaultTempFolder = LocalFileUtil.getDefaultTempFolder();
+        //鍐檈xcel
+        String excelPath = defaultTempFolder + File.separator + "btm.xls";
+        //璁剧疆鍒楀悕
+        List<String> columns = new ArrayList<>(
+                Arrays.asList("绫诲瀷鍚嶇О", "鏍囩", "缁ф壙鑷�", "瀹炵幇绫�", "鎻忚堪", "鐗堟湰瑙勫垯", "鐗堟湰鍙疯鍒�",
+                        "鏄惁鎵嬪伐杈撳叆","鍒嗛殧绗�", "鐗堟鍙疯鍒�","鐢熷懡鍛ㄦ湡", "澶囬�夌敓鍛藉懆鏈熷垪琛�","灞炴�у垪琛�")
+        );
+        try {
+            new File(excelPath).createNewFile();
+            //璁剧疆鍒�
+            List<WriteExcelData> excelDataList = new ArrayList<>();
+            //璁剧疆鍒楀ご
+            for (int index = 0; index < columns.size(); 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)));
+                attributes.addAll(Arrays.asList(bizType.apNameArray));
+                i++;
+            }
+            WriteExcelOption excelOption = new WriteExcelOption(excelDataList);
+            ExcelUtil.writeDataToFile(excelPath, excelOption);
+            //瀵煎嚭灞炴��
+            String attrPath = attributeService.exportAttributes("btmattr",
+                    attributes.stream().collect(Collectors.joining(",")),true);
+            //绉诲姩灞炴�у埌閾炬帴绫诲瀷鏂囦欢澶归噷闈㈠幓
+            cn.hutool.core.io.FileUtil.move(new File(attrPath), new File(defaultTempFolder),true);
+            cn.hutool.core.io.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());
+    }
+
+    /**
+     * 瀵煎叆涓氬姟绫诲瀷
+     * @param file 涓婁紶鐨勬枃浠�
+     * @return
+     */
+    @Override
+    public BaseResult impData(MultipartFile file) throws Exception {
+        String defaultTempFolder = LocalFileUtil.getDefaultTempFolder();
+        String fileName = defaultTempFolder + File.separator + LocalFileUtil.getFileNameForIE(file.getOriginalFilename());
+        file.transferTo(new File(fileName));
+        if (file == null) {
+            return BaseResult.fail(FrameWorkLangCodeConstant.IMPORT_FAIL, new String[]{"鏃犲鍏ョ殑鏂囦欢"});
+        }
+        if (!fileName.endsWith(".zip") || !fileName.endsWith(".rar")) {
+            throw new VciBaseException("浠呰兘涓婁紶zip鍘嬬缉鏂囦欢锛岃閲嶆柊涓婁紶锛�");
+        }
+        File unzip = ZipUtil.unzip(fileName);
+        File btmExcel = new File(unzip.getAbsolutePath() + File.separator + "btm.xls");
+        File attrExcel = new File(unzip.getAbsolutePath() + File.separator + "btmattr.xls");
+        if (!attrExcel.exists()) {
+            //澧炲姞瑙e帇鐨勮矾寰勶紝鐪嬫枃浠惰繕鍦ㄦ病鏈�
+            attrExcel = new File(unzip.getAbsolutePath() + File.separator + unzip.getName() + File.separator + "btmattr.xls");
+            if (!attrExcel.exists()) {
+                return BaseResult.fail(FrameWorkLangCodeConstant.IMPORT_FAIL, new String[]{"娌℃湁瀵煎叆鐨勫睘鎬ф枃浠躲�傚鍏ョ粓姝紒"});
+            }
+        }
+        //TODO锛氬鍏ュ睘鎬э紝浣嗘槸杩欎釜閫昏緫瀹為檯涓婂瓨鍦ㄤ竴浜涢棶棰橈紝瀵煎叆鐨勫睘鎬у彧鏄笟鍔$被鍨嬬殑灞炴�т笉搴旇鍘荤粰灞炴�ф睜瀵煎叆锛屽彲鑳芥槸鎯崇殑灞炴�т笉瀛樺湪鐨勫氨鏂板涓�娆�
+        BaseResult baseResult = attributeService.importAttributes(attrExcel,true);
+        if(!baseResult.isSuccess()){
+            //鍒犻櫎涓婁紶鐨勬枃浠跺す
+            FileUtil.del(defaultTempFolder + File.separator);
+            return baseResult;
+        }
+        //鍏ヤ笟鍔$被鍨�
+        if (!btmExcel.exists()) {
+            //澧炲姞瑙e帇鐨勮矾寰勶紝鐪嬫枃浠惰繕鍦ㄦ病鏈�
+            btmExcel = new File(unzip.getAbsolutePath() + File.separator + unzip.getName() + File.separator + "btm.xls");
+            if (!btmExcel.exists()) {
+                //鍒犻櫎涓婁紶鐨勬枃浠跺す
+                FileUtil.del(defaultTempFolder + File.separator);
+                return BaseResult.fail(FrameWorkLangCodeConstant.IMPORT_FAIL, new String[]{"娌℃湁瀵煎叆鐨勯摼鎺ユ枃浠躲�傚鍏ョ粓姝紒"});
+            }
+        }
+        try{
+            //1銆佽鍙杄xcel涓殑鏁版嵁锛岀粍鎴愬璞�
+            ReadExcelOption excelOption = new ReadExcelOption();
+            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[]{});
+            }
+            //褰撳墠excel涓槸鍚﹂噸澶嶇敤鐨勫垽閲峂ap:锛坘ey锛氬垽閲嶅睘鎬э紝value锛氳鍙凤級
+            Map<String, String> excelReapeat = new HashMap<>();
+            int maxLength = platformClientUtil.getLinkTypeService().getLTNameMaxLength();
+
+            //鍒ゆ柇蹇呭~灞炴�ф槸鍚︿负绌猴紝鐢ㄦ埛鏄惁宸插瓨鍦紝浠ュ強閮ㄩ棬鏄惁濉敊绛夋牎楠岄�昏緫
+            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()+"銆戣锛岀増鏈彿瑙勫垯涓嶈兘涓虹┖");
+                }
+                try {
+                    BizType historyBtm = platformClientUtil.getBtmService().getBizTypeByName(osBtmTypePO.getName());
+                    //宸叉湁姝ゆ暟鎹繘琛屽垹闄よ鐩�
+                    if(historyBtm != null && !historyBtm.name.equals("")){
+                        platformClientUtil.getBtmService().deleteBizType(historyBtm);
+                    }
+                } catch (PLException e) {
+                    throw new RuntimeException(e);
+                }
+
+                //灞炴�у悕excel涓垽閲嶅鐞�
+                excelReapeat.put(osBtmTypePO.getName(),osBtmTypePO.getRowIndex());
+                BizType bizType = new BizType();
+                bizType.name = osBtmTypePO.getName();
+                bizType.label = osBtmTypePO.getLable();
+                bizType.description = osBtmTypePO.getDescription();
+                bizType.fName = osBtmTypePO.getFName();
+                bizType.implClass = osBtmTypePO.getImplClass();
+                bizType.revLevel = osBtmTypePO.getRevLevel();
+                bizType.revRuleName = osBtmTypePO.getRevRuleName();
+                bizType.revInput = Boolean.parseBoolean(osBtmTypePO.getRevInput().toLowerCase(Locale.ROOT));
+                bizType.delimiter = osBtmTypePO.getDelimiter();
+                bizType.verRuleName = osBtmTypePO.getVerRuleName();
+                bizType.lifeCycle = osBtmTypePO.getLifeCycle();
+                bizType.lifeCycles = osBtmTypePO.getLifeCycles().split(",");
+                bizType.apNameArray = osBtmTypePO.getApNameArray().split(",");
+                String userId = WebUtil.getCurrentUserId();
+                bizType.modifier = userId;
+                bizType.creator = userId;
+                try {
+                    platformClientUtil.getBtmService().addBizType(bizType);
+                } catch (PLException e) {
+                    throw new RuntimeException(e);
+                }
+            });
+        }catch (Exception e){
+            if(logger.isErrorEnabled()){
+                logger.error("璇诲彇excel鍐呭鏃舵垨淇濆瓨涓氬姟绫诲瀷淇℃伅鏃跺嚭鐜颁簡閿欒锛屽叿浣撳師鍥狅細",VciBaseUtil.getExceptionMessage(e));
+            }
+            e.printStackTrace();
+            return BaseResult.fail(VciBaseUtil.getExceptionMessage(e),new String[]{},e);
+        }
+        //鍒犻櫎涓婁紶鐨勬枃浠跺す
+        FileUtil.del(defaultTempFolder + File.separator);
+        return BaseResult.success("涓氬姟绫诲瀷瀵煎叆鎴愬姛锛�");
     }
 
     /**
@@ -1186,21 +1473,21 @@
         return flag;
     }
 
-    private List<Tree> getChildren(BizType[] bizTypes,BizType parentBIzType){
+    private List<Tree> getChildren(List<OsBtmTypeVO> osBtmTypeVOS,OsBtmTypeVO parentBIzType){
         List<Tree> trees= new ArrayList<>();
-        for (BizType bizType : bizTypes) {
-            if(StringUtils.isBlank(bizType.fName)){
+        for (OsBtmTypeVO bizType : osBtmTypeVOS) {
+            if(StringUtils.isBlank(bizType.getfName())){
                 continue;
             }
-            if(bizType.fName.equals(parentBIzType.name)){
+            if(bizType.getfName().equals(parentBIzType.getName())){
                 Tree tree = new Tree();
-                tree.setOid(bizType.oid);
-                tree.setParentName(parentBIzType.fName);
-                tree.setParentId(parentBIzType.oid);
+                tree.setOid(bizType.getOid());
+                tree.setParentName(parentBIzType.getfName());
+                tree.setParentId(parentBIzType.getOid());
                 tree.setLeaf(true);
-                tree.setText(bizType.description);
+                tree.setText(bizType.getDescription());
                 tree.setAttributes(WebUtil.objectToMapString(bizType));
-                tree.setChildren(getChildren(bizTypes,bizType));
+                tree.setChildren(getChildren(osBtmTypeVOS,bizType));
                 trees.add(tree);
             }
         }
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLifeCycleServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLifeCycleServiceImpl.java
index bbf8729..26e995a 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLifeCycleServiceImpl.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLifeCycleServiceImpl.java
@@ -713,7 +713,7 @@
 			throw new PLException("500",new String[]{"璇峰嬀閫夎瀵煎嚭鐨勭敓鍛藉懆鏈熸ā鏉�!"});
 		}
 		//鐣岄潰娌′紶鍚嶇О锛屼娇鐢ㄩ粯璁ゅ鍑哄悕绉�
-		exportFileName = Func.isBlank(exportFileName) ?  "鐗堟湰瑙勫垯瀵煎嚭_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss"):exportFileName;
+		exportFileName = Func.isBlank(exportFileName) ?  "鐢熷懡鍛ㄦ湡瀵煎嚭_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss"):exportFileName;
 		//璁剧疆鍒楀悕
 		List<String> columns = this.getCloumns(flag);
 
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLinkTypeServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLinkTypeServiceImpl.java
index bd33e47..c9cf8d5 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLinkTypeServiceImpl.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLinkTypeServiceImpl.java
@@ -611,7 +611,7 @@
                 return BaseResult.fail(FrameWorkLangCodeConstant.IMPORT_FAIL, new String[]{"娌℃湁瀵煎叆鐨勫睘鎬ф枃浠躲�傚鍏ョ粓姝紒"});
             }
         }
-        BaseResult baseResult = attributeService.importAttributes(attrExcel);
+        BaseResult baseResult = attributeService.importAttributes(attrExcel,true);
         if(!baseResult.isSuccess()){
             //鍒犻櫎涓婁紶鐨勬枃浠跺す
             FileUtil.del(defaultTempFolder + File.separator);
@@ -648,7 +648,7 @@
                 }else if(!osLinkTypePO.getName().matches("^[A-Za-z]+$")){
                     throw new VciBaseException("绗��"+osLinkTypePO.getRowIndex()+"銆戣锛岄摼鎺ョ被鍨嬪悕绉板彧鑳戒负鑻辨枃瀛楁瘝");
                 }else if(excelReapeat.containsKey(osLinkTypePO.getName())){//灞炴�у悕琛ㄦ牸涓垽閲�
-                    throw new VciBaseException("绗��"+excelReapeat.get(osLinkTypePO.getName())+"銆戣鍜岀銆�"+osLinkTypePO.getRowIndex()+"銆戣鏁版嵁锛屽睘鎬у悕閲嶅");
+                    throw new VciBaseException("绗��"+excelReapeat.get(osLinkTypePO.getName())+"銆戣鍜岀銆�"+osLinkTypePO.getRowIndex()+"銆戣鏁版嵁锛岄摼鎺ョ被鍨嬪悕閲嶅");
                 }
                 try {
                     LinkType historyLink = platformClientUtil.getLinkTypeService().getLinkType(osLinkTypePO.getName());
@@ -687,7 +687,7 @@
             });
         }catch (Exception e){
             if(logger.isErrorEnabled()){
-                logger.error("璇诲彇excel鍐呭鏃舵垨淇濆瓨鐢ㄦ埛淇℃伅鏃跺嚭鐜颁簡閿欒锛屽叿浣撳師鍥狅細",VciBaseUtil.getExceptionMessage(e));
+                logger.error("璇诲彇excel鍐呭鏃舵垨淇濆瓨閾炬帴绫诲瀷淇℃伅鏃跺嚭鐜颁簡閿欒锛屽叿浣撳師鍥狅細",VciBaseUtil.getExceptionMessage(e));
             }
             e.printStackTrace();
             return BaseResult.fail(VciBaseUtil.getExceptionMessage(e),new String[]{},e);
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsQueryTemplateImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsQueryTemplateImpl.java
index ca8ac52..44d39ff 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsQueryTemplateImpl.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsQueryTemplateImpl.java
@@ -1,13 +1,15 @@
 package com.vci.web.service.impl;
 
+import com.alibaba.fastjson.JSONObject;
 import com.vci.client.common.oq.OQTool;
-import com.vci.common.qt.object.QTConstants;
-import com.vci.common.qt.object.QueryTemplate;
+import com.vci.common.qt.object.*;
 import com.vci.corba.common.PLException;
+import com.vci.corba.omd.atm.AttributeDef;
 import com.vci.corba.omd.data.LinkObject;
 import com.vci.corba.omd.qtm.QTD;
 import com.vci.corba.omd.qtm.QTInfo;
 import com.vci.dto.QTInfoDTO;
+import com.vci.omd.objects.OtherInfo;
 import com.vci.starter.web.pagemodel.BaseResult;
 import com.vci.starter.web.util.*;
 import com.vci.web.service.*;
@@ -18,6 +20,7 @@
 import org.apache.commons.lang3.time.DateFormatUtils;
 import org.dom4j.DocumentException;
 import org.dom4j.DocumentHelper;
+import org.dom4j.Element;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import java.util.*;
@@ -36,6 +39,18 @@
      */
     @Autowired
     private PlatformClientUtil platformClientUtil;
+
+    private final String EQUAL = "=";
+    private final String UNEQUAL = "!=";
+    private final String CONTAINS = "鍖呭惈";
+    private final String IN = "in";
+    private final String NOTIN = "not in";
+    private final String GT = ">";
+    private final String GTE = ">=";
+    private final String LT = "<";
+    private final String LTE = "<=";
+    private final String AND = "骞朵笖";
+    private final String OR = "鎴栬��";
 
     /**
      * 鏌ヨ妯℃澘鐨勫垪琛�
@@ -156,12 +171,68 @@
             qtInfoDTO.setLevelFlag(obj.levelFlag);
 //            qtInfoDTO.setQtText(obj.qtText);
             qtInfoDTO.setQtUIText(obj.qtUIText);
+            if(StringUtils.isNotBlank(obj.qtUIText)){
+                //灏嗙粰瀹氱殑String鏂囨湰瑙f瀽涓篨ML鏂囨。骞惰繑鍥炴柊鍒涘缓鐨刣ocument
+                qtInfoDTO.setTree(analysisXml(obj));
+            }
             qtInfoDTO.setQueryTemplate(OQTool.getQTByDoc(DocumentHelper.parseText(obj.qtText), obj.qtName));
             qtInfoDTO.setCreateTimeText(DateFormatUtils.format(new Date(obj.createTime), DateUtil.PATTERN_DATETIME));
             dtos.add(qtInfoDTO);
         }
         return BaseResult.dataList(dtos);
     }
+
+    /**
+     * 灏嗗鏈嶇鐣岄潰鏄剧ず鐨剎ml杞负hashMap
+     * @param obj 鐣岄潰瀵硅薄
+     * @return
+     * @throws DocumentException
+     */
+    private HashMap<String,Object> analysisXml(QTInfo obj) throws DocumentException {
+        org.dom4j.Document document = DocumentHelper.parseText(obj.qtUIText);
+        if(document == null){
+            return null;
+        }
+        //鑾峰彇鏍硅妭鐐�,鍦ㄤ緥瀛愪腑灏辨槸responsedata鑺傜偣
+        Element root = document.getRootElement();
+        List<HashMap<String,Object>> treeList = new ArrayList<>();
+        HashMap<String,Object> treeMap = new HashMap<>();
+        treeMap.put("connector",root.getText());
+        List<Element> children = root.elements();
+        List<Object> childList = new ArrayList<>();
+        for(Iterator<Element> i = children.iterator(); i.hasNext();){
+            Element child = i.next();
+            if(AND.equals(child.getText()) || OR.equals(child.getText())){
+                childList.add(addDefaultMutableTree(child));
+            }else {
+                childList.add(child.getText().trim());
+            }
+        }
+        treeMap.put("child",childList);
+        return treeMap;
+    }
+
+    /**
+     * 灏嗗瓙鑺傜偣杞负map缁撴瀯
+     * @param element
+     */
+    public Map<String, Object> addDefaultMutableTree(Element element){
+        List<Object> childList = new ArrayList<>();
+        List<Element> children = element.elements();
+        HashMap<String,Object> treeMap = new HashMap<>();
+        treeMap.put("connector",element.getText());
+        for(Iterator<Element> i = children.iterator(); i.hasNext();){
+            Element child = i.next();
+            if(AND.equals(child.getText()) || OR.equals(child.getText())){
+                childList.add(addDefaultMutableTree(child));
+            }else {
+                childList.add(child.getText().trim());
+            }
+        }
+        treeMap.put("child",childList);
+        return treeMap;
+    }
+
     /**
      * 妫�鏌ユ煡璇㈡ā鏉垮悕瀛楁槸鍚﹀瓨鍦�
      * @param name 鏌ヨ妯℃澘鍚嶅瓧
@@ -174,6 +245,559 @@
     }
 
     /**
+     * 閾炬帴绫诲瀷鏌ヨ妯℃澘淇濆瓨
+     * @param qtInfoDTO 淇濆瓨浼犺緭瀵硅薄
+     * @return 淇濆瓨缁撴灉
+     */
+    @Override
+    public BaseResult linkSave(QTInfoDTO qtInfoDTO) throws PLException {
+        QueryTemplate qt = getQT(qtInfoDTO);
+        String checkInfo = OQTool.checkQT(qt);
+        if(!checkInfo.equals("OK")){
+            throw new PLException("500", new String[]{checkInfo});
+        }
+        boolean saveFlag ;
+        qt.setId(qtInfoDTO.getQtName());
+        qt.setOrderInfoList(qtInfoDTO.getQueryTemplate().getOrderInfoList());
+        QTInfo qtWrapper = new QTInfo();
+        qtWrapper.qtName = qt.getId();
+        qtWrapper.btmName = qt.getLinkType();
+        qtWrapper.creator = WebUtil.getCurrentUserId();
+        qtWrapper.createTime = System.currentTimeMillis();
+        if(qtInfoDTO.getTree() == null){
+            qtWrapper.qtUIText = "";
+        }else{
+            qtWrapper.qtUIText = getSeniorXML(qtInfoDTO);
+        }
+        qtWrapper.levelFlag = qtInfoDTO.getLevelFlag();
+        qtWrapper.qtText = OQTool.qtTOXMl(qt).asXML();
+        saveFlag = platformClientUtil.getQTDService().saveQT(qtWrapper);
+        if(saveFlag){
+            return BaseResult.success();
+        }else{
+            return BaseResult.fail("淇濆瓨鏌ヨ妯℃澘澶辫触");
+        }
+    }
+
+    private String getSeniorXML(QTInfoDTO qtInfoDTO){
+        HashMap<String, Object> tree = qtInfoDTO.getTree();
+        if(tree.isEmpty()){
+            return "";
+        }
+        StringBuilder xmlStr = new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\"?><root>");
+        xmlStr.append(tree.get("connector"));
+        List<Object> childrens = (List<Object>) tree.get("child");
+        Iterator<Object> children = childrens.iterator();
+        while (children.hasNext()) {
+            Object obj = children.next();
+            if(obj instanceof JSONObject && (((JSONObject) obj).get("connector").equals(AND)
+                    || ((JSONObject) obj).get("connector").equals(OR))){
+                xmlStr.append(getSeniorChildXML((JSONObject) obj));
+            }else{
+                xmlStr.append("<child>").append(obj).append("</child>");
+            }
+        }
+        return xmlStr.append("</root>").toString();
+
+    }
+    private String getSeniorChildXML(JSONObject childs){
+
+        StringBuilder xmlStr = new StringBuilder("<child>" + childs.get("connector"));
+        List<Object> childrens = (List<Object>) childs.get("child");
+        if(childrens == null){
+            return "";
+        }
+        Iterator<Object> child = childrens.iterator();
+        while (child.hasNext()) {
+            Object obj = child.next();
+            if(obj instanceof JSONObject && (((JSONObject) obj).get("connector").equals(AND)
+                    || ((JSONObject) obj).get("connector").equals(OR))){
+                xmlStr.append(getSeniorChildXML((JSONObject) obj));
+            }else{
+                xmlStr.append("<child>").append(obj).append("</child>");
+            }
+        }
+        return xmlStr.append("</child>").toString();
+    }
+
+    /**
+     * 缁勮鏌ヨ妯℃澘
+     * @return
+     */
+    public QueryTemplate getQT(QTInfoDTO qtInfoDTO) throws PLException {
+        QueryTemplate qt = new QueryTemplate();
+        qt.setType(QTConstants.TYPE_LINK);
+        //TODO String qtId =
+        qt.setLinkType(qtInfoDTO.getBtmName());
+        qt.setDirection(qtInfoDTO.getQueryTemplate().getDirection());
+        qt.setBtmType(qtInfoDTO.getQueryTemplate().getBtmType());
+
+        qt.setVersion(qtInfoDTO.getQueryTemplate().getVersion());
+        qt.setQueryISLeaf(qtInfoDTO.getQueryTemplate().isQueryISLeaf());
+        qt.setLevel(qtInfoDTO.getQueryTemplate().getLevel());
+        List<String> clauseList = new ArrayList<String>();
+        //TODO 鏌ヨ鍒� 鏄剧ず鍒�
+        clauseList.add("*");
+        qt.setClauseList(clauseList);
+        Condition con = new Condition();
+        qt.setCondition(con);
+        HashMap<String, ConditionItem> ciMap = getCIMap(qtInfoDTO);
+        con.setCIMap(ciMap);
+        con.setRootCIName(con.getRootCINameByCIMap(ciMap));
+        return qt;
+    }
+
+    /**
+     * 鑾峰彇鏌ヨ鏉′欢
+     * @return
+     */
+    private HashMap<String, ConditionItem> getCIMap(QTInfoDTO qtInfoDTO) throws PLException {
+        HashMap<String, ConditionItem> ciMap = new HashMap<>();
+        //鏅�氭煡璇㈡潯浠�
+        if(qtInfoDTO.getLevelFlag() == 0){
+            /**
+             * 鍔犲叆鍙跺瓙鑺傜偣
+             */
+            for(int i = 0; i < qtInfoDTO.getCondition().size(); i++){
+                ConditionItem ci = new ConditionItem();
+                String id = "ci" + (i + 1);
+                ci.setId(id);
+                ci.setLeafFlag(true);
+                HashMap<String, String> condition = qtInfoDTO.getCondition().get(i);
+                String clause = condition.get("clause");
+                String operator = condition.get("operator");
+                String ordinaryValue = condition.get("ordinaryValue");
+                //add by zhangweiwei 2014/12/09  end  鍥犲鍔犻�夋嫨鏌ヨ妯℃澘鎸夐挳灏嗘瘡琛岀粍浠舵暟鐢�4鏀规垚5
+                LeafInfo leafInfo = new LeafInfo();
+                if(clause.contains("T_OID.") || clause.contains("F_OID.")){
+                    //鍘绘帀T_OID.鎴栬�匜_OID.
+                    String clause_ = clause.substring(6);
+                    //灞炴�т负鍙傜収灞炴��
+                    if(clause_.contains(".")){
+                        int fpIndex = clause_.indexOf(".");
+                        String refAbName = clause.substring(0, fpIndex + 6);
+                        clause = clause.substring(fpIndex + 6 + 1);
+                        leafInfo.setClause(refAbName);
+                        //鍘绘帀T_OID.鎴栬�匜_OID.
+                        refAbName = refAbName.substring(6);
+                        leafInfo.setOperator(Operator.IN);
+                        QueryTemplate qt = getRefQT(refAbName, clause, operator, ordinaryValue);
+                        LeafValue lValue = new LeafValue();
+                        lValue.setQueryTemplate(qt);
+                        leafInfo.setValue(lValue);
+                        //灞炴�т负闈炲弬鐓у睘鎬�
+                    }else{
+                        leafInfo.setClause(clause);
+                        leafInfo.setOperator(operator);
+                        LeafValue lValue = new LeafValue();
+                        leafInfo.setValue(lValue);
+                        //add by zhangweiwei 2014/12/09 start
+                        //濡傛灉宓屽Link
+                        if(ordinaryValue.contains(";")){
+                            leafInfo.setOperator(Operator.IN);
+                            String[] values = ordinaryValue.split(";");
+                            String  QTname = values[0];
+                            String  attr = values[1].substring(0, values[1].length());
+                            try {
+                                QTInfo qt = platformClientUtil.getQTDService().getQT(QTname);
+                                String qtText = qt.qtText;
+                                QueryTemplate qt_ = OQTool.getQTByQTText(qt.qtName, qtText);
+                                List<String> clauseList = new ArrayList<String>();
+                                clauseList.add(attr);
+                                qt_.setClauseList(clauseList);
+                                lValue.setQueryTemplate(qt_);
+                                //lValue.setAttr(attr);
+                            } catch (PLException e) {
+                                e.printStackTrace();
+                            }
+                            catch (DocumentException e1) {
+                                e1.printStackTrace();
+                            }
+                        }else{
+                            lValue.setOrdinaryValue(ordinaryValue);
+                        }
+                        //add by zhangweiwei 2014/12/09 end
+                    }
+                }else{
+                    //灞炴�т负鍙傜収灞炴��
+                    if(clause.contains(".")){
+                        int fpIndex = clause.indexOf(".");
+                        String refAbName = clause.substring(0, fpIndex);
+                        clause = clause.substring(fpIndex + 1);
+                        leafInfo.setClause(refAbName);
+                        leafInfo.setOperator(Operator.IN);
+                        QueryTemplate qt = getRefQT(refAbName, clause, operator, ordinaryValue);
+                        LeafValue lValue = new LeafValue();
+                        lValue.setQueryTemplate(qt);
+                        leafInfo.setValue(lValue);
+                        //灞炴�т负闈炲弬鐓у睘鎬�
+                    }else{
+                        leafInfo.setClause(clause);
+                        leafInfo.setOperator(operator);
+                        LeafValue lValue = new LeafValue();
+                        leafInfo.setValue(lValue);
+                        //add by zhangweiwei 2014/12/09 start
+                        //濡傛灉宓屽Link
+                        if(ordinaryValue.contains(";")){
+                            leafInfo.setOperator(Operator.IN);
+                            String[] values = ordinaryValue.split(";");
+                            String  QTname = values[0];
+                            String  attr = values[1].substring(0, values[1].length());
+                            try {
+                                QTInfo qt = platformClientUtil.getQTDService().getQT(QTname);
+                                String qtText = qt.qtText;
+                                QueryTemplate qt_ = OQTool.getQTByQTText(qt.qtName, qtText);
+                                List<String> clauseList = new ArrayList<String>();
+                                clauseList.add(attr);
+                                qt_.setClauseList(clauseList);
+                                lValue.setQueryTemplate(qt_);
+                                //lValue.setAttr(attr);
+                            } catch (PLException e) {
+                                e.printStackTrace();
+                            } catch (DocumentException e1) {
+                                e1.printStackTrace();
+                            }
+
+                        }else{
+                            lValue.setOrdinaryValue(ordinaryValue);
+                        }
+                        //add by zhangweiwei 2014/12/09 end
+                    }
+                }
+
+                ci.setLeafInfo(leafInfo);
+                ciMap.put(ci.getId(), ci);
+            }
+
+            Iterator<String> iterator = ciMap.keySet().iterator();
+            ArrayList<ConditionItem> ciList = new ArrayList<ConditionItem>();
+            String lCIId = null;
+            while(iterator.hasNext()){
+                lCIId = iterator.next();
+                break;
+            }
+            int count = ciMap.size();
+            while(iterator.hasNext()){
+                String rCIId = iterator.next();
+                ConditionItem pCI = new ConditionItem();
+                String pId = "ci" + ++count;
+                pCI.setId(pId);
+                pCI.setLeafFlag(false);
+                ChildrenInfo pChildrenInfo = new ChildrenInfo();
+                pChildrenInfo.setLeftCIName(lCIId);
+                pChildrenInfo.setConnector(Connector.AND);
+                pChildrenInfo.setRightCIName(rCIId);
+                pCI.setChildrenInfo(pChildrenInfo);
+                ciList.add(pCI);
+                lCIId = pId;
+            }
+            for(Iterator<ConditionItem> i = ciList.iterator(); i.hasNext();){
+                ConditionItem ci = i.next();
+                ciMap.put(ci.getId(), ci);
+            }
+            //楂樼骇鏌ヨ鏉′欢
+        }else if(qtInfoDTO.getLevelFlag() == 1){
+            ciMap = getCIMapForSeniorTree(qtInfoDTO);
+
+//            OQTool.parseTreeToDoc(seniorTree);
+        }
+        return ciMap;
+    }
+
+    /**
+     * 鑾峰彇楂樼骇鏌ヨ鐨勬煡璇㈡潯浠堕泦鍚�
+     * @return
+     */
+    private HashMap<String, ConditionItem> getCIMapForSeniorTree(QTInfoDTO qtInfoDTO) throws PLException {
+        HashMap<String, ConditionItem> ciMap = new HashMap<>();
+        HashMap<String, Object> tree = qtInfoDTO.getTree();
+        if (tree.isEmpty()) {
+            // 鏃犳煡璇㈡潯浠剁殑鏌ヨ
+            return null;
+        }
+        ArrayList<ConditionItem> ciList = new ArrayList<ConditionItem>();
+        String connector = String.valueOf(tree.get("connector"));
+        List<Object> childrens = (List<Object>) tree.get("child");
+        Iterator<Object> children = childrens.iterator();
+        while (children.hasNext()) {
+            Object obj = children.next();
+            if(obj instanceof JSONObject && (((JSONObject) obj).get("connector").equals(AND)
+                    || ((JSONObject) obj).get("connector").equals(OR))){
+                List<ConditionItem> subCIList = getCIList((JSONObject) obj, ciList.size() + 1);
+                if(subCIList == null){
+                    continue;
+                }
+                if(ciList.size() > 0){
+                    ConditionItem leftCI = ciList.get(ciList.size() - 1);
+                    ConditionItem rightCI = subCIList.get(subCIList.size() - 1);
+                    ciList.addAll(subCIList);
+                    ConditionItem pCI = new ConditionItem();
+                    pCI.setId("ci" + (ciList.size() + 1));
+                    ciList.add(pCI);
+                    pCI.setLeafFlag(false);
+                    ChildrenInfo cInfo = new ChildrenInfo();
+                    pCI.setChildrenInfo(cInfo);
+                    cInfo.setLeftCIName(leftCI.getId());
+                    cInfo.setConnector(connector);
+                    cInfo.setRightCIName(rightCI.getId());
+                }else{
+                    ciList.addAll(subCIList);
+                }
+            }else{
+                String text = String.valueOf(obj);
+                if(text == null || text.equals("")){
+                    continue;
+                }
+                if(!text.contains(Operator.EQUAL) && !text.contains(Operator.UNEQUAL) && !text.contains(Operator.CONTAINS)
+                        && !text.contains(Operator.IN) && !text.contains(Operator.NOTIN) &&!text.contains(Operator.GTE) && !text.contains(Operator.GT)
+                        && !text.contains(Operator.LTE) && !text.contains(Operator.LT)){
+                    continue;
+                }
+                if(ciList.size() > 0){
+                    ConditionItem leftCI = ciList.get(ciList.size() - 1);
+                    ConditionItem rightCI = getCIByNode(text, ciList.size() + 1);
+                    ciList.add(rightCI);
+                    ConditionItem pCI = new ConditionItem();
+                    pCI.setId("ci" + (ciList.size() + 1));
+                    ciList.add(pCI);
+                    pCI.setLeafFlag(false);
+                    ChildrenInfo cInfo = new ChildrenInfo();
+                    pCI.setChildrenInfo(cInfo);
+                    cInfo.setLeftCIName(leftCI.getId());
+                    cInfo.setConnector(connector);
+                    cInfo.setRightCIName(rightCI.getId());
+                }else{
+                    ConditionItem ci = getCIByNode(text, ciList.size() + 1);
+                    ciList.add(ci);
+                }
+            }
+        }
+
+        for(int i = 0; i < ciList.size(); i++){
+            ConditionItem ci = ciList.get(i);
+            ciMap.put(ci.getId(), ci);
+        }
+        return ciMap;
+    }
+    /**
+     * 鏍戝寲涓�涓煡璇㈡潯浠剁粍鑺傜偣
+     * @param children
+     * @param beginId
+     * @return
+     */
+    private List<ConditionItem> getCIList(JSONObject children, int beginId) throws PLException {
+        List<ConditionItem> ciList = new ArrayList<>();
+        String connector = String.valueOf(children.get("connector"));
+        List<Object> childrens = (List<Object>) children.get("child");
+        if(childrens == null){
+            return null;
+        }
+        Iterator<Object> child = childrens.iterator();
+        while (child.hasNext()) {
+            Object obj = child.next();
+            if(obj instanceof JSONObject && (((JSONObject) obj).get("connector").equals(AND)
+                    || ((JSONObject) obj).get("connector").equals(OR))){
+                List<ConditionItem> subCIList = getCIList((JSONObject) obj, beginId);
+                if(ciList.size() > 0){
+                    ConditionItem leftCI = ciList.get(ciList.size() - 1);
+                    ConditionItem rightCI = subCIList.get(subCIList.size() - 1);
+                    ciList.addAll(subCIList);
+                    beginId = beginId + subCIList.size();
+                    ConditionItem pCI = new ConditionItem();
+                    pCI.setId("ci" + beginId);
+                    ciList.add(pCI);
+                    beginId = beginId + 1;
+                    pCI.setLeafFlag(false);
+                    ChildrenInfo cInfo = new ChildrenInfo();
+                    pCI.setChildrenInfo(cInfo);
+                    cInfo.setLeftCIName(leftCI.getId());
+                    cInfo.setConnector(connector);
+                    cInfo.setRightCIName(rightCI.getId());
+                }else{
+                    ciList.addAll(subCIList);
+                    beginId = beginId + subCIList.size();
+                }
+            }else{
+                String text = String.valueOf(obj);
+                if(text == null || text.equals("")){
+                    continue;
+                }
+                if(!text.contains(Operator.EQUAL) && !text.contains(Operator.UNEQUAL) && !text.contains(Operator.CONTAINS)
+                        && !text.contains(Operator.IN) && !text.contains(Operator.NOTIN) &&!text.contains(Operator.GTE) && !text.contains(Operator.GT)
+                        && !text.contains(Operator.LTE) && !text.contains(Operator.LT)){
+                    continue;
+                }
+                if(ciList.size() > 0){
+                    ConditionItem leftCI = ciList.get(ciList.size() - 1);
+                    ConditionItem rightCI = getCIByNode(text, beginId);
+                    ciList.add(rightCI);
+                    beginId = beginId + 1;
+                    ConditionItem pCI = new ConditionItem();
+                    pCI.setId("ci" + beginId);
+                    ciList.add(pCI);
+                    beginId = beginId + 1;
+                    pCI.setLeafFlag(false);
+                    ChildrenInfo cInfo = new ChildrenInfo();
+                    pCI.setChildrenInfo(cInfo);
+                    cInfo.setLeftCIName(leftCI.getId());
+                    cInfo.setConnector(connector);
+                    cInfo.setRightCIName(rightCI.getId());
+                }else{
+                    ConditionItem ci = getCIByNode(text, beginId);
+                    ciList.add(ci);
+                    beginId = beginId + 1;
+                }
+            }
+        }
+        return ciList;
+    }
+    /**
+     * 楂樼骇鏌ヨ
+     * 鎶奛ode鍐呭瑙f瀽鎴怌onditionItem
+     * @param text
+     * @param id
+     * @return
+     */
+    private ConditionItem getCIByNode(String text, int id) throws PLException {
+        ConditionItem ci = new ConditionItem();
+        ci.setId("ci" + id);
+        ci.setLeafFlag(true);
+        LeafInfo leafInfo = new LeafInfo();
+        ci.setLeafInfo(leafInfo);
+        String operator = null;
+        if(text.contains(Operator.EQUAL)){
+            operator = Operator.EQUAL;
+        }else if(text.contains(Operator.CONTAINS)){
+            operator = Operator.CONTAINS;
+        }else if(text.contains(Operator.UNEQUAL)){
+            operator = Operator.UNEQUAL;
+        }else if(text.contains(Operator.IN)){
+            operator = Operator.IN;
+        }else if(text.contains(Operator.NOTIN)){
+            operator = Operator.NOTIN;
+        }else if(text.contains(Operator.GTE)){
+            operator = Operator.GTE;
+        }else if(text.contains(Operator.GT)){
+            operator = Operator.GT;
+        }else if(text.contains(Operator.LTE)){
+            operator = Operator.LTE;
+        }else if(text.contains(Operator.LT)){
+            operator = Operator.LT;
+        }
+        int operatorIndex = text.indexOf(operator);
+        String clause = text.substring(0, operatorIndex).trim();
+        String ordinaryValue = text.substring(operatorIndex + 2).trim();
+        if(clause.contains("T_OID.") || clause.contains("F_OID.")){
+            //鍘绘帀T_OID.鎴栬�匜_OID.
+            String clause_ = clause.substring(6);
+            //灞炴�т负鍙傜収灞炴��
+            if(clause_.contains(".")){
+                int fpIndex = clause_.indexOf(".");
+                String refAbName = clause.substring(0, fpIndex + 6);
+                clause = clause.substring(fpIndex + 6 + 1);
+                leafInfo.setClause(refAbName);
+                //鍘绘帀T_OID.鎴栬�匜_OID.
+                refAbName = refAbName.substring(6);
+                leafInfo.setOperator(Operator.IN);
+                QueryTemplate qt = getRefQT(refAbName, clause, operator, ordinaryValue);
+                LeafValue lValue = new LeafValue();
+                lValue.setQueryTemplate(qt);
+                leafInfo.setValue(lValue);
+                //灞炴�т负闈炲弬鐓у睘鎬�
+            }else{
+                leafInfo.setClause(clause);
+                leafInfo.setOperator(operator);
+                LeafValue lValue = new LeafValue();
+                leafInfo.setValue(lValue);
+                lValue.setOrdinaryValue(ordinaryValue);
+            }
+        }else{
+            //灞炴�т负鍙傜収灞炴��
+            if(clause.contains(".")){
+                int fpIndex = clause.indexOf(".");
+                String refAbName = clause.substring(0, fpIndex);
+                clause = clause.substring(fpIndex + 1);
+                leafInfo.setClause(refAbName);
+                leafInfo.setOperator(Operator.IN);
+                QueryTemplate qt = getRefQT(refAbName, clause, operator, ordinaryValue);
+                LeafValue lValue = new LeafValue();
+                lValue.setQueryTemplate(qt);
+                leafInfo.setValue(lValue);
+                //灞炴�т负闈炲弬鐓у睘鎬�
+            }else{
+                leafInfo.setClause(clause);
+                leafInfo.setOperator(operator);
+                LeafValue lValue = new LeafValue();
+                leafInfo.setValue(lValue);
+                lValue.setOrdinaryValue(ordinaryValue);
+            }
+        }
+
+        return ci;
+    }
+
+
+
+    /**
+     * 鑾峰彇鍙傜収鐨勬煡璇㈡ā鏉�
+     * @param refAbName: 鍙傜収灞炴�у悕
+     * @param clause: 灞炴�у弬鐓х殑涓氬姟绫诲瀷涓殑灞炴��
+     * @param operator
+     * @param ordinaryValue
+     * @return
+     */
+    private QueryTemplate getRefQT(String refAbName, String clause,
+                                   String operator, String ordinaryValue) throws PLException {
+        QueryTemplate qt = new QueryTemplate();
+        List<String> clauseList = new ArrayList<String>();
+        clauseList.add("OID");
+        qt.setClauseList(clauseList);
+        AttributeDef refAb = platformClientUtil.getAttributeService().getAttributeDefByName(refAbName);
+        OtherInfo otherInfo = OtherInfo.getOtherInfoByText(refAb.other);
+        int refFlag = otherInfo.getRefFlag();
+        String type = otherInfo.getRefTypeName();
+        if(refFlag == 0){
+            qt.setType(QTConstants.TYPE_BTM);
+            qt.setBtmType(type);
+        }else if(refFlag == 1){
+            qt.setType(QTConstants.TYPE_LINK);
+            qt.setLinkType(type);
+        }
+        Condition condition = new Condition();
+        qt.setCondition(condition);
+        condition.setRootCIName("ci1");
+        HashMap<String, ConditionItem> ciMap = new HashMap<String, ConditionItem>();
+        condition.setCIMap(ciMap);
+        ConditionItem ci = new ConditionItem();
+        ci.setId("ci1");
+        ciMap.put(ci.getId(), ci);
+        ci.setLeafFlag(true);
+        LeafInfo leafInfo = new LeafInfo();
+        if(clause.contains(".")){
+            int fpIndex = clause.indexOf(".");
+            String refAbName_ = clause.substring(0, fpIndex);
+            clause = clause.substring(fpIndex + 1);
+            leafInfo.setClause(refAbName_);
+            leafInfo.setOperator(Operator.IN);
+            QueryTemplate qt_ = getRefQT(refAbName_, clause, operator, ordinaryValue);
+            LeafValue lValue = new LeafValue();
+            lValue.setQueryTemplate(qt_);
+            leafInfo.setValue(lValue);
+            qt.setId("qt_" + refAbName + "_" + refAbName_);
+        }else{
+            leafInfo.setClause(clause);
+            leafInfo.setOperator(operator);
+            LeafValue lValue = new LeafValue();
+            lValue.setOrdinaryValue(ordinaryValue);
+            leafInfo.setValue(lValue);
+            qt.setId("qt_" + refAbName + "_" + clause);
+        }
+        ci.setLeafInfo(leafInfo);
+        condition.setCIMap(ciMap);
+        return qt;
+    }
+
+    /**
      * 缁勮鏌ヨ妯℃澘
      * @return
      */

--
Gitblit v1.9.3