ludc
2024-11-14 ed38499b75ab101109c3d2b6b7cc95034f868be3
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsBtmServiceImpl.java
@@ -246,7 +246,7 @@
            vo.setDelimiter(btmItem.delimiter);
            vo.setfName(btmItem.fName);
            vo.setVersionRule(String.valueOf(btmItem.verRuleName));
            if (StringUtils.isNotBlank(vo.getRevisionRuleName()) || vo.isInputRevisionFlag()) {
            if (StringUtils.isNotBlank(vo.getRevisionRuleId()) || vo.isInputRevisionFlag()) {
                vo.setRevisionFlag(true);
            }
            vo.setLifeCycleIds(Arrays.stream(btmItem.lifeCycles).collect(Collectors.joining(",")));
@@ -313,6 +313,25 @@
        }
        return self.selectAllBtmMap().getOrDefault(id.toLowerCase(), null);
    }
    /**
     * 使用类型名获取业务类型,查不到直接报错
     * @param btmName 类型名
     * @return 业务类型
     * @throws
     */
    @Override
    public OsBtmTypeVO getBtmByName(String btmName) throws PLException{
        if(Func.isBlank(btmName)){
            throw new PLException("500",new String[]{"查询条件类型名不能为空!"});
        }
        BizType bizType = platformClientUtil.getBtmService().getBizTypeByName(btmName);
        if(Func.isEmpty(bizType) || Func.isBlank(bizType.oid)){
            throw new PLException("500",new String[]{"根据【"+btmName+"】未查询到对应业务类型!"});
        }
        return btmDO2VO(bizType,null);
    }
    /**
     * 使用编号获取业务类型
     *
@@ -424,9 +443,10 @@
        if (attrVOs == null) {
            attrVOs = new ArrayList<>();
        }
        if (!CollectionUtils.isEmpty(attributeService.getDefaultAttributeVOs())) {
        List<OsAttributeVO> defaultAttributeVOs = attributeService.getDefaultAttributeVOs();
        if (!CollectionUtils.isEmpty(defaultAttributeVOs)) {
            List<OsBtmTypeAttributeVO> finalAttrVOs = attrVOs;
            attributeService.getDefaultAttributeVOs().stream().forEach(attr -> {
            defaultAttributeVOs.stream().forEach(attr -> {
                OsBtmTypeAttributeVO attributeVO = new OsBtmTypeAttributeVO();
                BeanUtil.convert(attr, attributeVO);
                attributeVO.setAttributeDataType(attr.getAttributeDataType());
@@ -955,14 +975,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 +991,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 +1001,7 @@
                                lastAttrList.add(abName);
                            }
                        }
                    }
                    }*/
                }
            }
        }
@@ -1575,7 +1597,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();