| | |
| | | import com.thoughtworks.xstream.io.xml.XmlFriendlyNameCoder; |
| | | import com.thoughtworks.xstream.io.xml.XppDriver; |
| | | import com.vci.corba.common.PLException; |
| | | import com.vci.corba.framework.data.RoleRightInfo; |
| | | import com.vci.corba.portal.data.*; |
| | | import com.vci.starter.web.annotation.log.VciUnLog; |
| | | import com.vci.starter.web.exception.VciBaseException; |
| | | import com.vci.starter.web.util.BeanUtil; |
| | | import com.vci.starter.web.util.LangBaseUtil; |
| | | import com.vci.starter.web.util.VciBaseUtil; |
| | | import com.vci.starter.web.util.VciDateUtil; |
| | | import com.vci.starter.web.pagemodel.SessionInfo; |
| | | import com.vci.starter.web.util.*; |
| | | import com.vci.starter.web.wrapper.VciQueryWrapperForDO; |
| | | import com.vci.web.enumpck.UIComponentDisplayTypeEnum; |
| | | import com.vci.web.enumpck.UIComponentTypeEnum; |
| | |
| | | public List<UIButtonDefineVO> listButtonByComponent(String pkComponent){ |
| | | 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()); |
| | | |
| | | Map<String,RoleRightInfo> allRightRoleMap = new HashMap<>(); |
| | | RoleRightInfo[] bts = platformClientUtil.getFrameworkService().getRoleRightByUserName("bt"); |
| | | Map<String,Long> rightMap = new HashMap<String,Long>(); |
| | | for(RoleRightInfo obj:bts){ |
| | | allRightRoleMap.put(obj.funcId, obj); |
| | | rightMap.put(obj.funcId,obj.rightValue); |
| | | } |
| | | //循环对按钮权限进行判断,没有权限的将移除buttonDefineVOS对象 |
| | | Iterator<UIButtonDefineVO> buttonDefineVO = buttonDefineVOS.iterator(); |
| | | while (buttonDefineVO.hasNext()){ |
| | | UIButtonDefineVO buttonDefine = buttonDefineVO.next(); |
| | | if(rightMap.containsKey(buttonDefine.getPkComponent())) { |
| | | Long rightValue = rightMap.get(buttonDefine.getPkComponent()); |
| | | int nodeValue = buttonDefine.getOrderNum(); |
| | | if (nodeValue >= 0 && nodeValue <= 63) { |
| | | //进行位与操作,如果相等则表示具有当前操作的权限 |
| | | long preValue = (rightValue >> nodeValue) & 1; |
| | | if (preValue != 1) { |
| | | buttonDefineVO.remove(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | if(CollectionUtils.isEmpty(buttonDefineVOS)){ |
| | | return buttonDefineVOS; |
| | | } |