Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/model/SmPasswordStrategyForPlatform1.java
@@ -83,7 +83,7 @@ name = "plcreatetime" ) @VciFieldType(VciFieldTypeEnum.VTDateTime) private Long plcreatetime; private String plcreatetime; /** * 创建人 @@ -102,7 +102,7 @@ name = "plupdatetime" ) @VciFieldType(VciFieldTypeEnum.VTDateTime) private Long plupdatetime; private String plupdatetime; /** * 最后修改人 @@ -203,11 +203,11 @@ this.pldesc = pldesc == null ? null : pldesc.trim(); } public Long getPlcreatetime() { public String getPlcreatetime() { return plcreatetime; } public void setPlcreatetime(Long plcreatetime) { public void setPlcreatetime(String plcreatetime) { this.plcreatetime = plcreatetime; } @@ -219,11 +219,11 @@ this.plcreateuser = plcreateuser == null ? null : plcreateuser.trim(); } public Long getPlupdatetime() { public String getPlupdatetime() { return plupdatetime; } public void setPlupdatetime(Long plupdatetime) { public void setPlupdatetime(String plupdatetime) { this.plupdatetime = plupdatetime; } Source/plt-web/plt-web-parent/plt-web-permission/src/main/java/com/vci/web/service/impl/SmUserQueryServiceImpl.java
@@ -1141,19 +1141,21 @@ if(StringUtils.isBlank(md5Password) || StringUtils.isBlank(userName)){ return false; } String sql = " select plpassword from pluser where plusername = :userName"; /*String sql = " select plpassword from pluser where plusername = :userName"; Map<String,String> conditionMap = new HashMap<>(); conditionMap.put("userName",userName.trim()); List<BusinessObject> BusinessObjectList = boService.queryBySql(sql, conditionMap); if(CollectionUtils.isEmpty(BusinessObjectList)){ conditionMap.put("userName",userName.trim());*/ SmUserVO userVO = this.getUserByUserId(userName); //List<BusinessObject> BusinessObjectList = boService.queryBySql(sql, conditionMap); if(Func.isEmpty(userVO) || Func.isBlank(userVO.getOid())){ return false; } ThreeDES des = new ThreeDES();// 实例化一个对�? des.getKey("daliantan0v0");// 生成密匙 //ThreeDES des = new ThreeDES();// 实例化一个对�? //des.getKey("daliantan0v0");// 生成密匙 //对查询出来的密码解密 String plpassword = ObjectTool.getNewBOAttributeValue(BusinessObjectList.get(0), "plpassword"); plpassword = des.getDesString(plpassword); //String plpassword = ObjectTool.getNewBOAttributeValue(BusinessObjectList.get(0), "plpassword"); String plpassword = userVO.getPassword(); //plpassword = des.getDesString(plpassword); if(md5Password.equals(plpassword)){ return true; } Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/SmFunctionController.java
@@ -1,6 +1,7 @@ package com.vci.web.controller; import com.vci.corba.common.PLException; import com.vci.starter.web.util.VciBaseUtil; import com.vci.web.service.ISmFunctionQueryService; import com.vci.web.enumpck.ResourceControlTypeEnum; import com.vci.pagemodel.MenuVO; @@ -63,8 +64,15 @@ */ @VciUnCheckRight @GetMapping("/getUIContentByBtmTypeAndId") public UIContentVO getUIContentByBtmTypeAndId(@RequestBody TreeQueryObject treeQueryObject) throws PLException { return functionQueryService.getUIContentByBtmTypeAndId(treeQueryObject, ResourceControlTypeEnum.BS); public BaseResult getUIContentByBtmTypeAndId(@RequestBody TreeQueryObject treeQueryObject) { try { return BaseResult.success(functionQueryService.getUIContentByBtmTypeAndId(treeQueryObject, ResourceControlTypeEnum.BS)); } catch (Exception e) { e.printStackTrace(); String exceptionMessage = "获取当前用户的菜单时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e); logger.error(exceptionMessage); return BaseResult.fail(exceptionMessage); } } /** Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/UIManagerController.java
@@ -616,25 +616,6 @@ } /** * 根据角色主键获取已授权的信息 * @param roleId * @return * @throws PLException */ /* @GetMapping( "/getRightListByRoleId") @VciBusinessLog(operateName = "根据角色主键获取已授权的UI主键集合") public BaseResult getRightListByRoleId(String roleId){ try { return BaseResult.success(uiManagerService.getRightListByRoleId(roleId)); }catch (Throwable e) { e.printStackTrace(); String exceptionMessage = "获取已授权信息时错误,原因:" + VciBaseUtil.getExceptionMessage(e); logger.error(exceptionMessage); return BaseResult.fail(exceptionMessage); } }*/ /*** * @param uiAuthorDTO 勾选的需要保存的数据对象 * @return */ Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebUIController.java
@@ -6,7 +6,11 @@ import com.vci.pagemodel.UITableDefineVO; import com.vci.starter.web.annotation.controller.VciUnCheckRight; import com.vci.starter.web.annotation.log.VciBusinessLog; import com.vci.starter.web.pagemodel.BaseResult; import com.vci.starter.web.util.VciBaseUtil; import com.vci.web.service.UIEngineServiceI; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -29,6 +33,11 @@ private UIEngineServiceI uiService; /** * 日志 */ private Logger logger = LoggerFactory.getLogger(getClass()); /** * 获取UI上下文的定义 * @param btmType 业务类型 * @param id 编号 @@ -36,8 +45,15 @@ */ @GetMapping("/getUIContentByBtmTypeAndId") @VciUnCheckRight public UIContentVO getUIContentByBtmTypeAndId(String btmType,String id){ return uiService.getUIContentByBtmTypeAndId(btmType,id); public BaseResult getUIContentByBtmTypeAndId(String btmType,String id){ try { return BaseResult.success(uiService.getUIContentByBtmTypeAndId(btmType,id)); } catch (PLException e) { e.printStackTrace(); String exceptionMessage = "获取UI上下文的定义时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e); logger.error(exceptionMessage); return BaseResult.fail(exceptionMessage); } } /** Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/SmPwdStrategyQueryServiceI.java
@@ -30,7 +30,7 @@ * @param pageHelper * @return */ DataGrid<SmPasswordStrategyVO> refDataGrid(Map<String, String> conditionMap, PageHelper pageHelper) throws PLException; DataGrid<SmPasswordStrategyVO> refDataGrid(Map<String, String> conditionMap, PageHelper pageHelper) throws Exception; /** * 查询密码安全策略,下拉使用的接口 @@ -46,28 +46,28 @@ * @param passwordStrategId * @return */ boolean saveUserPasswordStrateg(String[] userIds, String passwordStrategId) throws PLException; boolean saveUserPasswordStrateg(String[] userIds, String passwordStrategId) throws Exception; /** * 新增密码策略 * @param spsDto * @return */ boolean addPasswordStrateg(SmPasswordStrategyDTO spsDto) throws PLException; boolean addPasswordStrateg(SmPasswordStrategyDTO spsDto) throws Exception; /** * 修改密码策略 * @param spsDto * @return */ boolean updatePasswordStrateg(SmPasswordStrategyDTO spsDto) throws PLException; boolean updatePasswordStrateg(SmPasswordStrategyDTO spsDto) throws Exception; /** * 删除密码策略 * @param pwdIds * @return */ boolean delPasswordStrateg(String[] pwdIds) throws PLException; boolean delPasswordStrateg(String[] pwdIds) throws Exception; /** * 根据主键查询密码策略map对象 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/UIEngineServiceI.java
@@ -177,7 +177,7 @@ * @param pkComponent 组件的主键 * @return 按钮的信息 */ List<UIButtonDefineVO> listButtonByComponent(String pkComponent); List<UIButtonDefineVO> listButtonByComponent(String pkComponent, Map<String, RoleRightVO> roleRightMap); /** * 按钮的数据对象转换为显示对象 @@ -205,9 +205,10 @@ * @param id 主键 * @return UI上下文的信息 */ UIContentVO getUIContentByBtmTypeAndId(String btmType, String id); UIContentVO getUIContentByBtmTypeAndId(String btmType, String id) throws PLException; // UIContentVO UIContentDO2VO(PLPageLayoutDefination pageLayoutDefination, boolean queryDetail); UIContentVO UIContentDO2VO(PLUILayout pageLayoutDefination, boolean queryDetail); // UIContentVO UIContentDO2VO(PLPageLayoutDefination pageLayoutDefination, boolean queryDetail); UIContentVO UIContentDO2VO(PLUILayout pageLayoutDefination, boolean queryDetail,Map<String, RoleRightVO> roleRightMap); } Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/UIManagerServiceI.java
@@ -1,6 +1,7 @@ package com.vci.web.service; import com.vci.corba.common.PLException; import com.vci.corba.framework.data.RoleRightInfo; import com.vci.corba.omd.btm.BizType; import com.vci.corba.omd.ltm.LinkType; import com.vci.corba.omd.qtm.QTInfo; @@ -8,10 +9,7 @@ import com.vci.corba.portal.data.PLUILayout; import com.vci.corba.portal.data.PortalVI; import com.vci.dto.UIAuthorDTO; import com.vci.pagemodel.PLDefinationVO; import com.vci.pagemodel.PLTabButtonVO; import com.vci.pagemodel.PLUILayoutCloneVO; import com.vci.pagemodel.UICloneVO; import com.vci.pagemodel.*; import com.vci.starter.web.exception.VciBaseException; import com.vci.starter.web.pagemodel.BaseQueryObject; import com.vci.starter.web.pagemodel.BaseResult; @@ -24,6 +22,7 @@ import java.util.Map; /** * UI定义管理服务 * @author ludc * @date 2024/8/28 17:05 */ @@ -208,13 +207,13 @@ */ List<Tree> getUIAuthor(BaseQueryObject baseQueryObject)throws Exception; /* *//** /** * 根据角色主键获取已授权的信息 * @param roleId * @return * @throws PLException *//* Map<String,RoleRightVO> getRightListByRoleId(String roleId) throws PLException;*/ */ Map<String,RoleRightVO> getRoleRightMap(String roleId) throws PLException; /** * UI授权 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/SmFunctionQueryServicePlatformImpl.java
@@ -13,6 +13,7 @@ import com.vci.model.SmRoleForPlatform1; import com.vci.omd.utils.ObjectTool; import com.vci.pagemodel.MenuVO; import com.vci.pagemodel.RoleRightVO; import com.vci.pagemodel.SmFunctionVO; import com.vci.pagemodel.UIContentVO; import com.vci.starter.web.constant.QueryOptionConstant; @@ -24,6 +25,7 @@ import com.vci.web.properties.JsonConfigReader; import com.vci.web.service.ISmFunctionQueryService; import com.vci.web.service.UIEngineServiceI; import com.vci.web.service.UIManagerServiceI; import com.vci.web.service.WebBoServiceI; import com.vci.starter.web.util.Lcm.Func; import com.vci.web.util.PlatformClientUtil; @@ -87,13 +89,16 @@ private ISmFunctionQueryService self; @Autowired private UIEngineServiceI uiEngineServiceI; private UIEngineServiceI uiEngineServiceI; @Autowired private UIManagerServiceI uiManagerServiceI; @Autowired private RightControlUtil rightControlUtil; @Autowired private PlatformClientUtil platformClientUtil; @Autowired RightControlUtil rightControlUtil; /** * 查询所有的功能 @@ -708,13 +713,14 @@ @Override public UIContentVO getUIContentByBtmTypeAndId(TreeQueryObject treeQueryObject, ResourceControlTypeEnum resourceControlTypeEnum) throws PLException { SessionInfo sessionInfo = WebUtil.getCurrentUserSessionInfoNotException(); if(resourceControlTypeEnum == null){ /* if(resourceControlTypeEnum == null){ resourceControlTypeEnum = ResourceControlTypeEnum.BS; } }*/ Map<String, RoleRightVO> roleRightMap = uiManagerServiceI.getRoleRightMap(null); 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); return uiEngineServiceI.UIContentDO2VO(allPLUILayout,true,roleRightMap); } } return null; Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/SmPwdStrategyQueryServiceImpl.java
@@ -9,6 +9,7 @@ import com.vci.model.SmPasswordStrategyForPlatform1; import com.vci.omd.utils.ObjectTool; import com.vci.pagemodel.SmPasswordStrategyVO; import com.vci.starter.web.enumpck.VciFieldTypeEnum; import com.vci.starter.web.util.BeanUtilForVCI; import com.vci.web.service.SmUserQueryServiceI; import com.vci.starter.web.constant.QueryOptionConstant; @@ -31,6 +32,8 @@ import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.*; import java.util.stream.Collectors; @@ -93,7 +96,7 @@ * @return */ @Override public DataGrid<SmPasswordStrategyVO> refDataGrid(Map<String, String> conditionMap, PageHelper pageHelper) throws PLException { public DataGrid<SmPasswordStrategyVO> refDataGrid(Map<String, String> conditionMap, PageHelper pageHelper) throws Exception { if(pageHelper == null){ pageHelper = new PageHelper(-1); } @@ -138,13 +141,13 @@ * @param smPasswordStrategyForPlatform1s 原平台的密码策略 * @return */ private List<SmPasswordStrategyVO> pltPwdStrategy2SmPwdStrategyVOs(List<SmPasswordStrategyForPlatform1> smPasswordStrategyForPlatform1s) throws PLException{ private List<SmPasswordStrategyVO> pltPwdStrategy2SmPwdStrategyVOs(List<SmPasswordStrategyForPlatform1> smPasswordStrategyForPlatform1s) throws Exception{ List<SmPasswordStrategyVO> smPasswordStrategyVOList = new ArrayList<>(); if(!CollectionUtils.isEmpty(smPasswordStrategyForPlatform1s)){ smPasswordStrategyForPlatform1s.stream().forEach(s -> { try { smPasswordStrategyVOList.add(pltPwdStrategy2SmPwdStrategyVO(s)); } catch (PLException e) { } catch (Exception e) { e.printStackTrace(); String exceptionMessage = "Platform1对象转VO对象时出现错误,原因:"+VciBaseUtil.getExceptionMessage(e); logger.error(exceptionMessage); @@ -160,7 +163,7 @@ * @param strategyForPlatform1 原平台的密码策略 * @return 新的密码策略对象 */ private SmPasswordStrategyVO pltPwdStrategy2SmPwdStrategyVO(SmPasswordStrategyForPlatform1 strategyForPlatform1) throws PLException { private SmPasswordStrategyVO pltPwdStrategy2SmPwdStrategyVO(SmPasswordStrategyForPlatform1 strategyForPlatform1) throws PLException, ParseException { SmPasswordStrategyVO strategyVO = new SmPasswordStrategyVO(); strategyVO.setOid(strategyForPlatform1.getPluid()); strategyVO.setId(""); @@ -173,9 +176,14 @@ strategyVO.setLockTime(strategyForPlatform1.getPlocktime()); strategyVO.setDefaultFlag(strategyForPlatform1.getPlisdefault() == 1); strategyVO.setDescription(strategyForPlatform1.getPldesc()); strategyVO.setCreateTime(new Date(strategyForPlatform1.getPlcreatetime())); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); if(Func.isNotEmpty(strategyForPlatform1.getPlcreatetime())){ strategyVO.setCreateTime(sdf.parse(strategyForPlatform1.getPlcreatetime())); } strategyVO.setCreator(strategyForPlatform1.getPlcreateuser()); strategyVO.setLastModifyTime(new Date(strategyForPlatform1.getPlupdatetime())); if(Func.isNotEmpty(strategyForPlatform1.getPlupdatetime())){ strategyVO.setLastModifyTime(sdf.parse(strategyForPlatform1.getPlupdatetime())); } strategyVO.setLastModifier(strategyForPlatform1.getPlupdateuser()); strategyVO.setLicensors(strategyForPlatform1.getPllicensors()); strategyVO.setRequireCharCount(strategyForPlatform1.getPlrequiredtype()); @@ -316,7 +324,7 @@ * @param conditionMap * @return */ private List<SmPasswordStrategyVO> getPwdStrategyByCondition(Map<String,String> conditionMap) throws PLException { private List<SmPasswordStrategyVO> getPwdStrategyByCondition(Map<String,String> conditionMap) throws Exception { if(Func.isEmpty(conditionMap)){ conditionMap = new HashMap(); } @@ -334,7 +342,7 @@ * @return */ @Override public boolean addPasswordStrateg(SmPasswordStrategyDTO spsDto) throws PLException { public boolean addPasswordStrateg(SmPasswordStrategyDTO spsDto) throws Exception { VciBaseUtil.alertNotNull( spsDto,"新增的密码策略对象", spsDto.getName(),"策略名称", @@ -376,7 +384,7 @@ * @return */ @Override public boolean updatePasswordStrateg(SmPasswordStrategyDTO spsDto) throws PLException { public boolean updatePasswordStrateg(SmPasswordStrategyDTO spsDto) throws Exception { VciBaseUtil.alertNotNull( spsDto,"新增的密码策略对象", spsDto.getOid(),"策略主键", Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIEngineServiceImpl.java
@@ -10,27 +10,21 @@ import com.vci.pagemodel.*; import com.vci.starter.web.annotation.log.VciUnLog; import com.vci.starter.web.exception.VciBaseException; import com.vci.starter.web.util.BeanUtilForVCI; 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.util.*; import com.vci.starter.web.util.Lcm.Func; import com.vci.starter.web.wrapper.VciQueryWrapperForDO; import com.vci.web.enumpck.UIComponentDisplayTypeEnum; import com.vci.web.enumpck.UIComponentTypeEnum; import com.vci.web.enumpck.UIFieldTypeEnum; import com.vci.web.enumpck.UILayoutAreaTypeEnum; import com.vci.web.other.AllActionThreadLocal; import com.vci.web.service.OsAttributeServiceI; import com.vci.web.service.OsBtmServiceI; import com.vci.web.service.UIEngineServiceI; import com.vci.web.service.WebBoServiceI; import com.vci.web.service.*; import com.vci.web.util.PlatformClientUtil; import com.vci.web.util.WebUtil; import com.vci.web.xmlmodel.UIComponentDefineXO; import com.vci.web.xmlmodel.UIComponentDetailXO; import com.vci.web.xmlmodel.UIComponentItemXO; import org.apache.commons.lang3.StringUtils; import org.apache.poi.hdf.extractor.SEP; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -93,10 +87,10 @@ private OsAttributeServiceI attrService; /** * 业务类型的服务 * UI定义管理服务 */ @Autowired private WebBoServiceI boService; private UIManagerServiceI uiManagerServiceI; /** * 表单的字段类型映射 @@ -874,7 +868,7 @@ private List<UIContentVO> UIContentDO2VOs(Collection<PLUILayout> pageLayoutDefinations){ List<UIContentVO> contentVOS = new ArrayList<>(); Optional.ofNullable(pageLayoutDefinations).orElseGet(()->new ArrayList<PLUILayout>()).stream().forEach(pageLayout->{ contentVOS.add(UIContentDO2VO(pageLayout,false)); contentVOS.add(UIContentDO2VO(pageLayout,false,null)); }); if(!CollectionUtils.isEmpty(contentVOS)) { Map<String, List<UILayoutVO>> layoutMap = batchListLayoutByContent(contentVOS.stream().map(UIContentVO::getOid).collect(Collectors.toSet())); @@ -900,7 +894,7 @@ */ @VciUnLog @Override public UIContentVO UIContentDO2VO(PLUILayout pageLayoutDefination, boolean queryDetail){ public UIContentVO UIContentDO2VO(PLUILayout pageLayoutDefination, boolean queryDetail,Map<String, RoleRightVO> roleRightMap){ UIContentVO contentVO = new UIContentVO(); if(pageLayoutDefination !=null){ contentVO.setOid(pageLayoutDefination.plOId); @@ -918,14 +912,16 @@ contentVO.setLastModifier(pageLayoutDefination.plModifyUser); if(queryDetail){ //查询包含的内容 List<UILayoutVO> layoutVOS = listLayoutByContent(contentVO.getOid()); List<UILayoutVO> layoutVOS = null; //判断是否根据权限返回 layoutVOS = listLayoutByContent(contentVO.getOid(),roleRightMap); if(!CollectionUtils.isEmpty(layoutVOS)){ if(layoutVOS.size() == 1){ //只有一个区域 UILayoutVO layoutVO = layoutVOS.get(0); List<UIComponentVO> componentVOs = layoutVO.getComponentVOs(); //第一个作为center UIComponentVO firstCompVO = componentVOs.stream().min((o1, o2) -> o1.getOrderNum().compareTo(o2.getOrderNum())).get(); UIComponentVO firstCompVO = componentVOs.stream().min(Comparator.comparing(UIComponentVO::getOrderNum)).get(); List<UIComponentVO> southCompVO = componentVOs.stream().filter(s->!s.getOid().equals(firstCompVO.getOid())).collect(Collectors.toList()); UILayoutVO centerVO = new UILayoutVO(); @@ -1014,16 +1010,79 @@ // } /** * 获取某个UI上下文的区域 * 获取某个UI上下文的区域,根据权限控制返回 * @param pkContent UI上下文的主键 * @return 上下文 */ private List<UILayoutVO> listLayoutByContent(String pkContent){ private List<UILayoutVO> listLayoutByContent(String pkContent,Map<String, RoleRightVO> roleRightMap){ try { return UILayoutDO2VOs(Arrays.stream(platformClientUtil.getUIService().getPLTabPagesByPageDefinationOId(pkContent)).collect(Collectors.toList()),true); List<PLTabPage> tabPageList = Arrays.stream(platformClientUtil.getUIService().getPLTabPagesByPageDefinationOId(pkContent)).collect(Collectors.toList()); //过滤掉没有访问权限的UI tabPageList = this.filterTabPageByRoleRight(tabPageList,roleRightMap); return UILayoutDO2VOs(tabPageList,true,roleRightMap); } catch (PLException vciError) { throw WebUtil.getVciBaseException(vciError); } } /** * 根据权限集合过滤掉没有访问权限的页签数据 * @param tabPageList * @param roleRightMap */ private List<PLTabPage> filterTabPageByRoleRight(List<PLTabPage> tabPageList, Map<String, RoleRightVO> roleRightMap){ if(Func.isEmpty(roleRightMap) || Func.isEmpty(tabPageList)){ return tabPageList; } List<PLTabPage> filterList = new ArrayList<>(); for (int i = 0; i < tabPageList.size(); i++) { PLTabPage tabPage = tabPageList.get(i); if(roleRightMap.containsKey(tabPage.plOId)){ filterList.add(tabPage); } /*if(roleRightMap.containsKey(tabPage.plContextOId)) { Long rightValue = roleRightMap.get(tabPage.plContextOId).getRightValue(); int nodeValue = tabPage.plSeq; if (nodeValue >= 0 && nodeValue <= 63) { //进行位与操作,如果相等则表示具有当前操作的权限 long preValue = (rightValue >> nodeValue) & 1; if (preValue != 1) { tabPageList.remove(tabPage); } } }*/ } return filterList; } /** * 根据权限集合过滤掉没有访问权限的页面定义数据 * @param plPageDefinationList * @param roleRightMap */ private List<PLPageDefination> filterPageDefByRoleRight(List<PLPageDefination> plPageDefinationList, Map<String, RoleRightVO> roleRightMap){ if(Func.isEmpty(roleRightMap) || Func.isEmpty(plPageDefinationList)){ return plPageDefinationList; } List<PLPageDefination> filterList = new ArrayList<>(); for (int i = 0; i < plPageDefinationList.size(); i++) { PLPageDefination plPageDefination = plPageDefinationList.get(i); if(roleRightMap.containsKey(plPageDefination.plOId)){ filterList.add(plPageDefination); } /*if(roleRightMap.containsKey(plPageDefination.plTabPageOId)) { Long rightValue = roleRightMap.get(plPageDefination.plTabPageOId).getRightValue(); int nodeValue = plPageDefination.seq; if (nodeValue >= 0 && nodeValue <= 63) { //进行位与操作,如果相等则表示具有当前操作的权限 long preValue = (rightValue >> nodeValue) & 1; if (preValue != 1) { plPageDefinationList.remove(plPageDefination); } } }*/ } return filterList; } /** @@ -1077,7 +1136,7 @@ * @param pages 区域的数据对象 * @return 显示对象 */ private List<UILayoutVO> UILayoutDO2VOs(Collection<PLTabPage> pages, boolean queryDetail){ private List<UILayoutVO> UILayoutDO2VOs(Collection<PLTabPage> pages, boolean queryDetail, Map<String, RoleRightVO> roleRightMap){ List<UILayoutVO> contentVOS = new ArrayList<>(); Map<String, OsAttributeVO> attributeVOMap; if(pages != null && pages.size() > 0){ @@ -1091,7 +1150,7 @@ attributeVOMap = null; } Optional.ofNullable(pages).orElseGet(()->new ArrayList<PLTabPage>()).stream().forEach(page->{ UILayoutVO layoutVO = UILayoutDO2VO(page, queryDetail,attributeVOMap); UILayoutVO layoutVO = UILayoutDO2VO(page, queryDetail,attributeVOMap,roleRightMap); if(layoutVO.isEnableStatus()) { contentVOS.add(layoutVO); } @@ -1115,7 +1174,7 @@ * @return 区域的显示对象 */ @VciUnLog private UILayoutVO UILayoutDO2VO(PLTabPage page, boolean queryDetail,Map<String, OsAttributeVO> attributeVOMap){ private UILayoutVO UILayoutDO2VO(PLTabPage page, boolean queryDetail,Map<String, OsAttributeVO> attributeVOMap, Map<String, RoleRightVO> roleRightMap){ UILayoutVO layoutVO = new UILayoutVO(); if(page !=null ){ layoutVO.setOid(page.plOId); @@ -1155,7 +1214,10 @@ if(queryDetail){ //单个的,直接获取 try { layoutVO.setComponentVOs(uiComponentDO2VOs(Arrays.stream(platformClientUtil.getUIService().getPLPageDefinationsByPageContextOId(layoutVO.getOid())).collect(Collectors.toList()),true,attributeVOMap)); List<PLPageDefination> pageDefinationList = Arrays.stream(platformClientUtil.getUIService().getPLPageDefinationsByPageContextOId(layoutVO.getOid())).collect(Collectors.toList()); pageDefinationList = this.filterPageDefByRoleRight(pageDefinationList,roleRightMap); List<UIComponentVO> uiComponentVOS = uiComponentDO2VOs(pageDefinationList, true, attributeVOMap,roleRightMap); layoutVO.setComponentVOs(uiComponentVOS); } catch (PLException vciError) { throw WebUtil.getVciBaseException(vciError); } @@ -1163,6 +1225,7 @@ } return layoutVO; } /** * 查询所有的上下文的区域的映射 * @@ -1200,7 +1263,7 @@ return null; } try { return uiComponentDO2VO(platformClientUtil.getUIService().getPLPageDefinationById(componentOid),true,attributeVOMap); return uiComponentDO2VO(platformClientUtil.getUIService().getPLPageDefinationById(componentOid),true,attributeVOMap,null); } catch (PLException vciError) { throw WebUtil.getVciBaseException(vciError); } @@ -1224,10 +1287,10 @@ * @param pages 数据对象 * @return 显示对象 */ private List<UIComponentVO> uiComponentDO2VOs(Collection<com.vci.corba.portal.data.PLPageDefination> pages, boolean queryDetail,Map<String, OsAttributeVO> attributeVOMap){ private List<UIComponentVO> uiComponentDO2VOs(Collection<PLPageDefination> pages, boolean queryDetail,Map<String, OsAttributeVO> attributeVOMap, Map<String, RoleRightVO> roleRightMap){ List<UIComponentVO> componentVOS = new ArrayList<>(); pages.stream().forEach(page->{ componentVOS.add(uiComponentDO2VO(page,queryDetail,attributeVOMap)); componentVOS.add(uiComponentDO2VO(page,queryDetail,attributeVOMap,roleRightMap)); }); return componentVOS; } @@ -1238,7 +1301,7 @@ * @return 显示对象 */ @VciUnLog private UIComponentVO uiComponentDO2VO(PLPageDefination page, boolean queryDetail, Map<String, OsAttributeVO> attributeVOMap){ private UIComponentVO uiComponentDO2VO(PLPageDefination page, boolean queryDetail, Map<String, OsAttributeVO> attributeVOMap, Map<String, RoleRightVO> roleRightMap){ UIComponentVO componentVO = new UIComponentVO(); if(page !=null){ componentVO.setOid(page.plOId); @@ -1379,7 +1442,7 @@ treeDefineVO.setBtmType(componentDefineXO.getShowType()); treeDefineVO.setLinkType(componentDefineXO.getLinkType()); treeDefineVO.setLoadType("1".equalsIgnoreCase(componentDefineXO.getExpandMode())?"node":"all"); //TODO:这个属性现在由链接类型查询控制,不由页面定义控制了 //TODO:这个属性现在由链接类型查询模板配置上控制,不在页面定义控制了 //treeDefineVO.setOrientation("positive".equalsIgnoreCase(componentDefineXO.getOrientation())?false:true); treeDefineVO.setShowImage("1".equalsIgnoreCase(componentDefineXO.getIsShowImage())?true:false); treeDefineVO.setRootContent(componentDefineXO.getRootContent()); @@ -1405,34 +1468,30 @@ } componentVO.setUiParseClass(componentDefineXO.getUIParser()); componentVO.setExtendAttr(componentDefineXO.getExtAttr()); componentVO.setButtons(listButtonByComponent(componentVO.getOid())); componentVO.setButtons(listButtonByComponent(componentVO.getOid(),roleRightMap)); } return componentVO; } /** * 获取某个组件的按钮 * 获取某个组件的按钮(根据权限过滤) * @param pkComponent 组件的主键 * @return 按钮的信息 */ @Override public List<UIButtonDefineVO> listButtonByComponent(String pkComponent){ public List<UIButtonDefineVO> listButtonByComponent(String pkComponent, Map<String, 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()); 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); if(Func.isEmpty(roleRightMap)){ roleRightMap = uiManagerServiceI.getRoleRightMap(null); } //循环对按钮权限进行判断,没有权限的将移除buttonDefineVOS对象 Iterator<UIButtonDefineVO> buttonDefineVO = buttonDefineVOS.iterator(); while (buttonDefineVO.hasNext()){ UIButtonDefineVO buttonDefine = buttonDefineVO.next(); if(rightMap.containsKey(buttonDefine.getPkComponent())) { Long rightValue = rightMap.get(buttonDefine.getPkComponent()); if(roleRightMap.containsKey(buttonDefine.getPkComponent())) { Long rightValue = roleRightMap.get(buttonDefine.getPkComponent()).getRightValue(); int nodeValue = buttonDefine.getOrderNum(); if (nodeValue >= 0 && nodeValue <= 63) { //进行位与操作,如果相等则表示具有当前操作的权限 @@ -1469,7 +1528,7 @@ * @return 显示对象 */ @Override public List<UIButtonDefineVO> buttonDO2VOs(Collection<com.vci.corba.portal.data.PLTabButton> buttons){ public List<UIButtonDefineVO> buttonDO2VOs(Collection<PLTabButton> buttons){ List<UIButtonDefineVO> buttonDefineVOS = new ArrayList<>(); if(buttons != null && buttons.size() > 0){ // Map<String, UIActionVO> actionVOMap = self.selectAllActionMap(); @@ -1493,7 +1552,7 @@ * @return 显示对象 */ @Override public UIButtonDefineVO buttonDO2VO(com.vci.corba.portal.data.PLTabButton button, Map<String, UIActionVO> actionVOMap) { public UIButtonDefineVO buttonDO2VO(PLTabButton button, Map<String, UIActionVO> actionVOMap) { UIButtonDefineVO buttonVO = new UIButtonDefineVO(); // Map<String, UIActionVO> actionVOMap = ServiceProvider.getUIService().getAllPLAction(); if(button !=null){ @@ -1587,7 +1646,7 @@ * @return UI上下文的信息 */ @Override public UIContentVO getUIContentByBtmTypeAndId(String btmType, String id) { public UIContentVO getUIContentByBtmTypeAndId(String btmType, String id) throws PLException { WebUtil.alertNotNull(btmType,"业务类型或者链接类型",id,"UI上下文的编号"); PLUILayout[] obj = null; try { @@ -1595,6 +1654,10 @@ } catch (PLException vciError) { throw WebUtil.getVciBaseException(vciError); } // 1、根据当前角色判断是管理人员还是普通用户(正常来说只有普通用户才会用到该查询接口) Map<String, RoleRightVO> roleRightMap = uiManagerServiceI.getRoleRightMap(null); // 2、按照当前登录用户查询权限(功能权限和UI授权的授权信息都是放在同一张表里的) // 3、找出当前要查询的UI上下文 PLUILayout context = null; for (int i = 0; i < obj.length; i++) { if (obj[i].plCode.equals(id)) { @@ -1602,7 +1665,9 @@ break; } } return UIContentDO2VO(context,true); // 4、每一个菜单查询的都是一个UI上下文,所以UI上下文是有功能授权控制的,只需要控制后面的页签、页面、按钮的权限。 return UIContentDO2VO(context, true,roleRightMap); } } Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIManagerServiceImpl.java
@@ -45,7 +45,7 @@ import java.util.stream.Collectors; /** * UI定义服务界面相关接口 * UI定义管理服务界面相关接口 * @author ludc * @date 2024/8/28 17:05 */ @@ -1696,10 +1696,7 @@ boolean showCheckBox = Boolean.parseBoolean(conditionMap.get("showCheckBox")); Map<String,RoleRightVO> roleRightVOMap = new HashMap<>(); if(StringUtils.isNotBlank(roleId)){ String userName = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(); RoleRightInfo[] rightInfos = platformClientUtil.getFrameworkService().getRoleRightList(roleId,userName); List<RoleRightVO> roleRightVOList = roleRightDOO2VOS(Arrays.asList(rightInfos)); roleRightVOMap = roleRightVOList.stream().collect(Collectors.toMap(RoleRightVO::getFuncId,roleRightVO ->roleRightVO,(oldValue,newOldValue)->oldValue)); roleRightVOMap = this.getRoleRightMap(roleId); } BizType[] bizTypes = osBtmServiceI.getBizTypes(type); List<Tree> treeList=new ArrayList<>(); @@ -1709,7 +1706,6 @@ rootNode.setExpanded(true); List<Tree> childList=new ArrayList<>(); //long startTime = System.currentTimeMillis(); uiDataFetcher = new UIDataFetcher(); for (int i = 0; i < bizTypes.length; i++) { Tree bizTypeTree = new Tree(bizTypes[i].oid,bizTypes[i].name,bizTypes[i]);//(btmItems[i].label+" ["+ btmItems[i].name+"]", btmItems[i]); @@ -1718,18 +1714,12 @@ bizTypeTree.setParentId(rootNode.getOid()); bizTypeTree.setParentName(rootNode.getText()); bizTypeTree.setParentBtmName(bizTypes[i].name); //long startTime1 = System.currentTimeMillis(); List<PLUILayout> contextList = uiDataFetcher.getContext(bizTypes[i].name/*+context*/); //long endTime1 = System.currentTimeMillis(); //System.out.println("============================================获取UI定义数据引擎耗时:"+((endTime1-startTime1)/1000)+"s"); List<Tree> btmChildList = new ArrayList<>(); btmChildList.add(bizTypeTree); setChildNode(btmChildList,contextList,roleRightVOMap,showCheckBox); childList.add(bizTypeTree); } //long endTime = System.currentTimeMillis(); //System.out.println("============================================UI定义树计算完毕耗时:"+((endTime-startTime)/1000)+"s"); rootNode.setChildren(childList); treeList.add(rootNode); return treeList; @@ -1737,21 +1727,25 @@ /** * 根据角色主键获取已授权的信息 * @param roleId * @param roleId 如果roleId不传,就会获取当前登录的用户的名称查询权限 * @return * @throws PLException */ /* @Override public Map<String,RoleRightVO> getRightListByRoleId(String roleId) throws PLException { VciBaseUtil.alertNotNull(roleId,"查询条件角色主键"); String userName = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(); RoleRightInfo[] rightInfos= platformClientUtil.getFrameworkService().getRoleRightList(roleId,userName); List<RoleRightVO> roleRightVOList = roleRightDOO2VOS(Arrays.asList(rightInfos)); Map<String,RoleRightVO> roleRightVOMap = roleRightVOList.stream().collect(Collectors.toMap(RoleRightVO::getFuncId,roleRightVO ->roleRightVO,(oldValue,newOldValue)->oldValue)); return roleRightVOMap; }*/ @Override public Map<String,RoleRightVO> getRoleRightMap(String roleId) throws PLException { RoleRightInfo[] rightInfos = null; String userName = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(); if(Func.isBlank(roleId)){ rightInfos = platformClientUtil.getFrameworkService().getRoleRightByUserName(userName); }else{ rightInfos = platformClientUtil.getFrameworkService().getRoleRightList(roleId,userName); } List<RoleRightVO> roleRightVOList = roleRightDOO2VOS(Arrays.asList(rightInfos)); Map<String,RoleRightVO> roleRightVOMap = roleRightVOList.stream().collect(Collectors.toMap(RoleRightVO::getFuncId,roleRightVO ->roleRightVO,(oldValue,newOldValue)->oldValue)); return roleRightVOMap; } /*** /** * UI授权 * @param uiAuthorDTO * @return @@ -2229,7 +2223,7 @@ String id = plTabButton.plTableOId; if(roleRightVOMap.containsKey(id)){ RoleRightVO roleRightVO = roleRightVOMap.get(id); Long rightValue = roleRightVO.getRightValue(); Long rightValue = roleRightVO.getRightValue(); int nodeValue = plTabButton.plSeq; if (nodeValue >= 0 && nodeValue <= 63) { long preValue = (rightValue >> nodeValue) & 1; Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/uidataservice/impl/UIDataCommonServiceImpl.java
@@ -154,9 +154,9 @@ if(Func.isNotEmpty(dataGridQuery.getSourceData())){ dataGridQuery.setSourceData(this.convertMapValueJson2Map(dataGridQuery.getSourceData())); } //先判断查询模板是否配置了自定义查询类 UIComponentVO componentVO = uiEngineService.getComponentByOid(dataGridQuery.getComponentOid(), null); UITableDefineVO tableDefineVO = componentVO.getTableDefineVO(); //先判断查询模板是否配置了自定义查询类 String bsCustQueryCLsOrUrl = componentVO.getBsDataModel() ; // TODO: 2024/12/5 Ludc 根据UI配置的进行判断是否使用自定义类进行查询(自定义类查询方式优先级高于查询模板) if(Func.isNotBlank(bsCustQueryCLsOrUrl) && isCustomClass(bsCustQueryCLsOrUrl)){