From 3b3ac1fc72e2849eb500840fd9d61e9b8f1960e1 Mon Sep 17 00:00:00 2001 From: yuxc <yuxc@vci-tech.com> Date: 星期四, 17 十月 2024 16:31:45 +0800 Subject: [PATCH] 1、查询所有的action线程变量用于优化,只查一次平台。 2、新增文件柜管理的controller,servicel以及文件管理的分页查询卷、增加卷、修改卷等接口 --- Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIEngineServiceImpl.java | 150 +++++++++++++++++++++++++++++++++---------------- 1 files changed, 101 insertions(+), 49 deletions(-) diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIEngineServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIEngineServiceImpl.java index d430dcd..a91ac07 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIEngineServiceImpl.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIEngineServiceImpl.java @@ -4,21 +4,19 @@ import com.thoughtworks.xstream.XStream; import com.thoughtworks.xstream.io.xml.XmlFriendlyNameCoder; import com.thoughtworks.xstream.io.xml.XppDriver; -import com.vci.client.common.providers.ClientServiceProvider; import com.vci.corba.common.PLException; +import com.vci.corba.framework.data.RoleRightInfo; import com.vci.corba.portal.data.*; +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.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.util.*; 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.pageModel.*; +import com.vci.web.other.AllActionThreadLocal; import com.vci.web.service.OsAttributeServiceI; import com.vci.web.service.OsBtmServiceI; import com.vci.web.service.UIEngineServiceI; @@ -39,7 +37,7 @@ import java.util.*; import java.util.stream.Collectors; -import static com.vci.web.constant.EnumIdConstant.LC_STATUS_SUBFIX; +import static com.vci.constant.EnumIdConstant.LC_STATUS_SUBFIX; /** * UI寮曟搸鏈嶅姟锛屼互鍓嶅钩鍙板皝瑁呭埌action閲岀殑锛� @@ -83,6 +81,12 @@ */ @Autowired private OsBtmServiceI btmService; + + /** + * 灞炴�х殑鏈嶅姟 + */ + @Autowired + private OsAttributeServiceI attrService; /** * 涓氬姟绫诲瀷鐨勬湇鍔� @@ -131,8 +135,7 @@ public void checkInvalidXmlVI() { PortalVI[] portalVIS = null; try { - portalVIS = ClientServiceProvider.getUIService().getAllPortalVI(); - // portalVIS = platformClientUtil.getPortalService().getAllPortalVI(); + portalVIS = platformClientUtil.getUIService().getAllPortalVI(); } catch (PLException vciError) { throw WebUtil.getVciBaseException(vciError); } @@ -156,7 +159,7 @@ public List<UIFormDefineVO> selectAllForm() { PortalVI[] portalVIS = null; try { - portalVIS = ClientServiceProvider.getUIService().getAllPortalVI(); + portalVIS = platformClientUtil.getUIService().getAllPortalVI(); } catch (PLException vciError) { throw WebUtil.getVciBaseException(vciError); } @@ -319,7 +322,13 @@ //璇存槑鏄摼鎺ョ被鍨� field = field.substring("t_oid.".length()); } - OsAttributeVO attributeVO = attributeService.getAttr(field); +// OsAttributeVO attributeVO = attributeService.getAttr(field); + OsAttributeVO attributeVO = null; + try { + attributeVO = attributeService.attributeDO2VO(platformClientUtil.getAttributeService().getAttributeDefByName(field)); + } catch (PLException e) { + throw new RuntimeException(e); + } UIFormReferVO referVO = new UIFormReferVO(); if(attributeVO !=null && StringUtils.isNotBlank(attributeVO.getBtmTypeId()) && StringUtils.isBlank(itemXO.getRefer()) @@ -405,7 +414,7 @@ if(!QUERY_BY_CACHE){ PortalVI portalVI = null; try { - portalVI = ClientServiceProvider.getUIService().getPortalVIByTypeNameAndVIName(btmId, id); + portalVI = platformClientUtil.getUIService().getPortalVIByTypeNameAndVIName(btmId, id); } catch (PLException vciError) { throw WebUtil.getVciBaseException(vciError); } @@ -447,7 +456,7 @@ public List<UITableDefineVO> selectAllTable() { PortalVI[] portalVIS = null; try { - portalVIS = ClientServiceProvider.getUIService().getAllPortalVI(); + portalVIS = platformClientUtil.getUIService().getAllPortalVI(); } catch (PLException vciError) { throw WebUtil.getVciBaseException(vciError); } @@ -477,7 +486,12 @@ public List<UITableDefineVO> tableDO2VOs(Collection<PortalVI> prms, boolean queryDetail) { List<UITableDefineVO> tableDefineVOList = new ArrayList<>(); Optional.ofNullable(prms).orElseGet(()->new ArrayList<PortalVI>()).stream().forEach(portal->{ - UITableDefineVO defineVO = tableDO2VO(portal,queryDetail); + UITableDefineVO defineVO = null; + try { + defineVO = tableDO2VO(portal,queryDetail,null); + } catch (PLException e) { + throw new RuntimeException(e); + } tableDefineVOList.add(defineVO); }); return tableDefineVOList; @@ -492,7 +506,7 @@ */ @Override @VciUnLog - public UITableDefineVO tableDO2VO(PortalVI portal, boolean queryDetail) { + public UITableDefineVO tableDO2VO(PortalVI portal, boolean queryDetail, Map<String, OsAttributeVO> attributeVOMap) throws PLException { UITableDefineVO tableDefineVO = new UITableDefineVO(); tableDefineVO.setOid(portal.id); tableDefineVO.setId(portal.viName); @@ -523,7 +537,7 @@ self.selectAllForm().stream().filter(s -> formOid.equalsIgnoreCase(s.getOid())).findAny().orElseGet(() -> null); }else{ try { - formDefineVO = formDO2VO(ClientServiceProvider.getUIService().getPortalVIById(formOid)); + formDefineVO = formDO2VO(platformClientUtil.getUIService().getPortalVIById(formOid)); } catch (PLException vciError) { throw WebUtil.getVciBaseException(vciError); } @@ -597,7 +611,7 @@ fieldVO.setSortField(fieldName); fieldVO.setEdit("combox"); //鑲畾鏄笟鍔$被鍨嬶紝鍥犱负閾炬帴绫诲瀷娌℃湁杩欎釜瀛楁 - OsBtmTypeVO btmTypeVO = btmService.getBtmById(tableDefineVO.getBtmType()); + OsBtmTypeVO btmTypeVO = btmService.btmDO2VO(platformClientUtil.getBtmService().getBizTypeByName(tableDefineVO.getBtmType()),attributeVOMap); if(btmTypeVO!=null && StringUtils.isNotBlank(btmTypeVO.getLifeCycleId())){ fieldVO.setComboxKey(btmTypeVO.getLifeCycleId() + LC_STATUS_SUBFIX); } @@ -716,18 +730,18 @@ * @return 琛ㄥ崟鐨勫畾涔� */ @Override - public UITableDefineVO getTableById(String btmId, String id) { + public UITableDefineVO getTableById(String btmId, String id) throws PLException { if(StringUtils.isBlank(btmId) || StringUtils.isBlank(id)){ return null; } if(!QUERY_BY_CACHE){ PortalVI portalVI = null; try { - portalVI = ClientServiceProvider.getUIService().getPortalVIByTypeNameAndVIName(btmId, id); + portalVI = platformClientUtil.getUIService().getPortalVIByTypeNameAndVIName(btmId, id); } catch (PLException vciError) { throw WebUtil.getVciBaseException(vciError); } - return tableDO2VO(portalVI,true); + return tableDO2VO(portalVI,true,null); } return self.selectAllTableMap().getOrDefault(btmId.toLowerCase()+SEP+id.toLowerCase(),null); } @@ -764,8 +778,7 @@ @VciUnLog public List<UIActionVO> selectAllAction() { try { -// return actionDO2VOs(Arrays.stream(platformClientUtil.getPortalService().getAllPLAction()).collect(Collectors.toList())); - return actionDO2VOs(Arrays.stream(ClientServiceProvider.getUIService().getAllPLAction()).collect(Collectors.toList())); + return actionDO2VOs(Arrays.stream(platformClientUtil.getUIService().getAllPLAction()).collect(Collectors.toList())); } catch (PLException vciError) { throw WebUtil.getVciBaseException(vciError); } @@ -1006,7 +1019,7 @@ */ private List<UILayoutVO> listLayoutByContent(String pkContent){ try { - return UILayoutDO2VOs(Arrays.stream(ClientServiceProvider.getUIService().getPLTabPagesByPageDefinationOId(pkContent)).collect(Collectors.toList()),true); + return UILayoutDO2VOs(Arrays.stream(platformClientUtil.getUIService().getPLTabPagesByPageDefinationOId(pkContent)).collect(Collectors.toList()),true); } catch (PLException vciError) { throw WebUtil.getVciBaseException(vciError); } @@ -1065,8 +1078,19 @@ */ private List<UILayoutVO> UILayoutDO2VOs(Collection<PLTabPage> pages, boolean queryDetail){ List<UILayoutVO> contentVOS = new ArrayList<>(); + Map<String, OsAttributeVO> attributeVOMap; + if(pages != null && pages.size() > 0){ + attributeVOMap = attrService.selectAllAttributeMap(); + Map<String, UIActionVO> actionVOMap = AllActionThreadLocal.get(); + if(actionVOMap == null || actionVOMap.isEmpty()){ + actionVOMap = selectAllActionMap(); + AllActionThreadLocal.set(actionVOMap); + } + }else{ + attributeVOMap = null; + } Optional.ofNullable(pages).orElseGet(()->new ArrayList<PLTabPage>()).stream().forEach(page->{ - UILayoutVO layoutVO = UILayoutDO2VO(page, queryDetail); + UILayoutVO layoutVO = UILayoutDO2VO(page, queryDetail,attributeVOMap); if(layoutVO.isEnableStatus()) { contentVOS.add(layoutVO); } @@ -1079,6 +1103,7 @@ } }); } + AllActionThreadLocal.remove(); return contentVOS; } @@ -1089,7 +1114,7 @@ * @return 鍖哄煙鐨勬樉绀哄璞� */ @VciUnLog - private UILayoutVO UILayoutDO2VO(PLTabPage page, boolean queryDetail){ + private UILayoutVO UILayoutDO2VO(PLTabPage page, boolean queryDetail,Map<String, OsAttributeVO> attributeVOMap){ UILayoutVO layoutVO = new UILayoutVO(); if(page !=null ){ layoutVO.setOid(page.plOId); @@ -1129,8 +1154,7 @@ if(queryDetail){ //鍗曚釜鐨勶紝鐩存帴鑾峰彇 try { - layoutVO.setComponentVOs(uiComponentDO2VOs(Arrays.stream(ClientServiceProvider.getUIService().getPLPageDefinationsByPageContextOId(layoutVO.getOid())).collect(Collectors.toList()),true)); -// layoutVO.setComponentVOs(uiComponentDO2VOs(Arrays.stream(platformClientUtil.getPortalService().getPLPageDefinationsByPageContextOId(layoutVO.getOid())).collect(Collectors.toList()),true)); + layoutVO.setComponentVOs(uiComponentDO2VOs(Arrays.stream(platformClientUtil.getUIService().getPLPageDefinationsByPageContextOId(layoutVO.getOid())).collect(Collectors.toList()),true,attributeVOMap)); } catch (PLException vciError) { throw WebUtil.getVciBaseException(vciError); } @@ -1170,13 +1194,13 @@ * @return 涓婚敭鐨勬樉绀哄璞� */ @Override - public UIComponentVO getComponentByOid(String componentOid) { + public UIComponentVO getComponentByOid(String componentOid, Map<String, OsAttributeVO> attributeVOMap) { if(StringUtils.isBlank(componentOid)){ return null; } if(!QUERY_BY_CACHE){ try { - return uiComponentDO2VO(ClientServiceProvider.getUIService().getPLPageDefinationById(componentOid),true); + return uiComponentDO2VO(platformClientUtil.getUIService().getPLPageDefinationById(componentOid),true,attributeVOMap); } catch (PLException vciError) { throw WebUtil.getVciBaseException(vciError); } @@ -1195,10 +1219,10 @@ * @param pages 鏁版嵁瀵硅薄 * @return 鏄剧ず瀵硅薄 */ - private List<UIComponentVO> uiComponentDO2VOs(Collection<com.vci.corba.portal.data.PLPageDefination> pages, boolean queryDetail){ + private List<UIComponentVO> uiComponentDO2VOs(Collection<com.vci.corba.portal.data.PLPageDefination> pages, boolean queryDetail,Map<String, OsAttributeVO> attributeVOMap){ List<UIComponentVO> componentVOS = new ArrayList<>(); pages.stream().forEach(page->{ - componentVOS.add(uiComponentDO2VO(page,queryDetail)); + componentVOS.add(uiComponentDO2VO(page,queryDetail,attributeVOMap)); }); return componentVOS; } @@ -1209,7 +1233,7 @@ * @return 鏄剧ず瀵硅薄 */ @VciUnLog - private UIComponentVO uiComponentDO2VO(PLPageDefination page, boolean queryDetail){ + private UIComponentVO uiComponentDO2VO(PLPageDefination page, boolean queryDetail, Map<String, OsAttributeVO> attributeVOMap){ UIComponentVO componentVO = new UIComponentVO(); if(page !=null){ componentVO.setOid(page.plOId); @@ -1248,8 +1272,7 @@ componentVO.setTableDefineVO(tableDefineVOMap.get(key)); }else{ try { - componentVO.setTableDefineVO(tableDO2VO(ClientServiceProvider.getUIService().getPortalVIByTypeNameAndVIName(btmType,componentDefineXO.getTemplateId()),true)); - //componentVO.setTableDefineVO(tableDO2VO(platformClientUtil.getPortalService().getPortalVIByTypeNameAndVIName(btmType,componentDefineXO.getTemplateId()),true)); + componentVO.setTableDefineVO(tableDO2VO(platformClientUtil.getUIService().getPortalVIByTypeNameAndVIName(btmType,componentDefineXO.getTemplateId()),true,attributeVOMap)); } catch (PLException vciError) { throw WebUtil.getVciBaseException(vciError); } @@ -1285,7 +1308,7 @@ tableDefineVO= tableDefineVOMap.get(key); }else{ try { - tableDefineVO = tableDO2VO(ClientServiceProvider.getUIService().getPortalVIByTypeNameAndVIName(btmType,componentDefineXO.getTemplateId()),true); + tableDefineVO = tableDO2VO(platformClientUtil.getUIService().getPortalVIByTypeNameAndVIName(btmType,componentDefineXO.getTemplateId()),true,null); } catch (PLException vciError) { throw WebUtil.getVciBaseException(vciError); } @@ -1336,7 +1359,7 @@ componentVO.setFormDefineVO(formDefineVOMap.get(key)); }else{ try { - componentVO.setFormDefineVO(formDO2VO(ClientServiceProvider.getUIService().getPortalVIByTypeNameAndVIName(btmType,componentDefineXO.getTemplateId()))); + componentVO.setFormDefineVO(formDO2VO(platformClientUtil.getUIService().getPortalVIByTypeNameAndVIName(btmType,componentDefineXO.getTemplateId()))); } catch (PLException vciError) { throw WebUtil.getVciBaseException(vciError); } @@ -1386,7 +1409,32 @@ @Override public List<UIButtonDefineVO> listButtonByComponent(String pkComponent){ try { - List<UIButtonDefineVO> buttonDefineVOS = buttonDO2VOs(Arrays.stream(ClientServiceProvider.getUIService().getPLTabButtonsByTableOId(pkComponent)).collect(Collectors.toSet())).stream().sorted(((o1, o2) -> o1.getOrderNum().compareTo(o2.getOrderNum()))).collect(Collectors.toList()); + 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; } @@ -1414,9 +1462,19 @@ @Override public List<UIButtonDefineVO> buttonDO2VOs(Collection<com.vci.corba.portal.data.PLTabButton> buttons){ List<UIButtonDefineVO> buttonDefineVOS = new ArrayList<>(); - Optional.ofNullable(buttons).orElseGet(()->new ArrayList<>()).stream().forEach(button->{ - buttonDefineVOS.add(buttonDO2VO(button)); - }); + if(buttons != null && buttons.size() > 0){ +// Map<String, UIActionVO> actionVOMap = self.selectAllActionMap(); + Map<String, UIActionVO> actionVOMap = null; + actionVOMap = AllActionThreadLocal.get(); + if(actionVOMap == null ){ + actionVOMap = self.selectAllActionMap(); + } + Map<String, UIActionVO> finalActionVOMap = actionVOMap; + Optional.ofNullable(buttons).orElseGet(()->new ArrayList<>()).stream().forEach(button->{ + buttonDefineVOS.add(buttonDO2VO(button, finalActionVOMap)); + }); + } + return buttonDefineVOS; } @@ -1426,9 +1484,8 @@ * @return 鏄剧ず瀵硅薄 */ @Override - public UIButtonDefineVO buttonDO2VO(com.vci.corba.portal.data.PLTabButton button) { + public UIButtonDefineVO buttonDO2VO(com.vci.corba.portal.data.PLTabButton button, Map<String, UIActionVO> actionVOMap) { UIButtonDefineVO buttonVO = new UIButtonDefineVO(); - Map<String, UIActionVO> actionVOMap = self.selectAllActionMap(); // Map<String, UIActionVO> actionVOMap = ServiceProvider.getUIService().getAllPLAction(); if(button !=null){ buttonVO.setOid(button.plOId); @@ -1460,8 +1517,7 @@ //鏌ユ壘鍙傛暟 Map<String,String> params = new HashMap<>(); try { - //PLCommandParameter[] parameters = platformClientUtil.getPortalService().getPLCommandParametersByCommandOId(buttonVO.getOid()); - PLCommandParameter[] parameters = ClientServiceProvider.getUIService().getPLCommandParametersByCommandOId(buttonVO.getOid()); + PLCommandParameter[] parameters = platformClientUtil.getUIService().getPLCommandParametersByCommandOId(buttonVO.getOid()); if(parameters!=null && parameters.length > 0){ for(PLCommandParameter parameter: parameters){ params.put(parameter.plKey,parameter.plValue); @@ -1526,10 +1582,7 @@ WebUtil.alertNotNull(btmType,"涓氬姟绫诲瀷鎴栬�呴摼鎺ョ被鍨�",id,"UI涓婁笅鏂囩殑缂栧彿"); PLUILayout[] obj = null; try { - obj = ClientServiceProvider.getUIService().getPLUILayoutsByRelatedType(btmType); -// obj = platformClientUtil.getPortalService().getPLPageLayoutDefinationsByRelatedType(btmType); -// obj = ServiceProvider.geT(btmType); - + obj = platformClientUtil.getUIService().getPLUILayoutsByRelatedType(btmType); } catch (PLException vciError) { throw WebUtil.getVciBaseException(vciError); } @@ -1541,7 +1594,6 @@ } } return UIContentDO2VO(context,true); -// return UIContentDO2VO(null,true); } } -- Gitblit v1.9.3