From 880a40f2654662044a0539fe56479f99d3e1b8d4 Mon Sep 17 00:00:00 2001
From: yuxc <yuxc@vci-tech.com>
Date: 星期一, 09 九月 2024 15:35:43 +0800
Subject: [PATCH] 1、查询模板保存时未保存ID问题。 2、属性未存在报错。

---
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsQueryTemplateImpl.java |   47 +++++++++++++++--------------------------------
 1 files changed, 15 insertions(+), 32 deletions(-)

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 5b993f0..ff7fb61 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
@@ -265,9 +265,15 @@
                 if(column.contains(".")){
                     column = StringUtils.substringAfterLast(column, ".");
                 }
+                if(column.contains(" ")){
+                    column = StringUtils.substringBefore(column, " ");
+                }
                 AttributeDef att = platformClientUtil.getAttributeService().getAttributeDefByName(column);
                 if(att == null || "".equals(att.oid)){
                     att = allSysAttr.get(column.toLowerCase());
+                }
+                if(att == null){
+                    throw new PLException("500", new String[]{"灞炴�у瓧娈碉細" + column + "鍦ㄥ睘鎬ф睜涓湭鏌ヨ鍒帮紝璇风‘璁わ紒锛�"});
                 }
                 leafInfoDTO.setClause(leafInfo.getClause());
 
@@ -321,6 +327,7 @@
                 HashMap<String, String> data = new HashMap<>();
                 data.put("column",child.getText().trim());
                 data.put("type",att.vtDataType);
+                childList.add(data);
             }
         }
         treeMap.put("child",childList);
@@ -998,34 +1005,6 @@
         return qt;
     }
 
-//    /**
-//     * 缁勮鏌ヨ妯℃澘
-//     * @return
-//     */
-//    public QueryTemplate getQT(HashMap<String,Object> dataMap){
-//        QueryTemplate qt = new QueryTemplate();
-//        qt.setType(QTConstants.TYPE_LINK);
-//        //TODO String qtId =
-//        qt.setLinkType((String) dataMap.get("linkTypeName"));
-//        qt.setDirection( (Boolean)dataMap.get("rdPositive") ? QTConstants.DIRECTION_POSITIVE : QTConstants.DIRECTION_OPPOSITE);
-//        qt.setBtmType((String) dataMap.get("btmName"));
-//        if("鎵�鏈夌被鍨�".equals(dataMap.get("combRelaType"))){
-//            qt.setBtmType("*");
-//        }
-//        qt.setVersion(getVersion((String) dataMap.get("versionValue")));
-//        qt.setQueryISLeaf((Boolean) dataMap.get("isQueryIsLeaf"));
-//        qt.setLevel(StringUtils.isBlank((CharSequence) dataMap.get("level")) ? 1 : Integer.valueOf(String.valueOf(dataMap.get("level"))));
-//        List<String> clauseList = new ArrayList<String>();
-//        //TODO 鏌ヨ鍒� 鏄剧ず鍒�
-//        clauseList.add("*");
-//        qt.setClauseList(clauseList);
-//        Condition con = new Condition();
-//        qt.setCondition(con);
-//        HashMap<String, ConditionItem> ciMap = getCIMap();
-//        con.setCIMap(ciMap);
-//        con.setRootCIName(con.getRootCINameByCIMap(ciMap));
-//        return qt;
-//    }
 
     /**
      * 杩斿洖鏌ヨ鐨勭増鏈�
@@ -1074,11 +1053,12 @@
      * @return
      */
     @Override
-    public void expLinkTemplate(List<String> names, HttpServletResponse response) throws PLException, IOException {
+    public void expLinkTemplate(String names, HttpServletResponse response) throws PLException, IOException {
         String defaultTempFolder = LocalFileUtil.getDefaultTempFolder();
         String vciqtmfFileName = defaultTempFolder + File.separator + "LinkTemplateExp" + new Date().getTime() + ".vciqtf";
         LinkQTExportData exportData = new LinkQTExportData();
-        for (String name : names) {
+        String[] splits = names.split(",");
+        for (String name : splits) {
             QTInfo qt = platformClientUtil.getQTDService().getQT(name);
             exportData.getAllQTs().put(qt.qtName,qt);
             LinkType linkType = platformClientUtil.getLinkTypeService().getLinkType(qt.btmName);
@@ -1499,6 +1479,7 @@
         if(!checkInfo.equals("OK")){
             throw new PLException("500", new String[]{checkInfo});
         }
+        qt.setId(qtInfoDTO.getQtName());
         //璁剧疆鎺掑簭淇℃伅
         qt.setOrderInfoList(qtInfoDTO.getQueryTemplate().getOrderInfoList());
         QTInfo qtWrapper = new QTInfo();
@@ -1702,12 +1683,14 @@
                 if(direction != null) {
                     if (direction.equals(QTConstants.DIRECTION_POSITIVE)) {
                         if(att == null ){
-                            throw new PLException("500",new String[]{"灞炴�у瓧娈�:"+ abName +"鏈煡璇㈠埌锛岃纭锛�"});
+                            continue;
+//                            throw new PLException("500",new String[]{"灞炴�у瓧娈�:"+ abName +"鏈煡璇㈠埌锛岃纭锛�"});
                         }
                         att.name = "T_OID." + abName;
                     } else if (direction.equals(QTConstants.DIRECTION_OPPOSITE)) {
                         if(att == null ){
-                            throw new PLException("500",new String[]{"灞炴�у瓧娈�:"+ abName +"鏈煡璇㈠埌锛岃纭锛�"});
+                            continue;
+//                            throw new PLException("500",new String[]{"灞炴�у瓧娈�:"+ abName +"鏈煡璇㈠埌锛岃纭锛�"});
                         }
                         att.name = "F_OID." + abName;
                     }

--
Gitblit v1.9.3