ludc
2024-10-22 af99adcdd1198af865d091204b8566e2b81e389d
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsPortalVIServiceImpl.java
@@ -128,7 +128,7 @@
            GetPagePortalVIArrayByPageInfoResult pagePortalVIArrayByPageInfoResult= platformClientUtil.getPortalService().getPagePortalVIArrayByPageInfo(typeName,viName,viType,viTypeFlag,pageIndex,pageSize);
            if(pagePortalVIArrayByPageInfoResult.total>0) {
                PortalVI[] portalVIS = pagePortalVIArrayByPageInfoResult.returnValue;
                List<PortalVIVO> portalVIVOS=  portalVIDOO2VOS(Arrays.asList(portalVIS));
                List<PortalVIVO> portalVIVOS = portalVIDOO2VOS(Arrays.asList(portalVIS));
                dataGrid.setData(portalVIVOS);
                dataGrid.setTotal(pagePortalVIArrayByPageInfoResult.total);
            }else{
@@ -149,7 +149,7 @@
     */
    @Override
    public BaseResult addSave(PortalVIDTO portalVIDTO) throws VciBaseException {
        return  savePortalVIDTO(portalVIDTO,false);
        return savePortalVIDTO(portalVIDTO,false);
    }
    /**
@@ -166,8 +166,11 @@
        if(PortalVIType.Table.getName()==viType){
            lableName=PortalVIType.Table.getLabel();
        }
        PortalVIVO portalVIVO=new PortalVIVO();
        PortalVI portalVI=  platformClientUtil.getPortalService().getPortalVIById(id);
        PortalVIVO portalVIVO = new PortalVIVO();
        PortalVI portalVI = platformClientUtil.getPortalService().getPortalVIById(id);
        if(portalVI==null||StringUtils.isBlank(portalVI.id)){
            throw new VciBaseException("根据主键未查询到数据");
        }
        portalVIVO=portalVIDOO2VO(portalVI);
        return portalVIVO;
    }
@@ -381,7 +384,7 @@
                }
                String attributeStr="";
                try {
                    List<OsAttributeVO> osAttributeVOList=osAttributeService.getOsAttributeVOSByBtName(portalVIDTO.getTypeName(),portalVIDTO.getTypeFlag());
                    List<OsAttributeVO> osAttributeVOList=osAttributeService.getOsAttributeVOSByBtName(portalVIDTO.getTypeName(),portalVIDTO.getTypeFlag(),false);
                    if(!CollectionUtils.isEmpty(osAttributeVOList)){
                      List<String> filedList= osAttributeVOList.stream().map(OsAttributeVO::getId).collect(Collectors.toList());
                        attributeStr=VciBaseUtil.array2String(filedList.toArray(new String[]{}));
@@ -521,7 +524,7 @@
                            });
                        }
                        //校验属性是否正确
                        List<OsAttributeVO> osAttributeVOList = osAttributeService.getOsAttributeVOSByBtName(portalVI.typeName, portalVI.typeFlag);
                        List<OsAttributeVO> osAttributeVOList = osAttributeService.getOsAttributeVOSByBtName(portalVI.typeName, portalVI.typeFlag,false);
                        if (!CollectionUtils.isEmpty(osAttributeVOList)) {
                            List<String> filedList = osAttributeVOList.stream().map(OsAttributeVO::getId).collect(Collectors.toList());
                            List<String> attributeList = VciBaseUtil.str2List(portalVIPO.getAttributeKey());
@@ -640,36 +643,34 @@
        boolean flag = false;
        String labelName=PortalVIType.Form.getName();
        try {
            VciBaseUtil.alertNotNull(portalVIDTO.getViName(),"名称不能为空!");
            VciBaseUtil.alertNotNull(portalVIDTO.getViName(),"名称");
            if(portalVIDTO.getPrm()==null||portalVIDTO.getPrm().getPrmItemList()==null||portalVIDTO.getPrm().getPrmItemList().size()==0){
                throw  new Throwable(labelName+",未设置");
            }
            if(PortalVIType.Table.getIntVal()==portalVIDTO.getViType()){//如果是表格的的校验
                labelName=PortalVIType.Table.getName();
                PRMItemDTO prmItemDTO=  portalVIDTO.getPrm().getPrmItemList().get(0);
                PRMItemDTO prmItemDTO = portalVIDTO.getPrm().getPrmItemList().get(0);
                //每页显示校验
                String rtnContent = isCorrectPageNums(prmItemDTO.getItemPageSize());
                if (StringUtils.isNotBlank(rtnContent)) {
                   throw new VciBaseException(rtnContent);
                }
            }else{
            }
            labelName= PortalVIType.getByIntVal(portalVIDTO.getViType()).getLabel();
            if(!_isBtm){
                PortalVI[] portalVIS=  platformClientUtil.getPortalService().getPortalVIArrayByTypeName(portalVIDTO.getTypeName());
                PortalVI[] portalVIS = platformClientUtil.getPortalService().getPortalVIArrayByTypeName(portalVIDTO.getTypeName());
                for (int i = 0; i < portalVIS.length; i++) {
                    PortalVI portalVI=  portalVIS[i];
                   String viName= portalVI.viName;
                    PortalVI portalVI = portalVIS[i];
                   String viName = portalVI.viName;
                   if(isEdit){//如果为修改
                       try {
                           PortalVI oldPortalVI= platformClientUtil.getPortalService().getPortalVIById(portalVIDTO.getId());
                           flag=platformClientUtil.getPortalService().judgeUpdateButton(oldPortalVI.typeFlag, oldPortalVI.viName, oldPortalVI.typeName);
                           PortalVI oldPortalVI = platformClientUtil.getPortalService().getPortalVIById(portalVIDTO.getId());
                           flag = platformClientUtil.getPortalService().judgeUpdateButton(oldPortalVI.typeFlag, oldPortalVI.viName, oldPortalVI.typeName);
                           if (flag && (StringUtils.isNotBlank(portalVIDTO.getViName()))&&(!oldPortalVI.viName.equals(portalVIDTO.getViName()))) {
                               throw  new Throwable("该"+labelName+"已经被引用,不能修改名称!");
                           }
                       } catch (PLException e) {
                           throw  new Throwable("查询原有表单出现异常:"+e.getMessage());
                           throw new Throwable("查询原有表单出现异常:"+e.getMessage());
                       }
                       if (!portalVI.id.equals(portalVIDTO.getId())) {
                           if (portalVI.viName.equals(portalVIDTO.getViName())) {
@@ -882,7 +883,7 @@
        portalVIVO.setViType(portalVI.viType);
        portalVIVO.setViTypeText(PortalVIType.getByIntVal(portalVI.viType).getLabel());
        String  prm= portalVI.prm;
        String prm= portalVI.prm;
        if(StringUtils.isNotBlank(prm)) {
            PRMDO prmdo = UITools.getPRM(prm);
            portalVIVO.setPrm(prmDOO2VOS(prmdo, portalVI.viType));
@@ -985,6 +986,15 @@
        prmItemDO.setItemHttpPathField(prmItemDTO.getItemHttpPathField());
        if(viType==PortalVIType.Table.getIntVal()) {//如果是表格
            initTableConfigDTOO2DOData(prmItemDO,prmItemDTO);
        }else{
            List<String> itemValueList=new ArrayList<>();
            List<KeyValue> keyValueList=prmItemDTO.getItemKeyValueList();
            Optional.ofNullable(keyValueList).orElseGet(()->new ArrayList<>()).stream().forEach(keyValue -> {
              String value=  keyValue.getValue()+"{"+keyValue.getKey()+"}";
                itemValueList.add(value);
            });
            prmItemDO.setItemValueList(itemValueList);
        }
        return prmItemDO;
    }
@@ -1049,8 +1059,20 @@
        prmItemVO.setItemIsHttpSave(prmItemDO.getItemIsHttpSave());
        prmItemVO.setItemHttpVolumnPath(prmItemDO.getItemHttpVolumnPath());
        prmItemVO.setItemHttpPathField(prmItemDO.getItemHttpPathField());
        if(viType==PortalVIType.Table.getIntVal()) {//如果是表格
            initTableConfigDOO2VOData(prmItemVO,prmItemDO);
        }else{
          List<String> enumList=  prmItemDO.getItemValueList();
          List<KeyValue>itemKeyValueList=new ArrayList<>();
            Optional.ofNullable(enumList).orElseGet(()->new ArrayList<>()).stream().forEach(enumValue->{
             List<String> keyValueList=  VciBaseUtil.str2List(VciBaseUtil.removeComma(enumValue,"}"),"\\{");
                KeyValue keyValue=new KeyValue();
                keyValue.setKey(keyValueList.get(1));
                keyValue.setValue(keyValueList.get(0));
                itemKeyValueList.add(keyValue);
            });
            prmItemVO.setItemKeyValueList(itemKeyValueList);
        }
        return prmItemVO;
    }
@@ -1117,6 +1139,17 @@
        prmItemDTO.setItemHttpPathField(prmItemDO.getItemHttpPathField());
        if(viType==PortalVIType.Table.getIntVal()) {//如果是表格
            initTableConfigDOO2VOData(prmItemDTO,prmItemDO);
        }else{
            List<String> enumList=  prmItemDO.getItemValueList();
            List<KeyValue>itemKeyValueList=new ArrayList<>();
            Optional.ofNullable(enumList).orElseGet(()->new ArrayList<>()).stream().forEach(enumValue->{
                List<String> keyValueList=  VciBaseUtil.str2List(VciBaseUtil.removeComma(enumValue,"}"),"\\{");
                KeyValue keyValue=new KeyValue();
                keyValue.setKey(keyValueList.get(1));
                keyValue.setValue(keyValueList.get(0));
                itemKeyValueList.add(keyValue);
            });
            prmItemDTO.setItemKeyValueList(itemKeyValueList);
        }
        return prmItemDTO;
    }
@@ -1131,10 +1164,12 @@
        List<String> allKeyList= getRefFormVIName(prmItemDO.getItemInObj());
        List<String> itemOutFieldList =VciBaseUtil.str2List(prmItemDO.getItemOutFields());
        List<String> itemKeyFieldList =VciBaseUtil.str2List(prmItemDO.getItemKeyFields());
        List<String> itemSelectoutFieldList= allKeyList.stream().filter(s ->!itemOutFieldList.stream().map(s1 -> s1).collect(Collectors.toList()).contains(s) ).collect(Collectors.toList());
        prmItemVO.setItemSelectoutFieldList(itemSelectoutFieldList);//待选择的属性字段
        List<String> itemSelectOutFieldList= allKeyList.stream()
                .filter(s -> !itemOutFieldList.contains(s))
                .collect(Collectors.toList());
        prmItemVO.setItemSelectOutFieldList(itemSelectOutFieldList);//待选择的属性字段
        prmItemVO.setItemOutFieldList(itemOutFieldList);//需要使用的集合
      //  List<String> itemSearchFieldList= itemOutFieldList.stream().filter(s ->!CollectionUtils.isEmpty(itemKeyFieldList).stream().map(s1 -> s1).collect(Collectors.toList()).contains(s) ).collect(Collectors.toList());
        // List<String> itemSearchFieldList= itemOutFieldList.stream().filter(s ->!CollectionUtils.isEmpty(itemKeyFieldList).stream().map(s1 -> s1).collect(Collectors.toList()).contains(s) ).collect(Collectors.toList());
        List<String> itemSearchFieldList=new ArrayList<>();
        if(!CollectionUtils.isEmpty(itemKeyFieldList)){
            itemSearchFieldList= itemOutFieldList.stream().filter(s ->!itemKeyFieldList.contains(s)).collect(Collectors.toList());
@@ -1155,8 +1190,8 @@
        List<String> allKeyList= getRefFormVIName(prmItemDO.getItemInObj());
        List<String> itemOutFieldList =VciBaseUtil.str2List(prmItemDO.getItemOutFields());
        List<String> itemKeyFieldList =VciBaseUtil.str2List(prmItemDO.getItemKeyFields());
        List<String> itemSelectoutFieldList= allKeyList.stream().filter(s ->!itemOutFieldList.stream().map(s1 -> s1).collect(Collectors.toList()).contains(s) ).collect(Collectors.toList());
        prmItemDTO.setItemSelectoutFieldList(itemSelectoutFieldList);//待选择的属性字段
        List<String> itemSelectOutFieldList= allKeyList.stream().filter(s ->!itemOutFieldList.stream().map(s1 -> s1).collect(Collectors.toList()).contains(s) ).collect(Collectors.toList());
        prmItemDTO.setItemSelectoutFieldList(itemSelectOutFieldList);//待选择的属性字段
        prmItemDTO.setItemOutFieldList(itemOutFieldList);//需要使用的集合
        List<String> itemSearchFieldList=new ArrayList<>();
        if(!CollectionUtils.isEmpty(itemKeyFieldList)){
@@ -1255,10 +1290,10 @@
        }
        return itemSeniorQueryBOList;
    }
    private List<String> getRefFormVIName(String refFormOid){
        List<String> keyList=new ArrayList<>();
        try {
            PortalVI refFormVI = UITools.getService().getPortalVIById(refFormOid);
            PortalVIVO portalVIVO= portalVIDOO2VO(refFormVI);
            if(portalVIVO!=null&&portalVIVO.getPrm().getPrmItemList().size()>0){