我需要使用以下JSON生成pdf。结构应如下所示
{
"a1":"Salesman1",
"details1":[
{
"a11":"Cus001",
"a12":"115 EAST POINT CLINIC & SURGERY",
"a13":"16",
"details2":[
{
"a21":"2D LINGUALBRACKET W GINGIVAL HOOK1",
"a22":"SD01126",
"a23":1,
"a24":"",
"a25":130.0,
"a26":130.0,
"a27":"P00075S0000058",
"a28":"2019-12-02 08:39:13",
"a29":"Cus001",
"a30":"16",
"a31":73.6,
"a32":73.6
}
],
"a14":1,
"a15":130.0
}, {
"a11":"Cus002",
"a12":"115 EAST POINT CLINIC & SURGERY",
"a13":"16",
"details2":[
{
"a21":"2D LINGUALBRACKET W GINGIVAL HOOK1",
"a22":"SD01126",
"a23":1,
"a24":"",
"a25":130.0,
"a26":130.0,
"a27":"P00075S0000058",
"a28":"2019-12-02 08:39:13",
"a29":"Cus002",
"a30":"16",
"a31":73.6,
"a32":73.6
}
],
"a14":1,
"a15":130.0
}
],
"a2":1,
"a3":130.0
}
这是我的jrxml
<?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="salesmanlistingproduct" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="32c6aa19-795a-4cea-93c7-3515d92b4260">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="JsonArrayDataAdapter.xml"/>
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<subDataset name="details1" uuid="4563e834-a9e5-43b5-9f0a-824948c73c73">
<field name="A11" class="java.lang.String">
<fieldDescription><![CDATA[a11]]></fieldDescription>
</field>
<field name="A12" class="java.lang.String">
<fieldDescription><![CDATA[a12]]></fieldDescription>
</field>
<field name="A13" class="java.lang.String">
<fieldDescription><![CDATA[a13]]></fieldDescription>
</field>
<field name="A14" class="java.lang.String">
<fieldDescription><![CDATA[a14]]></fieldDescription>
</field>
<field name="A15" class="java.lang.String">
<fieldDescription><![CDATA[a15]]></fieldDescription>
</field>
</subDataset>
<subDataset name="details2" uuid="f703cb76-2a4a-44f1-9a42-227e180038d2">
<field name="A21" class="java.lang.String">
<fieldDescription><![CDATA[a21]]></fieldDescription>
</field>
<field name="A22" class="java.lang.String">
<fieldDescription><![CDATA[a22]]></fieldDescription>
</field>
<field name="A23" class="java.lang.String">
<fieldDescription><![CDATA[a23]]></fieldDescription>
</field>
<field name="A24" class="java.lang.String">
<fieldDescription><![CDATA[a24]]></fieldDescription>
</field>
<field name="A25" class="java.lang.String">
<fieldDescription><![CDATA[a25]]></fieldDescription>
</field>
<field name="A26" class="java.lang.String">
<fieldDescription><![CDATA[a26]]></fieldDescription>
</field>
<field name="A27" class="java.lang.String">
<fieldDescription><![CDATA[a27]]></fieldDescription>
</field>
<field name="A28" class="java.lang.String">
<fieldDescription><![CDATA[a28]]></fieldDescription>
</field>
<field name="A29" class="java.lang.String">
<fieldDescription><![CDATA[a29]]></fieldDescription>
</field>
<field name="A30" class="java.lang.String">
<fieldDescription><![CDATA[a30]]></fieldDescription>
</field>
<field name="A31" class="java.lang.String">
<fieldDescription><![CDATA[a31]]></fieldDescription>
</field>
<field name="A32" class="java.lang.String">
<fieldDescription><![CDATA[a32]]></fieldDescription>
</field>
</subDataset>
<parameter name="companyname" class="java.lang.String"/>
<parameter name="startdate" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<parameter name="enddate" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<parameter name="outlet" class="java.lang.String"/>
<parameter name="salesman" class="java.lang.String"/>
<queryString language="json">
<![CDATA[]]>
</queryString>
<field name="A1" class="java.lang.String">
<fieldDescription><![CDATA[a1]]></fieldDescription>
</field>
<field name="A2" class="java.lang.String">
<fieldDescription><![CDATA[a2]]></fieldDescription>
</field>
<field name="A3" class="java.lang.String">
<fieldDescription><![CDATA[a3]]></fieldDescription>
</field>
<field name="A4" class="java.lang.String">
<fieldDescription><![CDATA[a4]]></fieldDescription>
</field>
<field name="A5" class="java.lang.String">
<fieldDescription><![CDATA[a5]]></fieldDescription>
</field>
<variable name="cogs" class="java.lang.Double">
<variableExpression><![CDATA[]]></variableExpression>
</variable>
<group name="outlet">
<groupExpression><![CDATA[$P{outlet}]]></groupExpression>
<groupHeader>
<band/>
</groupHeader>
<groupFooter>
<band height="31"/>
</groupFooter>
</group>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band splitType="Stretch"/>
</title>
<pageHeader>
<band height="113" splitType="Stretch">
<staticText>
<reportElement x="136" y="69" width="16" height="15" uuid="dc6fd103-1feb-4b72-8745-cde0b1b5a429"/>
<textElement>
<font fontName="Arial" size="10"/>
</textElement>
<text><![CDATA[To]]></text>
</staticText>
<staticText>
<reportElement x="65" y="20" width="427" height="15" uuid="e9d86e9c-2138-40e8-b9d5-2071c1562c30"/>
<textElement textAlignment="Center">
<font fontName="Arial" size="12" isBold="true"/>
</textElement>
<text><![CDATA[Daily Sales Items Report By Salesperson]]></text>
</staticText>
<staticText>
<reportElement x="359" y="69" width="83" height="15" uuid="5f35681a-dc31-49a8-aa08-742519b8d28b"/>
<textElement>
<font fontName="Arial" size="10"/>
</textElement>
<text><![CDATA[Generated On :]]></text>
</staticText>
<staticText>
<reportElement x="0" y="69" width="65" height="15" uuid="20102bb3-7fb0-4626-af2c-9a8ea20ad899"/>
<textElement>
<font fontName="Arial" size="10"/>
</textElement>
<text><![CDATA[Report Date :]]></text>
</staticText>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="65" y="35" width="427" height="16" uuid="057cbf18-e44e-43f7-ab9e-e298b19e70cd"/>
<textElement textAlignment="Center">
<font fontName="Arial" size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{companyname}]]></textFieldExpression>
</textField>
<textField pattern="dd/MM/yyyy HH:mm">
<reportElement x="442" y="69" width="100" height="15" uuid="b6717e6e-d4b7-44da-8e5f-eb541848ae12"/>
<textElement>
<font fontName="Arial" size="10"/>
</textElement>
<textFieldExpression><![CDATA[new Date()]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="dd MMM yyyy" isBlankWhenNull="true">
<reportElement x="65" y="69" width="70" height="15" uuid="0bc43580-129d-40b8-9be5-ac0f7eacdb56"/>
<textElement textAlignment="Center">
<font size="9"/>
</textElement>
<textFieldExpression><![CDATA[$P{startdate}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="dd MMM yyyy" isBlankWhenNull="true">
<reportElement x="152" y="69" width="114" height="15" uuid="626babf0-7995-4dad-a592-735c0a1dfc93"/>
<textElement>
<font size="9"/>
</textElement>
<textFieldExpression><![CDATA[$P{enddate}]]></textFieldExpression>
</textField>
<staticText>
<reportElement mode="Opaque" x="0" y="96" width="65" height="15" backcolor="#CCCCCC" uuid="9afa0215-539a-4c7c-90b9-15d2e66e41a2"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="10" isBold="false"/>
</textElement>
<text><![CDATA[Item No]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="136" y="96" width="37" height="15" backcolor="#CCCCCC" uuid="427f8593-15d7-483d-a1ac-0af1db553b34"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="10" isBold="false"/>
</textElement>
<text><![CDATA[Qty]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="173" y="96" width="37" height="15" backcolor="#CCCCCC" uuid="3448d540-c0d2-4802-8542-1b72649493fc"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="10" isBold="false"/>
</textElement>
<text><![CDATA[UOM]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="230" y="97" width="46" height="15" backcolor="#CCCCCC" uuid="a56279db-0d72-47e0-a715-10a5ba03a50f"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="10" isBold="false"/>
</textElement>
<text><![CDATA[Amount]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="276" y="97" width="44" height="15" backcolor="#CCCCCC" uuid="6d0fad44-e80e-44f0-acbe-bb3e52d09a49"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="10" isBold="false"/>
</textElement>
<text><![CDATA[Date]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="344" y="98" width="49" height="15" backcolor="#CCCCCC" uuid="70821373-1bee-49f3-a6b0-d51d0d774098"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="10" isBold="false"/>
</textElement>
<text><![CDATA[Doc No]]></text>
</staticText>
<line>
<reportElement x="0" y="112" width="553" height="1" uuid="f0db66e2-1cae-4d6a-94dc-579a5646c623"/>
</line>
<staticText>
<reportElement mode="Opaque" x="512" y="96" width="35" height="15" backcolor="#CCCCCC" uuid="0009a776-a6fc-4c1c-9dbb-fa3c1de9eeb9"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="10" isBold="false"/>
</textElement>
<text><![CDATA[Cost]]></text>
</staticText>
</band>
</pageHeader>
<columnHeader>
<band splitType="Stretch"/>
</columnHeader>
<detail>
<band height="114" splitType="Stretch">
<textField>
<reportElement positionType="Float" x="0" y="0" width="333" height="20" uuid="698866c8-7d26-4bc7-8727-b4a56d239a53"/>
<textElement>
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{A1}]]></textFieldExpression>
</textField>
<componentElement>
<reportElement positionType="Float" x="0" y="20" width="537" height="20" uuid="c3237c70-6b2e-43e3-aa21-5092d8b91afc"/>
<jr:list xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" printOrder="Vertical">
<datasetRun subDataset="details1" uuid="f5fdc6a3-736f-43ce-b549-cd7332d19eb8">
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("details1")]]></dataSourceExpression>
</datasetRun>
<jr:listContents height="20" width="537">
<textField>
<reportElement x="261" y="0" width="130" height="20" uuid="07e3ff2a-3832-4b06-9275-cb1ee8e51cfe"/>
<textElement>
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{A13}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="0" width="130" height="20" uuid="bb5718c6-b39a-40ad-8481-5ec7ec483f2a"/>
<textElement>
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{A11}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="131" y="0" width="130" height="20" uuid="ebcab83b-73be-4bac-8e4f-7e9b09747956"/>
<textElement>
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{A12}]]></textFieldExpression>
</textField>
</jr:listContents>
</jr:list>
</componentElement>
<componentElement>
<reportElement positionType="Float" x="0" y="40" width="555" height="20" uuid="38f3ac11-ad3e-464c-813a-46132f23783f"/>
<jr:list xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" printOrder="Vertical">
<datasetRun subDataset="details2" uuid="833a13c3-e9b8-4f56-9f8f-279d32d403e8">
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("details1.details2")]]></dataSourceExpression>
</datasetRun>
<jr:listContents height="20" width="555">
<textField>
<reportElement x="0" y="0" width="58" height="20" uuid="3d9fb513-bfc9-4d95-a3da-16b95cf15e7c"/>
<textFieldExpression><![CDATA[$F{A21}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="58" y="0" width="72" height="20" uuid="b2444c9c-8171-4fcb-a03e-98bc48fb27aa"/>
<textFieldExpression><![CDATA[$F{A22}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="130" y="0" width="43" height="20" uuid="5900a561-3f85-44df-aac5-7633a283fe08"/>
<textFieldExpression><![CDATA[$F{A23}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="173" y="0" width="37" height="20" uuid="b4aa67ba-cacd-48e1-80c8-b871a5f23e15"/>
<textFieldExpression><![CDATA[$F{A24}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="210" y="0" width="72" height="20" uuid="41367276-1c6c-4c82-bd55-51edba1e574f"/>
<textFieldExpression><![CDATA[$F{A25}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="287" y="0" width="72" height="20" uuid="7b908791-48aa-4530-bc4e-37d46168ef36"/>
<textFieldExpression><![CDATA[$F{A26}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="359" y="0" width="72" height="20" uuid="0b8c42a8-b7a5-447e-835b-14481b0e32ec"/>
<textFieldExpression><![CDATA[$F{A27}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="431" y="0" width="72" height="20" uuid="ea742b2d-bd7c-4d86-8b7d-3fafd5f92e0c"/>
<textFieldExpression><![CDATA[$F{A28}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="512" y="0" width="43" height="20" uuid="a00cb6e6-abd0-4022-aaba-c320fa39a047"/>
<textFieldExpression><![CDATA[$F{A29}]]></textFieldExpression>
</textField>
</jr:listContents>
</jr:list>
</componentElement>
<componentElement>
<reportElement positionType="Float" x="0" y="60" width="537" height="20" uuid="34c4549c-8ef1-45db-92b0-9d1d927838cc"/>
<jr:list xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" printOrder="Vertical">
<datasetRun subDataset="details1" uuid="dedec0d2-a165-4b83-83d4-42bfeb42d56a">
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("details1")]]></dataSourceExpression>
</datasetRun>
<jr:listContents height="20" width="537">
<textField>
<reportElement x="261" y="0" width="130" height="20" uuid="6adeb567-ee9c-4ecc-aa68-515c346b32cf"/>
<textElement>
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{A15}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="0" width="130" height="20" uuid="f7f01036-0273-4f6c-ac3f-38ec3cf54539"/>
<textElement>
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA["Sub Total for "+$F{A11}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="131" y="0" width="130" height="20" uuid="291fbf2d-1c3b-4f0f-9859-254d2f53c3d5"/>
<textElement>
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{A14}]]></textFieldExpression>
</textField>
</jr:listContents>
</jr:list>
</componentElement>
<line>
<reportElement positionType="Float" x="0" y="100" width="553" height="1" uuid="6c5867d6-c33e-42a4-aeac-8a4a7fd48241"/>
<graphicElement>
<pen lineStyle="Dashed"/>
</graphicElement>
</line>
<textField>
<reportElement positionType="Float" x="0" y="81" width="152" height="20" uuid="9e7ff4bf-7d01-4b4f-9d66-8feb5aa6c481"/>
<textElement>
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA["Sub Total for "+$F{A1}]]></textFieldExpression>
</textField>
<textField>
<reportElement positionType="Float" x="157" y="81" width="130" height="20" uuid="6a126692-43e2-41ce-a650-4c9d919e614e"/>
<textElement>
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{A2}]]></textFieldExpression>
</textField>
<textField>
<reportElement positionType="Float" x="320" y="80" width="130" height="20" uuid="5ad5932f-06da-4cf5-baa8-be2948c146f5"/>
<textElement>
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{A3}]]></textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="13" splitType="Stretch">
<textField>
<reportElement x="237" y="0" width="100" height="13" uuid="371c3279-6e79-47b1-922a-7e892f83bdbf"/>
<textElement textAlignment="Center">
<font fontName="Arial"/>
</textElement>
<textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
</band>
</pageFooter>
<summary>
<band splitType="Stretch"/>
</summary>
</jasperReport>