ludc
2024-10-31 a756aed2072b98ed02967ddf2b013fc77be65f94
修改业务类型类型改变时和业务类型移除属性时校验逻辑
已修改2个文件
25 ■■■■■ 文件已修改
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsBtmServiceImpl.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsQueryTemplateImpl.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsBtmServiceImpl.java
@@ -955,14 +955,14 @@
        String[] unRemovableFields = null;
        List<String> unRemovableFields_ = null;
        //需要移除的属性
        List<String> removableFields = null;
        List<String> removableFields = new ArrayList<>();
        //修改前业务类型在数据库中已存在的所有属性
        String[] apNameArray = btmTypeDTO.getApNameArray().split(",");
        List<String> apNameArray = Func.toStrList(btmTypeDTO.getApNameArray());
        Set<String> dbApNameArray = Arrays.stream(dbBizType.apNameArray)
                .collect(Collectors.toSet());
        //过滤出需要移除的属性
        removableFields = Arrays.stream(apNameArray)
                .filter(ap -> !dbApNameArray.contains(ap))   // 过滤不在 dbApSet 中的元素
        removableFields = dbApNameArray.stream()
                .filter(ap -> !apNameArray.contains(ap))   // 过滤不在 dbApSet 中的元素
                .collect(Collectors.toList());
        // 当业务类型表中某属性已经有值, 不删除该属性, 将已经移除的属性添加回来
        unRemovableFields = platformClientUtil.getBtmService().getUnRemovableFields(id, removableFields.toArray(new String[0]));
@@ -971,7 +971,9 @@
            if (this.hasInstanceByBtmName(id)) {
                //业务类型已有实例, 只能删除没有数据的列
                if (unRemovableFields != null && unRemovableFields.length > 0) {
                    unRemovableFields_ = Arrays.asList(unRemovableFields);
                    //移除了不可修改的属性直接报错,就不往下执行了
                    throw new VciBaseException("业务类型已有实例, 只能删除没有数据的列");
                    /*unRemovableFields_ = Arrays.asList(unRemovableFields);
                    for (int i = 0; i < removableFields.size(); i++) {
                        String abName = removableFields.get(i);
                        if (unRemovableFields_.contains(abName)) {
@@ -979,7 +981,7 @@
                                lastAttrList.add(abName);
                            }
                        }
                    }
                    }*/
                }
            }
        }
@@ -1575,7 +1577,7 @@
        //boolean flag = DDLToolClient.getService().hasInstanceOralce(tableName);
        boolean flag = false;
        try {
            flag = ClientServiceProvider.getOMDService().getBTMService().hasData(btmName);
            flag = platformClientUtil.getBtmService().hasData(btmName);
        } catch (PLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsQueryTemplateImpl.java
@@ -1444,8 +1444,13 @@
            throw new PLException("500", new String[]{checkInfo});
        }
        qt.setId("qt1");
        BusinessObject[] result = platformClientUtil.getQueryService().findBTMObjects(qt.getId(), OQTool.qtTOXMl(qt).asXML());
        return BaseResult.dataList(Arrays.asList(result));
        try {
            BusinessObject[] result = platformClientUtil.getQueryService().findBTMObjects(qt.getId(), OQTool.qtTOXMl(qt).asXML());
            return BaseResult.dataList(Arrays.asList(result));
        }catch (Exception e){
            String errorLog = "查询时出现问题,请检查配置的条件是否存在问题,具体原因:"+VciBaseUtil.getExceptionMessage(e);
            throw new VciBaseException(errorLog);
        }
    }
    /**