//别骂,我是比较懒。ireport设计模板做的报表
1.效果图
?
?
?
?
?
2.java、提供数据的后台代码
绑定多个数据源,list放到map中。
public String exportToHTML(){ try { /* * 模板的位置 */ //指定路径 String fileName = "D:/ireportLib/template/pd_temple_report.jrxml";// 我们就是根据它生成报表的 //动态路径,存放在服务器webroot的路径下// String fileName = ReportAction.class.getResource("/").toString().substring(6) +"pd_temple_report.jrxml"; //---end /* * --生成html的位置和名稱 */ //指定路径 Date now = new Date(); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss"); String nowTime = dateFormat.format( now ); String outFileNameHtml = "D:/ireportLib/output/"+nowTime+".pdf"; //动态路径,存放在服务器指定文件夹下// String outFileNameHtml = Application.class.getResource("Application.class") .toString();// int index = outFileNameHtml.indexOf("WEB-INF");// if (index == -1) {// index = outFileNameHtml.indexOf("bin");// }// outFileNameHtml = outFileNameHtml.substring(0, index);// if (outFileNameHtml.startsWith("jar")) {// outFileNameHtml = outFileNameHtml.substring(10);// } else if (outFileNameHtml.startsWith("file")) {// outFileNameHtml = outFileNameHtml.substring(6);// }// if (outFileNameHtml.endsWith("/")) {// outFileNameHtml = outFileNameHtml.substring(0, outFileNameHtml.length() - 1);// }// outFileNameHtml = outFileNameHtml+"/reportOutput/"+"StatisticalReports.html"; //---end //暂时设置项目id为1 projectId = 1; /* * 饼状图 */ //获取pie的数据 List<Map<String, Object>> list1 = urlDetailBeanService.getUrlDetailGroupByScore(projectId); //pie的list List<Report> pieList = new ArrayList<Report>(); //pieList赋值 for (Map<String, Object> map : list1) { Report pieData = new Report(//int,string,string Integer.valueOf(map.get("count").toString()),//个数 map.get("score").toString(),//名称 "分数在["+map.get("score").toString()+"]之间的页面有["+Integer.valueOf(map.get("count").toString())+"]个");//描述 pieList.add(pieData); } //--end /* * 柱状图 */ //获取柱状图的数据 List list2 = urlDetailRuleService.getCountRuleName(projectId); //柱状图的list List<Report> barList = new ArrayList<Report>(); //barList赋值 if (list2.size() > 0) { for (int i = 0; i < list2.size(); i++) { Object[] obj = (Object[]) list2.get(i); Report barData = new Report(//string,int,string obj[0].toString(),//名称 Integer.valueOf(obj[1].toString()),//个数 obj[0].toString()+"["+Integer.valueOf(obj[1].toString())+"]个页面");//描述 barList.add(barData); } } //--end /* * 规则评分 */ //查询所有记录 List<UrlDetailBean> list3 = urlDetailBeanService.getByProjectId("1"); //获取二维数组内部索引的总数 int resultSize=0; Map<String,String> map = new HashMap<String, String>(); for(int k=0;k<list3.size();k++){ UrlDetailBean udb = list3.get(k); String str = new String(udb.getRuleInfo(), "GB2312"); JSONObject jsonlist = JSONObject.fromObject(str); JSONArray results = (JSONArray)jsonlist.get("results"); //netinfo scanid----url map.put(udb.getScanUrlId().toString(), jsonlist.get("url").toString()); resultSize+=results.size(); } /* * 网络请求 * start */ //pd_url_detail_netinfo查询的条件 String scanid=""; //把map的key全部取出来 Set<Map.Entry<String, String>> set=map.entrySet(); for (Iterator <Map.Entry<String, String>> iterator = set.iterator(); iterator.hasNext();) { Map.Entry<String, String> entry = (Map.Entry<String, String>) iterator.next(); // String key=entry.getKey(); scanid =scanid+ entry.getKey()+",";// String valueString=entry.getValue(); } String scanidData = scanid.substring(0, scanid.length()-1); List<UrlDetailNetInfo> list4 = urlDetailNetInfoService.getNetInfoByScanids(scanidData); String [][] data2 = new String[list4.size()][9]; for(int i=0;i<list4.size();i++){ String [] eachRowData = new String[9]; UrlDetailNetInfo netinfoBean = list4.get(i); String urlStr = map.get(netinfoBean.getScanUrlId().toString()); data2[i][0] =urlStr; data2[i][1] =netinfoBean.getStarted().toString(); data2[i][2] =netinfoBean.getTime().toString(); data2[i][3] =netinfoBean.getSent().toString(); data2[i][4] =netinfoBean.getReceived().toString(); data2[i][5] =netinfoBean.getMethod().toString(); data2[i][6] =netinfoBean.getResult().toString(); data2[i][7] =netinfoBean.getMimeType().toString(); data2[i][8] =netinfoBean.getUrl().toString(); } String [] colName1 = new String[]{"SCANURLID","STARTED","TIME","SENT","RECEIVED","METHOD","RESULT","MIMETYPE","URL"}; DefaultTableModel tableMode1 = new DefaultTableModel(data2,colName1); JRTableModelDataSource netInfolist = new net.sf.jasperreports.engine.data.JRTableModelDataSource(tableMode1); //end /* * 规则评分 * start */ //定义一个n行4列的二维数组 String [][] data = new String[resultSize][4]; //往数组封装数据 //作为二维数组的内部索引 int indexOf =0; for(int k=0;k<list3.size();k++){ UrlDetailBean udb = list3.get(k); String str = new String(udb.getRuleInfo(), "GB2312"); JSONObject jsonlist = JSONObject.fromObject(str); JSONArray results = (JSONArray)jsonlist.get("results"); String url = jsonlist.get("url").toString(); if(k==0){ indexOf= results.size(); } for(int j=0;j<results.size();j++){ String [] eachRowData = new String[4]; JSONObject object =(JSONObject) results.get(j); if(k!=0){ data[indexOf+j][0] = object.get("name").toString(); data[indexOf+j][1] = object.get("level").toString(); data[indexOf+j][2] = object.get("category").toString(); data[indexOf+j][3] = url.toString(); if(results.size()==(j+1)){ indexOf+=results.size();//保存插入数据的动态索引 } }else{//刚开始封装数据 data[j][0] = object.get("name").toString(); data[j][1] = object.get("level").toString(); data[j][2] = object.get("category").toString(); data[j][3] = url.toString(); } } }// String name="";// for(int j=0;j<results.size();j++){// JSONObject object =(JSONObject) results.get(j);// name = object.get("name").toString();// } // String [][] data = new String[20][4];// for(int i=0;i<20;i++){// String [] eachRowData = new String[4];// data[i][0] ="one"+(i+1);// data[i][1] = "two"+(i+1);// data[i][2] = "three"+(i+1);// // if(i<10){// data[i][3] = 1+"";// }else{// data[i][3] = 2+"";// }// } String [] colName = new String[]{"name","level","category","url"}; DefaultTableModel tableMode = new DefaultTableModel(data,colName); JRTableModelDataSource rulelist = new net.sf.jasperreports.engine.data.JRTableModelDataSource(tableMode); //--end /* * 报告的其他指标参数 */ //获取扫描项目的名称 String appName = "页面检测工具"; //获取扫描页面的总数 Integer total = urlDetailBeanService.getTotalUrlDetail(projectId); //获取页面总体评分 String avg = urlDetailBeanService.getScoreAvg(projectId); //获取页面检测结果 String testResults = " 本次检测对目标应用使用了18条页面性能的检测规则,本次检测对目标应用使用了18条页面性能的检测规则,本次检测对目标应用使用了18条页面性能的检测规则,本次检测对目标应用使用了18条页面性能的检测规则,本次检测对目标应用使用了18条页面性能的检测规则,本次检测对目标应用使用了18条页面性能的检测规则,本次检测对目标应用使用了18条页面性能的检测规则,本次检测对目标应用使用了18条页面性能的检测规则,本次检测对目标应用使用了18条页面性能的检测规则,本次检测对目标应用使用了18条页面性能的检测规则,共发现有85个影响页面性能的页面,影响性能百分比为29%。按影响性能等级分为:检查出0个页面评分为F级的页面,占总检查的0%"; //--end /* * 数据封装 */ //数据封装到map Map mapData = new HashMap(); //list mapData.put("pieList", pieList); mapData.put("barList", barList); mapData.put("ruleSetScoreList", rulelist); mapData.put("netInfoList",netInfolist); //static text mapData.put("appName",appName); mapData.put("pageTotals",total.toString()); mapData.put("pageScores",avg); mapData.put("testResults",testResults); //--end // 用list方式读取数据时需要转换 //JRBeanCollectionDataSource dataSource = new JRBeanCollectionDataSource(Reportlist); //转换为jasper文件 JasperReport jasperReport = (JasperReport)JasperCompileManager.compileReport(fileName); //将Collection填充到模板文件类中 //如果没有用list方式读取数据,则dataSource可写成new JREmptyDataSource();// JasperPrint print = JasperFillManager.fillReport(jasperReport, mapData, dataSource); //只读取自定义的map JasperPrint print = JasperFillManager.fillReport(jasperReport, mapData, new JREmptyDataSource()); /* * 報表的一些設置 */ //* 导出html格式的报表 // JRHtmlExporter exporter_html = new JRHtmlExporter();// exporter_html.setParameter(JRExporterParameter.OUTPUT_FILE_NAME,outFileNameHtml);// exporter_html.setParameter(JRExporterParameter.JASPER_PRINT, print);// exporter_html.setParameter(JRHtmlExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE);// exporter_html.setParameter(JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN,Boolean.TRUE); // exporter_html.exportReport(); //* 导出pdf格式的报表 JRExporter exporter_pdf = new JRPdfExporter(); exporter_pdf.setParameter(JRExporterParameter.OUTPUT_FILE_NAME,outFileNameHtml); exporter_pdf.setParameter(JRExporterParameter.JASPER_PRINT, print); exporter_pdf.exportReport(); } catch (JRException e) { e.printStackTrace(); System.exit(1); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } return SUCCESS; }
?
3.ireport设计的报表模板
建议copy下来保存为jrxml格式,然后用ireport4.6打开,可以看到柱状图,饼形图,table(多个,并分组),静态文本,动态文本,是如何设置的,其中绑定了四个数据源。
<?xml version="1.0" encoding="UTF-8"?><jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="pd_temple_report" language="groovy" pageWidth="595" pageHeight="3500" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" > <property name="ireport.zoom" value="1.0000000000000067"/> <property name="ireport.x" value="0"/> <property name="ireport.y" value="384"/> <style name="table"> <box> <pen lineWidth="1.0" lineColor="#000000"/> </box> </style> <style name="table_TH" mode="Opaque" backcolor="#F0F8FF"> <box> <pen lineWidth="0.5" lineColor="#000000"/> </box> </style> <style name="table_CH" mode="Opaque" backcolor="#BFE1FF"> <box> <pen lineWidth="0.5" lineColor="#000000"/> </box> </style> <style name="table_TD" mode="Opaque" backcolor="#FFFFFF"> <box> <pen lineWidth="0.5" lineColor="#000000"/> </box> </style> <style name="table 1"> <box> <topPen lineWidth="1.0" lineColor="#000000"/> <bottomPen lineWidth="1.0" lineColor="#000000"/> </box> </style> <style name="table 1_TH" mode="Opaque" backcolor="#F0F8FF"> <box> <topPen lineWidth="0.5" lineColor="#000000"/> <bottomPen lineWidth="0.5" lineColor="#000000"/> </box> </style> <style name="table 1_CH" mode="Opaque" backcolor="#BFE1FF"> <box> <topPen lineWidth="0.5" lineColor="#000000"/> <bottomPen lineWidth="0.5" lineColor="#000000"/> </box> </style> <style name="table 1_TD" mode="Opaque" backcolor="#FFFFFF"> <box> <topPen lineWidth="0.5" lineColor="#000000"/> <bottomPen lineWidth="0.5" lineColor="#000000"/> </box> <conditionalStyle> <conditionExpression><![CDATA[new Boolean($V{REPORT_COUNT}.intValue()%2==0)]]></conditionExpression> <style backcolor="#EFF7FF"/> </conditionalStyle> </style> <style name="table 2"> <box> <pen lineWidth="1.0" lineColor="#000000"/> </box> </style> <style name="table 2_TH" mode="Opaque" backcolor="#F0F8FF"> <box> <pen lineWidth="0.5" lineColor="#000000"/> </box> </style> <style name="table 2_CH" mode="Opaque" backcolor="#BFE1FF"> <box> <pen lineWidth="0.5" lineColor="#000000"/> </box> </style> <style name="table 2_TD" mode="Opaque" backcolor="#FFFFFF"> <box> <pen lineWidth="0.5" lineColor="#000000"/> </box> </style> <style name="table 3"> <box> <pen lineWidth="1.0" lineColor="#000000"/> </box> </style> <style name="table 3_TH" mode="Opaque" backcolor="#73B0E6"> <box> <pen lineWidth="0.5" lineColor="#000000"/> </box> </style> <style name="table 3_CH" mode="Opaque" backcolor="#CFDBE6"> <box> <pen lineWidth="0.5" lineColor="#000000"/> </box> </style> <style name="table 3_TD" mode="Opaque" backcolor="#FFFFFF"> <box> <pen lineWidth="0.5" lineColor="#000000"/> </box> <conditionalStyle> <conditionExpression><![CDATA[new Boolean($V{REPORT_COUNT}.intValue()%2==0)]]></conditionExpression> <style backcolor="#F3F6F8"/> </conditionalStyle> </style> <style name="table 4"> <box> <pen lineWidth="1.0" lineColor="#000000"/> </box> </style> <style name="table 4_TH" mode="Opaque" backcolor="#73B0E6"> <box> <pen lineWidth="0.5" lineColor="#000000"/> </box> </style> <style name="table 4_CH" mode="Opaque" backcolor="#CFDBE6"> <box> <pen lineWidth="0.5" lineColor="#000000"/> </box> </style> <style name="table 4_TD" mode="Opaque" backcolor="#FFFFFF"> <box> <pen lineWidth="0.5" lineColor="#000000"/> </box> <conditionalStyle> <conditionExpression><![CDATA[new Boolean($V{REPORT_COUNT}.intValue()%2==0)]]></conditionExpression> <style backcolor="#F3F6F8"/> </conditionalStyle> </style> <style name="table 5"> <box> <pen lineWidth="1.0" lineColor="#000000"/> </box> </style> <style name="table 5_TH" mode="Opaque" backcolor="#BFE1FF"> <box> <pen lineWidth="0.5" lineColor="#000000"/> </box> </style> <style name="table 5_CH" mode="Opaque" backcolor="#E6F3FF"> <box> <pen lineWidth="0.5" lineColor="#000000"/> </box> </style> <style name="table 5_TD" mode="Opaque" backcolor="#FFFFFF"> <box> <pen lineWidth="0.5" lineColor="#000000"/> </box> </style> <style name="table 6"> <box> <pen lineWidth="1.0" lineColor="#000000"/> </box> </style> <style name="table 6_TH" mode="Opaque" backcolor="#F0F8FF"> <box> <pen lineWidth="0.5" lineColor="#000000"/> </box> </style> <style name="table 6_CH" mode="Opaque" backcolor="#BFE1FF"> <box> <pen lineWidth="0.5" lineColor="#000000"/> </box> </style> <style name="table 6_TD" mode="Opaque" backcolor="#FFFFFF"> <box> <pen lineWidth="0.5" lineColor="#000000"/> </box> </style> <subDataset name="pieDataset" > <queryString> <![CDATA[]]> </queryString> <field name="pieCount" class="java.lang.Integer"> <fieldDescription><![CDATA[pieCount]]></fieldDescription> </field> <field name="pieDescription" class="java.lang.String"> <fieldDescription><![CDATA[pieDescription]]></fieldDescription> </field> <field name="pieScore" class="java.lang.String"> <fieldDescription><![CDATA[pieScore]]></fieldDescription> </field> </subDataset> <subDataset name="barDataset" > <queryString> <![CDATA[]]> </queryString> <field name="barCount" class="java.lang.Integer"> <fieldDescription><![CDATA[barCount]]></fieldDescription> </field> <field name="barDescription" class="java.lang.String"> <fieldDescription><![CDATA[barDescription]]></fieldDescription> </field> <field name="barRuleInfo" class="java.lang.String"> <fieldDescription><![CDATA[barRuleInfo]]></fieldDescription> </field> </subDataset> <subDataset name="ruleDataSet" > <queryString> <![CDATA[]]> </queryString> <field name="name" class="java.lang.String"/> <field name="level" class="java.lang.String"/> <field name="category" class="java.lang.String"/> <field name="url" class="java.lang.String"/> <group name="url"> <groupExpression><![CDATA[$F{url}]]></groupExpression> </group> </subDataset> <subDataset name="netInfoDataSet" > <queryString> <![CDATA[]]> </queryString> <field name="SCANURLID" class="java.lang.String"/> <field name="STARTED" class="java.lang.String"/> <field name="TIME" class="java.lang.String"/> <field name="SENT" class="java.lang.String"/> <field name="RECEIVED" class="java.lang.String"/> <field name="RESULT" class="java.lang.String"/> <field name="METHOD" class="java.lang.String"/> <field name="MIMETYPE" class="java.lang.String"/> <field name="URL" class="java.lang.String"/> <group name="SCANURLID"> <groupExpression><![CDATA[$F{SCANURLID}]]></groupExpression> </group> </subDataset> <parameter name="pageTotals" class="java.lang.String" isForPrompting="false"/> <parameter name="pageScores" class="java.lang.String" isForPrompting="false"/> <parameter name="appName" class="java.lang.String" isForPrompting="false"/> <parameter name="pieList" class="java.util.Collection" isForPrompting="false"/> <parameter name="barList" class="java.util.Collection" isForPrompting="false"/> <parameter name="testResults" class="java.lang.String" isForPrompting="false"/> <parameter name="ruleSetScoreList" class="java.lang.Object" isForPrompting="false"/> <parameter name="netInfoList" class="java.lang.Object" isForPrompting="false"/> <background> <band splitType="Stretch"/> </background> <title> <band height="157"> <staticText> <reportElement x="0" y="59" width="555" height="36"/> <textElement verticalAlignment="Middle"> <font size="18" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <text><![CDATA[ 1.综述]]></text> </staticText> <staticText> <reportElement x="36" y="95" width="100" height="20"/> <textElement textAlignment="Left" verticalAlignment="Middle"> <font fontName="微软雅黑" size="14" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <text><![CDATA[应用名称:]]></text> </staticText> <staticText> <reportElement x="36" y="115" width="100" height="20"/> <textElement textAlignment="Left" verticalAlignment="Middle"> <font fontName="微软雅黑" size="14" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <text><![CDATA[扫描页面:]]></text> </staticText> <textField> <reportElement x="136" y="115" width="113" height="20"/> <textElement textAlignment="Left" verticalAlignment="Middle"> <font size="14" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <textFieldExpression><![CDATA[$P{pageTotals}]]></textFieldExpression> </textField> <textField> <reportElement x="136" y="135" width="113" height="20"/> <textElement textAlignment="Left" verticalAlignment="Middle"> <font size="14" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <textFieldExpression><![CDATA[$P{pageScores}]]></textFieldExpression> </textField> <textField> <reportElement x="136" y="95" width="113" height="20"/> <textElement textAlignment="Left" verticalAlignment="Middle"> <font size="14" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <textFieldExpression><![CDATA[$P{appName}]]></textFieldExpression> </textField> <staticText> <reportElement x="36" y="135" width="100" height="20"/> <textElement textAlignment="Left" verticalAlignment="Middle"> <font fontName="微软雅黑" size="14" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <text><![CDATA[页面总体评分:]]></text> </staticText> <textField> <reportElement x="0" y="0" width="555" height="59"/> <textElement textAlignment="Center"> <font fontName="华文仿宋" size="20" isBold="true" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <textFieldExpression><![CDATA[$P{appName}+"分析报告"]]></textFieldExpression> </textField> </band> </title> <pageHeader> <band height="13"/> </pageHeader> <detail> <band height="766" splitType="Stretch"> <stackedBar3DChart> <chart renderType="draw" theme="default"> <reportElement x="11" y="353" width="526" height="400"/> <box> <pen lineWidth="0.25"/> <topPen lineWidth="0.25"/> <leftPen lineWidth="0.25"/> <bottomPen lineWidth="0.25"/> <rightPen lineWidth="0.25"/> </box> <chartTitle/> <chartSubtitle/> <chartLegend/> </chart> <categoryDataset> <dataset> <datasetRun subDataset="barDataset" > <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($P{barList})]]></dataSourceExpression> </datasetRun> </dataset> <categorySeries> <seriesExpression><![CDATA[$F{barRuleInfo}]]></seriesExpression> <categoryExpression><![CDATA[$F{barRuleInfo}]]></categoryExpression> <valueExpression><![CDATA[$F{barCount}]]></valueExpression> <labelExpression><![CDATA[$F{barCount}]]></labelExpression> <itemHyperlink> <hyperlinkTooltipExpression><![CDATA[$F{barDescription}]]></hyperlinkTooltipExpression> </itemHyperlink> </categorySeries> </categoryDataset> <bar3DPlot isShowLabels="true"> <plot labelRotation="45.0"/> <itemLabel> <font fontName="黑体" size="24" isBold="true" isItalic="true" isUnderline="true" isStrikeThrough="true" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </itemLabel> <categoryAxisLabelExpression><![CDATA["性能指标分析柱状图"]]></categoryAxisLabelExpression> <categoryAxisFormat labelRotation="45.0"> <axisFormat labelColor="#000000" tickLabelColor="#336600" verticalTickLabels="true" axisLineColor="#999900"> <labelFont> <font size="12"/> </labelFont> <tickLabelFont> <font size="18" isItalic="true"/> </tickLabelFont> </axisFormat> </categoryAxisFormat> <valueAxisFormat> <axisFormat> <tickLabelFont> <font size="14" isItalic="true"/> </tickLabelFont> </axisFormat> </valueAxisFormat> </bar3DPlot> </stackedBar3DChart> <pieChart> <chart renderType="draw" theme="default"> <reportElement mode="Opaque" x="11" y="53" width="526" height="287" forecolor="#000000"/> <box> <pen lineWidth="0.25"/> <topPen lineWidth="0.25"/> <leftPen lineWidth="0.25"/> <bottomPen lineWidth="0.25"/> <rightPen lineWidth="0.25"/> </box> <chartTitle color="#00CC00"> <font size="14"/> <titleExpression><![CDATA["页面检测统计饼型图"]]></titleExpression> </chartTitle> <chartSubtitle/> <chartLegend position="Right"> <font pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </chartLegend> </chart> <pieDataset> <dataset> <datasetRun subDataset="pieDataset" > <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($P{pieList})]]></dataSourceExpression> </datasetRun> </dataset> <keyExpression><![CDATA[$F{pieScore}]]></keyExpression> <valueExpression><![CDATA[$F{pieCount}]]></valueExpression> <labelExpression><![CDATA[$F{pieCount}]]></labelExpression> <sectionHyperlink> <hyperlinkTooltipExpression><![CDATA[$F{pieDescription}]]></hyperlinkTooltipExpression> </sectionHyperlink> <otherSectionHyperlink> <hyperlinkTooltipExpression><![CDATA[$F{pieDescription}]]></hyperlinkTooltipExpression> </otherSectionHyperlink> </pieDataset> <piePlot isShowLabels="true" isCircular="true" labelFormat="{1}个" legendLabelFormat="{0}分之间总个数为:{2}"> <plot labelRotation="1.0"> <seriesColor seriesOrder="0" color="#86D260"/> </plot> <itemLabel color="#FF3366" backgroundColor="#FFFFFF"> <font fontName="黑体" size="18" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </itemLabel> </piePlot> </pieChart> <staticText> <reportElement x="0" y="0" width="555" height="36"/> <textElement> <font size="18" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <text><![CDATA[ 2. 页面性能指标分类]]></text> </staticText> </band> <band height="219"> <componentElement> <reportElement key="table 6" style="table 4" x="11" y="31" width="291" height="185"/> <jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd"> <datasetRun subDataset="netInfoDataSet" > <dataSourceExpression><![CDATA[$P{netInfoList}]]></dataSourceExpression> </datasetRun> <jr:columnGroup width="520"> <jr:groupHeader groupName="SCANURLID"> <jr:cell height="18" rowSpan="1"> <textField> <reportElement x="0" y="0" width="517" height="18"/> <textElement> <font size="7" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <textFieldExpression><![CDATA["页面url: "+$F{SCANURLID}]]></textFieldExpression> </textField> </jr:cell> </jr:groupHeader> <jr:columnGroup width="520"> <jr:columnGroup width="520"> <jr:tableHeader style="table 6_TH" height="20" rowSpan="1"> <staticText> <reportElement x="3" y="0" width="517" height="20"/> <textElement textAlignment="Center"> <font size="12" isBold="true" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <text><![CDATA[网络请求详细列表]]></text> </staticText> </jr:tableHeader> <jr:columnGroup width="520"> <jr:groupFooter groupName="SCANURLID"> <jr:cell style="table 6_TH" height="10" rowSpan="1"/> </jr:groupFooter> <jr:column width="34"> <jr:groupHeader groupName="SCANURLID"> <jr:cell style="table 6_TH" height="30" rowSpan="1"> <staticText> <reportElement x="0" y="0" width="33" height="30"/> <textElement textAlignment="Center"> <font size="8" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <text><![CDATA[开始时间]]></text> </staticText> </jr:cell> </jr:groupHeader> <jr:detailCell style="table 6_TD" height="24" rowSpan="1"> <textField> <reportElement x="0" y="0" width="33" height="20"/> <textElement> <font size="5"/> </textElement> <textFieldExpression><![CDATA[$F{STARTED}]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> <jr:column width="22"> <jr:groupHeader groupName="SCANURLID"> <jr:cell style="table 6_TH" height="30" rowSpan="1"> <staticText> <reportElement x="1" y="0" width="21" height="30"/> <textElement textAlignment="Center"> <font size="8" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <text><![CDATA[持续时间]]></text> </staticText> </jr:cell> </jr:groupHeader> <jr:detailCell style="table 6_TD" height="24" rowSpan="1"> <textField> <reportElement x="0" y="0" width="21" height="20"/> <textElement> <font size="5"/> </textElement> <textFieldExpression><![CDATA[$F{TIME}]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> <jr:column width="19"> <jr:groupHeader groupName="SCANURLID"> <jr:cell style="table 6_TH" height="30" rowSpan="1"> <staticText> <reportElement x="0" y="0" width="19" height="30"/> <textElement textAlignment="Center"> <font size="8" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <text><![CDATA[发送]]></text> </staticText> </jr:cell> </jr:groupHeader> <jr:detailCell style="table 6_TD" height="24" rowSpan="1"> <textField> <reportElement x="0" y="0" width="19" height="20"/> <textElement> <font size="5"/> </textElement> <textFieldExpression><![CDATA[$F{SENT}]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> <jr:column width="18"> <jr:groupHeader groupName="SCANURLID"> <jr:cell style="table 6_TH" height="30" rowSpan="1"> <staticText> <reportElement x="0" y="0" width="17" height="30"/> <textElement textAlignment="Center"> <font size="8" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <text><![CDATA[接收]]></text> </staticText> </jr:cell> </jr:groupHeader> <jr:detailCell style="table 6_TD" height="24" rowSpan="1"> <textField> <reportElement x="0" y="0" width="17" height="20"/> <textElement> <font size="5"/> </textElement> <textFieldExpression><![CDATA[$F{RECEIVED}]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> <jr:column width="19"> <jr:groupHeader groupName="SCANURLID"> <jr:cell style="table 6_TH" height="30" rowSpan="1"> <staticText> <reportElement x="1" y="0" width="18" height="30"/> <textElement textAlignment="Center"> <font size="8" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <text><![CDATA[请求结果]]></text> </staticText> </jr:cell> </jr:groupHeader> <jr:detailCell style="table 6_TD" height="24" rowSpan="1"> <textField> <reportElement x="0" y="0" width="19" height="20"/> <textElement> <font size="5"/> </textElement> <textFieldExpression><![CDATA[$F{RESULT}]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> <jr:column width="22"> <jr:groupHeader groupName="SCANURLID"> <jr:cell style="table 6_TH" height="30" rowSpan="1"> <staticText> <reportElement x="0" y="0" width="22" height="30"/> <textElement textAlignment="Center"> <font size="8" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <text><![CDATA[请求方法]]></text> </staticText> </jr:cell> </jr:groupHeader> <jr:detailCell style="table 6_TD" height="24" rowSpan="1"> <textField> <reportElement x="0" y="0" width="22" height="20"/> <textElement> <font size="5"/> </textElement> <textFieldExpression><![CDATA[$F{METHOD}]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> <jr:column width="42"> <jr:groupHeader groupName="SCANURLID"> <jr:cell style="table 6_TH" height="30" rowSpan="1"> <staticText> <reportElement x="1" y="0" width="41" height="30"/> <textElement textAlignment="Center"> <font size="8" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <text><![CDATA[请求类型]]></text> </staticText> </jr:cell> </jr:groupHeader> <jr:detailCell style="table 6_TD" height="24" rowSpan="1"> <textField> <reportElement x="0" y="0" width="42" height="20"/> <textElement> <font size="4"/> </textElement> <textFieldExpression><![CDATA[$F{MIMETYPE}]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> <jr:column width="344"> <jr:groupHeader groupName="SCANURLID"> <jr:cell style="table 6_TH" height="30" rowSpan="1"> <staticText> <reportElement x="0" y="0" width="90" height="30"/> <textElement textAlignment="Center"> <font size="8" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <text><![CDATA[URL]]></text> </staticText> </jr:cell> </jr:groupHeader> <jr:detailCell style="table 6_TD" height="24" rowSpan="1"> <box topPadding="1" leftPadding="1" bottomPadding="1" rightPadding="1"/> <textField> <reportElement x="0" y="0" width="337" height="20" isPrintWhenDetailOverflows="true"/> <textElement> <font size="4"/> </textElement> <textFieldExpression><![CDATA[$F{URL}]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> </jr:columnGroup> </jr:columnGroup> </jr:columnGroup> </jr:columnGroup> </jr:table> </componentElement> <staticText> <reportElement x="0" y="0" width="555" height="31"/> <textElement> <font size="18" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <text><![CDATA[ 3.网络请求详细列表]]></text> </staticText> </band> <band height="218"> <componentElement> <reportElement key="table 4" style="table 4" x="11" y="31" width="291" height="187"/> <jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd"> <datasetRun subDataset="ruleDataSet" > <dataSourceExpression><![CDATA[$P{ruleSetScoreList}]]></dataSourceExpression> </datasetRun> <jr:columnGroup width="521"> <jr:groupHeader groupName="url"> <jr:cell height="32" rowSpan="1"> <textField isBlankWhenNull="false"> <reportElement style="table" stretchType="RelativeToTallestObject" isPrintRepeatedValues="false" x="0" y="2" width="521" height="30" backcolor="#B6B6D4"/> <textElement> <font size="8" isBold="false" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <textFieldExpression><![CDATA["页面URL: "+$F{url}]]></textFieldExpression> </textField> </jr:cell> </jr:groupHeader> <jr:columnGroup width="521"> <jr:tableHeader style="table 6_TH" height="20" rowSpan="1"> <staticText> <reportElement x="0" y="0" width="521" height="20"/> <textElement textAlignment="Center"> <font size="14" isBold="true" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <text><![CDATA[规则评分详细列表]]></text> </staticText> </jr:tableHeader> <jr:columnGroup width="521"> <jr:groupFooter groupName="url"> <jr:cell style="table 6_TH" height="9" rowSpan="1"/> </jr:groupFooter> <jr:column width="167"> <jr:groupHeader groupName="url"> <jr:cell style="table 6_TH" height="18" rowSpan="1"> <staticText> <reportElement x="22" y="0" width="135" height="15"/> <textElement textAlignment="Center"> <font size="8" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <text><![CDATA[规则名称]]></text> </staticText> </jr:cell> </jr:groupHeader> <jr:detailCell style="table 4_TD" height="20" rowSpan="1"> <textField> <reportElement x="0" y="0" width="167" height="20"/> <textElement textAlignment="Center"> <font size="8" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <textFieldExpression><![CDATA[$F{name}]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> <jr:column width="96"> <jr:groupHeader groupName="url"> <jr:cell style="table 6_TH" height="18" rowSpan="1"> <staticText> <reportElement x="10" y="0" width="44" height="15"/> <textElement textAlignment="Center"> <font size="8" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <text><![CDATA[分析等级]]></text> </staticText> </jr:cell> </jr:groupHeader> <jr:detailCell style="table 4_TD" height="20" rowSpan="1"> <textField> <reportElement x="25" y="0" width="44" height="20"/> <textElement> <font size="8"/> </textElement> <textFieldExpression><![CDATA[$F{level}]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> <jr:column width="258"> <jr:groupHeader groupName="url"> <jr:cell style="table 6_TH" height="18" rowSpan="1"> <staticText> <reportElement x="55" y="3" width="120" height="15"/> <textElement textAlignment="Center"> <font size="8" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <text><![CDATA[规则类别]]></text> </staticText> </jr:cell> </jr:groupHeader> <jr:detailCell style="table 4_TD" height="20" rowSpan="1"> <textField> <reportElement x="92" y="0" width="120" height="20"/> <textElement> <font size="8"/> </textElement> <textFieldExpression><![CDATA[$F{category}]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> </jr:columnGroup> </jr:columnGroup> </jr:columnGroup> </jr:table> </componentElement> <staticText> <reportElement x="0" y="0" width="555" height="31"/> <textElement> <font size="18" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <text><![CDATA[ 4.规则评分详细列表]]></text> </staticText> </band> </detail> <columnFooter> <band height="21"/> </columnFooter> <summary> <band height="160"> <staticText> <reportElement x="0" y="0" width="555" height="36"/> <textElement> <font size="18" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <text><![CDATA[ 5. 检测总结果]]></text> </staticText> <textField> <reportElement x="22" y="36" width="501" height="113"/> <textElement> <font pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <textFieldExpression><![CDATA[$P{testResults}]]></textFieldExpression> </textField> </band> </summary></jasperReport>
?
?
?
?
?
?