Browse Source

REPORT-13573 远程设计预览大模板的数据集卡顿(将传输全部模板改成只传数据集)&& 只含数据集模板序列化测试

bugfix/10.0
abel 6 years ago
parent
commit
bf8d6fbe99
  1. 15
      designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java
  2. 166
      designer-base/src/test/java/com/fr/design/AbstractTableDatasourceTest.java

15
designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java

@ -3,6 +3,7 @@ package com.fr.design.data;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.StoreProcedureParameter; import com.fr.base.StoreProcedureParameter;
import com.fr.base.TableData; import com.fr.base.TableData;
import com.fr.data.AbstractTableDataSource;
import com.fr.data.TableDataSource; import com.fr.data.TableDataSource;
import com.fr.data.core.DataCoreXmlUtils; import com.fr.data.core.DataCoreXmlUtils;
import com.fr.data.impl.EmbeddedTableData; import com.fr.data.impl.EmbeddedTableData;
@ -444,7 +445,19 @@ public abstract class DesignTableDataManager {
parameter.setValue(parameterMap.get(parameter.getName())); parameter.setValue(parameterMap.get(parameter.getName()));
} }
} }
return DataOperator.getInstance().previewTableData(tableDataSource, tabledata, parameterMap, rowCount); //这边数据集预览不需要把整个模板都发送过去,只需要把模板中的数据集挑出来,传过去就行了。模板一大,预览数据集很变得很慢。
TableDataSource wrapper = null;
if (tableDataSource != null) {
wrapper = new AbstractTableDataSource(){};
for (Iterator<String> it = tableDataSource.getTableDataNameIterator(); it != null && it.hasNext(); ) {
String name = it.next();
TableData tableData = tableDataSource.getTableData(name);
if (tableData != null) {
wrapper.putTableData(name, tableData);
}
}
}
return DataOperator.getInstance().previewTableData(wrapper, tabledata, parameterMap, rowCount);
} catch (Exception e) { } catch (Exception e) {
throw new TableDataException(e.getMessage(), e); throw new TableDataException(e.getMessage(), e);
} finally { } finally {

166
designer-base/src/test/java/com/fr/design/AbstractTableDatasourceTest.java

@ -0,0 +1,166 @@
package com.fr.design;
import com.fr.base.AbstractTableData;
import com.fr.base.TableData;
import com.fr.cert.token.lang.Assert;
import com.fr.data.AbstractTableDataSource;
import com.fr.data.TableDataSource;
import com.fr.general.data.TableDataException;
import com.fr.script.Calculator;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader;
import com.fr.third.javax.xml.stream.XMLStreamException;
import junit.framework.TestCase;
import java.io.ByteArrayOutputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
public class AbstractTableDatasourceTest extends TestCase {
public void testAbstractTableDataSourceReadAndWrite() throws XMLStreamException, TableDataException, UnsupportedEncodingException {
String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<TableDataMap xmlVersion=\"20170720\" releaseVersion=\"10.0.0\">\n" +
"<TableData name=\"新老用户对比\" class=\"com.fr.data.impl.EmbeddedTableData\">\n" +
"<Parameters/>\n" +
"<DSName>\n" +
"<![CDATA[]]></DSName>\n" +
"<ColumnNames>\n" +
"<![CDATA[用户,,.,,数量]]></ColumnNames>\n" +
"<ColumnTypes>\n" +
"<![CDATA[java.lang.String,java.lang.String]]></ColumnTypes>\n" +
"<RowData ColumnTypes=\"java.lang.String,java.lang.String\">\n" +
"<![CDATA[HT#`YdrgS?F_p4t!s5W<e!EG4`l?\"F!!~\n" +
"]]></RowData>\n" +
"</TableData>\n" +
"<TableData name=\"保费地区排名\" class=\"com.fr.data.impl.EmbeddedTableData\">\n" +
"<Parameters/>\n" +
"<DSName>\n" +
"<![CDATA[]]></DSName>\n" +
"<ColumnNames>\n" +
"<![CDATA[地区,,.,,保费,,.,,flag]]></ColumnNames>\n" +
"<ColumnTypes>\n" +
"<![CDATA[java.lang.String,java.lang.String,java.lang.String]]></ColumnTypes>\n" +
"<RowData ColumnTypes=\"java.lang.String,java.lang.String,java.lang.String\">\n" +
"<![CDATA[Hb+:uP9\"^(N=64(3\"<EiD4LX#]A:[R!*5^Gk'.CY1BPIb24^H\\8FPgD\"6PG:2VThn`VfNap_K\n" +
"e;n3PjDL~\n" +
"]]></RowData>\n" +
"</TableData>\n" +
"<TableData name=\"年度累计总保费\" class=\"com.fr.data.impl.EmbeddedTableData\">\n" +
"<Parameters/>\n" +
"<DSName>\n" +
"<![CDATA[]]></DSName>\n" +
"<ColumnNames>\n" +
"<![CDATA[年份,,.,,其他业务,,.,,价值业务]]></ColumnNames>\n" +
"<ColumnTypes>\n" +
"<![CDATA[java.lang.String,java.lang.String,java.lang.String]]></ColumnTypes>\n" +
"<RowData ColumnTypes=\"java.lang.String,java.lang.String,java.lang.String\">\n" +
"<![CDATA[4j(#=!$DgS^`'*Or^HRR9OhLVadFnN_OJGB+o,e>7.nI9\\uimQ~\n" +
"]]></RowData>\n" +
"</TableData>\n" +
"<TableData name=\"销售数据地图\" class=\"com.fr.data.impl.EmbeddedTableData\">\n" +
"<Parameters/>\n" +
"<DSName>\n" +
"<![CDATA[]]></DSName>\n" +
"<ColumnNames>\n" +
"<![CDATA[地区,,.,,金额]]></ColumnNames>\n" +
"<ColumnTypes>\n" +
"<![CDATA[java.lang.String,java.lang.String]]></ColumnTypes>\n" +
"<RowData ColumnTypes=\"java.lang.String,java.lang.String\">\n" +
"<![CDATA[<KP$pK.mjkccsoa\"<Od.f'0,sg8S&+Q6*+K4>9UT+>AM9kpGY!\\4\\SXO$EO1[i^/XKmIMmdu\n" +
"!\"Q5sC\"9Ji(qlAa_kVTnCC/+p:XVF.KGR?GMsmI)2\">1s>(/T71G7cFsfA\"UpjYr4R)A14-*\n" +
"qc6ri_1*%/XSsf!PM]ARc+ojE:eo:_gma!ut7eZ6BoFc2b5hu4@TUtuOT);aq6l4Vj<jM_Ku*\n" +
"\\lKh?<s9,PbluqGk84HlDg]Aq,#MDJrl^\\mAq.\\L)&\"oJcSIq!T%do(%#I!VZc`L$ri-QMpFZ\n" +
"u68s(6@m8kLKWBrPWS&l`~\n" +
"]]></RowData>\n" +
"</TableData>\n" +
"<TableData name=\"表单联动 柱形图\" class=\"com.fr.data.impl.EmbeddedTableData\">\n" +
"<Parameters/>\n" +
"<DSName>\n" +
"<![CDATA[]]></DSName>\n" +
"<ColumnNames>\n" +
"<![CDATA[地区,,.,,金额]]></ColumnNames>\n" +
"<ColumnTypes>\n" +
"<![CDATA[java.lang.String,java.lang.String]]></ColumnTypes>\n" +
"<RowData ColumnTypes=\"java.lang.String,java.lang.String\">\n" +
"<![CDATA[Ha[qnMsgT-EuI&u9Y$a3Sb[*^Hk=?NPj@SFcDUR5JiJK3>YfS3J$NPo=IB3AP?eiop.bk9Qu\n" +
"P:F\\.L&t$31~\n" +
"]]></RowData>\n" +
"</TableData>\n" +
"<TableData name=\"地区保费构成\" class=\"com.fr.data.impl.EmbeddedTableData\">\n" +
"<Parameters/>\n" +
"<DSName>\n" +
"<![CDATA[]]></DSName>\n" +
"<ColumnNames>\n" +
"<![CDATA[地区名称,,.,,分类,,.,,金额,,.,,flag]]></ColumnNames>\n" +
"<ColumnTypes>\n" +
"<![CDATA[java.lang.String,java.lang.String,java.lang.String,java.lang.String]]></ColumnTypes>\n" +
"<RowData ColumnTypes=\"java.lang.String,java.lang.String,java.lang.String,java.lang.String\">\n" +
"<![CDATA[Fj\\SDJhRmhiTp.nl8F((mNOIp$6h1jU+Qg/&hD+kfnR40k\"^#YZeKnes-ug@.TN@I?6#Eaf^\n" +
"'rbg9T)sQp9#\"<-_H((dqbGQ:6.4dS/KkN4Vt(j[Z%?bW2`a3UI)'Zm1]ApNcYFcFola@ZoH^\n" +
"C19_8ph'[:I3q*?OWI@!E-]AgkiLLVJJ&NTF<LNaEm(Hl!O%W#m6F94##isKmWGEQ:Qa7?-lo\n" +
"K']A:pj_-~\n" +
"]]></RowData>\n" +
"</TableData>\n" +
"<TableData name=\"热销产品\" class=\"com.fr.data.impl.EmbeddedTableData\">\n" +
"<Parameters/>\n" +
"<DSName>\n" +
"<![CDATA[]]></DSName>\n" +
"<ColumnNames>\n" +
"<![CDATA[名称,,.,,承保数量]]></ColumnNames>\n" +
"<ColumnTypes>\n" +
"<![CDATA[java.lang.String,java.lang.String]]></ColumnTypes>\n" +
"<RowData ColumnTypes=\"java.lang.String,java.lang.String\">\n" +
"<![CDATA[HeuF/jckKI]A9Y[Pgh=cCBPLqjoc-QELssEF9ur^NciQq_\"KW18~\n" +
"]]></RowData>\n" +
"</TableData>\n" +
"<TableData name=\"增长折线\" class=\"com.fr.data.impl.EmbeddedTableData\">\n" +
"<Parameters/>\n" +
"<DSName>\n" +
"<![CDATA[]]></DSName>\n" +
"<ColumnNames>\n" +
"<![CDATA[季度,,.,,增长数]]></ColumnNames>\n" +
"<ColumnTypes>\n" +
"<![CDATA[java.lang.String,java.lang.String]]></ColumnTypes>\n" +
"<RowData ColumnTypes=\"java.lang.String,java.lang.String\">\n" +
"<![CDATA[Ha9F*l.X*PG:hi3jEe,4#KesaHEs:Z0)ftdCm[0^~\n" +
"]]></RowData>\n" +
"</TableData>\n" +
"<TableData name=\"最新交易数据\" class=\"com.fr.data.impl.EmbeddedTableData\">\n" +
"<Parameters/>\n" +
"<DSName>\n" +
"<![CDATA[]]></DSName>\n" +
"<ColumnNames>\n" +
"<![CDATA[地区,,.,,渠道,,.,,成交信息,,.,,费用]]></ColumnNames>\n" +
"<ColumnTypes>\n" +
"<![CDATA[java.lang.String,java.lang.String,java.lang.String,java.lang.Integer]]></ColumnTypes>\n" +
"<RowData ColumnTypes=\"java.lang.String,java.lang.String,java.lang.String,java.lang.Integer\">\n" +
"<![CDATA[Kp'VSK0U8Cf@-XK?F2?>5++,D>0thk;G<`mPXn.b)QZb5j^mQri%8Ji5q\\<QfU[CMF+1@.+F\n" +
"=V2:B<sQd@CPt$SPQYC#d)m%W3UQG_:cE`,cpMKA/6nFt!<nYG1)TJ86<kT1X@Ni-l#s[@YI\n" +
"c#[Y!&A0DMK`q$3]Aa!hsc9COj`!fhS:\\?n6=/VkT*$_j&K@:h6gXHXSYM4[dXQq?es!Y/Yhi\n" +
"nj$:0r2r]A#gODY6&9qD$ho,Y3_[0s:u0S9kEH]A^ajp,mj0&rL$d*3B'eUJ8a7$U[+GFfaksD\n" +
",8XnK@&V;!H!NU*c`rtX)(^A~\n" +
"]]></RowData>\n" +
"</TableData>\n" +
"</TableDataMap>\n";
AbstractTableDataSource source = new AbstractTableDataSource() {
};
XMLableReader.createXMLableReader(xml).readXMLObject(source);
TableData tableData = source.getTableData("热销产品");
Assert.notNull(tableData);
Assert.isTrue(tableData.createDataModel(Calculator.createCalculator()).getRowCount() == 4);
Assert.isTrue(tableData.createDataModel(Calculator.createCalculator()).getColumnCount() == 2);
ByteArrayOutputStream out = new ByteArrayOutputStream();
XMLPrintWriter writer = XMLPrintWriter.create(new OutputStreamWriter(out,"UTF-8"));
source.writeXML(writer);
writer.close();
TableDataSource another = new AbstractTableDataSource(){};
XMLableReader.createXMLableReader(new String(out.toByteArray(),"UTF-8")).readXMLObject(another);
tableData = another.getTableData("热销产品");
Assert.notNull(tableData);
Assert.isTrue(tableData.createDataModel(Calculator.createCalculator()).getRowCount() == 4);
Assert.isTrue(tableData.createDataModel(Calculator.createCalculator()).getColumnCount() == 2);
}
}
Loading…
Cancel
Save