From 0f4bac6483639a3be54d8fa311e005a2a3c99885 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期五, 27 九月 2024 17:45: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/UIManagerController.java | 339 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 325 insertions(+), 14 deletions(-)
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/UIManagerController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/UIManagerController.java
index d686499..547d42d 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/UIManagerController.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/UIManagerController.java
@@ -1,19 +1,26 @@
package com.vci.web.controller;
+import cn.hutool.core.io.FileUtil;
+import com.vci.constant.FrameWorkLangCodeConstant;
import com.vci.corba.common.PLException;
-import com.vci.corba.portal.data.PLPageDefination;
import com.vci.corba.portal.data.PLTabPage;
import com.vci.corba.portal.data.PLUILayout;
import com.vci.dto.UIAuthorDTO;
+import com.vci.pagemodel.PLDefinationVO;
+import com.vci.pagemodel.PLTabButtonVO;
import com.vci.pagemodel.PLUILayoutCloneVO;
import com.vci.starter.web.annotation.log.VciBusinessLog;
import com.vci.starter.web.exception.VciBaseException;
import com.vci.starter.web.pagemodel.BaseQueryObject;
import com.vci.starter.web.pagemodel.BaseResult;
import com.vci.starter.web.pagemodel.DataGrid;
+import com.vci.starter.web.util.ControllerUtil;
+import com.vci.starter.web.util.LocalFileUtil;
import com.vci.starter.web.util.VciBaseUtil;
import com.vci.web.service.OsBtmServiceI;
import com.vci.web.service.UIManagerServiceI;
+import com.vci.web.util.Func;
+import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -21,10 +28,12 @@
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
-import javax.xml.crypto.Data;
+import java.io.File;
import java.io.IOException;
-import java.util.Comparator;
+import java.util.Arrays;
+import java.util.Date;
import java.util.List;
+import java.util.Map;
/**
* UI瀹氫箟鎺у埗灞�
@@ -159,26 +168,76 @@
}
/**
+ * 鏌ヨ瑕佸鍑篣I涓婁笅鏂囨爲
+ * @param expDatas
+ * @return
+ * @throws PLException
+ */
+ @GetMapping( "/getExpContextTree")
+ @VciBusinessLog(operateName = "鏌ヨ瑕佸鍑篣I涓婁笅鏂囨爲")
+ public BaseResult getExpContextTree(String[] expDatas){
+ try {
+ return BaseResult.success(uiManagerService.getExpContextTree(Arrays.asList(expDatas)),"Success");
+ }catch (Exception e) {
+ e.printStackTrace();
+ String exceptionMessage = "鏌ヨ瑕佸鍑篣I涓婁笅鏂囨爲鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e);
+ logger.error(exceptionMessage);
+ return BaseResult.fail(exceptionMessage);
+ }
+ }
+
+ /**
* 瀵煎嚭UI涓婁笅鏂�
* name 閾炬帴绫诲瀷鍚嶇О
* @return
*/
- @GetMapping("/expUIContextData")
- public void expUIContextData(String[] oids, HttpServletResponse response) throws PLException, IOException {
- uiManagerService.expUIContextData(oids, response);
+ @PostMapping("/expUIContextData")
+ public void expUIContextData(@RequestBody Map<String,String> expConditionMap, HttpServletResponse response) throws PLException, IOException {
+ try {
+ String excelPath = uiManagerService.expUIContextData(expConditionMap);
+ ControllerUtil.writeFileToResponse(response,excelPath);
+ FileUtil.del(LocalFileUtil.getDefaultTempFolder() + File.separator);
+ } catch (Exception e) {
+ String msg = "瀵煎嚭UI涓婁笅鏂囨椂鍑虹幇閿欒锛屽師鍥狅細" + VciBaseUtil.getExceptionMessage(e);
+ try {
+ //鍑洪敊鏃�
+ e.printStackTrace();
+ ControllerUtil.writeDataToResponse(response,"error_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss") + ".txt", StringUtils.isNotBlank(msg)?msg.getBytes():new byte[0],null);
+ } catch (IOException ioException) {
+ ioException.printStackTrace();
+ }
+ }
}
/**
* 瀵煎叆UI涓婁笅鏂�
* @param file 涓婁紶鐨勬枃浠�
+ * @param isCovered 鏄惁瑕嗙洊
+ * @param selectBtm 閫夋嫨瀵煎叆鍒扮殑涓氬姟绫诲瀷
* @return
*/
- @PostMapping("/impUiContextData")
- public BaseResult impUIContextData(MultipartFile file){try {
- return uiManagerService.impUIContextData(file);
- }catch (Throwable e) {
- throw new VciBaseException(VciBaseUtil.getExceptionMessage(e),new String[0],e);
- }
+ @PostMapping("/impUIContextData")
+ public BaseResult impUIContextData(MultipartFile file, boolean isCovered,String selectBtm){
+ File file1 = null;
+ try {
+ //瑕嗙洊锛屼笉闇�瑕佷紶file
+ if(!isCovered){
+ String excelFileName = LocalFileUtil.getDefaultTempFolder() + File.separator + LocalFileUtil.getFileNameForIE(file.getOriginalFilename());
+ file1 = new File(excelFileName);
+ file.transferTo(new File(excelFileName));
+ }
+ if (file != null || isCovered) {
+ return uiManagerService.impUIContextData(file1, isCovered,selectBtm);
+ } else {
+ return BaseResult.fail(FrameWorkLangCodeConstant.IMPORT_FAIL, new String[]{"鏃犲鍏ョ殑鏂囦欢"});
+ }
+ }catch (Throwable e) {
+ throw new VciBaseException(VciBaseUtil.getExceptionMessage(e),new String[0],e);
+ }finally {
+ if(!isCovered){
+ file1.delete();
+ }
+ }
}
/**
@@ -252,7 +311,7 @@
}
/**
- * 鍒犻櫎鏁版嵁
+ * 鍒犻櫎鍖哄煙瀹氫箟鏁版嵁
* @param oids
* @return
*/
@@ -263,6 +322,258 @@
} catch (PLException e) {
e.printStackTrace();
String exceptionMessage = "鍒犻櫎鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e);
+ logger.error(exceptionMessage);
+ return BaseResult.fail(exceptionMessage);
+ }
+ }
+
+ //椤甸潰璁捐鐩稿叧鎺ュ彛
+ /**
+ * 鏌ヨ椤甸潰璁捐瀹氫箟
+ * @param pageContextOId
+ * @return
+ */
+ @GetMapping( "/getPLPageDefinations")
+ @VciBusinessLog(operateName = "鏌ヨ椤甸潰璁捐瀹氫箟")
+ public BaseResult<DataGrid> getPLPageDefinations(String pageContextOId){
+ try {
+ return BaseResult.dataGrid(uiManagerService.getPLPageDefinations(pageContextOId));
+ }catch (Exception e) {
+ e.printStackTrace();
+ String exceptionMessage = "鏌ヨ椤甸潰璁捐瀹氫箟鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e);
+ logger.error(exceptionMessage);
+ return BaseResult.fail(exceptionMessage);
+ }
+ }
+
+ /**
+ * 娣诲姞椤甸潰瀹氫箟
+ * @param pdVO
+ * @return 淇濆瓨缁撴灉
+ */
+ @PostMapping("/addPageDefination")
+ public BaseResult addPageDefination(@RequestBody PLDefinationVO pdVO){
+ try {
+ return uiManagerService.addPageDefination(pdVO) ? BaseResult.success("椤甸潰瀹氫箟娣诲姞鎴愬姛锛�"):BaseResult.fail("椤甸潰瀹氫箟娣诲姞澶辫触锛�");
+ } catch (Throwable e) {
+ e.printStackTrace();
+ String exceptionMessage = "椤甸潰瀹氫箟娣诲姞鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e);
+ logger.error(exceptionMessage);
+ return BaseResult.fail(exceptionMessage);
+ }
+ }
+
+ /**
+ * 淇敼椤甸潰瀹氫箟鏁版嵁
+ * @param pdVO
+ * @return 淇敼缁撴灉
+ */
+ @PutMapping("/updatePageDefination")
+ public BaseResult updatePageDefination(@RequestBody PLDefinationVO pdVO){
+ try {
+ return uiManagerService.updatePageDefination(pdVO) ? BaseResult.success("淇敼椤甸潰瀹氫箟鎴愬姛锛�"):BaseResult.fail("淇敼椤甸潰瀹氫箟澶辫触锛�");
+ } catch (Throwable e) {
+ e.printStackTrace();
+ String exceptionMessage = "淇敼椤甸潰瀹氫箟鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e);
+ logger.error(exceptionMessage);
+ return BaseResult.fail(exceptionMessage);
+ }
+ }
+
+ /**
+ * 鍒犻櫎椤甸潰瀹氫箟鏁版嵁
+ * @param oids
+ * @return
+ */
+ @DeleteMapping("/delPageDefination")
+ public BaseResult delPageDefination(String[] oids){
+ try {
+ return uiManagerService.delPageDefination(oids) ? BaseResult.success("鍒犻櫎椤甸潰瀹氫箟鎴愬姛锛�"):BaseResult.fail("鍒犻櫎椤甸潰瀹氫箟鏁版嵁澶辫触锛�");
+ } catch (PLException e) {
+ e.printStackTrace();
+ String exceptionMessage = "鍒犻櫎椤甸潰瀹氫箟鏁版嵁鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e);
+ logger.error(exceptionMessage);
+ return BaseResult.fail(exceptionMessage);
+ }
+ }
+
+
+ /**
+ * 涓氬姟绫诲瀷涓嬫媺鏌ヨ
+ * @param baseQueryObject selectBtmType 閫夋嫨鐨勬簮瀵硅薄,甯﹀垎椤典俊鎭�
+ * @return
+ * @throws PLException
+ */
+ @GetMapping( "/getBtmDatasByPage")
+ @VciBusinessLog(operateName = "涓氬姟绫诲瀷涓嬫媺鏌ヨ")
+ public BaseResult getBtmDatasByPage(BaseQueryObject baseQueryObject){
+ try {
+ return BaseResult.dataGrid(uiManagerService.getBtmDatasByPage(baseQueryObject));
+ }catch (Throwable e) {
+ e.printStackTrace();
+ String exceptionMessage = "涓氬姟绫诲瀷涓嬫媺鏌ヨ鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e);
+ logger.error(exceptionMessage);
+ return BaseResult.fail(exceptionMessage);
+ }
+ }
+
+ /**
+ * UI瀹氫箟涓嬫媺鏌ヨ锛坱emplateType涓篣I瀹氫箟鏃剁殑閫夋嫨瀵硅薄涓嬫媺鏌ヨ锛�
+ * @param baseQueryObject selectBtmType 閫夋嫨鐨勬簮瀵硅薄,甯﹀垎椤典俊鎭�
+ * @return
+ * @throws PLException
+ */
+ @GetMapping( "/getUILayoutDatasByPage")
+ @VciBusinessLog(operateName = "UI瀹氫箟涓嬫媺鏌ヨ")
+ public BaseResult getUILayoutDatasByPage(BaseQueryObject baseQueryObject){
+ try {
+ return BaseResult.dataGrid(uiManagerService.getUILayoutDatasByPage(baseQueryObject));
+ }catch (Throwable e) {
+ e.printStackTrace();
+ String exceptionMessage = "UI瀹氫箟涓嬫媺鏌ヨ鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e);
+ logger.error(exceptionMessage);
+ return BaseResult.fail(exceptionMessage);
+ }
+ }
+
+ /**
+ * 閫夋嫨妯℃澘涓嬫媺鏌ヨ
+ * @param baseQueryObject
+ * @return
+ * @throws PLException
+ */
+ @GetMapping( "/getPortalVIDatasByPage")
+ @VciBusinessLog(operateName = "閫夋嫨妯℃澘涓嬫媺鏌ヨ")
+ public BaseResult getPortalVIDatasByPage(BaseQueryObject baseQueryObject){
+ try {
+ return BaseResult.dataGrid(uiManagerService.getPortalVIDatasByPage(baseQueryObject));
+ }catch (Throwable e) {
+ e.printStackTrace();
+ String exceptionMessage = "閫夋嫨妯℃澘涓嬫媺鏌ヨ鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e);
+ logger.error(exceptionMessage);
+ return BaseResult.fail(exceptionMessage);
+ }
+ }
+
+ /**
+ * 鏌ヨ妯℃澘涓嬫媺鏌ヨ
+ * @param baseQueryObject
+ * @return
+ * @throws PLException
+ */
+ @GetMapping( "/getQTInfoDatasByPage")
+ @VciBusinessLog(operateName = "鏌ヨ妯℃澘涓嬫媺鏌ヨ")
+ public BaseResult getQTInfoDatasByPage(BaseQueryObject baseQueryObject){
+ try {
+ return BaseResult.dataGrid(uiManagerService.getQTInfoDatasByPage(baseQueryObject));
+ }catch (Throwable e) {
+ e.printStackTrace();
+ String exceptionMessage = "鏌ヨ妯℃澘涓嬫媺鏌ヨ鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e);
+ logger.error(exceptionMessage);
+ return BaseResult.fail(exceptionMessage);
+ }
+ }
+
+
+ //椤甸潰璁捐涓嬮厤缃寜閽浉鍏虫帴鍙�
+ /**
+ * 鑾峰彇椤电鍖哄煙鎸夐挳閰嶇疆淇℃伅
+ * @param pageDefinationOid
+ * @return
+ */
+ @GetMapping( "/getTabButtons")
+ @VciBusinessLog(operateName = "鑾峰彇椤电鍖哄煙鎸夐挳閰嶇疆淇℃伅")
+ public BaseResult getTabButtons(String pageDefinationOid){
+ try {
+ return BaseResult.dataList(uiManagerService.getTabButtons(pageDefinationOid));
+ }catch (Exception e) {
+ e.printStackTrace();
+ String exceptionMessage = "鑾峰彇椤电鍖哄煙鎸夐挳閰嶇疆淇℃伅鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e);
+ logger.error(exceptionMessage);
+ return BaseResult.fail(exceptionMessage);
+ }
+ }
+
+ /**
+ * 娣诲姞鎸夐挳閰嶇疆淇℃伅
+ * @param tabButtonVO
+ * @return 淇濆瓨缁撴灉
+ */
+ @PostMapping("/addTapButton")
+ public BaseResult addTapButton(@RequestBody PLTabButtonVO tabButtonVO){
+ try {
+ return uiManagerService.addTapButton(tabButtonVO);
+ } catch (Throwable e) {
+ e.printStackTrace();
+ String exceptionMessage = "鎸夐挳閰嶇疆淇℃伅娣诲姞鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e);
+ logger.error(exceptionMessage);
+ return BaseResult.fail(exceptionMessage);
+ }
+ }
+
+ /**
+ * 淇敼鎸夐挳閰嶇疆淇℃伅
+ * @param tabButtonVO
+ * @return 淇敼缁撴灉
+ */
+ @PutMapping("/updateTapButton")
+ public BaseResult updateTapButton(@RequestBody PLTabButtonVO tabButtonVO){
+ try {
+ return uiManagerService.updateTapButton(tabButtonVO);
+ } catch (Throwable e) {
+ e.printStackTrace();
+ String exceptionMessage = "淇敼鎸夐挳閰嶇疆淇℃伅鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e);
+ logger.error(exceptionMessage);
+ return BaseResult.fail(exceptionMessage);
+ }
+ }
+
+ /**
+ * 鍒犻櫎鍗曚釜鎸夐挳閰嶇疆
+ * @param tabButtonVO
+ * @return
+ */
+ @DeleteMapping("/deleteTapButton")
+ public BaseResult deleteTapButton(@RequestBody PLTabButtonVO tabButtonVO){
+ try {
+ return uiManagerService.deleteTapButton(tabButtonVO) ? BaseResult.success("鍒犻櫎鍗曚釜鎸夐挳閰嶇疆鎴愬姛锛�"):BaseResult.fail("鍒犻櫎鍗曚釜鎸夐挳閰嶇疆澶辫触锛�");
+ } catch (PLException e) {
+ e.printStackTrace();
+ String exceptionMessage = "鍒犻櫎鍗曚釜鎸夐挳閰嶇疆鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e);
+ logger.error(exceptionMessage);
+ return BaseResult.fail(exceptionMessage);
+ }
+ }
+
+ /**
+ * 璋冩暣涓轰笅绾ф寜閽�
+ * @param tabButtonVO
+ * @return 淇敼缁撴灉
+ */
+ @PutMapping("/joinBtn")
+ public BaseResult joinBtn(@RequestBody PLTabButtonVO tabButtonVO){
+ try {
+ return uiManagerService.joinBtn(tabButtonVO);
+ } catch (Throwable e) {
+ e.printStackTrace();
+ String exceptionMessage = "璋冩暣涓轰笅绾ф寜閽椂鍑虹幇閿欒锛屽師鍥狅細" + VciBaseUtil.getExceptionMessage(e);
+ logger.error(exceptionMessage);
+ return BaseResult.fail(exceptionMessage);
+ }
+ }
+
+ /**
+ * 璋冩暣涓轰笂绾ф寜閽�
+ * @param tabButtonVO
+ * @return 淇敼缁撴灉
+ */
+ @PutMapping("/exitBtn")
+ public BaseResult exitBtn(@RequestBody PLTabButtonVO tabButtonVO){
+ try {
+ return uiManagerService.exitBtn(tabButtonVO);
+ } catch (Throwable e) {
+ e.printStackTrace();
+ String exceptionMessage = "璋冩暣涓轰笂绾ф寜閽椂鍑虹幇閿欒锛屽師鍥狅細" + VciBaseUtil.getExceptionMessage(e);
logger.error(exceptionMessage);
return BaseResult.fail(exceptionMessage);
}
@@ -292,7 +603,7 @@
*/
@PostMapping( "/authorizedUI")
@VciBusinessLog(operateName = "UI鎺堟潈")
- public BaseResult authorizedUI(UIAuthorDTO uiAuthorDTO){
+ public BaseResult authorizedUI(@RequestBody UIAuthorDTO uiAuthorDTO){
try {
return uiManagerService.authorizedUI(uiAuthorDTO)?BaseResult.success("鎺堟潈鎴愬姛!"):BaseResult.fail("鎺堟潈澶辫触锛�");
}catch (Throwable e) {
--
Gitblit v1.9.3