From ca3880ac5dde98928d6ae0d0c66a0e53c4cbc6c7 Mon Sep 17 00:00:00 2001
From: xiejun <xiejun@vci-tech.com>
Date: 星期二, 27 八月 2024 15:45:15 +0800
Subject: [PATCH] 表单表格功能测试完善

---
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebPortalVIController.java   |   39 ++++++-
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/enumpck/PortalVIType.java               |    5 
 Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/model/PortalVIDO.java                   |   33 ++++++
 Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/PortalVIDTO.java                    |   29 +++++
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsPortalVIServiceI.java         |    7 +
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsPortalVIServiceImpl.java |  120 +++++++++++++++++++++++-
 Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/PortalVIVO.java               |   31 ++++++
 Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/constant/PortalVIEnumConstant.java      |   14 ++
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/enumpck/PortalVITypeFlag.java           |    3 
 9 files changed, 267 insertions(+), 14 deletions(-)

diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/constant/PortalVIEnumConstant.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/constant/PortalVIEnumConstant.java
new file mode 100644
index 0000000..4c9fec8
--- /dev/null
+++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/constant/PortalVIEnumConstant.java
@@ -0,0 +1,14 @@
+package com.vci.constant;
+
+public class PortalVIEnumConstant {
+
+    /**
+     * 琛ㄥ崟绫诲瀷鏋氫妇
+     */
+    public static final String PORTALVI_VI_TYPE = "portalVIType";
+
+    /***
+     * 琛ㄥ崟涓氬姟绫诲瀷鏋氫妇
+     */
+    public static final String PORTALVI_VI_FLAG = "portalVITypeFlag";
+}
diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/PortalVIDTO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/PortalVIDTO.java
index be2d3bd..5160b07 100644
--- a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/PortalVIDTO.java
+++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/PortalVIDTO.java
@@ -17,6 +17,11 @@
      * 0: 涓氬姟绫诲瀷; 1: 閾炬帴绫诲瀷. 榛樿0
      */
     private short typeFlag;
+
+    /**
+     * 涓氬姟绫诲瀷鏄剧ず鍊�
+     */
+    private  String typeFlagText;
     /**
      * 绫诲瀷鍚�
      */
@@ -29,6 +34,10 @@
      * 瑙嗗浘绫诲瀷: 杈撳叆琛ㄥ崟鎴栧垎椤靛垪琛�
      */
     private short viType;
+    /**
+     *琛ㄥ崟绫诲瀷
+     */
+    private String viTypeText;
     /**
      * 瀹氫箟璇︽儏
      */
@@ -82,14 +91,32 @@
         this.prm = prm;
     }
 
+    public String getTypeFlagText() {
+        return typeFlagText;
+    }
+
+    public void setTypeFlagText(String typeFlagText) {
+        this.typeFlagText = typeFlagText;
+    }
+
+    public String getViTypeText() {
+        return viTypeText;
+    }
+
+    public void setViTypeText(String viTypeText) {
+        this.viTypeText = viTypeText;
+    }
+
     @Override
     public String toString() {
-        return "PortalVIVO{" +
+        return "PortalVIDTO{" +
                 "id='" + id + '\'' +
                 ", typeFlag=" + typeFlag +
+                ", typeFlagText='" + typeFlagText + '\'' +
                 ", typeName='" + typeName + '\'' +
                 ", viName='" + viName + '\'' +
                 ", viType=" + viType +
+                ", viTypeText='" + viTypeText + '\'' +
                 ", prm=" + prm +
                 '}';
     }
diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/model/PortalVIDO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/model/PortalVIDO.java
index 00e2b38..bdd90ed 100644
--- a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/model/PortalVIDO.java
+++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/model/PortalVIDO.java
@@ -1,7 +1,9 @@
 package com.vci.model;
 
+import com.vci.constant.PortalVIEnumConstant;
 import com.vci.starter.web.annotation.Transient;
 import com.vci.starter.web.annotation.VciBtmType;
+import com.vci.starter.web.annotation.VciUseEnum;
 import com.vci.starter.web.constant.FrameWorkLcStatusConstant;
 
 /**
@@ -21,7 +23,13 @@
     /**
      * 0: 涓氬姟绫诲瀷; 1: 閾炬帴绫诲瀷. 榛樿0
      */
+
+    @VciUseEnum(value = PortalVIEnumConstant.PORTALVI_VI_FLAG,defaultValue = "0",showTextField = "typeFlagText")
     private short typeFlag;
+    /**
+     * 涓氬姟绫诲瀷鏄剧ず鏂囨湰
+     */
+    private String typeFlagText;
     /**
      * 绫诲瀷鍚�
      */
@@ -33,7 +41,12 @@
     /**
      * 瑙嗗浘绫诲瀷: 杈撳叆琛ㄥ崟鎴栧垎椤靛垪琛�
      */
+    @VciUseEnum(value = PortalVIEnumConstant.PORTALVI_VI_TYPE,defaultValue = "0",showTextField = "viTypeText")
     private short viType;
+    /**
+     * 瑙嗗浘绫诲瀷鏄剧ず鏂囨湰
+     */
+    private  String viTypeText;
     /**
      * 瀹氫箟璇︽儏
      */
@@ -87,14 +100,32 @@
         this.prm = prm;
     }
 
+    public String getTypeFlagText() {
+        return typeFlagText;
+    }
+
+    public void setTypeFlagText(String typeFlagText) {
+        this.typeFlagText = typeFlagText;
+    }
+
+    public String getViTypeText() {
+        return viTypeText;
+    }
+
+    public void setViTypeText(String viTypeText) {
+        this.viTypeText = viTypeText;
+    }
+
     @Override
     public String toString() {
-        return "PortalVIVO{" +
+        return "PortalVIDO{" +
                 "id='" + id + '\'' +
                 ", typeFlag=" + typeFlag +
+                ", typeFlagText='" + typeFlagText + '\'' +
                 ", typeName='" + typeName + '\'' +
                 ", viName='" + viName + '\'' +
                 ", viType=" + viType +
+                ", viTypeText='" + viTypeText + '\'' +
                 ", prm='" + prm + '\'' +
                 '}';
     }
diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/PortalVIVO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/PortalVIVO.java
index 2cfe1fb..1ffbe3d 100644
--- a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/PortalVIVO.java
+++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/PortalVIVO.java
@@ -1,5 +1,9 @@
 package com.vci.pagemodel;
 
+import com.vci.common.portal.enums.PortalVIType;
+import com.vci.constant.EnumIdConstant;
+import com.vci.starter.web.annotation.VciUseEnum;
+
 /**
  *
  * 琛ㄥ崟鏄剧ず瀵硅薄
@@ -18,6 +22,10 @@
      */
     private short typeFlag;
     /**
+     * 涓氬姟绫诲瀷鏄剧ず鍊�
+     */
+    private  String typeFlagText;
+    /**
      * 绫诲瀷鍚�
      */
     private String typeName;
@@ -25,10 +33,15 @@
      * 瑙嗗浘鍚�
      */
     private String viName;
+
     /**
      * 瑙嗗浘绫诲瀷: 杈撳叆琛ㄥ崟鎴栧垎椤靛垪琛�
      */
     private short viType;
+    /**
+     *琛ㄥ崟绫诲瀷
+     */
+    private String viTypeText;
     /**
      * 瀹氫箟璇︽儏
      */
@@ -82,14 +95,32 @@
         this.prm = prm;
     }
 
+    public String getTypeFlagText() {
+        return typeFlagText;
+    }
+
+    public void setTypeFlagText(String typeFlagText) {
+        this.typeFlagText = typeFlagText;
+    }
+
+    public String getViTypeText() {
+        return viTypeText;
+    }
+
+    public void setViTypeText(String viTypeText) {
+        this.viTypeText = viTypeText;
+    }
+
     @Override
     public String toString() {
         return "PortalVIVO{" +
                 "id='" + id + '\'' +
                 ", typeFlag=" + typeFlag +
+                ", typeFlagText='" + typeFlagText + '\'' +
                 ", typeName='" + typeName + '\'' +
                 ", viName='" + viName + '\'' +
                 ", viType=" + viType +
+                ", viTypeText='" + viTypeText + '\'' +
                 ", prm=" + prm +
                 '}';
     }
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebPortalVIController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebPortalVIController.java
index b86ab56..3e11cb3 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebPortalVIController.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebPortalVIController.java
@@ -9,19 +9,27 @@
 import com.vci.pagemodel.PortalVIVO;
 import com.vci.starter.web.annotation.controller.VciUnCheckRight;
 import com.vci.starter.web.annotation.log.VciBusinessLog;
+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;
+import com.vci.starter.web.util.ControllerUtil;
+import com.vci.starter.web.util.LangBaseUtil;
 import com.vci.starter.web.util.VciBaseUtil;
 import com.vci.web.enumpck.ItemDblEnum;
 import com.vci.web.enumpck.ItemTypeEnum;
 import com.vci.web.service.OsPortalVIServiceI;
+import com.vci.web.service.WebBtmIOServiceI;
 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 javax.servlet.http.HttpServletResponse;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
 import java.util.List;
 
 /**
@@ -56,17 +64,18 @@
     /**
      *鏍规嵁琛ㄥ崟id鑾峰彇鍏蜂綋鏁版嵁
      * @param id
+     * @param viType
      * @return
      */
     @GetMapping( "/getPortalVIById")
     @VciBusinessLog(operateName = "鑾峰彇琛ㄥ崟/琛ㄦ牸鏁版嵁")
-    public BaseResult getPortalVIById(@RequestBody String id,@RequestBody String viType){
+    public BaseResult getPortalVIById(@RequestParam("id") String id,@RequestParam("viType") String viType){
         try{
             PortalVIVO portalVIVO=  portalVIServiceI.getPortalVIById(id,viType);
            return  BaseResult.success(portalVIVO);
         }catch (Throwable e){
             e.printStackTrace();
-            String exceptionMessage = "鍒涘缓涓氬姟绫诲瀷鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e);
+            String exceptionMessage = "鑾峰彇琛ㄥ崟/琛ㄦ牸鏁版嵁鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e);
             logger.error(exceptionMessage);
             return BaseResult.fail(exceptionMessage);
         }
@@ -110,12 +119,12 @@
      */
     @DeleteMapping("/deleteByIds")
     @VciBusinessLog(operateName = "鍒犻櫎琛ㄥ崟/琛ㄦ牸")
-    public BaseResult deleteByIds(@RequestBody String ids){
+    public BaseResult deleteByIds(@RequestParam("ids") String ids){
         try {
             return portalVIServiceI.delete(ids) ? BaseResult.success("鍒犻櫎鎴愬姛锛�"):BaseResult.fail("鍒犻櫎澶辫触锛�");
         } catch (PLException e) {
             e.printStackTrace();
-            String exceptionMessage = "鍒犻櫎琛ㄥ崟鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e);
+            String exceptionMessage =  VciBaseUtil.getExceptionMessage(e);
             logger.error(exceptionMessage);
             return BaseResult.fail(exceptionMessage);
         }
@@ -127,7 +136,7 @@
     @VciBusinessLog(operateName = "鍒犻櫎琛ㄥ崟/琛ㄦ牸")
     public BaseResult clone(@RequestBody ClonePortalVIDTOList portalVIDTOList){
         try {
-            return portalVIServiceI.clone(portalVIDTOList) ? BaseResult.success("鍒犻櫎鎴愬姛锛�"):BaseResult.fail("鍒犻櫎澶辫触锛�");
+            return portalVIServiceI.clone(portalVIDTOList) ? BaseResult.success("鍏嬮殕鎴愬姛锛�"):BaseResult.fail("鍏嬮殕澶辫触锛�");
         } catch (Throwable e) {
             e.printStackTrace();
             String exceptionMessage = "鍒犻櫎琛ㄥ崟鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e);
@@ -136,6 +145,26 @@
         }
 
     }
+
+    /**
+     * 瀵煎嚭鏁版嵁搴撶殑琛ㄤ俊鎭埌excel
+     * @param response 鍝嶅簲瀵硅薄
+     * @param btmTypeIds 涓氬姟绫诲瀷鐨勭紪鍙凤紝鐢ㄩ�楀彿鍒嗗壊
+     */
+    @PostMapping("/exportExcel")
+    @VciBusinessLog(operateName = "瀵煎嚭琛ㄥ崟/琛ㄦ牸鍒癳xcel涓�")
+    public void exportExcel(String btmTypeIds,HttpServletResponse response){
+        String excelFileName = portalVIServiceI.exportToExcel(VciBaseUtil.str2List(btmTypeIds));
+        try {
+            ControllerUtil.writeFileToResponse(response,excelFileName);
+        } catch (IOException e) {
+            try {
+                ControllerUtil.writeDataToResponse(response, LangBaseUtil.getErrorMsg(e).getBytes(StandardCharsets.UTF_8),null);
+            } catch (IOException ex) {
+                ex.printStackTrace();
+            }
+        }
+    }
     /**
      * 鑾峰彇灞炴�у瓧娈电被鍨�
      */
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/enumpck/PortalVIType.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/enumpck/PortalVIType.java
index 62b23ab..d8f254a 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/enumpck/PortalVIType.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/enumpck/PortalVIType.java
@@ -1,12 +1,15 @@
 package com.vci.web.enumpck;
 
 import com.vci.common.portal.enums.GetByType;
+import com.vci.constant.PortalVIEnumConstant;
+import com.vci.starter.web.annotation.VciEnum;
 
 /**
  * 琛ㄥ崟绫诲瀷
  * @author xiej
  *
  */
+@VciEnum(name = PortalVIEnumConstant.PORTALVI_VI_TYPE,text = "琛ㄥ崟绫诲瀷")
 public enum PortalVIType {
 	Form("Form", "琛ㄥ崟", (short)1),
 	Table("Table", "琛ㄦ牸", (short)0);
@@ -81,5 +84,5 @@
 	public void setIntVal(short intVal) {
 		this.intVal = intVal;
 	}
-	
+
 }
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/enumpck/PortalVITypeFlag.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/enumpck/PortalVITypeFlag.java
index 8051091..6da5dad 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/enumpck/PortalVITypeFlag.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/enumpck/PortalVITypeFlag.java
@@ -1,12 +1,15 @@
 package com.vci.web.enumpck;
 
 import com.vci.common.portal.enums.GetByType;
+import com.vci.constant.PortalVIEnumConstant;
+import com.vci.starter.web.annotation.VciEnum;
 
 /**
  * 琛ㄥ崟鏍囪绫诲瀷
  * @author xiej
  *
  */
+@VciEnum(name = PortalVIEnumConstant.PORTALVI_VI_FLAG,text = "琛ㄥ崟鎵�灞炰笟鍔$被鍨嬫灇涓�")
 public enum PortalVITypeFlag {
 	LinkType("LinkType", "閾炬帴绫诲瀷鐨勮〃鍗�", (short)1),
 	BtmType("BtmType", "涓氬姟绫诲瀷鐨勮〃鍗�", (short)0);
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsPortalVIServiceI.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsPortalVIServiceI.java
index 62df51c..223f0d6 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsPortalVIServiceI.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsPortalVIServiceI.java
@@ -74,7 +74,12 @@
      */
     boolean  clone(ClonePortalVIDTOList portalVIDTOList)throws  Throwable;
 
-
+    /**
+     * 瀵煎嚭琛ㄥ崟/琛ㄦ牸鐨勪俊鎭埌Excel涓�
+     * @param idList 涓氬姟绫诲瀷鐨勭紪鍙烽泦鍚�
+     * @return excel鐨勫叏璺緞
+     */
+    String exportToExcel(Collection<String> idList);
 
     /**
      *鏌ヨ鎵�鏈夎〃鍗曟垨鑰呰〃鏍�
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsPortalVIServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsPortalVIServiceImpl.java
index 76e4cc3..486c5bc 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsPortalVIServiceImpl.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsPortalVIServiceImpl.java
@@ -8,6 +8,8 @@
 import com.vci.dto.*;
 import com.vci.model.*;
 import com.vci.pagemodel.*;
+import com.vci.starter.poi.bo.WriteExcelData;
+import com.vci.starter.web.enumpck.VciFieldTypeEnum;
 import com.vci.starter.web.exception.VciBaseException;
 import com.vci.starter.web.pagemodel.BaseQueryObject;
 import com.vci.starter.web.pagemodel.BaseResult;
@@ -29,6 +31,7 @@
 
 import java.util.*;
 import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.function.Function;
 import java.util.stream.Collectors;
 
 /*
@@ -218,13 +221,23 @@
             throw  new VciBaseException("璇烽�夋嫨瑕佸厠闅嗙殑瀵硅薄!");
         }
         try {
+           String typeName=clonePortalVIDTOList.getClonePortalVIDTOList().get(0).getTypeName();
+            PortalVI[] portalVIS=  platformClientUtil.getPortalService().getPortalVIArrayByTypeName(typeName);
+            Map<String, PortalVIVO> PortalVIMap=new HashMap<>();
+            if(!CollectionUtils.isEmpty(Arrays.asList(portalVIS))) {
+                List<PortalVIVO> portalVIVOS = portalVIDOO2VOS(Arrays.asList(portalVIS));
+                PortalVIMap =portalVIVOS.stream().collect(Collectors.toMap(PortalVIVO::getViName, Function.identity()));
+            }
+            List<PortalVI> portalVIList=new ArrayList<>();
             for (ClonePortalVIDTO clonedestObject : clonePortalVIDTOList.getClonePortalVIDTOList()) {
                 String viName = clonedestObject.getViName();
                 PortalVIDTO portalVIDTO = clonedestObject.getOldPortalVIDTO();
-                String typeName = clonedestObject.getTypeName();
                 short typeFlag = clonedestObject.getTypeFlag();
                 if (viName != null) {
                     VciBaseUtil.alertNotNull(viName, "鍏嬮殕鍚嶇О涓嶅厑璁镐负绌�");
+                    if(  PortalVIMap.containsKey(viName)){
+                        throw  new VciBaseException("鍏嬮殕鍚嶇О"+viName+"宸插瓨鍦紝璇锋牳瀵癸紒");
+                    }
                     PortalVI portalVI = UITools.getService().getPortalVIById(portalVIDTO.getId());
                     portalVI.id = ObjectUtility.getNewObjectID36();
                     portalVI.viName = viName;
@@ -235,7 +248,8 @@
                     if (typeFlag == PortalVITypeFlag.BtmType.getIntVal() || typeFlag == PortalVITypeFlag.LinkType.getIntVal()) {
                         portalVI.typeFlag = typeFlag;
                     }
-                    UITools.getService().savePortalVI(portalVI);
+                    platformClientUtil.getPortalService().savePortalVI(portalVI);
+                    portalVIList.add(portalVI);
                 }
             }
         }catch (PLException e){
@@ -244,7 +258,94 @@
         return true;
     }
 
+    @Override
+    public String exportToExcel(Collection<String> idList) {
+        /*List<PortalVIVO>  portalVIVOList= listByIds(idList);
+        List<WriteExcelData> rowDataList = new ArrayList<>();
+        final int[] index = {0};
+        if(!CollectionUtils.isEmpty(portalVIVOList)) {
+            portalVIVOList.stream().forEach(PortalVIVO -> {
+                //鍏堟槸鍚嶇О
+                int rowIndex = index[0];
+                WriteExcelData idED = new WriteExcelData(rowIndex, 0, btmId);
+                idED.setMerged(true);
+                if (attributeVOS.size() > 0) {
+                    idED.setRowTo(rowIndex + attributeVOS.size() - 1 + 3);
+                }
+                rowDataList.add(idED);
 
+                WriteExcelData nameED = new WriteExcelData(rowIndex, 1, btmTypeVO.getName());
+                nameED.setMerged(true);
+                if (attributeVOS.size() > 0) {
+                    nameED.setRowTo(rowIndex + attributeVOS.size() - 1 + 3);
+                }
+                rowDataList.add(nameED);
+
+                rowDataList.add(new WriteExcelData(rowIndex, 2, "id"));
+                rowDataList.add(new WriteExcelData(rowIndex, 3, "缂栧彿"));
+                rowDataList.add(new WriteExcelData(rowIndex, 4, "瀛楃涓�"));
+                rowDataList.add(new WriteExcelData(rowIndex, 5, "鏄�"));
+                rowDataList.add(new WriteExcelData(rowIndex, 6, "50"));
+                rowIndex++;
+                rowDataList.add(new WriteExcelData(rowIndex, 2, "name"));
+                rowDataList.add(new WriteExcelData(rowIndex, 3, "鍚嶇О"));
+                rowDataList.add(new WriteExcelData(rowIndex, 4, "瀛楃涓�"));
+                rowDataList.add(new WriteExcelData(rowIndex, 5, "鏄�"));
+                rowDataList.add(new WriteExcelData(rowIndex, 6, "50"));
+                rowIndex++;
+                rowDataList.add(new WriteExcelData(rowIndex, 2, "description"));
+                rowDataList.add(new WriteExcelData(rowIndex, 3, "鎻忚堪"));
+                rowDataList.add(new WriteExcelData(rowIndex, 4, "瀛楃涓�"));
+                rowDataList.add(new WriteExcelData(rowIndex, 5, "鏄�"));
+                rowDataList.add(new WriteExcelData(rowIndex, 6, "150"));
+                //澶勭悊灞炴��
+                rowIndex++;
+                for (int i = 0; i < attributeVOS.size(); i++) {
+                    OsBtmTypeAttributeVO attributeVO = attributeVOS.get(i);
+                    //鍏堟槸灞炴�х殑鑻辨枃鍚嶇О
+                    rowDataList.add(new WriteExcelData(rowIndex, 2, attributeVO.getId()));
+                    //鐒跺悗灞炴�х殑涓枃鍚嶇О
+                    rowDataList.add(new WriteExcelData(rowIndex, 3, attributeVO.getName()));
+                    //灞炴�х殑绫诲瀷
+                    rowDataList.add(new WriteExcelData(rowIndex, 4, VciFieldTypeEnum.getTextByValue(attributeVO.getAttributeDataType())));
+                    //鏄惁鍙互涓虹┖
+                    rowDataList.add(new WriteExcelData(rowIndex, 5, attributeVO.isNullableFlag() ? "鏄�" : "鍚�"));
+                    //灞炴�ч暱搴�
+                    String length = attributeVO.getAttributeLength()==null?"":attributeVO.getAttributeLength() + "" ;
+                    if (attributeVO.getPrecisionLength() != null) {
+                        length = length + "(" + attributeVO.getPrecisionLength() + "," + attributeVO.getScaleLength() == null ? "2" : (attributeVO.getScaleLength() + "") + ")" ;
+                    }
+                    rowDataList.add(new WriteExcelData(rowIndex, 6, length));
+                    //澶囨敞
+                    rowDataList.add(new WriteExcelData(rowIndex, 7, attributeVO.getDescription() == null ? "" : attributeVO.getDescription()));
+                    rowIndex++;
+                }
+
+                index[0] = rowIndex;
+            });
+        }
+*/
+
+        return null;
+    }
+
+    public List<PortalVIVO> listByIds(Collection idList){
+        List<PortalVIVO> portalVIVOList=new ArrayList<>();
+        if(CollectionUtils.isEmpty(idList)){
+            throw  new VciBaseException("璇烽�夋嫨闇�瑕佸鍑虹殑鏁版嵁");
+        }
+        List<PortalVI> portalVIList=new ArrayList<>();
+        idList.stream().forEach(id->{
+            try {
+                PortalVI portalVI=  platformClientUtil.getPortalService().getPortalVIById(id.toString());
+                portalVIList.add(portalVI);
+            } catch (PLException e) {
+                e.printStackTrace();
+            }
+        });
+        portalVIVOList=  portalVIDOO2VOS(portalVIList);
+        return portalVIVOList;
+    }
     private BaseResult savePortalVIDTO(PortalVIDTO portalVIDTO,boolean isEdit)  {
 
         boolean _isBtm=false;
@@ -486,10 +587,13 @@
     public  PortalVIVO portalVIDOO2VO(PortalVI portalVI) {
         PortalVIVO portalVIVO=new PortalVIVO();
         portalVIVO.setId(portalVI.id);
+        portalVIVO.setTypeFlagText(PortalVITypeFlag.getByIntVal(portalVI.typeFlag).getLabel());
         portalVIVO.setTypeFlag(portalVI.typeFlag);
         portalVIVO.setTypeName(portalVI.typeName);
         portalVIVO.setViName(portalVI.viName);
         portalVIVO.setViType(portalVI.viType);
+        portalVIVO.setViTypeText(PortalVIType.getByIntVal(portalVI.viType).getLabel());
+
         String  prm= portalVI.prm;
         if(StringUtils.isNotBlank(prm)) {
             PRMDO prmdo = UITools.getPRM(prm);
@@ -742,7 +846,13 @@
         List<String> itemSelectoutFieldList= allKeyList.stream().filter(s ->!itemOutFieldList.stream().map(s1 -> s1).collect(Collectors.toList()).contains(s) ).collect(Collectors.toList());
         prmItemVO.setItemSelectoutFieldList(itemSelectoutFieldList);//寰呴�夋嫨鐨勫睘鎬у瓧娈�
         prmItemVO.setItemOutFieldList(itemOutFieldList);//闇�瑕佷娇鐢ㄧ殑闆嗗悎
-        List<String> itemSearchFieldList= itemOutFieldList.stream().filter(s ->!itemKeyFieldList.stream().map(s1 -> s1).collect(Collectors.toList()).contains(s) ).collect(Collectors.toList());
+      //  List<String> itemSearchFieldList= itemOutFieldList.stream().filter(s ->!CollectionUtils.isEmpty(itemKeyFieldList).stream().map(s1 -> s1).collect(Collectors.toList()).contains(s) ).collect(Collectors.toList());
+        List<String> itemSearchFieldList=new ArrayList<>();
+        if(!CollectionUtils.isEmpty(itemKeyFieldList)){
+            itemSearchFieldList= itemOutFieldList.stream().filter(s ->!itemKeyFieldList.contains(s)).collect(Collectors.toList());
+        }else{
+            itemSearchFieldList=itemOutFieldList;
+        }
         prmItemVO.setItemSearchFieldList(itemSearchFieldList);//寰呮悳绱㈠瓧娈�
         prmItemVO.setItemKeyFieldList(itemKeyFieldList);//鎼滅储瀛楁
     }
@@ -772,7 +882,7 @@
     private void initTableConfigDTOO2DOData(PRMItemDO prmItemDO,PRMItemDTO prmItemDTO){
 
         prmItemDO.setItemOutFields(VciBaseUtil.array2String(prmItemDTO.getItemOutFieldList().toArray(new String[]{})));//闇�瑕佷娇鐢ㄧ殑瀛楁
-        prmItemDO.setItemKeyFields(VciBaseUtil.array2String(prmItemDTO.getItemKeyFieldList().toArray(new String[]{})));//闇�瑕佹悳绱㈢殑瀛楁
+        prmItemDO.setItemKeyFields(CollectionUtils.isEmpty(prmItemDTO.getItemKeyFieldList())?"":VciBaseUtil.array2String(prmItemDTO.getItemKeyFieldList().toArray(new String[]{})));//闇�瑕佹悳绱㈢殑瀛楁
        List<String> newItemFieldWidthList=prmItemDTO.getItemFieldWidthList().stream().map(KeyValue::getValue).distinct().collect(Collectors.toList());
        prmItemDO.setItemFieldWidth(VciBaseUtil.array2String(newItemFieldWidthList.toArray(new String[]{}),":"));//瀛楁瀹藉害
        List<ItemSeniorQueryBO> itemSeniorQueryBOS=  prmItemDTO.getItemSeniorQueryBOS();
@@ -805,7 +915,7 @@
     private List<KeyValue>  initItemFieldWidthList(String itemOutFields,String itemFieldWidth){
         List<KeyValue> keyValueList=new ArrayList<>();
         List<String>itemOutFieldList=   VciBaseUtil.str2List(itemOutFields);
-        List<String>itemFieldWidthList=  VciBaseUtil.str2List(itemFieldWidth);
+        List<String>itemFieldWidthList=  VciBaseUtil.str2List(itemFieldWidth,":");
         if(itemOutFieldList.size()>0) {
             for (int i = 0; i < itemOutFieldList.size(); i++) {
                 KeyValue keyValue = new KeyValue();

--
Gitblit v1.9.3