From 36c2449aec5b51e5ed4e5c6841154b746060e09a Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期六, 14 九月 2024 12:22:20 +0800
Subject: [PATCH] UI上下文导入接口上传
---
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/UIManagerController.java | 18 +
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIManagerServiceImpl.java | 618 ++++++++++++++++++++++++++-----------------------------
Source/plt-web/plt-web-parent/plt-poi/src/main/java/com/vci/starter/poi/bo/ReadExcelOption.java | 2
Source/plt-web/plt-web-parent/plt-poi/src/main/java/com/vci/starter/poi/util/ExcelUtil.java | 2
4 files changed, 309 insertions(+), 331 deletions(-)
diff --git a/Source/plt-web/plt-web-parent/plt-poi/src/main/java/com/vci/starter/poi/bo/ReadExcelOption.java b/Source/plt-web/plt-web-parent/plt-poi/src/main/java/com/vci/starter/poi/bo/ReadExcelOption.java
index 16e8da6..6a00a08 100644
--- a/Source/plt-web/plt-web-parent/plt-poi/src/main/java/com/vci/starter/poi/bo/ReadExcelOption.java
+++ b/Source/plt-web/plt-web-parent/plt-poi/src/main/java/com/vci/starter/poi/bo/ReadExcelOption.java
@@ -33,7 +33,7 @@
/**
* 鎵╁睍灞炴�х殑鏄犲皠閰嶇疆锛宲o瀵硅薄涓婂睘鎬ф槸map鐨勫舰寮忔椂浣跨敤锛宬ey涓巈xcelColumn娉ㄨВ鐨剉alue()鐩稿悓锛屽�兼槸瀵瑰簲鐨勬爣棰�
*/
- private Map<String, List<ExcelColumnMap>> extendAttrMap ;
+ private Map<String, List<ExcelColumnMap>> extendAttrMap;
public String getSheetName() {
return sheetName;
diff --git a/Source/plt-web/plt-web-parent/plt-poi/src/main/java/com/vci/starter/poi/util/ExcelUtil.java b/Source/plt-web/plt-web-parent/plt-poi/src/main/java/com/vci/starter/poi/util/ExcelUtil.java
index a5d5e0e..34712cd 100644
--- a/Source/plt-web/plt-web-parent/plt-poi/src/main/java/com/vci/starter/poi/util/ExcelUtil.java
+++ b/Source/plt-web/plt-web-parent/plt-poi/src/main/java/com/vci/starter/poi/util/ExcelUtil.java
@@ -871,7 +871,7 @@
* @return 鏁版嵁鍒楄〃
* @throws VciBaseException 鎵ц鍑洪敊鐨勬椂鍊欎細鎶涘嚭寮傚父
*/
- public static List<SheetDataSet> readDataObjectFromExcel(File file) throws VciBaseException {
+ public static List<SheetDataSet> readDataObjectFromExcel(File file) throws VciBaseException {
return readDataObjectFromExcel(file, SheetDataSet.class);
}
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/UIManagerController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/UIManagerController.java
index 5fbd6bc..0e37319 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/UIManagerController.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/UIManagerController.java
@@ -216,13 +216,17 @@
* @param selectBtm 閫夋嫨瀵煎叆鍒扮殑涓氬姟绫诲瀷
* @return
*/
- @PostMapping("/impUiContextData")
+ @PostMapping("/impUIContextData")
public BaseResult impUIContextData(MultipartFile file, boolean isCovered,String selectBtm){
- String excelFileName = LocalFileUtil.getDefaultTempFolder() + File.separator + LocalFileUtil.getFileNameForIE(file.getOriginalFilename());
- File file1 = new File(excelFileName);
+ File file1 = null;
try {
- file.transferTo(new File(excelFileName));
- if (file != null) {
+ //瑕嗙洊锛屼笉闇�瑕佷紶file
+ if(!isCovered){
+ String excelFileName = LocalFileUtil.getDefaultTempFolder() + File.separator + LocalFileUtil.getFileNameForIE(file.getOriginalFilename());
+ file1 = new File(excelFileName);
+ file.transferTo(new File(excelFileName));
+ }
+ if (file != null || isCovered) {
return uiManagerService.impUIContextData(file1, isCovered,selectBtm);
} else {
return BaseResult.fail(FrameWorkLangCodeConstant.IMPORT_FAIL, new String[]{"鏃犲鍏ョ殑鏂囦欢"});
@@ -230,7 +234,9 @@
}catch (Throwable e) {
throw new VciBaseException(VciBaseUtil.getExceptionMessage(e),new String[0],e);
}finally {
- file1.delete();
+ if(!isCovered){
+ file1.delete();
+ }
}
}
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 d53f1b4..3ef9a19 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
@@ -1,7 +1,5 @@
package com.vci.web.service.impl;
-import com.alibaba.fastjson.JSONObject;
-import com.alibaba.fastjson.JSON;
import com.vci.common.utility.ObjectUtility;
import com.vci.corba.common.PLException;
import com.vci.corba.common.data.UserEntityInfo;
@@ -11,12 +9,9 @@
import com.vci.corba.portal.data.*;
import com.vci.dto.RoleRightDTO;
import com.vci.dto.UIAuthorDTO;
-import com.vci.frameworkcore.compatibility.SmRoleQueryServiceI;
import com.vci.model.PLDefination;
import com.vci.pagemodel.*;
-import com.vci.starter.poi.bo.SheetDataSet;
-import com.vci.starter.poi.bo.WriteExcelData;
-import com.vci.starter.poi.bo.WriteExcelOption;
+import com.vci.starter.poi.bo.*;
import com.vci.starter.poi.util.ExcelUtil;
import com.vci.starter.web.exception.VciBaseException;
import com.vci.starter.web.pagemodel.*;
@@ -25,6 +20,7 @@
import com.vci.starter.web.pagemodel.DataGrid;
import com.vci.starter.web.pagemodel.SessionInfo;
import com.vci.starter.web.util.*;
+import com.vci.web.redis.RedisService;
import com.vci.web.service.OsBtmServiceI;
import com.vci.web.service.UIManagerServiceI;
import com.vci.web.util.*;
@@ -35,23 +31,14 @@
import com.vci.web.util.UITools;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
-import org.apache.poi.hssf.usermodel.HSSFCell;
-import org.apache.poi.hssf.usermodel.HSSFRow;
-import org.apache.poi.hssf.usermodel.HSSFSheet;
-import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
-import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
-import javax.swing.*;
import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
import java.util.*;
-import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
import java.util.regex.Pattern;
@@ -71,10 +58,11 @@
private PlatformClientUtil platformClientUtil;
/**
- * 瑙掕壊
+ * 缂撳瓨宸ュ叿
*/
@Resource
- private SmRoleQueryServiceI smRoleQueryServiceI;
+ private RedisService redisService;
+
/***
* 鏄惁鏄鐞嗗憳
*/
@@ -91,6 +79,11 @@
* 鏃ュ織
*/
private Logger logger = LoggerFactory.getLogger(getClass());
+
+ /**
+ * 瀵煎叆鏁版嵁鐨剆heet闆嗗悎
+ */
+ private final String IMPORTUIKEY = "importUIKey:";
/**
* 鎺掑簭姣旇緝鍣�
@@ -441,14 +434,17 @@
//鍖哄煙瀹氫箟
tpDataList.add(new WriteExcelData(tpRow.get(),0, tabPage.plOId));
tpDataList.add(new WriteExcelData(tpRow.get(),1, tabPage.plSeq));
- tpDataList.add(new WriteExcelData(tpRow.get(),2, tabPage.plLabel));
- tpDataList.add(new WriteExcelData(tpRow.get(),3, tabPage.plName));
- tpDataList.add(new WriteExcelData(tpRow.get(),4, tabPage.plContextOId));
- tpDataList.add(new WriteExcelData(tpRow.get(),5, tabPage.plIsOpen));
- tpDataList.add(new WriteExcelData(tpRow.get(),6, tabPage.plOpenExpression));
- tpDataList.add(new WriteExcelData(tpRow.get(),7, tabPage.plUIParser));
- tpDataList.add(new WriteExcelData(tpRow.get(),8, tabPage.plExtAttr));
- tpDataList.add(new WriteExcelData(tpRow.get(),9, tabPage.plDesc));
+ tpDataList.add(new WriteExcelData(tpRow.get(),2, tabPage.plCode));
+ tpDataList.add(new WriteExcelData(tpRow.get(),3, tabPage.plLabel));
+ tpDataList.add(new WriteExcelData(tpRow.get(),4, tabPage.plName));
+ tpDataList.add(new WriteExcelData(tpRow.get(),5, tabPage.plContextOId));
+ tpDataList.add(new WriteExcelData(tpRow.get(),6, tabPage.plAreaType));
+ tpDataList.add(new WriteExcelData(tpRow.get(),7, tabPage.plIsOpen));
+ tpDataList.add(new WriteExcelData(tpRow.get(),8, tabPage.plOpenExpression));
+ tpDataList.add(new WriteExcelData(tpRow.get(),9, tabPage.plUIParser));
+ tpDataList.add(new WriteExcelData(tpRow.get(),10, tabPage.plExtAttr));
+ tpDataList.add(new WriteExcelData(tpRow.get(),11, tabPage.plDesc));
+ tpDataList.add(new WriteExcelData(tpRow.get(),12, tabPage.plLicensOrs));
tpRow.getAndIncrement();
try {
PLPageDefination[] plPageDefinations = platformClientUtil.getUIService().getPLPageDefinationsByPageContextOId(tabPage.plOId);
@@ -525,112 +521,124 @@
*/
@Override
public BaseResult impUIContextData(File file,boolean isCovered,String selectBtm) {
- /*VciBaseUtil.alertNotNull(file,"excel鏂囦欢");
- if(!file.exists()){
- throw new VciBaseException("瀵煎叆鐨別xcel鏂囦欢涓嶅瓨鍦�,{0}",new String[]{file.getPath()});
+ if(!isCovered){
+ VciBaseUtil.alertNotNull(file,"excel鏂囦欢");
+ if(!file.exists()){
+ throw new VciBaseException("瀵煎叆鐨別xcel鏂囦欢涓嶅瓨鍦�,{0}",new String[]{file.getPath()});
+ }
}
- //璇诲彇excel琛�
- List<SheetDataSet> sheetDataSets = ExcelUtil.readDataObjectFromExcel(file);
try {
+ List<SheetDataSet> sheetDataSets = null;
+ SessionInfo sessionInfo = WebThreadLocalUtil.getCurrentUserSessionInfoInThread();
+ //鏄鐩栨搷浣滐紝鎵�浠ョ洿鎺ヨ鍙�
+ if(isCovered){
+ sheetDataSets = redisService.getCacheList(IMPORTUIKEY + sessionInfo.getUserId());
+ if(Func.isEmpty(sheetDataSets)){
+ throw new VciBaseException("浠庣紦瀛樹腑鏈幏鍙栧埌瀵煎叆鐨勬暟鎹紝璇峰埛鏂板悗閲嶈瘯锛侊紒");
+ }
+ }else{
+ //璇诲彇excel琛�
+ ReadExcelOption readExcelOption = new ReadExcelOption();
+ readExcelOption.setReadAllSheet(true); //璇诲彇鍏ㄩ儴鐨剆heet
+ sheetDataSets = ExcelUtil.readDataObjectFromExcel(file,SheetDataSet.class,readExcelOption);
+ }
+
PLUILayout[] plpagelayoutdefinations = null;
- try {
- SheetDataSet plpagelayoutdefnationsheet = sheetDataSets.get(0);
- SheetDataSet pltabpagesheet = sheetDataSets.get(1);
- SheetDataSet plpagedefinationsheet = sheetDataSets.get(2);
- SheetDataSet pltabbuttonsheet = sheetDataSets.get(3);
- SheetDataSet plcommondparamsheet = sheetDataSets.get(4);
- *//*HSSFSheet plpagelayoutdefnationsheet = readworkbook.getSheet("PlpageLayoutDefnation");
- HSSFSheet pltabpagesheet = readworkbook.getSheet("Pltabpage");
- HSSFSheet plpagedefinationsheet = readworkbook.getSheet("Plpagedefination");
- HSSFSheet pltabbuttonsheet = readworkbook.getSheet("Pltabbutton");
- HSSFSheet plcommondparamsheet = readworkbook.getSheet("PlcommondParam");*//*
+ SheetDataSet plpagelayoutdefnationsheet = sheetDataSets.get(0);
+ SheetDataSet pltabpagesheet = sheetDataSets.get(1);
+ SheetDataSet plpagedefinationsheet = sheetDataSets.get(2);
+ SheetDataSet pltabbuttonsheet = sheetDataSets.get(3);
+ SheetDataSet plcommondparamsheet = sheetDataSets.get(4);
- SessionInfo sessionInfo = WebThreadLocalUtil.getCurrentUserSessionInfoInThread();
+ Map<PLUILayout,List<PLTabPage>> pdMap = new HashMap<>();
+ Map<PLTabPage,List<PLPageDefination>> tdMap = new HashMap<>();
+ Map<PLPageDefination,List<PLTabButton>> dbMap = new HashMap<>();
+ Map<PLTabButton,List<PLCommandParameter>> bcMap = new HashMap<>();
- Map<PLUILayout,List<PLTabPage>> pdMap = new HashMap<>();
- Map<PLTabPage,List<PLPageDefination>> tdMap = new HashMap<>();
- Map<PLPageDefination,List<PLTabButton>> dbMap = new HashMap<>();
- Map<PLTabButton,List<PLCommandParameter>> bcMap = new HashMap<>();
+ List<PLUILayout> plpagelayoutdefinationList = new ArrayList<>();
+ List<PLTabPage> pltabpagelist = new ArrayList<>();
+ List<PLPageDefination> plpagedefinationlist = new ArrayList<>();
+ List<PLTabButton> pltabbuttonlist = new ArrayList<>();
+ List<PLCommandParameter> plcommandparameterlist = new ArrayList<>();
- List<PLUILayout> plpagelayoutdefinationList = new ArrayList<PLUILayout>();
- List<PLTabPage> pltabpagelist = new ArrayList<PLTabPage>();
- List<PLPageDefination> plpagedefinationlist = new ArrayList<PLPageDefination>();
- List<PLTabButton> pltabbuttonlist = new ArrayList<PLTabButton>();
- List<PLCommandParameter> plcommandparameterlist = new ArrayList<PLCommandParameter>();
+ /*StringBuffer checkplpagelayoutdefination = new StringBuffer();
+ StringBuffer checkplpagelayoutdefinationPlcode = new StringBuffer();*/
+ StringBuffer plActionIDNulls = new StringBuffer();
- StringBuffer checkplpagelayoutdefination = new StringBuffer();
- StringBuffer checkplpagelayoutdefinationPlcode = new StringBuffer();
- StringBuffer plActionIDNulls = new StringBuffer();
+ //add by caill start 鍒濆鍖栨爣璁�
+ int count=0;
+ int preCount=0;
+ String preOID="";
+ String doublePreOID="";
+ String plpageLayoutDefinationId="";
+ String plPageContextOId="";
+ String plCommandOId="";
+ String plTableOId="";
- //add by caill start 鍒濆鍖栨爣璁�
- int count=0;
- int preCount=0;
- String preOID="";
- String doublePreOID="";
+ //add by caill end
+ PLAction[] allPLAction = platformClientUtil.getUIService().getAllPLAction();
+ Map<String,String> relation = null;
+ List<SheetRowData> rowData = plpagelayoutdefnationsheet.getRowData();
+ for(int i=0; i<rowData.size(); i++){
+ pltabpagelist = new ArrayList<PLTabPage>();
+ PLUILayout p = new PLUILayout();
+ //HSSFRow readrow = plpagelayoutdefnationsheet.getRowData();
+ Map<Integer, String> dataMap = rowData.get(i).getData();
+ if(Func.isEmpty(dataMap)){
+ break;
+ }
+ //鏍规嵁涓氬姟绫诲瀷鏌ヨui涓婁笅鏂�
+ plpagelayoutdefinations = platformClientUtil.getUIService().getPLUILayoutsByRelatedType(selectBtm);
+
+ p.plOId = ObjectUtility.getNewObjectID36();
+ p.plCode = dataMap.get(1);
+ p.plName = dataMap.get(2);
+ //add by caill start
+ //閬嶅巻UI鍚嶇О
+ for(PLUILayout pd : plpagelayoutdefinations){
+ if(pd.plName.equals(p.plName) && !isCovered){
+ //濡傛灉鐢ㄦ埛閫夋嫨瑕嗙洊锛岀浜屾璋冪敤灏变笉浼氫紶瀵煎叆鏂囦欢锛屾墍浠ヨ繖閲屽瓨鍏ョ紦瀛�
+ redisService.setCacheList(IMPORTUIKEY+sessionInfo.getUserId(),sheetDataSets);
+ //璁剧疆杩囨湡鏃堕棿涓�5鍒嗛挓锛屽洜涓轰竴鑸儏鍐典笅涓嶄細璇存槸绛夊お涔�
+ redisService.expire(IMPORTUIKEY+sessionInfo.getUserId(),5, TimeUnit.MINUTES);
+ throw new VciBaseException(pd.plName+"鍚嶇О宸茬粡瀛樺湪,鏄惁瑕嗙洊?");
+ }
+ //鏍规嵁UI涓婁笅鏂囧仛鍒ゆ柇
+ if(pd.plCode.equals(p.plCode)){
+ count=1;
+ preOID=pd.plOId; //濡傛灉UI涓婁笅鏂囩浉鍚岋紝灏辨妸绯荤粺涓殑id璧嬪�肩粰鏂板鍏ョ殑id
+ p.plOId=pd.plOId;
+ }
+ }
//add by caill end
- PLAction[] allPLAction = platformClientUtil.getUIService().getAllPLAction();
- Map<String,String> relation = null;
- for(int i=0;i<=plpagelayoutdefnationsheet.getLastRowNum();i++){
- pltabpagelist = new ArrayList<PLTabPage>();
- PLUILayout p = new PLUILayout();
- HSSFRow readrow = plpagelayoutdefnationsheet.getRow(i);
- if(readrow==null){
- break;
- }
+ plpageLayoutDefinationId = dataMap.get(0);
+ String name = dataMap.get(3);
+ p.plRelatedType = dataMap.get(3);
+ p.plIsShowNavigator = Short.parseShort(dataMap.get(4));
+ p.plIsShowTab = Short.parseShort(dataMap.get(5));
+ p.plIsShowForm = Short.parseShort(dataMap.get(6));
+ //閫夋嫨鐨勫拰瀵煎叆鐨勪笟鍔$被鍨嬭妭鐐逛笉涓�鑷�
+ if(!selectBtm.equals(name)){
+ throw new VciBaseException("璇烽�夋嫨瑕佸鍏ョ殑绫诲瀷鑺傜偣鍚嶇О锛�");
+ }
- plpagelayoutdefinations = platformClientUtil.getUIService().getPLUILayoutsByRelatedType(btmName);
+ plpagelayoutdefinationList.add(p);
- p.plOId = ObjectUtility.getNewObjectID36();
- HSSFCell readcell = readrow.getCell(0);
- p.plName = readcell.getStringCellValue();
- readcell = readrow.getCell(1);
- p.plCode = readcell.getStringCellValue();
- //add by caill start
- //閬嶅巻UI鍚嶇О
- for(PLUILayout pd : plpagelayoutdefinations){
- if(pd.plName.equals(p.plName) && isCovered){
- throw new VciBaseException(pd.plName+"鍚嶇О宸茬粡瀛樺湪,鏄惁瑕嗙洊?");
- }
- //鏍规嵁UI涓婁笅鏂囧仛鍒ゆ柇
- if(pd.plCode.equals(p.plCode)){
- count=1;
- preOID=pd.plOId; //濡傛灉UI涓婁笅鏂囩浉鍚岋紝灏辨妸绯荤粺涓殑id璧嬪�肩粰鏂板鍏ョ殑id
- p.plOId=pd.plOId;
- }
- }
- //add by caill end
- readcell = readrow.getCell(2);
- plpageLayoutDefinationId = readcell.getStringCellValue();
- readcell = readrow.getCell(3);
- String name = readcell.getStringCellValue();
- readcell = readrow.getCell(4);
- p.plRelatedType = readcell.getStringCellValue();
- readcell = readrow.getCell(5);
- p.plIsShowNavigator = (short) readcell.getNumericCellValue();
- readcell = readrow.getCell(6);
- p.plIsShowTab = (short) readcell.getNumericCellValue();
- readcell = readrow.getCell(7);
- p.plIsShowForm = (short) readcell.getNumericCellValue();
- //閫夋嫨鐨勫拰瀵煎叆鐨勪笟鍔$被鍨嬭妭鐐逛笉涓�鑷�
- if(!selectBtm.equals(name)){
- throw new VciBaseException("璇烽�夋嫨瑕佸鍏ョ殑绫诲瀷鑺傜偣鍚嶇О锛�");
- }
-
- plpagelayoutdefinationList.add(p);
- for(int j=0;j<=pltabpagesheet.getLastRowNum();j++){
+ //鍖哄煙瀹氫箟sheet澶勭悊
+ List<SheetRowData> tabPageRowData = pltabpagesheet.getRowData();
+ if(Func.isNotEmpty(tabPageRowData)){
+ for(int j=0; j<tabPageRowData.size(); j++){
plpagedefinationlist = new ArrayList<PLPageDefination>();
PLTabPage pt = new PLTabPage();
- HSSFRow readrow1 = pltabpagesheet.getRow(j);
- if(readrow1==null){
+ Map<Integer, String> tabPageDataMap = tabPageRowData.get(j).getData();
+ if(Func.isEmpty(tabPageDataMap)){
break;
}
pt.plOId = ObjectUtility.getNewObjectID36();
- HSSFCell readcell1 = readrow1.getCell(0);
- pt.plName = readcell1.getStringCellValue();
- readcell1 = readrow1.getCell(1);
- pt.plCode = readcell1.getStringCellValue();
+ pt.plCode = tabPageDataMap.get(2);
+ pt.plName = tabPageDataMap.get(4);
//add by caill start
if(count==1) {
PLTabPage[] PLTabPages = platformClientUtil.getUIService().getPLTabPagesByPageDefinationOId(preOID);
@@ -644,235 +652,198 @@
}
}
//add by caill end
- readcell1 = readrow1.getCell(2);
- pt.plSeq = (short) readcell1.getNumericCellValue();
- readcell1 = readrow1.getCell(3);
- pt.plContextOId = readcell1.getStringCellValue();
- readcell1 = readrow1.getCell(4);
- pt.plDesc = readcell1.getStringCellValue();
- readcell1 = readrow1.getCell(5);
- pt.plIsOpen = (short) readcell1.getNumericCellValue();
- readcell1 = readrow1.getCell(6);
- pt.plAreaType = (short) readcell1.getNumericCellValue();
- readcell1 = readrow1.getCell(7);
- pt.plOpenExpression = readcell1.getStringCellValue();
- readcell1 = readrow1.getCell(8);
- pt.plLicensOrs = readcell1.getStringCellValue();
- readcell1 = readrow1.getCell(9);
- pt.plLabel = readcell1.getStringCellValue();
- readcell1 = readrow1.getCell(10);
- String plPageContextOId = readcell1.getStringCellValue();
+ pt.plSeq = Short.parseShort(tabPageDataMap.get(1));
+ pt.plLabel = tabPageDataMap.get(3);
+ pt.plContextOId = tabPageDataMap.get(5);
+ pt.plAreaType = Short.parseShort(tabPageDataMap.get(6));
+ pt.plIsOpen = Short.parseShort(tabPageDataMap.get(7));
+ pt.plOpenExpression = tabPageDataMap.get(8);
+ pt.plUIParser = tabPageDataMap.get(9);
+ pt.plExtAttr = tabPageDataMap.get(10);
+ pt.plDesc = tabPageDataMap.get(11);
+ pt.plLicensOrs = tabPageDataMap.get(12);
+ plPageContextOId = tabPageDataMap.get(5);
if(pt.plContextOId.equals(plpageLayoutDefinationId)){
pt.plContextOId = p.plOId;
pltabpagelist.add(pt);
- for(int k=0;k<=plpagedefinationsheet.getLastRowNum();k++){
- pltabbuttonlist = new ArrayList<PLTabButton>();
- PLPageDefination plpagedefination = new PLPageDefination();
- HSSFRow readrow2 = plpagedefinationsheet.getRow(k);
- if(readrow2==null){
- break;
- }
- plpagedefination.plOId = ObjectUtility.getNewObjectID36();
- HSSFCell readcell2 = readrow2.getCell(0);
- plpagedefination.name = readcell2.getStringCellValue();
- //add by caill start
- //鏈�鍚庝竴绾х殑鍒ゆ柇
- if(preCount==1) {
- PLPageDefination[] PLPageDefinations = platformClientUtil.getUIService().getPLPageDefinationsByPageContextOId(doublePreOID);
- for(PLPageDefination plp : PLPageDefinations) {
- if(plp.name.equals(plpagedefination.name)) {
- plpagedefination.plOId=plp.plOId;
+ //椤甸潰璁捐澶勭悊
+ List<SheetRowData> pagedefinationRowData = plpagedefinationsheet.getRowData();
+ if(Func.isNotEmpty(pagedefinationRowData)){
+ for(int k=0;k<pagedefinationRowData.size();k++){
+ pltabbuttonlist = new ArrayList<>();
+ PLPageDefination plpagedefination = new PLPageDefination();
+ Map<Integer, String> pagedefinationDataMap = pagedefinationRowData.get(k).getData();
+
+ if(Func.isEmpty(pagedefinationDataMap)){
+ break;
+ }
+ plpagedefination.plOId = ObjectUtility.getNewObjectID36();
+ plpagedefination.name = pagedefinationDataMap.get(3);
+ //add by caill start
+ //鏈�鍚庝竴绾х殑鍒ゆ柇
+ if(preCount==1) {
+ PLPageDefination[] PLPageDefinations = platformClientUtil.getUIService().getPLPageDefinationsByPageContextOId(doublePreOID);
+ for(PLPageDefination plp : PLPageDefinations) {
+ if(plp.name.equals(plpagedefination.name)) {
+ plpagedefination.plOId=plp.plOId;
+
+ }
}
-
}
- }
- //add by caill end
- readcell2 = readrow2.getCell(1);
- plpagedefination.plDefination = readcell2.getStringCellValue();
- readcell2 = readrow2.getCell(2);
- plpagedefination.seq = (short) readcell2.getNumericCellValue();
- readcell2 = readrow2.getCell(3);
- plpagedefination.plTabPageOId = readcell2.getStringCellValue();
- readcell2 = readrow2.getCell(4);
- plpagedefination.desc = readcell2.getStringCellValue();
- readcell2 = readrow2.getCell(5);
- plpagedefination.plType = (short) readcell2.getNumericCellValue();
- readcell2 = readrow2.getCell(6);
- plTableOId = readcell2.getStringCellValue();
- if(plpagedefination.plTabPageOId.equals(plPageContextOId)){
- plpagedefination.plTabPageOId = pt.plOId;
- plpagedefinationlist.add(plpagedefination);
- //淇濆瓨鏂版棫oid鐨勫叧绯伙紝鍦ㄧ‘瀹氬眰绾у叧绯绘椂浣跨敤
- relation = new HashMap<String,String>();
- for(int a=0;a<=pltabbuttonsheet.getLastRowNum();a++){
- HSSFRow readrow3 = pltabbuttonsheet.getRow(a);
- if(readrow3!=null){
- HSSFCell readcell3 = readrow3.getCell(7);
- plCommandOId = readcell3.getStringCellValue();
- String newOId = ObjectUtility.getNewObjectID36();
- relation.put(plCommandOId, newOId);
- }
- }
- for(int a=0;a<=pltabbuttonsheet.getLastRowNum();a++){
- plcommandparameterlist = new ArrayList<PLCommandParameter>();
- PLTabButton plTabButton = new PLTabButton();
- HSSFRow readrow3 = pltabbuttonsheet.getRow(a);
- if(readrow3==null){
- break;
- }
- plTabButton.plOId = ObjectUtility.getNewObjectID36();
- HSSFCell readcell3 = readrow3.getCell(0);
- plTabButton.plLabel = readcell3.getStringCellValue();
- readcell3 = readrow3.getCell(1);
- plTabButton.plAreaType = readcell3.getStringCellValue();
- readcell3 = readrow3.getCell(2);
- plTabButton.plTableOId = readcell3.getStringCellValue();
- readcell3 = readrow3.getCell(3);
- plTabButton.plSeq = (short) readcell3.getNumericCellValue();
- String plActionId = "";
- //PLAction[] allPLAction = Tool.getService().getAllPLAction();
- for(PLAction action : allPLAction){
- if((readrow3.getCell(4).getStringCellValue()!=null&&!"".equals(readrow3.getCell(4).getStringCellValue())
- )&&(readrow3.getCell(4).getStringCellValue().trim().equals(action.plCode.trim()))
- ){
- plActionId = action.plOId;
- break;
+ //add by caill end
+ plpagedefination.plDefination = pagedefinationDataMap.get(6);
+ plpagedefination.seq = Short.parseShort(pagedefinationDataMap.get(5));
+ plpagedefination.plTabPageOId = pagedefinationDataMap.get(1);
+ plpagedefination.desc = pagedefinationDataMap.get(4);
+ plpagedefination.plType = Short.parseShort(pagedefinationDataMap.get(2));
+ plTableOId = pagedefinationDataMap.get(1);
+ if(plpagedefination.plTabPageOId.equals(plPageContextOId)){
+ plpagedefination.plTabPageOId = pt.plOId;
+ plpagedefinationlist.add(plpagedefination);
+ //淇濆瓨鏂版棫oid鐨勫叧绯伙紝鍦ㄧ‘瀹氬眰绾у叧绯绘椂浣跨敤
+ relation = new HashMap<String,String>();
+ List<SheetRowData> tabbuttonRowData = pltabbuttonsheet.getRowData();
+ if(Func.isNotEmpty(tabbuttonRowData)){
+ for(int a=0;a<tabbuttonRowData.size();a++){
+ Map<Integer, String> tabbuttonDataMap = tabbuttonRowData.get(a).getData();
+ if(Func.isNotEmpty(tabbuttonDataMap)){
+ plCommandOId = tabbuttonDataMap.get(1);
+ String newOId = ObjectUtility.getNewObjectID36();
+ relation.put(plCommandOId, newOId);
+ }
}
- }
- if(plActionId==null||"".equals(plActionId)){
- if(!plActionIDNulls.toString().contains(readrow3.getCell(4).getStringCellValue())){
- plActionIDNulls.append("\n\tAction缂栧彿:"+readrow3.getCell(4).getStringCellValue());
- }
- }
- plTabButton.plActionOId = plActionId;
- readcell3 = readrow3.getCell(5);
- plTabButton.plAreaType = readcell3.getStringCellValue();
- readcell3 = readrow3.getCell(6);
- plTabButton.plDesc = readcell3.getStringCellValue();
- readcell3 = readrow3.getCell(8);
- String parentOid = readcell3.getStringCellValue();//鐖秓id
- readcell3 = readrow3.getCell(7);
- plCommandOId = readcell3.getStringCellValue();
- readcell3 = readrow3.getCell(9);
- if(readcell3 != null) {
- plTabButton.displayMode = readcell3.getStringCellValue();
- }
- readcell3 = readrow3.getCell(10);
- if(readcell3 != null) {
- plTabButton.iconPath = readcell3.getStringCellValue();
- }
- readcell3 = readrow3.getCell(11);
- if(readcell3 != null) {
- plTabButton.authorization = readcell3.getStringCellValue();
- }
- readcell3 = readrow3.getCell(12);
- if(readcell3 != null) {
- plTabButton.show = readcell3.getStringCellValue();
- }
- //璧嬩簣淇濆瓨濂界殑鍊硷紝鏉ヤ繚璇佸眰绾у叧绯讳笉浼氫涪澶�
- plTabButton.plOId = relation.get(plCommandOId);
- if(parentOid != null && parentOid.length() > 0) {
- plTabButton.plParentOid =
- relation.get(parentOid) == null ? "" : relation.get(parentOid);
- }
- if(plTabButton.plTableOId.equals(plTableOId)){
- plTabButton.plTableOId = plpagedefination.plOId;
- pltabbuttonlist.add(plTabButton);
- for(int b=0;b<=plcommondparamsheet.getLastRowNum();b++){
- PLCommandParameter plCommandParameter = new PLCommandParameter();
- HSSFRow readrow4 = plcommondparamsheet.getRow(b);
- if(readrow4==null){
+ for(int a=0;a<tabbuttonRowData.size();a++){
+ plcommandparameterlist = new ArrayList<PLCommandParameter>();
+ PLTabButton plTabButton = new PLTabButton();
+ Map<Integer, String> tabbuttonDataMap = tabbuttonRowData.get(a).getData();
+ if(Func.isEmpty(tabbuttonDataMap)){
break;
}
- plCommandParameter.plOId = ObjectUtility.getNewObjectID36();
- HSSFCell readcell4 = readrow4.getCell(0);
- plCommandParameter.plCommandOId = readcell4.getStringCellValue();
- readcell4 = readrow4.getCell(1);
- plCommandParameter.plKey = readcell4.getStringCellValue();
- readcell4 = readrow4.getCell(2);
- plCommandParameter.plValue = readcell4.getStringCellValue();
- if(plCommandParameter.plCommandOId.equals(plCommandOId)){
- plCommandParameter.plCommandOId = plTabButton.plOId;
- plcommandparameterlist.add(plCommandParameter);
+ plTabButton.plOId = ObjectUtility.getNewObjectID36();
+ plTabButton.plLabel = tabbuttonDataMap.get(4);
+ plTabButton.plAreaType = tabbuttonDataMap.get(5);
+ plTabButton.plTableOId = tabbuttonDataMap.get(1);
+ plTabButton.plSeq = Short.parseShort(tabbuttonDataMap.get(7));
+ String plActionId = "";
+ //PLAction[] allPLAction = Tool.getService().getAllPLAction();
+ for(PLAction action : allPLAction){
+ if((tabbuttonDataMap.get(3)!=null&&!"".equals(tabbuttonDataMap.get(3))
+ )&&(tabbuttonDataMap.get(3).trim().equals(action.plCode.trim()))
+ ){
+ plActionId = action.plOId;
+ break;
+ }
+ }
+ if(plActionId==null||"".equals(plActionId)){
+ if(!plActionIDNulls.toString().contains(tabbuttonDataMap.get(3))){
+ plActionIDNulls.append("\n\tAction缂栧彿:"+tabbuttonDataMap.get(3));
+ }
+ }
+ plTabButton.plActionOId = plActionId;
+ plTabButton.plAreaType = tabbuttonDataMap.get(5);
+ plTabButton.plDesc = tabbuttonDataMap.get(6);
+ String parentOid = tabbuttonDataMap.get(8);//鐖秓id
+ plCommandOId = tabbuttonDataMap.get(1);
+ plTabButton.displayMode = tabbuttonDataMap.get(9);
+ plTabButton.iconPath = tabbuttonDataMap.get(10);
+ plTabButton.authorization = tabbuttonDataMap.get(11);
+ plTabButton.show = tabbuttonDataMap.get(12);
+
+ //璧嬩簣淇濆瓨濂界殑鍊硷紝鏉ヤ繚璇佸眰绾у叧绯讳笉浼氫涪澶�
+ plTabButton.plOId = relation.get(plCommandOId);
+ if(parentOid != null && parentOid.length() > 0) {
+ plTabButton.plParentOid =
+ relation.get(parentOid) == null ? "" : relation.get(parentOid);
+ }
+ if(plTabButton.plTableOId.equals(plTableOId)){
+ plTabButton.plTableOId = plpagedefination.plOId;
+ pltabbuttonlist.add(plTabButton);
+ List<SheetRowData> commondparamsRowData = plcommondparamsheet.getRowData();
+ if(Func.isNotEmpty(commondparamsRowData)){
+ for(int b=0;b<commondparamsRowData.size();b++){
+ PLCommandParameter plCommandParameter = new PLCommandParameter();
+ Map<Integer, String> commandParameterDataMap = commondparamsRowData.get(b).getData();
+ if(Func.isEmpty(commandParameterDataMap)){
+ break;
+ }
+ plCommandParameter.plOId = ObjectUtility.getNewObjectID36();
+ plCommandParameter.plCommandOId = commandParameterDataMap.get(1);
+ plCommandParameter.plKey = commandParameterDataMap.get(2);
+ plCommandParameter.plValue = commandParameterDataMap.get(3);
+ if(plCommandParameter.plCommandOId.equals(plCommandOId)){
+ plCommandParameter.plCommandOId = plTabButton.plOId;
+ plcommandparameterlist.add(plCommandParameter);
+ }
+ }
+ bcMap.put(plTabButton, plcommandparameterlist);
+ }
}
}
- bcMap.put(plTabButton, plcommandparameterlist);
+ dbMap.put(plpagedefination, pltabbuttonlist);
}
}
- dbMap.put(plpagedefination, pltabbuttonlist);
}
+ tdMap.put(pt, plpagedefinationlist);
}
- tdMap.put(pt, plpagedefinationlist);
}
}
pdMap.put(p, pltabpagelist);
}
-
- if(plActionIDNulls.length()>0){
- VCIOptionPane.showMessage(PLTApplication.frame, plActionIDNulls.toString()+"涓嶅瓨鍦紒");
- return false;
- }
-
- //鍒犻櫎鍘熸湁button鏁版嵁
- if(tdMap.size() > 0) {
- for(List<PLPageDefination> list : tdMap.values()) {
- for(PLPageDefination ppd : list) {
- if(ppd.plOId != null && ppd.plOId.length() > 0) {
- PLTabButton[] buttons = platformClientUtil.getUIService().getPLTabButtonsByTableOId(ppd.plOId);
- if(buttons != null && buttons.length > 0) {
- for(PLTabButton ptb : buttons) {
- platformClientUtil.getUIService().deletePLTabButtonByID(ptb.plOId);
- }
- }
- }
- }
- }
- }
-
- for(PLUILayout plPageLayoutDefination : plpagelayoutdefinationList){
- List<PLTabPage> pltabpagelists = pdMap.get(plPageLayoutDefination);
- for(PLTabPage pltabpage:pltabpagelists){
- List<PLPageDefination> plpagedefinationlists = tdMap.get(pltabpage);
- for(PLPageDefination plpagedefination : plpagedefinationlists){
- List<PLTabButton> pltabbuttons = dbMap.get(plpagedefination);
- for(PLTabButton pltabbutton : pltabbuttons){
- List<PLCommandParameter> plcommandParams = bcMap.get(pltabbutton);
- for(PLCommandParameter plcommandparameter : plcommandParams){
- plcommandparameter.plCreateUser = sessionInfo.getUserId();
- plcommandparameter.plModifyUser = sessionInfo.getUserId();
- platformClientUtil.getUIService().savePLCommandParameter(plcommandparameter);
- }
- pltabbutton.plCreateUser = sessionInfo.getUserId();
- pltabbutton.plModifyUser = sessionInfo.getUserId();
- platformClientUtil.getUIService().savePLTabButton(pltabbutton);
- }
- platformClientUtil.getUIService().savePLPageDefination(plpagedefination);
- }
- pltabpage.plCreateUser = sessionInfo.getUserId();
- pltabpage.plModifyUser = sessionInfo.getUserId();
- platformClientUtil.getUIService().savePLTabPage(pltabpage);
- }
- plPageLayoutDefination.plCreateUser = sessionInfo.getUserId();
- plPageLayoutDefination.plModifyUser = sessionInfo.getUserId();
- platformClientUtil.getUIService().savePLUILayout(plPageLayoutDefination);
- }
- return true;
- } catch (IOException e) {
- e.printStackTrace();
- return false;
- } catch (PLException e) {
- e.printStackTrace();
- return false;
}
- } catch (FileNotFoundException e) {
+
+ if(plActionIDNulls.length()>0){
+ throw new VciBaseException(plActionIDNulls.toString()+"涓嶅瓨鍦紒");
+ }
+
+ //鍒犻櫎鍘熸湁button鏁版嵁
+ if(tdMap.size() > 0) {
+ for(List<PLPageDefination> list : tdMap.values()) {
+ for(PLPageDefination ppd : list) {
+ if(ppd.plOId != null && ppd.plOId.length() > 0) {
+ PLTabButton[] buttons = platformClientUtil.getUIService().getPLTabButtonsByTableOId(ppd.plOId);
+ if(buttons != null && buttons.length > 0) {
+ for(PLTabButton ptb : buttons) {
+ platformClientUtil.getUIService().deletePLTabButtonByID(ptb.plOId);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ for(PLUILayout plPageLayoutDefination : plpagelayoutdefinationList){
+ List<PLTabPage> pltabpagelists = pdMap.get(plPageLayoutDefination);
+ for(PLTabPage pltabpage:pltabpagelists){
+ List<PLPageDefination> plpagedefinationlists = tdMap.get(pltabpage);
+ for(PLPageDefination plpagedefination : plpagedefinationlists){
+ List<PLTabButton> pltabbuttons = dbMap.get(plpagedefination);
+ for(PLTabButton pltabbutton : pltabbuttons){
+ List<PLCommandParameter> plcommandParams = bcMap.get(pltabbutton);
+ for(PLCommandParameter plcommandparameter : plcommandParams){
+ plcommandparameter.plCreateUser = sessionInfo.getUserId();
+ plcommandparameter.plModifyUser = sessionInfo.getUserId();
+ platformClientUtil.getUIService().savePLCommandParameter(plcommandparameter);
+ }
+ pltabbutton.plCreateUser = sessionInfo.getUserId();
+ pltabbutton.plModifyUser = sessionInfo.getUserId();
+ platformClientUtil.getUIService().savePLTabButton(pltabbutton);
+ }
+ platformClientUtil.getUIService().savePLPageDefination(plpagedefination);
+ }
+ pltabpage.plCreateUser = sessionInfo.getUserId();
+ pltabpage.plModifyUser = sessionInfo.getUserId();
+ platformClientUtil.getUIService().savePLTabPage(pltabpage);
+ }
+ plPageLayoutDefination.plCreateUser = sessionInfo.getUserId();
+ plPageLayoutDefination.plModifyUser = sessionInfo.getUserId();
+ platformClientUtil.getUIService().savePLUILayout(plPageLayoutDefination);
+ }
+ return BaseResult.success("UI涓婁笅鏂囧鍏ユ垚鍔燂紒");
+ } catch (PLException e) {
e.printStackTrace();
- return false;
+ return BaseResult.success("UI涓婁笅鏂囧鍏ュけ璐�,鍘熷洜锛�"+VciBaseUtil.getExceptionMessage(e));
}
-
-*/
-
- return null;
}
/**
@@ -2132,7 +2103,6 @@
});
}
-
/**
* UI瑙掕壊瀵硅薄杞崲
* @param vos
@@ -2149,7 +2119,6 @@
}
-
/**
* UI瑙掕壊瀵硅薄杞崲
* @param infos
@@ -2164,6 +2133,7 @@
return roleRightVOS;
}
+
/**
* UI瑙掕壊瀵硅薄杞崲
* @param dtos
@@ -2183,6 +2153,7 @@
return roleRightInfoList;
}
+
/**
* UI瑙掕壊瀵硅薄杞崲
* @param info
@@ -2202,6 +2173,7 @@
vo.setModifyUser(info.modifyUser);
return vo;
}
+
/**
* UI瑙掕壊瀵硅薄杞崲
* @param vo
--
Gitblit v1.9.3