From 663878fdcd0d44c105888014f4cdf7fc926f609f Mon Sep 17 00:00:00 2001 From: yuxc <yuxc@vci-tech.com> Date: 星期三, 19 六月 2024 10:27:04 +0800 Subject: [PATCH] 1、去掉client包的相关更改。 2、修改登录鉴权修改。 --- Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmFunctionQueryServicePlatformImpl.java | 99 ++++++++++++++----------------------------------- 1 files changed, 28 insertions(+), 71 deletions(-) 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 58977d3..4fad0ab 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 @@ -1,9 +1,10 @@ package com.vci.frameworkcore.compatibility.impl; import com.alibaba.fastjson.JSONObject; -import com.vci.client.common.providers.ServiceProvider; import com.vci.corba.common.PLException; import com.vci.corba.framework.data.FunctionInfo; +import com.vci.corba.framework.data.RoleRightInfo; +import com.vci.corba.omd.data.BusinessObject; import com.vci.corba.portal.data.PLUILayout; import com.vci.frameworkcore.compatibility.ISmFunctionQueryService; import com.vci.frameworkcore.enumpck.ResourceControlTypeEnum; @@ -11,6 +12,7 @@ import com.vci.frameworkcore.model.SmRoleForPlatform1; import com.vci.frameworkcore.pagemodel.MenuVO; import com.vci.frameworkcore.pagemodel.SmFunctionVO; +import com.vci.omd.utils.ObjectTool; import com.vci.starter.web.constant.QueryOptionConstant; import com.vci.starter.web.exception.VciBaseException; import com.vci.starter.web.pagemodel.*; @@ -18,22 +20,19 @@ import com.vci.web.pageModel.UIContentVO; import com.vci.web.service.UIEngineServiceI; import com.vci.web.service.WebBoServiceI; +import com.vci.web.util.PlatformClientUtil; +import com.vci.web.util.RightControlUtil; import com.vci.web.util.WebUtil; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.cache.annotation.CacheEvict; -import org.springframework.cache.annotation.Cacheable; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import java.util.*; import java.util.stream.Collectors; - -import static com.vci.web.constant.CacheKeyConstant.ALL_FUNCTION; -import static com.vci.web.constant.CacheNameConstant.VCI_OBJECT_SERVICE; /** * 鑰佸钩鍙扮殑鏉冮檺鏈嶅姟 @@ -76,6 +75,11 @@ @Autowired private UIEngineServiceI uiEngineServiceI; + @Autowired + private PlatformClientUtil platformClientUtil; + + @Autowired + RightControlUtil rightControlUtil; /** * 鏌ヨ鎵�鏈夌殑鍔熻兘 * @@ -94,7 +98,6 @@ * @return 鍔熻兘鐨勬樉绀哄璞� */ @Override - @Cacheable(value = VCI_OBJECT_SERVICE,key = ALL_FUNCTION,unless = "#result == null") public Map<String, SmFunctionVO> selectAllFunctionMap() { return Optional.ofNullable(self.selectAllFunction()).orElseGet(()->new ArrayList<>()).stream().collect(Collectors.toMap(s->s.getOid(),t->t)); } @@ -201,33 +204,6 @@ return functionVO; } -// /** -// * 鑾峰彇褰撳墠瑙掕壊鐨勮彍鍗� -// * -// * @param treeQueryObject 灞炴�ф煡璇㈠璞� -// * @param resourceControlTypeEnum 瑙掕壊鎺у埗鍖哄煙锛屼篃鏄姛鑳芥帶鍒剁殑鍖哄煙 -// * @return 鑿滃崟锛屽寘鍚笂涓嬬骇 -// */ -// @Override -// public List<Tree> treeCurrentUserMenu(TreeQueryObject treeQueryObject, ResourceControlTypeEnum resourceControlTypeEnum) { -// SessionInfo sessionInfo = WebUtil.getCurrentUserSessionInfoNotException(); -// if(sessionInfo == null || CollectionUtils.isEmpty(sessionInfo.getFunctionOids())){ -// return new ArrayList<Tree>(); -// } -// if(resourceControlTypeEnum == null){ -// resourceControlTypeEnum = ResourceControlTypeEnum.BS; -// } -// Map<String, SmFunctionVO> functionVOMap = selectAllFunctionMap(); -// List<SmFunctionVO> functionVOList = new ArrayList<>(); -// for(String oid : sessionInfo.getFunctionOids()) { -// SmFunctionVO functionVO = functionVOMap.get(oid); -// if(functionVO !=null && resourceControlTypeEnum.getValue().equals(functionVO.getResourceControlType()) && functionVO.isDisplayFlag()) { -// functionVOList.add(functionVO); -// } -// } -// return dos2Trees(functionVOList.stream().sorted(Comparator.comparing(s -> s.getOrderNum())).collect(Collectors.toList()),treeQueryObject == null?null:treeQueryObject.getParentOid()); -// } - /** * 鑾峰彇褰撳墠瑙掕壊鐨勮彍鍗� * @@ -238,21 +214,21 @@ @Override public List<MenuVO> treeCurrentUserMenu(TreeQueryObject treeQueryObject, ResourceControlTypeEnum resourceControlTypeEnum) throws PLException { SessionInfo sessionInfo = WebUtil.getCurrentUserSessionInfoNotException(); -// if(sessionInfo == null || CollectionUtils.isEmpty(sessionInfo.getFunctionOids())){ -// return new ArrayList<Tree>(); -// } - if(resourceControlTypeEnum == null){ - resourceControlTypeEnum = ResourceControlTypeEnum.BS; - } -// PortalServicePrx uiService = ServiceProvider.getUIService(); -// FrameworkServicePrx frameService = ServiceProvider.getFrameService(); - FunctionInfo[] menus = ServiceProvider.getFrameService().getModuleListByParentId("modelManagmentNode", true); -// FunctionInfo[] menus = ServiceProvider.getFrameService().("modelManagmentNode", true); + String parentId; -// PLAction[] allPLAction = uiService.getAllPLAction(); + if (rightControlUtil.isAdminOrDeveloperOrRoot(sessionInfo.getUserId())) { + // 绯荤粺鑿滃崟 + parentId = "systemManagmentNode" ; + } else if (rightControlUtil.isThreeAdminCurUser()) { + parentId = "systemManagmentNode" ; + } else { + parentId = "modelManagmentNode" ; + } + RoleRightInfo[] userRoleRights = rightControlUtil.getRoleRightByUserName(sessionInfo.getUserId()); + Map<String, List<FunctionInfo>> map = rightControlUtil.getAllChildrenFunctionsByUserName( + parentId, sessionInfo.getUserId(), userRoleRights); List<MenuVO> functionVOList = new ArrayList<>(); -// Map<String, SmFunctionVO> functionVOMap = selectAllFunctionMap(); - for (FunctionInfo menu : menus) { + for (FunctionInfo menu : map.get(parentId)) { if(!menu.isValid){ continue; } @@ -263,13 +239,6 @@ continue; } functionVO.setPath(menu.resourceB); -// if(menu.resourceB.contains("type=") || menu.resourceB.contains("context=")){ -// String[] split = menu.resourceB.split("\\?")[0].split("="); -// functionVO.setPath((split.length>1 && split[1].equals("test") ? "/custom-ui/" :"/base/UIContentViewer") + menu.resourceB.substring(3)); -// }else{ -// functionVO.setPath("/views/" + menu.id); -//// functionVO.setPath("/" + menu.resourceB + menu.aliasName); -// } functionVO.setParentId(menu.parentId); functionVO.setCode(menu.aliasName); functionVO.setAlias(menu.aliasName); @@ -284,12 +253,11 @@ } functionVOList.add(functionVO); } -// return dos2Trees(functionVOList.stream().sorted(Comparator.comparing(s -> s.getSort())).collect(Collectors.toList()),treeQueryObject == null?null:treeQueryObject.getParentOid()); return functionVOList.stream().sorted(Comparator.comparing(s -> s.getSort())).collect(Collectors.toList()); } public List<MenuVO> findChildFunctionVO(String parentOid) throws PLException { - FunctionInfo[] menus = ServiceProvider.getFrameService().getModuleListByParentId(parentOid, true); + FunctionInfo[] menus = platformClientUtil.getFrameworkService().getModuleListByParentId(parentOid, true); List<MenuVO> functionVOList = new ArrayList<>(); for (FunctionInfo menu : menus) { if(!menu.isValid){ @@ -302,13 +270,6 @@ continue; } functionVO.setPath(menu.resourceB); -// if(menu.resourceB.contains("type=") || menu.resourceB.contains("context=")){ -// String[] split = menu.resourceB.split("\\?")[0].split("="); -// functionVO.setPath((split.length>1 && split[1].equals("test") ? "/custom-ui/" :"/base/UIContentViewer") + menu.resourceB.substring(3)); -// }else{ -// functionVO.setPath("/views/" + menu.id); -//// functionVO.setPath("/" + menu.resourceB + menu.aliasName); -// } functionVO.setCode(menu.aliasName); functionVO.setAlias(menu.aliasName); functionVO.setParentId(menu.parentId); @@ -330,13 +291,10 @@ @Override public UIContentVO getUIContentByBtmTypeAndId(TreeQueryObject treeQueryObject, ResourceControlTypeEnum resourceControlTypeEnum) throws PLException { SessionInfo sessionInfo = WebUtil.getCurrentUserSessionInfoNotException(); -// if(sessionInfo == null || CollectionUtils.isEmpty(sessionInfo.getFunctionOids())){ -// return new ArrayList<Tree>(); -// } if(resourceControlTypeEnum == null){ resourceControlTypeEnum = ResourceControlTypeEnum.BS; } - for (PLUILayout allPLUILayout : ServiceProvider.getUIService().getAllPLUILayouts()) { + for (PLUILayout allPLUILayout : platformClientUtil.getUIService().getAllPLUILayouts()) { if(treeQueryObject.getConditionMap().getOrDefault("type","").equals(allPLUILayout.plRelatedType) && treeQueryObject.getConditionMap().getOrDefault("context","").equals(allPLUILayout.plCode)){ return uiEngineServiceI.UIContentDO2VO(allPLUILayout,true); @@ -569,12 +527,12 @@ if(!CollectionUtils.isEmpty(functionVOS)){ functionVOList.addAll(functionVOS); String sql = "select plfuncoid,plroleoid from plroleright where plroleoid in (" + WebUtil.toInSql(roleOids.toArray(new String[0])) + ")"; - List<com.vci.client.bof.ClientBusinessObject> cbos = boService.queryBySql(sql, null); + List<BusinessObject> cbos = boService.queryBySql(sql, null); if(!CollectionUtils.isEmpty(cbos)){ cbos.stream().forEach(cbo->{ - String roleOid = cbo.getAttributeValue("plroleoid"); + String roleOid = ObjectTool.getBOAttributeValue(cbo,"plroleoid"); List<String> functionOids = roleFunctionOidMap.getOrDefault(roleOid,new ArrayList<>()); - functionOids.add(cbo.getAttributeValue("plfuncoid")); + functionOids.add(ObjectTool.getBOAttributeValue(cbo,"plfuncoid")); roleFunctionOidMap.put(roleOid,functionOids); }); } @@ -678,7 +636,6 @@ * 娓呴櫎缂撳瓨 */ @Override - @CacheEvict(value = VCI_OBJECT_SERVICE,key = ALL_FUNCTION) public void clearCache() { } -- Gitblit v1.9.3