From 90c86c95de1d20a3c3a44cab3482388a8c221a5e Mon Sep 17 00:00:00 2001 From: ludc Date: 星期四, 05 十二月 2024 10:32:59 +0800 Subject: [PATCH] UI数据查询调整 --- Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIEngineServiceImpl.java | 128 ++++++++++++++++++++++++++++-------------- 1 files changed, 86 insertions(+), 42 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 6d760d5..af8bfa8 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 @@ -7,16 +7,19 @@ 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.pagemodel.SessionInfo; -import com.vci.starter.web.util.*; +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.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; @@ -27,6 +30,7 @@ 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; @@ -37,7 +41,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閲岀殑锛� @@ -81,6 +85,12 @@ */ @Autowired private OsBtmServiceI btmService; + + /** + * 灞炴�х殑鏈嶅姟 + */ + @Autowired + private OsAttributeServiceI attrService; /** * 涓氬姟绫诲瀷鐨勬湇鍔� @@ -316,7 +326,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()) @@ -399,16 +415,13 @@ if(StringUtils.isBlank(btmId) || StringUtils.isBlank(id)){ return null; } - if(!QUERY_BY_CACHE){ - PortalVI portalVI = null; - try { - portalVI = platformClientUtil.getUIService().getPortalVIByTypeNameAndVIName(btmId, id); - } catch (PLException vciError) { - throw WebUtil.getVciBaseException(vciError); - } - return formDO2VO(portalVI); + PortalVI portalVI = null; + try { + portalVI = platformClientUtil.getUIService().getPortalVIByTypeNameAndVIName(btmId, id); + } catch (PLException vciError) { + throw WebUtil.getVciBaseException(vciError); } - return self.selectAllFormMap().getOrDefault(btmId.toLowerCase()+SEP+id.toLowerCase(),null); + return formDO2VO(portalVI); } /** @@ -474,7 +487,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; @@ -489,7 +507,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); @@ -594,7 +612,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); } @@ -643,7 +661,7 @@ && !UIFieldTypeEnum.CUSTOM.getValue().equalsIgnoreCase(s.getFieldType())).forEach(fieldVO->{ //鍒楄〃閲岄潰涓嶆斁edit锛岃�屾煡璇㈤噷闈㈤渶瑕佹斁edit UITableFieldVO queryFieldVO = new UITableFieldVO(); - BeanUtil.convert(fieldVO,queryFieldVO); + BeanUtilForVCI.convert(fieldVO,queryFieldVO); canQueryFields.add(queryFieldVO); }); tableDefineVO.setSeniorQueryColumns(canQueryFields); @@ -713,7 +731,7 @@ * @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; } @@ -724,7 +742,7 @@ } 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); } @@ -911,7 +929,7 @@ List<UIComponentVO> southCompVO = componentVOs.stream().filter(s->!s.getOid().equals(firstCompVO.getOid())).collect(Collectors.toList()); UILayoutVO centerVO = new UILayoutVO(); - BeanUtil.convert(layoutVO,centerVO); + BeanUtilForVCI.convert(layoutVO,centerVO); centerVO.setOid(centerVO.getOid() + "_center"); centerVO.setLayoutAreaType(UILayoutAreaTypeEnum.CENTER.getValue()); centerVO.setOrderNum(0); @@ -929,7 +947,7 @@ //鍏朵綑鐨勪綔涓簊outh if(!CollectionUtils.isEmpty(southCompVO)) { UILayoutVO southVO = new UILayoutVO(); - BeanUtil.convert(layoutVO, southVO); + BeanUtilForVCI.convert(layoutVO, southVO); southVO.setOid(centerVO.getOid() + "_south"); southVO.setLayoutAreaType(UILayoutAreaTypeEnum.SOUTH.getValue()); southVO.setOrderNum(0); @@ -1061,8 +1079,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); } @@ -1075,6 +1104,7 @@ } }); } + AllActionThreadLocal.remove(); return contentVOS; } @@ -1085,7 +1115,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); @@ -1125,7 +1155,7 @@ if(queryDetail){ //鍗曚釜鐨勶紝鐩存帴鑾峰彇 try { - layoutVO.setComponentVOs(uiComponentDO2VOs(Arrays.stream(platformClientUtil.getUIService().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); } @@ -1165,13 +1195,18 @@ * @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(platformClientUtil.getUIService().getPLPageDefinationById(componentOid),true,attributeVOMap); + } catch (PLException vciError) { + throw WebUtil.getVciBaseException(vciError); + } + /*if(!QUERY_BY_CACHE){ try { - return uiComponentDO2VO(platformClientUtil.getUIService().getPLPageDefinationById(componentOid),true); + return uiComponentDO2VO(platformClientUtil.getUIService().getPLPageDefinationById(componentOid),true,attributeVOMap); } catch (PLException vciError) { throw WebUtil.getVciBaseException(vciError); } @@ -1181,8 +1216,7 @@ if(!CollectionUtils.isEmpty(componentVOList)){ return componentVOList.get(0); } - } - return null; + }*/ } /** @@ -1190,10 +1224,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; } @@ -1204,7 +1238,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); @@ -1243,7 +1277,7 @@ componentVO.setTableDefineVO(tableDefineVOMap.get(key)); }else{ try { - componentVO.setTableDefineVO(tableDO2VO(platformClientUtil.getUIService().getPortalVIByTypeNameAndVIName(btmType,componentDefineXO.getTemplateId()),true)); + componentVO.setTableDefineVO(tableDO2VO(platformClientUtil.getUIService().getPortalVIByTypeNameAndVIName(btmType,componentDefineXO.getTemplateId()),true,attributeVOMap)); } catch (PLException vciError) { throw WebUtil.getVciBaseException(vciError); } @@ -1279,7 +1313,7 @@ tableDefineVO= tableDefineVOMap.get(key); }else{ try { - tableDefineVO = tableDO2VO(platformClientUtil.getUIService().getPortalVIByTypeNameAndVIName(btmType,componentDefineXO.getTemplateId()),true); + tableDefineVO = tableDO2VO(platformClientUtil.getUIService().getPortalVIByTypeNameAndVIName(btmType,componentDefineXO.getTemplateId()),true,null); } catch (PLException vciError) { throw WebUtil.getVciBaseException(vciError); } @@ -1287,7 +1321,7 @@ if(tableDefineVO != null) { UITreeTableDefineVO treeTableDefineVO = new UITreeTableDefineVO(); - BeanUtil.convert(tableDefineVO, treeTableDefineVO); + BeanUtilForVCI.convert(tableDefineVO, treeTableDefineVO); if(isLink){ treeTableDefineVO.setTreeCurrentField("t_oid"); treeTableDefineVO.setTreeParentField("f_oid"); @@ -1342,7 +1376,8 @@ treeDefineVO.setBtmType(componentDefineXO.getShowType()); treeDefineVO.setLinkType(componentDefineXO.getLinkType()); treeDefineVO.setLoadType("1".equalsIgnoreCase(componentDefineXO.getExpandMode())?"node":"all"); - treeDefineVO.setOrientation("positive".equalsIgnoreCase(componentDefineXO.getOrientation())?false:true); + //TODO:杩欎釜灞炴�х幇鍦ㄧ敱閾炬帴绫诲瀷鏌ヨ鎺у埗锛屼笉鐢遍〉闈㈠畾涔夋帶鍒朵簡 + //treeDefineVO.setOrientation("positive".equalsIgnoreCase(componentDefineXO.getOrientation())?false:true); treeDefineVO.setShowImage("1".equalsIgnoreCase(componentDefineXO.getIsShowImage())?true:false); treeDefineVO.setRootContent(componentDefineXO.getRootContent()); treeDefineVO.setFieldSep(StringUtils.isBlank(componentDefineXO.getSeparator())?",":componentDefineXO.getSeparator()); @@ -1433,9 +1468,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; } @@ -1445,9 +1490,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); -- Gitblit v1.9.3