| | |
| | | import com.vci.corba.omd.btm.BizType; |
| | | import com.vci.corba.omd.data.*; |
| | | import com.vci.corba.omd.lcm.LifeCycle; |
| | | import com.vci.corba.omd.ltm.LinkType; |
| | | import com.vci.dto.*; |
| | | import com.vci.frameworkcore.lcstatuspck.FrameworkDataLCStatus; |
| | | import com.vci.frameworkcore.lcstatuspck.ReleaseDataLCStatus; |
| | |
| | | queryFieldList.add("creator_name"); |
| | | queryFieldList.add("lastmodifier_name"); |
| | | //我们在后台查询业务数据 |
| | | Map<String, String> replaceMap = wrapperReplaceMap( dataGridQuery.getSourceData()); |
| | | Map<String, String> replaceMap = wrapperReplaceMap(dataGridQuery.getSourceData()); |
| | | |
| | | if(dataGridQuery.isLinkTypeFlag()){ |
| | | UILinkTypeDataQuery linkTypeDataQuery = new UILinkTypeDataQuery(); |
| | |
| | | * @throws VciBaseException 查询出错的时候会抛出异常 |
| | | */ |
| | | @Override |
| | | public List<Tree> getDataForTree(UITreeQuery treeQuery) throws VciBaseException { |
| | | public List<Tree> getDataForTree(UITreeQuery treeQuery) throws VciBaseException, PLException { |
| | | VciBaseUtil.alertNotNull(treeQuery,"表单的查询对象",treeQuery.getBtmname(),"业务类型的信息",treeQuery.getComponentOid(),"树所在的组件的主键"); |
| | | Map<String, OsAttributeVO> attributeVOMap = attrService.selectAllAttributeMap(); |
| | | UIComponentVO componentVO = uiEngineService.getComponentByOid(treeQuery.getComponentOid(),attributeVOMap); |
| | |
| | | if(treeQuery.getExtandParamsMap() != null){ |
| | | treeQuery.getConditionMap().putAll(treeQuery.getExtandParamsMap()); |
| | | } |
| | | String parentFieldName = treeQuery.getParentFieldName(); |
| | | String parentFieldName = treeQuery.getParentFieldName(); |
| | | if(parentFieldName.contains(",")){ |
| | | parentFieldName = parentFieldName.split(",")[0]; |
| | | } |
| | |
| | | if(StringUtils.isBlank(treeDefineVO.getLinkType())){ |
| | | //这个是业务类型的自参照 |
| | | //以前的平台没有对自参照这种有全部查询的 |
| | | OsBtmTypeVO btmTypeVO = btmService.getBtmById(treeDefineVO.getBtmType(),attributeVOMap); |
| | | OsBtmTypeVO btmTypeVO = btmService.getBtmByName(treeDefineVO.getBtmType()); |
| | | queryFieldList.addAll(btmTypeVO.getAttributes().stream().map(OsBtmTypeAttributeVO::getId).collect(Collectors.toList())); |
| | | queryFieldList.addAll(WebBoServiceImpl.BO_BASE_FIELD_MAP.values()); |
| | | |
| | |
| | | if(StringUtils.isBlank(parentFieldNameAndValue) || !parentFieldNameAndValue.contains(",")){ |
| | | throw new VciBaseException("配置的信息有误。在没有在菜单或者来源数据设置根节点的查询模板时,请在树的【参照树】上设置上级字段的名称和根节点的查询的值。比如xxxx,yyy。其中xxxx是上级字段英文名称"); |
| | | } |
| | | parentFieldName= parentFieldNameAndValue.split(",")[0]; |
| | | parentFieldName = parentFieldNameAndValue.split(",")[0]; |
| | | String rootQueryValue = parentFieldNameAndValue.split(",")[1]; |
| | | treeQuery.getConditionMap().put(parentFieldName,rootQueryValue); |
| | | replaceMap.put(parentFieldName,rootQueryValue); |
| | |
| | | return cbo2Trees(thisChildren, valueField, textField, parentFieldName, treeQuery.isShowCheckBox(), null); |
| | | } |
| | | }else{ |
| | | OsLinkTypeVO linkTypeVO = linkTypeService.getLinkTypeById(treeDefineVO.getLinkType()); |
| | | queryFieldList.addAll(linkTypeVO.getAttributes().stream().map(OsLinkTypeAttributeVO::getId).collect(Collectors.toList())); |
| | | //OsLinkTypeVO linkTypeVO = linkTypeService.getLinkTypeById(treeDefineVO.getLinkType()); |
| | | LinkType linkType = platformClientUtil.getLinkTypeService().getLinkType(treeDefineVO.getLinkType()); |
| | | //queryFieldList.addAll(linkTypeVO.getAttributes().stream().map(OsLinkTypeAttributeVO::getId).collect(Collectors.toList())); |
| | | queryFieldList.addAll(Arrays.asList(linkType.attributes)); |
| | | queryFieldList.addAll(WebLoServiceImpl.LO_BASE_FIELD_MAP.values()); |
| | | |
| | | addQueryField(queryFieldList,valueField); |
| | |
| | | return cloAndCbo2Trees(loService.queryCLOAndBoByLinkType(linkTypeDataQuery),valueField,textField,parentFieldName,treeQuery.isShowCheckBox(),treeQuery.getParentOid()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取数据(根据查询模板查询对象,返回的结构按照ui定义,定义的模板类型返回) |
| | | * @param treeQuery 树形查询条件 |
| | | * @return 树形数据 |
| | | * @throws VciBaseException 查询出错的时候会抛出异常 |
| | | */ |
| | | @Override |
| | | public BaseResult getDataByTemp(UITreeQuery treeQuery) throws VciBaseException, PLException { |
| | | VciBaseUtil.alertNotNull(treeQuery,"表单的查询对象",treeQuery.getComponentOid(),"当前组件的主键"); |
| | | //1、先查询页面定义组件 |
| | | Map<String, OsAttributeVO> attributeVOMap = attrService.selectAllAttributeMap(); |
| | | UIComponentVO componentVO = uiEngineService.getComponentByOid(treeQuery.getComponentOid(),attributeVOMap); |
| | | if(componentVO == null || StringUtils.isBlank(componentVO.getOid())){ |
| | | throw new VciBaseException("未获取到界面配置信息!"); |
| | | } |
| | | // 2、根据配置的查询模板查询数据(需要考虑全面一点), |
| | | // 这儿根据当前类型来获取是什么类型的查询模板,然后做对应的查询处理 |
| | | |
| | | UITreeDefineVO treeDefineVO = componentVO.getTreeDefineVO(); |
| | | String queryTemplate = StringUtils.isNotBlank(treeQuery.getQueryTemplate())?treeQuery.getQueryTemplate():(!CollectionUtils.isEmpty(treeQuery.getSourceData())?treeQuery.getSourceData().getOrDefault("querytemplate",treeDefineVO.getQueryTemplateName()):treeDefineVO.getQueryTemplateName()); |
| | | Map<String, String> replaceMap = wrapperReplaceMap(treeQuery.getSourceData()); |
| | | List<String> queryFieldList = new ArrayList<>(); |
| | | String valueField = treeQuery.isLinkTypeFlag()?(!treeDefineVO.isOrientation()?"${oid}" + TREE_NODE_ID_SEP + "${t_oid}":"${oid}" + TREE_NODE_ID_SEP + "${f_oid}"):(StringUtils.isNotBlank(treeQuery.getValueField())?treeQuery.getValueField():"oid"); |
| | | String textField = StringUtils.isNotBlank(treeDefineVO.getTreeNodeExpression())?treeDefineVO.getTreeNodeExpression():(StringUtils.isNotBlank(treeQuery.getTextField())?treeQuery.getTextField():"name"); |
| | | String rootExpress = StringUtils.isNotBlank(treeQuery.getRootExpress())?treeQuery.getRootExpress():treeDefineVO.getRootContent(); |
| | | String parentFieldName = treeQuery.getParentFieldName(); |
| | | if(parentFieldName.contains(",")){ |
| | | parentFieldName = parentFieldName.split(",")[0]; |
| | | } |
| | | queryFieldList.add("creator_name"); |
| | | queryFieldList.add("lastmodifier_name"); |
| | | OsBtmTypeVO btmTypeVO = btmService.getBtmByName(treeDefineVO.getBtmType()); |
| | | queryFieldList.addAll(btmTypeVO.getAttributes().stream().map(OsBtmTypeAttributeVO::getId).collect(Collectors.toList())); |
| | | queryFieldList.addAll(WebBoServiceImpl.BO_BASE_FIELD_MAP.values()); |
| | | |
| | | addQueryField(queryFieldList,valueField); |
| | | addQueryField(queryFieldList,textField); |
| | | List<BusinessObject> rootCbos = boService.queryCBOByScheme(queryTemplate, null, replaceMap); |
| | | |
| | | //3、根据不同的组件返回不同的数据类型(树、列表、树表、自定义模板、表单等) |
| | | List<Tree> rootTreeList = null; |
| | | if(!CollectionUtils.isEmpty(rootCbos)){ |
| | | rootTreeList = cbo2Trees(rootCbos,valueField,StringUtils.isBlank(rootExpress)?textField:rootExpress,parentFieldName,treeQuery.isShowCheckBox(),null); |
| | | TreeQueryObject treeQueryObject = new TreeQueryObject(); |
| | | treeQueryObject.setValueField(valueField); |
| | | treeQueryObject.setTextField(textField); |
| | | treeQueryObject.setParentFieldName(parentFieldName); |
| | | treeQueryObject.setShowCheckBox(treeQuery.isShowCheckBox()); |
| | | if(UITreeLoadTypeEnum.ALL.getValue().equalsIgnoreCase(treeDefineVO.getLoadType())){ |
| | | treeQueryObject.setQueryAllLevel(false); |
| | | } |
| | | //queryTreeForBO(rootTreeList,treeDefineVO.getQueryTemplateName(),queryFieldList,treeQueryObject); |
| | | } |
| | | return BaseResult.tree(rootTreeList); |
| | | } |
| | | |
| | | /** |
| | |
| | | Map<String,String> cbo2Map = boService.cbo2Map(cbo); |
| | | if(!CollectionUtils.isEmpty(cbo2Map)){ |
| | | cbo2Map.forEach((key,value)->{ |
| | | //TODO: 这儿为啥要拼接上parentFieldName,导致后面freemarker表达式无法正确替换 |
| | | cloMap.put(parentFieldName + "." + key,value); |
| | | }); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | tree.setAttributes(cbo2Map); |
| | | tree.setAttributes(cloMap/*cbo2Map*/); |
| | | tree.setIndex(i[0] + ""); |
| | | i[0]++; |
| | | tree.setChecked(showCheckBox); |
| | |
| | | conditionMap.put(usedAttributeVO.getId(),QueryOptionConstant.IN + "(" + VciBaseUtil.toInSql(oids.toArray(new String[0])) + ")"); |
| | | if(StringUtils.isNotBlank(usedAttributeVO.getPkBtmType())) { |
| | | if (boService.queryCount(usedAttributeVO.getPkBtmType(), conditionMap) > 0) { |
| | | OsBtmTypeVO btmTypeVO = btmService.getBtmById(usedAttributeVO.getPkBtmType()); |
| | | OsBtmTypeVO btmTypeVO = null; |
| | | try { |
| | | btmTypeVO = btmService.getBtmById(usedAttributeVO.getPkBtmType()); |
| | | } catch (PLException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | throw new VciBaseException("数据在【" + btmTypeVO.getName() + "】中的字段[" + usedAttributeVO.getName() + "]里被引用.不能删除"); |
| | | } |
| | | }else{ |