| | |
| | | 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.ServiceProvider; |
| | | 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.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.constant.CacheKeyConstant; |
| | | 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; |
| | |
| | | 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; |
| | | import org.springframework.cache.annotation.CacheEvict; |
| | | import org.springframework.cache.annotation.Cacheable; |
| | | import org.springframework.cache.annotation.Caching; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.vci.web.constant.CacheNameConstant.VCI_OBJECT_SERVICE; |
| | | import static com.vci.web.constant.EnumIdConstant.LC_STATUS_SUBFIX; |
| | | import static com.vci.constant.EnumIdConstant.LC_STATUS_SUBFIX; |
| | | |
| | | /** |
| | | * UI引擎服务,以前平台封装到action里的, |
| | |
| | | */ |
| | | @Autowired |
| | | private OsBtmServiceI btmService; |
| | | |
| | | /** |
| | | * 属性的服务 |
| | | */ |
| | | @Autowired |
| | | private OsAttributeServiceI attrService; |
| | | |
| | | /** |
| | | * 业务类型的服务 |
| | |
| | | public void checkInvalidXmlVI() { |
| | | PortalVI[] portalVIS = null; |
| | | try { |
| | | portalVIS = ServiceProvider.getUIService().getAllPortalVI(); |
| | | // portalVIS = platformClientUtil.getPortalService().getAllPortalVI(); |
| | | portalVIS = platformClientUtil.getUIService().getAllPortalVI(); |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | |
| | | public List<UIFormDefineVO> selectAllForm() { |
| | | PortalVI[] portalVIS = null; |
| | | try { |
| | | portalVIS = ServiceProvider.getUIService().getAllPortalVI(); |
| | | portalVIS = platformClientUtil.getUIService().getAllPortalVI(); |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | |
| | | * @return key是表单英文名称 |
| | | */ |
| | | @Override |
| | | @Cacheable(value = VCI_OBJECT_SERVICE,key = CacheKeyConstant.ALL_FORM,unless = "#result == null") |
| | | public Map<String, UIFormDefineVO> selectAllFormMap() { |
| | | return Optional.ofNullable(self.selectAllForm()).orElseGet(()->new ArrayList<>()).stream().collect(Collectors.toMap(s->s.getBtmType().toLowerCase() + SEP + s.getId().toLowerCase(),t->t,(o1,o2)->o1)); |
| | | } |
| | |
| | | //说明是链接类型 |
| | | 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()) |
| | |
| | | * @return 表单的定义 |
| | | */ |
| | | @Override |
| | | @Cacheable(value = VCI_OBJECT_SERVICE,key = "#p0.concat('${formcache}').concat(#p1)",unless = "#result == null || #p0 == null || #p1 == null") |
| | | public UIFormDefineVO getFormById(String btmId, String id) { |
| | | if(StringUtils.isBlank(btmId) || StringUtils.isBlank(id)){ |
| | | return null; |
| | | } |
| | | if(!QUERY_BY_CACHE){ |
| | | PortalVI portalVI = null; |
| | | try { |
| | | portalVI = ServiceProvider.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); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return 表格的定义 |
| | | */ |
| | | @Override |
| | | @Cacheable(value = VCI_OBJECT_SERVICE,key = CacheKeyConstant.ALL_TABLE,unless = "#result == null") |
| | | @VciUnLog |
| | | public List<UITableDefineVO> selectAllTable() { |
| | | PortalVI[] portalVIS = null; |
| | | try { |
| | | portalVIS = ServiceProvider.getUIService().getAllPortalVI(); |
| | | portalVIS = platformClientUtil.getUIService().getAllPortalVI(); |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | |
| | | 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); |
| | |
| | | self.selectAllForm().stream().filter(s -> formOid.equalsIgnoreCase(s.getOid())).findAny().orElseGet(() -> null); |
| | | }else{ |
| | | try { |
| | | formDefineVO = formDO2VO(ServiceProvider.getUIService().getPortalVIById(formOid)); |
| | | formDefineVO = formDO2VO(platformClientUtil.getUIService().getPortalVIById(formOid)); |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | |
| | | 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); |
| | | } |
| | |
| | | && !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); |
| | |
| | | * @return 表单的定义 |
| | | */ |
| | | @Override |
| | | @Cacheable(value = VCI_OBJECT_SERVICE,key = "#p0.concat('${tablecache}').concat(#p1)",unless = "#result == null || #p0 == null || #p1 == null") |
| | | 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 = ServiceProvider.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); |
| | | } |
| | |
| | | @VciUnLog |
| | | public List<UIActionVO> selectAllAction() { |
| | | try { |
| | | // return actionDO2VOs(Arrays.stream(platformClientUtil.getPortalService().getAllPLAction()).collect(Collectors.toList())); |
| | | return actionDO2VOs(Arrays.stream(ServiceProvider.getUIService().getAllPLAction()).collect(Collectors.toList())); |
| | | return actionDO2VOs(Arrays.stream(platformClientUtil.getUIService().getAllPLAction()).collect(Collectors.toList())); |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | |
| | | * @return 显示对象,key是action的主键 |
| | | */ |
| | | @Override |
| | | @Cacheable(value = VCI_OBJECT_SERVICE,key=CacheKeyConstant.ALL_ACTION,unless = "#result == null") |
| | | public Map<String, UIActionVO> selectAllActionMap() { |
| | | return Optional.ofNullable(self.selectAllAction()).orElseGet(()->new ArrayList<>()).stream().collect(Collectors.toMap(s->s.getOid(),t->t)); |
| | | } |
| | |
| | | * 清除缓存 |
| | | */ |
| | | @Override |
| | | @Caching(evict = { |
| | | @CacheEvict(value = VCI_OBJECT_SERVICE,key = CacheKeyConstant.ALL_UI), |
| | | @CacheEvict(value = VCI_OBJECT_SERVICE,key = CacheKeyConstant.ALL_ACTION), |
| | | @CacheEvict(value = VCI_OBJECT_SERVICE,key = CacheKeyConstant.ALL_FORM), |
| | | @CacheEvict(value = VCI_OBJECT_SERVICE,key = CacheKeyConstant.ALL_TABLE), |
| | | @CacheEvict(value = VCI_OBJECT_SERVICE,key = CacheKeyConstant.ALL_FORM_AND_TABLE) |
| | | }) |
| | | public void clearCache() { |
| | | |
| | | } |
| | |
| | | */ |
| | | @Override |
| | | @VciUnLog |
| | | @Cacheable(value = VCI_OBJECT_SERVICE,key = CacheKeyConstant.ALL_UI,unless = "#result == null") |
| | | public List<UIContentVO> selectAllUIContent() { |
| | | try { |
| | | return UIContentDO2VOs(Arrays.stream(platformClientUtil.getPortalService().getAllPLUILayouts()).collect(Collectors.toList())); |
| | |
| | | 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); |
| | |
| | | //其余的作为south |
| | | 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); |
| | |
| | | */ |
| | | private List<UILayoutVO> listLayoutByContent(String pkContent){ |
| | | try { |
| | | return UILayoutDO2VOs(Arrays.stream(ServiceProvider.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); |
| | | } |
| | |
| | | * @return 区域的显示对象 |
| | | */ |
| | | @Override |
| | | @Cacheable(value = VCI_OBJECT_SERVICE,key = CacheKeyConstant.ALL_LAYOUT,unless = "#result == null") |
| | | public List<UILayoutVO> selectAllUILayout() { |
| | | // try { |
| | | // return UILayoutDO2VOs(Arrays.stream(platformClientUtil.getPortalService().getAllPLTabPages()).collect(Collectors.toList()),true); |
| | |
| | | */ |
| | | 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(ServiceProvider.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); |
| | | } |
| | |
| | | * @return UI组件 |
| | | */ |
| | | @Override |
| | | @Cacheable(value = VCI_OBJECT_SERVICE,key = CacheKeyConstant.ALL_COMP ,unless = "#result ==null") |
| | | public List<UIComponentVO> selectAllUIComponent() { |
| | | // try { |
| | | // return uiComponentDO2VOs(Arrays.stream(platformClientUtil.getPortalService().getAllPLPageDefinations()).collect(Collectors.toList()),false); |
| | |
| | | * @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(ServiceProvider.getUIService().getPLPageDefinationById(componentOid),true); |
| | | return uiComponentDO2VO(platformClientUtil.getUIService().getPLPageDefinationById(componentOid),true,attributeVOMap); |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | |
| | | if(!CollectionUtils.isEmpty(componentVOList)){ |
| | | return componentVOList.get(0); |
| | | } |
| | | } |
| | | return null; |
| | | }*/ |
| | | } |
| | | |
| | | /** |
| | |
| | | * @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(ServiceProvider.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); |
| | | } |
| | |
| | | tableDefineVO= tableDefineVOMap.get(key); |
| | | }else{ |
| | | try { |
| | | tableDefineVO = tableDO2VO(ServiceProvider.getUIService().getPortalVIByTypeNameAndVIName(btmType,componentDefineXO.getTemplateId()),true); |
| | | tableDefineVO = tableDO2VO(platformClientUtil.getUIService().getPortalVIByTypeNameAndVIName(btmType,componentDefineXO.getTemplateId()),true,null); |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | |
| | | 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"); |
| | |
| | | componentVO.setFormDefineVO(formDefineVOMap.get(key)); |
| | | }else{ |
| | | try { |
| | | componentVO.setFormDefineVO(formDO2VO(ServiceProvider.getUIService().getPortalVIByTypeNameAndVIName(btmType,componentDefineXO.getTemplateId()))); |
| | | componentVO.setFormDefineVO(formDO2VO(platformClientUtil.getUIService().getPortalVIByTypeNameAndVIName(btmType,componentDefineXO.getTemplateId()))); |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | |
| | | 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()); |
| | |
| | | @Override |
| | | public List<UIButtonDefineVO> listButtonByComponent(String pkComponent){ |
| | | try { |
| | | List<UIButtonDefineVO> buttonDefineVOS = buttonDO2VOs(Arrays.stream(ServiceProvider.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; |
| | | } |
| | |
| | | @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); |
| | |
| | | //查找参数 |
| | | Map<String,String> params = new HashMap<>(); |
| | | try { |
| | | //PLCommandParameter[] parameters = platformClientUtil.getPortalService().getPLCommandParametersByCommandOId(buttonVO.getOid()); |
| | | PLCommandParameter[] parameters = ServiceProvider.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); |
| | |
| | | * @return UI上下文的信息 |
| | | */ |
| | | @Override |
| | | @Cacheable(value = VCI_OBJECT_SERVICE,key = "#p0.concat('${uicache}').concat(#p1)",unless = "#result == null || #p0 == null || #p1 ==null") |
| | | public UIContentVO getUIContentByBtmTypeAndId(String btmType, String id) { |
| | | WebUtil.alertNotNull(btmType,"业务类型或者链接类型",id,"UI上下文的编号"); |
| | | PLUILayout[] obj = null; |
| | | try { |
| | | obj = ServiceProvider.getUIService().getPLUILayoutsByRelatedType(btmType); |
| | | // obj = platformClientUtil.getPortalService().getPLPageLayoutDefinationsByRelatedType(btmType); |
| | | // obj = ServiceProvider.geT(btmType); |
| | | |
| | | obj = platformClientUtil.getUIService().getPLUILayoutsByRelatedType(btmType); |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | |
| | | } |
| | | } |
| | | return UIContentDO2VO(context,true); |
| | | // return UIContentDO2VO(null,true); |
| | | } |
| | | } |
| | | |