| | |
| | | import com.vci.corba.common.data.UserEntityInfo; |
| | | 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; |
| | | import com.vci.corba.portal.PortalService; |
| | | import com.vci.corba.portal.data.*; |
| | |
| | | import com.vci.starter.web.pagemodel.DataGrid; |
| | | import com.vci.starter.web.pagemodel.SessionInfo; |
| | | import com.vci.starter.web.util.*; |
| | | import com.vci.web.redis.RedisService; |
| | | import com.vci.starter.web.redis.RedisService; |
| | | import com.vci.web.service.OsBtmServiceI; |
| | | import com.vci.web.service.UIManagerServiceI; |
| | | import com.vci.web.util.*; |
| | |
| | | private final String IMPORTUIKEY = "importUIKey:"; |
| | | |
| | | /** |
| | | * 当前登录用户的信息 |
| | | */ |
| | | private SessionInfo sessionInfo = null; |
| | | |
| | | /** |
| | | * 排序比较器 |
| | | */ |
| | | private Comparator<PLUILayout> pageLayoutComparator = new Comparator<PLUILayout>() { |
| | |
| | | } |
| | | |
| | | /** |
| | | * ton通过业务类型和名称查询 |
| | | * 通过业务类型和名称查询 |
| | | * @param btemName |
| | | * @param context |
| | | * @return |
| | |
| | | pdVO.getShowType(), |
| | | pdVO.getLinkType(), |
| | | pdVO.getQueryTemplateName(), |
| | | pdVO.getShowExpressionRoot(), |
| | | pdVO.getShowExpression(), |
| | | pdVO.getRefTreeSet(), |
| | | pdVO.getRootContent(), |
| | | pdVO.getShowAbs(), |
| | | pdVO.getShowLinkAbs(), |
| | | pdVO.getSeparator(), |
| | | pdVO.getExpandMode() |
| | | ); |
| | |
| | | case "6": |
| | | UILayoutComptCheckInput ulci = new UILayoutComptCheckInput( |
| | | pdVO.getSearchTarger(), |
| | | pdVO.getShowType(), |
| | | pdVO.getUiLayout(), |
| | | pdVO.getSubUIObjType(), |
| | | pdVO.getSubUILayout(), |
| | | pdVO.getQueryTemplateName(), |
| | | pdVO.getQryType() |
| | | ); |
| | |
| | | pdVO.getShowType(), |
| | | pdVO.getLinkType(), |
| | | pdVO.getQueryTemplateName(), |
| | | pdVO.getShowExpressionRoot(), |
| | | pdVO.getShowExpression(), |
| | | pdVO.getRefTreeSet(), |
| | | pdVO.getRootContent(), |
| | | pdVO.getShowAbs(), |
| | | pdVO.getShowLinkAbs(), |
| | | pdVO.getSeparator(), |
| | | pdVO.getExpandMode() |
| | | ); |
| | |
| | | case "6": |
| | | UILayoutComptCheckInput ulci = new UILayoutComptCheckInput( |
| | | pdVO.getSearchTarger(), |
| | | pdVO.getShowType(), |
| | | pdVO.getUiLayout(), |
| | | pdVO.getSubUIObjType(), |
| | | pdVO.getSubUILayout(), |
| | | pdVO.getQueryTemplateName(), |
| | | pdVO.getQryType() |
| | | ); |
| | |
| | | } |
| | | plTabButtonVO.setOId(tabButtonDO.plOId); |
| | | plTabButtonVO.setTableOId(tabButtonDO.plTableOId); |
| | | plTabButtonVO.setPageOId(tabButtonDO.plPageOId); |
| | | //plTabButtonVO.setPageOId(tabButtonDO.plPageOId); |
| | | plTabButtonVO.setActionOId(tabButtonDO.plActionOId); |
| | | plTabButtonVO.setLabel(tabButtonDO.plLabel); |
| | | plTabButtonVO.setAreaType(tabButtonDO.plAreaType); |
| | |
| | | LinkedHashMap::new // 指定使用 LinkedHashMap |
| | | )); |
| | | plTabButtonVO.setButtonParams(parameterMap); |
| | | } |
| | | if(Func.isNotBlank(tabButtonDO.plActionOId)){ |
| | | PLAction actionInfo = platformClientUtil.getUIService().getPLActionById(tabButtonDO.plActionOId); |
| | | plTabButtonVO.setActionName(Func.isNotEmpty(actionInfo) ? actionInfo.plName:""); |
| | | } |
| | | return plTabButtonVO; |
| | | } |
| | |
| | | private PLTabButton tabButtonVO2TabButton(PLTabButton plTabButton,PLTabButtonVO tabButtonVO) { |
| | | plTabButton.plOId = tabButtonVO.getOId(); |
| | | plTabButton.plTableOId = tabButtonVO.getTableOId(); |
| | | plTabButton.plPageOId = tabButtonVO.getPageOId(); |
| | | //plTabButton.plPageOId = tabButtonVO.getPageOId(); |
| | | plTabButton.plActionOId = tabButtonVO.getActionOId(); |
| | | plTabButton.plLabel = tabButtonVO.getLabel(); |
| | | plTabButton.plAreaType = tabButtonVO.getAreaType(); |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public BaseResult addTapButton(PLTabButtonVO tabButtonVO) { |
| | | public BaseResult addTabButton(PLTabButtonVO tabButtonVO) { |
| | | boolean res = this.saveOrUpdateTapButton(tabButtonVO, true); |
| | | return res ? BaseResult.success("按钮配置添加成功!"):BaseResult.success("按钮配置添加失败!"); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public BaseResult updateTapButton(PLTabButtonVO tabButtonVO) { |
| | | public BaseResult updateTabButton(PLTabButtonVO tabButtonVO) { |
| | | boolean res = this.saveOrUpdateTapButton(tabButtonVO, false); |
| | | return res ? BaseResult.success("按钮配置修改成功!"):BaseResult.success("按钮配置修改失败!"); |
| | | } |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | this.saveButtonParams(tabButtonVO.getButtonParams(),plTabButton.plOId); |
| | | return true; |
| | | } |
| | | |
| | | LinkedHashMap<String, String> buttonParams = tabButtonVO.getButtonParams(); |
| | | /** |
| | | * 按钮参数保存 |
| | | * @param buttonParams |
| | | * @param tabButtonOid |
| | | * @return |
| | | */ |
| | | private void saveButtonParams(LinkedHashMap<String, String> buttonParams,String tabButtonOid) throws VciBaseException{ |
| | | if(Func.isNotEmpty(buttonParams)) { |
| | | Iterator<Map.Entry<String, String>> iterator = buttonParams.entrySet().iterator(); |
| | | while(iterator.hasNext()){ |
| | |
| | | Map.Entry<String, String> next = kvItor.next(); |
| | | PLCommandParameter plCommandParameter = new PLCommandParameter(); |
| | | plCommandParameter.plOId = ObjectUtility.getNewObjectID36(); |
| | | plCommandParameter.plCommandOId = plTabButton.plOId; |
| | | plCommandParameter.plCommandOId = tabButtonOid; |
| | | plCommandParameter.plKey = next.getKey(); |
| | | plCommandParameter.plValue = next.getValue(); |
| | | plCommandParameter.plCreateUser = sessionInfo.getUserId(); |
| | |
| | | } |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean deleteTapButton(PLTabButtonVO tabButtonVO) throws PLException { |
| | | public boolean deleteTabButton(PLTabButtonVO tabButtonVO) throws PLException { |
| | | VciBaseUtil.alertNotNull(tabButtonVO,"删除的按钮配置对象"); |
| | | boolean success = platformClientUtil.getUIService().deletePLTabButton(this.tabButtonVO2TabButton(new PLTabButton(),tabButtonVO)); |
| | | if(success == false){ |
| | |
| | | */ |
| | | @Override |
| | | public BaseResult joinBtn(PLTabButtonVO tabButtonVO) throws PLException { |
| | | VciBaseUtil.alertNotNull(tabButtonVO,"需调整为下级按钮",tabButtonVO.getTableOId(),"当前按钮配置所在的页面主键"); |
| | | VciBaseUtil.alertNotNull(tabButtonVO,"需调整为下级按钮的对象",tabButtonVO.getTableOId(),"当前按钮配置所在的页面主键"); |
| | | //同一页面下的按钮 |
| | | List<PLTabButtonVO> plTabButtons = this.getTabButtons(tabButtonVO.getTableOId()); |
| | | if(Func.isEmpty(plTabButtons)){ |
| | |
| | | } |
| | | BizType[] bizTypes=osBtmServiceI.getBizTypes(type); |
| | | List<Tree> treeList=new ArrayList<>(); |
| | | Tree rootNode =new Tree("root","功能模块","root"); |
| | | Tree rootNode =new Tree("root","功能模块","root"); |
| | | rootNode.setLevel(0); |
| | | rootNode.setShowCheckbox(true); |
| | | rootNode.setExpanded(true); |
| | |
| | | * @param vo |
| | | * @return |
| | | */ |
| | | private RoleRightDTO roleRightVOO2DTO(RoleRightVO vo){ |
| | | private RoleRightDTO roleRightVOO2DTO(RoleRightVO vo){ |
| | | RoleRightDTO dto=new RoleRightDTO(); |
| | | dto.setId(vo.getId()); |
| | | dto.setCreateTime(vo.getCreateTime()); |
| | |
| | | * @param dto |
| | | * @return |
| | | */ |
| | | private RoleRightInfo roleRightDTOO2Info(RoleRightDTO dto) throws Exception { |
| | | private RoleRightInfo roleRightDTOO2Info(RoleRightDTO dto) throws Exception { |
| | | RoleRightInfo info=new RoleRightInfo(); |
| | | info.id=StringUtils.isBlank(dto.getId())?"":dto.getId(); |
| | | info.createTime=StringUtils.isBlank(dto.getCreateTime())?new Date().getTime():VciDateUtil.getTime(VciDateUtil.str2Date(dto.getCreateTime(),"")); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 查询链接类型下拉 |
| | | * @param baseQueryObject |
| | | * @return |
| | | * @throws PLException |
| | | */ |
| | | public DataGrid<LinkType> getLinkDatasByPage(BaseQueryObject baseQueryObject) throws PLException{ |
| | | List<LinkType> list = new ArrayList<>(); |
| | | Map<String, LinkType> map = new HashMap<>(); |
| | | LinkType[] lts = platformClientUtil.getLinkTypeService().getLinkTypes(); |
| | | for (LinkType lt : lts) { |
| | | Map<String, String> conditionMap = baseQueryObject.getConditionMap(); |
| | | if(Func.isNotEmpty(conditionMap)){ |
| | | //选择的对象类型 |
| | | String selectBtmType = conditionMap.get("selectBtmType"); |
| | | if(selectBtmType != null){ |
| | | boolean existFrom = existInArray(selectBtmType, lt.btmItemsFrom); |
| | | boolean existTo = existInArray(selectBtmType, lt.btmItemsTo); |
| | | if(existFrom || existTo){ |
| | | if(!map.containsKey(lt.name)){ |
| | | map.put(lt.name, lt); |
| | | list.add(lt); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | DataGrid<LinkType> res = new DataGrid<>(); |
| | | res.setData(list); |
| | | res.setTotal(list.size()); |
| | | return res; |
| | | } |
| | | |
| | | private boolean existInArray(String value, String[] values){ |
| | | boolean res = false; |
| | | for (String string : values) { |
| | | if(string.equals(value)){ |
| | | res = true; |
| | | break; |
| | | } |
| | | } |
| | | return res; |
| | | } |
| | | |
| | | /** |
| | | * UI定义下拉查询(templateType为UI定义时的UI定义下拉查询) |
| | | * @param baseQueryObject selectBtmType 选择的源对象,带分页信息 |
| | | * @return |
| | |
| | | return res; |
| | | } |
| | | |
| | | /** |
| | | * 通过业务类型获取UI上下文包含其下关联的区域定义>页面定义等所有关联数据,归纳成tree结构 |
| | | * @param btmName 业务类型名称 |
| | | * @param level 查询到那个层级为止(ui、tab、pageDef) |
| | | * @return |
| | | */ |
| | | public Tree getAllLevelTreeByBtm(String btmName,String level) throws PLException { |
| | | VciBaseUtil.alertNotNull(btmName,"业务类型编号",level,"查询层级"); |
| | | Tree resTree = new Tree(); |
| | | resTree.setText("UI上下文选项"); |
| | | resTree.setId("UILayout"); |
| | | resTree.setLeaf(false); |
| | | resTree.setLevel(1); |
| | | String level1Oid = ObjectUtility.getNewObjectID36(); |
| | | resTree.setOid(level1Oid); |
| | | |
| | | PLUILayout[] pluiLayouts = platformClientUtil.getUIService().getPLUILayoutsByRelatedType(btmName); |
| | | if(Func.isEmpty(pluiLayouts)){ |
| | | return resTree; |
| | | } |
| | | //根据查询的层级不同决定是否返回 |
| | | List<Tree> uiChildrenTree = new ArrayList<>(); |
| | | |
| | | Arrays.stream(pluiLayouts).forEach(item->{ |
| | | Tree uiTree = new Tree(); |
| | | uiTree.setLeaf(level.equals("ui")); |
| | | uiTree.setLevel(2); |
| | | uiTree.setId(item.plCode); |
| | | uiTree.setOid(item.plOId); |
| | | uiTree.setText(item.plCode + "(" + item.plName + ")"); |
| | | uiTree.setParentId(level1Oid); |
| | | List<Tree> tabChildren = null; |
| | | if(!level.equalsIgnoreCase("ui")){ |
| | | try { |
| | | tabChildren = this.getTabChildren(item.plOId, level); |
| | | } catch (PLException e) { |
| | | e.printStackTrace(); |
| | | String exceptionMessage = "查询页签时出现错误:"+VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(exceptionMessage); |
| | | throw new VciBaseException(exceptionMessage); |
| | | } |
| | | uiTree.setChildren(tabChildren); |
| | | } |
| | | uiChildrenTree.add(uiTree); |
| | | }); |
| | | |
| | | resTree.setChildren(uiChildrenTree); |
| | | return resTree; |
| | | } |
| | | |
| | | /** |
| | | * 克隆按钮(存在父子结构关系、关联数据按钮参数) |
| | | * @param uiCloneVO |
| | | * @return |
| | | * @throws Throwable |
| | | */ |
| | | @Override |
| | | public BaseResult cloneTabButton(UICloneVO uiCloneVO) throws Throwable { |
| | | VciBaseUtil.alertNotNull(uiCloneVO,"克隆对象",uiCloneVO.getSourceOId(),"源对象主键"); |
| | | String fromOId = uiCloneVO.getSourceOId(); |
| | | String toOId = uiCloneVO.getToOId(); |
| | | //先查询源对象 |
| | | //PLTabButton tabButton = platformClientUtil.getUIService().getPLTabButtonById(fromOId); |
| | | String sourceTableOId = uiCloneVO.getCloneParam().get("sourceTableOId"); |
| | | if(Func.isBlank(sourceTableOId)){ |
| | | return BaseResult.fail("未从请求参数中获取到,源对象关联的页面定义主键!!"); |
| | | } |
| | | //判断是否有目标主键,如果没有就说明是克隆到当前页面下 |
| | | if(Func.isBlank(toOId)){ |
| | | toOId = sourceTableOId; |
| | | } |
| | | //判断前端是否传了克隆名过来(按钮这边不需要名称、编号判重,所以这一块儿逻辑忽略) |
| | | //按钮具有父子级关系,所以还需要做oid和parentOId处理 |
| | | List<PLTabButtonVO> tabButtons = this.getTabButtons(sourceTableOId); |
| | | PLTabButtonVO filterTabButton = tabButtons.stream() |
| | | .filter(item -> item.getOId().equals(fromOId)).findFirst().orElse(null); |
| | | if(Func.isEmpty(filterTabButton)){ |
| | | return BaseResult.fail("根据源对象主键未查询到源对象,请刷新后重试!!"); |
| | | } |
| | | if(Func.isEmpty(sessionInfo)){ |
| | | sessionInfo = WebThreadLocalUtil.getCurrentUserSessionInfoInThread(); |
| | | } |
| | | |
| | | //改变button对象的oid和parentOId |
| | | this.modifyButtonIdsAndCopy(filterTabButton,toOId,ObjectUtility.getNewObjectID36()); |
| | | |
| | | return BaseResult.success("按钮复制成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 修改oId和parentOid,不改变父子级(oid变换parentOId也需要跟着变换)结构,并保存按钮和其参数 |
| | | * @param button |
| | | * @param newOId |
| | | */ |
| | | private void modifyButtonIdsAndCopy(PLTabButtonVO button,String toOId, String newOId) throws PLException { |
| | | if (button == null) { |
| | | return; |
| | | } |
| | | |
| | | // 修改当前节点的oId |
| | | button.setOId(newOId); |
| | | //开始保存按钮和参数 |
| | | button.setCreateUser(sessionInfo.getUserId()); |
| | | button.setModifyUser(sessionInfo.getUserId()); |
| | | button.setTableOId(toOId); |
| | | PLTabButton plTabButton = this.tabButtonVO2TabButton(new PLTabButton(), button); |
| | | boolean res = platformClientUtil.getUIService().savePLTabButton(plTabButton); |
| | | if(!res){ |
| | | throw new PLException("500",new String[]{"按钮配置复制失败!"}); |
| | | } |
| | | this.saveButtonParams(button.getButtonParams(),button.getOId()); |
| | | |
| | | // 递归遍历子节点 |
| | | if (button.getChildren() != null) { |
| | | for (PLTabButtonVO child : button.getChildren()) { |
| | | |
| | | // 子对象的 parentOid 设置为当前节点的新oid |
| | | modifyButtonIdsAndCopy(child,toOId, ObjectUtility.getNewObjectID36()); |
| | | child.setParentOid(button.getOId()); // 确保子对象的parentOid指向当前的oid |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 克隆页签 |
| | | * @param uiCloneVO |
| | | * @return |
| | | * @throws Throwable |
| | | */ |
| | | @Override |
| | | public BaseResult clonetabPage(UICloneVO uiCloneVO) throws Throwable { |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 克隆页面定义 |
| | | * @param uiCloneVO |
| | | * @return |
| | | * @throws Throwable |
| | | */ |
| | | @Override |
| | | public BaseResult clonePageDef(UICloneVO uiCloneVO) throws Throwable { |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 获取页签这一层的关联数据 |
| | | * @return |
| | | */ |
| | | private List<Tree> getTabChildren(String uiLayoutOid,String level) throws PLException { |
| | | List<Tree> tabChildren = new ArrayList<>(); |
| | | if(Func.isNotBlank(uiLayoutOid)){ |
| | | PLTabPage[] tabPages = platformClientUtil.getUIService().getPLTabPagesByPageDefinationOId(uiLayoutOid); |
| | | Arrays.stream(tabPages).forEach(tabPage->{ |
| | | Tree tabTree = new Tree(); |
| | | tabTree.setLeaf(level.equals("tab")); |
| | | tabTree.setLevel(2); |
| | | tabTree.setId(tabPage.plCode); |
| | | tabTree.setOid(tabPage.plOId); |
| | | tabTree.setText(tabPage.plCode + "(" + tabPage.plName + ")"); |
| | | tabTree.setParentId(uiLayoutOid); |
| | | if(!level.equalsIgnoreCase("tab")){ |
| | | try { |
| | | tabTree.setChildren(this.getPageDefChildren(tabPage.plOId,level)); |
| | | } catch (PLException e) { |
| | | e.printStackTrace(); |
| | | String exceptionMessage = "查询页面定义时出现错误:"+VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(exceptionMessage); |
| | | throw new VciBaseException(exceptionMessage); |
| | | } |
| | | } |
| | | tabChildren.add(tabTree); |
| | | }); |
| | | } |
| | | return tabChildren; |
| | | } |
| | | |
| | | /** |
| | | * 获取页面定义这一层的关联数据 |
| | | * @return |
| | | */ |
| | | private List<Tree> getPageDefChildren(String tabPageOid,String level) throws PLException { |
| | | List<Tree> pageDefChildren = new ArrayList<>(); |
| | | if(Func.isNotBlank(tabPageOid)){ |
| | | PLPageDefination[] pageDefs = platformClientUtil.getUIService().getPLPageDefinationsByPageContextOId(tabPageOid); |
| | | Arrays.stream(pageDefs).forEach(pageDef->{ |
| | | Tree tabTree = new Tree(); |
| | | tabTree.setLeaf(true); |
| | | tabTree.setLevel(2); |
| | | tabTree.setId(pageDef.name); |
| | | tabTree.setOid(pageDef.plOId); |
| | | tabTree.setText(pageDef.name + "(" + pageDef.desc + ")"); |
| | | tabTree.setParentId(tabPageOid); |
| | | pageDefChildren.add(tabTree); |
| | | }); |
| | | } |
| | | return pageDefChildren; |
| | | } |
| | | |
| | | //基础公共检查接口 |
| | | private abstract class BaseComptInter { |
| | | |