业务类型查询:树查询修改,数据列表查询接口修改(处理模板套模板情况下freemarker表达式的替换处理)。
| | |
| | | this.functionType = functionType; |
| | | } |
| | | |
| | | public void setValid(Boolean valid) { |
| | | isValid = valid; |
| | | } |
| | | |
| | | public void setHavePermission(Integer havePermission) { |
| | | this.havePermission = havePermission; |
| | | } |
| | | |
| | | public int getFunctionType() { |
| | | return functionType; |
| | | } |
| | | |
| | | public Boolean getValid() { |
| | | return isValid; |
| | | } |
| | | |
| | | public Integer getHavePermission() { |
| | |
| | | return isValid; |
| | | } |
| | | |
| | | |
| | | |
| | | public void setChildType(Integer childType) { |
| | | this.childType = childType; |
| | | } |
| | |
| | | @VciBusinessLog(operateName = "获取属性(树形结构)") |
| | | public BaseResult<List<Tree>> getTreeAttributesByBtmName(TreeQueryObject treeQueryObject){ |
| | | try { |
| | | List<Tree> trees= attributeService.getTreeAttributesByBtmName(treeQueryObject); |
| | | List<Tree> trees = attributeService.getTreeAttributesByBtmName(treeQueryObject); |
| | | return BaseResult.dataList(trees); |
| | | // return BaseResult.tree(trees); |
| | | }catch (Throwable e) { |
| | |
| | | @PostMapping("/getDataForTree") |
| | | @VciUnCheckRight |
| | | @VciBusinessLog(operateName = "树的查询",description = "${param.btmname}") |
| | | public List<Tree> getDataForTree(UITreeQuery treeQuery){ |
| | | public BaseResult getDataForTree(UITreeQuery treeQuery){ |
| | | try { |
| | | return uiDataService.getDataForTree(treeQuery); |
| | | return BaseResult.tree(uiDataService.getDataForTree(treeQuery)); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | String errorMsg = "树的数据查询出现错误,原因:"+ VciBaseUtil.getExceptionMessage(e); |
| | |
| | | pTree.setExpanded(true); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | 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(); |
| | |
| | | if(treeQuery.getExtandParamsMap() != null){ |
| | | treeQuery.getConditionMap().putAll(treeQuery.getExtandParamsMap()); |
| | | } |
| | | String parentFieldName = treeQuery.getParentFieldName(); |
| | | String parentFieldName = treeQuery.getParentFieldName(); |
| | | if(parentFieldName.contains(",")){ |
| | | parentFieldName = parentFieldName.split(",")[0]; |
| | | } |
| | | //TODO: 这儿为啥要将根节点显示表达式放到查询条件中去,这样就会导致这个节点被当成查询条件去查询 |
| | | if(StringUtils.isNotBlank(parentFieldName)){ |
| | | if(StringUtils.isNotBlank(treeQuery.getParentOid())){ |
| | | treeQuery.getConditionMap().put(parentFieldName,treeQuery.getParentOid()); |
| | |
| | | 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); |
| | |
| | | Map<String,String> cbo2Map = boService.cbo2Map(cbo); |
| | | if(!CollectionUtils.isEmpty(cbo2Map)){ |
| | | cbo2Map.forEach((key,value)->{ |
| | | cloMap.put(parentFieldName + "." + key,value); |
| | | //TODO: 这儿为啥要拼接上parentFieldName,导致后面freemarker表达式无法正确替换 |
| | | cloMap.put(/*parentFieldName + "." +*/ key,value); |
| | | }); |
| | | } |
| | | tree.setOid(getValueByExpressForBOAndLO(cloMap,cbo2Map,valueField)); |
| | |
| | | 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()); |
| | |
| | | import com.vci.starter.web.wrapper.VciQueryWrapperForDO; |
| | | import com.vci.web.properties.WebProperties; |
| | | import com.vci.web.service.*; |
| | | import com.vci.web.util.Func; |
| | | import com.vci.web.util.PlatformClientUtil; |
| | | import com.vci.web.util.WebUtil; |
| | | import org.apache.commons.lang3.StringUtils; |
| | |
| | | replaceLowMap.put(key.toLowerCase(),value); |
| | | }); |
| | | } |
| | | Map<String, ConditionItem> ciMap = condition.getCIMap(); |
| | | //改为递归,处理模板套模板的问题 |
| | | this.recurReplaceCiMap(qt,replaceLowMap); |
| | | /*Map<String, ConditionItem> ciMap = condition.getCIMap(); |
| | | ciMap.forEach((ciId,ci)->{ |
| | | if(ci.isLeaf()) { |
| | | LeafInfo lInfo = ci.getLeafInfo(); |
| | |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | });*/ |
| | | } |
| | | }catch(PLException e){ |
| | | logger.error(e.code,e); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 递归处理ciMap中值替换问题,处理模板套模板的问题 |
| | | * @param qt |
| | | * @param replaceLowMap |
| | | */ |
| | | private void recurReplaceCiMap(QueryTemplate qt, Map<String,String> replaceLowMap){ |
| | | //跳出递归 |
| | | if(Func.isEmpty(qt)){ |
| | | return; |
| | | } |
| | | Map<String, ConditionItem> ciMap = qt.getCondition().getCIMap(); |
| | | ciMap.forEach((ciId,ci)->{ |
| | | if(ci.isLeaf()) { |
| | | LeafInfo lInfo = ci.getLeafInfo(); |
| | | String value = lInfo.getValue().getOrdinaryValue(); |
| | | if(StringUtils.isNotBlank(value)){ |
| | | if(value.contains("#")){ |
| | | //系统变量.支持一个 |
| | | //lInfo.getValue().setOrdinaryValue(systemVarValueMap.getOrDefault(value.toUpperCase(),"")); |
| | | }else if(value.contains("${")){ |
| | | //有${xxxx}的方式 |
| | | if(!CollectionUtils.isEmpty(replaceLowMap)) { |
| | | try { |
| | | lInfo.getValue().setOrdinaryValue(VciBaseUtil.replaceByFreeMarker(value, replaceLowMap)); |
| | | }catch (Throwable e){ |
| | | logger.error("可能配置有问题,在转换freemarker表达式的时候,没有找到对应的值,目前表达式为{}",new String[]{value},e); |
| | | } |
| | | } |
| | | }else if(replaceLowMap.containsKey(value.toLowerCase())){ |
| | | lInfo.getValue().setOrdinaryValue(replaceLowMap.get(value.toLowerCase())); |
| | | } |
| | | }else { |
| | | recurReplaceCiMap(lInfo.getValue().getQueryTemplate(),replaceLowMap); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 根据查询模板来查询数据 |
| | | * @param queryScheme 查询方案 |
| | | * @param conditionMap 查询条件 |
| | |
| | | LO_BASE_FIELD_MAP.put("oid","oid"); |
| | | LO_BASE_FIELD_MAP.put("creator","creator"); |
| | | LO_BASE_FIELD_MAP.put("createTime","createTime"); |
| | | LO_BASE_FIELD_MAP.put("lastModifier","lastModifier"); |
| | | LO_BASE_FIELD_MAP.put("lastModifyTime","lastModifyTime"); |
| | | //LO_BASE_FIELD_MAP.put("lastModifier","lastModifier"); |
| | | //LO_BASE_FIELD_MAP.put("lastModifyTime","lastModifyTime"); |
| | | LO_BASE_FIELD_MAP.put("modifier","lastModifier"); |
| | | LO_BASE_FIELD_MAP.put("modifyTime","lastModifyTime"); |
| | | LO_BASE_FIELD_MAP.put("fromOid","f_oid"); |
| | | LO_BASE_FIELD_MAP.put("fromRevisionOid","f_revisionoid"); |
| | | //LO_BASE_FIELD_MAP.put("fromRevisionOid","f_revisionoid"); |
| | | LO_BASE_FIELD_MAP.put("fromRevOid","f_revisionoid"); |
| | | LO_BASE_FIELD_MAP.put("fromNameOid","f_nameoid"); |
| | | LO_BASE_FIELD_MAP.put("fromBTMName","f_btwname"); |
| | | LO_BASE_FIELD_MAP.put("toRevisionOid","t_revisionoid"); |
| | | //LO_BASE_FIELD_MAP.put("fromBTMName","f_btwname"); |
| | | LO_BASE_FIELD_MAP.put("fromBTName","f_btwname"); |
| | | //LO_BASE_FIELD_MAP.put("toRevisionOid","t_revisionoid"); |
| | | LO_BASE_FIELD_MAP.put("toRevOid","t_revisionoid"); |
| | | LO_BASE_FIELD_MAP.put("toNameOid","t_nameoid"); |
| | | LO_BASE_FIELD_MAP.put("toBTMName","t_btwname"); |
| | | //LO_BASE_FIELD_MAP.put("toBTMName","t_btwname"); |
| | | LO_BASE_FIELD_MAP.put("toBTName","t_btwname"); |
| | | LO_BASE_FIELD_MAP.put("toOid","t_oid"); |
| | | LO_BASE_FIELD_MAP.put("ts","ts"); |
| | | LO_BASE_FIELD_MAP.put("linkTypeName","linkTypeName"); |
| | | //LO_BASE_FIELD_MAP.put("linkTypeName","linkTypeName"); |
| | | LO_BASE_FIELD_MAP.put("ltName","linkTypeName"); |
| | | } |
| | | |
| | | |