| | |
| | | import com.vci.web.enumpck.UIComponentTypeEnum; |
| | | import com.vci.web.enumpck.UIFieldTypeEnum; |
| | | import com.vci.web.enumpck.UILayoutAreaTypeEnum; |
| | | import com.vci.web.other.AllActionThreadLocal; |
| | | import com.vci.web.service.OsAttributeServiceI; |
| | | import com.vci.web.service.OsBtmServiceI; |
| | | import com.vci.web.service.UIEngineServiceI; |
| | |
| | | */ |
| | | @Autowired |
| | | private OsBtmServiceI btmService; |
| | | |
| | | /** |
| | | * 属性的服务 |
| | | */ |
| | | @Autowired |
| | | private OsAttributeServiceI attrService; |
| | | |
| | | /** |
| | | * 业务类型的服务 |
| | |
| | | //说明是链接类型 |
| | | 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()) |
| | |
| | | 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; |
| | |
| | | */ |
| | | @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); |
| | |
| | | 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); |
| | | } |
| | |
| | | * @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; |
| | | } |
| | |
| | | } 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); |
| | | } |
| | |
| | | */ |
| | | 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); |
| | | } |
| | |
| | | } |
| | | }); |
| | | } |
| | | AllActionThreadLocal.remove(); |
| | | return contentVOS; |
| | | } |
| | | |
| | |
| | | * @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); |
| | |
| | | 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); |
| | | } |
| | |
| | | * @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); |
| | | return uiComponentDO2VO(platformClientUtil.getUIService().getPLPageDefinationById(componentOid),true,attributeVOMap); |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | |
| | | * @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; |
| | | } |
| | |
| | | * @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); |
| | |
| | | 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); |
| | | } |
| | |
| | | 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); |
| | | } |
| | |
| | | @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; |
| | | } |
| | | |
| | |
| | | * @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); |