From 528599faeea03a6370ec5094c26c5e251518ccb5 Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期三, 28 八月 2024 17:53:55 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebBtmTypeController.java | 30 +
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/enumpck/ActionEnum.java | 132 ++++
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebCodeGenSchemaController.java | 13
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsActionServiceImpl.java | 495 ++++++++++++++++++
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/PLActionExpDTO.java | 39 +
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/other/BtmQTExportData.java | 65 ++
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsCodeGenSchemaServiceI.java | 3
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsQuereyTemplateServiceI.java | 50 +
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/HMSysModConfigController.java | 5
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsActionServiceI.java | 13
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsBtmServiceImpl.java | 16
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmFunctionQueryServicePlatformImpl.java | 12
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/enumpck/PlTypetypeEnum.java | 128 ++++
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsBtmServiceI.java | 4
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBtmIOServiceImpl.java | 8
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsQueryTemplateController.java | 107 +++
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsQueryTemplateImpl.java | 428 +++++++++++++++
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsActionController.java | 32 +
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsCodeGenSchemaServiceImpl.java | 3
19 files changed, 1,534 insertions(+), 49 deletions(-)
diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/PLActionExpDTO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/PLActionExpDTO.java
new file mode 100644
index 0000000..9a50ca9
--- /dev/null
+++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/PLActionExpDTO.java
@@ -0,0 +1,39 @@
+package com.vci.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * Action瀵煎嚭浼犺緭瀵硅薄
+ * @author yuxc
+ * @date 2024/8/27 17:46
+ */
+@Data
+public class PLActionExpDTO implements java.io.Serializable{
+
+ /**
+ * 绂佹淇敼杩欎釜鍊�
+ */
+ private static final long serialVersionUID = 2009350578651813260L;
+ /**
+ * 閫夋嫨瀵煎嚭鏁版嵁鐨勬ā寮�
+ */
+ private String dataType;//閫夋嫨瀵煎嚭鏁版嵁鐨勬ā寮�
+ /**
+ * 閫夋嫨銆愰�夋嫨銆戞ā寮忓垯闇�瑕佷紶姝ゅ弬鏁�
+ */
+ private List<String> chooseDataOid;
+ /**
+ * 椤电爜
+ */
+ private String pageNum;
+ /**
+ * 鎵�闇�瑕佸鍑虹殑鍒�
+ */
+ private List<String> columnName;
+ /**
+ * 鏂囦欢鍚�
+ */
+ private String fileName;
+}
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmFunctionQueryServicePlatformImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmFunctionQueryServicePlatformImpl.java
index ea1bf1a..8422fbc 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmFunctionQueryServicePlatformImpl.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmFunctionQueryServicePlatformImpl.java
@@ -395,12 +395,16 @@
throw new VciBaseException(String.valueOf(e.code),e.messages);
}
}
- }else if(parentId.equals("sysOptionNode")){
+ }else if(parentId.equals("operateNode")){
//鍔犺浇鎵�鏈夋搷浣�
try{
//灏嗚繑鍥炵殑鑺傜偣澶栧眰濂椾笂褰撳墠鐖惰妭鐐�
MenuVO parentNode = JsonConfigReader.getSysModuleConf().getOperateNode();
- List<MenuVO> menuVOS = new ArrayList<>();
+ //濡傛灉鏌ヨ鐨勬槸绗竴灞傝妭鐐瑰氨闇�瑕佺洿鎺ヨ繑鍥瀞ysOptionNode鑺傜偣
+ if(Func.isNotBlank(modeType) && modeType.equals("firstNode")){
+ menuVOList.add(parentNode);
+ return menuVOList;
+ }
OperateInfo[] operateInfos = platformClientUtil.getFrameworkService().getOperateTreeList(parentId);
for(int i = 0; i < operateInfos.length;i++ ){
OperateInfo operateInfo = operateInfos[i];
@@ -416,10 +420,8 @@
menuVO.setSort((int) operateInfo.seq);
menuVO.setModeType("operateObject");
menuVO.setHasChildren(false);
- menuVOS.add(menuVO);
+ menuVOList.add(menuVO);
}
- parentNode.setChildren(menuVOS);
- menuVOList.add(parentNode);
}catch (PLException e) {
e.printStackTrace();
throw new VciBaseException(String.valueOf(e.code),new String[]{VciBaseUtil.getExceptionMessage(e)});
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/HMSysModConfigController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/HMSysModConfigController.java
index 8137581..01f81e0 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/HMSysModConfigController.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/HMSysModConfigController.java
@@ -1,7 +1,6 @@
package com.vci.web.controller;
import com.vci.constant.FrameWorkLangCodeConstant;
-import com.vci.corba.framework.data.AppConfigDetailInfo;
import com.vci.corba.framework.data.FuncOperationInfo;
import com.vci.corba.framework.data.OperateInfo;
import com.vci.frameworkcore.compatibility.ISmFunctionQueryService;
@@ -9,7 +8,6 @@
import com.vci.pagemodel.AppConfigDetailInfoVO;
import com.vci.pagemodel.ExpExcelConditionVO;
import com.vci.pagemodel.MenuVO;
-import com.vci.starter.web.annotation.controller.VciUnCheckRight;
import com.vci.starter.web.exception.VciBaseException;
import com.vci.starter.web.pagemodel.BaseResult;
import com.vci.starter.web.util.ControllerUtil;
@@ -19,7 +17,6 @@
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 org.springframework.web.multipart.MultipartFile;
@@ -188,7 +185,7 @@
return BaseResult.success(hmSysModConfigService.addOperationType(operateInfo),"娣诲姞鎿嶄綔绫诲瀷鎴愬姛");
}catch (Exception e){
e.printStackTrace();
- String errorMsg = "鍒犻櫎妯″潡鏃跺嚭鐜伴敊璇紝鍘熷洜锛�"+ VciBaseUtil.getExceptionMessage(e);
+ String errorMsg = "娣诲姞鎿嶄綔绫诲瀷鏃跺嚭鐜伴敊璇紝鍘熷洜锛�"+ VciBaseUtil.getExceptionMessage(e);
logger.error(errorMsg);
throw new VciBaseException(errorMsg);
}
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsActionController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsActionController.java
index 01b4da8..fa65c57 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsActionController.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsActionController.java
@@ -3,11 +3,15 @@
import com.vci.corba.common.PLException;
import com.vci.dto.PLActionClsDTO;
import com.vci.dto.PLActionDTO;
+import com.vci.dto.PLActionExpDTO;
import com.vci.dto.PLActionQueryDTO;
+import com.vci.starter.web.exception.VciBaseException;
import com.vci.starter.web.pagemodel.BaseResult;
+import com.vci.starter.web.util.VciBaseUtil;
import com.vci.web.service.OsActionServiceI;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@@ -149,7 +153,7 @@
}
/**
- * 瀵煎嚭Action
+ * 瀵煎嚭Action鍒嗙被
* @return
*/
@PostMapping("/exportBeans")
@@ -157,4 +161,30 @@
osActionServiceI.exportBeans(actionOid, response);
}
+ /**
+ * 瀵煎叆Action
+ * @param file 涓婁紶鐨勬枃浠�
+ * @return
+ */
+ @PostMapping("/impData")
+ public BaseResult impData(MultipartFile file){
+ try {
+ return osActionServiceI.impData(file);
+ }catch (Throwable e) {
+ throw new VciBaseException(VciBaseUtil.getExceptionMessage(e),new String[0],e);
+ }
+ }
+
+ /**
+ * 瀵煎嚭Action
+ * @param plActionExpDTO 瀵煎嚭灞炴�ц缃璞�
+ */
+ @PostMapping("/exportAction")
+ public void exportAction(@RequestBody PLActionExpDTO plActionExpDTO, HttpServletResponse response) throws PLException {
+ try {
+ osActionServiceI.exportAction(plActionExpDTO, response);
+ }catch (Throwable e) {
+ throw new VciBaseException(VciBaseUtil.getExceptionMessage(e),new String[0],e);
+ }
+ }
}
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsQueryTemplateController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsQueryTemplateController.java
index 0313038..c2032a4 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsQueryTemplateController.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsQueryTemplateController.java
@@ -147,6 +147,39 @@
}
/**
+ * 涓氬姟绫诲瀷鏌ヨ妯℃澘涓嬬殑鏌ヨ鏉′欢鐨勬煡璇㈡寜閽煡璇ist鍒楄〃
+ * @param qtInfoDTO
+ * @return 鏌ヨ缁撴灉
+ */
+ @PostMapping("/getCriteriaBtm")
+ public BaseResult getCriteriaBtm(@RequestBody QTInfoDTO qtInfoDTO){
+ try {
+ return quereyTemplateServiceI.getCriteriaBtm(qtInfoDTO);
+ } catch (PLException e) {
+ BaseResult objectBaseResult = new BaseResult<>();
+ objectBaseResult.setCode(Integer.parseInt(e.code));
+ objectBaseResult.setMsg(Arrays.toString(e.messages));
+ return objectBaseResult;
+ }
+ }
+
+ /**
+ * 鏌ヨ鏉′欢涓嬬殑閫夋嫨鏌ヨ妯℃澘瀵硅瘽妗嗭紙鏌ヨ鍏ㄩ儴妯℃澘鍜屾墍瀵瑰簲鐨勪笟鍔$被鍨嬫垨閾炬帴绫诲瀷鍚嶏級
+ * @return
+ */
+ @GetMapping("/getAllQTs")
+ public BaseResult getAllQTs(){
+ try {
+ return quereyTemplateServiceI.getAllQTs();
+ } catch (PLException e) {
+ BaseResult objectBaseResult = new BaseResult<>();
+ objectBaseResult.setCode(Integer.parseInt(e.code));
+ objectBaseResult.setMsg(Arrays.toString(e.messages));
+ return objectBaseResult;
+ }
+ }
+
+ /**
* 鏌ヨ妯℃澘鍒楄〃
* @param btName 绫诲瀷鍚嶇О
* @return 鏌ヨ缁撴灉
@@ -258,4 +291,78 @@
return objectBaseResult;
}
}
+
+ /**
+ * 涓氬姟绫诲瀷鏌ヨ妯℃澘淇濆瓨
+ * @param qtInfoDTO 淇濆瓨浼犺緭瀵硅薄
+ * @return 淇濆瓨缁撴灉
+ */
+ @PostMapping("/btmSave")
+ public BaseResult btmSave(@RequestBody QTInfoDTO qtInfoDTO){
+ try {
+ return quereyTemplateServiceI.btmSave(qtInfoDTO);
+ } catch (PLException e) {
+ BaseResult objectBaseResult = new BaseResult<>();
+ objectBaseResult.setCode(Integer.parseInt(e.code));
+ objectBaseResult.setMsg(Arrays.toString(e.messages));
+ return objectBaseResult;
+ }
+ }
+
+ /**
+ * 鏇存柊鏁版嵁搴撶粨鏋�
+ * @return 鏇存柊缁撴灉
+ */
+ @PostMapping("/updateDBStructure")
+ public BaseResult btmSave(){
+ try {
+ return quereyTemplateServiceI.updateDBStructure();
+ } catch (PLException e) {
+ BaseResult objectBaseResult = new BaseResult<>();
+ objectBaseResult.setCode(Integer.parseInt(e.code));
+ objectBaseResult.setMsg(Arrays.toString(e.messages));
+ return objectBaseResult;
+ }
+ }
+
+ /**
+ * 涓氬姟绫诲瀷鏌ヨ妯℃澘鏍戞煡璇紝鐢ㄤ簬鐣岄潰鐨勫鍑哄姛鑳�
+ * @return 鏌ヨ缁撴灉
+ */
+ @GetMapping("/getBtmQtTree")
+ public BaseResult getBtmQtTree(){
+ try {
+ return quereyTemplateServiceI.getBtmQtTree();
+ } catch (PLException e) {
+ BaseResult objectBaseResult = new BaseResult<>();
+ objectBaseResult.setCode(Integer.parseInt(e.code));
+ objectBaseResult.setMsg(Arrays.toString(e.messages));
+ return objectBaseResult;
+ }
+ }
+
+ /**
+ * 瀵煎嚭涓氬姟绫诲瀷鏌ヨ妯℃澘
+ * names 鏌ヨ妯℃澘鍚�
+ * @return
+ */
+ @PostMapping("/expBtmQTTemplate")
+ public void expBtmQTTemplate(@RequestBody List<String> names,HttpServletResponse response) throws PLException, IOException {
+ quereyTemplateServiceI.expBtmQTTemplate(names, response);
+ }
+
+ /**
+ * 瀵煎叆涓氬姟绫诲瀷鏌ヨ妯℃澘
+ * @param file 涓婁紶鐨勬枃浠�
+ * @return 瀵煎叆缁撴灉
+ */
+ @PostMapping("/impBtmTemplate")
+ public BaseResult impBtmTemplate(MultipartFile file){
+ try {
+ return quereyTemplateServiceI.impBtmTemplate(file);
+ }catch (Throwable e) {
+ throw new VciBaseException(VciBaseUtil.getExceptionMessage(e),new String[0],e);
+ }
+ }
+
}
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebBtmTypeController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebBtmTypeController.java
index 270d46a..10c2d5c 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebBtmTypeController.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebBtmTypeController.java
@@ -403,7 +403,15 @@
@GetMapping(value = "/getAllAttributesByBtmId")
@VciBusinessLog(operateName = "鏌ョ湅涓氬姟绫诲瀷鐨勫睘鎬�")
public BaseResult<List<OsBtmTypeAttributeVO>> getAllAttributesByBtmId(String btmId){
- List<OsBtmTypeAttributeVO> osBtmTypeAttributeVOS = btmService.listAttributeByBtmIdHasDefault(btmId);
+ List<OsBtmTypeAttributeVO> osBtmTypeAttributeVOS = null;
+ try {
+ osBtmTypeAttributeVOS = btmService.listAttributeByBtmIdHasDefault(btmId);
+ } catch (PLException e) {
+ e.printStackTrace();
+ String exceptionMessage = VciBaseUtil.getExceptionMessage(e);
+ logger.error(exceptionMessage);
+ throw new VciBaseException(exceptionMessage);
+ }
return BaseResult.dataList(osBtmTypeAttributeVOS);
}
@@ -457,7 +465,15 @@
String hasDefaultAttr = baseQueryObject.getConditionMap().getOrDefault("hasDefaultAttr","false");
String attrId = baseQueryObject.getConditionMap().containsKey("name")?baseQueryObject.getConditionMap().get("name").replace("*",""):"";
String attrName = baseQueryObject.getConditionMap().containsKey("label") ? baseQueryObject.getConditionMap().get("label").replace("*","") : "";
- List<OsBtmTypeAttributeVO> boAttrs = btmService.listAttributeByBtmId(btmTypeId);
+ List<OsBtmTypeAttributeVO> boAttrs = null;
+ try {
+ boAttrs = btmService.listAttributeByBtmId(btmTypeId);
+ } catch (PLException e) {
+ e.printStackTrace();
+ String exceptionMessage = VciBaseUtil.getExceptionMessage(e);
+ logger.error(exceptionMessage);
+ throw new VciBaseException(exceptionMessage);
+ }
if(boAttrs == null){
boAttrs = new ArrayList<>();
}
@@ -505,7 +521,15 @@
String attrId = baseQueryObject.getConditionMap().containsKey("name")?baseQueryObject.getConditionMap().get("name").replace("*",""):"";
String attrName = baseQueryObject.getConditionMap().containsKey("label") ? baseQueryObject.getConditionMap().get("label").replace("*","") : "";
OsBtmTypeVO btmTypeVO = btmService.selectByOid(btmTypeOid);
- List<OsBtmTypeAttributeVO> boAttrs = btmService.listAttributeByBtmId(btmTypeVO.getId());
+ List<OsBtmTypeAttributeVO> boAttrs = null;
+ try {
+ boAttrs = btmService.listAttributeByBtmId(btmTypeVO.getId());
+ } catch (PLException e) {
+ e.printStackTrace();
+ String exceptionMessage = VciBaseUtil.getExceptionMessage(e);
+ logger.error(exceptionMessage);
+ throw new VciBaseException(exceptionMessage);
+ }
List<OsBtmTypeAttributeVO> attrList = boAttrs.stream().filter(s->{
boolean usedFlag = true;
if(StringUtils.isNotBlank(attrId) && !s.getId().contains(attrId)){
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebCodeGenSchemaController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebCodeGenSchemaController.java
index ec1b0dd..c6666a8 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebCodeGenSchemaController.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebCodeGenSchemaController.java
@@ -1,5 +1,7 @@
package com.vci.web.controller;
+import com.vci.corba.common.PLException;
+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;
@@ -7,6 +9,7 @@
import com.vci.starter.web.util.LangBaseUtil;
import com.vci.dto.OsCodeGenSchemaDTO;
import com.vci.pagemodel.OsCodeGenSchemaVO;
+import com.vci.starter.web.util.VciBaseUtil;
import com.vci.web.service.OsCodeGenSchemaServiceI;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -71,8 +74,14 @@
*/
@PostMapping(value = "/productCodeFile")
public BaseResult productCodeFile(String oid){
- codeGenSchemaService.productCodeFile(oid);
- return BaseResult.success();
+ try {
+ codeGenSchemaService.productCodeFile(oid);
+ return BaseResult.success();
+ } catch (PLException e) {
+ e.printStackTrace();
+ String exceptionMessage = VciBaseUtil.getExceptionMessage(e);
+ throw new VciBaseException(exceptionMessage);
+ }
}
/**
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/enumpck/ActionEnum.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/enumpck/ActionEnum.java
new file mode 100644
index 0000000..538646b
--- /dev/null
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/enumpck/ActionEnum.java
@@ -0,0 +1,132 @@
+package com.vci.web.enumpck;
+import com.vci.pagemodel.KeyValue;
+import com.vci.starter.web.enumpck.BaseEnum;
+import java.util.ArrayList;
+import java.util.List;
+/**
+ * Action鏋氫妇
+ * @author yuxc
+ *
+ */
+public enum ActionEnum implements BaseEnum{
+ EXP_CHOOSE("0","閫夋嫨"),
+ EXP_ALL("1","鍏ㄩ儴"),
+ EXP_PAGE("2","椤电爜"),
+ CLOUMN_PLNAME("鍚嶇О","plName"),
+ CLOUMN_PLCODE("缂栧彿","plCode"),
+ CLOUMN_PLBSURL("绫昏矾寰�","plBSUrl"),
+ CLOUMN_PLCSCLASS("閾炬帴鍦板潃","plCSClass"),
+ CLOUMN_PLDESC("鎻忚堪","plDesc"),
+ CLOUMN_PLTYPETYPE("绫诲瀷","plTypeType");
+ /**
+ * 鏋氫妇鐨勫��
+ */
+ private String value;
+
+ /**
+ * 鏋氫妇鏄剧ず鏂囨湰
+ */
+ private String text;
+
+ /**
+ * 鑾峰彇鏋氫妇鍊�
+ *
+ * @return 鏋氫妇鍊�
+ */
+ @Override
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * 璁剧疆鏋氫妇鍊�
+ *
+ * @param value 鏋氫妇鍊�
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ /**
+ * 鑾峰彇鏋氫妇鏄剧ず鏂囨湰
+ *
+ * @return 鏄剧ず鏂囨湰
+ */
+ @Override
+ public String getText() {
+ return text;
+ }
+
+ /**
+ * 璁剧疆鏄剧ず鏂囨湰
+ *
+ * @param text 鏄剧ず鏂囨湰
+ */
+ public void setText(String text) {
+ this.text = text;
+ }
+ ActionEnum(String value, String text) {
+ this.value = value;
+ this.text = text;
+ }
+
+
+ /**
+ * 鏍规嵁鍚嶇О鑾峰彇瀵瑰簲鐨勬灇涓惧��
+ *
+ * @param text 鍚嶇О
+ * @return 鏋氫妇鍊�
+ */
+ public static String getValueByText(String text) {
+ for (ActionEnum actionEnum : ActionEnum.values()) {
+ if (actionEnum.getText().equalsIgnoreCase(text)) {
+ return actionEnum.getValue();
+ }
+ }
+ return "";
+ }
+
+ /**
+ * 鏍规嵁鏋氫妇鍊艰幏鍙栧悕绉�
+ *
+ * @param value 鏋氫妇鍊�
+ * @return 鍚嶇О
+ */
+ public static String getTextByValue(String value) {
+ for (ActionEnum actionEnum : ActionEnum.values()) {
+ if (actionEnum.getValue().equalsIgnoreCase(value)) {
+ return actionEnum.getText();
+ }
+ }
+ return "";
+ }
+ /**
+ * 鏍规嵁鏋氫妇鍊艰幏鍙栨灇涓惧璞�
+ *
+ * @param value 鏋氫妇鍊�
+ * @return 鏋氫妇瀵硅薄锛屼笉瀛樺湪鏃跺�欒繑鍥瀗ull
+ */
+ public static ActionEnum forValue(String value) {
+ for (ActionEnum actionEnum : ActionEnum.values()) {
+ if (actionEnum.getValue().equalsIgnoreCase(value)) {
+ return actionEnum;
+ }
+ }
+ return null;
+ }
+ /**
+ * 鏍规嵁鏋氫妇鍊艰幏鍙栧悕绉�
+ *
+ * @return 鍚嶇О
+ */
+ public static List<KeyValue> getActionAll() {
+ List<KeyValue> enumDataList=new ArrayList<>();
+ for (ActionEnum actionEnum : ActionEnum.values()) {
+ KeyValue enumData=new KeyValue();
+ enumData.setKey(actionEnum.value);
+ enumData.setValue(actionEnum.text);
+ enumDataList.add(enumData);
+ }
+ return enumDataList;
+ }
+}
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/enumpck/PlTypetypeEnum.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/enumpck/PlTypetypeEnum.java
new file mode 100644
index 0000000..dd37809
--- /dev/null
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/enumpck/PlTypetypeEnum.java
@@ -0,0 +1,128 @@
+package com.vci.web.enumpck;
+
+import com.vci.pagemodel.KeyValue;
+import com.vci.starter.web.enumpck.BaseEnum;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Action鏋氫妇
+ * @author yuxc
+ *
+ */
+public enum PlTypetypeEnum implements BaseEnum{
+ BUSINESS("business","涓氬姟绫诲瀷"),
+ LINK("link","閾炬帴绫诲瀷");
+ /**
+ * 鏋氫妇鐨勫��
+ */
+ private String value;
+
+ /**
+ * 鏋氫妇鏄剧ず鏂囨湰
+ */
+ private String text;
+
+ /**
+ * 鑾峰彇鏋氫妇鍊�
+ *
+ * @return 鏋氫妇鍊�
+ */
+ @Override
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * 璁剧疆鏋氫妇鍊�
+ *
+ * @param value 鏋氫妇鍊�
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ /**
+ * 鑾峰彇鏋氫妇鏄剧ず鏂囨湰
+ *
+ * @return 鏄剧ず鏂囨湰
+ */
+ @Override
+ public String getText() {
+ return text;
+ }
+
+ /**
+ * 璁剧疆鏄剧ず鏂囨湰
+ *
+ * @param text 鏄剧ず鏂囨湰
+ */
+ public void setText(String text) {
+ this.text = text;
+ }
+ PlTypetypeEnum(String value, String text) {
+ this.value = value;
+ this.text = text;
+ }
+
+
+ /**
+ * 鏍规嵁鍚嶇О鑾峰彇瀵瑰簲鐨勬灇涓惧��
+ *
+ * @param text 鍚嶇О
+ * @return 鏋氫妇鍊�
+ */
+ public static String getValueByText(String text) {
+ for (PlTypetypeEnum actionEnum : PlTypetypeEnum.values()) {
+ if (actionEnum.getText().equalsIgnoreCase(text)) {
+ return actionEnum.getValue();
+ }
+ }
+ return "";
+ }
+
+ /**
+ * 鏍规嵁鏋氫妇鍊艰幏鍙栧悕绉�
+ *
+ * @param value 鏋氫妇鍊�
+ * @return 鍚嶇О
+ */
+ public static String getTextByValue(String value) {
+ for (PlTypetypeEnum actionEnum : PlTypetypeEnum.values()) {
+ if (actionEnum.getValue().equalsIgnoreCase(value)) {
+ return actionEnum.getText();
+ }
+ }
+ return "";
+ }
+ /**
+ * 鏍规嵁鏋氫妇鍊艰幏鍙栨灇涓惧璞�
+ *
+ * @param value 鏋氫妇鍊�
+ * @return 鏋氫妇瀵硅薄锛屼笉瀛樺湪鏃跺�欒繑鍥瀗ull
+ */
+ public static PlTypetypeEnum forValue(String value) {
+ for (PlTypetypeEnum actionEnum : PlTypetypeEnum.values()) {
+ if (actionEnum.getValue().equalsIgnoreCase(value)) {
+ return actionEnum;
+ }
+ }
+ return null;
+ }
+ /**
+ * 鏍规嵁鏋氫妇鍊艰幏鍙栧悕绉�
+ *
+ * @return 鍚嶇О
+ */
+ public static List<KeyValue> getActionAll() {
+ List<KeyValue> enumDataList=new ArrayList<>();
+ for (PlTypetypeEnum actionEnum : PlTypetypeEnum.values()) {
+ KeyValue enumData=new KeyValue();
+ enumData.setKey(actionEnum.value);
+ enumData.setValue(actionEnum.text);
+ enumDataList.add(enumData);
+ }
+ return enumDataList;
+ }
+}
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/other/BtmQTExportData.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/other/BtmQTExportData.java
new file mode 100644
index 0000000..4c293f3
--- /dev/null
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/other/BtmQTExportData.java
@@ -0,0 +1,65 @@
+package com.vci.web.other;
+
+import com.vci.corba.omd.btm.BizType;
+import com.vci.corba.omd.ltm.LinkType;
+import com.vci.corba.omd.qtm.QTD;
+import com.vci.corba.omd.qtm.QTInfo;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 鏌ヨ涓氬姟绫诲瀷妯℃澘瀵煎嚭鏁版嵁绫伙細鍙簭鍒楀寲涓烘ā鏉挎枃浠�,鍚屾椂涔熷吋瀵煎嚭鏁版嵁鎺у埗绫�
+ * @Title :QTExportData.java
+ * @Description :
+ * @Copyright :瀹忓崥杩滆揪绉戞妧鏈夐檺鍏徃
+ * @Author :骞冲彴涓庤鍒掗儴/ZhongGY/E-mail:zhonggy@vci-tech.com
+ * @Date :2015-6-8
+ * @Version :1
+ * @Other :浜х敓娉ㄩ噴:Alt+Shift+J
+ */
+public class BtmQTExportData implements Serializable{
+
+ private static final long serialVersionUID = 1L;
+
+
+ /**
+ * 闇�瑕佸簭鍒楀寲鐨勬ā鏉挎暟鎹�
+ */
+ //
+ private Map<String/*绫诲瀷鍚嶇О*/, BizType/*绫诲瀷瀵硅薄*/> selectedBtmItems = new HashMap<String, BizType>();
+ private Map<String/*绫诲瀷鍚嶇О*/,String[]/*绫诲瀷鎵�灞炲睘鎬�*/> selectedBtmAttrs = new HashMap<String, String[]>();
+ private Map<String/*鏌ヨ妯℃澘鍚嶇О*/, QTInfo/*鏌ヨ妯℃澘瀵硅薄*/> allSelectedQTs = new HashMap<String, QTInfo>();
+ private Map<String/*绫诲瀷鍚嶇О*/, QTD[]/*鏌ヨ妯℃澘瀹氫箟*/> allQTDs = new HashMap<String, QTD[]>();
+
+
+ public Map<String, BizType> getSelectedBtmItems() {
+ return selectedBtmItems;
+ }
+
+ public void setSelectedBtmItems(Map<String, BizType> selectedBtmItems) {
+ this.selectedBtmItems = selectedBtmItems;
+ }
+
+ public Map<String, String[]> getSelectedBtmAttrs() {
+ return selectedBtmAttrs;
+ }
+
+ public void setSelectedBtmAttrs(Map<String, String[]> selectedBtmAttrs) {
+ this.selectedBtmAttrs = selectedBtmAttrs;
+ }
+
+ public Map<String, QTD[]> getAllQTDs() {
+ return allQTDs;
+ }
+
+ public void setAllQTDs(Map<String, QTD[]> allQTDs) {
+ this.allQTDs = allQTDs;
+ }
+
+ public Map<String, QTInfo> getAllQTs() {
+ return allSelectedQTs;
+ }
+
+}
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsActionServiceI.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsActionServiceI.java
index 26e0397..07d7105 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsActionServiceI.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsActionServiceI.java
@@ -3,9 +3,11 @@
import com.vci.corba.common.PLException;
import com.vci.dto.PLActionClsDTO;
import com.vci.dto.PLActionDTO;
+import com.vci.dto.PLActionExpDTO;
import com.vci.dto.PLActionQueryDTO;
import com.vci.starter.web.pagemodel.BaseResult;
import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.FileNotFoundException;
@@ -65,4 +67,15 @@
* @return
*/
void exportBeans(List<String> actionOid, HttpServletResponse response) throws PLException, IOException;
+ /**
+ * 瀵煎叆Action
+ * @param file 涓婁紶鐨勬枃浠�
+ * @return
+ */
+ BaseResult impData(MultipartFile file) throws IOException, PLException;
+ /**
+ * 瀵煎嚭Action
+ * @param plActionExpDTO 瀵煎嚭灞炴�ц缃璞�
+ */
+ void exportAction(PLActionExpDTO plActionExpDTO, HttpServletResponse response) throws PLException, IOException;
}
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsBtmServiceI.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsBtmServiceI.java
index 964b250..2d07b7a 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsBtmServiceI.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsBtmServiceI.java
@@ -114,14 +114,14 @@
* @param btmId 涓氬姟绫诲瀷鐨勭紪鍙�
* @return 灞炴�х殑鍐呭
*/
- List<OsBtmTypeAttributeVO> listAttributeByBtmId(String btmId);
+ List<OsBtmTypeAttributeVO> listAttributeByBtmId(String btmId) throws PLException;
/**
* 鏍规嵁涓氬姟绫诲瀷鑾峰彇鍖呭惈鐨勫睘鎬�--鍖呭惈鍩虹灞炴��
* @param btmId 涓氬姟绫诲瀷鐨勭紪鍙�
* @return 灞炴�х殑鍐呭
*/
- List<OsBtmTypeAttributeVO> listAttributeByBtmIdHasDefault(String btmId);
+ List<OsBtmTypeAttributeVO> listAttributeByBtmIdHasDefault(String btmId) throws PLException;
/**
* 鍙傜収涓氬姟绫诲瀷
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsCodeGenSchemaServiceI.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsCodeGenSchemaServiceI.java
index 60b864d..84f113d 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsCodeGenSchemaServiceI.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsCodeGenSchemaServiceI.java
@@ -1,4 +1,5 @@
package com.vci.web.service;
+import com.vci.corba.common.PLException;
import com.vci.starter.web.exception.VciBaseException;
import com.vci.starter.web.pagemodel.DataGrid;
import com.vci.starter.web.pagemodel.PageHelper;
@@ -59,7 +60,7 @@
* @param oid 鏂规鐨勪富閿�
* @throws VciBaseException 鍙傛暟涓虹┖锛屾柟妗堜笉瀛樺湪浼氭姏鍑哄紓甯�
*/
- void productCodeFile(String oid) throws VciBaseException;
+ void productCodeFile(String oid) throws VciBaseException, PLException;
/**
* 棰勮浠g爜鏂囦欢
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsQuereyTemplateServiceI.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsQuereyTemplateServiceI.java
index c4fbb99..4b2f1fa 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsQuereyTemplateServiceI.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsQuereyTemplateServiceI.java
@@ -3,6 +3,7 @@
import com.vci.corba.common.PLException;
import com.vci.corba.omd.ltm.LinkType;
import com.vci.corba.omd.qtm.QTD;
+import com.vci.corba.omd.qtm.QTInfo;
import com.vci.dto.QTInfoDTO;
import com.vci.pagemodel.OsBtmTypeAttributeVO;
import com.vci.pagemodel.OsLinkTypeAttributeVO;
@@ -52,7 +53,6 @@
*/
BaseResult deleteTemplate(String name) throws PLException;
/**
- *
* @param qtInfoDTO 浼犺緭鐨勬暟鎹璞★細
* linkTypeName 閾炬帴绫诲瀷銆�
* rdPositive 鏂瑰悜锛宼rue姝e悜锛宖alse鍙嶅悜
@@ -106,4 +106,52 @@
* @return 鎿嶄綔缁撴灉
*/
BaseResult deleteLinkTemplate(List<String> templateNames) throws PLException;
+
+ /**
+ * 鏌ヨ鏉′欢涓嬬殑鏌ヨ鎸夐挳
+ * @param qtInfoDTO
+ * @return
+ * @throws PLException
+ */
+ BaseResult getCriteriaBtm(QTInfoDTO qtInfoDTO) throws PLException;
+
+ /**
+ * 涓氬姟绫诲瀷鏌ヨ妯℃澘淇濆瓨
+ * @param qtInfoDTO 淇濆瓨浼犺緭瀵硅薄
+ * @return 淇濆瓨缁撴灉
+ */
+ BaseResult btmSave(QTInfoDTO qtInfoDTO) throws PLException;
+
+ /**
+ * 鏇存柊鏁版嵁搴撶粨鏋�
+ * @return 淇濆瓨缁撴灉
+ */
+ BaseResult updateDBStructure() throws PLException;
+
+ /**
+ * 涓氬姟绫诲瀷鏌ヨ妯℃澘鏍戞煡璇紝鐢ㄤ簬鐣岄潰鐨勫鍑哄姛鑳�
+ * @return 鏌ヨ缁撴灉
+ */
+ BaseResult getBtmQtTree() throws PLException;
+
+ /**
+ * 瀵煎嚭涓氬姟绫诲瀷鏌ヨ妯℃澘
+ * names 鏌ヨ妯℃澘鍚�
+ * @return
+ */
+ void expBtmQTTemplate(List<String> names, HttpServletResponse response) throws PLException,IOException ;
+
+ /**
+ * 鏌ヨ鏉′欢涓嬬殑閫夋嫨鏌ヨ妯℃澘瀵硅瘽妗嗭紙鏌ヨ鍏ㄩ儴妯℃澘鍜屾墍瀵瑰簲鐨勪笟鍔$被鍨嬫垨閾炬帴绫诲瀷鍚嶏級
+ * @return
+ */
+ BaseResult getAllQTs() throws PLException;
+
+ /**
+ * 瀵煎叆涓氬姟绫诲瀷鏌ヨ妯℃澘
+ * @param file 涓婁紶鐨勬枃浠�
+ * @return 瀵煎叆缁撴灉
+ */
+ BaseResult impBtmTemplate(MultipartFile file) throws IOException, ClassNotFoundException;
+
}
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..8d8e922 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.PLActionExpDTO;
import com.vci.dto.PLActionQueryDTO;
+import com.vci.pagemodel.OsAttributeVO;
+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 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.*;
@@ -302,7 +309,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 +332,484 @@
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);
+ }
+
+ 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鍒楄〃鏁版嵁
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsBtmServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsBtmServiceImpl.java
index 080e08e..e46d9c8 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsBtmServiceImpl.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsBtmServiceImpl.java
@@ -38,6 +38,7 @@
import com.vci.starter.poi.constant.ExcelLangCodeConstant;
import com.vci.starter.poi.util.ExcelUtil;
import com.vci.starter.web.annotation.log.VciUnLog;
+import com.vci.starter.web.constant.QueryOptionConstant;
import com.vci.starter.web.enumpck.BooleanEnum;
import com.vci.starter.web.exception.VciBaseException;
import com.vci.starter.web.pagemodel.BaseResult;
@@ -358,9 +359,14 @@
* @return 灞炴�х殑鍐呭
*/
@Override
- public List<OsBtmTypeAttributeVO> listAttributeByBtmId(String btmId) {
+ public List<OsBtmTypeAttributeVO> listAttributeByBtmId(String btmId) throws PLException {
VciBaseUtil.alertNotNull(btmId,"涓氬姟绫诲瀷鐨勭紪鍙�");
- OsBtmTypeVO btmTypeVO = getBtmById(btmId);
+ BizType[] bizTypes = platformClientUtil.getBtmService().getBizTypes(btmId);
+ if(Func.isEmpty(bizTypes)){
+ return new ArrayList<>();
+ }
+ BizType bizType = bizTypes[0];
+ OsBtmTypeVO btmTypeVO = btmDO2VO(bizType);
List<OsBtmTypeAttributeVO> attributes = btmTypeVO.getAttributes();
if(attributes == null){
attributes = new ArrayList<>();
@@ -375,7 +381,7 @@
* @return 灞炴�х殑鍐呭
*/
@Override
- public List<OsBtmTypeAttributeVO> listAttributeByBtmIdHasDefault(String btmId) {
+ public List<OsBtmTypeAttributeVO> listAttributeByBtmIdHasDefault(String btmId) throws PLException {
List<OsBtmTypeAttributeVO> attrVOs = listAttributeByBtmId(btmId);
if(attrVOs == null){
attrVOs = new ArrayList<>();
@@ -1216,13 +1222,15 @@
public boolean addIndex(List<IndexObject> indexObjectList) throws PLException {
VciBaseUtil.alertNotNull(indexObjectList,"鏂板鐨勭储寮曚俊鎭�");
String btmName = indexObjectList.get(0).getTypeName();
- String indexNames = indexObjectList.stream().map(IndexObject::getIndexName).collect(Collectors.joining());
+ String indexNames = indexObjectList.stream().map(IndexObject::getIndexName).collect(Collectors.joining(","));
String[] oldindexAttr = {indexNames};
BusinessObject bo;
List<BusinessObject> boList = new ArrayList<>();
//鍏堟煡璇㈠綋鍓嶆坊鍔犵储寮曟槸鍚﹀凡缁忓瓨鍦紝濡傛灉瀛樺湪灏卞厛鍒犻櫎鍐嶆柊澧炲疄鐜版浛鎹㈡搷浣�
Map<String, String> conditionMap = new HashMap<>();
conditionMap.put("typename",btmName);
+ //鍏堣繖鏍峰鐞嗭紝鍓嶇鐜板湪鍙仛浜嗗崟娆′繚瀛橈紝鎵�浠ヤ笉鐢╥n
+ conditionMap.put("indexname", indexNames);
List<IndexObject> indexObjects = getIndexByCondition(conditionMap);
if(indexObjects!=null && indexObjects.size()>0){
//绱㈠紩涓嶅瓨鍦ㄦ椂鍒犻櫎灏变細鎶ラ敊绱㈠紩涓嶅瓨鍦紝鎵�浠ヨ繖閲屾湁绱㈠紩鎵嶅幓鍒犻櫎
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsCodeGenSchemaServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsCodeGenSchemaServiceImpl.java
index 2bbb45b..edd1a2a 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsCodeGenSchemaServiceImpl.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsCodeGenSchemaServiceImpl.java
@@ -1,6 +1,7 @@
package com.vci.web.service.impl;
import com.alibaba.fastjson.JSONObject;
+import com.vci.corba.common.PLException;
import com.vci.starter.revision.service.RevisionModelUtil;
import com.vci.starter.web.annotation.Column;
import com.vci.starter.web.constant.FrameWorkLcStatusConstant;
@@ -268,7 +269,7 @@
* @throws VciBaseException 鍙傛暟涓虹┖锛屾柟妗堜笉瀛樺湪浼氭姏鍑哄紓甯�
*/
@Override
- public void productCodeFile(String oid) throws VciBaseException {
+ public void productCodeFile(String oid) throws VciBaseException, PLException {
OsCodeGenSchemaDO codeGenSchemaDO = selectByOid(oid);
//澶勭悊涓存椂鏂囦欢澶癸紝鍦ㄤ复鏃舵枃浠跺す涓坊鍔燾odes/{涓氬姟绫诲瀷鐨勮嫳鏂囧悕绉皚
String tempFolder =LocalFileUtil.getProjectFolder();
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 8f49da8..83fd63d 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
@@ -3,11 +3,15 @@
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.ZipUtil;
import com.alibaba.fastjson.JSONObject;
+import com.vci.client.ClientSession;
import com.vci.client.common.oq.OQTool;
+import com.vci.client.common.providers.ClientServiceProvider;
import com.vci.common.qt.object.*;
import com.vci.constant.FrameWorkLangCodeConstant;
import com.vci.corba.common.PLException;
import com.vci.corba.omd.atm.AttributeDef;
+import com.vci.corba.omd.btm.BizType;
+import com.vci.corba.omd.data.BusinessObject;
import com.vci.corba.omd.data.LinkObject;
import com.vci.corba.omd.ltm.LinkType;
import com.vci.corba.omd.qtm.QTD;
@@ -22,8 +26,10 @@
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.pagemodel.DataGrid;
import com.vci.starter.web.pagemodel.Tree;
import com.vci.starter.web.util.*;
+import com.vci.web.other.BtmQTExportData;
import com.vci.web.other.LinkQTExportData;
import com.vci.web.service.*;
import com.vci.web.util.DateUtil;
@@ -32,17 +38,22 @@
import com.vci.web.util.WebUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
+import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
+import org.jdesktop.swingx.JXDatePicker;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
+import javax.swing.*;
+import java.awt.*;
import java.io.*;
import java.util.*;
+import java.util.List;
import java.util.stream.Collectors;
/**
@@ -90,7 +101,7 @@
}
/**
- * 鏌ヨ妯℃澘
+ * 淇濆瓨鏌ヨ妯℃澘
* @param qtd 鏌ヨ妯℃澘瀹炰綋绫�
* @return 淇濆瓨缁撴灉
*/
@@ -150,8 +161,7 @@
}
}
/**
- *
- * @param dataMap 浼犺緭鐨勬暟鎹璞★細
+ * @param qtInfoDTO 浼犺緭鐨勬暟鎹璞★細
* linkTypeName 閾炬帴绫诲瀷銆�
* rdPositive 鏂瑰悜锛宼rue姝e悜锛宖alse鍙嶅悜
* btmName 涓氬姟绫诲瀷鍚嶇О
@@ -163,7 +173,7 @@
*/
@Override
public BaseResult getCriteria(QTInfoDTO qtInfoDTO) throws PLException {
- QueryTemplate qt = getQT(qtInfoDTO);
+ QueryTemplate qt = getQT(qtInfoDTO,true);
String checkInfo = OQTool.checkQT(qt);
if(!checkInfo.equals("OK")){
throw new PLException("500", new String[]{checkInfo});
@@ -189,7 +199,7 @@
qtInfoDTO.setBtmName(obj.btmName);
qtInfoDTO.setQtName(obj.qtName);
qtInfoDTO.setLevelFlag(obj.levelFlag);
-// qtInfoDTO.setQtText(obj.qtText);
+ //qtInfoDTO.setQtText(obj.qtText);
qtInfoDTO.setQtUIText(obj.qtUIText);
if(StringUtils.isNotBlank(obj.qtUIText)){
//灏嗙粰瀹氱殑String鏂囨湰瑙f瀽涓篨ML鏂囨。骞惰繑鍥炴柊鍒涘缓鐨刣ocument
@@ -271,7 +281,7 @@
*/
@Override
public BaseResult linkSave(QTInfoDTO qtInfoDTO) throws PLException {
- QueryTemplate qt = getQT(qtInfoDTO);
+ QueryTemplate qt = getQT(qtInfoDTO,true);
String checkInfo = OQTool.checkQT(qt);
if(!checkInfo.equals("OK")){
throw new PLException("500", new String[]{checkInfo});
@@ -415,17 +425,22 @@
* 缁勮鏌ヨ妯℃澘
* @return
*/
- public QueryTemplate getQT(QTInfoDTO qtInfoDTO) throws PLException {
+ public QueryTemplate getQT(QTInfoDTO qtInfoDTO,boolean isLinkType) throws PLException {
QueryTemplate qt = new QueryTemplate();
- qt.setType(QTConstants.TYPE_LINK);
- //TODO String qtId =
- qt.setLinkType(qtInfoDTO.getBtmName());
- qt.setDirection(qtInfoDTO.getQueryTemplate().getDirection());
- qt.setBtmType(qtInfoDTO.getQueryTemplate().getBtmType());
- qt.setVersion(qtInfoDTO.getQueryTemplate().getVersion());
- qt.setQueryISLeaf(qtInfoDTO.getQueryTemplate().isQueryISLeaf());
- qt.setLevel(qtInfoDTO.getQueryTemplate().getLevel());
+ if(isLinkType){
+ qt.setType(QTConstants.TYPE_LINK);
+ qt.setLinkType(qtInfoDTO.getBtmName());
+ qt.setDirection(qtInfoDTO.getQueryTemplate().getDirection());
+ qt.setBtmType(qtInfoDTO.getQueryTemplate().getBtmType());
+ qt.setVersion(qtInfoDTO.getQueryTemplate().getVersion());
+ qt.setQueryISLeaf(qtInfoDTO.getQueryTemplate().isQueryISLeaf());
+ qt.setLevel(qtInfoDTO.getQueryTemplate().getLevel());
+ }else{
+ qt.setType(QTConstants.TYPE_BTM);
+ qt.setBtmType(qtInfoDTO.getBtmName());
+ }
+
List<String> clauseList = new ArrayList<String>();
//TODO 鏌ヨ鍒� 鏄剧ず鍒�
clauseList.add("*");
@@ -915,7 +930,6 @@
// return qt;
// }
-
/**
* 杩斿洖鏌ヨ鐨勭増鏈�
* @return
@@ -940,7 +954,6 @@
return version;
}
-
/**
* 鏍¢獙鍙傛暟
* @param qtd
@@ -957,7 +970,6 @@
throw new PLException("500", new String[]{"璇ユā鏉垮畾涔夊悕宸茬粡琚娇鐢�, 璇锋洿鎹�"});
}
}
-
/**
* 瀵煎嚭閾炬帴绫诲瀷鏌ヨ妯℃澘
@@ -1143,6 +1155,35 @@
}
}
+ private void getPLQtBtmItem2(String string, BizType bizType, List<BizType> ltsNew) {
+ // TODO Auto-generated method stub
+ try {
+ BizType queryBizType = platformClientUtil.getBtmService().getBizTypes(string)[0];
+ BizType[] btmArray = platformClientUtil.getBtmService().getBizTypes("");
+ String[] strings = queryBizType.apNameArray;
+ boolean b = true;
+ for (int i = 0; i < btmArray.length; i++) {
+ if (btmArray[i].name.equals(string)) {
+ b = false;
+ if (Arrays.equals(bizType.apNameArray, strings)) {
+ btmArray[i].name += "銆愪笟鍔$被鍨嬪凡瀛樺湪銆�";
+ ltsNew.add(btmArray[i]);
+ } else {
+ btmArray[i].name += "銆愪笟鍔$被鍨嬪瓨鍦ㄤ絾灞炴�т笉涓�鑷淬��";
+ ltsNew.add(btmArray[i]);
+ }
+ }
+ }
+ if (b) {
+ bizType.name += "銆愪笟鍔$被鍨嬩笉瀛樺湪銆�";
+ ltsNew.add(bizType);
+ }
+ } catch (PLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
private void getPLQtWrapper(String string, QTInfo qtWrapper, List<LinkType> ltsNew, List<QTInfo> qTWrapperNew, Map<String/*绫诲瀷鍚嶇О*/, QTD[]/*鏌ヨ妯℃澘瀹氫箟*/> newNorepQTDs) {
try {
QTInfo[] qtws = platformClientUtil.getQTDService().getAllQTs();
@@ -1208,6 +1249,71 @@
}
}
+ private void getPLBtmQtWrapper(String string, QTInfo qtWrapper, List<BizType> ltsNew, List<QTInfo> qTWrapperNew, Map<String/*绫诲瀷鍚嶇О*/, QTD[]/*鏌ヨ妯℃澘瀹氫箟*/> newNorepQTDs) {
+ try {
+ QTInfo[] qtws = platformClientUtil.getQTDService().getAllQTs();
+ boolean islaet = true;
+ for (int i = 0; i < qtws.length; i++) {
+ if (string.equals(qtws[i].qtName)) {
+ islaet = false;
+ for (BizType lt : ltsNew) {
+ if (qtWrapper.btmName.equals(lt.name.substring(0,
+ lt.name.indexOf("銆�")))) {
+ if (lt.name.endsWith("銆愪笟鍔$被鍨嬪凡瀛樺湪銆�")) {
+ qtWrapper.qtName += "銆愭煡璇㈡ā鏉垮凡瀛樺湪锛屼笉瀵煎叆銆�";
+ qTWrapperNew.add(qtWrapper);
+ }else if(lt.name.endsWith("銆愪笟鍔$被鍨嬪瓨鍦ㄤ絾灞炴�т笉涓�鑷淬��")){
+ qtWrapper.qtName += "銆愭煡璇㈡ā鏉挎墍灞炰笟鍔$被鍨嬪睘鎬т笉涓�鑷达紝涓嶅鍏ャ��";
+ qTWrapperNew.add(qtWrapper);
+ }else{
+ qtWrapper.qtName += "銆愭煡璇㈡ā鏉挎墍灞炰笟鍔$被鍨嬩笉瀛樺湪锛屼笉瀵煎叆銆�";
+ qTWrapperNew.add(qtWrapper);
+ }
+ }
+ }
+ }
+ }
+ if (islaet) {
+ for (BizType btmItem : ltsNew) {
+ if (qtWrapper.btmName.equals(btmItem.name.substring(0,
+ btmItem.name.indexOf("銆�")))) {
+ if (btmItem.name.endsWith("銆愪笟鍔$被鍨嬪凡瀛樺湪銆�")) {
+ //鍒ゆ柇鏌ヨ妯℃澘瀹氫箟鏄惁瀛樺湪锛岃繘琛屼繚瀛�
+ QTD[] qtds = newNorepQTDs.get(qtWrapper.btmName);
+ if(qtds != null){
+ for (QTD qtd : qtds) {
+ QTD qtdByName = platformClientUtil.getQTDService().getQTDByName(qtd.name);
+ if(!(qtdByName != null && StringUtils.isNotBlank(qtdByName.name))){
+ boolean b = platformClientUtil.getQTDService().addQTD(qtd);
+ if(!b){
+ qtWrapper.qtName += qtWrapper.qtName+"瀵煎叆鏌ヨ妯℃澘瀹氫箟銆�" + qtdByName.name + "銆戝け璐ワ紒";
+ }
+ }
+ }
+ newNorepQTDs.remove(qtWrapper.btmName);
+ }
+ boolean success = platformClientUtil.getQTDService().saveQT(qtWrapper);
+ if(!success){
+ qtWrapper.qtName += qtWrapper.qtName+"瀵煎叆澶辫触锛�";
+ }else {
+ qtWrapper.qtName += "銆愭煡璇㈡ā鏉垮鍏ユ垚鍔燂紒銆�";
+ }
+ qTWrapperNew.add(qtWrapper);
+ }else if(btmItem.name.endsWith("銆愪笟鍔$被鍨嬪瓨鍦ㄤ絾灞炴�т笉涓�鑷淬��")){
+ qtWrapper.qtName += "銆愭煡璇㈡ā鏉挎墍灞炰笟鍔$被鍨嬪睘鎬т笉涓�鑷达紝涓嶅鍏ャ��";
+ qTWrapperNew.add(qtWrapper);
+ }else{
+ qtWrapper.qtName += "銆愭煡璇㈡ā鏉挎墍灞炰笟鍔$被鍨嬩笉瀛樺湪锛屼笉瀵煎叆銆�";
+ qTWrapperNew.add(qtWrapper);
+ }
+ }
+ }
+ }
+ } catch (PLException e) {
+ e.printStackTrace();
+ }
+ }
+
//鏍规嵁閫夋嫨鐨勬煡璇㈡ā鏉胯繃婊ゆā鏉垮畾涔�
private Map<String, QTD[]> getnewNorepQTDs(Map<String, QTD[]> norepQTDs,
Map<String, QTInfo> allQTs) {
@@ -1235,6 +1341,290 @@
if(!b){
return BaseResult.fail("鍒犻櫎澶辫触锛侊紒锛�");
}
- return BaseResult.success();
+ return BaseResult.success("鏌ヨ妯℃澘鍒犻櫎鎴愬姛锛�");
}
+
+ /**
+ * @param qtInfoDTO 浼犺緭鐨勬暟鎹璞★細
+ * linkTypeName 閾炬帴绫诲瀷銆�
+ * rdPositive 鏂瑰悜锛宼rue姝e悜锛宖alse鍙嶅悜
+ * btmName 涓氬姟绫诲瀷鍚嶇О
+ * combRelaType 涓氬姟绫诲瀷閫夋嫨鍊�
+ * versionValue 鐗堟湰鐝鍊�
+ * isQueryIsLeaf 鏄惁閫夋嫨涓嬬骇
+ * level 瀛愯妭鐐瑰眰鏁�
+ * @return 鏌ヨ缁撴灉
+ */
+ @Override
+ public BaseResult getCriteriaBtm(QTInfoDTO qtInfoDTO) throws PLException {
+ QueryTemplate qt = getQT(qtInfoDTO,false);
+ String checkInfo = OQTool.checkQT(qt);
+ if(!checkInfo.equals("OK")){
+ throw new PLException("500", new String[]{checkInfo});
+ }
+ qt.setId("qt1");
+ BusinessObject[] result = platformClientUtil.getQueryService().findBTMObjects(qt.getId(), OQTool.qtTOXMl(qt).asXML());
+ return BaseResult.dataList(Arrays.asList(result));
+ }
+
+ /**
+ * 涓氬姟绫诲瀷鏌ヨ妯℃澘淇濆瓨
+ * @param qtInfoDTO 淇濆瓨浼犺緭瀵硅薄
+ * @return 淇濆瓨缁撴灉
+ */
+ @Override
+ public BaseResult btmSave(QTInfoDTO qtInfoDTO) throws PLException {
+ VciBaseUtil.alertNotNull(
+ qtInfoDTO,"淇濆瓨鐨勪笟鍔$被鍨嬫ā鏉垮璞�",
+ qtInfoDTO.getBtmName(),"璇烽�夋嫨涓氬姟绫诲瀷鍜屾煡璇㈡ā鏉垮畾涔夋潵鍒涘缓鏌ヨ妯℃澘"
+ );
+
+ //add by caill start 閬嶅巻鏅�氭煡璇㈡ā鏉胯緭鍏ユ涓殑鍊煎仛鏍¢獙
+ // ArrayList<String> list = cpm_centerPanel.getList();
+ // for(int i=0;i<list.size();i++){
+ // String text = (String) list.get(i);
+ // if(text.contains("'")){
+ // JOptionPane.showMessageDialog(cp_mainPanel, "鏉′欢鍊间腑鍖呭惈浜嗛潪娉曞瓧绗�", "闈炴硶瀛楃", JOptionPane.ERROR_MESSAGE);
+ // return;
+ // }
+ // }
+ //淇濆瓨涔嬪墠甯﹀嚭宸查�夋嫨鐨剄tName
+ QueryTemplate qt = getQT(qtInfoDTO,false);
+ //鍓嶇璋冪敤杩欎釜鏂规硶isExistsQT()
+ /*if(isExists(qtName)){
+ return BaseResult.success("","璇ユ煡璇㈡ā鏉垮悕宸茬粡瀛樺湪,鏄惁瑕嗙洊锛�");
+ }*/
+ String checkInfo = OQTool.checkQT(qt);
+ if(!checkInfo.equals("OK")){
+ throw new PLException("500", new String[]{checkInfo});
+ }
+ //璁剧疆鎺掑簭淇℃伅
+ qt.setOrderInfoList(qtInfoDTO.getQueryTemplate().getOrderInfoList());
+ QTInfo qtWrapper = new QTInfo();
+ qtWrapper.qtName = qtInfoDTO.getQtName();
+ qtWrapper.btmName = qt.getBtmType();
+ qtWrapper.creator = WebUtil.getCurrentUserId();
+ qtWrapper.createTime = System.currentTimeMillis();
+ if(qtInfoDTO.getTree() == null){
+ qtWrapper.qtUIText = "";
+ }else{
+ //褰撳嬀閫変簡楂樼骇鏌ヨ鏃堕渶瑕佸鐞嗛珮绾ф煡璇㈢殑鐩稿叧鏉′欢
+ qtWrapper.qtUIText = getSeniorXML(qtInfoDTO);
+ }
+ qtWrapper.levelFlag = qtInfoDTO.getLevelFlag();
+ qtWrapper.qtText = OQTool.qtTOXMl(qt).asXML();
+ boolean saveFlag = platformClientUtil.getQTDService().saveQT(qtWrapper);
+ if(saveFlag){
+ return BaseResult.success("淇濆瓨鏌ヨ妯℃澘鎴愬姛");
+ }else{
+ return BaseResult.fail("淇濆瓨鏌ヨ妯℃澘澶辫触");
+ }
+ }
+
+ /**
+ * 鏇存柊鏁版嵁搴撶粨鏋�
+ * @return 淇濆瓨缁撴灉
+ */
+ @Override
+ public BaseResult updateDBStructure() throws PLException {
+ boolean f = platformClientUtil.getQTDService().updateQT();
+ if(f){
+ return BaseResult.success("鏇存柊鎴愬姛");
+ }else{
+ return BaseResult.fail("鏇存柊澶辫触");
+ }
+ }
+
+ /**
+ * 涓氬姟绫诲瀷鏌ヨ妯℃澘鏍戞煡璇紝鐢ㄤ簬鐣岄潰鐨勫鍑哄姛鑳�
+ * @return 鏌ヨ缁撴灉
+ */
+ @Override
+ public BaseResult getBtmQtTree() throws PLException {
+ BizType[] bizTypes= null;
+ QTInfo[] qts = null;
+ HashMap<String,Object> tree = new HashMap();
+ tree.put("text","涓氬姟绫诲瀷");
+ if (bizTypes == null) {
+ List<BizType> es = new ArrayList<>();
+ bizTypes = platformClientUtil.getBtmService().getBizTypes("");
+ for (BizType lt : bizTypes) {
+ QTInfo[] qtWrappers = platformClientUtil.getQTDService().getObjTypeQTs(lt.name);
+ if (qtWrappers.length!=0) {
+ es.add(lt);
+ }
+ }
+ bizTypes = es.toArray(new BizType[es.size()]);
+ //TODO:闇�淇娌℃湁鍏宠仈鏌ヨ妯℃澘涓氬姟绫诲瀷鍘绘帀
+ qts = platformClientUtil.getQTDService().getAllQTs();//鑾峰彇鎵�鏈夋煡璇㈡ā鏉�
+ }
+ List<HashMap<String,Object>> childList = new ArrayList<>();
+ //娣诲姞涓氬姟绫诲瀷鏍硅妭鐐�
+ for (BizType plAction : bizTypes) {
+ HashMap<String,Object> childTree = new HashMap();
+ childTree.put("text", plAction.label + "/" +plAction.name);
+ childTree.put("oid", plAction.oid);
+ //tree.put("children", childTree);
+ addExportTreeNode(plAction, qts, childTree);
+ childList.add(childTree);
+ }
+ tree.put("children", childList);
+ return BaseResult.success(tree);
+ }
+
+ /**
+ * 瀵煎嚭涓氬姟绫诲瀷鏌ヨ妯℃澘
+ * names 鏌ヨ妯℃澘鍚�
+ * @return
+ */
+ @Override
+ public void expBtmQTTemplate(List<String> names, HttpServletResponse response) throws PLException, IOException {
+ String defaultTempFolder = LocalFileUtil.getDefaultTempFolder();
+ String vciqtmfFileName = defaultTempFolder + File.separator + "BtmTemplateExp" + new Date().getTime() + ".vciqtf";
+ BtmQTExportData exportData = new BtmQTExportData();
+ for (String name : names) {
+ QTInfo qt = platformClientUtil.getQTDService().getQT(name);
+ exportData.getAllQTs().put(qt.qtName,qt);
+ BizType[] bizTypes = platformClientUtil.getBtmService().getBizTypes(qt.btmName);
+ for (int i = 0; i < bizTypes.length; i++) {
+ BizType bizType = bizTypes[i];
+ if(bizTypes != null && !bizType.oid.equals("")){
+ exportData.getSelectedBtmItems().put(bizType.name, bizType);
+ exportData.getSelectedBtmAttrs().put(bizType.name, bizType.apNameArray);
+ exportData.getAllQTDs().put(bizType.name, platformClientUtil.getQTDService().getBizTypeQTDs(bizType.name));
+ }
+ }
+ }
+ ObjectOutputStream vciamfFileStream = null;
+ try {
+ File vciqtmfFile = new File(vciqtmfFileName);
+ vciamfFileStream = new ObjectOutputStream(new FileOutputStream(vciqtmfFile));
+ vciamfFileStream.writeObject(exportData);
+ }finally {
+ try {
+ if (vciamfFileStream != null) {
+ vciamfFileStream.flush();
+ vciamfFileStream.close();
+ }
+ } catch (Exception e) {
+ throw new PLException("500",new String[]{"瀵煎嚭娴佸叧闂紓甯革紒"});
+ }
+ }
+ ControllerUtil.writeFileToResponse(response,vciqtmfFileName);
+ FileUtil.del(defaultTempFolder + File.separator);
+ }
+
+ /**
+ * 鏌ヨ鏉′欢涓嬬殑閫夋嫨鏌ヨ妯℃澘瀵硅瘽妗嗭紙鏌ヨ鍏ㄩ儴妯℃澘鍜屾墍瀵瑰簲鐨勪笟鍔$被鍨嬫垨閾炬帴绫诲瀷鍚嶏級
+ * @return
+ */
+ @Override
+ public BaseResult getAllQTs() throws PLException {
+ QTInfo[] allQTs = platformClientUtil.getQTDService().getAllQTs();
+ DataGrid<QTInfo> dataGrid = new DataGrid<>();
+ dataGrid.setData(Arrays.asList(allQTs));
+ dataGrid.setTotal(allQTs.length);
+ return BaseResult.dataGrid(dataGrid);
+ }
+
+ /**
+ * 瀵煎叆涓氬姟绫诲瀷鏌ヨ妯℃澘
+ * @param file 涓婁紶鐨勬枃浠�
+ * @return 瀵煎叆缁撴灉
+ */
+ @Override
+ public BaseResult impBtmTemplate(MultipartFile file) throws IOException, ClassNotFoundException {
+ if (file == null) {
+ return BaseResult.fail(FrameWorkLangCodeConstant.IMPORT_FAIL, new String[]{"鏃犲鍏ョ殑鏂囦欢"});
+ }
+ if (!file.getOriginalFilename().endsWith(".vciqtf")) {
+ throw new VciBaseException("浠呰兘涓婁紶.vciqtf鏍煎紡鏂囦欢锛岃閲嶆柊涓婁紶锛�");
+ }
+ ObjectInputStream obj = new ObjectInputStream(
+ file.getInputStream());
+ BtmQTExportData qtExportData = (BtmQTExportData) obj.readObject();
+ List<BizType> ltsNew = new ArrayList<>();
+ List<QTInfo> qTWrapperNew = new ArrayList<>();
+ Map<String/* 绫诲瀷鍚嶇О */, QTD[]/* 鏌ヨ妯℃澘瀹氫箟 */> norepQTDs = new HashMap<String, QTD[]>();
+ addImportBtmData(qtExportData, ltsNew, qTWrapperNew, norepQTDs);
+ QTInfo[] qts = qTWrapperNew
+ .toArray(new QTInfo[qTWrapperNew.size()]);
+ //澶勭悊鏍戠殑杩斿洖
+ HashMap<String,Object> tree = new HashMap();
+ tree.put("text","涓氬姟绫诲瀷");
+ List<HashMap<String,Object>> childList = new ArrayList<>();
+ //娣诲姞涓氬姟绫诲瀷鏍硅妭鐐�
+ for (BizType plAction : ltsNew) {
+ HashMap<String,Object> childTree = new HashMap();
+ childTree.put("text", plAction.label + "/" +plAction.name);
+ childTree.put("oid", plAction.oid);
+ addExportTreeNode(plAction, qts, childTree);
+ childList.add(childTree);
+ }
+ tree.put("children", childList);
+ return BaseResult.success(tree);
+ }
+
+ // 鏁版嵁杩囨护
+ private void addImportBtmData(BtmQTExportData qtExportData, List<BizType> ltsNew, List<QTInfo> qTWrapperNew,
+ Map<String/* 绫诲瀷鍚嶇О */, QTD[]/* 鏌ヨ妯℃澘瀹氫箟 */> norepQTDs) {
+ Map<String/* 绫诲瀷鍚嶇О */, QTD[]/* 鏌ヨ妯℃澘瀹氫箟 */> allQTDs = qtExportData
+ .getAllQTDs();
+ Map<String/* 绫诲瀷鍚嶇О */, BizType/* 绫诲瀷瀵硅薄 */> selectedBtmItems = qtExportData
+ .getSelectedBtmItems();
+ Map<String/* 绫诲瀷鍚嶇О */, String[]/* 绫诲瀷鎵�灞炲睘鎬� */> selectedBtmAttrs = qtExportData
+ .getSelectedBtmAttrs();
+ Map<String/* 鏌ヨ妯℃澘鍚嶇О */, QTInfo/* 鏌ヨ妯℃澘瀵硅薄 */> allSelectedQTs = qtExportData
+ .getAllQTs();
+ if (allQTDs.size() == 0 || allQTDs == null
+ || selectedBtmItems.size() == 0 || selectedBtmItems == null
+ || selectedBtmAttrs.size() == 0 || selectedBtmAttrs == null
+ || allSelectedQTs.size() == 0 || allSelectedQTs == null) {
+ throw new VciBaseException("瀵煎叆鐨勬ā鏉挎暟鎹湁璇�!!!");
+ }
+ Set<Map.Entry<String, QTD[]>> pLActions = allQTDs.entrySet();
+ Set<Map.Entry<String, QTInfo>> pLQts = allSelectedQTs.entrySet();
+ Set<Map.Entry<String, BizType>> btmpLQts = selectedBtmItems.entrySet();
+ for (Map.Entry<String, QTD[]> entry : pLActions) {
+ String string = entry.getKey();
+ QTD[] qtds = entry.getValue();
+ getPLQtIsInDB(string, qtds, norepQTDs);
+ }
+ for (Map.Entry<String, BizType> entry : btmpLQts) {
+ String string = entry.getKey();
+ BizType bizType = entry.getValue();
+ getPLQtBtmItem2(string, bizType, ltsNew);
+ }
+ Map<String/*绫诲瀷鍚嶇О*/, QTD[]/*鏌ヨ妯℃澘瀹氫箟*/> newNorepQTDs = getnewNorepQTDs(norepQTDs,allSelectedQTs);
+ for (Map.Entry<String, QTInfo> entry : pLQts) {
+ String string = entry.getKey();
+ QTInfo qtWrapper = entry.getValue();
+ getPLBtmQtWrapper(string, qtWrapper, ltsNew, qTWrapperNew, newNorepQTDs);
+ }
+
+ }
+
+ /**
+ * 鐢熸垚瀵煎嚭鏍戦�夋嫨浠ュ強瀵煎叆鏍戞樉绀�
+ * @param bizType
+ * @param qts
+ * @param tree
+ */
+ private void addExportTreeNode(BizType bizType/*涓氬姟绫诲瀷*/,QTInfo[] qts/*鏌ヨ妯℃澘瀵硅薄*/,HashMap<String,Object> tree) {
+ List<String> childList = new ArrayList<>();
+ // 娣诲姞鏌ヨ妯℃澘瀵硅薄瀛愯妭鐐�
+ for (QTInfo qtItem : qts) {
+ //澶勭悊瀵煎叆鏃舵棤娉曡繘琛岀被鍨嬪垽鏂�
+ int splitLength = bizType.name.indexOf("銆�");
+ if(splitLength == -1){
+ splitLength = bizType.name.length();
+ }
+ if (qtItem.btmName.equals(bizType.name.substring(0,
+ splitLength))) {
+ childList.add(qtItem.qtName);
+ }
+ }
+ tree.put("children",childList);
+ }
+
}
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBtmIOServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBtmIOServiceImpl.java
index b8724f9..7faff82 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBtmIOServiceImpl.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBtmIOServiceImpl.java
@@ -851,7 +851,13 @@
if(!CollectionUtils.isEmpty(btmTypeVOList)) {
btmTypeVOList.stream().forEach(btmTypeVO -> {
String btmId = btmTypeVO.getId();
- List<OsBtmTypeAttributeVO> attributeVOS = btmService.listAttributeByBtmId(btmId);
+ List<OsBtmTypeAttributeVO> attributeVOS = null;
+ try {
+ attributeVOS = btmService.listAttributeByBtmId(btmId);
+ } catch (PLException e) {
+ e.printStackTrace();
+ throw new VciBaseException(VciBaseUtil.getExceptionMessage(e));
+ }
//鍏堟槸鍚嶇О
int rowIndex = index[0];
WriteExcelData idED = new WriteExcelData(rowIndex, 0, btmId);
--
Gitblit v1.9.3