| | |
| | | import com.vci.client.mw.ClientSessionUtility; |
| | | import com.vci.corba.common.PLException; |
| | | import com.vci.corba.omd.atm.AttributeDef; |
| | | import com.vci.corba.omd.vrm.VersionRule; |
| | | import com.vci.dto.OsAttributeDTO; |
| | | import com.vci.dto.OsEnumDTO; |
| | | import com.vci.dto.OsEnumItemDTO; |
| | |
| | | * 导出选中的属性 |
| | | * @param exportFileName 导出的文件名 |
| | | * @param attrNames 需要导出的属性名称 |
| | | * @param flag 控制导出的列名是否和导入模板一致 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public String exportAttributes(String exportFileName, String attrNames) throws PLException { |
| | | public String exportAttributes(String exportFileName, String attrNames,boolean flag/*控制导出的列名是否和导入模板一致*/) throws PLException { |
| | | if(Func.isBlank(attrNames)){ |
| | | throw new PLException("500",new String[]{"请勾选要导出的属性!"}); |
| | | } |
| | | //界面没传名称,使用默认导出名称 |
| | | exportFileName = Func.isBlank(exportFileName) ? "属性池中属性导出_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss"):exportFileName; |
| | | //设置列名 |
| | | List<String> columns = new ArrayList<>( |
| | | Arrays.asList("属性名", "标签", "描述", |
| | | "属性类型", "允许为空", "默认值", "使用的枚举英文名称(枚举名)", |
| | | "使用的枚举中文名称(标签)", "参照的业务类型编号", "参照的业务类型名称", |
| | | "参照的链接类型名称","版本版次","属性长度", "小数精度位数","小数刻度位数","取值范围","创建时间") |
| | | ); |
| | | List<String> columns = this.getCloumns(flag); |
| | | |
| | | //写excel |
| | | String excelPath = LocalFileUtil.getDefaultTempFolder() + File.separator + exportFileName + ".xls"; |
| | |
| | | excelDataList.add(new WriteExcelData(i+1,4, osAttributeVO.isNullableFlag())); |
| | | excelDataList.add(new WriteExcelData(i+1,5, osAttributeVO.getDefaultValue())); |
| | | excelDataList.add(new WriteExcelData(i+1,6, osAttributeVO.getEnumId())); |
| | | excelDataList.add(new WriteExcelData(i+1,7, osAttributeVO.getEnumName())); |
| | | excelDataList.add(new WriteExcelData(i+1,8, osAttributeVO.getBtmTypeId())); |
| | | excelDataList.add(new WriteExcelData(i+1,9, osAttributeVO.getBtmTypeName())); |
| | | excelDataList.add(new WriteExcelData(i+1,10, osAttributeVO.getAttrLength())); |
| | | excelDataList.add(new WriteExcelData(i+1,11, osAttributeVO.getLinkTypeName())); |
| | | excelDataList.add(new WriteExcelData(i+1,12, osAttributeVO.getVersion())); |
| | | excelDataList.add(new WriteExcelData(i+1,13, osAttributeVO.getPrecisionLength())); |
| | | excelDataList.add(new WriteExcelData(i+1,14, osAttributeVO.getScaleLength())); |
| | | excelDataList.add(new WriteExcelData(i+1,15, osAttributeVO.getRange())); |
| | | excelDataList.add(new WriteExcelData(i+1,16, osAttributeVO.getCreateTime())); |
| | | //excelDataList.add(new WriteExcelData(i+1,7, osAttributeVO.getEnumName())); |
| | | excelDataList.add(new WriteExcelData(i+1,7, osAttributeVO.getBtmTypeId())); |
| | | //excelDataList.add(new WriteExcelData(i+1,9, osAttributeVO.getBtmTypeName())); |
| | | excelDataList.add(new WriteExcelData(i+1,8, osAttributeVO.getAttrLength())); |
| | | excelDataList.add(new WriteExcelData(i+1,9, osAttributeVO.getLinkTypeName())); |
| | | excelDataList.add(new WriteExcelData(i+1,10, osAttributeVO.getVersion())); |
| | | excelDataList.add(new WriteExcelData(i+1,11, osAttributeVO.getPrecisionLength())); |
| | | excelDataList.add(new WriteExcelData(i+1,12, osAttributeVO.getScaleLength())); |
| | | excelDataList.add(new WriteExcelData(i+1,13, osAttributeVO.getRange())); |
| | | if(!flag){ |
| | | excelDataList.add(new WriteExcelData(i+1,14, Func.format(osAttributeVO.getCreateTime(),"yyyy年MM月dd日 hh:mm:ss"))); |
| | | } |
| | | } |
| | | } |
| | | WriteExcelOption excelOption = new WriteExcelOption(excelDataList); |
| | | ExcelUtil.writeDataToFile(excelPath, excelOption); |
| | | return excelPath; |
| | | } |
| | | |
| | | /** |
| | | * 获取导出或导入模板的列名 |
| | | * @param flag 是否获取导入模板列名 |
| | | * @return |
| | | */ |
| | | private List<String> getCloumns(boolean flag){ |
| | | if(flag){ |
| | | return new ArrayList<>( |
| | | Arrays.asList("属性名", "标签", "描述", |
| | | "属性类型(参照新增界面的属性类型如VTString)", "允许为空(是/否)", "默认值", "使用的枚举英文名称" |
| | | , "参照的业务类型编号","参照的链接类型编号","版本版次","属性长度", "小数精度位数","小数刻度位数" |
| | | ,"取值范围" |
| | | ) |
| | | ); |
| | | } |
| | | return new ArrayList<>( |
| | | Arrays.asList("属性名", "标签", "描述", |
| | | "属性类型", "允许为空", "默认值", "使用的枚举英文名称(枚举名)", |
| | | "参照的业务类型编号", "参照的链接类型编号","版本版次","属性长度", |
| | | "小数精度位数","小数刻度位数","取值范围","创建时间") |
| | | ); |
| | | } |
| | | |
| | | /** |
| | |
| | | //界面没传名称,使用默认导出名称 |
| | | exportFileName = Func.isBlank(exportFileName) ? "属性池导入模板_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss"):exportFileName; |
| | | //设置列名 |
| | | List<String> columns = new ArrayList<>( |
| | | Arrays.asList("属性名", "标签", "描述", |
| | | "属性类型(请参照新增界面的属性类型填写)", "允许为空(是/否)", "默认值", "使用的枚举英文名称", "参照的业务类型编号", |
| | | "参照的链接类型编号","版本版次","属性长度", "小数精度位数","小数刻度位数","取值范围") |
| | | ); |
| | | List<String> columns = this.getCloumns(true); |
| | | //设置必填列 |
| | | ColumnNameisRed.clear(); |
| | | ColumnNameisRed.add(0); |