ludc
2024-10-30 0888cf078640e6db9fba2b7fcaa29f449e017371
属性池修改接口调整
已修改2个文件
43 ■■■■ 文件已修改
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java 42 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsBtmServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java
@@ -55,6 +55,7 @@
import java.util.*;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
//import static com.vci.client.omd.attribpool.ui.VTDataTypePanel.*;
import static com.vci.omd.constants.AttributeConstants.*;
@@ -167,7 +168,7 @@
    }
    /**
     * 够着属性树节点
     * 构造属性树节点
     * @param parentTreeList
     * @param refTypeName
     * @param refFlag
@@ -342,7 +343,10 @@
                attributeVO.setLastModifyTime(new Date(attribItem.modifyTime));
                attributeVO.setTs(VciDateUtil.str2Date(attribItem.ts,VciDateUtil.DateTimeMillFormat));
            }catch (Throwable e){
                e.printStackTrace();
                String errorLog = "属性DO转VO时出错,原因:"+VciBaseUtil.getExceptionMessage(e);
                logger.error(errorLog);
                throw new VciBaseException(errorLog);
            }
            attributeVO.setLastModifier(attribItem.modifier);
            attributeVO.setName(attribItem.label);
@@ -639,9 +643,10 @@
        //检查默认值与属性类型是否匹配
        checkDefValue(osAttributeDTO);
        boolean compatible = isCompatible(osAttributeVO,osAttributeDTO);
        boolean hasInstance = hasInstance(osAttributeDTO.getName());
        //产生数据, 并且不兼容
        if(hasInstance && !compatible){
        //boolean hasInstance = hasInstance(osAttributeDTO.getId()); //不判断是否产生数据只要被引用就需要进一步判断类型是否兼容
        boolean checkAttrIsUse = this.checkAttrIsUse(osAttributeDTO.getId());
        //TODO:按照以前操作配置文档中的逻辑应该是:不论是否产生数据只要被引用就需要要判断类型是否兼容(如VTString不能转为VTIntger或VTLong)
        if(checkAttrIsUse/*hasInstance*/ && !compatible){
            throw new PLException("500",new String[]{"无效变更, 不兼容已产生的数据!"});
        }
        String userId = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId();
@@ -791,6 +796,26 @@
     */
    private boolean hasInstance(String abName) throws PLException {
        return osBtmService.hasInstance(abName) && osLinkTypeServiceI.hasInstance(abName);
    }
    /**
     * 查看属性是否被引用
     * @param abName
     * @return false未被引用 true被引用
     */
    private boolean checkAttrIsUse(String abName) throws PLException {
        if(Func.isBlank(abName)){
            return false;
        }
        String[] btNames = platformClientUtil.getBtmService().getBTNamesByAPName(abName);
        if(Func.isNotEmpty(btNames)){
            return true;
        }
        String[] ltNames = platformClientUtil.getLinkTypeService().getLTNamesByAPName(abName);
        if(Func.isNotEmpty(ltNames)){
            return true;
        }
        return false;
    }
    /**
@@ -974,11 +999,14 @@
            throw new PLException("500",new String[]{"请选择要查询应用范围的属性!"});
        }
        String[] btNames = platformClientUtil.getBtmService().getBTNamesByAPName(attributeName);
        if(Func.isEmpty(btNames)){
        String[] ltNames = platformClientUtil.getLinkTypeService().getLTNamesByAPName(attributeName);
        String[] mergedArray = Stream.concat(Stream.of(btNames), Stream.of(ltNames)).toArray(String[]::new);
        if(Func.isEmpty(mergedArray)){
            return new ArrayList<>();
        }
        List<Map<String,String>> btmNameMapList = new ArrayList<>();
        Arrays.stream(btNames).forEach(btName->{
        Arrays.stream(mergedArray).forEach(btName->{
            Map<String, String> itemMap = new HashMap<>();
            itemMap.put("attributeName",attributeName);
            itemMap.put("source",btName);
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsBtmServiceImpl.java
@@ -495,7 +495,6 @@
    /**
     * 判断该属性是否已经在业务类型中产生了数据
     *
     * @param abName
     * @return
     * @throws PLException