Commit 9834809f authored by Quxl's avatar Quxl

x

parent 2dd94e07
......@@ -2,25 +2,30 @@ package com.egolm.sso.bean;
import java.util.List;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamImplicit;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
@XStreamAlias("ns0:Z_MT_SD_005_PERFORM_INVOICE")
@XmlType
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name="Z_MT_SD_005_PERFORM_INVOICE", namespace="http://schneider-distributor.com/")
public class Z_MT_SD_005_PERFORM_INVOICE {
Z_DT_SD_005_PERFORM_INVOICE Z_DT_SD_005_PERFORM_INVOICE;
@XStreamAlias("Z_DT_SD_005_PERFORM_INVOICE")
public static class Z_DT_SD_005_PERFORM_INVOICE {
HEADER_GENERAL_DATA HEADER_GENERAL_DATA;
@XStreamImplicit(itemFieldName="HEADER_PARTNER_DATA")List<HEADER_PARTNER_DATA> HEADER_PARTNER_DATA;
List<HEADER_PARTNER_DATA> HEADER_PARTNER_DATA;
HEADER_DOCU_DATE HEADER_DOCU_DATE;
HEADER_REFERENCE_DATA HEADER_REFERENCE_DATA;
HEADER_BANK_DATA HEADER_BANK_DATA;
HEADER_ORGANIZATIONAL_DATA HEADER_ORGANIZATIONAL_DATA;
@XStreamImplicit(itemFieldName="ITEM_DATA")List<ITEM_DATA> ITEM_DATA;
@XStreamImplicit(itemFieldName="SUMMARY_GENERAL")List<SUMMARY_GENERAL> SUMMARY_GENERAL;
List<ITEM_DATA> ITEM_DATA;
List<SUMMARY_GENERAL> SUMMARY_GENERAL;
public HEADER_GENERAL_DATA getHEADER_GENERAL_DATA() {
return HEADER_GENERAL_DATA;
......@@ -87,7 +92,6 @@ public class Z_MT_SD_005_PERFORM_INVOICE {
}
}
@XStreamAlias("HEADER_GENERAL_DATA")
public static class HEADER_GENERAL_DATA {
String BELNR;
String ZTERM;
......@@ -109,7 +113,6 @@ public class Z_MT_SD_005_PERFORM_INVOICE {
}
}
@XStreamAlias("HEADER_PARTNER_DATA")
public static class HEADER_PARTNER_DATA {
String PARVW;
String PARTN;
......@@ -131,7 +134,6 @@ public class Z_MT_SD_005_PERFORM_INVOICE {
}
}
@XStreamAlias("HEADER_DOCU_DATE")
public static class HEADER_DOCU_DATE {
String IDDAT;
String DATUM;
......@@ -153,7 +155,6 @@ public class Z_MT_SD_005_PERFORM_INVOICE {
}
}
@XStreamAlias("HEADER_REFERENCE_DATA")
public static class HEADER_REFERENCE_DATA {
String QUALF;
String BELNR;
......@@ -184,7 +185,6 @@ public class Z_MT_SD_005_PERFORM_INVOICE {
}
}
@XStreamAlias("HEADER_BANK_DATA")
public static class HEADER_BANK_DATA {
String ACNUM;
......@@ -197,7 +197,6 @@ public class Z_MT_SD_005_PERFORM_INVOICE {
}
}
@XStreamAlias("HEADER_ORGANIZATIONAL_DATA")
public static class HEADER_ORGANIZATIONAL_DATA {
String QUALF;
String ORGID;
......@@ -219,7 +218,6 @@ public class Z_MT_SD_005_PERFORM_INVOICE {
}
}
@XStreamAlias("SUMMARY_GENERAL")
public static class SUMMARY_GENERAL {
String SUMID;
String SUMME;
......@@ -250,13 +248,12 @@ public class Z_MT_SD_005_PERFORM_INVOICE {
}
}
@XStreamAlias("ITEM_DATA")
public static class ITEM_DATA {
ITEM_REFERENCE_DATA ITEM_REFERENCE_DATA;
ITEM_MATERIAL_DATA ITEM_MATERIAL_DATA;
@XStreamImplicit(itemFieldName="ITEM_AMOUNT_DATA")List<ITEM_AMOUNT_DATA> ITEM_AMOUNT_DATA;
List<ITEM_AMOUNT_DATA> ITEM_AMOUNT_DATA;
ITEM_VAT_DATA ITEM_VAT_DATA;
@XStreamImplicit(itemFieldName="ITEM_REFERENCE_PO_TYPE")List<ITEM_REFERENCE_PO_TYPE> ITEM_REFERENCE_PO_TYPE;
List<ITEM_REFERENCE_PO_TYPE> ITEM_REFERENCE_PO_TYPE;
String POSEX;
String MENGE;
String MENEE;
......@@ -335,7 +332,6 @@ public class Z_MT_SD_005_PERFORM_INVOICE {
}
}
@XStreamAlias("ITEM_REFERENCE_DATA")
public static class ITEM_REFERENCE_DATA {
String QUALF;
String BELNR;
......@@ -393,7 +389,6 @@ public class Z_MT_SD_005_PERFORM_INVOICE {
}
}
@XStreamAlias("ITEM_MATERIAL_DATA")
public static class ITEM_MATERIAL_DATA {
String QUALF;
String IDTNR;
......@@ -415,7 +410,6 @@ public class Z_MT_SD_005_PERFORM_INVOICE {
}
}
@XStreamAlias("ITEM_AMOUNT_DATA")
public static class ITEM_AMOUNT_DATA {
String QUALF;
String BETRG;
......@@ -437,7 +431,6 @@ public class Z_MT_SD_005_PERFORM_INVOICE {
}
}
@XStreamAlias("ITEM_VAT_DATA")
public static class ITEM_VAT_DATA {
String MWSKZ;
String MWSBT;
......@@ -459,7 +452,6 @@ public class Z_MT_SD_005_PERFORM_INVOICE {
}
}
@XStreamAlias("ITEM_REFERENCE_PO_TYPE")
public static class ITEM_REFERENCE_PO_TYPE {
ITEM_REFERENCE_PO_DATA ITEM_REFERENCE_PO_DATA;
String TDID;
......@@ -481,7 +473,6 @@ public class Z_MT_SD_005_PERFORM_INVOICE {
}
}
@XStreamAlias("ITEM_REFERENCE_PO_DATA")
public static class ITEM_REFERENCE_PO_DATA {
String TDLINE;
......@@ -494,4 +485,12 @@ public class Z_MT_SD_005_PERFORM_INVOICE {
}
}
public Z_DT_SD_005_PERFORM_INVOICE getZ_DT_SD_005_PERFORM_INVOICE() {
return Z_DT_SD_005_PERFORM_INVOICE;
}
public void setZ_DT_SD_005_PERFORM_INVOICE(Z_DT_SD_005_PERFORM_INVOICE z_DT_SD_005_PERFORM_INVOICE) {
Z_DT_SD_005_PERFORM_INVOICE = z_DT_SD_005_PERFORM_INVOICE;
}
}
......@@ -3,6 +3,7 @@ package com.egolm.sso.service.impl;
import java.io.IOException;
import javax.jws.WebService;
import javax.xml.bind.JAXBException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
......@@ -27,8 +28,13 @@ public class ProFormaInvoiceServiceImpl implements ProFormaInvoiceService {
@Override
public void execute(String xml) {
Z_MT_SD_005_PERFORM_INVOICE Z_MT_SD_005_PERFORM_INVOICE = XMLUtil.toBean(xml, Z_MT_SD_005_PERFORM_INVOICE.class);
System.out.println(new Gson().toJson(Z_MT_SD_005_PERFORM_INVOICE));
try {
Z_MT_SD_005_PERFORM_INVOICE bean = XMLUtil.toBeanByJxab(xml, Z_MT_SD_005_PERFORM_INVOICE.class);
System.out.println(new Gson().toJson(bean));
} catch (JAXBException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static void main(String[] args) throws IOException {
......
package com.egolm.sso.util;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
public class FileUtil {
......@@ -22,4 +25,9 @@ public class FileUtil {
}
}
public static void writeText(String path, String text) throws IOException {
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(path)));
writer.write(text);
writer.close();
}
}
package com.egolm.sso.util;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import com.thoughtworks.xstream.XStream;
public class XMLUtil {
......@@ -15,4 +22,14 @@ public class XMLUtil {
return bean;
}
public static <T> T toBeanByJxab(String XML, Class<T> requireType) throws JAXBException {
JAXBContext jc = JAXBContext.newInstance(requireType);
Unmarshaller uma = jc.createUnmarshaller();
InputStream inputStream = new ByteArrayInputStream(XML.getBytes());
@SuppressWarnings("unchecked")
T bean = (T) uma.unmarshal(inputStream);
return bean;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment