From e9eadf142317089a140821851b3d2e37c9d29b9a Mon Sep 17 00:00:00 2001 From: "fly.li" Date: Tue, 14 Sep 2021 10:53:42 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-55243:=E5=8F=AF=E8=83=BD=E5=AD=98?= =?UTF-8?q?=E5=9C=A8=E7=9A=84=E5=BC=BA=E8=BD=AC=E9=94=99=E8=AF=AF=E5=8F=8A?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E5=90=8D=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/utils/CptAndCptxCompatibilityUtil.java | 4 ++-- .../com/fr/nx/app/designer/utils/CptCompileUtil.java | 11 +++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/nx/app/designer/utils/CptAndCptxCompatibilityUtil.java b/designer-base/src/main/java/com/fr/nx/app/designer/utils/CptAndCptxCompatibilityUtil.java index 2e08a8ae9..0b1a65657 100644 --- a/designer-base/src/main/java/com/fr/nx/app/designer/utils/CptAndCptxCompatibilityUtil.java +++ b/designer-base/src/main/java/com/fr/nx/app/designer/utils/CptAndCptxCompatibilityUtil.java @@ -23,7 +23,7 @@ public class CptAndCptxCompatibilityUtil { String path = editingFILE.getPath(); //只有在旧文件是cptx文件并且新文件是cpt文件时才会改变报表引擎属性 boolean isCptxConvertToCpt = FileExtension.CPTX.matchExtension(oldName) && FileExtension.CPT.matchExtension(path); - if (isCptxConvertToCpt && !changeFrEngineAttr(jTemplate)){ + if (isCptxConvertToCpt && !setFrEngineAttr(jTemplate)){ isCptxConvertToCpt = false; } return (isCptxConvertToCpt || isSaveAs(jTemplate, oldName, path)); @@ -39,7 +39,7 @@ public class CptAndCptxCompatibilityUtil { /** * cptx另存为cpt需要修改报表引擎属性 **/ - private static boolean changeFrEngineAttr(JTemplate jTemplate){ + private static boolean setFrEngineAttr(JTemplate jTemplate){ WorkSheet workSheet = gainWorkSheet(jTemplate.getTarget()); if (workSheet == null){ return false; diff --git a/designer-base/src/main/java/com/fr/nx/app/designer/utils/CptCompileUtil.java b/designer-base/src/main/java/com/fr/nx/app/designer/utils/CptCompileUtil.java index cb414589c..36c184670 100644 --- a/designer-base/src/main/java/com/fr/nx/app/designer/utils/CptCompileUtil.java +++ b/designer-base/src/main/java/com/fr/nx/app/designer/utils/CptCompileUtil.java @@ -1,5 +1,6 @@ package com.fr.nx.app.designer.utils; +import com.fr.base.extension.FileExtension; import com.fr.design.mainframe.JTemplate; import com.fr.file.FILE; import com.fr.file.FileNodeFILE; @@ -34,16 +35,18 @@ public class CptCompileUtil { } FILE file = jtemplate.getEditingFILE(); String path = file.getPath(); - WorkBook workbook = (WorkBook) jtemplate.getTarget(); + Object target = jtemplate.getTarget(); /* * 如果是cpt并且引擎设置正确,执行预编译,如果是cptx文件也执行预编译。在JStreamWork中,保存和另存为流程都进行了重新编译。 * 但是由于之前的DefaultTemplateResource.saveTemplate的原因导致JStreamWork::saveFile()不能执行--cptx的保存不能进行预编译, * 应该是流程的误改动,这里改回来,保存时仍然执行预编译。 * 预编译本不应该受引擎模式的影响,但是cpt文件在设置为新引擎后是需要进行编译的 * */ - if (!CptAndCptxCompatibilityUtil.isEngineXEnable(workbook, path)){ + + if (!CptAndCptxCompatibilityUtil.isEngineXEnable(target, path)){ return; } + WorkBook workbook = (WorkBook) jtemplate.getTarget(); TransformResultInfo resultInfo = compile0(workbook, file); unSupportLog(resultInfo); @@ -143,4 +146,8 @@ public class CptCompileUtil { FineLoggerFactory.getLogger().error(transformResultInfo.getTransformLog()); } } + + private static boolean isUnSupportFileType(String path){ + return FileExtension.CPT.matchExtension(path) || FileExtension.CPTX.matchExtension(path); + } }