业务类型查询:树查询修改,数据列表查询接口修改(处理模板套模板情况下freemarker表达式的替换处理)。
已修改8个文件
96 ■■■■ 文件已修改
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/MenuVO.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsAttributeController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebUIDataController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIDataServiceImpl.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIEngineServiceImpl.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBoServiceImpl.java 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebLoServiceImpl.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/MenuVO.java
@@ -175,20 +175,12 @@
        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() {
@@ -231,6 +223,8 @@
        return isValid;
    }
    public void setChildType(Integer childType) {
        this.childType = childType;
    }
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsAttributeController.java
@@ -56,7 +56,7 @@
    @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) {
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebUIDataController.java
@@ -86,9 +86,9 @@
    @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);
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java
@@ -229,7 +229,6 @@
                pTree.setExpanded(true);
            }
        }
    }
    /**
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIDataServiceImpl.java
@@ -185,7 +185,7 @@
        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();
@@ -367,10 +367,11 @@
        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());
@@ -410,7 +411,7 @@
                    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);
@@ -706,7 +707,8 @@
            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));
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIEngineServiceImpl.java
@@ -1371,7 +1371,8 @@
                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());
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBoServiceImpl.java
@@ -26,6 +26,7 @@
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;
@@ -942,7 +943,9 @@
                        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();
@@ -965,7 +968,7 @@
                            }
                        }
                    }
                });
                });*/
            }
        }catch(PLException e){
            logger.error(e.code,e);
@@ -978,6 +981,44 @@
    }
    /**
     * 递归处理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 查询条件
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebLoServiceImpl.java
@@ -75,18 +75,25 @@
        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");
    }