From 0d464e9757c7d590794a8d98911e2afe356db5ea Mon Sep 17 00:00:00 2001
From: ludc <ludc@vci-tech.com>
Date: 星期五, 03 一月 2025 10:47:16 +0800
Subject: [PATCH] 菜单和功能模块管理菜单节点不返回code别名
---
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsActionServiceImpl.java | 635 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 621 insertions(+), 14 deletions(-)
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsActionServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsActionServiceImpl.java
index 0ce7bef..0a8fec3 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsActionServiceImpl.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsActionServiceImpl.java
@@ -1,27 +1,34 @@
package com.vci.web.service.impl;
+
import cn.hutool.core.io.FileUtil;
+import com.vci.constant.FrameWorkLangCodeConstant;
import com.vci.corba.common.PLException;
-import com.vci.corba.omd.ltm.LinkType;
-import com.vci.corba.omd.qtm.QTInfo;
import com.vci.corba.portal.data.Constraint;
import com.vci.corba.portal.data.PLAction;
import com.vci.corba.portal.data.PLActionCls;
import com.vci.corba.portal.data.PLActionParam;
-import com.vci.dto.PLActionClsDTO;
-import com.vci.dto.PLActionDTO;
-import com.vci.dto.PLActionQueryDTO;
+import com.vci.dto.*;
+import com.vci.starter.poi.bo.WriteExcelData;
+import com.vci.starter.poi.bo.WriteExcelOption;
+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.util.ControllerUtil;
+import com.vci.starter.web.util.LangBaseUtil;
import com.vci.starter.web.util.LocalFileUtil;
+import com.vci.web.enumpck.ActionEnum;
+import com.vci.web.enumpck.PlTypetypeEnum;
import com.vci.web.other.ExportActionLogBean;
import com.vci.web.other.ExportBeans;
-import com.vci.web.other.LinkQTExportData;
-import com.vci.web.service.*;
-import com.vci.web.util.*;
+import com.vci.web.service.OsActionServiceI;
+import com.vci.starter.web.util.Lcm.Func;
+import com.vci.web.util.PinyinCommon;
+import com.vci.web.util.PlatformClientUtil;
+import com.vci.web.util.WebUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
-import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
@@ -95,6 +102,7 @@
PLActionCls pac = new PLActionCls();
pac.name = pLActionCls.getName();
pac.pid = pLActionCls.getPid();
+ pac.id = pLActionCls.getId();
pac.description = pLActionCls.getDescription() == null ? "" : pLActionCls.getDescription();
pac.creator = WebUtil.getCurrentUserId();
pac.createTime = System.currentTimeMillis();
@@ -124,14 +132,15 @@
PLActionCls[] clses = platformClientUtil.getUIService().getPLActionClsArray();
PLActionClsDTO treDto = new PLActionClsDTO();
treDto.setName("Action鍒嗙被");
+ treDto.setId("root");
Map<String, List<PLActionCls>> allDataMap = Arrays.stream(clses).collect(Collectors.groupingBy(pl -> pl.pid));
for (PLActionCls cls : clses) {
- if (StringUtils.isBlank(cls.pid)) {
+ if (StringUtils.isBlank(cls.pid) || cls.pid.equals("root")) {
PLActionClsDTO parentDto = new PLActionClsDTO();
parentDto.setId(cls.id);
parentDto.setName(cls.name);
- parentDto.setPid(cls.pid);
+ parentDto.setPid("root");
parentDto.setDescription(cls.description);
parentDto.setCreator(cls.creator);
parentDto.setCreateTime(cls.createTime);
@@ -181,9 +190,10 @@
@Override
public BaseResult getActionTableData(PLActionQueryDTO dto) throws PLException {
Constraint[] consArray ;
- if(StringUtils.isNotBlank(dto.getPlactioncls())){
+ //杩欏効瑕佺敤!=null鎺у埗锛屾煡璇㈡湭鍒嗙被鑺傜偣鐨勬椂鍊欎紶鐨�""
+ if(dto.getPlactioncls() != null){
consArray = new Constraint[7];
- consArray[6] = new Constraint("plactioncls", dto.getPlactioncls());
+ consArray[6] = new Constraint("plactioncls", dto.getPlactioncls().equals("root") ? "": dto.getPlactioncls());
}else {
consArray = new Constraint[6];
}
@@ -302,7 +312,7 @@
@Override
public void exportBeans(List<String> actionOid, HttpServletResponse response) throws PLException, IOException {
String defaultTempFolder = LocalFileUtil.getDefaultTempFolder();
- String vciqtmfFileName = defaultTempFolder + File.separator + "actionTemplateExp" + new Date().getTime() + ".vciamf";
+ String vciqtmfFileName = defaultTempFolder + File.separator + "VCIACTIONMODELFILE" + new Date().getTime() + ".vciamf";
HashMap exportBeans = new HashMap<String, Object>();
getExportBeans(actionOid, exportBeans);// 鑾峰緱瀵煎嚭Bean鍚屾椂锛岃褰昹og
@@ -325,6 +335,603 @@
FileUtil.del(defaultTempFolder + File.separator);
}
+ @Override
+ public BaseResult impData(MultipartFile file) throws IOException, PLException {
+ // 瀵煎叆鐨勫璞�
+ ExportBeans exportBeans = null;
+ if (file == null) {
+ return BaseResult.fail(FrameWorkLangCodeConstant.IMPORT_FAIL, new String[]{"鏃犲鍏ョ殑鏂囦欢"});
+ }
+ if (!file.getOriginalFilename().endsWith(".vciamf")) {
+ throw new VciBaseException("浠呰兘涓婁紶.vciqtf鏍煎紡鏂囦欢锛岃閲嶆柊涓婁紶锛�");
+ }
+ HashMap map;
+ try {
+ ObjectInputStream obj = new ObjectInputStream(file.getInputStream());
+ map = (HashMap) obj.readObject();
+ } catch (ClassNotFoundException e) {
+ return BaseResult.fail("瀵煎叆瀵硅薄鏈幏鍙栨垚鍔燂紒锛佸鍏ュ璞$増鏈彿涓嶅悓锛�");
+ }
+ //鏈�缁堢殑鎸佷箙鍖�
+ ArrayList<PLActionCls> pLActionClsList = new ArrayList<>();
+ // 鏇存崲actionId鍚庯紝鍙互浠庢瀵艰埅涓幏寰楀師鏉ョ殑id
+ HashMap<String /* newId */, String /* oldId */> actionIdNav = new HashMap<String /* newId */, String /* oldId */>();
+ // 鏇存崲actionClsId鍚庯紝鍙互浠庢瀵艰埅涓幏寰楀師鏉ョ殑id
+ HashMap<String /* newId */, String /* oldId */> actionClsIdNav = new HashMap<String /* newId */, String /* oldId */>();
+ //淇濆瓨鎵�鏈夌埗鍒嗙被锛岀敤id涓籯ey
+ HashMap<String/*id*/,PLActionCls> actionClses = new HashMap<String/*id*/,PLActionCls>();
+ // 瀛樺偍绗﹀悎鏉′欢鐨凱LAction
+ ArrayList<PLAction> optionPLActionList = new ArrayList<>();
+ // 瀛樺偍绗﹀悎鏉′欢鐨凱LActionCls
+ ArrayList<PLActionCls> optionPLActionClsList = new ArrayList<>();
+ // 搴撲腑鐨勬墍鏈堿ction鍒嗙被瀵硅薄
+ PLActionCls[] pLActionClses = null;
+ exportBeans = (ExportBeans) map.get("exportBeans");
+ // 娣诲姞瀵煎叆鐨勬暟鎹�
+ addImportData(exportBeans, pLActionClsList, actionIdNav, actionClsIdNav, optionPLActionClsList, pLActionClses, optionPLActionList);
+ // 灏哖LActionCls 銆丳LAction 瀵瑰簲鐨剆et闆嗗悎杞崲鎴愭暟缁勶紙鍖归厤鍘焌ddExportTreeNode鏂规硶锛�
+ PLActionCls[] newPLActionClsArray = new PLActionCls[optionPLActionClsList.size()];
+ PLAction[] newPLActionArray = new PLAction[optionPLActionList.size()];
+ optionPLActionClsList.toArray(newPLActionClsArray);
+ optionPLActionList.toArray(newPLActionArray);
+ //娓呮鍒嗙被id
+ actionClses.clear();
+ //淇濆瓨鎵�鏈夊垎绫籭d
+ for (int i = 0; i < newPLActionClsArray.length; i++) {
+ actionClses.put(newPLActionClsArray[i].id,newPLActionClsArray[i]);
+ }
+ //淇濆瓨鎵�鏈夊瓨鍦╝ction鐨勫垎绫伙紙瀛愬垎绫诲瓨鍦╝ction涔熶繚瀛橈級
+ HashSet<PLActionCls> pLActionClss =new HashSet<PLActionCls> ();
+ for (int i = 0; i < newPLActionArray.length; i++) {
+ //缂撳瓨璇ュ垎绫荤殑鎵�鏈夌埗鍒嗙被
+ saveParentCls(newPLActionArray[i].plActionCls,pLActionClss,actionClses);
+ }
+ PLActionCls[] actionClslist = new PLActionCls[pLActionClss.size()];
+ pLActionClss.toArray(actionClslist);
+ PLActionClsDTO treDto = new PLActionClsDTO();
+ treDto.setName("Action鍒嗙被");
+
+ Map<String, List<PLAction>> plActionMap = Arrays.stream(newPLActionArray).collect(Collectors.groupingBy(e -> e.plActionCls));
+ Map<String, List<PLActionCls>> plActionClsMap = pLActionClss.stream().collect(Collectors.groupingBy(e -> e.pid));
+ Map<String, List<PLActionCls>> allCls = Arrays.stream(platformClientUtil.getUIService().getPLActionClsArray()).collect(Collectors.groupingBy(e -> e.name));
+ // 娣诲姞瀛愯妭鐐�(婧愭爲鑺傜偣)
+ for (Map.Entry<String, PLActionCls> entry : exportBeans.getPLActionClsBeans().entrySet()) {
+ if (StringUtils.isBlank(entry.getValue().pid)) {
+ PLActionClsDTO parentDto = new PLActionClsDTO();
+ parentDto.setId(entry.getValue().id);
+ parentDto.setName(entry.getValue().name);
+ parentDto.setPid(entry.getValue().pid);
+ parentDto.setDescription(entry.getValue().description);
+ parentDto.setCreator(entry.getValue().creator);
+ parentDto.setCreateTime(entry.getValue().createTime);
+ parentDto.setSerialno(entry.getValue().serialno);
+ addExportTreeNode(plActionClsMap, plActionMap, parentDto, allCls, exportBeans);
+ treDto.getChilds().add(parentDto);
+ }
+ }
+ PLActionClsDTO noDto = new PLActionClsDTO();
+ noDto.setName("鏈垎绫�");
+ if(plActionMap.containsKey("")){
+ for (PLAction plAction : plActionMap.get("")) {
+ PLActionClsDTO childPrentDto = new PLActionClsDTO();
+ if (plAction.plName.endsWith("@#淇敼$%")) {
+ childPrentDto.setName(plAction.plCode + "/" + plAction.plName.replace("@#淇敼$%", "銆愪慨鏀瑰畬鎴愩��"));
+ plAction.plName = plAction.plName.replace("@#淇敼$%", "");
+ platformClientUtil.getUIService().updatePLAction(plAction);
+ }else
+ if (plAction.plName.endsWith("@#瀛樺湪鍦ㄦ湭鍒嗙被涓�$%")) {
+ childPrentDto.setName(plAction.plCode + "/" + plAction.plName.replace("@#瀛樺湪鍦ㄦ湭鍒嗙被涓�$%", "銆恆ction瀛樺湪鍦ㄦ湭鍒嗙被涓紝淇敼瀹屾垚銆�"));
+ plAction.plName = plAction.plName.replace("@#瀛樺湪鍦ㄦ湭鍒嗙被涓�$%", "");
+ platformClientUtil.getUIService().updatePLAction(plAction);
+// plAction.plName = plAction.plName.replace("@#瀛樺湪鍦ㄦ湭鍒嗙被涓�$%", "銆恆ction瀛樺湪鍦ㄦ湭鍒嗙被涓紝淇敼Action骞舵寜瀵煎叆鏂囦欢鍒涘缓action鍒嗙被銆�");
+ }
+ else {
+ childPrentDto.setName(plAction.plCode + "/" + "銆愭柊澧炲畬鎴愩��");
+// plAction.plName += "銆愭柊澧炪��";
+ platformClientUtil.getUIService().savePLAction(plAction);
+ }
+ dealParam(exportBeans, plAction);
+ childPrentDto.setId(plAction.plOId);
+ childPrentDto.setPid(plAction.plActionCls);
+ noDto.getChilds().add(childPrentDto);
+ }
+ }
+ treDto.getChilds().add(noDto);
+
+ return BaseResult.success(treDto);
+ }
+ /**
+ * 瀵煎嚭Action
+ * @param plActionExpDTO 瀵煎嚭灞炴�ц缃璞�
+ */
+ @Override
+ public void exportAction(PLActionExpDTO plActionExpDTO, HttpServletResponse response) throws PLException, IOException {
+ String defaultTempFolder = LocalFileUtil.getDefaultTempFolder();
+ String excelPath = defaultTempFolder + File.separator + plActionExpDTO.getFileName() + ".xls";
+ try {
+ new File(excelPath).createNewFile();
+ } catch (Throwable e) {
+ throw new VciBaseException(LangBaseUtil.getErrorMsg(e), new String[]{excelPath}, e);
+ }
+ isValidPageForamt(plActionExpDTO);
+ //璁剧疆鍒�
+ List<WriteExcelData> excelDataList = new ArrayList<>();
+ //璁剧疆鍒楀ご
+ for (int index = 0; index < plActionExpDTO.getColumnName().size(); index++) {
+ excelDataList.add(new WriteExcelData(0,index, plActionExpDTO.getColumnName().get(index)));
+ }
+ PLAction[] allPLAction ;
+ if(plActionExpDTO.getDataType().equals(ActionEnum.EXP_ALL.getValue()) ||
+ plActionExpDTO.getDataType().equals(ActionEnum.EXP_PAGE.getValue())){
+ allPLAction = platformClientUtil.getUIService().getAllPLAction();
+ }else{
+ allPLAction = new PLAction[plActionExpDTO.getChooseDataOid().size()];
+ for (int i = 0; i < plActionExpDTO.getChooseDataOid().size(); i++) {
+ allPLAction[i] = platformClientUtil.getUIService().getPLActionById(plActionExpDTO.getChooseDataOid().get(i));
+ }
+ }
+ if(Func.isEmpty(allPLAction)){
+ excelDataList.add(new WriteExcelData(1,1, "鏍规嵁灞炴�у悕绉版湭鏌ヨ鍒板睘鎬т俊鎭紝璇峰埛鏂板悗灏濊瘯閲嶆柊瀵煎嚭锛�"));
+ }else{
+ for (int i = 0; i < allPLAction.length; i++) {
+ PLAction action = allPLAction[i];
+ List<String> columnName = plActionExpDTO.getColumnName();
+ for (int index = 0; index < columnName.size(); index++) {
+ switch (columnName.get(index)){
+ case "缂栧彿":
+ excelDataList.add(new WriteExcelData(i+1,index, action.plCode));
+ break;
+ case "绫昏矾寰�":
+ excelDataList.add(new WriteExcelData(i+1,index, action.plBSUrl));
+ break;
+ case "閾炬帴鍦板潃":
+ excelDataList.add(new WriteExcelData(i+1,index, action.plCSClass));
+ break;
+ case "鎻忚堪":
+ excelDataList.add(new WriteExcelData(i+1,index, action.plDesc));
+ break;
+ case "绫诲瀷":
+ excelDataList.add(new WriteExcelData(i+1,index, action.plTypeType.equals(PlTypetypeEnum.BUSINESS.getValue()) ?
+ PlTypetypeEnum.BUSINESS.getText() : PlTypetypeEnum.LINK.getText()));
+ break;
+ case "鍚嶇О":
+ excelDataList.add(new WriteExcelData(i+1,index, action.plName));
+ break;
+ }
+ }
+ }
+ }
+ WriteExcelOption excelOption = new WriteExcelOption(excelDataList);
+ ExcelUtil.writeDataToFile(excelPath, excelOption);
+ ControllerUtil.writeFileToResponse(response,excelPath);
+ FileUtil.del(defaultTempFolder + File.separator);
+ }
+ /**
+ * 淇濆瓨Action鍙傛暟鏁版嵁
+ * dto action浼犺緭瀵硅薄
+ * @return 淇濆瓨缁撴灉
+ */
+ @Override
+ public BaseResult savePLActionParam(PLActionParamDTO dto) throws PLException {
+ if(dto.getName() == null || dto.getName().equals("")) {
+ throw new PLException("500",new String[]{"鍙傛暟鍚嶇О涓嶈兘涓虹┖"});
+ }
+ PLActionParam param = new PLActionParam();
+ param.oid = "";
+ param.name = dto.getName();
+ param.defaultValue = dto.getDefaultValue();
+ param.description = dto.getDescription();
+ param.action = dto.getAction();
+ String message = platformClientUtil.getUIService().createPLActionParam(param);
+
+ if(message.startsWith("0")) {
+ if(message.equals("01")) {
+ throw new PLException("500",new String[]{"鍙傛暟鍚嶅凡缁忓瓨鍦紒"});
+ } else {
+ throw new PLException("500",new String[]{"娣诲姞鎸夐挳鍙傛暟鏃跺彂鐢熷紓甯革細" + message.substring(1)});
+ }
+ }
+ return BaseResult.success();
+ }
+
+ @Override
+ public BaseResult updatePLActionParam(PLActionParamDTO dto) throws PLException {
+ if(dto.getName() == null || dto.getName().equals("")) {
+ throw new PLException("500",new String[]{"鍙傛暟鍚嶇О涓嶈兘涓虹┖"});
+ }
+ PLActionParam param = new PLActionParam();
+ param.oid = dto.getOid();
+ param.name = dto.getName();
+ param.defaultValue = dto.getDefaultValue();
+ param.description = dto.getDescription();
+ param.action = dto.getAction();
+ String message = platformClientUtil.getUIService().editPLActionParam(param);
+
+ if(message.startsWith("0")) {
+ if(message.equals("01")) {
+ throw new PLException("500",new String[]{"鍙傛暟鍚嶅凡缁忓瓨鍦紒"});
+ } else {
+ throw new PLException("500",new String[]{"娣诲姞鎸夐挳鍙傛暟鏃跺彂鐢熷紓甯革細" + message.substring(1)});
+ }
+ }
+ return BaseResult.success();
+ }
+ /**
+ * 鍒犻櫎Action鍙傛暟鏁版嵁
+ * oid 鍙傛暟涓婚敭
+ * @return 淇濆瓨缁撴灉
+ */
+ @Override
+ public BaseResult deletePLActionParam(String oid) throws PLException {
+ if(StringUtils.isBlank(oid)){
+ throw new PLException("500", new String[]{"鍙傛暟涓婚敭涓嶈兘涓虹┖"});
+ }
+ String message = platformClientUtil.getUIService().deletePLActionParam(oid);
+ if (message.startsWith("0")) {
+ throw new PLException("500", new String[]{"鍒犻櫎鎸夐挳鍙傛暟鏃跺彂鐢熷紓甯革細" + message.substring(1)});
+ }
+ return BaseResult.success();
+ }
+ /**
+ * 鏌ヨAction鍙傛暟鍒楄〃鏁版嵁
+ * actionOid 鍙傛暟涓婚敭
+ * @return 淇濆瓨缁撴灉
+ */
+ @Override
+ public BaseResult getPLActionParam(String actionOid) throws PLException {
+ if (StringUtils.isBlank(actionOid)){
+ throw new PLException("500", new String[]{"Action涓婚敭涓嶈兘涓虹┖锛�"});
+ }
+ PLActionParam[] paramArrays = platformClientUtil.getUIService().getPLActionParamArrayByActionId(actionOid);
+ List<PLActionParamDTO> dtos = new ArrayList<>();
+ for (PLActionParam paramArray : paramArrays) {
+ PLActionParamDTO dto = new PLActionParamDTO();
+ dto.setAction(paramArray.action);
+ dto.setOid(paramArray.oid);
+ dto.setName(paramArray.name);
+ dto.setDescription(paramArray.description);
+ dto.setDefaultValue(paramArray.defaultValue);
+ dtos.add(dto);
+ }
+ return BaseResult.dataList(dtos);
+ }
+
+ /**
+ * 鍒犻櫎鍒嗙被
+ * @param dto 鍒嗙被瀵硅薄
+ * @return 澶勭悊缁撴灉
+ * @throws PLException
+ */
+ @Override
+ public BaseResult deleteActionCls(PLActionClsDTO dto) throws PLException {
+ PLActionCls[] clses = platformClientUtil.getUIService().getPLActionClsArray();
+ // 灏嗘墍鏈夊垎绫荤埗鍒嗙被淇濆瓨
+ HashSet<String> clsPids = new HashSet<String>();
+ for (PLActionCls plActionCls : clses) {
+ clsPids.add(plActionCls.pid);
+ }
+ if (dto.getName().equals("鏈垎绫�")) {
+ throw new PLException("500", new String[]{"鏈垎绫讳笉鑳藉垹闄�!"});
+ }
+ if (clsPids.contains(dto.getId())) {
+ throw new PLException("500", new String[]{"璇ュ垎绫讳笅瀛樺湪瀛愬垎绫讳笉鑳藉垹闄わ紒\n璇峰垹闄ゆ鍒嗙被涓嬬殑瀛愬垎绫伙紒"});
+ }
+ // 鎵ц鍒犻櫎鎿嶄綔
+ PLActionCls actionCls = new PLActionCls();
+ actionCls.id = dto.getId();
+ actionCls.name = dto.getName();
+ String message = platformClientUtil.getUIService().deletePLActionCls(actionCls);
+ if (message.startsWith("0")) {
+ throw new PLException("500", new String[]{"鍒犻櫎鍒嗙被澶辫触锛�" + message.substring(1)});
+ }
+ return BaseResult.success("鍒嗙被鍒犻櫎鎴愬姛锛�" + message.substring(1));
+ }
+
+ public boolean isValidPageForamt(PLActionExpDTO plActionExpDTO) throws PLException {
+
+ boolean res = false;
+ if(plActionExpDTO.getDataType().equals(ActionEnum.EXP_ALL.getValue()) ||
+ plActionExpDTO.getDataType().equals(ActionEnum.EXP_CHOOSE.getValue())) {
+ res = true;
+ return res;
+ }
+ if(StringUtils.isBlank(plActionExpDTO.getPageNum())){
+ throw new PLException("500", new String[]{"椤电爜涓嶈兘涓虹┖"});
+ } else{
+ int pageCount = 1;//杩欓噷鍥哄畾鐢变簬鐣岄潰娌℃湁缈婚〉鍔熻兘
+ String[] pages = plActionExpDTO.getPageNum().split("-");
+
+ // 鐢╠obule鎺ユ敹杈撳叆鐨勬暟鎹紝闃叉杈撳叆瓒呭ぇ鍊硷紙澶т簬Integer.MAX_VALUE锛�
+ // 杞崲鎴怚nteger锛岃繘琛屾瘮杈冿紝鍙婂湪鎻愮ず鍐呭涓幓鎺塪ouble绫诲瀷鏁版嵁鍙兘浼氬嚭鐜扮殑灏忔暟鐐�
+ if(pages.length == 1){
+ double pageD = Double.parseDouble(pages[0]);
+ if(pageD > Integer.MAX_VALUE){
+ throw new PLException("500", new String[]{"璧峰椤电爜 " + String.valueOf(pageD) + " 涓嶅緱澶т簬 " + Integer.MAX_VALUE});
+ }else{
+ int page = (int)pageD;
+ if(page > pageCount){
+ throw new PLException("500", new String[]{"杈撳叆鐨勯〉鐮� " + page + " 涓嶅緱澶т簬鎬婚〉鏁� " + pageCount});
+ } else if(page > Integer.MAX_VALUE){
+ throw new PLException("500", new String[]{"杈撳叆鐨勯〉鐮� " + page + " 涓嶅緱澶т簬 " + Integer.MAX_VALUE});
+ } else {
+ res = true;
+ }
+ }
+ } else{
+ double pageStartD = Double.parseDouble(pages[0]);
+ double pageEndD = Double.parseDouble(pages[1]);
+ if(pageStartD > Integer.MAX_VALUE){
+ throw new PLException("500", new String[]{"璧峰椤电爜 " + pageStartD + " 涓嶅緱澶т簬 " + Integer.MAX_VALUE});
+ } else if(pageEndD > Integer.MAX_VALUE){
+ throw new PLException("500", new String[]{"缁撴潫椤电爜 " + pageEndD + " 涓嶅緱澶т簬 " + Integer.MAX_VALUE});
+ } else{
+ int pageStart = (int)pageStartD;
+ int pageEnd = (int)pageEndD;
+ if(pageStart > pageCount){
+ throw new PLException("500", new String[]{"璧峰椤电爜 " + pageStart + " 涓嶅緱澶т簬鎬婚〉鏁� " + pageCount});
+ } else if(pageEnd > pageCount){
+ throw new PLException("500", new String[]{"缁撴潫椤电爜 " + pageEnd + " 涓嶅緱澶т簬鎬婚〉鏁� " + pageCount});
+ } else if(pageStart > pageEnd){
+ throw new PLException("500", new String[]{"璧峰椤电爜 " + pageStart + " 涓嶅緱澶т簬缁撴潫椤电爜 " + pageEnd});
+ } else{
+ res = true;
+ }
+ }
+ }
+ }
+ return res;
+ }
+
+ /**
+ * 澶勭悊鍙傛暟鍒楄〃
+ * @param exportBeans 瀵煎叆鏁版嵁闆嗗悎
+ * @param plAction action瀵硅薄
+ * @throws PLException
+ */
+ private void dealParam(ExportBeans exportBeans, PLAction plAction) throws PLException {
+ PLActionParam[] plActionParamArrayByActionId = exportBeans.getPLActionParamArrayByActionId(plAction.plOId);
+ PLActionParam[] paramArray = platformClientUtil.getUIService().getPLActionParamArrayByActionId(plAction.plOId);
+ Map<String, List<PLActionParam>> params = Arrays.stream(paramArray).collect(Collectors.groupingBy(e -> e.oid));
+ if(plActionParamArrayByActionId == null){
+ return;
+ }
+ for (PLActionParam param : plActionParamArrayByActionId) {
+ if(params.containsKey(param)){
+ platformClientUtil.getUIService().editPLActionParam(param);
+ }else {
+ platformClientUtil.getUIService().createPLActionParam(param);
+ }
+ }
+ }
+
+ private void addExportTreeNode(Map<String, List<PLActionCls>> pLActionClses, Map<String, List<PLAction>> plActions,
+ PLActionClsDTO parentDto,Map<String, List<PLActionCls>> allCls, ExportBeans exportBeans) throws PLException {
+
+ //澶勭悊褰撳墠鑺傜偣涓嬬殑action
+ if(plActions.containsKey(parentDto.getId())){
+ for (PLAction plAction : plActions.get(parentDto.getId())) {
+ PLActionClsDTO childPrentDto = new PLActionClsDTO();
+ childPrentDto.setId(plAction.plOId);
+ if (plAction.plName.endsWith("@#淇敼$%")) {
+ childPrentDto.setName(plAction.plCode + "/" + plAction.plName.replace("@#淇敼$%", "銆愪慨鏀规垚鍔熴��"));
+// plAction.plName = plAction.plName.replace("@#淇敼$%", "銆愪慨鏀广��");
+ plAction.plName = plAction.plName.replace("@#淇敼$%", "");
+ platformClientUtil.getUIService().updatePLAction(plAction);
+ }else
+ if (plAction.plName.endsWith("@#瀛樺湪鍦ㄦ湭鍒嗙被涓�$%")) {
+ childPrentDto.setName(plAction.plCode + "/" + plAction.plName.replace("@#瀛樺湪鍦ㄦ湭鍒嗙被涓�$%", "銆恆ction瀛樺湪鍦ㄦ湭鍒嗙被涓紝淇敼Action鎴愬姛銆�"));
+// plAction.plName = plAction.plName.replace("@#瀛樺湪鍦ㄦ湭鍒嗙被涓�$%", "銆恆ction瀛樺湪鍦ㄦ湭鍒嗙被涓紝淇敼Action骞舵寜瀵煎叆鏂囦欢鍒涘缓action鍒嗙被銆�");
+ plAction.plName = plAction.plName.replace("@#瀛樺湪鍦ㄦ湭鍒嗙被涓�$%", "");
+ platformClientUtil.getUIService().updatePLAction(plAction);
+ }
+ else {
+ childPrentDto.setName(plAction.plCode + "/" + plAction.plName.replace("@#鏂板%", "銆愭柊澧炴垚鍔熴��"));
+// plAction.plName += "銆愭柊澧炪��";
+ platformClientUtil.getUIService().savePLAction(plAction);
+ }
+ dealParam(exportBeans, plAction);
+ childPrentDto.setPid(plAction.plActionCls);
+ parentDto.getChilds().add(childPrentDto);
+ }
+ }
+ if(pLActionClses.containsKey(parentDto.getId())){
+ List<PLActionCls> plActionCls = pLActionClses.get(parentDto.getId());
+ for (PLActionCls plActionCl : plActionCls) {
+ PLActionClsDTO childParentDto = new PLActionClsDTO();
+ childParentDto.setId(plActionCl.id);
+ if(allCls.containsKey(childParentDto.getName())){
+ childParentDto.setName(plActionCl.name);
+ }else {
+ childParentDto.setName(plActionCl.name + "銆愭柊澧炲畬鎴愩��");
+ platformClientUtil.getUIService().creaetePLActionCls(plActionCl);
+ }
+ childParentDto.setPid(plActionCl.pid);
+ childParentDto.setDescription(plActionCl.description);
+ childParentDto.setCreator(plActionCl.creator);
+ childParentDto.setCreateTime(plActionCl.createTime);
+ childParentDto.setSerialno(plActionCl.serialno);
+ addExportTreeNode(pLActionClses, plActions, childParentDto, allCls, exportBeans);
+ parentDto.getChilds().add(childParentDto);
+ }
+
+ }
+
+ }
+
+
+ /**
+ * 淇濆瓨鎵�鏈夌埗鍒嗙被
+ * @param plActionCls
+ * @param pLActionClsList
+ */
+ private void saveParentCls(String plActionCls, HashSet<PLActionCls> pLActionClsList,
+ HashMap<String/*id*/,PLActionCls> actionClses) {
+ if(actionClses.containsKey(plActionCls)){
+ PLActionCls pCls = actionClses.get(plActionCls);
+ pLActionClsList.add(pCls);
+ saveParentCls(pCls.pid, pLActionClsList, actionClses);
+ }
+
+ }
+
+ private void addImportData(ExportBeans exportBeans, ArrayList<PLActionCls> pLActionClsList, HashMap<String /* newId */,
+ String /* oldId */> actionIdNav,HashMap<String /* newId */, String /* oldId */> actionClsIdNav,
+ ArrayList<PLActionCls> optionPLActionClsList, PLActionCls[] pLActionClses, ArrayList<PLAction> plActionList)
+ throws PLException {
+ HashMap<String, PLAction> pLActionBeans = exportBeans.getPLActions();
+ if (pLActionBeans == null) {
+ throw new VciBaseException("瀵煎叆瀵硅薄鏈幏鍙栨垚鍔燂紒锛�");
+ }
+ //鏁版嵁搴撲腑娌℃湁瀛樺湪鐨勬暟鎹璞★紝闇�瑕佽繘琛屼繚瀛�
+// ArrayList<PLAction> plActionList = new ArrayList<>();
+ PLAction[] allPLAction = platformClientUtil.getUIService().getAllPLAction();
+ Map<String, PLAction> allPLActionMap = Arrays.stream(allPLAction).collect(Collectors.toMap(e -> e.plOId, e -> e));
+ Set<Map.Entry<String, PLAction>> plActions = pLActionBeans.entrySet();
+ for (Map.Entry<String, PLAction> entry : plActions) {
+ PLAction plAction = entry.getValue();
+ PLAction plActionInDB =allPLActionMap.get(plAction.plOId);
+
+ if (plActionInDB != null) {
+ if( plActionInDB.plActionCls != ""){
+ plAction.plActionCls = plActionInDB.plActionCls;
+ // plAction.plOId = newId;
+ plAction.plName += "@#淇敼$%";
+ plActionList.add(plAction);
+ continue;
+ }else{
+ plAction.plName += "@#瀛樺湪鍦ㄦ湭鍒嗙被涓�$%";
+ }
+
+ }
+ // 灏嗚瀹炰緥acion瀛樺叆鍒皃lActionList涓�
+ plActionList.add(plAction);
+
+ // 瀹氫箟list瀛樺偍褰撳墠action鍒版暟鎹簱action鐨勮矾寰勪笂鐨勬墍鏈塒LActionCls瀵硅薄
+ List<PLActionCls> plActionClsList = new ArrayList<PLActionCls>();
+ // 鑾峰緱搴撲腑鐨勬渶杩戠殑PLActionCls瀵硅薄
+ String pId = WebUtil.getSnowflakePk();
+ String oId = WebUtil.getSnowflakePk();
+
+ PLActionCls pLActionCls = getParentPLActionClsInDBById(plAction,
+ pId, plActionClsList, actionClsIdNav, exportBeans, optionPLActionClsList, pLActionClses);
+
+ changePLActionOID(plAction, oId, pId, actionIdNav);
+
+ if (plActionClsList.size() == 1) {
+ // 鍒犻櫎"鏈垎绫�"鍒嗙被瀵硅薄
+ PLActionCls plActionCls = plActionClsList.get(plActionClsList
+ .size() - 1);
+
+ if(pLActionCls != null){
+ plAction.plActionCls = pLActionCls.id;
+ if(plActionCls.name.equals("鏈垎绫�")){
+ plAction.plActionCls = "";
+ }
+ plActionClsList.remove(plActionClsList.size() - 1);
+ }else{
+ if(plActionCls.name.equals("鏈垎绫�")){
+ plActionClsList.remove(plActionClsList.size() - 1);
+ }else{
+ plActionCls.pid = "";
+ }
+
+ }
+
+ }
+ if (plActionClsList.size() >= 2) {
+
+ PLActionCls plActionCls2 = plActionClsList.get(plActionClsList
+ .size() - 2);
+ PLActionCls plActionCls1 = plActionClsList.get(plActionClsList
+ .size() - 1);
+ if (pLActionCls != null) {
+ // 灏嗗鍏ュ璞′笌鈥滃簱涓殑鏈�杩戠殑PLActionCls瀵� 璞♀�漬ame鐩稿悓鐨勫璞�
+ // 鐨勪笅涓�涓狿LActionCls瀵硅薄鐖秈d鏀逛负搴撲腑鈥滄渶杩戔�漃LActionCls瀵硅薄id
+ plActionClsList.remove(plActionClsList.size() - 1);
+ plActionCls2.pid = pLActionCls.id;
+ }else{
+ if(plActionCls1.name.equals("鏈垎绫�")){
+ plActionClsList.remove(plActionClsList.size() - 1);
+ plActionCls2.pid = "";
+ }else{
+ plActionCls1.pid = "";
+ }
+
+ }
+
+ }
+ // 澧炲姞鍒版暣浣搇ist涓敤鏉ユ渶缁堟寔涔呭寲
+ pLActionClsList.addAll(plActionClsList);
+ }
+ }
+
+
+ private void changePLActionOID(PLAction plAction, String oId, String pId, HashMap<String /* newId */, String /* oldId */> actionIdNav) {
+ actionIdNav.put(oId, plAction.plOId);
+ plAction.plOId = oId;
+ plAction.plActionCls = pId;
+ }
+ /***
+ * 鑾峰緱搴撲腑鐨凱LActionCls瀵硅薄锛岀敤鏉ュ珌鎺ュ鍏ユ潵鐨勬爲
+ *
+ * @param
+ * @param plActionClsList
+ * @return
+ */
+ private PLActionCls getParentPLActionClsInDBById(Object plActionClsIdObj,
+ String newPLActionClsId, List<PLActionCls> plActionClsList,
+ HashMap<String /* newId */, String /* oldId */> actionClsIdNav,ExportBeans exportBeans,
+ ArrayList<PLActionCls> optionPLActionClsList, PLActionCls[] pLActionClses) {
+ String pId = null;
+ if (plActionClsIdObj instanceof PLAction) {
+ pId = ((PLAction) plActionClsIdObj).plActionCls;
+ if(pId.equals("")){
+ PLActionCls noneCls = new PLActionCls("", "鏈垎绫�", "", "", "", 0, (short)0);
+ plActionClsList.add(noneCls);
+ return noneCls;
+ }
+ }
+ if (plActionClsIdObj instanceof PLActionCls) {
+ pId = ((PLActionCls) plActionClsIdObj).pid;
+ pId = actionClsIdNav.get(pId);
+ if(pId.equals("")){
+ pId = "null";
+ }
+
+ }
+
+ PLActionCls plActionCls = exportBeans.getPLActionClsBeanById(pId);// 浠庡鍏ュ璞′腑鑾峰緱鐖跺垎绫�
+
+
+ PLActionCls tempPLActionCls = null;
+ if (plActionCls != null) {// plActionCls涓虹┖ 璇佹槑鐖惰妭鐐逛负鏍硅妭鐐�
+
+ plActionClsList.add(plActionCls);
+ if(optionPLActionClsList.contains(plActionCls)){
+ return plActionCls ;
+ }
+ for (PLActionCls Cls : pLActionClses) {
+ if ((plActionCls.id.equals("") && plActionCls.name.trim()
+ .equals("鏈垎绫�"))
+ || plActionCls.name.trim().equals(Cls.name.trim())) {
+ tempPLActionCls = Cls;
+ }
+ }
+ plActionCls.id = newPLActionClsId; // 淇敼鐖跺垎绫籭d
+ } else {
+ return null;
+ }
+
+ if (tempPLActionCls == null) {
+ String newClsId = WebUtil.getSnowflakePk();
+ actionClsIdNav.put(newClsId, plActionCls.pid);
+ plActionCls.pid = newClsId;
+ return getParentPLActionClsInDBById(plActionCls, newClsId,
+ plActionClsList, actionClsIdNav, exportBeans, optionPLActionClsList, pLActionClses);
+ }
+ return tempPLActionCls;
+ }
+
/**
* 澶勭悊瀵煎嚭鐨勫璞�
* @param actionOid 鐣岄潰閫夋嫨鐨刟ction鍒楄〃鏁版嵁
--
Gitblit v1.9.3