From 08635bced778daba88cd02a6382f7727de4f7bab Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期一, 09 九月 2024 10:29:32 +0800
Subject: [PATCH] ui定义下页面定义添加、查询接口调整

---
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIManagerServiceImpl.java |   67 +++++++++++++++++++++++++++------
 1 files changed, 54 insertions(+), 13 deletions(-)

diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIManagerServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIManagerServiceImpl.java
index d843ddb..b315dc0 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIManagerServiceImpl.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIManagerServiceImpl.java
@@ -35,7 +35,6 @@
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
 import org.springframework.web.multipart.MultipartFile;
-
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
@@ -58,12 +57,6 @@
     private PlatformClientUtil platformClientUtil;
 
     /**
-     * 瑙掕壊
-     */
-    @Resource
-    private SmRoleQueryServiceI smRoleQueryServiceI;
-
-    /**
      * 涓氬姟绫诲瀷
      */
     @Resource
@@ -81,6 +74,16 @@
         @Override
         public int compare(PLUILayout o1, PLUILayout o2) {
             return o1.plCode.compareTo(o2.plCode);
+        }
+    };
+
+    /**
+     * 鎺掑簭姣旇緝鍣�
+     */
+    private Comparator<PLDefinationVO> pageDefinationComparator = new Comparator<PLDefinationVO>() {
+        @Override
+        public int compare(PLDefinationVO o1, PLDefinationVO o2) {
+            return new Integer(o1.getSeq()).compareTo(new Integer(o2.getSeq()));
         }
     };
 
@@ -326,10 +329,13 @@
      * 鏍规嵁涓婁笅鏂嘔D鍜屽尯鍩熺被鍨嬶紝鎸夐『搴忚幏鍙栧綋鍓嶅尯鍩熺殑tab椤�
      */
     @Override
-    public List<PLTabPage> getTabByContextIdAndType(String contextId, int areaType) throws PLException {
+    public DataGrid getTabByContextIdAndType(String contextId, int areaType) throws PLException {
         VciBaseUtil.alertNotNull(contextId,"涓婁笅鏂囦富閿�",areaType,"鍖哄煙绫诲瀷");
         PLTabPage[] plTabPages = platformClientUtil.getUIService().getTabPagesByContextIdAndType(contextId, (short) areaType);
-        return Arrays.asList(plTabPages);
+        DataGrid dataGrid = new DataGrid();
+        dataGrid.setTotal(plTabPages.length);
+        dataGrid.setData(Arrays.asList(plTabPages));
+        return dataGrid;
     }
 
     /**
@@ -391,14 +397,48 @@
 
     /**
      * 鏌ヨ椤甸潰璁捐瀹氫箟
-     * @param plPageContextOId
+     * @param pageContextOId
      * @return
      */
     @Override
-    public List<PLPageDefination> getPLPageDefinations(String plPageContextOId) {
-
-        return null;
+    public DataGrid getPLPageDefinations(String pageContextOId) throws PLException {
+        DataGrid dataGrid = new DataGrid();
+        if(Func.isBlank(pageContextOId)) return dataGrid;
+        PLPageDefination[] plPageDefinations = platformClientUtil.getUIService().getPLPageDefinationsByPageContextOId(pageContextOId);
+        if(Func.isEmpty(plPageDefinations)){
+            return dataGrid;
+        }
+        //DO2VO
+        List<PLDefinationVO> plDefinationVOS = this.pageDefinations2PLDefinationVO(Arrays.asList(plPageDefinations));
+        dataGrid.setTotal(plDefinationVOS.size());
+        Collections.sort(plDefinationVOS, Comparator.comparing(PLDefinationVO::getSeq));
+        //Arrays.sort(plDefinationVOS, pageDefinationComparator);
+        dataGrid.setData(plDefinationVOS);
+        return dataGrid;
     }
+
+    /**
+     * 椤甸潰瀹氫箟鐨凞O2VO瀵硅薄
+     * @param plPageDefinations
+     * @return
+     */
+    private List<PLDefinationVO> pageDefinations2PLDefinationVO(List<PLPageDefination> plPageDefinations){
+        List<PLDefinationVO> plDefinationVOList = new ArrayList<>();
+        plPageDefinations.stream().forEach(item->{
+            try {
+                PLDefinationVO plDefinationVO = new PLDefinationVO();
+                PLDefination plDefination = UITools.getPLDefination(item.plDefination);
+                BeanUtil.copy(plDefination,plDefinationVO);
+                plDefinationVOList.add(plDefinationVO);
+            } catch (Throwable e) {
+                e.printStackTrace();
+                logger.error(e.getMessage());
+                throw new VciBaseException("椤甸潰瀹氫箟DO瀵硅薄杞琕O瀵硅薄鏃跺嚭鐜伴敊璇�,鍘熷洜锛�"+e.getMessage());
+            }
+        });
+        return plDefinationVOList;
+    }
+
 
     /**
      * 娣诲姞椤甸潰瀹氫箟
@@ -1016,6 +1056,7 @@
             }
         });
     }
+
     /**
      * UI瑙掕壊瀵硅薄杞崲
      * @param infos

--
Gitblit v1.9.3