dangsn
2024-06-14 82ff3244651e8a470237b9667583ad942f3a973e
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmFunctionQueryServicePlatformImpl.java
@@ -1,7 +1,6 @@
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.portal.data.PLUILayout;
@@ -18,22 +17,18 @@
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.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 +71,9 @@
    @Autowired
    private  UIEngineServiceI uiEngineServiceI;
    @Autowired
    private PlatformClientUtil platformClientUtil;
    /**
     * 查询所有的功能
     *
@@ -94,7 +92,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 +198,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,20 +208,11 @@
    @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);
//        PLAction[] allPLAction = uiService.getAllPLAction();
        FunctionInfo[] menus = platformClientUtil.getFrameworkService().getModuleListByParentId("modelManagmentNode", true);
        List<MenuVO> functionVOList = new ArrayList<>();
//        Map<String, SmFunctionVO> functionVOMap = selectAllFunctionMap();
        for (FunctionInfo menu : menus) {
            if(!menu.isValid){
                continue;
@@ -263,13 +224,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 +238,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 +255,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 +276,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);
@@ -678,7 +621,6 @@
     * 清除缓存
     */
    @Override
    @CacheEvict(value = VCI_OBJECT_SERVICE,key = ALL_FUNCTION)
    public void clearCache() {
    }