ludc
2025-01-16 986aa62ed00bee39363bab41b4eeb8259d446efd
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIEngineServiceImpl.java
@@ -894,7 +894,7 @@
    */
   @VciUnLog
   @Override
   public UIContentVO UIContentDO2VO(PLUILayout pageLayoutDefination, boolean queryDetail,Map<String, RoleRightVO> roleRightMap){
   public UIContentVO UIContentDO2VO(PLUILayout pageLayoutDefination, boolean queryDetail,Map<String, List<RoleRightVO>> roleRightMap){
      UIContentVO contentVO = new UIContentVO();
      if(pageLayoutDefination !=null){
         contentVO.setOid(pageLayoutDefination.plOId);
@@ -1014,7 +1014,7 @@
    * @param pkContent UI上下文的主键
    * @return 上下文
    */
   private List<UILayoutVO> listLayoutByContent(String pkContent,Map<String, RoleRightVO> roleRightMap){
   private List<UILayoutVO> listLayoutByContent(String pkContent,Map<String, List<RoleRightVO>> roleRightMap){
      try {
         List<PLTabPage> tabPageList = Arrays.stream(platformClientUtil.getUIService().getPLTabPagesByPageDefinationOId(pkContent)).collect(Collectors.toList());
         //过滤掉没有访问权限的UI
@@ -1030,7 +1030,7 @@
    * @param tabPageList
    * @param roleRightMap
    */
   private List<PLTabPage> filterTabPageByRoleRight(List<PLTabPage> tabPageList, Map<String, RoleRightVO> roleRightMap){
   private List<PLTabPage> filterTabPageByRoleRight(List<PLTabPage> tabPageList, Map<String, List<RoleRightVO>> roleRightMap){
      if(Func.isEmpty(roleRightMap) || Func.isEmpty(tabPageList)){
         return tabPageList;
      }
@@ -1060,7 +1060,7 @@
    * @param plPageDefinationList
    * @param roleRightMap
    */
   private List<PLPageDefination> filterPageDefByRoleRight(List<PLPageDefination> plPageDefinationList, Map<String, RoleRightVO> roleRightMap){
   private List<PLPageDefination> filterPageDefByRoleRight(List<PLPageDefination> plPageDefinationList, Map<String, List<RoleRightVO>> roleRightMap){
      if(Func.isEmpty(roleRightMap) || Func.isEmpty(plPageDefinationList)){
         return plPageDefinationList;
      }
@@ -1136,7 +1136,7 @@
    * @param pages 区域的数据对象
    * @return 显示对象
    */
   private List<UILayoutVO> UILayoutDO2VOs(Collection<PLTabPage> pages, boolean queryDetail, Map<String, RoleRightVO> roleRightMap){
   private List<UILayoutVO> UILayoutDO2VOs(Collection<PLTabPage> pages, boolean queryDetail, Map<String, List<RoleRightVO>> roleRightMap){
      List<UILayoutVO> contentVOS = new ArrayList<>();
      Map<String, OsAttributeVO> attributeVOMap;
      if(pages != null && pages.size() > 0){
@@ -1174,7 +1174,7 @@
    * @return 区域的显示对象
    */
   @VciUnLog
   private UILayoutVO UILayoutDO2VO(PLTabPage page, boolean queryDetail,Map<String, OsAttributeVO> attributeVOMap, Map<String, RoleRightVO> roleRightMap){
   private UILayoutVO UILayoutDO2VO(PLTabPage page, boolean queryDetail,Map<String, OsAttributeVO> attributeVOMap, Map<String, List<RoleRightVO>> roleRightMap){
      UILayoutVO layoutVO = new UILayoutVO();
      if(page !=null ){
         layoutVO.setOid(page.plOId);
@@ -1274,7 +1274,7 @@
    * @param pages 数据对象
    * @return 显示对象
    */
   private List<UIComponentVO> uiComponentDO2VOs(Collection<PLPageDefination> pages, boolean queryDetail,Map<String, OsAttributeVO> attributeVOMap, Map<String, RoleRightVO> roleRightMap){
   private List<UIComponentVO> uiComponentDO2VOs(Collection<PLPageDefination> pages, boolean queryDetail,Map<String, OsAttributeVO> attributeVOMap, Map<String, List<RoleRightVO>> roleRightMap){
      List<UIComponentVO> componentVOS = new ArrayList<>();
      pages.stream().forEach(page->{
         componentVOS.add(uiComponentDO2VO(page,queryDetail,attributeVOMap,roleRightMap));
@@ -1288,7 +1288,7 @@
    * @return 显示对象
    */
   @VciUnLog
   private UIComponentVO uiComponentDO2VO(PLPageDefination page, boolean queryDetail, Map<String, OsAttributeVO> attributeVOMap, Map<String, RoleRightVO> roleRightMap){
   private UIComponentVO uiComponentDO2VO(PLPageDefination page, boolean queryDetail, Map<String, OsAttributeVO> attributeVOMap, Map<String, List<RoleRightVO>> roleRightMap){
      UIComponentVO componentVO = new UIComponentVO();
      if(page !=null){
         componentVO.setOid(page.plOId);
@@ -1466,7 +1466,7 @@
    * @return 按钮的信息
    */
   @Override
   public List<UIButtonDefineVO> listButtonByComponent(String pkComponent, Map<String, RoleRightVO> roleRightMap){
   public List<UIButtonDefineVO> listButtonByComponent(String pkComponent, Map<String, List<RoleRightVO>> roleRightMap){
      try {
         List<UIButtonDefineVO> buttonDefineVOS = buttonDO2VOs(Arrays.stream(platformClientUtil.getUIService().getPLTabButtonsByTableOId(pkComponent)).collect(Collectors.toSet())).stream().sorted(((o1, o2) -> o1.getOrderNum().compareTo(o2.getOrderNum()))).collect(Collectors.toList());
         if(Func.isEmpty(roleRightMap)){
@@ -1478,12 +1478,20 @@
         while (buttonDefineVO.hasNext()){
            UIButtonDefineVO buttonDefine = buttonDefineVO.next();
            if(roleRightMap.containsKey(buttonDefine.getPkComponent())) {
               Long rightValue = roleRightMap.get(buttonDefine.getPkComponent()).getRightValue();
               List<Long> rightValues = roleRightMap.get(buttonDefine.getPkComponent()).stream()
                     .map(e -> e.getRightValue()).collect(Collectors.toList());
               int nodeValue = buttonDefine.getOrderNum();
               if (nodeValue >= 0 && nodeValue <= 63) {
                  boolean authFlag = false;
                  //进行位与操作,如果相等则表示具有当前操作的权限
                  long preValue = (rightValue >> nodeValue) & 1;
                  if (preValue != 1) {
                  for (Long rightValue : rightValues) {
                     long preValue = (rightValue >> nodeValue) & 1;
                     if (preValue == 1) {
                        authFlag = true;
                        break;
                     }
                  }
                  if(!authFlag){
                     buttonDefineVO.remove();
                  }
               }
@@ -1642,7 +1650,7 @@
         throw WebUtil.getVciBaseException(vciError);
      }
      // 1、根据当前角色判断是管理人员还是普通用户(正常来说只有普通用户才会用到该查询接口)
      Map<String, RoleRightVO> roleRightMap = uiManagerServiceI.getRoleRightMap(null);
      Map<String, List<RoleRightVO>> roleRightMap = uiManagerServiceI.getRoleRightMap(null);
      // 2、按照当前登录用户查询权限(功能权限和UI授权的授权信息都是放在同一张表里的)
      // 3、找出当前要查询的UI上下文
      PLUILayout context = null;