| | |
| | | import com.vci.corba.portal.data.*; |
| | | import com.vci.dto.RoleRightDTO; |
| | | import com.vci.dto.UIAuthorDTO; |
| | | import com.vci.frameworkcore.compatibility.SmRoleQueryServiceI; |
| | | import com.vci.model.PLDefination; |
| | | import com.vci.pagemodel.PLDefinationVO; |
| | | import com.vci.pagemodel.PLTabButtonVO; |
| | | import com.vci.pagemodel.PLUILayoutCloneVO; |
| | | import com.vci.pagemodel.RoleRightVO; |
| | | import com.vci.pagemodel.*; |
| | | import com.vci.starter.web.exception.VciBaseException; |
| | | import com.vci.starter.web.pagemodel.*; |
| | | import com.vci.starter.web.pagemodel.BaseQueryObject; |
| | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.swing.*; |
| | | import javax.swing.tree.TreePath; |
| | | import java.io.IOException; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | |
| | | @Resource |
| | | private PlatformClientUtil platformClientUtil; |
| | | |
| | | /** |
| | | * 角色 |
| | | */ |
| | | @Resource |
| | | private SmRoleQueryServiceI smRoleQueryServiceI; |
| | | /*** |
| | | * 是否是管理员 |
| | | */ |
| | | @Autowired |
| | | RightControlUtil rightControlUtil; |
| | | |
| | | /** |
| | | * 业务类型 |
| | | */ |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<PLTabButtonVO> getTabButton(String pageDefinationOid) { |
| | | public List<PLTabButtonVO> getTabButtons(String pageDefinationOid) { |
| | | VciBaseUtil.alertNotNull(pageDefinationOid,"页面定义主键"); |
| | | List<PLTabButton> buttonList = new ArrayList<>(); |
| | | try { |
| | | PLTabButton[] plTabButtons = platformClientUtil.getUIService().getPLTabButtonsByTableOId(pageDefinationOid); |
| | | buttonList = Arrays.asList(plTabButtons); |
| | | return this.tabButton2TabButtonVOS(buttonList); |
| | | List<PLTabButtonVO> plTabButtonVOList = this.tabButton2TabButtonVOS(buttonList); |
| | | PLTabButtonVO plTabButtonVO = new PLTabButtonVO(); |
| | | for(int i = 0; i < plTabButtonVOList.size(); i++){ |
| | | plTabButtonVO = plTabButtonVOList.get(i); |
| | | |
| | | if(plTabButtonVO.getParentOid().equals("")){ |
| | | plTabButtonVO.setChildren(plTabButtonVO2Children(plTabButtonVOList,plTabButtonVO.getOId())); |
| | | } |
| | | } |
| | | return plTabButtonVOList; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new VciBaseException("加载页签区域按钮配置信息异常:" + e.getMessage()); |
| | |
| | | plTabButtonVO.setButtonParams(parameterMap); |
| | | } |
| | | return plTabButtonVO; |
| | | } |
| | | |
| | | /** |
| | | * 按钮配置子节点查找 |
| | | * @param plOid |
| | | * @param plTabButtonVOList |
| | | * @return |
| | | */ |
| | | private List<PLTabButtonVO> plTabButtonVO2Children(List<PLTabButtonVO> plTabButtonVOList, String plOid){ |
| | | ArrayList<PLTabButtonVO> plTabButtonVOS = new ArrayList<>(); |
| | | for (PLTabButtonVO plTabButtonVO : plTabButtonVOList) { |
| | | if(StringUtils.isBlank(plTabButtonVO.getParentOid())){ |
| | | continue; |
| | | } |
| | | if(plTabButtonVO.getParentOid().equals(plOid)){ |
| | | plTabButtonVO.setChildren(plTabButtonVO2Children(plTabButtonVOList,plOid)); |
| | | plTabButtonVOS.add(plTabButtonVO); |
| | | } |
| | | } |
| | | return plTabButtonVOS; |
| | | } |
| | | |
| | | /** |
| | |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 删除单个按钮配置 |
| | | * @param tabButton |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean deleteTapButton(PLTabButton tabButton) throws PLException { |
| | | VciBaseUtil.alertNotNull(tabButton,"删除的按钮配置对象"); |
| | | boolean success = UITools.getService().deletePLTabButton(tabButton); |
| | | if(success == false){ |
| | | throw new VciBaseException("该有子级按钮,不能删除!"); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 调整为下级按钮 |
| | | * @param plTabButton |
| | | * @return |
| | | */ |
| | | @Override |
| | | public BaseResult joinBtn(PLTabButton plTabButton) throws PLException { |
| | | VciBaseUtil.alertNotNull(plTabButton,"需调整为下级按钮",plTabButton.plTableOId,"当前按钮配置所在的页面主键"); |
| | | //同一页面下的按钮 |
| | | List<PLTabButtonVO> plTabButtons = this.getTabButtons(plTabButton.plTableOId); |
| | | if(Func.isEmpty(plTabButtons)){ |
| | | return BaseResult.fail("未获取到按钮配置信息!"); |
| | | } |
| | | //获取当前要移动的按钮的下标 |
| | | int index = 0; |
| | | for (int i = 0; i < plTabButtons.size(); i++) { |
| | | if (plTabButtons.get(i).getOId().equals(plTabButton.plOId)) { |
| | | index = i; // 找到后记录下标 |
| | | break; // 找到后退出循环 |
| | | } |
| | | } |
| | | //当选择的按钮为树的第一个节点的时候,他的兄节点是他自己,导致调整为下级按钮时出错,故作此判断。 |
| | | if(index == 0){ |
| | | return BaseResult.fail("当前节点不存在兄节点,无法调整为下级按钮!"); |
| | | } |
| | | //设置父id为上一个节点的 |
| | | plTabButton.plParentOid = plTabButtons.get(index-1).getOId(); |
| | | |
| | | boolean success = platformClientUtil.getUIService().updatePLTabButton(plTabButton); |
| | | if(success == false) { |
| | | return BaseResult.fail("修改失败!"); |
| | | } |
| | | return BaseResult.fail("修改成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 调整为上级按钮 |
| | | * @param plTabButton |
| | | * @return |
| | | */ |
| | | @Override |
| | | public BaseResult exitBtn(PLTabButton plTabButton) throws PLException { |
| | | plTabButton.plParentOid = ""; |
| | | |
| | | boolean success = platformClientUtil.getUIService().updatePLTabButton(plTabButton); |
| | | if(success == false) { |
| | | BaseResult.fail("撤销失败!"); |
| | | } |
| | | return BaseResult.success("撤销成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 处理配置的event事件 |
| | |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 获取权限 |
| | | * @param isUp 是否是向上获取,如果是向上获取,传进来的必然是模块节点,且上级模块必然是没有选中 |
| | |
| | | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 传入直接挂接操作的模块的节点,计算该节点的权限值 |
| | | * @param node 模块节点 |
| | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | private void setChildNode(List<Tree> parentTree, List<PLUILayout>contextList,Map<String,RoleRightVO> roleRightVOMap,boolean isShowCheckBox){ |
| | | Optional.ofNullable(parentTree).orElseGet(()->new ArrayList<Tree>()).stream().forEach(pTree -> { |
| | | Object funcObj= pTree.getData(); |