| | |
| | | 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.common.VCIError; |
| | | import com.vci.corba.portal.data.PLTabButton; |
| | | import com.vci.corba.portal.data.PLUILayout; |
| | | import com.vci.starter.web.annotation.log.VciUnLog; |
| | | import com.vci.starter.web.exception.VciBaseException; |
| | |
| | | import com.vci.web.service.OsBtmServiceI; |
| | | import com.vci.web.service.UIEngineServiceI; |
| | | import com.vci.web.service.WebBoServiceI; |
| | | import com.vci.web.util.Func; |
| | | import com.vci.web.util.PlatformClientUtil; |
| | | import com.vci.web.util.WebUtil; |
| | | import com.vci.web.xmlmodel.UIComponentDefineXO; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | import com.vci.corba.portal.data.PortalVI; |
| | | import com.vci.corba.portal.data.PLAction; |
| | | import com.vci.corba.portal.data.PLTabPage; |
| | | import com.vci.corba.portal.data.PLTabButton; |
| | | |
| | | import com.vci.corba.portal.data.PLAction; |
| | | import com.vci.corba.portal.data.PLPageDefination; |
| | | import com.vci.corba.portal.data.PLCommandParameter; |
| | | import plm.corba.portal.*; |
| | | |
| | | import java.util.*; |
| | |
| | | * |
| | | */ |
| | | @Service |
| | | public class UIEngineServiceImpl implements UIEngineServiceI { |
| | | public class UIEngineServiceImpl implements UIEngineServiceI { |
| | | |
| | | /** |
| | | * 是否从缓存中查询 |
| | |
| | | try { |
| | | portalVIS = ServiceProvider.getUIService().getAllPortalVI(); |
| | | // portalVIS = platformClientUtil.getPortalService().getAllPortalVI(); |
| | | } catch (VCIError vciError) { |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | | for(int i = 0 ; i < portalVIS.length ; i++){ |
| | |
| | | @Override |
| | | @VciUnLog |
| | | public List<UIFormDefineVO> selectAllForm() { |
| | | com.vci.corba.portal.data.PortalVI[] portalVIS = null; |
| | | PortalVI[] portalVIS = null; |
| | | try { |
| | | portalVIS = ServiceProvider.getUIService().getAllPortalVI(); |
| | | } catch (VCIError vciError) { |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | | List<com.vci.corba.portal.data.PortalVI> portalVIList = Arrays.stream(portalVIS).filter(portal -> 1 == portal.viType).collect(Collectors.toList()); |
| | | List<PortalVI> portalVIList = Arrays.stream(portalVIS).filter(portal -> 1 == portal.viType).collect(Collectors.toList()); |
| | | return formDO2VOs(portalVIList); |
| | | } |
| | | |
| | |
| | | * @return 显示对象 |
| | | */ |
| | | @Override |
| | | public List<UIFormDefineVO> formDO2VOs(Collection<com.vci.corba.portal.data.PortalVI> portalVIS) { |
| | | public List<UIFormDefineVO> formDO2VOs(Collection<PortalVI> portalVIS) { |
| | | List<UIFormDefineVO> formDefineVOList = new ArrayList<>(); |
| | | Optional.ofNullable(portalVIS).orElseGet(()->new ArrayList<com.vci.corba.portal.data.PortalVI>()).stream().forEach(portal->{ |
| | | Optional.ofNullable(portalVIS).orElseGet(()->new ArrayList<PortalVI>()).stream().forEach(portal->{ |
| | | try { |
| | | UIFormDefineVO defineVO = formDO2VO(portal); |
| | | formDefineVOList.add(defineVO); |
| | |
| | | */ |
| | | @Override |
| | | @VciUnLog |
| | | public UIFormDefineVO formDO2VO(com.vci.corba.portal.data.PortalVI portal) { |
| | | public UIFormDefineVO formDO2VO(PortalVI portal) { |
| | | if(portal == null ||StringUtils.isBlank(portal.prm)){ |
| | | throw new VciBaseException("表单可能不存在,因为未能获取到它的信息"); |
| | | } |
| | |
| | | if("radio".equalsIgnoreCase(itemVO.getType()) || "checkbox".equalsIgnoreCase(itemVO.getType()) |
| | | || "combox".equalsIgnoreCase(itemVO.getType())){ |
| | | //看看有没有单独设置 |
| | | if(StringUtils.isNotBlank(itemXO.getComboxKey())){ |
| | | itemVO.setComboxKey(itemXO.getComboxKey()); |
| | | if(StringUtils.isNotBlank(itemXO.getComboxItems())){ |
| | | List<KeyValue> keyValues = new ArrayList<>(); |
| | | VciBaseUtil.str2List(itemXO.getComboxItems()).stream().forEach(temmpKeyValue->{ |
| | | KeyValue kv = new KeyValue(); |
| | | kv.setKey(temmpKeyValue.split("=")[0]); |
| | | kv.setValue(temmpKeyValue.split("=")[1]); |
| | | keyValues.add(kv); |
| | | }); |
| | | itemVO.setData(keyValues); |
| | | // if(StringUtils.isNotBlank(itemXO.getComboxKey())){ |
| | | // itemVO.setComboxKey(itemXO.getComboxKey()); |
| | | if(StringUtils.isNotBlank(itemXO.getComboxItems())){ |
| | | List<KeyValue> keyValues = new ArrayList<>(); |
| | | for (String keyValue : itemXO.getComboxItems().split(";")) { |
| | | KeyValue kv = new KeyValue(); |
| | | String[] split = keyValue.split("\\{"); |
| | | kv.setKey(split[0]); |
| | | kv.setValue(split[1].substring(0,split[1].length()-1)); |
| | | keyValues.add(kv); |
| | | } |
| | | itemVO.setData(keyValues); |
| | | }else{ |
| | | String attr = itemVO.getField(); |
| | | if(itemVO.getField().toLowerCase().startsWith("t_oid.") |
| | |
| | | return null; |
| | | } |
| | | if(!QUERY_BY_CACHE){ |
| | | com.vci.corba.portal.data.PortalVI portalVI = null; |
| | | PortalVI portalVI = null; |
| | | try { |
| | | portalVI = ServiceProvider.getUIService().getPortalVIByTypeNameAndVIName(btmId, id); |
| | | } catch (VCIError vciError) { |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | | return formDO2VO(portalVI); |
| | |
| | | @Cacheable(value = VCI_OBJECT_SERVICE,key = CacheKeyConstant.ALL_TABLE,unless = "#result == null") |
| | | @VciUnLog |
| | | public List<UITableDefineVO> selectAllTable() { |
| | | com.vci.corba.portal.data.PortalVI[] portalVIS = null; |
| | | PortalVI[] portalVIS = null; |
| | | try { |
| | | portalVIS = ServiceProvider.getUIService().getAllPortalVI(); |
| | | } catch (VCIError vciError) { |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | | List<com.vci.corba.portal.data.PortalVI> portalVIList = Arrays.stream(portalVIS).filter(portal -> 0 == portal.viType).collect(Collectors.toList()); |
| | | List<PortalVI> portalVIList = Arrays.stream(portalVIS).filter(portal -> 0 == portal.viType).collect(Collectors.toList()); |
| | | return tableDO2VOs(portalVIList,false); |
| | | } |
| | | |
| | |
| | | @VciUnLog |
| | | public List<UITableDefineVO> tableDO2VOs(Collection<PortalVI> prms, boolean queryDetail) { |
| | | List<UITableDefineVO> tableDefineVOList = new ArrayList<>(); |
| | | Optional.ofNullable(prms).orElseGet(()->new ArrayList<com.vci.corba.portal.data.PortalVI>()).stream().forEach(portal->{ |
| | | Optional.ofNullable(prms).orElseGet(()->new ArrayList<PortalVI>()).stream().forEach(portal->{ |
| | | UITableDefineVO defineVO = tableDO2VO(portal,queryDetail); |
| | | tableDefineVOList.add(defineVO); |
| | | }); |
| | |
| | | @Override |
| | | @VciUnLog |
| | | public UITableDefineVO tableDO2VO(PortalVI portal, boolean queryDetail) { |
| | | if(null != null){ |
| | | |
| | | } |
| | | UITableDefineVO tableDefineVO = new UITableDefineVO(); |
| | | tableDefineVO.setOid(portal.id); |
| | | tableDefineVO.setId(portal.viName); |
| | |
| | | }else{ |
| | | try { |
| | | formDefineVO = formDO2VO(ServiceProvider.getUIService().getPortalVIById(formOid)); |
| | | } catch (VCIError vciError) { |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | | } |
| | |
| | | return null; |
| | | } |
| | | if(!QUERY_BY_CACHE){ |
| | | com.vci.corba.portal.data.PortalVI portalVI = null; |
| | | PortalVI portalVI = null; |
| | | try { |
| | | portalVI = ServiceProvider.getUIService().getPortalVIByTypeNameAndVIName(btmId, id); |
| | | } catch (VCIError vciError) { |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | | return tableDO2VO(portalVI,true); |
| | |
| | | try { |
| | | // return actionDO2VOs(Arrays.stream(platformClientUtil.getPortalService().getAllPLAction()).collect(Collectors.toList())); |
| | | return actionDO2VOs(Arrays.stream(ServiceProvider.getUIService().getAllPLAction()).collect(Collectors.toList())); |
| | | } catch (VCIError vciError) { |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | | } |
| | |
| | | */ |
| | | @Override |
| | | @VciUnLog |
| | | public List<UIActionVO> actionDO2VOs(Collection<com.vci.corba.portal.data.PLAction> actions) { |
| | | public List<UIActionVO> actionDO2VOs(Collection<PLAction> actions) { |
| | | List<UIActionVO> actionVOS = new ArrayList<>(); |
| | | Optional.ofNullable(actions).orElseGet(()->new ArrayList<>()).stream().forEach(action->{ |
| | | UIActionVO actionVO = actionDO2VO(action); |
| | |
| | | */ |
| | | @Override |
| | | @VciUnLog |
| | | public UIActionVO actionDO2VO(com.vci.corba.portal.data.PLAction action) { |
| | | public UIActionVO actionDO2VO(PLAction action) { |
| | | UIActionVO actionVO = new UIActionVO(); |
| | | if(action!=null){ |
| | | actionVO.setOid(action.plOId); |
| | |
| | | actionVO.setCreator(action.plCreateUser); |
| | | actionVO.setLastModifier(action.plModifyUser); |
| | | try { |
| | | actionVO.setCreateTime(VciDateUtil.str2Date(String.valueOf(action.plCreateTime), VciDateUtil.DateTimeFormat)); |
| | | actionVO.setLastModifyTime(VciDateUtil.str2Date(String.valueOf(action.plCreateTime), VciDateUtil.DateTimeFormat)); |
| | | actionVO.setCreateTime(new Date(action.plCreateTime)); |
| | | actionVO.setLastModifyTime(new Date(action.plCreateTime)); |
| | | }catch (Throwable e){ |
| | | logger.error("转换时间",e); |
| | | } |
| | |
| | | contentVO.setDescription(pageLayoutDefination.plDesc); |
| | | contentVO.setCreator(pageLayoutDefination.plCreateUser); |
| | | try { |
| | | contentVO.setCreateTime(VciDateUtil.str2Date(String.valueOf(pageLayoutDefination.plCreateTime),VciDateUtil.DateTimeFormat)); |
| | | contentVO.setLastModifyTime(VciDateUtil.str2Date(String.valueOf(pageLayoutDefination.plModifyTime),VciDateUtil.DateTimeFormat)); |
| | | contentVO.setCreateTime(new Date(pageLayoutDefination.plCreateTime)); |
| | | contentVO.setLastModifyTime(new Date(pageLayoutDefination.plModifyTime)); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | return contentVO; |
| | | } |
| | | |
| | | // private List<UILayoutVO> swapLayArea(List<UILayoutVO> layoutVOS){ |
| | | // List<UILayoutVO> layoutVOList = new ArrayList<>(); |
| | | // //1 导航区 |
| | | // //2 主内容区 |
| | | // //3 页签区 |
| | | // if(!CollectionUtils.isEmpty(layoutVOS)){ |
| | | // //只有一个区域的时候,都放在center里,哪怕本身是导航区 |
| | | // if(layoutVOS.size() == 1){ |
| | | // layoutVOS.get(0).setLayoutAreaType(UILayoutAreaTypeEnum.CENTER.getValue()); |
| | | // layoutVOList.add(layoutVOS.get(0)); |
| | | // }else{ |
| | | // Map<String,List<UILayoutVO>> layoutAreaMap = layoutVOS.stream().collect(Collectors.groupingBy(UILayoutVO::getLayoutAreaType)); |
| | | // if(layoutAreaMap.containsKey("1")){ |
| | | // // |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // private List<UILayoutVO> swapLayArea(List<UILayoutVO> layoutVOS){ |
| | | // List<UILayoutVO> layoutVOList = new ArrayList<>(); |
| | | // //1 导航区 |
| | | // //2 主内容区 |
| | | // //3 页签区 |
| | | // if(!CollectionUtils.isEmpty(layoutVOS)){ |
| | | // //只有一个区域的时候,都放在center里,哪怕本身是导航区 |
| | | // if(layoutVOS.size() == 1){ |
| | | // layoutVOS.get(0).setLayoutAreaType(UILayoutAreaTypeEnum.CENTER.getValue()); |
| | | // layoutVOList.add(layoutVOS.get(0)); |
| | | // }else{ |
| | | // Map<String,List<UILayoutVO>> layoutAreaMap = layoutVOS.stream().collect(Collectors.groupingBy(UILayoutVO::getLayoutAreaType)); |
| | | // if(layoutAreaMap.containsKey("1")){ |
| | | // // |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | /** |
| | | * 获取某个UI上下文的区域 |
| | |
| | | private List<UILayoutVO> listLayoutByContent(String pkContent){ |
| | | try { |
| | | return UILayoutDO2VOs(Arrays.stream(ServiceProvider.getUIService().getPLTabPagesByPageDefinationOId(pkContent)).collect(Collectors.toList()),true); |
| | | } catch (VCIError vciError) { |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | | } |
| | |
| | | * @param pages 区域的数据对象 |
| | | * @return 显示对象 |
| | | */ |
| | | private List<UILayoutVO> UILayoutDO2VOs(Collection<com.vci.corba.portal.data.PLTabPage> pages, boolean queryDetail){ |
| | | private List<UILayoutVO> UILayoutDO2VOs(Collection<PLTabPage> pages, boolean queryDetail){ |
| | | List<UILayoutVO> contentVOS = new ArrayList<>(); |
| | | Optional.ofNullable(pages).orElseGet(()->new ArrayList<com.vci.corba.portal.data.PLTabPage>()).stream().forEach(page->{ |
| | | Optional.ofNullable(pages).orElseGet(()->new ArrayList<PLTabPage>()).stream().forEach(page->{ |
| | | UILayoutVO layoutVO = UILayoutDO2VO(page, queryDetail); |
| | | if(layoutVO.isEnableStatus()) { |
| | | contentVOS.add(layoutVO); |
| | |
| | | * @return 区域的显示对象 |
| | | */ |
| | | @VciUnLog |
| | | private UILayoutVO UILayoutDO2VO(com.vci.corba.portal.data.PLTabPage page, boolean queryDetail){ |
| | | private UILayoutVO UILayoutDO2VO(PLTabPage page, boolean queryDetail){ |
| | | UILayoutVO layoutVO = new UILayoutVO(); |
| | | if(page !=null ){ |
| | | layoutVO.setOid(page.plOId); |
| | |
| | | } |
| | | layoutVO.setCreator(page.plCreateUser); |
| | | try { |
| | | layoutVO.setCreateTime(VciDateUtil.str2Date(String.valueOf(page.plCreateTime),VciDateUtil.DateTimeFormat)); |
| | | layoutVO.setLastModifyTime(VciDateUtil.str2Date(String.valueOf(page.plModifyTime),VciDateUtil.DateTimeFormat)); |
| | | layoutVO.setCreateTime(new Date(page.plCreateTime)); |
| | | layoutVO.setLastModifyTime(new Date(page.plModifyTime)); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | 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)); |
| | | } catch (VCIError vciError) { |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | | } |
| | |
| | | } |
| | | if(!QUERY_BY_CACHE){ |
| | | try { |
| | | platformClientUtil.getPortalService().getPLPageDefinationById(componentOid); |
| | | return uiComponentDO2VO(null,true); |
| | | } catch (VCIError vciError) { |
| | | return uiComponentDO2VO(ServiceProvider.getUIService().getPLPageDefinationById(componentOid),true); |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | | }else{ |
| | |
| | | * @return 显示对象 |
| | | */ |
| | | @VciUnLog |
| | | private UIComponentVO uiComponentDO2VO(com.vci.corba.portal.data.PLPageDefination page, boolean queryDetail){ |
| | | private UIComponentVO uiComponentDO2VO(PLPageDefination page, boolean queryDetail){ |
| | | UIComponentVO componentVO = new UIComponentVO(); |
| | | if(page !=null){ |
| | | componentVO.setOid(page.plOId); |
| | |
| | | try { |
| | | componentVO.setTableDefineVO(tableDO2VO(ServiceProvider.getUIService().getPortalVIByTypeNameAndVIName(btmType,componentDefineXO.getTemplateId()),true)); |
| | | //componentVO.setTableDefineVO(tableDO2VO(platformClientUtil.getPortalService().getPortalVIByTypeNameAndVIName(btmType,componentDefineXO.getTemplateId()),true)); |
| | | } catch (VCIError vciError) { |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | | } |
| | |
| | | }else{ |
| | | try { |
| | | tableDefineVO = tableDO2VO(ServiceProvider.getUIService().getPortalVIByTypeNameAndVIName(btmType,componentDefineXO.getTemplateId()),true); |
| | | } catch (VCIError vciError) { |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | | } |
| | |
| | | }else{ |
| | | try { |
| | | componentVO.setFormDefineVO(formDO2VO(ServiceProvider.getUIService().getPortalVIByTypeNameAndVIName(btmType,componentDefineXO.getTemplateId()))); |
| | | } catch (VCIError vciError) { |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | | } |
| | |
| | | }else{ |
| | | return buttonDefineVOS; |
| | | } |
| | | } catch (VCIError vciError) { |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | | } |
| | |
| | | public UIButtonDefineVO buttonDO2VO(com.vci.corba.portal.data.PLTabButton button) { |
| | | UIButtonDefineVO buttonVO = new UIButtonDefineVO(); |
| | | Map<String, UIActionVO> actionVOMap = self.selectAllActionMap(); |
| | | //Map<String, UIActionVO> actionVOMap = ServiceProvider.getUIService().getAllPLAction(); |
| | | // Map<String, UIActionVO> actionVOMap = ServiceProvider.getUIService().getAllPLAction(); |
| | | if(button !=null){ |
| | | buttonVO.setOid(button.plOId); |
| | | buttonVO.setPkComponent(button.plTableOId); |
| | |
| | | //查找参数 |
| | | Map<String,String> params = new HashMap<>(); |
| | | try { |
| | | // PLCommandParameter[] parameters = platformClientUtil.getPortalService().getPLCommandParametersByCommandOId(buttonVO.getOid()); |
| | | com.vci.corba.portal.data.PLCommandParameter[] parameters = ServiceProvider.getUIService().getPLCommandParametersByCommandOId(buttonVO.getOid()); |
| | | //PLCommandParameter[] parameters = platformClientUtil.getPortalService().getPLCommandParametersByCommandOId(buttonVO.getOid()); |
| | | PLCommandParameter[] parameters = ServiceProvider.getUIService().getPLCommandParametersByCommandOId(buttonVO.getOid()); |
| | | if(parameters!=null && parameters.length > 0){ |
| | | for(com.vci.corba.portal.data.PLCommandParameter parameter: parameters){ |
| | | for(PLCommandParameter parameter: parameters){ |
| | | params.put(parameter.plKey,parameter.plValue); |
| | | } |
| | | } |
| | | } catch (VCIError vciError) { |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | | buttonVO.setParamVOS(params); |
| | |
| | | @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上下文的编号"); |
| | | PLPageLayoutDefination[] obj = null; |
| | | PLUILayout[] obj = null; |
| | | try { |
| | | obj = platformClientUtil.getPortalService().getPLPageLayoutDefinationsByRelatedType(btmType); |
| | | } catch (VCIError vciError) { |
| | | obj = ServiceProvider.getUIService().getPLUILayoutsByRelatedType(btmType); |
| | | // obj = platformClientUtil.getPortalService().getPLPageLayoutDefinationsByRelatedType(btmType); |
| | | // obj = ServiceProvider.geT(btmType); |
| | | |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | | PLPageLayoutDefination context = null; |
| | | PLUILayout context = null; |
| | | for (int i = 0; i < obj.length; i++) { |
| | | if (obj[i].plCode.equals(id)) { |
| | | context = obj[i]; |
| | | break; |
| | | } |
| | | } |
| | | //return UIContentDO2VO(context,true); |
| | | return UIContentDO2VO(null,true); |
| | | return UIContentDO2VO(context,true); |
| | | // return UIContentDO2VO(null,true); |
| | | } |
| | | |
| | | } |
| | | |