From a11ab9ba8af25a2936ba63f77de86b868296d6b8 Mon Sep 17 00:00:00 2001 From: "fly.li" Date: Mon, 11 Apr 2022 10:35:10 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-67790;=E4=BF=AE=E6=94=B9=E5=BC=80?= =?UTF-8?q?=E5=90=AF=E6=96=B0=E5=BC=95=E6=93=8E=E7=9A=84=E9=80=BB=E8=BE=91?= =?UTF-8?q?=EF=BC=88=E5=8E=9F=E6=9D=A5=E7=9A=84=E4=BB=A5=E7=AC=AC=E4=B8=80?= =?UTF-8?q?=E4=B8=AAsheet=E8=AE=BE=E7=BD=AE=E4=B8=BA=E5=87=86=EF=BC=8C?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E5=8F=AA=E8=A6=81=E6=9C=89=E4=B8=80=E4=B8=AA?= =?UTF-8?q?sheet=E8=AE=BE=E7=BD=AE=E4=BA=86=E6=96=B0=E5=BC=95=E6=93=8E?= =?UTF-8?q?=EF=BC=8C=E5=B0=B1=E8=B5=B0=E6=96=B0=E5=BC=95=E6=93=8E=E9=80=BB?= =?UTF-8?q?=E8=BE=91=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../utils/CptAndCptxCompatibilityUtil.java | 29 ++++++------------- 1 file changed, 9 insertions(+), 20 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 0b1a65657a..df0303a65d 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 @@ -3,7 +3,9 @@ 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.main.FineBook; import com.fr.main.TemplateWorkBook; +import com.fr.report.core.ReportUtils; import com.fr.report.report.Report; import com.fr.report.stable.LayerReportAttr; import com.fr.report.worksheet.WorkSheet; @@ -30,7 +32,7 @@ public class CptAndCptxCompatibilityUtil { } /** - * 判断是不是cptx模板或者开启了的新引擎的cpt模板的另存为操作 + * 判断是不是cptx模板或者开启了新引擎的cpt模板的另存为操作 **/ private static boolean isSaveAs(JTemplate jTemplate, String oldName, String newName){ return isEngineXEnable(jTemplate.getTarget(), newName) && ((FileExtension.CPTX.matchExtension(oldName) && FileExtension.CPTX.matchExtension(newName)) || (FileExtension.CPT.matchExtension(oldName) && FileExtension.CPT.matchExtension(newName))); @@ -40,7 +42,7 @@ public class CptAndCptxCompatibilityUtil { * cptx另存为cpt需要修改报表引擎属性 **/ private static boolean setFrEngineAttr(JTemplate jTemplate){ - WorkSheet workSheet = gainWorkSheet(jTemplate.getTarget()); + WorkSheet workSheet = getFirstWorkSheet(jTemplate.getTarget()); if (workSheet == null){ return false; }else { @@ -49,8 +51,7 @@ public class CptAndCptxCompatibilityUtil { layerReportAttr = new LayerReportAttr(); workSheet.setLayerReportAttr(layerReportAttr); } - layerReportAttr.setClientPaging(true); - layerReportAttr.setEngineState(0); + layerReportAttr.enableEngineX(); return true; } } @@ -60,29 +61,17 @@ public class CptAndCptxCompatibilityUtil { * cptx自动走新引擎(非兼容模式),cpt需要进行设置 * */ public static boolean isEngineXEnable(Object workBook, String fileName){ - WorkSheet workSheet = gainWorkSheet(workBook); - LayerReportAttr layerReportAttr = gainLayerReportAttr(workSheet); - return isEngineXEnable(layerReportAttr, fileName); - } - - private static LayerReportAttr gainLayerReportAttr(WorkSheet workSheet){ - if (workSheet != null){ - LayerReportAttr layerReportAttr = workSheet.getLayerReportAttr(); - return layerReportAttr; - } else { - return null; + if (workBook == null || !(workBook instanceof FineBook)){ + return false; } + return ReportUtils.hasEngineXReport4Template((FineBook) workBook) || FileExtension.CPTX.matchExtension(fileName); } - private static WorkSheet gainWorkSheet(Object workBook){ + private static WorkSheet getFirstWorkSheet(Object workBook){ if (workBook == null || !(workBook instanceof TemplateWorkBook)){ return null; } Report report = ((TemplateWorkBook) workBook).getReport(0); return report instanceof WorkSheet ? (WorkSheet)report : null; } - - private static boolean isEngineXEnable(LayerReportAttr layerReportAttr, String fileName){ - return (layerReportAttr!= null && layerReportAttr.isClientPaging() && layerReportAttr.getEngineState() == LayerReportAttr.ENGINE_X) || FileExtension.CPTX.matchExtension(fileName); - } }