| | |
| | | import com.vci.corba.omd.ltm.LinkType; |
| | | import com.vci.corba.omd.qtm.QTD; |
| | | import com.vci.corba.omd.qtm.QTInfo; |
| | | import com.vci.dto.AttributeDefDTO; |
| | | import com.vci.dto.QTDDTO; |
| | | import com.vci.dto.QTInfoDTO; |
| | | import com.vci.omd.constants.SystemAttribute; |
| | | import com.vci.omd.objects.OtherInfo; |
| | | import com.vci.po.OsLinkTypePO; |
| | | import com.vci.starter.poi.bo.ReadExcelOption; |
| | |
| | | } |
| | | /** |
| | | * 查询方案删除 |
| | | * @param templateNames 查询方案名 |
| | | * @param names 查询方案名 |
| | | * @return 操作结果 |
| | | */ |
| | | @Override |
| | | public BaseResult deleteLinkTemplate(List<String> templateNames) throws PLException { |
| | | boolean b = platformClientUtil.getQTDService().deleteQTs(templateNames.toArray(new String[0])); |
| | | public BaseResult deleteLinkTemplate(String names) throws PLException { |
| | | if(StringUtils.isBlank(names)){ |
| | | return BaseResult.fail("请选择查询方案!"); |
| | | } |
| | | String[] nameSplit = names.split(","); |
| | | boolean b = platformClientUtil.getQTDService().deleteQTs(nameSplit); |
| | | if(!b){ |
| | | return BaseResult.fail("删除失败!!!"); |
| | | } |
| | |
| | | return BaseResult.success(tree); |
| | | } |
| | | |
| | | @Override |
| | | public BaseResult queryTemplateListByAttr(String btmName, Boolean linkFlag, String direction) throws PLException { |
| | | //返回的界面下拉框显示树 |
| | | List<QTDDTO> qtddtos = new ArrayList<>(); |
| | | |
| | | Map<String, AttributeDef> allSysAttr = Arrays.stream(platformClientUtil.getBtmService().getSysAttributeDefs()).collect(Collectors.toMap(e -> e.name, e -> e)); |
| | | |
| | | // if(linkFlag){ |
| | | // QTD[] qtdArray = platformClientUtil.getQTDService().getLinkTypeQTDs(btmName); |
| | | // for (QTD qtd : qtdArray) { |
| | | // QTDDTO qtddto = new QTDDTO(); |
| | | // qtddto.setName(qtd.name); |
| | | // qtddto.setCreateTime(qtd.createTime); |
| | | // qtddto.setLinkTypeName(qtd.linkTypeName); |
| | | // qtddto.setBtmName(qtd.btmName); |
| | | // qtddto.setCreator(qtd.creator); |
| | | // for (String abName : qtd.abNames) { |
| | | // AttributeDef att = platformClientUtil.getAttributeService().getAttributeDefByName(abName); |
| | | // AttributeDefDTO attrDto = new AttributeDefDTO(); |
| | | // attrDto.setDescription(att.description); |
| | | // attrDto.setLabel(att.label); |
| | | // attrDto.setOid(att.oid); |
| | | // attrDto.setCreator(att.creator); |
| | | // attrDto.setName(att.name); |
| | | // attrDto.setDefValue(att.defValue); |
| | | // attrDto.setRage(att.rage); |
| | | // attrDto.setVtDataType(att.vtDataType); |
| | | // attrDto.setOther(att.other); |
| | | // qtddto.getAttrs().add(attrDto); |
| | | // } |
| | | // qtddtos.add(qtddto); |
| | | // } |
| | | // |
| | | // }else { |
| | | // Map<String, AttributeDef> lSysAttr = Arrays.stream(platformClientUtil.getLinkTypeService().getSysAttributeDefs()).collect(Collectors.toMap(e -> e.name, e -> e)); |
| | | allSysAttr.putAll(Arrays.stream(platformClientUtil.getLinkTypeService().getSysAttributeDefs()).collect(Collectors.toMap(e -> e.name, e -> e))); |
| | | QTD[] qtdArray = null; |
| | | if(linkFlag){ |
| | | qtdArray = platformClientUtil.getQTDService().getLinkTypeQTDs(btmName); |
| | | }else { |
| | | qtdArray = platformClientUtil.getQTDService().getBizTypeQTDs(btmName); |
| | | } |
| | | |
| | | // QTD[] |
| | | for (QTD qtd : qtdArray) { |
| | | QTDDTO qtddto = new QTDDTO(); |
| | | qtddto.setName(qtd.name); |
| | | qtddto.setCreateTime(qtd.createTime); |
| | | qtddto.setLinkTypeName(qtd.linkTypeName); |
| | | qtddto.setBtmName(qtd.btmName); |
| | | qtddto.setCreator(qtd.creator); |
| | | for (String abName : qtd.abNames) { |
| | | AttributeDef att = platformClientUtil.getAttributeService().getAttributeDefByName(abName); |
| | | if(att == null || "".equals(att.oid)){ |
| | | att = allSysAttr.get(abName.toLowerCase()); |
| | | } |
| | | if(direction != null) { |
| | | if (direction.equals(QTConstants.DIRECTION_POSITIVE)) { |
| | | att.name = "T_OID." + abName; |
| | | } else if (direction.equals(QTConstants.DIRECTION_OPPOSITE)) { |
| | | att.name = "F_OID." + abName; |
| | | } |
| | | }else{ |
| | | att.name = abName; |
| | | } |
| | | AttributeDefDTO attrDto = new AttributeDefDTO(); |
| | | attrDto.setDescription(att.description); |
| | | attrDto.setLabel(att.label); |
| | | attrDto.setOid(att.oid); |
| | | attrDto.setCreator(att.creator); |
| | | attrDto.setName(att.name); |
| | | attrDto.setDefValue(att.defValue); |
| | | attrDto.setLayersNum(1); |
| | | attrDto.setRage(att.rage); |
| | | attrDto.setVtDataType(att.vtDataType); |
| | | attrDto.setOther(att.other); |
| | | qtddto.getAttrs().add(attrDto); |
| | | addNode(attrDto, allSysAttr); |
| | | } |
| | | qtddtos.add(qtddto); |
| | | } |
| | | // } |
| | | return BaseResult.dataList(Arrays.asList(qtddtos)); |
| | | } |
| | | private void addNode(AttributeDefDTO attributeDefByName, Map<String, AttributeDef> allSysAttr){ |
| | | |
| | | if(attributeDefByName.getLayersNum() >= 3){ |
| | | return; |
| | | } |
| | | String abName = attributeDefByName.name; |
| | | //取node上的最后一个属性名 |
| | | if(abName.contains(".")){ |
| | | abName = abName.substring(abName.lastIndexOf(".") + 1); |
| | | } |
| | | // qtddto.getAttrs().add(attributeDefByName); |
| | | if(SystemAttribute.sysAttList().contains(abName.toUpperCase())){ |
| | | return; |
| | | } |
| | | AttributeDef abItem = null; |
| | | try { |
| | | abItem = platformClientUtil.getAttributeService().getAttributeDefByName(abName); |
| | | String other = abItem.other; |
| | | // String btmName = ApProvider.getInstance().getOtherValueByType(other, BTM); |
| | | OtherInfo otherInfo = OtherInfo.getOtherInfoByText(other); |
| | | int refFlag = otherInfo.getRefFlag(); |
| | | String refTypeName = otherInfo.getRefTypeName(); |
| | | if(refFlag != -1){ |
| | | //参照业务类型 |
| | | if(refFlag == 0){ |
| | | //pName: 为参照属性名加上路径 |
| | | String pName = attributeDefByName.name + "."; |
| | | String[] abNames = platformClientUtil.getBtmService().getAttributeNames(refTypeName); |
| | | for(int i = 0; i < abNames.length; i++){ |
| | | String abName_ = abNames[i]; |
| | | AttributeDef att = platformClientUtil.getAttributeService().getAttributeDefByName(abName_); |
| | | if(att == null || "".equals(att.oid)){ |
| | | att = allSysAttr.get(abName_.toLowerCase()); |
| | | } |
| | | att.name = pName + abName_ ; |
| | | AttributeDefDTO attrDto = new AttributeDefDTO(); |
| | | attrDto.setDescription(att.description); |
| | | attrDto.setLabel(att.label); |
| | | attrDto.setOid(att.oid); |
| | | attrDto.setLayersNum(attributeDefByName.getLayersNum() + 1); |
| | | attrDto.setCreator(att.creator); |
| | | attrDto.setName(att.name); |
| | | attrDto.setDefValue(att.defValue); |
| | | attrDto.setRage(att.rage); |
| | | attrDto.setVtDataType(att.vtDataType); |
| | | attrDto.setOther(att.other); |
| | | attributeDefByName.getAttrs().add(attrDto); |
| | | addNode(attrDto, allSysAttr); |
| | | } |
| | | //系统属性ID,NAME,DESCRIPTION |
| | | // AttributeDef[] sysAttributeDefs = platformClientUtil.getBtmService().getSysAttributeDefs(); |
| | | // for (int i = 0; i < sysAttributeDefs.length; i++) { |
| | | for (int i = 0; i < SystemAttribute.bosysAttList().size(); i++) { |
| | | // addNode(node, new DefaultMutableTreeNode(pName + SystemAttribute.bosysAttList().get(i))); |
| | | AttributeDef attributeDef = allSysAttr.get(SystemAttribute.bosysAttList().get(i).toLowerCase()); |
| | | AttributeDefDTO attrDto = new AttributeDefDTO(); |
| | | attrDto.setDescription(attributeDef.description); |
| | | attrDto.setLabel(attributeDef.label); |
| | | attrDto.setOid(attributeDef.oid); |
| | | attrDto.setLayersNum(attributeDefByName.getLayersNum() + 1); |
| | | attrDto.setCreator(attributeDef.creator); |
| | | attrDto.setName(pName + SystemAttribute.bosysAttList().get(i)); |
| | | attrDto.setDefValue(attributeDef.defValue); |
| | | attrDto.setRage(attributeDef.rage); |
| | | attrDto.setVtDataType(attributeDef.vtDataType); |
| | | attrDto.setOther(attributeDef.other); |
| | | attributeDefByName.getAttrs().add(attrDto); |
| | | addNode(attrDto, allSysAttr); |
| | | } |
| | | //参照链接类型 |
| | | }else if(refFlag == 1){ |
| | | //pName: 为参照属性名加上路径 |
| | | String pName = attributeDefByName.name + "."; |
| | | LinkType link = null; |
| | | try { |
| | | link = platformClientUtil.getLinkTypeService().getLinkType(refTypeName); |
| | | } catch (Exception e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } catch (Throwable e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | if(link != null){ |
| | | String[] abNames = link.attributes; |
| | | for(int i = 0; i < abNames.length; i++){ |
| | | String abName_ = abNames[i]; |
| | | // DefaultMutableTreeNode node_ = new DefaultMutableTreeNode(pName + abName_); |
| | | AttributeDef att = platformClientUtil.getAttributeService().getAttributeDefByName(abName_); |
| | | if(att == null || att.oid.equals("")){ |
| | | att = allSysAttr.get(abName_.toLowerCase()); |
| | | } |
| | | AttributeDefDTO attrDto = new AttributeDefDTO(); |
| | | attrDto.setDescription(att.description); |
| | | attrDto.setLabel(att.label); |
| | | attrDto.setOid(att.oid); |
| | | attrDto.setLayersNum(attributeDefByName.getLayersNum() + 1); |
| | | attrDto.setCreator(att.creator); |
| | | attrDto.setName(pName + abName_); |
| | | attrDto.setDefValue(att.defValue); |
| | | attrDto.setRage(att.rage); |
| | | attrDto.setVtDataType(att.vtDataType); |
| | | attrDto.setOther(att.other); |
| | | attributeDefByName.getAttrs().add(attrDto); |
| | | addNode(attrDto, allSysAttr); |
| | | } |
| | | //系统属性ID,NAME,DESCRIPTION |
| | | for (int i = 0; i < SystemAttribute.losysAttList().size(); i++) { |
| | | // addNode(node, new DefaultMutableTreeNode(pName + SystemAttribute.losysAttList().get(i))); |
| | | // } |
| | | // AttributeDef[] sysAttributeDefs = platformClientUtil.getLinkTypeService().getSysAttributeDefs(); |
| | | // for (int i = 0; i < sysAttributeDefs.length; i++) { |
| | | // addNode(node, new DefaultMutableTreeNode(pName + SystemAttribute.bosysAttList().get(i))); |
| | | AttributeDef sysAttributeDefs = allSysAttr.get(SystemAttribute.losysAttList().get(i).toLowerCase()); |
| | | AttributeDefDTO attrDto = new AttributeDefDTO(); |
| | | attrDto.setDescription(sysAttributeDefs.description); |
| | | attrDto.setLabel(sysAttributeDefs.label); |
| | | attrDto.setOid(sysAttributeDefs.oid); |
| | | attrDto.setLayersNum(attributeDefByName.getLayersNum() + 1); |
| | | attrDto.setCreator(sysAttributeDefs.creator); |
| | | attrDto.setName(pName + SystemAttribute.losysAttList().get(i)); |
| | | attrDto.setDefValue(sysAttributeDefs.defValue); |
| | | attrDto.setRage(sysAttributeDefs.rage); |
| | | attrDto.setVtDataType(sysAttributeDefs.vtDataType); |
| | | attrDto.setOther(sysAttributeDefs.other); |
| | | attributeDefByName.getAttrs().add(attrDto); |
| | | addNode(attrDto, allSysAttr); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } catch (PLException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | // 数据过滤 |
| | | private void addImportBtmData(BtmQTExportData qtExportData, List<BizType> ltsNew, List<QTInfo> qTWrapperNew, |
| | | Map<String/* 类型名称 */, QTD[]/* 查询模板定义 */> norepQTDs) { |