田源
2025-01-16 a13255b4129ee8a7a7b7e1ecd8e02dd2c78f7c17
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);
@@ -1267,19 +1267,6 @@
      } catch (PLException vciError) {
         throw WebUtil.getVciBaseException(vciError);
      }
      /*if(!QUERY_BY_CACHE){
         try {
            return uiComponentDO2VO(platformClientUtil.getUIService().getPLPageDefinationById(componentOid),true,attributeVOMap);
         } catch (PLException vciError) {
            throw WebUtil.getVciBaseException(vciError);
         }
      }else{
         List<UIComponentVO> componentVOS = self.selectAllUIComponent();
         List<UIComponentVO> componentVOList = Optional.ofNullable(componentVOS).orElseGet(() -> new ArrayList<>()).stream().filter(s -> s.getOid().equalsIgnoreCase(componentOid)).collect(Collectors.toList());
         if(!CollectionUtils.isEmpty(componentVOList)){
            return componentVOList.get(0);
         }
      }*/
   }
   /**
@@ -1287,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));
@@ -1301,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);
@@ -1442,8 +1429,8 @@
            treeDefineVO.setBtmType(componentDefineXO.getShowType());
            treeDefineVO.setLinkType(componentDefineXO.getLinkType());
            treeDefineVO.setLoadType("1".equalsIgnoreCase(componentDefineXO.getExpandMode())?"node":"all");
            //TODO:这个属性现在由链接类型查询模板配置上控制,不在页面定义控制了
            //treeDefineVO.setOrientation("positive".equalsIgnoreCase(componentDefineXO.getOrientation())?false:true);
            //TODO:这个属性现在由链接类型查询模板配置上控制,不在页面定义控制了,但是为了兼容以前的UI定义所以需要考虑保留
            treeDefineVO.setOrientation(componentDefineXO.getOrientation());
            treeDefineVO.setShowImage("1".equalsIgnoreCase(componentDefineXO.getIsShowImage())?true:false);
            treeDefineVO.setRootContent(componentDefineXO.getRootContent());
            treeDefineVO.setFieldSep(StringUtils.isBlank(componentDefineXO.getSeparator())?",":componentDefineXO.getSeparator());
@@ -1479,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)){
@@ -1491,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();
                  }
               }
@@ -1655,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;