| | |
| | | OsBtmTypeAttributeVO idAttrVO = new OsBtmTypeAttributeVO(); |
| | | idAttrVO.setId("id"); |
| | | idAttrVO.setName("编号"); |
| | | idAttrVO.setAttrDataType(VciFieldTypeEnum.VTString.name()); |
| | | idAttrVO.setAttributeDataType(VciFieldTypeEnum.VTString.name()); |
| | | idAttrVO.setAttributeLength(50); |
| | | idAttrVO.setNullableFlag(true); |
| | | attributes.add(idAttrVO); |
| | |
| | | OsBtmTypeAttributeVO nameAttrVO = new OsBtmTypeAttributeVO(); |
| | | nameAttrVO.setId("name"); |
| | | nameAttrVO.setName("名称"); |
| | | nameAttrVO.setAttrDataType(VciFieldTypeEnum.VTString.name()); |
| | | nameAttrVO.setAttributeDataType(VciFieldTypeEnum.VTString.name()); |
| | | nameAttrVO.setAttributeLength(50); |
| | | nameAttrVO.setNullableFlag(true); |
| | | attributes.add(nameAttrVO); |
| | |
| | | OsBtmTypeAttributeVO descAttrVO = new OsBtmTypeAttributeVO(); |
| | | descAttrVO.setId("description"); |
| | | descAttrVO.setName("描述"); |
| | | descAttrVO.setAttrDataType(VciFieldTypeEnum.VTString.name()); |
| | | descAttrVO.setAttributeDataType(VciFieldTypeEnum.VTString.name()); |
| | | descAttrVO.setAttributeLength(150); |
| | | descAttrVO.setNullableFlag(true); |
| | | attributes.add(descAttrVO); |
| | |
| | | |
| | | attributes.stream().forEach( t -> { |
| | | int index = indexMap.get("index"); |
| | | Map<String,Object> columnData = attributeToWordMap(t,index); |
| | | Map<String,Object> columnData = null; |
| | | try { |
| | | columnData = attributeToWordMap(t,index); |
| | | } catch (PLException e) { |
| | | e.printStackTrace(); |
| | | String exceptionMessage = "将属性对象拷贝到word数据对象中时出现错误,原因:"+VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(exceptionMessage); |
| | | } |
| | | indexMap.put("index",index+1); |
| | | columnDataList.add(columnData); |
| | | }); |
| | |
| | | indexMap.put("index",1); |
| | | attributes.stream().forEach( t -> { |
| | | int index = indexMap.get("index"); |
| | | Map<String,Object> columnData = attributeToWordMap(t,index); |
| | | Map<String,Object> columnData = null; |
| | | try { |
| | | columnData = attributeToWordMap(t,index); |
| | | } catch (PLException e) { |
| | | e.printStackTrace(); |
| | | String exceptionMessage = "将属性对象拷贝到word数据对象中时出现错误,原因:"+VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(exceptionMessage); |
| | | } |
| | | indexMap.put("index",index+1); |
| | | columnDataList.add(columnData); |
| | | }); |
| | |
| | | if(!CollectionUtils.isEmpty(btmTypeVOList)) { |
| | | btmTypeVOList.stream().forEach(btmTypeVO -> { |
| | | String btmId = btmTypeVO.getId(); |
| | | List<OsBtmTypeAttributeVO> attributeVOS = btmService.listAttributeByBtmId(btmId); |
| | | List<OsBtmTypeAttributeVO> attributeVOS = null; |
| | | try { |
| | | attributeVOS = btmService.listAttributeByBtmId(btmId); |
| | | } catch (PLException e) { |
| | | e.printStackTrace(); |
| | | throw new VciBaseException(VciBaseUtil.getExceptionMessage(e)); |
| | | } |
| | | //先是名称 |
| | | int rowIndex = index[0]; |
| | | WriteExcelData idED = new WriteExcelData(rowIndex, 0, btmId); |
| | |
| | | //然后属性的中文名称 |
| | | rowDataList.add(new WriteExcelData(rowIndex, 3, attributeVO.getName())); |
| | | //属性的类型 |
| | | rowDataList.add(new WriteExcelData(rowIndex, 4, VciFieldTypeEnum.getTextByValue(attributeVO.getAttrDataType()))); |
| | | rowDataList.add(new WriteExcelData(rowIndex, 4, VciFieldTypeEnum.getTextByValue(attributeVO.getAttributeDataType()))); |
| | | //是否可以为空 |
| | | rowDataList.add(new WriteExcelData(rowIndex, 5, attributeVO.isNullableFlag() ? "是" : "否")); |
| | | //属性长度 |
| | |
| | | if(!CollectionUtils.isEmpty(linkTypeVOList)){ |
| | | linkTypeVOList.stream().forEach(linkTypeVO->{ |
| | | String linkTypeId = linkTypeVO.getId(); |
| | | List<OsLinkTypeAttributeVO> attributeVOS = linkTypeService.listAttributeByLinkId(linkTypeId); |
| | | List<OsLinkTypeAttributeVO> attributeVOS = null; |
| | | try { |
| | | attributeVOS = linkTypeService.listAttributeByLinkId(linkTypeId); |
| | | } catch (PLException e) { |
| | | e.printStackTrace(); |
| | | String errorLog = "查询链接类型时出现错误,原因:"+VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(errorLog); |
| | | throw new VciBaseException(errorLog); |
| | | } |
| | | //先是名称 |
| | | int rowIndex = index[0]; |
| | | WriteExcelData idED = new WriteExcelData(rowIndex, 0, linkTypeId); |
| | |
| | | * @param index 索引 |
| | | * @return 数据映射,key 是word里的域字段,value是对应的值 |
| | | */ |
| | | private Map<String,Object> attributeToWordMap(OsBtmTypeAttributeVO btmTypeAttributeVO,int index){ |
| | | private Map<String,Object> attributeToWordMap(OsBtmTypeAttributeVO btmTypeAttributeVO,int index) throws PLException { |
| | | Map<String,Object> columnData = new HashMap<>(); |
| | | if(StringUtils.isNotBlank(wordFieldProperties.getColumnIndex())) { |
| | | columnData.put(wordFieldProperties.getColumnIndex(), index); |
| | | } |
| | | columnData.put(wordFieldProperties.getColumnId(),btmTypeAttributeVO.getId().toLowerCase()); |
| | | columnData.put(wordFieldProperties.getColumnName(),btmTypeAttributeVO.getName()); |
| | | String attrDataType = btmTypeAttributeVO.getAttrDataType(); |
| | | String attrDataType = btmTypeAttributeVO.getAttributeDataType(); |
| | | String columnType = VciFieldTypeEnum.getTextByValue(attrDataType); |
| | | if(StringUtils.isBlank(columnType)){ |
| | | columnType = "字符串"; |
| | |
| | | } else { |
| | | btmItem.verRuleName = 0; |
| | | } |
| | | //包含的属性的数组 |
| | | List<OsBtmTypeLinkAttributesDTO> attributesDTOList = btmTypeDTO.getAttributes(); |
| | | List<String> attrIdList = new ArrayList<String>(); |
| | | if (!CollectionUtils.isEmpty(attributesDTOList)) { |
| | | for (OsBtmTypeLinkAttributesDTO attr : attributesDTOList) { |
| | | attrIdList.add(attr.getId().toLowerCase()); |
| | | } |
| | | } |
| | | btmItem.apNameArray = attrIdList.toArray(new String[0]); |
| | | //包含的属性名称 |
| | | btmItem.apNameArray = btmTypeDTO.getApNameArray().split(","); |
| | | } |
| | | |
| | | /** |