From 6f7f3834f66b08bed7af331ce1a168d6cd89292d Mon Sep 17 00:00:00 2001
From: wangting <wangting@vci-tech.com>
Date: 星期五, 03 一月 2025 18:14:45 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsActionServiceImpl.java |  149 +++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 137 insertions(+), 12 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 8d8e922..6661629 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,4 +1,5 @@
 package com.vci.web.service.impl;
+
 import cn.hutool.core.io.FileUtil;
 import com.vci.constant.FrameWorkLangCodeConstant;
 import com.vci.corba.common.PLException;
@@ -6,11 +7,7 @@
 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.dto.*;
 import com.vci.starter.poi.bo.WriteExcelData;
 import com.vci.starter.poi.bo.WriteExcelOption;
 import com.vci.starter.poi.util.ExcelUtil;
@@ -23,8 +20,11 @@
 import com.vci.web.enumpck.PlTypetypeEnum;
 import com.vci.web.other.ExportActionLogBean;
 import com.vci.web.other.ExportBeans;
-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;
@@ -102,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();
@@ -131,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);
@@ -188,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];
         }
@@ -238,6 +241,7 @@
         plAction.plModifyUser = WebUtil.getCurrentUserId();
         plAction.plActionCls = StringUtils.defaultString(dto.getPlActionCls());
         plAction.plTypeType = StringUtils.defaultString(dto.getPlTypeType());
+        plAction.plImage = StringUtils.defaultString(dto.getPlImage());
         boolean b = platformClientUtil.getUIService().savePLAction(plAction);
         if(!b){
             throw new PLException("500", new String[]{"淇濆瓨澶辫触锛侊紒"});
@@ -271,6 +275,7 @@
         plAction.plModifyUser = WebUtil.getCurrentUserId();
         plAction.plActionCls = StringUtils.defaultString(dto.getPlActionCls());
         plAction.plTypeType = StringUtils.defaultString(dto.getPlTypeType());
+        plAction.plImage = StringUtils.defaultString(dto.getPlImage());
         boolean b = platformClientUtil.getUIService().updatePLAction(plAction);
         if(!b){
             throw new PLException("500", new String[]{"淇敼澶辫触锛侊紒"});
@@ -296,6 +301,7 @@
         plAction.plModifyUser = WebUtil.getCurrentUserId();
         plAction.plActionCls = StringUtils.defaultString(dto.getPlActionCls());
         plAction.plTypeType = StringUtils.defaultString(dto.getPlTypeType());
+        plAction.plImage = StringUtils.defaultString(dto.getPlImage());
         boolean b = platformClientUtil.getUIService().deletePLAction(plAction);
         if(!b){
             throw new PLException("500", new String[]{"鍒犻櫎澶辫触锛侊紒"});
@@ -503,6 +509,126 @@
         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 {
 
@@ -558,7 +684,6 @@
         }
         return res;
     }
-
 
     /**
      * 澶勭悊鍙傛暟鍒楄〃

--
Gitblit v1.9.3