Commit e929880c authored by Quxl's avatar Quxl

x

parent d337208f
...@@ -2,20 +2,25 @@ package com.egolm.sso.bean; ...@@ -2,20 +2,25 @@ package com.egolm.sso.bean;
import java.util.List; import java.util.List;
public class Z_DT_SD_005_PERFORM_INVOICE { import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamImplicit;
Z_DT_SD_005_PERFORM_INVOICE2 Z_DT_SD_005_PERFORM_INVOICE; @XStreamAlias("Z_MT_SD_005_PERFORM_INVOICE")
public class Z_MT_SD_005_PERFORM_INVOICE {
public static class Z_DT_SD_005_PERFORM_INVOICE2 { 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; HEADER_GENERAL_DATA HEADER_GENERAL_DATA;
List<HEADER_PARTNER_DATA> HEADER_PARTNER_DATA; @XStreamImplicit(itemFieldName="HEADER_PARTNER_DATA")List<HEADER_PARTNER_DATA> HEADER_PARTNER_DATA;
HEADER_DOCU_DATE HEADER_DOCU_DATE; HEADER_DOCU_DATE HEADER_DOCU_DATE;
HEADER_REFERENCE_DATA HEADER_REFERENCE_DATA; HEADER_REFERENCE_DATA HEADER_REFERENCE_DATA;
HEADER_BANK_DATA HEADER_BANK_DATA; HEADER_BANK_DATA HEADER_BANK_DATA;
HEADER_ORGANIZATIONAL_DATA HEADER_ORGANIZATIONAL_DATA; HEADER_ORGANIZATIONAL_DATA HEADER_ORGANIZATIONAL_DATA;
ITEM_DATA ITEM_DATA; @XStreamImplicit(itemFieldName="ITEM_DATA")List<ITEM_DATA> ITEM_DATA;
List<SUMMARY_GENERAL> SUMMARY_GENERAL; @XStreamImplicit(itemFieldName="SUMMARY_GENERAL")List<SUMMARY_GENERAL> SUMMARY_GENERAL;
public HEADER_GENERAL_DATA getHEADER_GENERAL_DATA() { public HEADER_GENERAL_DATA getHEADER_GENERAL_DATA() {
return HEADER_GENERAL_DATA; return HEADER_GENERAL_DATA;
...@@ -65,14 +70,6 @@ public class Z_DT_SD_005_PERFORM_INVOICE { ...@@ -65,14 +70,6 @@ public class Z_DT_SD_005_PERFORM_INVOICE {
HEADER_ORGANIZATIONAL_DATA = hEADER_ORGANIZATIONAL_DATA; HEADER_ORGANIZATIONAL_DATA = hEADER_ORGANIZATIONAL_DATA;
} }
public ITEM_DATA getITEM_DATA() {
return ITEM_DATA;
}
public void setITEM_DATA(ITEM_DATA iTEM_DATA) {
ITEM_DATA = iTEM_DATA;
}
public List<SUMMARY_GENERAL> getSUMMARY_GENERAL() { public List<SUMMARY_GENERAL> getSUMMARY_GENERAL() {
return SUMMARY_GENERAL; return SUMMARY_GENERAL;
} }
...@@ -80,8 +77,17 @@ public class Z_DT_SD_005_PERFORM_INVOICE { ...@@ -80,8 +77,17 @@ public class Z_DT_SD_005_PERFORM_INVOICE {
public void setSUMMARY_GENERAL(List<SUMMARY_GENERAL> sUMMARY_GENERAL) { public void setSUMMARY_GENERAL(List<SUMMARY_GENERAL> sUMMARY_GENERAL) {
SUMMARY_GENERAL = sUMMARY_GENERAL; SUMMARY_GENERAL = sUMMARY_GENERAL;
} }
public List<ITEM_DATA> getITEM_DATA() {
return ITEM_DATA;
}
public void setITEM_DATA(List<ITEM_DATA> iTEM_DATA) {
ITEM_DATA = iTEM_DATA;
}
} }
@XStreamAlias("HEADER_GENERAL_DATA")
public static class HEADER_GENERAL_DATA { public static class HEADER_GENERAL_DATA {
String BELNR; String BELNR;
String ZTERM; String ZTERM;
...@@ -103,6 +109,7 @@ public class Z_DT_SD_005_PERFORM_INVOICE { ...@@ -103,6 +109,7 @@ public class Z_DT_SD_005_PERFORM_INVOICE {
} }
} }
@XStreamAlias("HEADER_PARTNER_DATA")
public static class HEADER_PARTNER_DATA { public static class HEADER_PARTNER_DATA {
String PARVW; String PARVW;
String PARTN; String PARTN;
...@@ -124,6 +131,7 @@ public class Z_DT_SD_005_PERFORM_INVOICE { ...@@ -124,6 +131,7 @@ public class Z_DT_SD_005_PERFORM_INVOICE {
} }
} }
@XStreamAlias("HEADER_DOCU_DATE")
public static class HEADER_DOCU_DATE { public static class HEADER_DOCU_DATE {
String IDDAT; String IDDAT;
String DATUM; String DATUM;
...@@ -145,6 +153,7 @@ public class Z_DT_SD_005_PERFORM_INVOICE { ...@@ -145,6 +153,7 @@ public class Z_DT_SD_005_PERFORM_INVOICE {
} }
} }
@XStreamAlias("HEADER_REFERENCE_DATA")
public static class HEADER_REFERENCE_DATA { public static class HEADER_REFERENCE_DATA {
String QUALF; String QUALF;
String BELNR; String BELNR;
...@@ -175,6 +184,7 @@ public class Z_DT_SD_005_PERFORM_INVOICE { ...@@ -175,6 +184,7 @@ public class Z_DT_SD_005_PERFORM_INVOICE {
} }
} }
@XStreamAlias("HEADER_BANK_DATA")
public static class HEADER_BANK_DATA { public static class HEADER_BANK_DATA {
String ACNUM; String ACNUM;
...@@ -187,6 +197,7 @@ public class Z_DT_SD_005_PERFORM_INVOICE { ...@@ -187,6 +197,7 @@ public class Z_DT_SD_005_PERFORM_INVOICE {
} }
} }
@XStreamAlias("HEADER_ORGANIZATIONAL_DATA")
public static class HEADER_ORGANIZATIONAL_DATA { public static class HEADER_ORGANIZATIONAL_DATA {
String QUALF; String QUALF;
String ORGID; String ORGID;
...@@ -208,6 +219,7 @@ public class Z_DT_SD_005_PERFORM_INVOICE { ...@@ -208,6 +219,7 @@ public class Z_DT_SD_005_PERFORM_INVOICE {
} }
} }
@XStreamAlias("SUMMARY_GENERAL")
public static class SUMMARY_GENERAL { public static class SUMMARY_GENERAL {
String SUMID; String SUMID;
String SUMME; String SUMME;
...@@ -238,12 +250,13 @@ public class Z_DT_SD_005_PERFORM_INVOICE { ...@@ -238,12 +250,13 @@ public class Z_DT_SD_005_PERFORM_INVOICE {
} }
} }
@XStreamAlias("ITEM_DATA")
public static class ITEM_DATA { public static class ITEM_DATA {
ITEM_REFERENCE_DATA ITEM_REFERENCE_DATA; ITEM_REFERENCE_DATA ITEM_REFERENCE_DATA;
ITEM_MATERIAL_DATA ITEM_MATERIAL_DATA; ITEM_MATERIAL_DATA ITEM_MATERIAL_DATA;
List<ITEM_AMOUNT_DATA> ITEM_AMOUNT_DATA; @XStreamImplicit(itemFieldName="ITEM_AMOUNT_DATA")List<ITEM_AMOUNT_DATA> ITEM_AMOUNT_DATA;
ITEM_VAT_DATA ITEM_VAT_DATA; ITEM_VAT_DATA ITEM_VAT_DATA;
List<ITEM_REFERENCE_PO_TYPE> ITEM_REFERENCE_PO_TYPE; @XStreamImplicit(itemFieldName="ITEM_REFERENCE_PO_TYPE")List<ITEM_REFERENCE_PO_TYPE> ITEM_REFERENCE_PO_TYPE;
String POSEX; String POSEX;
String MENGE; String MENGE;
String MENEE; String MENEE;
...@@ -322,6 +335,7 @@ public class Z_DT_SD_005_PERFORM_INVOICE { ...@@ -322,6 +335,7 @@ public class Z_DT_SD_005_PERFORM_INVOICE {
} }
} }
@XStreamAlias("ITEM_REFERENCE_DATA")
public static class ITEM_REFERENCE_DATA { public static class ITEM_REFERENCE_DATA {
String QUALF; String QUALF;
String BELNR; String BELNR;
...@@ -379,6 +393,7 @@ public class Z_DT_SD_005_PERFORM_INVOICE { ...@@ -379,6 +393,7 @@ public class Z_DT_SD_005_PERFORM_INVOICE {
} }
} }
@XStreamAlias("ITEM_MATERIAL_DATA")
public static class ITEM_MATERIAL_DATA { public static class ITEM_MATERIAL_DATA {
String QUALF; String QUALF;
String IDTNR; String IDTNR;
...@@ -400,6 +415,7 @@ public class Z_DT_SD_005_PERFORM_INVOICE { ...@@ -400,6 +415,7 @@ public class Z_DT_SD_005_PERFORM_INVOICE {
} }
} }
@XStreamAlias("ITEM_AMOUNT_DATA")
public static class ITEM_AMOUNT_DATA { public static class ITEM_AMOUNT_DATA {
String QUALF; String QUALF;
String BETRG; String BETRG;
...@@ -421,6 +437,7 @@ public class Z_DT_SD_005_PERFORM_INVOICE { ...@@ -421,6 +437,7 @@ public class Z_DT_SD_005_PERFORM_INVOICE {
} }
} }
@XStreamAlias("ITEM_VAT_DATA")
public static class ITEM_VAT_DATA { public static class ITEM_VAT_DATA {
String MWSKZ; String MWSKZ;
String MWSBT; String MWSBT;
...@@ -442,6 +459,7 @@ public class Z_DT_SD_005_PERFORM_INVOICE { ...@@ -442,6 +459,7 @@ public class Z_DT_SD_005_PERFORM_INVOICE {
} }
} }
@XStreamAlias("ITEM_REFERENCE_PO_TYPE")
public static class ITEM_REFERENCE_PO_TYPE { public static class ITEM_REFERENCE_PO_TYPE {
ITEM_REFERENCE_PO_DATA ITEM_REFERENCE_PO_DATA; ITEM_REFERENCE_PO_DATA ITEM_REFERENCE_PO_DATA;
String TDID; String TDID;
...@@ -463,6 +481,7 @@ public class Z_DT_SD_005_PERFORM_INVOICE { ...@@ -463,6 +481,7 @@ public class Z_DT_SD_005_PERFORM_INVOICE {
} }
} }
@XStreamAlias("ITEM_REFERENCE_PO_DATA")
public static class ITEM_REFERENCE_PO_DATA { public static class ITEM_REFERENCE_PO_DATA {
String TDLINE; String TDLINE;
......
package com.egolm.sso.service.impl; package com.egolm.sso.service.impl;
import java.io.IOException;
import javax.jws.WebService; import javax.jws.WebService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import com.egolm.sso.bean.Z_DT_SD_005_PERFORM_INVOICE; import com.egolm.sso.bean.Z_MT_SD_005_PERFORM_INVOICE;
import com.egolm.sso.bean.Z_DT_SD_005_PERFORM_INVOICE.HEADER_BANK_DATA;
import com.egolm.sso.bean.Z_DT_SD_005_PERFORM_INVOICE.HEADER_DOCU_DATE;
import com.egolm.sso.bean.Z_DT_SD_005_PERFORM_INVOICE.HEADER_GENERAL_DATA;
import com.egolm.sso.bean.Z_DT_SD_005_PERFORM_INVOICE.HEADER_ORGANIZATIONAL_DATA;
import com.egolm.sso.bean.Z_DT_SD_005_PERFORM_INVOICE.HEADER_PARTNER_DATA;
import com.egolm.sso.bean.Z_DT_SD_005_PERFORM_INVOICE.HEADER_REFERENCE_DATA;
import com.egolm.sso.bean.Z_DT_SD_005_PERFORM_INVOICE.ITEM_AMOUNT_DATA;
import com.egolm.sso.bean.Z_DT_SD_005_PERFORM_INVOICE.ITEM_DATA;
import com.egolm.sso.bean.Z_DT_SD_005_PERFORM_INVOICE.ITEM_MATERIAL_DATA;
import com.egolm.sso.bean.Z_DT_SD_005_PERFORM_INVOICE.ITEM_REFERENCE_DATA;
import com.egolm.sso.bean.Z_DT_SD_005_PERFORM_INVOICE.ITEM_REFERENCE_PO_DATA;
import com.egolm.sso.bean.Z_DT_SD_005_PERFORM_INVOICE.ITEM_REFERENCE_PO_TYPE;
import com.egolm.sso.bean.Z_DT_SD_005_PERFORM_INVOICE.ITEM_VAT_DATA;
import com.egolm.sso.bean.Z_DT_SD_005_PERFORM_INVOICE.SUMMARY_GENERAL;
import com.egolm.sso.bean.Z_DT_SD_005_PERFORM_INVOICE.Z_DT_SD_005_PERFORM_INVOICE2;
import com.egolm.sso.service.CommonService; import com.egolm.sso.service.CommonService;
import com.egolm.sso.service.ProFormaInvoiceService; import com.egolm.sso.service.ProFormaInvoiceService;
import com.egolm.sso.util.FileUtil;
import com.egolm.sso.util.XMLUtil;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.thoughtworks.xstream.XStream;
@Component @Component
@WebService(serviceName = "ProFormaInvoiceService", targetNamespace = "http://pro_forma_invoice.sso.egolm.com", endpointInterface = "com.egolm.sso.service.ProFormaInvoiceService") @WebService(serviceName = "ProFormaInvoiceService", targetNamespace = "http://pro_forma_invoice.sso.egolm.com", endpointInterface = "com.egolm.sso.service.ProFormaInvoiceService")
...@@ -39,30 +27,13 @@ public class ProFormaInvoiceServiceImpl implements ProFormaInvoiceService { ...@@ -39,30 +27,13 @@ public class ProFormaInvoiceServiceImpl implements ProFormaInvoiceService {
@Override @Override
public void execute(String xml) { public void execute(String xml) {
XStream xStream = new XStream(); Z_MT_SD_005_PERFORM_INVOICE Z_MT_SD_005_PERFORM_INVOICE = XMLUtil.toBean(xml, Z_MT_SD_005_PERFORM_INVOICE.class);
xStream.alias("Z_DT_SD_005_PERFORM_INVOICE",Z_DT_SD_005_PERFORM_INVOICE2.class); System.out.println(new Gson().toJson(Z_MT_SD_005_PERFORM_INVOICE));
xStream.alias("HEADER_GENERAL_DATA",HEADER_GENERAL_DATA.class); }
xStream.alias("HEADER_PARTNER_DATA", HEADER_PARTNER_DATA.class);
xStream.alias("HEADER_DOCU_DATE", HEADER_DOCU_DATE.class); public static void main(String[] args) throws IOException {
xStream.alias("HEADER_REFERENCE_DATA", HEADER_REFERENCE_DATA.class); new ProFormaInvoiceServiceImpl().execute(FileUtil.readText("D:/data/sso/005.XML"));
xStream.alias("HEADER_BANK_DATA", HEADER_BANK_DATA.class);
xStream.alias("HEADER_ORGANIZATIONAL_DATA", HEADER_ORGANIZATIONAL_DATA.class);
xStream.alias("SUMMARY_GENERAL", SUMMARY_GENERAL.class);
xStream.alias("ITEM_DATA", ITEM_DATA.class);
xStream.alias("ITEM_REFERENCE_DATA", ITEM_REFERENCE_DATA.class);
xStream.alias("ITEM_MATERIAL_DATA", ITEM_MATERIAL_DATA.class);
xStream.alias("ITEM_AMOUNT_DATA", ITEM_AMOUNT_DATA.class);
xStream.alias("ITEM_VAT_DATA", ITEM_VAT_DATA.class);
xStream.alias("ITEM_REFERENCE_PO_TYPE", ITEM_REFERENCE_PO_TYPE.class);
xStream.alias("ITEM_REFERENCE_PO_DATA", ITEM_REFERENCE_PO_DATA.class);
Z_DT_SD_005_PERFORM_INVOICE Z_DT_SD_005_PERFORM_INVOICE = (Z_DT_SD_005_PERFORM_INVOICE)xStream.fromXML(xml);
System.out.println(new Gson().toJson(Z_DT_SD_005_PERFORM_INVOICE));
} }
} }
package com.egolm.sso.util;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
public class FileUtil {
public static String readText(String path) throws IOException {
BufferedReader br = null;
try {
br = new BufferedReader(new InputStreamReader(new FileInputStream(path)));
String line = null;
StringBuffer sb = new StringBuffer();
while ((line = br.readLine()) != null) {
sb.append(line);
}
return sb.toString();
} finally {
br.close();
}
}
}
package com.egolm.sso.util;
import com.thoughtworks.xstream.XStream;
public class XMLUtil {
public static <T> T toBean(String XML, Class<T> requireType) {
XStream xStream = new XStream();
XStream.setupDefaultSecurity(xStream);
xStream.allowTypesByWildcard(new String[] {"com.egolm.sso.bean.**"});
xStream.autodetectAnnotations(true);
xStream.processAnnotations(requireType);
@SuppressWarnings("unchecked")
T bean = (T)xStream.fromXML(XML);
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