Browse Source

REPORT-55243:可能存在的强转错误及方法名修改

research/11.0
fly.li 3 years ago
parent
commit
e9eadf1423
  1. 4
      designer-base/src/main/java/com/fr/nx/app/designer/utils/CptAndCptxCompatibilityUtil.java
  2. 11
      designer-base/src/main/java/com/fr/nx/app/designer/utils/CptCompileUtil.java

4
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;

11
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);
}
}

Loading…
Cancel
Save