From de42c7075ba5a474ba74d8833e9830dfa1312464 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期三, 28 八月 2024 15:20:17 +0800
Subject: [PATCH] 业务类型查询模板接口上传

---
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebBtmTypeController.java                                 |   30 ++
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebCodeGenSchemaController.java                           |   13 
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/other/BtmQTExportData.java                                           |   65 +++++
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsCodeGenSchemaServiceI.java                                 |    3 
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsQuereyTemplateServiceI.java                                |   50 +++
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/HMSysModConfigController.java                             |    5 
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsBtmServiceImpl.java                                   |   16 
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmFunctionQueryServicePlatformImpl.java |   12 
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsBtmServiceI.java                                           |    4 
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBtmIOServiceImpl.java                                |    8 
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsQueryTemplateController.java                            |  107 ++++++++
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsQueryTemplateImpl.java                                |  428 +++++++++++++++++++++++++++++++-
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsCodeGenSchemaServiceImpl.java                         |    3 
 13 files changed, 701 insertions(+), 43 deletions(-)

diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmFunctionQueryServicePlatformImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmFunctionQueryServicePlatformImpl.java
index ea1bf1a..8422fbc 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmFunctionQueryServicePlatformImpl.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmFunctionQueryServicePlatformImpl.java
@@ -395,12 +395,16 @@
                     throw new VciBaseException(String.valueOf(e.code),e.messages);
                 }
             }
-        }else if(parentId.equals("sysOptionNode")){
+        }else if(parentId.equals("operateNode")){
             //鍔犺浇鎵�鏈夋搷浣�
             try{
                 //灏嗚繑鍥炵殑鑺傜偣澶栧眰濂椾笂褰撳墠鐖惰妭鐐�
                 MenuVO parentNode = JsonConfigReader.getSysModuleConf().getOperateNode();
-                List<MenuVO> menuVOS = new ArrayList<>();
+                //濡傛灉鏌ヨ鐨勬槸绗竴灞傝妭鐐瑰氨闇�瑕佺洿鎺ヨ繑鍥瀞ysOptionNode鑺傜偣
+                if(Func.isNotBlank(modeType) && modeType.equals("firstNode")){
+                    menuVOList.add(parentNode);
+                    return menuVOList;
+                }
                 OperateInfo[] operateInfos = platformClientUtil.getFrameworkService().getOperateTreeList(parentId);
                 for(int i = 0; i < operateInfos.length;i++ ){
                     OperateInfo operateInfo = operateInfos[i];
@@ -416,10 +420,8 @@
                     menuVO.setSort((int) operateInfo.seq);
                     menuVO.setModeType("operateObject");
                     menuVO.setHasChildren(false);
-                    menuVOS.add(menuVO);
+                    menuVOList.add(menuVO);
                 }
-                parentNode.setChildren(menuVOS);
-                menuVOList.add(parentNode);
             }catch (PLException e) {
                 e.printStackTrace();
                 throw new VciBaseException(String.valueOf(e.code),new String[]{VciBaseUtil.getExceptionMessage(e)});
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/HMSysModConfigController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/HMSysModConfigController.java
index 8137581..01f81e0 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/HMSysModConfigController.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/HMSysModConfigController.java
@@ -1,7 +1,6 @@
 package com.vci.web.controller;
 
 import com.vci.constant.FrameWorkLangCodeConstant;
-import com.vci.corba.framework.data.AppConfigDetailInfo;
 import com.vci.corba.framework.data.FuncOperationInfo;
 import com.vci.corba.framework.data.OperateInfo;
 import com.vci.frameworkcore.compatibility.ISmFunctionQueryService;
@@ -9,7 +8,6 @@
 import com.vci.pagemodel.AppConfigDetailInfoVO;
 import com.vci.pagemodel.ExpExcelConditionVO;
 import com.vci.pagemodel.MenuVO;
-import com.vci.starter.web.annotation.controller.VciUnCheckRight;
 import com.vci.starter.web.exception.VciBaseException;
 import com.vci.starter.web.pagemodel.BaseResult;
 import com.vci.starter.web.util.ControllerUtil;
@@ -19,7 +17,6 @@
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
@@ -188,7 +185,7 @@
             return BaseResult.success(hmSysModConfigService.addOperationType(operateInfo),"娣诲姞鎿嶄綔绫诲瀷鎴愬姛");
         }catch (Exception e){
             e.printStackTrace();
-            String errorMsg = "鍒犻櫎妯″潡鏃跺嚭鐜伴敊璇紝鍘熷洜锛�"+ VciBaseUtil.getExceptionMessage(e);
+            String errorMsg = "娣诲姞鎿嶄綔绫诲瀷鏃跺嚭鐜伴敊璇紝鍘熷洜锛�"+ VciBaseUtil.getExceptionMessage(e);
             logger.error(errorMsg);
             throw new VciBaseException(errorMsg);
         }
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 0313038..c2032a4 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
@@ -147,6 +147,39 @@
     }
 
     /**
+     * 涓氬姟绫诲瀷鏌ヨ妯℃澘涓嬬殑鏌ヨ鏉′欢鐨勬煡璇㈡寜閽煡璇ist鍒楄〃
+     * @param qtInfoDTO
+     * @return 鏌ヨ缁撴灉
+     */
+    @PostMapping("/getCriteriaBtm")
+    public BaseResult getCriteriaBtm(@RequestBody QTInfoDTO qtInfoDTO){
+        try {
+            return quereyTemplateServiceI.getCriteriaBtm(qtInfoDTO);
+        } catch (PLException e) {
+            BaseResult objectBaseResult = new BaseResult<>();
+            objectBaseResult.setCode(Integer.parseInt(e.code));
+            objectBaseResult.setMsg(Arrays.toString(e.messages));
+            return objectBaseResult;
+        }
+    }
+
+    /**
+     * 鏌ヨ鏉′欢涓嬬殑閫夋嫨鏌ヨ妯℃澘瀵硅瘽妗嗭紙鏌ヨ鍏ㄩ儴妯℃澘鍜屾墍瀵瑰簲鐨勪笟鍔$被鍨嬫垨閾炬帴绫诲瀷鍚嶏級
+     * @return
+     */
+    @GetMapping("/getAllQTs")
+    public BaseResult getAllQTs(){
+        try {
+            return quereyTemplateServiceI.getAllQTs();
+        } catch (PLException e) {
+            BaseResult objectBaseResult = new BaseResult<>();
+            objectBaseResult.setCode(Integer.parseInt(e.code));
+            objectBaseResult.setMsg(Arrays.toString(e.messages));
+            return objectBaseResult;
+        }
+    }
+
+    /**
      * 鏌ヨ妯℃澘鍒楄〃
      * @param btName 绫诲瀷鍚嶇О
      * @return 鏌ヨ缁撴灉
@@ -258,4 +291,78 @@
             return objectBaseResult;
         }
     }
+
+    /**
+     * 涓氬姟绫诲瀷鏌ヨ妯℃澘淇濆瓨
+     * @param qtInfoDTO 淇濆瓨浼犺緭瀵硅薄
+     * @return 淇濆瓨缁撴灉
+     */
+    @PostMapping("/btmSave")
+    public BaseResult btmSave(@RequestBody QTInfoDTO qtInfoDTO){
+        try {
+            return quereyTemplateServiceI.btmSave(qtInfoDTO);
+        } catch (PLException e) {
+            BaseResult objectBaseResult = new BaseResult<>();
+            objectBaseResult.setCode(Integer.parseInt(e.code));
+            objectBaseResult.setMsg(Arrays.toString(e.messages));
+            return objectBaseResult;
+        }
+    }
+
+    /**
+     * 鏇存柊鏁版嵁搴撶粨鏋�
+     * @return 鏇存柊缁撴灉
+     */
+    @PostMapping("/updateDBStructure")
+    public BaseResult btmSave(){
+        try {
+            return quereyTemplateServiceI.updateDBStructure();
+        } catch (PLException e) {
+            BaseResult objectBaseResult = new BaseResult<>();
+            objectBaseResult.setCode(Integer.parseInt(e.code));
+            objectBaseResult.setMsg(Arrays.toString(e.messages));
+            return objectBaseResult;
+        }
+    }
+
+    /**
+     * 涓氬姟绫诲瀷鏌ヨ妯℃澘鏍戞煡璇紝鐢ㄤ簬鐣岄潰鐨勫鍑哄姛鑳�
+     * @return 鏌ヨ缁撴灉
+     */
+    @GetMapping("/getBtmQtTree")
+    public BaseResult getBtmQtTree(){
+        try {
+            return quereyTemplateServiceI.getBtmQtTree();
+        } catch (PLException e) {
+            BaseResult objectBaseResult = new BaseResult<>();
+            objectBaseResult.setCode(Integer.parseInt(e.code));
+            objectBaseResult.setMsg(Arrays.toString(e.messages));
+            return objectBaseResult;
+        }
+    }
+
+    /**
+     * 瀵煎嚭涓氬姟绫诲瀷鏌ヨ妯℃澘
+     * names 鏌ヨ妯℃澘鍚�
+     * @return
+     */
+    @PostMapping("/expBtmQTTemplate")
+    public void expBtmQTTemplate(@RequestBody List<String> names,HttpServletResponse response) throws PLException, IOException {
+        quereyTemplateServiceI.expBtmQTTemplate(names, response);
+    }
+
+    /**
+     * 瀵煎叆涓氬姟绫诲瀷鏌ヨ妯℃澘
+     * @param file 涓婁紶鐨勬枃浠�
+     * @return 瀵煎叆缁撴灉
+     */
+    @PostMapping("/impBtmTemplate")
+    public BaseResult impBtmTemplate(MultipartFile file){
+        try {
+            return quereyTemplateServiceI.impBtmTemplate(file);
+        }catch (Throwable e) {
+            throw new VciBaseException(VciBaseUtil.getExceptionMessage(e),new String[0],e);
+        }
+    }
+
 }
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 270d46a..10c2d5c 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
@@ -403,7 +403,15 @@
     @GetMapping(value = "/getAllAttributesByBtmId")
     @VciBusinessLog(operateName = "鏌ョ湅涓氬姟绫诲瀷鐨勫睘鎬�")
     public BaseResult<List<OsBtmTypeAttributeVO>> getAllAttributesByBtmId(String btmId){
-        List<OsBtmTypeAttributeVO> osBtmTypeAttributeVOS = btmService.listAttributeByBtmIdHasDefault(btmId);
+        List<OsBtmTypeAttributeVO> osBtmTypeAttributeVOS = null;
+        try {
+            osBtmTypeAttributeVOS = btmService.listAttributeByBtmIdHasDefault(btmId);
+        } catch (PLException e) {
+            e.printStackTrace();
+            String exceptionMessage = VciBaseUtil.getExceptionMessage(e);
+            logger.error(exceptionMessage);
+            throw new VciBaseException(exceptionMessage);
+        }
         return BaseResult.dataList(osBtmTypeAttributeVOS);
     }
 
@@ -457,7 +465,15 @@
         String hasDefaultAttr = baseQueryObject.getConditionMap().getOrDefault("hasDefaultAttr","false");
         String attrId = baseQueryObject.getConditionMap().containsKey("name")?baseQueryObject.getConditionMap().get("name").replace("*",""):"";
         String attrName = baseQueryObject.getConditionMap().containsKey("label") ? baseQueryObject.getConditionMap().get("label").replace("*","") : "";
-        List<OsBtmTypeAttributeVO> boAttrs = btmService.listAttributeByBtmId(btmTypeId);
+        List<OsBtmTypeAttributeVO> boAttrs = null;
+        try {
+            boAttrs = btmService.listAttributeByBtmId(btmTypeId);
+        } catch (PLException e) {
+            e.printStackTrace();
+            String exceptionMessage = VciBaseUtil.getExceptionMessage(e);
+            logger.error(exceptionMessage);
+            throw new VciBaseException(exceptionMessage);
+        }
         if(boAttrs == null){
             boAttrs = new ArrayList<>();
         }
@@ -505,7 +521,15 @@
         String attrId = baseQueryObject.getConditionMap().containsKey("name")?baseQueryObject.getConditionMap().get("name").replace("*",""):"";
         String attrName = baseQueryObject.getConditionMap().containsKey("label") ? baseQueryObject.getConditionMap().get("label").replace("*","") : "";
         OsBtmTypeVO btmTypeVO = btmService.selectByOid(btmTypeOid);
-        List<OsBtmTypeAttributeVO> boAttrs = btmService.listAttributeByBtmId(btmTypeVO.getId());
+        List<OsBtmTypeAttributeVO> boAttrs = null;
+        try {
+            boAttrs = btmService.listAttributeByBtmId(btmTypeVO.getId());
+        } catch (PLException e) {
+            e.printStackTrace();
+            String exceptionMessage = VciBaseUtil.getExceptionMessage(e);
+            logger.error(exceptionMessage);
+            throw new VciBaseException(exceptionMessage);
+        }
         List<OsBtmTypeAttributeVO> attrList = boAttrs.stream().filter(s->{
             boolean usedFlag = true;
             if(StringUtils.isNotBlank(attrId) && !s.getId().contains(attrId)){
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebCodeGenSchemaController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebCodeGenSchemaController.java
index ec1b0dd..c6666a8 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebCodeGenSchemaController.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebCodeGenSchemaController.java
@@ -1,5 +1,7 @@
 package com.vci.web.controller;
 
+import com.vci.corba.common.PLException;
+import com.vci.starter.web.exception.VciBaseException;
 import com.vci.starter.web.pagemodel.BaseQueryObject;
 import com.vci.starter.web.pagemodel.BaseResult;
 import com.vci.starter.web.pagemodel.DataGrid;
@@ -7,6 +9,7 @@
 import com.vci.starter.web.util.LangBaseUtil;
 import com.vci.dto.OsCodeGenSchemaDTO;
 import com.vci.pagemodel.OsCodeGenSchemaVO;
+import com.vci.starter.web.util.VciBaseUtil;
 import com.vci.web.service.OsCodeGenSchemaServiceI;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -71,8 +74,14 @@
      */
     @PostMapping(value = "/productCodeFile")
     public BaseResult productCodeFile(String oid){
-        codeGenSchemaService.productCodeFile(oid);
-        return BaseResult.success();
+        try {
+            codeGenSchemaService.productCodeFile(oid);
+            return BaseResult.success();
+        } catch (PLException e) {
+            e.printStackTrace();
+            String exceptionMessage = VciBaseUtil.getExceptionMessage(e);
+            throw new VciBaseException(exceptionMessage);
+        }
     }
 
     /**
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/other/BtmQTExportData.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/other/BtmQTExportData.java
new file mode 100644
index 0000000..4c293f3
--- /dev/null
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/other/BtmQTExportData.java
@@ -0,0 +1,65 @@
+package com.vci.web.other;
+
+import com.vci.corba.omd.btm.BizType;
+import com.vci.corba.omd.ltm.LinkType;
+import com.vci.corba.omd.qtm.QTD;
+import com.vci.corba.omd.qtm.QTInfo;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 鏌ヨ涓氬姟绫诲瀷妯℃澘瀵煎嚭鏁版嵁绫伙細鍙簭鍒楀寲涓烘ā鏉挎枃浠�,鍚屾椂涔熷吋瀵煎嚭鏁版嵁鎺у埗绫�
+ * @Title		:QTExportData.java
+ * @Description	: 
+ * @Copyright	:瀹忓崥杩滆揪绉戞妧鏈夐檺鍏徃
+ * @Author		:骞冲彴涓庤鍒掗儴/ZhongGY/E-mail:zhonggy@vci-tech.com
+ * @Date		:2015-6-8
+ * @Version		:1
+ * @Other		:浜х敓娉ㄩ噴:Alt+Shift+J
+ */
+public class BtmQTExportData implements Serializable{
+
+	private static final long serialVersionUID = 1L;
+
+	
+	/**
+	 * 闇�瑕佸簭鍒楀寲鐨勬ā鏉挎暟鎹�
+	 */
+	//
+	private Map<String/*绫诲瀷鍚嶇О*/, BizType/*绫诲瀷瀵硅薄*/> selectedBtmItems = new HashMap<String, BizType>();
+	private Map<String/*绫诲瀷鍚嶇О*/,String[]/*绫诲瀷鎵�灞炲睘鎬�*/> selectedBtmAttrs = new HashMap<String, String[]>();
+	private Map<String/*鏌ヨ妯℃澘鍚嶇О*/, QTInfo/*鏌ヨ妯℃澘瀵硅薄*/> allSelectedQTs = new HashMap<String, QTInfo>();
+	private Map<String/*绫诲瀷鍚嶇О*/, QTD[]/*鏌ヨ妯℃澘瀹氫箟*/> allQTDs = new HashMap<String, QTD[]>();
+
+
+	public Map<String, BizType> getSelectedBtmItems() {
+		return selectedBtmItems;
+	}
+
+	public void setSelectedBtmItems(Map<String, BizType> selectedBtmItems) {
+		this.selectedBtmItems = selectedBtmItems;
+	}
+
+	public Map<String, String[]> getSelectedBtmAttrs() {
+		return selectedBtmAttrs;
+	}
+
+	public void setSelectedBtmAttrs(Map<String, String[]> selectedBtmAttrs) {
+		this.selectedBtmAttrs = selectedBtmAttrs;
+	}
+
+	public Map<String, QTD[]> getAllQTDs() {
+		return allQTDs;
+	}
+
+	public void setAllQTDs(Map<String, QTD[]> allQTDs) {
+		this.allQTDs = allQTDs;
+	}
+
+	public Map<String, QTInfo> getAllQTs() {
+		return allSelectedQTs;
+	}
+
+}
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 964b250..2d07b7a 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
@@ -114,14 +114,14 @@
      * @param btmId 涓氬姟绫诲瀷鐨勭紪鍙�
      * @return 灞炴�х殑鍐呭
      */
-    List<OsBtmTypeAttributeVO> listAttributeByBtmId(String btmId);
+    List<OsBtmTypeAttributeVO> listAttributeByBtmId(String btmId) throws PLException;
 
     /**
      * 鏍规嵁涓氬姟绫诲瀷鑾峰彇鍖呭惈鐨勫睘鎬�--鍖呭惈鍩虹灞炴��
      * @param btmId 涓氬姟绫诲瀷鐨勭紪鍙�
      * @return 灞炴�х殑鍐呭
      */
-    List<OsBtmTypeAttributeVO> listAttributeByBtmIdHasDefault(String btmId);
+    List<OsBtmTypeAttributeVO> listAttributeByBtmIdHasDefault(String btmId) throws PLException;
 
     /**
      * 鍙傜収涓氬姟绫诲瀷
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsCodeGenSchemaServiceI.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsCodeGenSchemaServiceI.java
index 60b864d..84f113d 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsCodeGenSchemaServiceI.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsCodeGenSchemaServiceI.java
@@ -1,4 +1,5 @@
 package com.vci.web.service;
+import com.vci.corba.common.PLException;
 import com.vci.starter.web.exception.VciBaseException;
 import com.vci.starter.web.pagemodel.DataGrid;
 import com.vci.starter.web.pagemodel.PageHelper;
@@ -59,7 +60,7 @@
      * @param oid 鏂规鐨勪富閿�
      * @throws VciBaseException 鍙傛暟涓虹┖锛屾柟妗堜笉瀛樺湪浼氭姏鍑哄紓甯�
      */
-    void productCodeFile(String oid) throws VciBaseException;
+    void productCodeFile(String oid) throws VciBaseException, PLException;
 
     /**
      * 棰勮浠g爜鏂囦欢
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 c4fbb99..4b2f1fa 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.corba.omd.qtm.QTInfo;
 import com.vci.dto.QTInfoDTO;
 import com.vci.pagemodel.OsBtmTypeAttributeVO;
 import com.vci.pagemodel.OsLinkTypeAttributeVO;
@@ -52,7 +53,6 @@
      */
     BaseResult deleteTemplate(String name) throws PLException;
     /**
-     *
      * @param qtInfoDTO 浼犺緭鐨勬暟鎹璞★細
      *                linkTypeName 閾炬帴绫诲瀷銆�
      *                rdPositive 鏂瑰悜锛宼rue姝e悜锛宖alse鍙嶅悜
@@ -106,4 +106,52 @@
      * @return 鎿嶄綔缁撴灉
      */
     BaseResult deleteLinkTemplate(List<String> templateNames) throws PLException;
+
+    /**
+     * 鏌ヨ鏉′欢涓嬬殑鏌ヨ鎸夐挳
+     * @param qtInfoDTO
+     * @return
+     * @throws PLException
+     */
+    BaseResult getCriteriaBtm(QTInfoDTO qtInfoDTO) throws PLException;
+
+    /**
+     * 涓氬姟绫诲瀷鏌ヨ妯℃澘淇濆瓨
+     * @param qtInfoDTO 淇濆瓨浼犺緭瀵硅薄
+     * @return 淇濆瓨缁撴灉
+     */
+    BaseResult btmSave(QTInfoDTO qtInfoDTO) throws PLException;
+
+    /**
+     * 鏇存柊鏁版嵁搴撶粨鏋�
+     * @return 淇濆瓨缁撴灉
+     */
+    BaseResult updateDBStructure() throws PLException;
+
+    /**
+     * 涓氬姟绫诲瀷鏌ヨ妯℃澘鏍戞煡璇紝鐢ㄤ簬鐣岄潰鐨勫鍑哄姛鑳�
+     * @return 鏌ヨ缁撴灉
+     */
+    BaseResult getBtmQtTree() throws PLException;
+
+    /**
+     * 瀵煎嚭涓氬姟绫诲瀷鏌ヨ妯℃澘
+     * names 鏌ヨ妯℃澘鍚�
+     * @return
+     */
+    void expBtmQTTemplate(List<String> names, HttpServletResponse response) throws PLException,IOException ;
+
+    /**
+     * 鏌ヨ鏉′欢涓嬬殑閫夋嫨鏌ヨ妯℃澘瀵硅瘽妗嗭紙鏌ヨ鍏ㄩ儴妯℃澘鍜屾墍瀵瑰簲鐨勪笟鍔$被鍨嬫垨閾炬帴绫诲瀷鍚嶏級
+     * @return
+     */
+    BaseResult getAllQTs() throws PLException;
+
+    /**
+     * 瀵煎叆涓氬姟绫诲瀷鏌ヨ妯℃澘
+     * @param file 涓婁紶鐨勬枃浠�
+     * @return 瀵煎叆缁撴灉
+     */
+    BaseResult impBtmTemplate(MultipartFile file) throws IOException, ClassNotFoundException;
+
 }
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 080e08e..e46d9c8 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
@@ -38,6 +38,7 @@
 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;
@@ -358,9 +359,14 @@
      * @return 灞炴�х殑鍐呭
      */
     @Override
-    public List<OsBtmTypeAttributeVO> listAttributeByBtmId(String btmId) {
+    public List<OsBtmTypeAttributeVO> listAttributeByBtmId(String btmId) throws PLException {
         VciBaseUtil.alertNotNull(btmId,"涓氬姟绫诲瀷鐨勭紪鍙�");
-        OsBtmTypeVO btmTypeVO = getBtmById(btmId);
+        BizType[] bizTypes = platformClientUtil.getBtmService().getBizTypes(btmId);
+        if(Func.isEmpty(bizTypes)){
+            return new ArrayList<>();
+        }
+        BizType bizType = bizTypes[0];
+        OsBtmTypeVO btmTypeVO = btmDO2VO(bizType);
         List<OsBtmTypeAttributeVO> attributes = btmTypeVO.getAttributes();
         if(attributes == null){
             attributes = new ArrayList<>();
@@ -375,7 +381,7 @@
      * @return 灞炴�х殑鍐呭
      */
     @Override
-    public List<OsBtmTypeAttributeVO> listAttributeByBtmIdHasDefault(String btmId) {
+    public List<OsBtmTypeAttributeVO> listAttributeByBtmIdHasDefault(String btmId) throws PLException {
         List<OsBtmTypeAttributeVO> attrVOs = listAttributeByBtmId(btmId);
         if(attrVOs == null){
             attrVOs = new ArrayList<>();
@@ -1216,13 +1222,15 @@
     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 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){
             //绱㈠紩涓嶅瓨鍦ㄦ椂鍒犻櫎灏变細鎶ラ敊绱㈠紩涓嶅瓨鍦紝鎵�浠ヨ繖閲屾湁绱㈠紩鎵嶅幓鍒犻櫎
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsCodeGenSchemaServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsCodeGenSchemaServiceImpl.java
index 2bbb45b..edd1a2a 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsCodeGenSchemaServiceImpl.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsCodeGenSchemaServiceImpl.java
@@ -1,6 +1,7 @@
 package com.vci.web.service.impl;
 
 import com.alibaba.fastjson.JSONObject;
+import com.vci.corba.common.PLException;
 import com.vci.starter.revision.service.RevisionModelUtil;
 import com.vci.starter.web.annotation.Column;
 import com.vci.starter.web.constant.FrameWorkLcStatusConstant;
@@ -268,7 +269,7 @@
      * @throws VciBaseException 鍙傛暟涓虹┖锛屾柟妗堜笉瀛樺湪浼氭姏鍑哄紓甯�
      */
     @Override
-    public void productCodeFile(String oid) throws VciBaseException {
+    public void productCodeFile(String oid) throws VciBaseException, PLException {
         OsCodeGenSchemaDO codeGenSchemaDO = selectByOid(oid);
         //澶勭悊涓存椂鏂囦欢澶癸紝鍦ㄤ复鏃舵枃浠跺す涓坊鍔燾odes/{涓氬姟绫诲瀷鐨勮嫳鏂囧悕绉皚
         String tempFolder =LocalFileUtil.getProjectFolder();
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 8f49da8..83fd63d 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
@@ -3,11 +3,15 @@
 import cn.hutool.core.io.FileUtil;
 import cn.hutool.core.util.ZipUtil;
 import com.alibaba.fastjson.JSONObject;
+import com.vci.client.ClientSession;
 import com.vci.client.common.oq.OQTool;
+import com.vci.client.common.providers.ClientServiceProvider;
 import com.vci.common.qt.object.*;
 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.BusinessObject;
 import com.vci.corba.omd.data.LinkObject;
 import com.vci.corba.omd.ltm.LinkType;
 import com.vci.corba.omd.qtm.QTD;
@@ -22,8 +26,10 @@
 import com.vci.starter.poi.util.ExcelUtil;
 import com.vci.starter.web.exception.VciBaseException;
 import com.vci.starter.web.pagemodel.BaseResult;
+import com.vci.starter.web.pagemodel.DataGrid;
 import com.vci.starter.web.pagemodel.Tree;
 import com.vci.starter.web.util.*;
+import com.vci.web.other.BtmQTExportData;
 import com.vci.web.other.LinkQTExportData;
 import com.vci.web.service.*;
 import com.vci.web.util.DateUtil;
@@ -32,17 +38,22 @@
 import com.vci.web.util.WebUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.time.DateFormatUtils;
+import org.dom4j.Document;
 import org.dom4j.DocumentException;
 import org.dom4j.DocumentHelper;
 import org.dom4j.Element;
+import org.jdesktop.swingx.JXDatePicker;
 import org.springframework.beans.factory.annotation.Autowired;
 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.awt.*;
 import java.io.*;
 import java.util.*;
+import java.util.List;
 import java.util.stream.Collectors;
 
 /**
@@ -90,7 +101,7 @@
     }
 
     /**
-     * 鏌ヨ妯℃澘
+     * 淇濆瓨鏌ヨ妯℃澘
      * @param qtd 鏌ヨ妯℃澘瀹炰綋绫�
      * @return 淇濆瓨缁撴灉
      */
@@ -150,8 +161,7 @@
         }
     }
     /**
-     *
-     * @param dataMap 浼犺緭鐨勬暟鎹璞★細
+     * @param qtInfoDTO 浼犺緭鐨勬暟鎹璞★細
      *                linkTypeName 閾炬帴绫诲瀷銆�
      *                rdPositive 鏂瑰悜锛宼rue姝e悜锛宖alse鍙嶅悜
      *                btmName 涓氬姟绫诲瀷鍚嶇О
@@ -163,7 +173,7 @@
      */
     @Override
     public BaseResult getCriteria(QTInfoDTO qtInfoDTO) throws PLException {
-        QueryTemplate qt = getQT(qtInfoDTO);
+        QueryTemplate qt = getQT(qtInfoDTO,true);
         String checkInfo = OQTool.checkQT(qt);
         if(!checkInfo.equals("OK")){
             throw new PLException("500", new String[]{checkInfo});
@@ -189,7 +199,7 @@
             qtInfoDTO.setBtmName(obj.btmName);
             qtInfoDTO.setQtName(obj.qtName);
             qtInfoDTO.setLevelFlag(obj.levelFlag);
-//            qtInfoDTO.setQtText(obj.qtText);
+            //qtInfoDTO.setQtText(obj.qtText);
             qtInfoDTO.setQtUIText(obj.qtUIText);
             if(StringUtils.isNotBlank(obj.qtUIText)){
                 //灏嗙粰瀹氱殑String鏂囨湰瑙f瀽涓篨ML鏂囨。骞惰繑鍥炴柊鍒涘缓鐨刣ocument
@@ -271,7 +281,7 @@
      */
     @Override
     public BaseResult linkSave(QTInfoDTO qtInfoDTO) throws PLException {
-        QueryTemplate qt = getQT(qtInfoDTO);
+        QueryTemplate qt = getQT(qtInfoDTO,true);
         String checkInfo = OQTool.checkQT(qt);
         if(!checkInfo.equals("OK")){
             throw new PLException("500", new String[]{checkInfo});
@@ -415,17 +425,22 @@
      * 缁勮鏌ヨ妯℃澘
      * @return
      */
-    public QueryTemplate getQT(QTInfoDTO qtInfoDTO) throws PLException {
+    public QueryTemplate getQT(QTInfoDTO qtInfoDTO,boolean isLinkType) 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());
+        if(isLinkType){
+            qt.setType(QTConstants.TYPE_LINK);
+            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());
+        }else{
+            qt.setType(QTConstants.TYPE_BTM);
+            qt.setBtmType(qtInfoDTO.getBtmName());
+        }
+
         List<String> clauseList = new ArrayList<String>();
         //TODO 鏌ヨ鍒� 鏄剧ず鍒�
         clauseList.add("*");
@@ -915,7 +930,6 @@
 //        return qt;
 //    }
 
-
     /**
      * 杩斿洖鏌ヨ鐨勭増鏈�
      * @return
@@ -940,7 +954,6 @@
         return version;
     }
 
-
     /**
      * 鏍¢獙鍙傛暟
      * @param qtd
@@ -957,7 +970,6 @@
             throw new PLException("500", new String[]{"璇ユā鏉垮畾涔夊悕宸茬粡琚娇鐢�, 璇锋洿鎹�"});
         }
     }
-
 
     /**
      * 瀵煎嚭閾炬帴绫诲瀷鏌ヨ妯℃澘
@@ -1143,6 +1155,35 @@
         }
     }
 
+    private void getPLQtBtmItem2(String string, BizType bizType, List<BizType> ltsNew) {
+        // TODO Auto-generated method stub
+        try {
+            BizType queryBizType = platformClientUtil.getBtmService().getBizTypes(string)[0];
+            BizType[] btmArray = platformClientUtil.getBtmService().getBizTypes("");
+            String[] strings = queryBizType.apNameArray;
+            boolean b = true;
+            for (int i = 0; i < btmArray.length; i++) {
+                if (btmArray[i].name.equals(string)) {
+                    b = false;
+                    if (Arrays.equals(bizType.apNameArray, strings)) {
+                        btmArray[i].name += "銆愪笟鍔$被鍨嬪凡瀛樺湪銆�";
+                        ltsNew.add(btmArray[i]);
+                    } else {
+                        btmArray[i].name += "銆愪笟鍔$被鍨嬪瓨鍦ㄤ絾灞炴�т笉涓�鑷淬��";
+                        ltsNew.add(btmArray[i]);
+                    }
+                }
+            }
+            if (b) {
+                bizType.name += "銆愪笟鍔$被鍨嬩笉瀛樺湪銆�";
+                ltsNew.add(bizType);
+            }
+        } catch (PLException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+    }
+
     private void getPLQtWrapper(String string, QTInfo qtWrapper, List<LinkType> ltsNew, List<QTInfo> qTWrapperNew, Map<String/*绫诲瀷鍚嶇О*/, QTD[]/*鏌ヨ妯℃澘瀹氫箟*/> newNorepQTDs) {
         try {
             QTInfo[] qtws = platformClientUtil.getQTDService().getAllQTs();
@@ -1208,6 +1249,71 @@
         }
     }
 
+    private void getPLBtmQtWrapper(String string, QTInfo qtWrapper, List<BizType> ltsNew, List<QTInfo> qTWrapperNew, Map<String/*绫诲瀷鍚嶇О*/, QTD[]/*鏌ヨ妯℃澘瀹氫箟*/> newNorepQTDs) {
+        try {
+            QTInfo[] qtws = platformClientUtil.getQTDService().getAllQTs();
+            boolean islaet = true;
+            for (int i = 0; i < qtws.length; i++) {
+                if (string.equals(qtws[i].qtName)) {
+                    islaet = false;
+                    for (BizType lt : ltsNew) {
+                        if (qtWrapper.btmName.equals(lt.name.substring(0,
+                                lt.name.indexOf("銆�")))) {
+                            if (lt.name.endsWith("銆愪笟鍔$被鍨嬪凡瀛樺湪銆�")) {
+                                qtWrapper.qtName += "銆愭煡璇㈡ā鏉垮凡瀛樺湪锛屼笉瀵煎叆銆�";
+                                qTWrapperNew.add(qtWrapper);
+                            }else if(lt.name.endsWith("銆愪笟鍔$被鍨嬪瓨鍦ㄤ絾灞炴�т笉涓�鑷淬��")){
+                                qtWrapper.qtName += "銆愭煡璇㈡ā鏉挎墍灞炰笟鍔$被鍨嬪睘鎬т笉涓�鑷达紝涓嶅鍏ャ��";
+                                qTWrapperNew.add(qtWrapper);
+                            }else{
+                                qtWrapper.qtName += "銆愭煡璇㈡ā鏉挎墍灞炰笟鍔$被鍨嬩笉瀛樺湪锛屼笉瀵煎叆銆�";
+                                qTWrapperNew.add(qtWrapper);
+                            }
+                        }
+                    }
+                }
+            }
+            if (islaet) {
+                for (BizType btmItem : ltsNew) {
+                    if (qtWrapper.btmName.equals(btmItem.name.substring(0,
+                            btmItem.name.indexOf("銆�")))) {
+                        if (btmItem.name.endsWith("銆愪笟鍔$被鍨嬪凡瀛樺湪銆�")) {
+                            //鍒ゆ柇鏌ヨ妯℃澘瀹氫箟鏄惁瀛樺湪锛岃繘琛屼繚瀛�
+                            QTD[] qtds = newNorepQTDs.get(qtWrapper.btmName);
+                            if(qtds != null){
+                                for (QTD qtd : qtds) {
+                                    QTD qtdByName = platformClientUtil.getQTDService().getQTDByName(qtd.name);
+                                    if(!(qtdByName != null && StringUtils.isNotBlank(qtdByName.name))){
+                                        boolean b = platformClientUtil.getQTDService().addQTD(qtd);
+                                        if(!b){
+                                            qtWrapper.qtName += qtWrapper.qtName+"瀵煎叆鏌ヨ妯℃澘瀹氫箟銆�" + qtdByName.name + "銆戝け璐ワ紒";
+                                        }
+                                    }
+                                }
+                                newNorepQTDs.remove(qtWrapper.btmName);
+                            }
+                            boolean success = platformClientUtil.getQTDService().saveQT(qtWrapper);
+                            if(!success){
+                                qtWrapper.qtName += qtWrapper.qtName+"瀵煎叆澶辫触锛�";
+                            }else {
+                                qtWrapper.qtName += "銆愭煡璇㈡ā鏉垮鍏ユ垚鍔燂紒銆�";
+                            }
+                            qTWrapperNew.add(qtWrapper);
+                        }else if(btmItem.name.endsWith("銆愪笟鍔$被鍨嬪瓨鍦ㄤ絾灞炴�т笉涓�鑷淬��")){
+                            qtWrapper.qtName += "銆愭煡璇㈡ā鏉挎墍灞炰笟鍔$被鍨嬪睘鎬т笉涓�鑷达紝涓嶅鍏ャ��";
+                            qTWrapperNew.add(qtWrapper);
+                        }else{
+                            qtWrapper.qtName += "銆愭煡璇㈡ā鏉挎墍灞炰笟鍔$被鍨嬩笉瀛樺湪锛屼笉瀵煎叆銆�";
+                            qTWrapperNew.add(qtWrapper);
+                        }
+                    }
+                }
+            }
+        } catch (PLException e) {
+            e.printStackTrace();
+        }
+    }
+
     //鏍规嵁閫夋嫨鐨勬煡璇㈡ā鏉胯繃婊ゆā鏉垮畾涔�
     private Map<String, QTD[]> getnewNorepQTDs(Map<String, QTD[]> norepQTDs,
                                                Map<String, QTInfo> allQTs) {
@@ -1235,6 +1341,290 @@
         if(!b){
             return BaseResult.fail("鍒犻櫎澶辫触锛侊紒锛�");
         }
-        return BaseResult.success();
+        return BaseResult.success("鏌ヨ妯℃澘鍒犻櫎鎴愬姛锛�");
     }
+
+    /**
+     * @param qtInfoDTO 浼犺緭鐨勬暟鎹璞★細
+     *                linkTypeName 閾炬帴绫诲瀷銆�
+     *                rdPositive 鏂瑰悜锛宼rue姝e悜锛宖alse鍙嶅悜
+     *                btmName 涓氬姟绫诲瀷鍚嶇О
+     *                combRelaType 涓氬姟绫诲瀷閫夋嫨鍊�
+     *                versionValue 鐗堟湰鐝鍊�
+     *                isQueryIsLeaf 鏄惁閫夋嫨涓嬬骇
+     *                level 瀛愯妭鐐瑰眰鏁�
+     * @return 鏌ヨ缁撴灉
+     */
+    @Override
+    public BaseResult getCriteriaBtm(QTInfoDTO qtInfoDTO) throws PLException {
+        QueryTemplate qt = getQT(qtInfoDTO,false);
+        String checkInfo = OQTool.checkQT(qt);
+        if(!checkInfo.equals("OK")){
+            throw new PLException("500", new String[]{checkInfo});
+        }
+        qt.setId("qt1");
+        BusinessObject[] result = platformClientUtil.getQueryService().findBTMObjects(qt.getId(), OQTool.qtTOXMl(qt).asXML());
+        return BaseResult.dataList(Arrays.asList(result));
+    }
+
+    /**
+     * 涓氬姟绫诲瀷鏌ヨ妯℃澘淇濆瓨
+     * @param qtInfoDTO 淇濆瓨浼犺緭瀵硅薄
+     * @return 淇濆瓨缁撴灉
+     */
+    @Override
+    public BaseResult btmSave(QTInfoDTO qtInfoDTO) throws PLException {
+        VciBaseUtil.alertNotNull(
+                qtInfoDTO,"淇濆瓨鐨勪笟鍔$被鍨嬫ā鏉垮璞�",
+                qtInfoDTO.getBtmName(),"璇烽�夋嫨涓氬姟绫诲瀷鍜屾煡璇㈡ā鏉垮畾涔夋潵鍒涘缓鏌ヨ妯℃澘"
+        );
+
+        //add by caill start 閬嶅巻鏅�氭煡璇㈡ā鏉胯緭鍏ユ涓殑鍊煎仛鏍¢獙
+        //		ArrayList<String> list = cpm_centerPanel.getList();
+        //		for(int i=0;i<list.size();i++){
+        //			String text = (String) list.get(i);
+        //			if(text.contains("'")){
+        //				JOptionPane.showMessageDialog(cp_mainPanel, "鏉′欢鍊间腑鍖呭惈浜嗛潪娉曞瓧绗�", "闈炴硶瀛楃", JOptionPane.ERROR_MESSAGE);
+        //				return;
+        //			}
+        //		}
+        //淇濆瓨涔嬪墠甯﹀嚭宸查�夋嫨鐨剄tName
+        QueryTemplate qt = getQT(qtInfoDTO,false);
+        //鍓嶇璋冪敤杩欎釜鏂规硶isExistsQT()
+        /*if(isExists(qtName)){
+            return BaseResult.success("","璇ユ煡璇㈡ā鏉垮悕宸茬粡瀛樺湪,鏄惁瑕嗙洊锛�");
+        }*/
+        String checkInfo = OQTool.checkQT(qt);
+        if(!checkInfo.equals("OK")){
+            throw new PLException("500", new String[]{checkInfo});
+        }
+        //璁剧疆鎺掑簭淇℃伅
+        qt.setOrderInfoList(qtInfoDTO.getQueryTemplate().getOrderInfoList());
+        QTInfo qtWrapper = new QTInfo();
+        qtWrapper.qtName = qtInfoDTO.getQtName();
+        qtWrapper.btmName = qt.getBtmType();
+        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();
+        boolean saveFlag = platformClientUtil.getQTDService().saveQT(qtWrapper);
+        if(saveFlag){
+            return BaseResult.success("淇濆瓨鏌ヨ妯℃澘鎴愬姛");
+        }else{
+            return BaseResult.fail("淇濆瓨鏌ヨ妯℃澘澶辫触");
+        }
+    }
+
+    /**
+     * 鏇存柊鏁版嵁搴撶粨鏋�
+     * @return 淇濆瓨缁撴灉
+     */
+    @Override
+    public BaseResult updateDBStructure() throws PLException {
+        boolean f = platformClientUtil.getQTDService().updateQT();
+        if(f){
+            return BaseResult.success("鏇存柊鎴愬姛");
+        }else{
+            return BaseResult.fail("鏇存柊澶辫触");
+        }
+    }
+
+    /**
+     * 涓氬姟绫诲瀷鏌ヨ妯℃澘鏍戞煡璇紝鐢ㄤ簬鐣岄潰鐨勫鍑哄姛鑳�
+     * @return 鏌ヨ缁撴灉
+     */
+    @Override
+    public BaseResult getBtmQtTree() throws PLException {
+        BizType[] bizTypes= null;
+        QTInfo[] qts = null;
+        HashMap<String,Object> tree = new HashMap();
+        tree.put("text","涓氬姟绫诲瀷");
+        if (bizTypes == null) {
+            List<BizType> es = new ArrayList<>();
+            bizTypes = platformClientUtil.getBtmService().getBizTypes("");
+            for (BizType lt : bizTypes) {
+                QTInfo[] qtWrappers = platformClientUtil.getQTDService().getObjTypeQTs(lt.name);
+                if (qtWrappers.length!=0) {
+                    es.add(lt);
+                }
+            }
+            bizTypes = es.toArray(new BizType[es.size()]);
+            //TODO:闇�淇娌℃湁鍏宠仈鏌ヨ妯℃澘涓氬姟绫诲瀷鍘绘帀
+            qts = platformClientUtil.getQTDService().getAllQTs();//鑾峰彇鎵�鏈夋煡璇㈡ā鏉�
+        }
+        List<HashMap<String,Object>> childList = new ArrayList<>();
+        //娣诲姞涓氬姟绫诲瀷鏍硅妭鐐�
+        for (BizType plAction : bizTypes) {
+            HashMap<String,Object> childTree = new HashMap();
+            childTree.put("text", plAction.label + "/" +plAction.name);
+            childTree.put("oid", plAction.oid);
+            //tree.put("children", childTree);
+            addExportTreeNode(plAction, qts, childTree);
+            childList.add(childTree);
+        }
+        tree.put("children", childList);
+        return BaseResult.success(tree);
+    }
+
+    /**
+     * 瀵煎嚭涓氬姟绫诲瀷鏌ヨ妯℃澘
+     * names 鏌ヨ妯℃澘鍚�
+     * @return
+     */
+    @Override
+    public void expBtmQTTemplate(List<String> names, HttpServletResponse response) throws PLException, IOException {
+        String defaultTempFolder = LocalFileUtil.getDefaultTempFolder();
+        String vciqtmfFileName = defaultTempFolder + File.separator + "BtmTemplateExp" + new Date().getTime() + ".vciqtf";
+        BtmQTExportData exportData = new BtmQTExportData();
+        for (String name : names) {
+            QTInfo qt = platformClientUtil.getQTDService().getQT(name);
+            exportData.getAllQTs().put(qt.qtName,qt);
+            BizType[] bizTypes = platformClientUtil.getBtmService().getBizTypes(qt.btmName);
+            for (int i = 0; i < bizTypes.length; i++) {
+                BizType bizType = bizTypes[i];
+                if(bizTypes != null && !bizType.oid.equals("")){
+                    exportData.getSelectedBtmItems().put(bizType.name, bizType);
+                    exportData.getSelectedBtmAttrs().put(bizType.name, bizType.apNameArray);
+                    exportData.getAllQTDs().put(bizType.name, platformClientUtil.getQTDService().getBizTypeQTDs(bizType.name));
+                }
+            }
+        }
+        ObjectOutputStream vciamfFileStream = null;
+        try {
+            File vciqtmfFile = new File(vciqtmfFileName);
+            vciamfFileStream = new ObjectOutputStream(new FileOutputStream(vciqtmfFile));
+            vciamfFileStream.writeObject(exportData);
+        }finally {
+            try {
+                if (vciamfFileStream != null) {
+                    vciamfFileStream.flush();
+                    vciamfFileStream.close();
+                }
+            } catch (Exception e) {
+                throw new PLException("500",new String[]{"瀵煎嚭娴佸叧闂紓甯革紒"});
+            }
+        }
+        ControllerUtil.writeFileToResponse(response,vciqtmfFileName);
+        FileUtil.del(defaultTempFolder + File.separator);
+    }
+
+    /**
+     * 鏌ヨ鏉′欢涓嬬殑閫夋嫨鏌ヨ妯℃澘瀵硅瘽妗嗭紙鏌ヨ鍏ㄩ儴妯℃澘鍜屾墍瀵瑰簲鐨勪笟鍔$被鍨嬫垨閾炬帴绫诲瀷鍚嶏級
+     * @return
+     */
+    @Override
+    public BaseResult getAllQTs() throws PLException {
+        QTInfo[] allQTs = platformClientUtil.getQTDService().getAllQTs();
+        DataGrid<QTInfo> dataGrid = new DataGrid<>();
+        dataGrid.setData(Arrays.asList(allQTs));
+        dataGrid.setTotal(allQTs.length);
+        return BaseResult.dataGrid(dataGrid);
+    }
+
+    /**
+     * 瀵煎叆涓氬姟绫诲瀷鏌ヨ妯℃澘
+     * @param file 涓婁紶鐨勬枃浠�
+     * @return 瀵煎叆缁撴灉
+     */
+    @Override
+    public BaseResult impBtmTemplate(MultipartFile file) throws IOException, ClassNotFoundException {
+        if (file == null) {
+            return BaseResult.fail(FrameWorkLangCodeConstant.IMPORT_FAIL, new String[]{"鏃犲鍏ョ殑鏂囦欢"});
+        }
+        if (!file.getOriginalFilename().endsWith(".vciqtf")) {
+            throw new VciBaseException("浠呰兘涓婁紶.vciqtf鏍煎紡鏂囦欢锛岃閲嶆柊涓婁紶锛�");
+        }
+        ObjectInputStream obj = new ObjectInputStream(
+                file.getInputStream());
+        BtmQTExportData qtExportData = (BtmQTExportData) obj.readObject();
+        List<BizType> ltsNew = new ArrayList<>();
+        List<QTInfo> qTWrapperNew = new ArrayList<>();
+        Map<String/* 绫诲瀷鍚嶇О */, QTD[]/* 鏌ヨ妯℃澘瀹氫箟 */> norepQTDs = new HashMap<String, QTD[]>();
+        addImportBtmData(qtExportData, ltsNew, qTWrapperNew, norepQTDs);
+        QTInfo[] qts = qTWrapperNew
+                .toArray(new QTInfo[qTWrapperNew.size()]);
+        //澶勭悊鏍戠殑杩斿洖
+        HashMap<String,Object> tree = new HashMap();
+        tree.put("text","涓氬姟绫诲瀷");
+        List<HashMap<String,Object>> childList = new ArrayList<>();
+        //娣诲姞涓氬姟绫诲瀷鏍硅妭鐐�
+        for (BizType plAction : ltsNew) {
+            HashMap<String,Object> childTree = new HashMap();
+            childTree.put("text", plAction.label + "/" +plAction.name);
+            childTree.put("oid", plAction.oid);
+            addExportTreeNode(plAction, qts, childTree);
+            childList.add(childTree);
+        }
+        tree.put("children", childList);
+        return BaseResult.success(tree);
+    }
+
+    // 鏁版嵁杩囨护
+    private void addImportBtmData(BtmQTExportData qtExportData, List<BizType> ltsNew, List<QTInfo> qTWrapperNew,
+                               Map<String/* 绫诲瀷鍚嶇О */, QTD[]/* 鏌ヨ妯℃澘瀹氫箟 */> norepQTDs) {
+        Map<String/* 绫诲瀷鍚嶇О */, QTD[]/* 鏌ヨ妯℃澘瀹氫箟 */> allQTDs = qtExportData
+                .getAllQTDs();
+        Map<String/* 绫诲瀷鍚嶇О */, BizType/* 绫诲瀷瀵硅薄 */> selectedBtmItems = qtExportData
+                .getSelectedBtmItems();
+        Map<String/* 绫诲瀷鍚嶇О */, String[]/* 绫诲瀷鎵�灞炲睘鎬� */> selectedBtmAttrs = qtExportData
+                .getSelectedBtmAttrs();
+        Map<String/* 鏌ヨ妯℃澘鍚嶇О */, QTInfo/* 鏌ヨ妯℃澘瀵硅薄 */> allSelectedQTs = qtExportData
+                .getAllQTs();
+        if (allQTDs.size() == 0 || allQTDs == null
+                || selectedBtmItems.size() == 0 || selectedBtmItems == null
+                || selectedBtmAttrs.size() == 0 || selectedBtmAttrs == null
+                || allSelectedQTs.size() == 0 || allSelectedQTs == null) {
+            throw new VciBaseException("瀵煎叆鐨勬ā鏉挎暟鎹湁璇�!!!");
+        }
+        Set<Map.Entry<String, QTD[]>> pLActions = allQTDs.entrySet();
+        Set<Map.Entry<String, QTInfo>> pLQts = allSelectedQTs.entrySet();
+        Set<Map.Entry<String, BizType>> btmpLQts = selectedBtmItems.entrySet();
+        for (Map.Entry<String, QTD[]> entry : pLActions) {
+            String string = entry.getKey();
+            QTD[] qtds = entry.getValue();
+            getPLQtIsInDB(string, qtds, norepQTDs);
+        }
+        for (Map.Entry<String, BizType> entry : btmpLQts) {
+            String string = entry.getKey();
+            BizType bizType = entry.getValue();
+            getPLQtBtmItem2(string, bizType, ltsNew);
+        }
+        Map<String/*绫诲瀷鍚嶇О*/, QTD[]/*鏌ヨ妯℃澘瀹氫箟*/> newNorepQTDs = getnewNorepQTDs(norepQTDs,allSelectedQTs);
+        for (Map.Entry<String, QTInfo> entry : pLQts) {
+            String string = entry.getKey();
+            QTInfo qtWrapper = entry.getValue();
+            getPLBtmQtWrapper(string, qtWrapper, ltsNew, qTWrapperNew, newNorepQTDs);
+        }
+
+    }
+
+    /**
+     * 鐢熸垚瀵煎嚭鏍戦�夋嫨浠ュ強瀵煎叆鏍戞樉绀�
+     * @param bizType
+     * @param qts
+     * @param tree
+     */
+    private void addExportTreeNode(BizType bizType/*涓氬姟绫诲瀷*/,QTInfo[] qts/*鏌ヨ妯℃澘瀵硅薄*/,HashMap<String,Object> tree) {
+        List<String> childList = new ArrayList<>();
+        // 娣诲姞鏌ヨ妯℃澘瀵硅薄瀛愯妭鐐�
+        for (QTInfo qtItem : qts) {
+            //澶勭悊瀵煎叆鏃舵棤娉曡繘琛岀被鍨嬪垽鏂�
+            int splitLength = bizType.name.indexOf("銆�");
+            if(splitLength == -1){
+                splitLength = bizType.name.length();
+            }
+            if (qtItem.btmName.equals(bizType.name.substring(0,
+                    splitLength))) {
+                childList.add(qtItem.qtName);
+            }
+        }
+        tree.put("children",childList);
+    }
+
 }
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBtmIOServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBtmIOServiceImpl.java
index b8724f9..7faff82 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBtmIOServiceImpl.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBtmIOServiceImpl.java
@@ -851,7 +851,13 @@
         if(!CollectionUtils.isEmpty(btmTypeVOList)) {
             btmTypeVOList.stream().forEach(btmTypeVO -> {
                 String btmId = btmTypeVO.getId();
-                List<OsBtmTypeAttributeVO> attributeVOS = btmService.listAttributeByBtmId(btmId);
+                List<OsBtmTypeAttributeVO> attributeVOS = null;
+                try {
+                    attributeVOS = btmService.listAttributeByBtmId(btmId);
+                } catch (PLException e) {
+                    e.printStackTrace();
+                    throw new VciBaseException(VciBaseUtil.getExceptionMessage(e));
+                }
                 //鍏堟槸鍚嶇О
                 int rowIndex = index[0];
                 WriteExcelData idED = new WriteExcelData(rowIndex, 0, btmId);

--
Gitblit v1.9.3