From 8f6576fd595f67a3b17ef2e5e8054e8f194078f7 Mon Sep 17 00:00:00 2001 From: wangting <675591594@qq.com> Date: 星期四, 05 九月 2024 20:35:19 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIManagerServiceImpl.java | 591 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 591 insertions(+), 0 deletions(-) diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIManagerServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIManagerServiceImpl.java new file mode 100644 index 0000000..98d2f58 --- /dev/null +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIManagerServiceImpl.java @@ -0,0 +1,591 @@ +package com.vci.web.service.impl; + +import com.sun.jnlp.ApiDialog; +import com.vci.client.mw.ClientContextVariable; +import com.vci.common.utility.ObjectUtility; +import com.vci.corba.common.PLException; +import com.vci.corba.framework.data.RoleRightInfo; +import com.vci.corba.omd.btm.BizType; +import com.vci.corba.portal.PortalService; +import com.vci.corba.portal.data.*; +import com.vci.frameworkcore.compatibility.SmRoleQueryServiceI; +import com.vci.pagemodel.OsBtmTypeVO; +import com.vci.pagemodel.PLUILayoutCloneVO; +import com.vci.pagemodel.RoleRightVO; +import com.vci.starter.web.exception.VciBaseException; +import com.vci.starter.web.pagemodel.BaseQueryObject; +import com.vci.starter.web.pagemodel.DataGrid; +import com.vci.starter.web.pagemodel.SessionInfo; +import com.vci.starter.web.pagemodel.Tree; +import com.vci.starter.web.util.VciBaseUtil; +import com.vci.starter.web.util.VciDateUtil; +import com.vci.starter.web.util.WebThreadLocalUtil; +import com.vci.web.service.OsBtmServiceI; +import com.vci.web.service.UIManagerServiceI; +import com.vci.web.util.*; +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.ss.formula.functions.T; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.*; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +/** + * UI瀹氫箟鏈嶅姟鐣岄潰鐩稿叧鎺ュ彛 + * @author ludc + * @date 2024/8/28 17:05 + */ +@Service +public class UIManagerServiceImpl implements UIManagerServiceI { + + /** + * 骞冲彴鐨勮皟鐢ㄥ伐鍏风被 + */ + @Resource + private PlatformClientUtil platformClientUtil; + /** + * 瑙掕壊 + */ + @Resource + private SmRoleQueryServiceI smRoleQueryServiceI; + + /** + * 涓氬姟绫诲瀷 + */ + @Resource + private OsBtmServiceI osBtmServiceI; + + /** + * 鏃ュ織 + */ + private Logger logger = LoggerFactory.getLogger(getClass()); + + /** + * 鎺掑簭姣旇緝鍣� + */ + private Comparator<PLUILayout> pageLayoutComparator = new Comparator<PLUILayout>() { + @Override + public int compare(PLUILayout o1, PLUILayout o2) { + return o1.plCode.compareTo(o2.plCode); + } + }; + + /** + * 鏍规嵁涓氬姟绫诲瀷鍚嶆煡璇i涓婁笅鏂囨暟鎹� + * @param baseQueryObject + * @return + * @throws PLException + */ + @Override + public DataGrid gridUIContextData(BaseQueryObject baseQueryObject) throws PLException { + VciBaseUtil.alertNotNull(baseQueryObject,"鏉′欢瀵硅薄"); + int page = baseQueryObject.getPage(); + int limit = baseQueryObject.getLimit(); + Map<String, String> conditionMap = baseQueryObject.getConditionMap(); + String btmName = conditionMap.getOrDefault("btmName",""); + if(Func.isEmpty(conditionMap) || Func.isBlank(btmName)){ + throw new PLException("500",new String[]{"鏈幏鍙栧埌涓氬姟绫诲瀷鍚嶇О锛�"}); + } + String txtName = conditionMap.getOrDefault("txtName","").trim(); + String txtCode = conditionMap.getOrDefault("txtCode","").trim(); + PortalService.GetPLUILayoutsByRelatedTypeAndQueryInfoResult result = platformClientUtil.getUIService() + .getPLUILayoutsByRelatedTypeAndQueryInfo(btmName, txtName, txtCode, page, limit); + DataGrid<PLUILayout> dataGrid = new DataGrid<>(); + int total = (int)result.total; + dataGrid.setTotal(total); + dataGrid.setLimit(limit); + dataGrid.setPage(page); + PLUILayout[] res = result.returnValue; + Arrays.sort(res,pageLayoutComparator); + List<PLUILayout> pluiLayouts = Arrays.asList(res); + dataGrid.setData(pluiLayouts); + return dataGrid; + } + + /** + * ton閫氳繃涓氬姟绫诲瀷鍜屽悕绉版煡璇� + * @param btemName + * @param code + * @return + * @throws PLException + */ + public List<PLUILayout> getUIContextDataByBtName(String btemName,String code) throws PLException { + List<PLUILayout> pluiLayoutList=new ArrayList<>(); + PLUILayout[] pluiLayouts= platformClientUtil.getUIService().getPLUILayoutEntityByTypeAndCode(btemName,code); + if(pluiLayouts!=null&&pluiLayouts.length>0){ + pluiLayoutList= Stream.of(pluiLayouts).collect(Collectors.toList()); + } + return pluiLayoutList; + } + + /** + * 缁欎笟鍔$被鍨嬩笅娣诲姞ui涓婁笅鏂� + * @param pluiLayout + * @return + * @throws PLException + */ + @Override + public boolean saveUIContextData(PLUILayout pluiLayout) throws VciBaseException { + try { + //ui涓婁笅鏂囧璞℃牎楠� + canContinue(pluiLayout); + + String code = pluiLayout.plCode; + String name = pluiLayout.plName; + boolean isExist = nameOrCodeIsExist(pluiLayout, false); + //鏄惁瀛樺湪鏍¢獙 + if (isExist){ + throw new VciBaseException("涓婁笅鏂囩紪鐮佹垨鍚嶇О宸茬粡瀛樺湪锛岃妫�鏌ワ紒"); + } + + PLUILayout pld = new PLUILayout(); + pld.plOId = ObjectUtility.getNewObjectID36(); + pld.plCode = code; + pld.plName = name; + pld.plRelatedType = pluiLayout.plRelatedType; + pld.plDesc = pluiLayout.plDesc; + SessionInfo sessionInfo = WebThreadLocalUtil.getCurrentUserSessionInfoInThread(); + pld.plCreateUser = sessionInfo.getUserId(); + pld.plModifyUser = sessionInfo.getUserId(); + //瀵艰埅鍖� + pld.plIsShowForm = pluiLayout.plIsShowForm; + //鎺у埗鍖� + pld.plIsShowNavigator = pluiLayout.plIsShowNavigator; + //鎿嶄綔鍖� + pld.plIsShowTab = pluiLayout.plIsShowTab; + //鎵ц淇濆瓨 + return platformClientUtil.getUIService().savePLUILayout(pld); + } catch (PLException e) { + e.printStackTrace(); + String exceptionMessage = VciBaseUtil.getExceptionMessage(e); + logger.error(exceptionMessage); + throw new VciBaseException(exceptionMessage); + } + } + + /** + * 淇敼ui涓婁笅鏂� + * @param pluiLayout + * @return + * @throws PLException + */ + @Override + public boolean updateUIContextData(PLUILayout pluiLayout) throws VciBaseException { + this.canContinue(pluiLayout); + try { + String code = pluiLayout.plCode; + String name = pluiLayout.plName; + boolean isExist = nameOrCodeIsExist(pluiLayout, true); + if (isExist){ + throw new VciBaseException("涓婁笅鏂囩紪鐮佹垨鍚嶇О宸茬粡瀛樺湪锛岃妫�鏌ワ紒"); + } + + PLUILayout pld = new PLUILayout(); + pld.plOId = pluiLayout.plOId; + pld.plCode = code; + pld.plName = name; + pld.plRelatedType = pluiLayout.plRelatedType; + pld.plDesc = pluiLayout.plDesc; + pld.plCreateUser = pluiLayout.plCreateUser; + pld.plModifyUser = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(); + + //瀵艰埅鍖� + pld.plIsShowForm = pluiLayout.plIsShowForm; + //鎺у埗鍖� + pld.plIsShowNavigator = pluiLayout.plIsShowNavigator; + //鎿嶄綔鍖� + pld.plIsShowTab = pluiLayout.plIsShowTab; + //鎵ц淇敼 + return platformClientUtil.getUIService().updatePLUILayout(pld); + } catch (PLException e) { + e.printStackTrace(); + String exceptionMessage = VciBaseUtil.getExceptionMessage(e); + logger.error(exceptionMessage); + throw new VciBaseException(exceptionMessage); + } + } + + /** + * 鏍规嵁涓婚敭鍜屼笟鍔$被鍨媜id鍒犻櫎ui涓婁笅鏂囨暟鎹� + * @return + */ + @Override + public boolean delUIContextData(String[] oids) throws PLException { + VciBaseUtil.alertNotNull(oids,"寰呭垹闄ょ殑瀵硅薄鍒楄〃"); + //鍒犻櫎鏂规硶涓湁鍏宠仈鏁版嵁鍒犻櫎鐨勬搷浣滈�昏緫 + return platformClientUtil.getUIService().deletePLUILayoutByOidsForCascade(oids); + } + + /** + * 鍏嬮殕ui涓婁笅鏂囷紙鍏峰鍏宠仈鏁版嵁鐨勫厠闅嗭級 + * @param pluiLayoutCloneVO + * @return + */ + @Override + public boolean cloneUiContextData(PLUILayoutCloneVO pluiLayoutCloneVO) throws PLException { + VciBaseUtil.alertNotNull( + pluiLayoutCloneVO,"鍏嬮殕鍙傛暟瀵硅薄", + pluiLayoutCloneVO.getSourcePLUILayout(),"鍏嬮殕鐨勬簮瀵硅薄淇℃伅", + pluiLayoutCloneVO.getCloneName(),"鍏嬮殕鐨勫璞″悕绉�", + pluiLayoutCloneVO.getCloneContextCode(),"鍏嬮殕鐨勫璞′笂涓嬫枃缂栫爜" + ); + PLUILayout pluiLayout = new PLUILayout(); + PLUILayout sourcePLUILayout = pluiLayoutCloneVO.getSourcePLUILayout(); + //濡傛灉閫夋嫨鍏嬮殕鐩爣锛屽垯鍏嬮殕鍒伴�夋嫨鐨勭被鍨嬩笅锛屽鏋滄病鏈夐�夋嫨鍏嬮殕鐩爣锛屽垯鍏嬮殕鍒板綋鍓嶇被鍨嬩笅 + if(Func.isBlank(pluiLayoutCloneVO.getCloneTargetOid())){ + pluiLayout.plRelatedType = sourcePLUILayout.plRelatedType; + } + //鍏嬮殕鐨勫悕绉板拰ui涓婁笅鏂囩紪鍙锋煡閲� + String cloneName = pluiLayoutCloneVO.getCloneName(); + String cloneContextCode = pluiLayoutCloneVO.getCloneContextCode(); + pluiLayout.plOId = ObjectUtility.getNewObjectID36(); + pluiLayout.plName = cloneName; + pluiLayout.plCode = cloneContextCode; + pluiLayout.plIsShowTab = sourcePLUILayout.plIsShowTab; + pluiLayout.plIsShowNavigator = sourcePLUILayout.plIsShowNavigator; + pluiLayout.plIsShowForm = sourcePLUILayout.plIsShowForm; + pluiLayout.plDesc = sourcePLUILayout.plDesc; + SessionInfo sessionInfo = WebThreadLocalUtil.getCurrentUserSessionInfoInThread(); + pluiLayout.plCreateUser = sessionInfo.getUserId(); + pluiLayout.plModifyUser = sessionInfo.getUserId(); + //鍏嬮殕鐩爣涓媢i鍚嶇О鍜岀紪鍙锋煡閲� + this.checkCodeName(pluiLayout); + //1銆佸厛淇濆瓨ui涓婁笅鏂� + boolean res = platformClientUtil.getUIService().savePLUILayout(pluiLayout); + //2銆佸啀鑰冭檻瀛愯妭鐐圭殑鍏嬮殕 + PLTabPage[] pages = platformClientUtil.getUIService().getPLTabPagesByPageDefinationOId(sourcePLUILayout.plOId); //鎺у埗鍖鸿妭鐐瑰強鍏跺瓙鑺傜偣鐨勫厠闅� + if(pages == null){ + return true; + } + try { + for (PLTabPage page : pages) { + savePlpageLayoutDefinationRelation(page,pluiLayout.plOId); + } + return true; + }catch (Exception e){ + e.printStackTrace(); + String exceptionMessage = VciBaseUtil.getExceptionMessage(e); + logger.error(exceptionMessage); + throw new VciBaseException(exceptionMessage); + } + } + + @Override + public void expUiContextData(String[] oids, HttpServletResponse response) throws PLException, IOException { + + } + + /** + * 鑾峰彇UI鎺堟潈鏍� + * @param treeQueryObject + * @return + * @throws Exception + */ + @Override + public List<Tree> getUIAuthor(BaseQueryObject treeQueryObject) throws Exception { + + Map<String, String> conditionMap = treeQueryObject.getConditionMap(); + if (conditionMap == null) { + conditionMap = new HashMap<>(); + } + String roleId = StringUtils.isBlank(conditionMap.get("roleId")) ? "" : conditionMap.get("roleId"); + String type = StringUtils.isBlank(conditionMap.get("type")) ? "" : conditionMap.get("type"); + String context = StringUtils.isBlank(conditionMap.get("context")) ? "" : conditionMap.get("context"); + 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)); + } + BizType[] bizTypes=osBtmServiceI.getBizTypes(type); + List<Tree> treeList=new ArrayList<>(); + Tree rootNode =new Tree("root","鍔熻兘妯″潡","root"); + rootNode.setLevel(0); + rootNode.setShowCheckbox(true); + rootNode.setExpanded(true); + List<Tree> childList=new ArrayList<>(); + 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]); + bizTypeTree.setLevel(1); + bizTypeTree.setShowCheckbox(true); + bizTypeTree.setParentId(rootNode.getOid()); + bizTypeTree.setParentName(rootNode.getText()); + bizTypeTree.setShowCheckbox(true); + childList.add(bizTypeTree); + List<PLUILayout>contextList=getUIContextDataByBtName(bizTypes[i].name,context); + List<Tree> btmChildList=new ArrayList<>(); + btmChildList.add(bizTypeTree); + setChildNode(btmChildList,contextList,roleRightVOMap,showCheckBox); + } + rootNode.setChildren(childList); + treeList.add(rootNode); + return treeList; + } + + 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(); + List<Tree> chiledTreeList=new ArrayList<>(); + if (funcObj instanceof BizType) {//涓氬姟绫诲瀷 + BizType bizType = (BizType) funcObj; + if(!CollectionUtil.isEmpty(contextList)) { + contextList.stream().forEach(context->{ + Tree childTree=new Tree(context.plOId,context.plName+"("+context.plCode+")",context); + childTree.setParentName(pTree.getText()); + childTree.setParentId(pTree.getOid()); + childTree.setLevel(pTree.getLevel()+1); + childTree.setShowCheckbox(isShowCheckBox); + chiledTreeList.add(childTree); + }); + pTree.setChildren(chiledTreeList); + } + if(!CollectionUtil.isEmpty(chiledTreeList)) { + setChildNode(chiledTreeList, contextList, roleRightVOMap, isShowCheckBox); + } + }else if (funcObj instanceof PLUILayout){//UI + PLUILayout context = (PLUILayout) funcObj; + PLTabPage[] pages = new PLTabPage[0]; + try { + pages = platformClientUtil.getUIService().getPLTabPagesByPageDefinationOId(context.plOId); + } catch (PLException e) { + e.printStackTrace(); + } + if(pages!=null&&pages.length>0){ + List<PLTabPage> plTabPageList= Arrays.stream(pages).collect(Collectors.toList()); + plTabPageList.stream().forEach(plTabPage -> { + Tree childTree=new Tree(plTabPage.plOId,plTabPage.plName,plTabPage); + childTree.setParentName(pTree.getText()); + childTree.setParentId(pTree.getOid()); + childTree.setLevel(pTree.getLevel()+1); + childTree.setShowCheckbox(isShowCheckBox); + chiledTreeList.add(childTree); + }); + pTree.setChildren(chiledTreeList); + } + if(!CollectionUtil.isEmpty(chiledTreeList)) { + setChildNode(chiledTreeList, contextList, roleRightVOMap, isShowCheckBox); + } + + }else if (funcObj instanceof PLTabPage) {//涓婁笅鏂� + PLTabPage plTabPage = (PLTabPage) funcObj; + List<PLPageDefination>plPageDefinationList=new ArrayList<>(); + try { + PLPageDefination[] pLPageDefinations = platformClientUtil.getUIService().getPLPageDefinationsByPageContextOId(plTabPage.plOId); + if(pLPageDefinations!=null&&pLPageDefinations.length>0){ + plPageDefinationList= Arrays.stream(pLPageDefinations).collect(Collectors.toList()); + plPageDefinationList.stream().forEach(plPageDefination -> { + Tree childTree=new Tree(plPageDefination.plOId,plPageDefination.name,plPageDefination); + childTree.setParentName(pTree.getText()); + childTree.setParentId(pTree.getOid()); + childTree.setLevel(pTree.getLevel()+1); + childTree.setShowCheckbox(isShowCheckBox); + chiledTreeList.add(childTree); + }); + pTree.setChildren(chiledTreeList); + } + if(!CollectionUtil.isEmpty(chiledTreeList)) { + setChildNode(chiledTreeList, contextList, roleRightVOMap, isShowCheckBox); + } + } catch (PLException e) { + e.printStackTrace(); + } + + }else if (funcObj instanceof PLPageDefination) {// + PLPageDefination plPageDefination = (PLPageDefination) funcObj; + try { + List<PLTabButton>plTabButtonList=new ArrayList<>(); + PLTabButton[] pLTabButtons = platformClientUtil.getUIService().getPLTabButtonsByTableOId(plPageDefination.plOId); + if(pLTabButtons!=null&&pLTabButtons.length>0){ + plTabButtonList= Arrays.stream(pLTabButtons).collect(Collectors.toList()); + plTabButtonList.stream().forEach(plTabButton -> { + Tree childTree=new Tree(plTabButton.plOId,plTabButton.plLabel,plTabButton); + childTree.setParentName(pTree.getText()); + childTree.setParentId(pTree.getOid()); + childTree.setLevel(pTree.getLevel()+1); + childTree.setShowCheckbox(isShowCheckBox); + childTree.setLeaf(true); + chiledTreeList.add(childTree); + }); + pTree.setChildren(chiledTreeList); + } + if(!CollectionUtil.isEmpty(chiledTreeList)) { + setChildNode(chiledTreeList, contextList, roleRightVOMap, isShowCheckBox); + } + } catch (PLException e) { + e.printStackTrace(); + } + + }else if (funcObj instanceof PLTabButton) {//鎸夐挳 + String id = ((PLTabButton) funcObj).plTableOId; + if(roleRightVOMap.containsKey(id)){ + pTree.setChecked(true); + }else{ + pTree.setChecked(false); + } + } + }); + } + /** + * UI瑙掕壊瀵硅薄杞崲 + * @param infos + * @return + */ + private List<RoleRightVO> roleRightDOO2VOS(List<RoleRightInfo> infos){ + List<RoleRightVO> roleRightVOS=new ArrayList<>(); + Optional.ofNullable(infos).orElseGet(()->new ArrayList<>()).stream().forEach(info -> { + RoleRightVO vo=roleRightDOO2VO(info); + roleRightVOS.add(vo); + }); + + return roleRightVOS; + } + + /** + * UI瑙掕壊瀵硅薄杞崲 + * @param info + * @return + */ + private RoleRightVO roleRightDOO2VO(RoleRightInfo info){ + RoleRightVO vo=new RoleRightVO(); + vo.setId(info.id); + vo.setCreateTime(VciDateUtil.date2Str(VciDateUtil.long2Date(info.createTime),"")); + vo.setCreateUser(info.createUser); + vo.setRoleId(info.roleId); + vo.setRightType(info.rightType); + vo.setLicensor(info.licensor); + vo.setRightValue(info.rightValue); + vo.setFuncId(info.funcId); + vo.setModifyTime(VciDateUtil.date2Str(VciDateUtil.long2Date(info.modifyTime),"")); + vo.setModifyUser(info.modifyUser); + return vo; + } + + /** + * 鎺у埗鍖鸿妭鐐瑰強鍏跺瓙鑺傜偣鐨勫厠闅� + * @param obj + */ + private void savePlpageLayoutDefinationRelation(Object obj,String plUILayoutId) { + PLTabPage tabPage = (PLTabPage)obj; + try { + + PLPageDefination[] pLPageDefinations = platformClientUtil.getUIService().getPLPageDefinationsByPageContextOId(tabPage.plOId); + + tabPage.plOId = ObjectUtility.getNewObjectID36(); + tabPage.plContextOId = plUILayoutId; + //add by caill start 2016.8.15 瀵艰埅鍖恒�佹帶鍒跺尯銆佹搷浣滃尯鍦ㄦ病鏈夊瓙鑺傜偣鐨勬儏鍐典笅鐨勫厠闅� + if(pLPageDefinations.length==0){ + platformClientUtil.getUIService().savePLTabPage(tabPage); + } + //add by caill end + for(int j=0;j<pLPageDefinations.length;j++){ + PLPageDefination plPageDef = pLPageDefinations[j]; + + platformClientUtil.getUIService().savePLTabPage(tabPage); + PLTabButton[] pLTabButtons = platformClientUtil.getUIService().getPLTabButtonsByTableOId(plPageDef.plOId); + + plPageDef.plOId = ObjectUtility.getNewObjectID36(); + plPageDef.plTabPageOId = tabPage.plOId; + platformClientUtil.getUIService().savePLPageDefination(plPageDef); + + for(int b=0;b<pLTabButtons.length;b++){ + PLTabButton plTabButton = pLTabButtons[b]; + PLCommandParameter[] pLCommandParameters = platformClientUtil.getUIService().getPLCommandParametersByCommandOId(plTabButton.plOId); + + plTabButton.plOId = ObjectUtility.getNewObjectID36(); + plTabButton.plTableOId = plPageDef.plOId; + platformClientUtil.getUIService().savePLTabButton(plTabButton); + + for(int c=0;c<pLCommandParameters.length;c++){ + final PLCommandParameter plCommandParameter = pLCommandParameters[c]; + plCommandParameter.plOId = ObjectUtility.getNewObjectID36(); + plCommandParameter.plCommandOId = plTabButton.plOId; + platformClientUtil.getUIService().savePLCommandParameter(plCommandParameter); + } + } + } + } catch (PLException e) { + e.printStackTrace(); + } + } + + /** + * 鏈仛鍒ょ┖澶勭悊锛岃皟鐢ㄥ墠璇蜂繚璇乷bj涓嶄负绌� + * @param obj + * @throws PLException + */ + public void checkCodeName(PLUILayout obj) throws PLException { + PLUILayout[] plUILayouts = platformClientUtil.getUIService().getPLUILayoutsByRelatedType(obj.plRelatedType); + int length = plUILayouts.length; + String code = obj.plCode; + String name = obj.plName; + + if (Func.isNotBlank(name) || Func.isNotBlank(code)){ + for (int i =0;i<length;i++){//寰幆鑺傜偣鐨刄I涓婃枃鍜屽悕绉� + if (plUILayouts[i].plCode.equalsIgnoreCase(code) || plUILayouts[i].plName.equals(name)){ + throw new VciBaseException("涓氬姟绫诲瀷涓婾I鍚嶇О鎴朥I涓婁笅鏂囩紪鐮佸凡瀛樺湪锛�"); + } + } + } + } + + /** + * ui涓婁笅鏂囨柊澧炰慨鏀瑰墠妫�鏌� + * @param pluiLayout + */ + private void canContinue(PLUILayout pluiLayout){ + String code = pluiLayout.plCode; + String name = pluiLayout.plName; + if(Func.isBlank(code)){ + throw new VciBaseException("涓婁笅鏂囩紪鐮佷笉鑳戒负绌猴紒"); + } + if(Func.isBlank(name)){ + throw new VciBaseException("鍚嶇О涓嶈兘涓虹┖锛�"); + } + if((pluiLayout.plIsShowNavigator == 0) && (pluiLayout.plIsShowForm == 0) && (pluiLayout.plIsShowTab == 0)){ + throw new VciBaseException("涓婁笅鏂囪嚦灏戣鍖呭惈涓�涓尯鍩燂紒"); + } + } + + /** + * 妫�鏌ュ悕绉版垨鑰呯紪鐮佹槸鍚﹀凡瀛樺湪 + * @param pluiLayout + * @param isEdit + * @return + * @throws VciBaseException + */ + private boolean nameOrCodeIsExist(PLUILayout pluiLayout, boolean isEdit) throws PLException { + boolean res = false; + //鏌ヨ鍚屼竴涓氬姟绫诲瀷涓嬬殑ui涓婁笅鏂囷紝鐒跺悗鏌ラ噸 + PLUILayout[] plpagelayoutdefinations = platformClientUtil.getUIService().getPLUILayoutsByRelatedType(pluiLayout.plRelatedType); + int length = plpagelayoutdefinations.length; + for (int i =0;i<length;i++){ + String code = plpagelayoutdefinations[i].plCode; + String name = plpagelayoutdefinations[i].plName; + String ids = plpagelayoutdefinations[i].plOId; + if(isEdit){ + if(!ids.equals(pluiLayout.plOId)){ + if (pluiLayout.plCode.equalsIgnoreCase(code) || pluiLayout.plName.equals(name)){ + res = true; + break; + } + } + } + else { + if (code.equalsIgnoreCase(code) || name.equals(name)){ + res = true; + break; + } + } + } + return res; + } + +} -- Gitblit v1.9.3