Commit a3d56184 authored by Quxl's avatar Quxl

x

parents
Pipeline #154 failed with stages
/target/
/.settings/
/.classpath
/.project
/application.properties
/bin/
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.egolm</groupId>
<artifactId>sap-service</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<start-class>com.egolm.sso.SSOApplication</start-class>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.0.RELEASE</version>
</parent>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Finchley.SR2</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-spring-boot-starter-jaxws</artifactId>
<version>3.3.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.38</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.1.17</version>
</dependency>
<dependency>
<groupId>org.apache.ws.security</groupId>
<artifactId>wss4j</artifactId>
<version>1.6.19</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-ws-security</artifactId>
<version>3.3.2</version>
</dependency>
<dependency>
<groupId>org.apache.santuario</groupId>
<artifactId>xmlsec</artifactId>
<version>2.1.3</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>3.2.2</version>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>${start-class}</mainClass>
<layout>ZIP</layout>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
package com.egolm.sso;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@EnableScheduling
@EnableTransactionManagement
@SpringBootApplication(scanBasePackages= {"com.schneider_distributor", "com.egolm.sso"})
public class SSOApplication {
private static ApplicationContext applicationContext;
public static void main(String[] args) {
applicationContext = SpringApplication.run(SSOApplication.class, args);
}
public static ApplicationContext getApplicationContext() {
return applicationContext;
}
public static Object getBean(String name){
return getApplicationContext().getBean(name);
}
public static <T> T getBean(Class<T> clazz){
return getApplicationContext().getBean(clazz);
}
public static <T> T getBean(String name, Class<T> clazz){
return getApplicationContext().getBean(name, clazz);
}
}
package com.egolm.sso.config;
import javax.sql.DataSource;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.transaction.PlatformTransactionManager;
import com.alibaba.druid.pool.DruidDataSource;
@Configuration
public class DataSourceConfig {
@Bean
@Primary
@ConfigurationProperties(prefix = "spring.datasource")
public DataSource getDataSource() {
return DataSourceBuilder.create().type(DruidDataSource.class).build();
}
@Bean
@Primary
public PlatformTransactionManager getTransactionManager(DataSource dataSource) {
return new DataSourceTransactionManager(dataSource);
}
@Bean
@Primary
public JdbcTemplate getJdbcTemplate(DataSource dataSource) {
JdbcTemplate jdbcTemplate = new JdbcTemplate();
jdbcTemplate.setDataSource(dataSource);
return jdbcTemplate;
}
}
\ No newline at end of file
package com.egolm.sso.config;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.xml.ws.Endpoint;
import org.apache.cxf.Bus;
import org.apache.cxf.jaxws.EndpointImpl;
import org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor;
import org.apache.ws.security.WSConstants;
import org.apache.ws.security.handler.WSHandlerConstants;
import org.apache.wss4j.common.ext.WSPasswordCallback;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.egolm.sso.services.confirm_quotation.ConfirmQuotationService;
import com.egolm.sso.services.dn_deletion.DNDeletionService;
import com.egolm.sso.services.material_master.MaterialMasterService;
import com.egolm.sso.services.prforma_invoice.PrformaInvoiceService;
import com.egolm.sso.services.price_list.PriceListService;
import com.egolm.sso.services.shipping_notfirmation.ShippingNotificationService;
@Configuration
public class WsConfig {
@Autowired
private Bus bus;
@Autowired
WSS4JInInterceptor authInterceptor;
@Bean
public Endpoint getMaterialMasterPoint(MaterialMasterService materialMasterService) {
EndpointImpl endpoint = new EndpointImpl(bus, materialMasterService);
endpoint.setInInterceptors(Arrays.asList(authInterceptor));
endpoint.publish("/material_master");
return endpoint;
}
@Bean
public Endpoint getPriceListPoint(PriceListService priceListService) {
EndpointImpl endpoint = new EndpointImpl(bus, priceListService);
endpoint.setInInterceptors(Arrays.asList(authInterceptor));
endpoint.publish("/price_list");
return endpoint;
}
@Bean
public Endpoint getProFormaInvoicePoint(PrformaInvoiceService priceListService) {
EndpointImpl endpoint = new EndpointImpl(bus, priceListService);
endpoint.setInInterceptors(Arrays.asList(authInterceptor));
endpoint.publish("/prforma_invoice");
return endpoint;
}
@Bean
public Endpoint getSoConfirmQuotationPoint(ConfirmQuotationService soConfirmQuotationService) {
EndpointImpl endpoint = new EndpointImpl(bus, soConfirmQuotationService);
endpoint.setInInterceptors(Arrays.asList(authInterceptor));
endpoint.publish("/confirm_quotation");
return endpoint;
}
@Bean
public Endpoint getShippingNotificationPoint(ShippingNotificationService shippingNotificationService) {
EndpointImpl endpoint = new EndpointImpl(bus, shippingNotificationService);
endpoint.setInInterceptors(Arrays.asList(authInterceptor));
endpoint.publish("/shipping_notification");
return endpoint;
}
@Bean
public Endpoint getDNDeletionPoint(DNDeletionService deletionService) {
EndpointImpl endpoint = new EndpointImpl(bus, deletionService);
endpoint.setInInterceptors(Arrays.asList(authInterceptor));
endpoint.publish("/dn_deletion");
return endpoint;
}
@Value("${wsUsername}")
private String wsUername;
@Value("${wsPassword}")
private String wsPassword;
@Bean
public WSS4JInInterceptor getWSS4JInInterceptor() {
Map<String, Object> properties = new HashMap<String, Object>();
properties.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN);
properties.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_DIGEST);
properties.put(WSHandlerConstants.PW_CALLBACK_REF, new CallbackHandler() {
public void handle(Callback[] callbacks) {
for (int i = 0; i < callbacks.length; i++) {
WSPasswordCallback pc = (WSPasswordCallback) callbacks[i];
String username = pc.getIdentifier();
if (username.equals(wsUername)) {
pc.setPassword(wsPassword);
}
}
}
});
WSS4JInInterceptor interceptor = new WSS4JInInterceptor(properties);
return interceptor;
}
}
package com.egolm.sso.config;
public class XRException extends RuntimeException {
private static final long serialVersionUID = 1L;
public XRException(String msg) {
super(msg);
}
public XRException(String msg, Throwable e) {
super(msg, e);
}
public XRException(String msg, int code) {
super(msg);
}
public XRException(String msg, int code, Throwable e) {
super(msg, e);
}
public static void assertNotBlank(String message, Object... objs) {
for(Object obj : objs) {
if(obj == null || obj.toString().trim().equals("")) {
throw new XRException((message == null || message.trim().equals("")) ? "对象不能为空" : message);
}
}
}
}
package com.egolm.sso.services;
import java.text.MessageFormat;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import com.egolm.sso.config.XRException;
@Service
public class CommonService {
@Autowired
private JdbcTemplate jdbcTemplate;
public Long getNextval(String sName) {
try {
Map<String, Object> seqMap = jdbcTemplate.queryForMap("select * from sequence where name = ?", sName);
Integer id = (Integer)seqMap.get("id");
Long step = (Long)seqMap.get("step");
Long max = (Long)seqMap.get("max");
Long min = (Long)seqMap.get("min");
Long value = (Long)seqMap.get("value");
Long nextValue = value + step;
if(value > max || value < min) {
throw new XRException(MessageFormat.format("序列已超出许可范围[{0}]", sName));
} else {
String sql = "update sequence set value = ? where id = ? and value < ?";
int count = jdbcTemplate.update(sql, nextValue, id, nextValue);
if(count == 1) {
return value;
} else if(count == 0) {
return this.getNextval(sName);
} else {
throw new XRException(MessageFormat.format("序列错误[{0}]", sName));
}
}
} catch (EmptyResultDataAccessException e) {
String sql = "insert into sequence (name, max, min, step, value) values (?, ?, ?, ?, ?)";
jdbcTemplate.update(sql, sName, Long.MAX_VALUE, 1L, 1L, 1L);
return this.getNextval(sName);
}
}
}
package com.egolm.sso.services.confirm_quotation;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService(targetNamespace = "http://confirm_quotation.sso.egolm.com")
public interface ConfirmQuotationService {
@WebMethod
public void execute(Z_MT_SD_008_SO_CONFIRM_QUOTATION Z_MT_SD_008_SO_CONFIRM_QUOTATION);
}
package com.egolm.sso.services.confirm_quotation;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import javax.jws.WebService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import com.alibaba.fastjson.JSON;
import com.egolm.sso.services.CommonService;
import com.egolm.sso.services.confirm_quotation.Z_MT_SD_008_SO_CONFIRM_QUOTATION.HEADER;
import com.egolm.sso.services.confirm_quotation.Z_MT_SD_008_SO_CONFIRM_QUOTATION.ITEM_DATA;
import com.egolm.sso.services.confirm_quotation.Z_MT_SD_008_SO_CONFIRM_QUOTATION.ITEM_PRICING;
import com.egolm.sso.services.confirm_quotation.Z_MT_SD_008_SO_CONFIRM_QUOTATION.RESPONSE;
import com.egolm.sso.util.DateUtil;
import com.egolm.sso.util.StringUtil;
@Component
@WebService(serviceName = "ConfirmQuotationService", targetNamespace = "http://confirm_quotation.sso.egolm.com", endpointInterface = "com.egolm.sso.services.confirm_quotation.ConfirmQuotationService")
public class ConfirmQuotationServiceImpl implements ConfirmQuotationService {
@Autowired
JdbcTemplate jdbcTemplate;
@Autowired
CommonService common;
@Override
@Transactional
public void execute(Z_MT_SD_008_SO_CONFIRM_QUOTATION Z_MT_SD_008_SO_CONFIRM_QUOTATION) {
Date now = new Date();
String today = DateUtil.formatDate(now, DateUtil.FMT_DATE);
Long time = now.getTime();
System.out.println(JSON.toJSONString(Z_MT_SD_008_SO_CONFIRM_QUOTATION));
Map<String, Object> header = new HashMap<>();
RESPONSE res = Z_MT_SD_008_SO_CONFIRM_QUOTATION.getRESPONSE();
HEADER h = res.getHEADER();
header.put("BSTKD_E", h.getBSTKD_E());
header.put("VBELN", h.getVBELN());
header.put("VKORG", h.getVKORG());
header.put("VTWEG", h.getVTWEG());
header.put("SPART", h.getSPART());
header.put("ERNAM", h.getERNAM());
header.put("BSTDK", DateUtil.parseDateNoEmpty(h.getBSTDK(), DateUtil.FMT_DATE));
header.put("ERZET", DateUtil.parseDateNoEmpty(h.getERZET(), DateUtil.FMT_TIME));
header.put("ERDAT", DateUtil.parseDateNoEmpty(h.getERDAT(), DateUtil.FMT_DATE));
header.put("KUNNR", h.getKUNNR());
header.put("KGNNR", h.getKGNNR());
header.put("NAME1", h.getNAME1());
header.put("NAME2", h.getNAME2());
header.put("POSTL_COD1", h.getPOSTL_COD1());
header.put("CITY1", h.getCITY1());
header.put("ZZPROM", h.getZZPROM());
header.put("BSTKD", h.getBSTKD());
header.put("AUART", h.getAUART());
header.put("CMGST", h.getCMGST());
header.put("NETWRH", StringUtil.toDouble(h.getNETWRH()));
header.put("MWSTH", StringUtil.toDouble(h.getMWSTH()));
header.put("WAERK", h.getWAERK());
header.put("DPFLAG", h.getDPFLAG());
header.put("SEND_STATUS", "N");
header.put("BATCH", today+common.getNextval("T_SO_CONFIRMACTION_HEADER_BATCH_")+today);
header.put("CREATED", now);
header.put("CREATEDBY", "system");
String idIndex = StringUtil.format(common.getNextval("T_SO_CONFIRMATION_HEADER_ID_"+today), "00000");
Long hID = Long.valueOf(time+idIndex);
header.put("ID", hID);
header.put("TRACE_NO", "sapsoconfirmquotation"+DateUtil.formatDate(now, DateUtil.FMT_DATETIME));
insertTo(header, "t_so_confirmation_header");
List<ITEM_DATA> ids = res.getITEM_DATA();
Map<String, Map<String, Object>> itemDatas = new HashMap<>();
for(ITEM_DATA id : ids) {
Map<String, Object> itemData = new HashMap<>();
itemData.put("BSTKD_E", h.getBSTKD_E());
itemData.put("VBELN", h.getVBELN());
itemData.put("HEADER_ID", hID);
itemData.put("POSNR", id.getPOSNR());
itemData.put("UEPOS", id.getUEPOS());
itemData.put("VTEXT", id.getVTEXT());
itemData.put("MATNR", id.getMATNR());
itemData.put("KWMENG", StringUtil.toDouble(id.getKWMENG()));
itemData.put("VRKME", id.getVRKME());
itemData.put("EDATU", DateUtil.parseDateNoEmpty(id.getEDATU(), DateUtil.FMT_DATE));
itemData.put("CDATE", DateUtil.parseDateNoEmpty(id.getCDATE(), DateUtil.FMT_DATE));
itemData.put("REFLAG", id.getREFLAG());
itemData.put("MWSTI", StringUtil.toDouble(id.getMWSTI()));
itemData.put("NETWRI", StringUtil.toDouble(id.getNETWRI()));
itemData.put("WAERK_I", id.getWAERK_I());
itemData.put("WERKS", id.getWERKS());
itemData.put("ZZCRDDATE", DateUtil.parseDateNoEmpty(id.getZZCRDDATE(), DateUtil.FMT_DATE));
itemData.put("KGNNR_I", id.getKGNNR_I());
itemData.put("NAME1_I", id.getNAME1_I());
itemData.put("NAME2_I", id.getNAME2_I());
itemData.put("POSTL_CODE1_I", id.getPOSTL_COD1_I());
itemData.put("CITY1_I", id.getCITY1_I());
itemData.put("CREATED", now);
itemData.put("CREATEDBY", "system");
String iidIndex = StringUtil.format(common.getNextval("T_SO_CONFIRMATION_ITEM_DATA_ID_"+today), "00000");
Long iID = Long.valueOf(time+iidIndex);
itemData.put("ID", iID);
itemDatas.put(id.getPOSNR(), itemData);
insertTo(itemData, "t_so_confirmation_item_data");
}
List<ITEM_PRICING> ips = res.getITEM_PRICING();
for(ITEM_PRICING ip : ips) {
Map<String, Object> itemPricing = new HashMap<>();
itemPricing.put("HEADER_ID", hID);
String POSNR = ip.getPOSNR();
itemPricing.put("ITEM_DATA_ID", itemDatas.get(POSNR).get("ID"));
itemPricing.put("BSTKD_E", h.getBSTKD_E());
itemPricing.put("VBELN", h.getVBELN());
itemPricing.put("POSNR", POSNR);
itemPricing.put("KSCHL", ip.getKSCHL());
itemPricing.put("VTEXT", ip.getVTEXT());
itemPricing.put("KBETR", StringUtil.toDouble(ip.getKBETR()));
itemPricing.put("KWERT", StringUtil.toDouble(ip.getKWERT()));
itemPricing.put("CREATED", now);
itemPricing.put("CREATEDBY", "system");
String itemPricingID = StringUtil.format(common.getNextval("T_SO_CONFIRMATION_ITEM_PRICING_ID_"+today), "00000");
itemPricing.put("ID", Long.valueOf(time+itemPricingID));
insertTo(itemPricing, "t_so_confirmation_item_pricing");
}
}
private void insertTo(Map<String, Object> obj, String table) {
String insertSql = "insert into "+table+" ";
String fieldSql = "(";
String valuesSql = "(";
List<Object> values = new ArrayList<>();
for(Entry<String, Object> entry : obj.entrySet()) {
Object value = entry.getValue();
if(value!=null) {
fieldSql = fieldSql + entry.getKey() + ", ";
valuesSql = valuesSql + "?, ";
values.add(entry.getValue());
}
}
fieldSql = fieldSql.substring(0, fieldSql.length()-2);
valuesSql = valuesSql.substring(0, valuesSql.length()-2);
insertSql = insertSql + fieldSql + ") values " + valuesSql + ")";
System.out.println(JSON.toJSONString(values));
jdbcTemplate.update(insertSql, values.toArray());
}
}
package com.egolm.sso.services.confirm_quotation;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
@XmlRootElement(name="Z_MT_SD_008_SO_CONFIRM_QUOTATION", namespace="http://schneider-distributor.com/")
@XmlType(name = "Z_MT_SD_008_SO_CONFIRM_QUOTATION")
@XmlAccessorType(XmlAccessType.FIELD)
public class Z_MT_SD_008_SO_CONFIRM_QUOTATION {
RESPONSE RESPONSE;
public RESPONSE getRESPONSE() {
return RESPONSE;
}
public void setRESPONSE(RESPONSE rESPONSE) {
RESPONSE = rESPONSE;
}
@XmlType(name = "RESPONSE")
@XmlAccessorType(XmlAccessType.FIELD)
public static class RESPONSE {
String VBELN;
String MESSAGE;
HEADER HEADER;
List<ITEM_DATA> ITEM_DATA;
List<ITEM_PRICING> ITEM_PRICING;
public String getVBELN() {
return VBELN;
}
public void setVBELN(String vBELN) {
VBELN = vBELN;
}
public String getMESSAGE() {
return MESSAGE;
}
public void setMESSAGE(String mESSAGE) {
MESSAGE = mESSAGE;
}
public HEADER getHEADER() {
return HEADER;
}
public void setHEADER(HEADER hEADER) {
HEADER = hEADER;
}
public List<ITEM_DATA> getITEM_DATA() {
return ITEM_DATA;
}
public void setITEM_DATA(List<ITEM_DATA> iTEM_DATA) {
ITEM_DATA = iTEM_DATA;
}
public List<ITEM_PRICING> getITEM_PRICING() {
return ITEM_PRICING;
}
public void setITEM_PRICING(List<ITEM_PRICING> iTEM_PRICING) {
ITEM_PRICING = iTEM_PRICING;
}
}
@XmlType(name = "HEADER")
@XmlAccessorType(XmlAccessType.FIELD)
public static class HEADER {
String BSTKD_E;
String VBELN;
String VKORG;
String VTWEG;
String SPART;
String ERNAM;
String BSTDK;
String ERZET;
String ERDAT;
String KUNNR;
String KGNNR;
String NAME1;
String NAME2;
String POSTL_COD1;
String CITY1;
String ZZPROM;
String BSTKD;
String AUART;
String CMGST;
String NETWRH;
String MWSTH;
String WAERK;
String DPFLAG;
public String getBSTKD_E() {
return BSTKD_E;
}
public void setBSTKD_E(String bSTKD_E) {
BSTKD_E = bSTKD_E;
}
public String getVBELN() {
return VBELN;
}
public void setVBELN(String vBELN) {
VBELN = vBELN;
}
public String getVKORG() {
return VKORG;
}
public void setVKORG(String vKORG) {
VKORG = vKORG;
}
public String getVTWEG() {
return VTWEG;
}
public void setVTWEG(String vTWEG) {
VTWEG = vTWEG;
}
public String getSPART() {
return SPART;
}
public void setSPART(String sPART) {
SPART = sPART;
}
public String getERNAM() {
return ERNAM;
}
public void setERNAM(String eRNAM) {
ERNAM = eRNAM;
}
public String getBSTDK() {
return BSTDK;
}
public void setBSTDK(String bSTDK) {
BSTDK = bSTDK;
}
public String getERZET() {
return ERZET;
}
public void setERZET(String eRZET) {
ERZET = eRZET;
}
public String getERDAT() {
return ERDAT;
}
public void setERDAT(String eRDAT) {
ERDAT = eRDAT;
}
public String getKUNNR() {
return KUNNR;
}
public void setKUNNR(String kUNNR) {
KUNNR = kUNNR;
}
public String getKGNNR() {
return KGNNR;
}
public void setKGNNR(String kGNNR) {
KGNNR = kGNNR;
}
public String getNAME1() {
return NAME1;
}
public void setNAME1(String nAME1) {
NAME1 = nAME1;
}
public String getNAME2() {
return NAME2;
}
public void setNAME2(String nAME2) {
NAME2 = nAME2;
}
public String getPOSTL_COD1() {
return POSTL_COD1;
}
public void setPOSTL_COD1(String pOSTL_COD1) {
POSTL_COD1 = pOSTL_COD1;
}
public String getCITY1() {
return CITY1;
}
public void setCITY1(String cITY1) {
CITY1 = cITY1;
}
public String getZZPROM() {
return ZZPROM;
}
public void setZZPROM(String zZPROM) {
ZZPROM = zZPROM;
}
public String getBSTKD() {
return BSTKD;
}
public void setBSTKD(String bSTKD) {
BSTKD = bSTKD;
}
public String getAUART() {
return AUART;
}
public void setAUART(String aUART) {
AUART = aUART;
}
public String getCMGST() {
return CMGST;
}
public void setCMGST(String cMGST) {
CMGST = cMGST;
}
public String getNETWRH() {
return NETWRH;
}
public void setNETWRH(String nETWRH) {
NETWRH = nETWRH;
}
public String getMWSTH() {
return MWSTH;
}
public void setMWSTH(String mWSTH) {
MWSTH = mWSTH;
}
public String getWAERK() {
return WAERK;
}
public void setWAERK(String wAERK) {
WAERK = wAERK;
}
public String getDPFLAG() {
return DPFLAG;
}
public void setDPFLAG(String dPFLAG) {
DPFLAG = dPFLAG;
}
}
@XmlType(name = "ITEM_DATA")
@XmlAccessorType(XmlAccessType.FIELD)
public static class ITEM_DATA {
String POSNR;
String UEPOS;
String VTEXT;
String MATNR;
String KWMENG;
String VRKME;
String EDATU;
String CDATE;
String REFLAG;
String MWSTI;
String NETWRI;
String WAERK_I;
String WERKS;
String ZZCRDDATE;
String KGNNR_I;
String NAME1_I;
String NAME2_I;
String POSTL_COD1_I;
String CITY1_I;
public String getPOSNR() {
return POSNR;
}
public void setPOSNR(String pOSNR) {
POSNR = pOSNR;
}
public String getUEPOS() {
return UEPOS;
}
public void setUEPOS(String uEPOS) {
UEPOS = uEPOS;
}
public String getVTEXT() {
return VTEXT;
}
public void setVTEXT(String vTEXT) {
VTEXT = vTEXT;
}
public String getMATNR() {
return MATNR;
}
public void setMATNR(String mATNR) {
MATNR = mATNR;
}
public String getKWMENG() {
return KWMENG;
}
public void setKWMENG(String kWMENG) {
KWMENG = kWMENG;
}
public String getVRKME() {
return VRKME;
}
public void setVRKME(String vRKME) {
VRKME = vRKME;
}
public String getEDATU() {
return EDATU;
}
public void setEDATU(String eDATU) {
EDATU = eDATU;
}
public String getCDATE() {
return CDATE;
}
public void setCDATE(String cDATE) {
CDATE = cDATE;
}
public String getREFLAG() {
return REFLAG;
}
public void setREFLAG(String rEFLAG) {
REFLAG = rEFLAG;
}
public String getMWSTI() {
return MWSTI;
}
public void setMWSTI(String mWSTI) {
MWSTI = mWSTI;
}
public String getNETWRI() {
return NETWRI;
}
public void setNETWRI(String nETWRI) {
NETWRI = nETWRI;
}
public String getWAERK_I() {
return WAERK_I;
}
public void setWAERK_I(String wAERK_I) {
WAERK_I = wAERK_I;
}
public String getWERKS() {
return WERKS;
}
public void setWERKS(String wERKS) {
WERKS = wERKS;
}
public String getZZCRDDATE() {
return ZZCRDDATE;
}
public void setZZCRDDATE(String zZCRDDATE) {
ZZCRDDATE = zZCRDDATE;
}
public String getKGNNR_I() {
return KGNNR_I;
}
public void setKGNNR_I(String kGNNR_I) {
KGNNR_I = kGNNR_I;
}
public String getNAME1_I() {
return NAME1_I;
}
public void setNAME1_I(String nAME1_I) {
NAME1_I = nAME1_I;
}
public String getNAME2_I() {
return NAME2_I;
}
public void setNAME2_I(String nAME2_I) {
NAME2_I = nAME2_I;
}
public String getPOSTL_COD1_I() {
return POSTL_COD1_I;
}
public void setPOSTL_COD1_I(String pOSTL_COD1_I) {
POSTL_COD1_I = pOSTL_COD1_I;
}
public String getCITY1_I() {
return CITY1_I;
}
public void setCITY1_I(String cITY1_I) {
CITY1_I = cITY1_I;
}
}
@XmlType(name = "ITEM_PRICING")
@XmlAccessorType(XmlAccessType.FIELD)
public static class ITEM_PRICING {
String POSNR;
String KSCHL;
String VTEXT;
String KBETR;
String KWERT;
public String getPOSNR() {
return POSNR;
}
public void setPOSNR(String pOSNR) {
POSNR = pOSNR;
}
public String getKSCHL() {
return KSCHL;
}
public void setKSCHL(String kSCHL) {
KSCHL = kSCHL;
}
public String getVTEXT() {
return VTEXT;
}
public void setVTEXT(String vTEXT) {
VTEXT = vTEXT;
}
public String getKBETR() {
return KBETR;
}
public void setKBETR(String kBETR) {
KBETR = kBETR;
}
public String getKWERT() {
return KWERT;
}
public void setKWERT(String kWERT) {
KWERT = kWERT;
}
}
}
package com.egolm.sso.services.dn_deletion;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "DELETED_DOCUMENTS")
@XmlRootElement(name = "DELETED_DOCUMENTS")
public class DELETED_DOCUMENTS {
String TARGET_SYSTEM;
String DOCTYPE;
String DOCNUMBER;
String SALES_ORG;
public String getTARGET_SYSTEM() {
return TARGET_SYSTEM;
}
public void setTARGET_SYSTEM(String tARGET_SYSTEM) {
TARGET_SYSTEM = tARGET_SYSTEM;
}
public String getDOCTYPE() {
return DOCTYPE;
}
public void setDOCTYPE(String dOCTYPE) {
DOCTYPE = dOCTYPE;
}
public String getDOCNUMBER() {
return DOCNUMBER;
}
public void setDOCNUMBER(String dOCNUMBER) {
DOCNUMBER = dOCNUMBER;
}
public String getSALES_ORG() {
return SALES_ORG;
}
public void setSALES_ORG(String sALES_ORG) {
SALES_ORG = sALES_ORG;
}
}
\ No newline at end of file
package com.egolm.sso.services.dn_deletion;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService(targetNamespace = "http://dn_deletion.sso.egolm.com")
public interface DNDeletionService {
@WebMethod
public void execute(DELETED_DOCUMENTS DELETED_DOCUMENTS);
}
package com.egolm.sso.services.dn_deletion;
import javax.jws.WebService;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@Component
@WebService(serviceName = "DNDeletionService", targetNamespace = "http://dn_deletion.sso.egolm.com", endpointInterface = "com.egolm.sso.services.dn_deletion.DNDeletionService")
public class DNDeletionServiceImpl implements DNDeletionService {
@Override
@Transactional
public void execute(DELETED_DOCUMENTS DELETED_DOCUMENTS) {
}
}
package com.egolm.sso.services.material_master;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService(targetNamespace = "http://material_master.sso.egolm.com")
public interface MaterialMasterService {
@WebMethod
public void execute(Z_MT_SD_001_MATERIAL_MASTER Z_MT_SD_001_MATERIAL_MASTER);
}
package com.egolm.sso.services.material_master;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import javax.jws.WebService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import com.egolm.sso.services.CommonService;
import com.egolm.sso.services.material_master.Z_MT_SD_001_MATERIAL_MASTER.HEADER_SENDING;
import com.egolm.sso.services.material_master.Z_MT_SD_001_MATERIAL_MASTER.ITEM;
import com.egolm.sso.services.material_master.Z_MT_SD_001_MATERIAL_MASTER.RECORD;
import com.egolm.sso.util.DateUtil;
import com.egolm.sso.util.StringUtil;
import com.google.gson.Gson;
@Component
@WebService(serviceName = "MaterialMasterService", targetNamespace = "http://material_master.sso.egolm.com", endpointInterface = "com.egolm.sso.services.material_master.MaterialMasterService")
public class MaterialMasterServiceImpl implements MaterialMasterService {
@Autowired
JdbcTemplate jdbcTemplate;
@Autowired
CommonService common;
@Override
@Transactional
public void execute(Z_MT_SD_001_MATERIAL_MASTER Z_MT_SD_001_MATERIAL_MASTER) {
System.out.println(new Gson().toJson(Z_MT_SD_001_MATERIAL_MASTER));
Date now = new Date();
String today = DateUtil.formatDate(now, DateUtil.FMT_DATE);
RECORD RECORD = Z_MT_SD_001_MATERIAL_MASTER.getRECORD();
HEADER_SENDING h = RECORD.getHEADER_SENDING();
String DIS_CODE = h.getKUNNR();
String DATUM = h.getDATUM();
String UZEIT = h.getUZEIT();
List<ITEM> items = RECORD.getITEM();
for(ITEM item : items) {
String GOODS_CODE = item.getMATNR();
Map<String, Object> goods = getGoods(DIS_CODE, GOODS_CODE);
if (goods == null) {
goods = new HashMap<>();
}
goods.put("DIS_CODE", DIS_CODE);
goods.put("DATUM", DateUtil.parseDate(DATUM, DateUtil.FMT_DATE));
goods.put("UZEIT", DateUtil.parseDate(UZEIT, DateUtil.FMT_TIME));
goods.put("GOODS_CODE", GOODS_CODE);
goods.put("ROUGH_WEIGHT", Double.valueOf(item.getBRGEW()));
goods.put("NET_WEIGHT", Double.valueOf(item.getNTGEW()));
goods.put("WETGHT_UNIT", item.getGEWEI());
goods.put("CATEGORY_CODE", item.getPLINE());
goods.put("CREATION_DATE", DateUtil.parseDate(item.getERSDA(), DateUtil.FMT_DATE));
goods.put("LAST_CHANGE_DATE", DateUtil.parseDate(item.getLAEDA(), DateUtil.FMT_DATE));
goods.put("GOODS_NAME", item.getNORMT());
goods.put("VMSTA", item.getVMSTA());
goods.put("STKTYP", item.getSTKTYP());
goods.put("SPEC", item.getUMREZ());
goods.put("GOODS_NAME_EN", item.getNORMT_EN());
goods.put("AUMNG", item.getAUMNG());
goods.put("VRKME", item.getVRKME());
goods.put("BASE_UNIT", item.getMEINS());
goods.put("STATISTICS_UNIT", item.getSCHME());// (统计单位--》发货单位)
goods.put("LAENG", item.getLAENG());
goods.put("BREIT", item.getBREIT());
goods.put("HOEHE", item.getHOEHE());
goods.put("MEABM", item.getMEABM());
goods.put("LAENG_B", item.getLAENG_B());
goods.put("BREIT_B", item.getBREIT_B());
goods.put("HOEHE_B", item.getHOEHE_B());
goods.put("MEABM_B", item.getMEABM_B());
goods.put("PUBLIC", item.getPUBLIC());
goods.put("INTERNET", item.getINTERNET());
/*
goods.put("CATEGORY_NAME", "");// 品类名称
goods.put("PRODUCTION_LINE_CODE", "");// 产线(产地)编码
goods.put("PRODUCTION_LINE_NAME", "");// 产线(产地)名称
goods.put("MSTAV", "");// 停产标志2
goods.put("BARCODE", "");// 物料条码
goods.put("TAX_RATE", 0);// 税率
goods.put("GOODS_KEY", "");// 物料唯一码
goods.put("SEND_TIME", now);// 发送时间
goods.put("DIS_UPDATE_STATUS", "N");// 分销商更新结果(Y成功,N失败)
*/
Long BATCHID = common.getNextval(today + "T_VEN_GOODS_BATCH_" + today);
String BATCH = today+"-"+BATCHID;
goods.put("TRACE_NO", "sapmaterialmaster" + DateUtil.formatDate(now, DateUtil.FMT_DATETIME));
goods.put("BATCH", BATCH);
goods.put("SEND_STATUS", "N");
if (goods.get("ID") != null) {
updateGoods(goods);
} else {
insertGoods(goods);
}
}
}
private void updateGoods(Map<String, Object> goods) {
goods.put("UPDATED", new Date());
goods.put("UPDATEDBY", "system");
String sql = "update t_ven_goods set ";
List<Object> args = new ArrayList<>();
for (Entry<String, Object> entry : goods.entrySet()) {
String key = entry.getKey();
Object value = entry.getValue();
if (!key.equals("ID")) {
sql = sql + key + " = ?, ";
args.add(value);
}
}
sql = sql.substring(0, sql.length() - 2);
sql = sql + " where ID = ?";
args.add(goods.get("ID"));
jdbcTemplate.update(sql, args.toArray());
}
private void insertGoods(Map<String, Object> goods) {
Date now = new Date();
String today = DateUtil.formatDate(now, DateUtil.FMT_DATE);
Long time = now.getTime();
String idIndex = StringUtil.format(common.getNextval("T_VEN_GOODS_ID_"+today), "00000");
Long ID = Long.valueOf(time+idIndex);
goods.put("ID", ID);
goods.put("CREATED", DateUtil.formatDate(now, DateUtil.FMT_DATE_TIME)/* datetimef.format(new Date()) */);
goods.put("CREATEDBY", "system");
String insertSql = "insert into t_ven_goods ";
String fieldSql = "(";
String valuesSql = "(";
List<Object> values = new ArrayList<>();
for (Entry<String, Object> entry : goods.entrySet()) {
fieldSql = fieldSql + entry.getKey() + ", ";
valuesSql = valuesSql + "?, ";
values.add(entry.getValue());
}
fieldSql = fieldSql.substring(0, fieldSql.length() - 2);
valuesSql = valuesSql.substring(0, valuesSql.length() - 2);
insertSql = insertSql + fieldSql + ") values " + valuesSql + ")";
jdbcTemplate.update(insertSql, values.toArray());
}
private Map<String, Object> getGoods(String DIS_CODE, String GOODS_CODE) {
String sql = "select * from t_ven_goods where DIS_CODE = ? and GOODS_CODE = ?";
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql, DIS_CODE, GOODS_CODE);
if (list != null && list.size() > 0) {
return list.get(0);
}
return null;
}
}
package com.egolm.sso.services.material_master;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
@XmlType(name = "Z_MT_SD_001_MATERIAL_MASTER")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name="Z_MT_SD_001_MATERIAL_MASTER", namespace="http://schneider-distributor.com/")
public class Z_MT_SD_001_MATERIAL_MASTER {
RECORD RECORD;
public RECORD getRECORD() {
return RECORD;
}
public void setRECORD(RECORD rECORD) {
RECORD = rECORD;
}
@XmlType(name = "RECORD")
@XmlAccessorType(XmlAccessType.FIELD)
public static class RECORD{
HEADER_SENDING HEADER_SENDING;
List<ITEM> ITEM;
public HEADER_SENDING getHEADER_SENDING() {
return HEADER_SENDING;
}
public void setHEADER_SENDING(HEADER_SENDING hEADER_SENDING) {
HEADER_SENDING = hEADER_SENDING;
}
public List<ITEM> getITEM() {
return ITEM;
}
public void setITEM(List<ITEM> iTEM) {
ITEM = iTEM;
}
}
@XmlType(name = "HEADER_SENDING")
@XmlAccessorType(XmlAccessType.FIELD)
public static class HEADER_SENDING{
String KUNNR;
String DATUM;
String UZEIT;
public String getKUNNR() {
return KUNNR;
}
public void setKUNNR(String kUNNR) {
KUNNR = kUNNR;
}
public String getDATUM() {
return DATUM;
}
public void setDATUM(String dATUM) {
DATUM = dATUM;
}
public String getUZEIT() {
return UZEIT;
}
public void setUZEIT(String uZEIT) {
UZEIT = uZEIT;
}
}
@XmlType(name = "ITEM")
@XmlAccessorType(XmlAccessType.FIELD)
public static class ITEM{
String MATNR;
String BRGEW;
String NTGEW;
String GEWEI;
String PLINE;
String ERSDA;
String LAEDA;
String NORMT;
String NORMT_EN;
String LIFNR;
String VMSTA;
String MSTAV;
String STKTYP;
String UMREZ;
String AUMNG;
String VRKME;
String MEINS;
String SCHME;
String LAENG;
String BREIT;
String HOEHE;
String MEABM;
String LAENG_B;
String BREIT_B;
String HOEHE_B;
String MEABM_B;
String PUBLIC;
String INTERNET;
public String getMATNR() {
return MATNR;
}
public void setMATNR(String mATNR) {
MATNR = mATNR;
}
public String getBRGEW() {
return BRGEW;
}
public void setBRGEW(String bRGEW) {
BRGEW = bRGEW;
}
public String getNTGEW() {
return NTGEW;
}
public void setNTGEW(String nTGEW) {
NTGEW = nTGEW;
}
public String getGEWEI() {
return GEWEI;
}
public void setGEWEI(String gEWEI) {
GEWEI = gEWEI;
}
public String getPLINE() {
return PLINE;
}
public void setPLINE(String pLINE) {
PLINE = pLINE;
}
public String getERSDA() {
return ERSDA;
}
public void setERSDA(String eRSDA) {
ERSDA = eRSDA;
}
public String getLAEDA() {
return LAEDA;
}
public void setLAEDA(String lAEDA) {
LAEDA = lAEDA;
}
public String getNORMT() {
return NORMT;
}
public void setNORMT(String nORMT) {
NORMT = nORMT;
}
public String getNORMT_EN() {
return NORMT_EN;
}
public void setNORMT_EN(String nORMT_EN) {
NORMT_EN = nORMT_EN;
}
public String getLIFNR() {
return LIFNR;
}
public void setLIFNR(String lIFNR) {
LIFNR = lIFNR;
}
public String getVMSTA() {
return VMSTA;
}
public void setVMSTA(String vMSTA) {
VMSTA = vMSTA;
}
public String getMSTAV() {
return MSTAV;
}
public void setMSTAV(String mSTAV) {
MSTAV = mSTAV;
}
public String getSTKTYP() {
return STKTYP;
}
public void setSTKTYP(String sTKTYP) {
STKTYP = sTKTYP;
}
public String getUMREZ() {
return UMREZ;
}
public void setUMREZ(String uMREZ) {
UMREZ = uMREZ;
}
public String getAUMNG() {
return AUMNG;
}
public void setAUMNG(String aUMNG) {
AUMNG = aUMNG;
}
public String getVRKME() {
return VRKME;
}
public void setVRKME(String vRKME) {
VRKME = vRKME;
}
public String getMEINS() {
return MEINS;
}
public void setMEINS(String mEINS) {
MEINS = mEINS;
}
public String getSCHME() {
return SCHME;
}
public void setSCHME(String sCHME) {
SCHME = sCHME;
}
public String getLAENG() {
return LAENG;
}
public void setLAENG(String lAENG) {
LAENG = lAENG;
}
public String getBREIT() {
return BREIT;
}
public void setBREIT(String bREIT) {
BREIT = bREIT;
}
public String getHOEHE() {
return HOEHE;
}
public void setHOEHE(String hOEHE) {
HOEHE = hOEHE;
}
public String getMEABM() {
return MEABM;
}
public void setMEABM(String mEABM) {
MEABM = mEABM;
}
public String getLAENG_B() {
return LAENG_B;
}
public void setLAENG_B(String lAENG_B) {
LAENG_B = lAENG_B;
}
public String getBREIT_B() {
return BREIT_B;
}
public void setBREIT_B(String bREIT_B) {
BREIT_B = bREIT_B;
}
public String getHOEHE_B() {
return HOEHE_B;
}
public void setHOEHE_B(String hOEHE_B) {
HOEHE_B = hOEHE_B;
}
public String getMEABM_B() {
return MEABM_B;
}
public void setMEABM_B(String mEABM_B) {
MEABM_B = mEABM_B;
}
public String getPUBLIC() {
return PUBLIC;
}
public void setPUBLIC(String pUBLIC) {
PUBLIC = pUBLIC;
}
public String getINTERNET() {
return INTERNET;
}
public void setINTERNET(String iNTERNET) {
INTERNET = iNTERNET;
}
}
}
package com.egolm.sso.services.prforma_invoice;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService(targetNamespace = "http://prforma_invoice.sso.egolm.com")
public interface PrformaInvoiceService {
@WebMethod
public void execute(Z_MT_SD_005_PERFORM_INVOICE Z_MT_SD_005_PERFORM_INVOICE);
}
package com.egolm.sso.services.prforma_invoice;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.jws.WebService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import com.egolm.sso.services.CommonService;
import com.egolm.sso.services.prforma_invoice.Z_MT_SD_005_PERFORM_INVOICE.HEADER_BANK_DATA;
import com.egolm.sso.services.prforma_invoice.Z_MT_SD_005_PERFORM_INVOICE.HEADER_DOCU_DATE;
import com.egolm.sso.services.prforma_invoice.Z_MT_SD_005_PERFORM_INVOICE.HEADER_GENERAL_DATA;
import com.egolm.sso.services.prforma_invoice.Z_MT_SD_005_PERFORM_INVOICE.HEADER_ORGANIZATIONAL_DATA;
import com.egolm.sso.services.prforma_invoice.Z_MT_SD_005_PERFORM_INVOICE.HEADER_PARTNER_DATA;
import com.egolm.sso.services.prforma_invoice.Z_MT_SD_005_PERFORM_INVOICE.HEADER_REFERENCE_DATA;
import com.egolm.sso.services.prforma_invoice.Z_MT_SD_005_PERFORM_INVOICE.ITEM_AMOUNT_DATA;
import com.egolm.sso.services.prforma_invoice.Z_MT_SD_005_PERFORM_INVOICE.ITEM_DATA;
import com.egolm.sso.services.prforma_invoice.Z_MT_SD_005_PERFORM_INVOICE.ITEM_MATERIAL_DATA;
import com.egolm.sso.services.prforma_invoice.Z_MT_SD_005_PERFORM_INVOICE.ITEM_REFERENCE_DATA;
import com.egolm.sso.services.prforma_invoice.Z_MT_SD_005_PERFORM_INVOICE.ITEM_REFERENCE_PO_TYPE;
import com.egolm.sso.services.prforma_invoice.Z_MT_SD_005_PERFORM_INVOICE.ITEM_VAT_DATA;
import com.egolm.sso.services.prforma_invoice.Z_MT_SD_005_PERFORM_INVOICE.SUMMARY_GENERAL;
import com.egolm.sso.services.prforma_invoice.Z_MT_SD_005_PERFORM_INVOICE.Z_DT_SD_005_PERFORM_INVOICE;
import com.egolm.sso.util.DateUtil;
import com.egolm.sso.util.SqlUtil;
import com.egolm.sso.util.SqlUtil.Sql;
import com.egolm.sso.util.StringUtil;
@Component
@WebService(serviceName = "PrformaInvoiceService", targetNamespace = "http://prforma_invoice.sso.egolm.com", endpointInterface = "com.egolm.sso.services.prforma_invoice.PrformaInvoiceService")
public class PrformaInvoiceServiceImpl implements PrformaInvoiceService {
@Autowired
JdbcTemplate jdbcTemplate;
@Autowired
CommonService common;
@Override
@Transactional
public void execute(Z_MT_SD_005_PERFORM_INVOICE Z_MT_SD_005_PERFORM_INVOICE) {
Date now = new Date();
String dateString = DateUtil.formatDate(now, DateUtil.FMT_DATE);
Map<String, Object> headMap = new HashMap<String, Object>();
Z_DT_SD_005_PERFORM_INVOICE Z_DT_SD_005_PERFORM_INVOICE = Z_MT_SD_005_PERFORM_INVOICE.getZ_DT_SD_005_PERFORM_INVOICE();
HEADER_GENERAL_DATA HEADER_GENERAL_DATA = Z_DT_SD_005_PERFORM_INVOICE.getHEADER_GENERAL_DATA();
List<HEADER_PARTNER_DATA> partnerList = Z_DT_SD_005_PERFORM_INVOICE.getHEADER_PARTNER_DATA();
HEADER_DOCU_DATE HEADER_DOCU_DATE = Z_DT_SD_005_PERFORM_INVOICE.getHEADER_DOCU_DATE();
HEADER_REFERENCE_DATA HEADER_REFERENCE_DATA = Z_DT_SD_005_PERFORM_INVOICE.getHEADER_REFERENCE_DATA();
HEADER_BANK_DATA HEADER_BANK_DATA = Z_DT_SD_005_PERFORM_INVOICE.getHEADER_BANK_DATA();
HEADER_ORGANIZATIONAL_DATA HEADER_ORGANIZATIONAL_DATA = Z_DT_SD_005_PERFORM_INVOICE.getHEADER_ORGANIZATIONAL_DATA();
List<SUMMARY_GENERAL> summaryList = Z_DT_SD_005_PERFORM_INVOICE.getSUMMARY_GENERAL();
List<ITEM_DATA> itemList = Z_DT_SD_005_PERFORM_INVOICE.getITEM_DATA();
Long headerId = common.getNextval("T_PERFORM_INVOICE_HEADER_ID");
headMap.put("ID", headerId);
if(HEADER_GENERAL_DATA != null) {
headMap.put("GENERAL_BELNR", HEADER_GENERAL_DATA.getBELNR());
headMap.put("GENERAL_ZTERM", HEADER_GENERAL_DATA.getZTERM());
}
if(partnerList != null) {
for(HEADER_PARTNER_DATA HEADER_PARTNER_DATA : partnerList) {
if("AG".equals(HEADER_PARTNER_DATA.getPARVW())) {
headMap.put("PARTNER_PARVW1", HEADER_PARTNER_DATA.getPARVW());
headMap.put("PARTNER_PARTN1", HEADER_PARTNER_DATA.getPARTN());
} else if("WE".equals(HEADER_PARTNER_DATA.getPARVW())) {
headMap.put("PARTNER_PARVW2", HEADER_PARTNER_DATA.getPARVW());
headMap.put("PARTNER_PARTN2", HEADER_PARTNER_DATA.getPARTN());
}
}
}
if(HEADER_DOCU_DATE != null) {
headMap.put("DOCU_IDDAT", HEADER_DOCU_DATE.getIDDAT());
headMap.put("DOCU_DATUM", HEADER_DOCU_DATE.getDATUM());
}
if(HEADER_REFERENCE_DATA != null) {
headMap.put("EFERENCE_QUALF", HEADER_REFERENCE_DATA.getQUALF());
headMap.put("EFERENCE_BELNR", HEADER_REFERENCE_DATA.getBELNR());
headMap.put("EFERENCE_DATUM", HEADER_REFERENCE_DATA.getDATUM());
}
if(HEADER_BANK_DATA != null) {
headMap.put("BANK_ACNUM", HEADER_BANK_DATA.getACNUM());
}
if(HEADER_ORGANIZATIONAL_DATA != null) {
headMap.put("ORGANIZATIONAL_QUALF", HEADER_ORGANIZATIONAL_DATA.getQUALF());
headMap.put("ORGANIZATIONAL_ORGID", HEADER_ORGANIZATIONAL_DATA.getORGID());
}
if(summaryList != null) {
for(int i = 0; i < summaryList.size(); i++) {
SUMMARY_GENERAL SUMMARY_GENERAL = summaryList.get(i);
headMap.put("SUMMARY_SUMID" + (i + 1), SUMMARY_GENERAL.getSUMID());
headMap.put("SUMMARY_SUMME" + (i + 1), SUMMARY_GENERAL.getSUMME());
headMap.put("SUMMARY_WAERQ" + (i + 1), SUMMARY_GENERAL.getWAERQ());
}
}
headMap.put("BATCH", dateString + "-" + common.getNextval("T_PERFORM_INVOICE_HEADER_BATCH_" + dateString));
headMap.put("SEND_STATUS", 'N');
headMap.put("SEND_TIME", now);
headMap.put("TRACE_NO", "sapproformainvoice" + DateUtil.formatDate(now, DateUtil.FMT_DATETIME));
headMap.put("CREATED", now);
headMap.put("CREATEDBY", "system");
headMap.put("UPDATED", null);
headMap.put("UPDATEDBY", null);
List<Map<String, Object>> itemDatas = new ArrayList<Map<String, Object>>();
if(itemList != null) {
for(ITEM_DATA ITEM_DATA : itemList) {
Map<String, Object> itemDataMap = new HashMap<String, Object>();
Long itemId = Long.valueOf("" + System.currentTimeMillis() + StringUtil.format(common.getNextval("T_PERFORM_INVOICE_HEADER_ID_" + dateString), "00000"));
ITEM_REFERENCE_DATA ITEM_REFERENCE_DATA = ITEM_DATA.getITEM_REFERENCE_DATA();
ITEM_MATERIAL_DATA ITEM_MATERIAL_DATA = ITEM_DATA.getITEM_MATERIAL_DATA();
List<ITEM_AMOUNT_DATA> itemAmountList = ITEM_DATA.getITEM_AMOUNT_DATA();
ITEM_VAT_DATA ITEM_VAT_DATA = ITEM_DATA.getITEM_VAT_DATA();
List<ITEM_REFERENCE_PO_TYPE> poTypeList = ITEM_DATA.getITEM_REFERENCE_PO_TYPE();
itemDataMap.put("ID", itemId);
itemDataMap.put("HEADER_ID", headerId);
if(ITEM_DATA != null) {
itemDataMap.put("POSEX", ITEM_DATA.getPOSEX());
itemDataMap.put("MENGE", ITEM_DATA.getMENGE());
itemDataMap.put("MENEE", ITEM_DATA.getMENEE());
itemDataMap.put("WERKS", ITEM_DATA.getWERKS());
}
if(ITEM_REFERENCE_DATA != null) {
itemDataMap.put("REFERENCE_QUALF", ITEM_REFERENCE_DATA.getQUALF());
itemDataMap.put("REFERENCE_BELNR", ITEM_REFERENCE_DATA.getBELNR());
itemDataMap.put("REFERENCE_ZEILE", ITEM_REFERENCE_DATA.getZEILE());
}
if(ITEM_MATERIAL_DATA != null) {
itemDataMap.put("MATERIAL_QUALF", ITEM_MATERIAL_DATA.getQUALF());
itemDataMap.put("MATERIAL_IDTNR", ITEM_MATERIAL_DATA.getIDTNR());
itemDataMap.put("MATERIAL_DIDTNR", null);
}
if(itemAmountList != null) {
for(int i = 0; i < itemAmountList.size(); i++) {
ITEM_AMOUNT_DATA ITEM_AMOUNT_DATA = itemAmountList.get(i);
headMap.put("AMOUNT_QUALF" + (i + 1), ITEM_AMOUNT_DATA.getQUALF());
headMap.put("AMOUNT_BETRG" + (i + 1), ITEM_AMOUNT_DATA.getBETRG());
}
}
if(ITEM_VAT_DATA != null) {
itemDataMap.put("VAT_MWSKZ", ITEM_VAT_DATA.getMWSKZ());
itemDataMap.put("VAT_MWSBT", ITEM_VAT_DATA.getMWSBT());
}
if(poTypeList != null) {
for(int i = 0; i < poTypeList.size(); i++) {
ITEM_REFERENCE_PO_TYPE ITEM_REFERENCE_PO_TYPE = poTypeList.get(i);
headMap.put("REFERENCE_PO_TYPE_TDID" + (i + 1), ITEM_REFERENCE_PO_TYPE.getTDID());
headMap.put("REFERENCE_PO_DATA_TDLINE" + (i + 1), ITEM_REFERENCE_PO_TYPE.getITEM_REFERENCE_PO_DATA().getTDLINE());
}
}
itemDataMap.put("CREATED", now);
itemDataMap.put("CREATEDBY", "system");
itemDataMap.put("UPDATED", headerId);
itemDataMap.put("UPDATEDBY", headerId);
itemDatas.add(itemDataMap);
}
}
Sql headerSql = SqlUtil.insertSql("t_perform_invoice_header", headMap);
jdbcTemplate.update(headerSql.getSql(), headerSql.getArgs());
Sql itemDataSql = SqlUtil.insertSqlBatch("t_perform_invoice_item", itemDatas);
jdbcTemplate.batchUpdate(itemDataSql.getSql(), itemDataSql.getBachArgs());
}
}
package com.egolm.sso.services.prforma_invoice;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
@XmlType(name = "Z_MT_SD_005_PERFORM_INVOICE")
@XmlAccessorType(XmlAccessType.FIELD)
public class Z_MT_SD_005_PERFORM_INVOICE {
Z_DT_SD_005_PERFORM_INVOICE Z_DT_SD_005_PERFORM_INVOICE;
@XmlType(name = "Z_DT_SD_005_PERFORM_INVOICE")
@XmlAccessorType(XmlAccessType.FIELD)
public static class Z_DT_SD_005_PERFORM_INVOICE {
HEADER_GENERAL_DATA HEADER_GENERAL_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;
List<ITEM_DATA> ITEM_DATA;
List<SUMMARY_GENERAL> SUMMARY_GENERAL;
public HEADER_GENERAL_DATA getHEADER_GENERAL_DATA() {
return HEADER_GENERAL_DATA;
}
public void setHEADER_GENERAL_DATA(HEADER_GENERAL_DATA hEADER_GENERAL_DATA) {
HEADER_GENERAL_DATA = hEADER_GENERAL_DATA;
}
public List<HEADER_PARTNER_DATA> getHEADER_PARTNER_DATA() {
return HEADER_PARTNER_DATA;
}
public void setHEADER_PARTNER_DATA(List<HEADER_PARTNER_DATA> hEADER_PARTNER_DATA) {
HEADER_PARTNER_DATA = hEADER_PARTNER_DATA;
}
public HEADER_DOCU_DATE getHEADER_DOCU_DATE() {
return HEADER_DOCU_DATE;
}
public void setHEADER_DOCU_DATE(HEADER_DOCU_DATE hEADER_DOCU_DATE) {
HEADER_DOCU_DATE = hEADER_DOCU_DATE;
}
public HEADER_REFERENCE_DATA getHEADER_REFERENCE_DATA() {
return HEADER_REFERENCE_DATA;
}
public void setHEADER_REFERENCE_DATA(HEADER_REFERENCE_DATA hEADER_REFERENCE_DATA) {
HEADER_REFERENCE_DATA = hEADER_REFERENCE_DATA;
}
public HEADER_BANK_DATA getHEADER_BANK_DATA() {
return HEADER_BANK_DATA;
}
public void setHEADER_BANK_DATA(HEADER_BANK_DATA hEADER_BANK_DATA) {
HEADER_BANK_DATA = hEADER_BANK_DATA;
}
public HEADER_ORGANIZATIONAL_DATA getHEADER_ORGANIZATIONAL_DATA() {
return HEADER_ORGANIZATIONAL_DATA;
}
public void setHEADER_ORGANIZATIONAL_DATA(HEADER_ORGANIZATIONAL_DATA hEADER_ORGANIZATIONAL_DATA) {
HEADER_ORGANIZATIONAL_DATA = hEADER_ORGANIZATIONAL_DATA;
}
public List<SUMMARY_GENERAL> getSUMMARY_GENERAL() {
return SUMMARY_GENERAL;
}
public void setSUMMARY_GENERAL(List<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;
}
}
@XmlType(name = "HEADER_GENERAL_DATA")
@XmlAccessorType(XmlAccessType.FIELD)
public static class HEADER_GENERAL_DATA {
String BELNR;
String ZTERM;
public String getBELNR() {
return BELNR;
}
public void setBELNR(String bELNR) {
BELNR = bELNR;
}
public String getZTERM() {
return ZTERM;
}
public void setZTERM(String zTERM) {
ZTERM = zTERM;
}
}
@XmlType(name = "HEADER_PARTNER_DATA")
@XmlAccessorType(XmlAccessType.FIELD)
public static class HEADER_PARTNER_DATA {
String PARVW;
String PARTN;
public String getPARVW() {
return PARVW;
}
public void setPARVW(String pARVW) {
PARVW = pARVW;
}
public String getPARTN() {
return PARTN;
}
public void setPARTN(String pARTN) {
PARTN = pARTN;
}
}
@XmlType(name = "HEADER_DOCU_DATE")
@XmlAccessorType(XmlAccessType.FIELD)
public static class HEADER_DOCU_DATE {
String IDDAT;
String DATUM;
public String getIDDAT() {
return IDDAT;
}
public void setIDDAT(String iDDAT) {
IDDAT = iDDAT;
}
public String getDATUM() {
return DATUM;
}
public void setDATUM(String dATUM) {
DATUM = dATUM;
}
}
@XmlType(name = "HEADER_REFERENCE_DATA")
@XmlAccessorType(XmlAccessType.FIELD)
public static class HEADER_REFERENCE_DATA {
String QUALF;
String BELNR;
String DATUM;
public String getQUALF() {
return QUALF;
}
public void setQUALF(String qUALF) {
QUALF = qUALF;
}
public String getBELNR() {
return BELNR;
}
public void setBELNR(String bELNR) {
BELNR = bELNR;
}
public String getDATUM() {
return DATUM;
}
public void setDATUM(String dATUM) {
DATUM = dATUM;
}
}
@XmlType(name = "HEADER_BANK_DATA")
@XmlAccessorType(XmlAccessType.FIELD)
public static class HEADER_BANK_DATA {
String ACNUM;
public String getACNUM() {
return ACNUM;
}
public void setACNUM(String aCNUM) {
ACNUM = aCNUM;
}
}
@XmlType(name = "HEADER_ORGANIZATIONAL_DATA")
@XmlAccessorType(XmlAccessType.FIELD)
public static class HEADER_ORGANIZATIONAL_DATA {
String QUALF;
String ORGID;
public String getQUALF() {
return QUALF;
}
public void setQUALF(String qUALF) {
QUALF = qUALF;
}
public String getORGID() {
return ORGID;
}
public void setORGID(String oRGID) {
ORGID = oRGID;
}
}
@XmlType(name = "SUMMARY_GENERAL")
@XmlAccessorType(XmlAccessType.FIELD)
public static class SUMMARY_GENERAL {
String SUMID;
String SUMME;
String WAERQ;
public String getSUMID() {
return SUMID;
}
public void setSUMID(String sUMID) {
SUMID = sUMID;
}
public String getSUMME() {
return SUMME;
}
public void setSUMME(String sUMME) {
SUMME = sUMME;
}
public String getWAERQ() {
return WAERQ;
}
public void setWAERQ(String wAERQ) {
WAERQ = wAERQ;
}
}
@XmlType(name = "ITEM_DATA")
@XmlAccessorType(XmlAccessType.FIELD)
public static class ITEM_DATA {
ITEM_REFERENCE_DATA ITEM_REFERENCE_DATA;
ITEM_MATERIAL_DATA ITEM_MATERIAL_DATA;
List<ITEM_AMOUNT_DATA> ITEM_AMOUNT_DATA;
ITEM_VAT_DATA ITEM_VAT_DATA;
List<ITEM_REFERENCE_PO_TYPE> ITEM_REFERENCE_PO_TYPE;
String POSEX;
String MENGE;
String MENEE;
String WERKS;
public ITEM_REFERENCE_DATA getITEM_REFERENCE_DATA() {
return ITEM_REFERENCE_DATA;
}
public void setITEM_REFERENCE_DATA(ITEM_REFERENCE_DATA iTEM_REFERENCE_DATA) {
ITEM_REFERENCE_DATA = iTEM_REFERENCE_DATA;
}
public ITEM_MATERIAL_DATA getITEM_MATERIAL_DATA() {
return ITEM_MATERIAL_DATA;
}
public void setITEM_MATERIAL_DATA(ITEM_MATERIAL_DATA iTEM_MATERIAL_DATA) {
ITEM_MATERIAL_DATA = iTEM_MATERIAL_DATA;
}
public List<ITEM_AMOUNT_DATA> getITEM_AMOUNT_DATA() {
return ITEM_AMOUNT_DATA;
}
public void setITEM_AMOUNT_DATA(List<ITEM_AMOUNT_DATA> iTEM_AMOUNT_DATA) {
ITEM_AMOUNT_DATA = iTEM_AMOUNT_DATA;
}
public ITEM_VAT_DATA getITEM_VAT_DATA() {
return ITEM_VAT_DATA;
}
public void setITEM_VAT_DATA(ITEM_VAT_DATA iTEM_VAT_DATA) {
ITEM_VAT_DATA = iTEM_VAT_DATA;
}
public List<ITEM_REFERENCE_PO_TYPE> getITEM_REFERENCE_PO_TYPE() {
return ITEM_REFERENCE_PO_TYPE;
}
public void setITEM_REFERENCE_PO_TYPE(List<ITEM_REFERENCE_PO_TYPE> iTEM_REFERENCE_PO_TYPE) {
ITEM_REFERENCE_PO_TYPE = iTEM_REFERENCE_PO_TYPE;
}
public String getPOSEX() {
return POSEX;
}
public void setPOSEX(String pOSEX) {
POSEX = pOSEX;
}
public String getMENGE() {
return MENGE;
}
public void setMENGE(String mENGE) {
MENGE = mENGE;
}
public String getMENEE() {
return MENEE;
}
public void setMENEE(String mENEE) {
MENEE = mENEE;
}
public String getWERKS() {
return WERKS;
}
public void setWERKS(String wERKS) {
WERKS = wERKS;
}
}
@XmlType(name = "ITEM_REFERENCE_DATA")
@XmlAccessorType(XmlAccessType.FIELD)
public static class ITEM_REFERENCE_DATA {
String QUALF;
String BELNR;
String ZEILE;
public String getQUALF() {
return QUALF;
}
public void setQUALF(String qUALF) {
QUALF = qUALF;
}
public String getBELNR() {
return BELNR;
}
public void setBELNR(String bELNR) {
BELNR = bELNR;
}
public String getZEILE() {
return ZEILE;
}
public void setZEILE(String zEILE) {
ZEILE = zEILE;
}
}
@XmlType(name = "ITEM_MATERIAL_DATA")
@XmlAccessorType(XmlAccessType.FIELD)
public static class ITEM_MATERIAL_DATA {
String QUALF;
String IDTNR;
public String getQUALF() {
return QUALF;
}
public void setQUALF(String qUALF) {
QUALF = qUALF;
}
public String getIDTNR() {
return IDTNR;
}
public void setIDTNR(String iDTNR) {
IDTNR = iDTNR;
}
}
@XmlType(name = "ITEM_AMOUNT_DATA")
@XmlAccessorType(XmlAccessType.FIELD)
public static class ITEM_AMOUNT_DATA {
String QUALF;
String BETRG;
public String getQUALF() {
return QUALF;
}
public void setQUALF(String qUALF) {
QUALF = qUALF;
}
public String getBETRG() {
return BETRG;
}
public void setBETRG(String bETRG) {
BETRG = bETRG;
}
}
@XmlType(name = "ITEM_VAT_DATA")
@XmlAccessorType(XmlAccessType.FIELD)
public static class ITEM_VAT_DATA {
String MWSKZ;
String MWSBT;
public String getMWSKZ() {
return MWSKZ;
}
public void setMWSKZ(String mWSKZ) {
MWSKZ = mWSKZ;
}
public String getMWSBT() {
return MWSBT;
}
public void setMWSBT(String mWSBT) {
MWSBT = mWSBT;
}
}
@XmlType(name = "ITEM_REFERENCE_PO_TYPE")
@XmlAccessorType(XmlAccessType.FIELD)
public static class ITEM_REFERENCE_PO_TYPE {
ITEM_REFERENCE_PO_DATA ITEM_REFERENCE_PO_DATA;
String TDID;
public ITEM_REFERENCE_PO_DATA getITEM_REFERENCE_PO_DATA() {
return ITEM_REFERENCE_PO_DATA;
}
public void setITEM_REFERENCE_PO_DATA(ITEM_REFERENCE_PO_DATA iTEM_REFERENCE_PO_DATA) {
ITEM_REFERENCE_PO_DATA = iTEM_REFERENCE_PO_DATA;
}
public String getTDID() {
return TDID;
}
public void setTDID(String tDID) {
TDID = tDID;
}
}
@XmlType(name = "ITEM_REFERENCE_PO_DATA")
@XmlAccessorType(XmlAccessType.FIELD)
public static class ITEM_REFERENCE_PO_DATA {
String TDLINE;
public String getTDLINE() {
return TDLINE;
}
public void setTDLINE(String tDLINE) {
TDLINE = tDLINE;
}
}
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;
}
}
package com.egolm.sso.services.price_list;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService(targetNamespace = "http://price_list.sso.egolm.com")
public interface PriceListService {
@WebMethod
public void execute(Z_MT_SD_002_PRICE_LIST Z_MT_SD_002_PRICE_LIST);
}
package com.egolm.sso.services.price_list;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import javax.jws.WebService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import com.egolm.sso.services.CommonService;
import com.egolm.sso.services.price_list.Z_MT_SD_002_PRICE_LIST.HEADER_SENDING;
import com.egolm.sso.services.price_list.Z_MT_SD_002_PRICE_LIST.ITEM;
import com.egolm.sso.services.price_list.Z_MT_SD_002_PRICE_LIST.RECORD;
import com.egolm.sso.util.DateUtil;
import com.egolm.sso.util.StringUtil;
import com.google.gson.Gson;
@Component
@WebService(serviceName = "PriceListService", targetNamespace = "http://price_list.sso.egolm.com", endpointInterface = "com.egolm.sso.services.price_list.PriceListService")
public class PriceListServiceImpl implements PriceListService {
@Autowired
JdbcTemplate jdbcTemplate;
@Autowired
CommonService common;
@Override
@Transactional
public void execute(Z_MT_SD_002_PRICE_LIST Z_MT_SD_002_PRICE_LIST) {
Date now = new Date();
String today = DateUtil.formatDate(now, DateUtil.FMT_DATE);
System.out.println(new Gson().toJson(Z_MT_SD_002_PRICE_LIST));
RECORD r = Z_MT_SD_002_PRICE_LIST.getRECORD();
HEADER_SENDING h = r.getHEADER_SENDING();
List<ITEM> items = r.getITEM();
String KUNNR = h.getKUNNR();
String DATUM = h.getDATUM();
String UZEIT = h.getUZEIT();
for(ITEM item : items) {
String MATNR = item.getMATNR();
Map<String, Object> priceObj = getPriceObj(KUNNR, MATNR);
if (priceObj == null) {
priceObj = new HashMap<>();
}
priceObj.put("KUNNR", KUNNR);
priceObj.put("DATUM", DateUtil.parseDate(DATUM, DateUtil.FMT_DATE));
priceObj.put("UZEIT", DateUtil.parseDate(UZEIT, DateUtil.FMT_TIME));
priceObj.put("MATNR", MATNR);
priceObj.put("KBETR", StringUtil.toDouble(item.getKBETR()));
priceObj.put("KONWA", item.getKONWA());
priceObj.put("KPEIN", item.getKPEIN());
priceObj.put("KMEIN", item.getKMEIN());
priceObj.put("UMREZ", item.getUMREZ());
priceObj.put("MAKTX", item.getMAKTX());
priceObj.put("PRSCH", StringUtil.toDouble(item.getPRSCH()));
priceObj.put("DATAM", DateUtil.parseDate(item.getDATAM(), DateUtil.FMT_DATE));
priceObj.put("DATBI", DateUtil.parseDateNoEmpty(item.getDATBI(), DateUtil.FMT_DATE));
priceObj.put("PLINE", item.getPLINE());
priceObj.put("PRSCH_1", StringUtil.toDouble(item.getPRSCH_1()));
/*
priceObj.put("SEND_DATE", new Date(0));// 发送时间
*/
priceObj.put("SEND_STATUS", "N");
Long BATCHID = common.getNextval("T_PRICE_LIST_BATCH_" + today);
String BATCH = today + "-" + BATCHID;
priceObj.put("TRACE_NO", "sappricelist" + DateUtil.formatDate(now, DateUtil.FMT_DATETIME));
priceObj.put("BATCH", BATCH);
if (priceObj.get("ID") != null) {
updatePriceObj(priceObj);
} else {
insertPriceObj(priceObj);
}
}
}
private void updatePriceObj(Map<String, Object> priceObj) {
priceObj.put("UPDATEDBY", "system");
priceObj.put("UPDATED", new Date());
String sql = "update t_price_list set ";
List<Object> args = new ArrayList<>();
for (Entry<String, Object> entry : priceObj.entrySet()) {
String key = entry.getKey();
Object value = entry.getValue();
if (!key.equals("ID")) {
sql = sql + key + " = ?, ";
args.add(value);
}
}
sql = sql.substring(0, sql.length() - 2);
sql = sql + " where ID = ?";
args.add(priceObj.get("ID"));
jdbcTemplate.update(sql, args.toArray());
}
private void insertPriceObj(Map<String, Object> priceObj) {
Date now = new Date();
String today = DateUtil.formatDate(now, DateUtil.FMT_DATE);
Long time = now.getTime();
String idIndex = StringUtil.format(common.getNextval("T_PRICE_LIST_ID_"+today), "00000");
Long ID = Long.valueOf(time + idIndex);
priceObj.put("ID", ID);
priceObj.put("CREATED", now);
priceObj.put("CREATEDBY", "system");
String insertSql = "insert into t_price_list ";
String fieldSql = "(";
String valuesSql = "(";
List<Object> values = new ArrayList<>();
for (Entry<String, Object> entry : priceObj.entrySet()) {
fieldSql = fieldSql + entry.getKey() + ", ";
valuesSql = valuesSql + "?, ";
values.add(entry.getValue());
}
fieldSql = fieldSql.substring(0, fieldSql.length() - 2);
valuesSql = valuesSql.substring(0, valuesSql.length() - 2);
insertSql = insertSql + fieldSql + ") values " + valuesSql + ")";
jdbcTemplate.update(insertSql, values.toArray());
}
private Map<String, Object> getPriceObj(String KUNNR, String MATNR) {
String sql = "select * from t_price_list where KUNNR = ? and MATNR = ?";
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql, KUNNR, MATNR);
if (list != null && list.size() > 0) {
return list.get(0);
}
return null;
}
}
package com.egolm.sso.services.price_list;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
@XmlType(name = "Z_MT_SD_002_PRICE_LIST")
@XmlAccessorType(XmlAccessType.FIELD)
public class Z_MT_SD_002_PRICE_LIST {
RECORD RECORD;
public RECORD getRECORD() {
return RECORD;
}
public void setRECORD(RECORD rECORD) {
RECORD = rECORD;
}
@XmlType(name = "RECORD")
@XmlAccessorType(XmlAccessType.FIELD)
public static class RECORD {
HEADER_SENDING HEADER_SENDING;
List<ITEM> ITEM;
public HEADER_SENDING getHEADER_SENDING() {
return HEADER_SENDING;
}
public void setHEADER_SENDING(HEADER_SENDING hEADER_SENDING) {
HEADER_SENDING = hEADER_SENDING;
}
public List<ITEM> getITEM() {
return ITEM;
}
public void setITEM(List<ITEM> iTEM) {
ITEM = iTEM;
}
}
@XmlType(name = "HEADER_SENDING")
@XmlAccessorType(XmlAccessType.FIELD)
public static class HEADER_SENDING {
String KUNNR;
String DATUM;
String UZEIT;
public String getKUNNR() {
return KUNNR;
}
public void setKUNNR(String kUNNR) {
KUNNR = kUNNR;
}
public String getDATUM() {
return DATUM;
}
public void setDATUM(String dATUM) {
DATUM = dATUM;
}
public String getUZEIT() {
return UZEIT;
}
public void setUZEIT(String uZEIT) {
UZEIT = uZEIT;
}
}
@XmlType(name = "ITEM")
@XmlAccessorType(XmlAccessType.FIELD)
public static class ITEM {
String MATNR;
String KBETR;
String KONWA;
String KPEIN;
String KMEIN;
String UMREZ;
String MAKTX;
String PRSCH;
String DATAM;
String DATBI;
String PLINE;
String PRSCH_1;
public String getMATNR() {
return MATNR;
}
public void setMATNR(String mATNR) {
MATNR = mATNR;
}
public String getKBETR() {
return KBETR;
}
public void setKBETR(String kBETR) {
KBETR = kBETR;
}
public String getKONWA() {
return KONWA;
}
public void setKONWA(String kONWA) {
KONWA = kONWA;
}
public String getKPEIN() {
return KPEIN;
}
public void setKPEIN(String kPEIN) {
KPEIN = kPEIN;
}
public String getKMEIN() {
return KMEIN;
}
public void setKMEIN(String kMEIN) {
KMEIN = kMEIN;
}
public String getUMREZ() {
return UMREZ;
}
public void setUMREZ(String uMREZ) {
UMREZ = uMREZ;
}
public String getMAKTX() {
return MAKTX;
}
public void setMAKTX(String mAKTX) {
MAKTX = mAKTX;
}
public String getPRSCH() {
return PRSCH;
}
public void setPRSCH(String pRSCH) {
PRSCH = pRSCH;
}
public String getDATAM() {
return DATAM;
}
public void setDATAM(String dATAM) {
DATAM = dATAM;
}
public String getDATBI() {
return DATBI;
}
public void setDATBI(String dATBI) {
DATBI = dATBI;
}
public String getPLINE() {
return PLINE;
}
public void setPLINE(String pLINE) {
PLINE = pLINE;
}
public String getPRSCH_1() {
return PRSCH_1;
}
public void setPRSCH_1(String pRSCH_1) {
PRSCH_1 = pRSCH_1;
}
}
}
package com.egolm.sso.services.shipping_notfirmation;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService(targetNamespace = "http://shipping_notfirmation.sso.egolm.com")
public interface ShippingNotificationService {
@WebMethod
public void execute(Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE);
}
package com.egolm.sso.services.shipping_notfirmation;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import javax.jws.WebService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import com.alibaba.fastjson.JSON;
import com.egolm.sso.services.CommonService;
import com.egolm.sso.services.shipping_notfirmation.Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE.HEADER_DATE;
import com.egolm.sso.services.shipping_notfirmation.Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE.HEADER_DELIVERY;
import com.egolm.sso.services.shipping_notfirmation.Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE.HEADER_PARTNER;
import com.egolm.sso.services.shipping_notfirmation.Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE.ITEM;
import com.egolm.sso.services.shipping_notfirmation.Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE.ITEM_REFERENCE_PO_DATA;
import com.egolm.sso.services.shipping_notfirmation.Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE.ITEM_REFERENCE_PO_TYPE;
import com.egolm.sso.services.shipping_notfirmation.Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE.ITEM_REFERENCE_SO;
import com.egolm.sso.services.shipping_notfirmation.Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE.Z_DT_SD_007_SHIPPING_NOTIFICATION_FILE;
import com.egolm.sso.util.DateUtil;
import com.egolm.sso.util.StringUtil;
@Component
@WebService(serviceName = "ShippingNotificationService", targetNamespace = "http://shipping_notfirmation.sso.egolm.com", endpointInterface = "com.egolm.sso.services.shipping_notfirmation.ShippingNotificationService")
public class ShippingNotificationServiceImpl implements ShippingNotificationService {
@Autowired
JdbcTemplate jdbcTemplate;
@Autowired
CommonService common;
@Override
@Transactional
public void execute(Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE) {
System.out.println(JSON.toJSONString(Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE));
Date now = new Date();
String today = DateUtil.formatDate(now, DateUtil.FMT_DATE);
Long time = now.getTime();
Map<String, Object> header = new HashMap<>();
Z_DT_SD_007_SHIPPING_NOTIFICATION_FILE Z_DT_SD_007_SHIPPING_NOTIFICATION_FILE = Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE.getZ_DT_SD_007_SHIPPING_NOTIFICATION_FILE();
HEADER_DELIVERY HEADER_DELIVERY = Z_DT_SD_007_SHIPPING_NOTIFICATION_FILE.getHEADER_DELIVERY();
header.put("DELIVERY_VBELN", HEADER_DELIVERY.getVBELN());
header.put("DELIVERY_LFART", HEADER_DELIVERY.getLFART());
header.put("DELIVERY_INCO1", HEADER_DELIVERY.getINCO1());
header.put("DELIVERY_BTGEW", StringUtil.toDouble(HEADER_DELIVERY.getBTGEW()));
header.put("DELIVERY_GEWEI", HEADER_DELIVERY.getGEWEI());
header.put("DELIVERY_CMGST", HEADER_DELIVERY.getCMGST());
header.put("DELIVERY_VKORG", HEADER_DELIVERY.getVKORG());
List<HEADER_PARTNER> HEADER_PARTNERs = HEADER_DELIVERY.getHEADER_PARTNER();
for(int i=0; i<HEADER_PARTNERs.size(); i++) {
HEADER_PARTNER HEADER_PARTNER = HEADER_PARTNERs.get(i);
String PARTNER_Q = HEADER_PARTNER.getPARTNER_Q();
String PARTNER_ID = HEADER_PARTNER.getPARTNER_ID();
String NAME1 = HEADER_PARTNER.getNAME1();
String NAME2 = HEADER_PARTNER.getNAME2();
String POSTL_COD1 = HEADER_PARTNER.getPOSTL_COD1();
String CITY1 = HEADER_PARTNER.getCITY1();
if(PARTNER_Q!=null) {
header.put("PARTNER_Q"+(i+1), PARTNER_Q);
}
if(PARTNER_ID!=null) {
header.put("PARTNER_ID"+(i+1), PARTNER_ID);
}
if(NAME1!=null) {
header.put("PARTNER_NAME1_"+(i+1), NAME1);
}
if(NAME2!=null) {
header.put("PARTNER_NAME2_"+(i+1), NAME2);
}
if(POSTL_COD1!=null) {
header.put("PARTNER_POSTLCOD1_"+(i+1), POSTL_COD1);
}
if(CITY1!=null) {
header.put("PARTNER_CITY1_"+(i+1), CITY1);
}
}
List<HEADER_DATE> HEADER_DATEs= HEADER_DELIVERY.getHEADER_DATE();
if(HEADER_DATEs!=null&&HEADER_DATEs.size()>0) {
HEADER_DATE HEADER_DATE = HEADER_DATEs.get(0);
header.put("QUALF", HEADER_DATE.getQUALF());
header.put("NTEND", HEADER_DATE.getNTEND());
}
header.put("BATCH", today+"-"+common.getNextval("T_SHIPPING_NOTIFICATION_HEADER_BATCH_"+today));
header.put("SEND_STATUS", "N");
header.put("TRACE_NO", "sapshippingnotification"+DateUtil.formatDate(now, DateUtil.FMT_DATETIME));
header.put("CREATED", now);
header.put("CREATEDBY", "system");
Long hID = Long.valueOf(time+StringUtil.format(common.getNextval("T_SHIPPING_NOTIFICATION_HEADER_ID_"+today), "00000"));
header.put("ID", hID);
insertTo(header, "t_shipping_notification_header");
List<ITEM> ITEMs = HEADER_DELIVERY.getITEM();
for(ITEM ITEM : ITEMs) {
Map<String, Object> item = new HashMap<>();
Long iID = Long.valueOf(time+StringUtil.format(common.getNextval("T_SHIPPING_NOTIFICATION_ITEM_ID_"+today), "00000"));
item.put("ID", iID);
item.put("HEADER_ID", hID);
item.put("POSNR", ITEM.getPOSNR());
item.put("VTWEG", ITEM.getVTWEG());
item.put("MATNR", ITEM.getMATNR());
item.put("DMATNR", ITEM.getDMATNR());
item.put("LFIMG", ITEM.getLFIMG());
item.put("VRKME", ITEM.getVRKME());
List<ITEM_REFERENCE_SO> ITEM_REFERENCE_SOs = ITEM.getITEM_REFERENCE_SO();
if(ITEM_REFERENCE_SOs!=null&&ITEM_REFERENCE_SOs.size()>0) {
ITEM_REFERENCE_SO ITEM_REFERENCE_SO = ITEM_REFERENCE_SOs.get(0);
item.put("REFERENCE_SO_QUALF", ITEM_REFERENCE_SO.getQUALF());
item.put("REFERENCE_SO_BELNR", ITEM_REFERENCE_SO.getBELNR());
item.put("REFERENCE_SO_POSNR", ITEM_REFERENCE_SO.getPOSNR());
}
List<ITEM_REFERENCE_PO_TYPE> ITEM_REFERENCE_PO_TYPEs = ITEM.getITEM_REFERENCE_PO_TYPE();
for(int i=0; i<ITEM_REFERENCE_PO_TYPEs.size(); i++) {
ITEM_REFERENCE_PO_TYPE ITEM_REFERENCE_PO_TYPE = ITEM_REFERENCE_PO_TYPEs.get(i);
item.put("REFERENCE_PO_TYPE_TDID"+(i+1), ITEM_REFERENCE_PO_TYPE.getTDID());
List<ITEM_REFERENCE_PO_DATA> ITEM_REFERENCE_PO_DATAs = ITEM_REFERENCE_PO_TYPE.getITEM_REFERENCE_PO_DATA();
if(ITEM_REFERENCE_PO_DATAs!=null&&ITEM_REFERENCE_PO_DATAs.size()>0) {
ITEM_REFERENCE_PO_DATA ITEM_REFERENCE_PO_DATA = ITEM_REFERENCE_PO_DATAs.get(0);
item.put("REFERENCE_PO_TYPE_TDLINE"+(i+1), ITEM_REFERENCE_PO_DATA.getTDLINE());
}
}
item.put("CREATED", now);
item.put("CREATEDBY", "system");
insertTo(item, "t_shipping_notification_item");
}
}
private void insertTo(Map<String, Object> obj, String table) {
String insertSql = "insert into "+table+" ";
String fieldSql = "(";
String valuesSql = "(";
List<Object> values = new ArrayList<>();
for(Entry<String, Object> entry : obj.entrySet()) {
Object value = entry.getValue();
if(value!=null) {
fieldSql = fieldSql + entry.getKey() + ", ";
valuesSql = valuesSql + "?, ";
values.add(entry.getValue());
}
}
fieldSql = fieldSql.substring(0, fieldSql.length()-2);
valuesSql = valuesSql.substring(0, valuesSql.length()-2);
insertSql = insertSql + fieldSql + ") values " + valuesSql + ")";
jdbcTemplate.update(insertSql, values.toArray());
}
}
package com.egolm.sso.services.shipping_notfirmation;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
@XmlType(name = "Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE")
@XmlAccessorType(XmlAccessType.FIELD)
public class Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE {
Z_DT_SD_007_SHIPPING_NOTIFICATION_FILE Z_DT_SD_007_SHIPPING_NOTIFICATION_FILE;
public Z_DT_SD_007_SHIPPING_NOTIFICATION_FILE getZ_DT_SD_007_SHIPPING_NOTIFICATION_FILE() {
return Z_DT_SD_007_SHIPPING_NOTIFICATION_FILE;
}
public void setZ_DT_SD_007_SHIPPING_NOTIFICATION_FILE(
Z_DT_SD_007_SHIPPING_NOTIFICATION_FILE z_DT_SD_007_SHIPPING_NOTIFICATION_FILE) {
Z_DT_SD_007_SHIPPING_NOTIFICATION_FILE = z_DT_SD_007_SHIPPING_NOTIFICATION_FILE;
}
@XmlType(name = "Z_DT_SD_007_SHIPPING_NOTIFICATION_FILE")
@XmlAccessorType(XmlAccessType.FIELD)
public static class Z_DT_SD_007_SHIPPING_NOTIFICATION_FILE{
HEADER_DELIVERY HEADER_DELIVERY;
public HEADER_DELIVERY getHEADER_DELIVERY() {
return HEADER_DELIVERY;
}
public void setHEADER_DELIVERY(HEADER_DELIVERY hEADER_DELIVERY) {
HEADER_DELIVERY = hEADER_DELIVERY;
}
}
@XmlType(name = "HEADER_DELIVERY")
@XmlAccessorType(XmlAccessType.FIELD)
public static class HEADER_DELIVERY{
String VBELN;
String LFART;
String INCO1;
String BTGEW;
String GEWEI;
String CMGST;
String VKORG;
List<HEADER_PARTNER> HEADER_PARTNER;
List<HEADER_DATE> HEADER_DATE;
List<ITEM> ITEM;
public String getVKORG() {
return VKORG;
}
public void setVKORG(String vKORG) {
VKORG = vKORG;
}
public String getCMGST() {
return CMGST;
}
public void setCMGST(String cMGST) {
CMGST = cMGST;
}
public String getLFART() {
return LFART;
}
public void setLFART(String lFART) {
LFART = lFART;
}
public String getVBELN() {
return VBELN;
}
public void setVBELN(String vBELN) {
VBELN = vBELN;
}
public String getINCO1() {
return INCO1;
}
public void setINCO1(String iNCO1) {
INCO1 = iNCO1;
}
public String getBTGEW() {
return BTGEW;
}
public void setBTGEW(String bTGEW) {
BTGEW = bTGEW;
}
public String getGEWEI() {
return GEWEI;
}
public void setGEWEI(String gEWEI) {
GEWEI = gEWEI;
}
public List<HEADER_PARTNER> getHEADER_PARTNER() {
return HEADER_PARTNER;
}
public void setHEADER_PARTNER(List<HEADER_PARTNER> hEADER_PARTNER) {
HEADER_PARTNER = hEADER_PARTNER;
}
public List<HEADER_DATE> getHEADER_DATE() {
return HEADER_DATE;
}
public void setHEADER_DATE(List<HEADER_DATE> hEADER_DATE) {
HEADER_DATE = hEADER_DATE;
}
public List<ITEM> getITEM() {
return ITEM;
}
public void setITEM(List<ITEM> iTEM) {
ITEM = iTEM;
}
}
@XmlType(name = "HEADER_PARTNER")
@XmlAccessorType(XmlAccessType.FIELD)
public static class HEADER_PARTNER{
String PARTNER_Q;
String PARTNER_ID;
String NAME1;
String NAME2;
String POSTL_COD1;
String CITY1;
public String getNAME1() {
return NAME1;
}
public void setNAME1(String nAME1) {
NAME1 = nAME1;
}
public String getNAME2() {
return NAME2;
}
public void setNAME2(String nAME2) {
NAME2 = nAME2;
}
public String getPOSTL_COD1() {
return POSTL_COD1;
}
public void setPOSTL_COD1(String pOSTL_COD1) {
POSTL_COD1 = pOSTL_COD1;
}
public String getCITY1() {
return CITY1;
}
public void setCITY1(String cITY1) {
CITY1 = cITY1;
}
public String getPARTNER_Q() {
return PARTNER_Q;
}
public void setPARTNER_Q(String pARTNER_Q) {
PARTNER_Q = pARTNER_Q;
}
public String getPARTNER_ID() {
return PARTNER_ID;
}
public void setPARTNER_ID(String pARTNER_ID) {
PARTNER_ID = pARTNER_ID;
}
}
@XmlType(name = "HEADER_DATE")
@XmlAccessorType(XmlAccessType.FIELD)
public static class HEADER_DATE{
String QUALF;
String NTEND;
public String getQUALF() {
return QUALF;
}
public void setQUALF(String qUALF) {
QUALF = qUALF;
}
public String getNTEND() {
return NTEND;
}
public void setNTEND(String nTEND) {
NTEND = nTEND;
}
}
@XmlType(name = "ITEM")
@XmlAccessorType(XmlAccessType.FIELD)
public static class ITEM{
String POSNR;
String VTWEG;
String MATNR;
String DMATNR;
String LFIMG;
String VRKME;
List<ITEM_REFERENCE_SO> ITEM_REFERENCE_SO;
List<ITEM_REFERENCE_PO_TYPE> ITEM_REFERENCE_PO_TYPE;
public String getDMATNR() {
return DMATNR;
}
public void setDMATNR(String dMATNR) {
DMATNR = dMATNR;
}
public String getVTWEG() {
return VTWEG;
}
public void setVTWEG(String vTWEG) {
VTWEG = vTWEG;
}
public String getPOSNR() {
return POSNR;
}
public void setPOSNR(String pOSNR) {
POSNR = pOSNR;
}
public String getMATNR() {
return MATNR;
}
public void setMATNR(String mATNR) {
MATNR = mATNR;
}
public String getLFIMG() {
return LFIMG;
}
public void setLFIMG(String lFIMG) {
LFIMG = lFIMG;
}
public String getVRKME() {
return VRKME;
}
public void setVRKME(String vRKME) {
VRKME = vRKME;
}
public List<ITEM_REFERENCE_SO> getITEM_REFERENCE_SO() {
return ITEM_REFERENCE_SO;
}
public void setITEM_REFERENCE_SO(List<ITEM_REFERENCE_SO> iTEM_REFERENCE_SO) {
ITEM_REFERENCE_SO = iTEM_REFERENCE_SO;
}
public List<ITEM_REFERENCE_PO_TYPE> getITEM_REFERENCE_PO_TYPE() {
return ITEM_REFERENCE_PO_TYPE;
}
public void setITEM_REFERENCE_PO_TYPE(List<ITEM_REFERENCE_PO_TYPE> iTEM_REFERENCE_PO_TYPE) {
ITEM_REFERENCE_PO_TYPE = iTEM_REFERENCE_PO_TYPE;
}
}
@XmlType(name = "ITEM_REFERENCE_SO")
@XmlAccessorType(XmlAccessType.FIELD)
public static class ITEM_REFERENCE_SO{
String QUALF;
String BELNR;
String POSNR;
public String getQUALF() {
return QUALF;
}
public void setQUALF(String qUALF) {
QUALF = qUALF;
}
public String getBELNR() {
return BELNR;
}
public void setBELNR(String bELNR) {
BELNR = bELNR;
}
public String getPOSNR() {
return POSNR;
}
public void setPOSNR(String pOSNR) {
POSNR = pOSNR;
}
}
@XmlType(name = "ITEM_REFERENCE_PO_TYPE")
@XmlAccessorType(XmlAccessType.FIELD)
public static class ITEM_REFERENCE_PO_TYPE{
String TDID;
List<ITEM_REFERENCE_PO_DATA> ITEM_REFERENCE_PO_DATA;
public String getTDID() {
return TDID;
}
public void setTDID(String tDID) {
TDID = tDID;
}
public List<ITEM_REFERENCE_PO_DATA> getITEM_REFERENCE_PO_DATA() {
return ITEM_REFERENCE_PO_DATA;
}
public void setITEM_REFERENCE_PO_DATA(List<ITEM_REFERENCE_PO_DATA> iTEM_REFERENCE_PO_DATA) {
ITEM_REFERENCE_PO_DATA = iTEM_REFERENCE_PO_DATA;
}
}
@XmlType(name = "ITEM_REFERENCE_PO_DATA")
@XmlAccessorType(XmlAccessType.FIELD)
public static class ITEM_REFERENCE_PO_DATA{
String TDLINE;
public String getTDLINE() {
return TDLINE;
}
public void setTDLINE(String tDLINE) {
TDLINE = tDLINE;
}
}
}
package com.egolm.sso.util;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
public class DateUtil {
private static Map<String, DateFormat> fmtMap = new HashMap<>();
public static final String FMT_DATE = "yyyyMMdd";
public static final String FMT_TIME = "HHmmss";
public static final String FMT_DATE_TIME = "yyyy-MM-dd HH:mm:ss";
public static final String FMT_DATETIME = "yyyyMMddHHmmss";
public static String formatDate(Date d, String fmt) {
DateFormat df = getFmt(fmt);
return formatDate(d, df);
}
public static String formatDate(Date d, DateFormat fmt) {
return fmt.format(d);
}
public static Date parseDate(String d, String fmt) {
DateFormat df = getFmt(fmt);
return parseDate(d, df);
}
public static Date parseDate(String d, DateFormat fmt) {
try {
return fmt.parse(d);
} catch (ParseException e) {
throw new RuntimeException(d + " parse to" + fmt, e);
}
}
public static Date parseDateNoEmpty(String d, String fmt) {
Date res;
if(d!=null&&!d.equals("")) {
res = parseDate(d, fmt);
}else {
res = new Date(0);
}
return res;
}
public static Date parseDateNoEmpty(String d, DateFormat fmt) {
Date res;
if(d!=null&&!d.equals("")) {
res = parseDate(d, fmt);
}else {
res = new Date(0);
}
return res;
}
public static DateFormat getFmt(String fmt) {
DateFormat df = fmtMap.get(fmt);
if(df == null) {
df = new SimpleDateFormat(fmt);
fmtMap.put(fmt, df);
}
return df;
}
}
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 {
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();
}
}
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.net.URL;
import java.util.HashMap;
import java.util.Map;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import org.apache.cxf.endpoint.Client;
import org.apache.cxf.frontend.ClientProxy;
import org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor;
import org.apache.ws.security.WSConstants;
import org.apache.ws.security.handler.WSHandlerConstants;
import org.apache.wss4j.common.ext.WSPasswordCallback;
import com.egolm.sso.services.material_master.MaterialMasterService;
import com.egolm.sso.services.material_master.Z_MT_SD_001_MATERIAL_MASTER;
public class ServiceFactory {
static String username = "test";
static String password = "78258c537d6e4d5fb210a57d05619fb6";
public static <T> T create(String wsdlLocation, String namespace, String serviceName, Class<T> requiredType) throws Exception {
Map<String, Object> pro = new HashMap<String, Object>();
pro.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN);
pro.put(WSHandlerConstants.USER, username);
pro.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_DIGEST);
pro.put(WSHandlerConstants.PW_CALLBACK_REF, new CallbackHandler() {
public void handle(Callback[] callbacks) {
for (int i = 0; i < callbacks.length; i++) {
WSPasswordCallback pc = (WSPasswordCallback) callbacks[i];
pc.setPassword(password);
}
}
});
URL WSDL_URL = new URL(wsdlLocation);
QName qName = new QName(namespace, serviceName);
Service dyService = Service.create(WSDL_URL, qName);
T service = dyService.getPort(requiredType);
Client client = ClientProxy.getClient(service);
client.getOutInterceptors().add(new WSS4JOutInterceptor(pro));
return service;
}
public static void main(String[] args) throws Exception {
String wsdlLocation = "http://localhost:8080/sso/services/material_master?wsdl";
String namespace = "http://material_master.sso.egolm.com";
String serviceName = "MaterialMasterService";
MaterialMasterService service = create(wsdlLocation, namespace, serviceName, MaterialMasterService.class);
String XML = StringUtil.readText("D:/data/sso/001.XML");
Z_MT_SD_001_MATERIAL_MASTER bean = XMLUtil.toBeanByJxab(XML, Z_MT_SD_001_MATERIAL_MASTER.class);
service.execute(bean);
}
}
package com.egolm.sso.util;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
public class SqlUtil {
private static String tipRight = "`";
private static String tipLeft = "`";
public static Sql insertSqlBatch(String table_name, List<Map<String, Object>> objs) {
List<String> names = new ArrayList<String>();
Object[][] vals = new Object[objs.size()][];
for(int i = 0; i < objs.size(); i++) {
Map<String, Object> map = objs.get(i);
List<Object> valsAry = new ArrayList<Object>();
for(String key : map.keySet()) {
if(i == 0) {
names.add(key);
}
valsAry.add(map.get(key));
}
vals[i] = valsAry.toArray();
}
String sql = "insert into " + table_name + StringUtil.join(tipRight + ", " + tipLeft, " (" + tipLeft, tipRight + ") ", "", names) + " values" + StringUtil.join("?", ", ", names.size(), " (", ")");
return new Sql(sql, vals);
}
public static Sql insertSql(String tableName, Map<String, Object> objMap) {
String table_name = tableName;
Set<String> keySet = objMap.keySet();
String[] setArray = keySet.toArray(new String[keySet.size()]);
String[] fields = setArray;
String[] columns = setArray;
List<String> names = new ArrayList<String>();
List<Object> args = new ArrayList<Object>();
for(int i = 0; i < fields.length; i++) {
Object objArg = objMap.get(fields[i]);
if(objArg != null && objArg instanceof Date) {
objArg = new Timestamp(((Date)objArg).getTime());
}
if(objArg != null) {
names.add(columns[i]);
args.add(objArg);
}
}
String sql = "insert into " + table_name + StringUtil.join(tipRight + ", " + tipLeft, " (" + tipLeft, tipRight + ") ", "", names) + "values" + StringUtil.join("?", ", ", names.size(), " (", ")");
return new Sql(sql, args.toArray());
}
public static class Sql {
private String sql;
private List<Object[]> args = new ArrayList<Object[]>();
public Sql(String sql, Object[]... argsAry) {
this.sql = sql;
for(Object[] ary : argsAry) {
this.args.add(ary);
}
}
public String getSql() {
return sql;
}
public Object[] getArgs() {
return (args != null && args.size() > 0) ? args.get(0) : new Object[]{};
}
public List<Object[]> getBachArgs() {
return args;
}
}
}
package com.egolm.sso.util;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.List;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
public class StringUtil {
public static Double toDouble(String value) {
Double res;
if(value==null||value.equals("")) {
res = 0.0;
}else {
res = Double.valueOf(value);
}
return res;
}
public static String prependZero(int Num, int length) {
return prependZero(Num+"", length);
}
public static String prependZero(String Num, int length) {
String prepend = "";
for(int i=Num.length(); i<length; i++) {
prepend = prepend + "0";
}
return prepend + Num;
}
public static Element getDataElement(String xml, String eName) {
Document doc = null;
Element el = null;
try {
doc = DocumentHelper.parseText(xml);
Element root = doc.getRootElement();
el = root.element(eName);
} catch (DocumentException e) {
e.printStackTrace();
}
return el;
}
public static String join(String sign, String before, String after, String def, List<String> strs) {
return join(sign, before, after, def, strs.toArray(new String[strs.size()]));
}
public static String join(String sign, String before, String after, String def, String[] strs) {
if (strs == null || strs.length == 0) {
return def == null ? "" : def;
} else {
StringBuffer sb = new StringBuffer("");
for (int i = 0; i < strs.length; i++) {
String str = String.valueOf(strs[i]);
sb.append((i == 0 && before != null) ? before : "").append(str == null ? "" : str).append(i < strs.length - 1 ? (sign == null ? "" : sign) : "").append((i == strs.length - 1 && after != null) ? after : "");
}
return String.valueOf(sb);
}
}
public static String join(String str, String sign, int count, String before, String after) {
if (str == null || count == 0) {
return "";
} else {
StringBuffer sb = new StringBuffer("");
for (int i = 0; i < count; i++) {
sb.append(i == 0 && before != null ? before : "").append(str).append(i < count - 1 ? (sign == null ? "" : sign) : "").append(i == count - 1 && after != null ? after : "");
}
return String.valueOf(sb);
}
}
public static String format(Object no, String format) {
String strno = String.valueOf(no);
Integer index = format.length() - strno.length();
return format.substring(0, index) + strno;
}
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 java.io.ByteArrayInputStream;
import java.io.InputStream;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import com.egolm.sso.config.XRException;
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;
}
public static <T> T toBeanByJxab(String XML, Class<T> requireType) {
try {
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;
} catch (JAXBException e) {
throw new XRException("XML转换错误", e);
}
}
}
package com.schneider_distributor;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlElementDecl;
import javax.xml.bind.annotation.XmlRegistry;
import javax.xml.namespace.QName;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the com.schneider_distributor package.
* <p>An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
* content can consist of schema derived interfaces
* and classes representing the binding of schema
* type definitions, element declarations and model
* groups. Factory methods for each of these are
* provided in this class.
*
*/
@XmlRegistry
public class ObjectFactory {
private final static QName _ZMTSD009SOCREATION_QNAME = new QName("http://schneider-distributor.com/", "Z_MT_SD_009_SO_CREATION");
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.schneider_distributor
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link ZDTSD009SOCREATION }
*
*/
public ZDTSD009SOCREATION createZDTSD009SOCREATION() {
return new ZDTSD009SOCREATION();
}
/**
* Create an instance of {@link ZDTSD009SOCREATION.Header }
*
*/
public ZDTSD009SOCREATION.Header createZDTSD009SOCREATIONHeader() {
return new ZDTSD009SOCREATION.Header();
}
/**
* Create an instance of {@link ZDTSD009SOCREATION.ITEM }
*
*/
public ZDTSD009SOCREATION.ITEM createZDTSD009SOCREATIONITEM() {
return new ZDTSD009SOCREATION.ITEM();
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link ZDTSD009SOCREATION }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://schneider-distributor.com/", name = "Z_MT_SD_009_SO_CREATION")
public JAXBElement<ZDTSD009SOCREATION> createZMTSD009SOCREATION(ZDTSD009SOCREATION value) {
return new JAXBElement<ZDTSD009SOCREATION>(_ZMTSD009SOCREATION_QNAME, ZDTSD009SOCREATION.class, null, value);
}
}
package com.schneider_distributor;
import java.net.MalformedURLException;
import java.util.LinkedHashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping
public class TestController {
@Value("${spring.profiles.active}")
private String profiles;
@Autowired
ZMISD009SOCREATIONTask task;
private void verify() {
if(profiles.contains("pro")) {
throw new RuntimeException("spring.profiles.active=" + profiles + ", The test interface has been closed.");
}
}
@RequestMapping(method = {RequestMethod.GET, RequestMethod.POST})
public String list(HttpServletRequest request) {
this.verify();
Map<String, String> map = new LinkedHashMap<String, String>();
map.put("/", "接口列表");
map.put("/009_SO_CREATION", "分销商采购(特价采购)订单,EDI平台调用SAP接口上传数据");
StringBuffer sb = new StringBuffer();
for(String key : map.keySet()) {
sb.append("<A HREF=\"" + key + "\">" + map.get(key) + "</A>").append("<BR/>\n");
}
String html = "<HTML>\n" + sb.toString() + "</HTML>";
return html;
}
@RequestMapping(value= {"/009_SO_CREATION"}, method = {RequestMethod.GET, RequestMethod.POST})
public String executeZMISD009SOCREATIONTask() throws MalformedURLException {
this.verify();
task.runTask();
return "OK";
}
}
package com.schneider_distributor;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Z_DT_SD_009_SO_CREATION complex type的 Java 类。
*
* <p>以下模式片段指定包含在此类中的预期内容。
*
* <pre>
* &lt;complexType name="Z_DT_SD_009_SO_CREATION"&gt;
* &lt;complexContent&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
* &lt;sequence&gt;
* &lt;element name="Header"&gt;
* &lt;complexType&gt;
* &lt;complexContent&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
* &lt;sequence&gt;
* &lt;element name="BSTKD_E" minOccurs="0"&gt;
* &lt;simpleType&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"&gt;
* &lt;maxLength value="36"/&gt;
* &lt;/restriction&gt;
* &lt;/simpleType&gt;
* &lt;/element&gt;
* &lt;element name="VBELN" minOccurs="0"&gt;
* &lt;simpleType&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"&gt;
* &lt;maxLength value="10"/&gt;
* &lt;/restriction&gt;
* &lt;/simpleType&gt;
* &lt;/element&gt;
* &lt;element name="BSTDK" minOccurs="0"&gt;
* &lt;simpleType&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"&gt;
* &lt;maxLength value="8"/&gt;
* &lt;/restriction&gt;
* &lt;/simpleType&gt;
* &lt;/element&gt;
* &lt;element name="KUNNR" minOccurs="0"&gt;
* &lt;simpleType&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"&gt;
* &lt;maxLength value="10"/&gt;
* &lt;/restriction&gt;
* &lt;/simpleType&gt;
* &lt;/element&gt;
* &lt;element name="KGNNR" minOccurs="0"&gt;
* &lt;simpleType&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"&gt;
* &lt;maxLength value="10"/&gt;
* &lt;/restriction&gt;
* &lt;/simpleType&gt;
* &lt;/element&gt;
* &lt;element name="QTFLAG" minOccurs="0"&gt;
* &lt;simpleType&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"&gt;
* &lt;maxLength value="1"/&gt;
* &lt;/restriction&gt;
* &lt;/simpleType&gt;
* &lt;/element&gt;
* &lt;/sequence&gt;
* &lt;/restriction&gt;
* &lt;/complexContent&gt;
* &lt;/complexType&gt;
* &lt;/element&gt;
* &lt;element name="ITEM" maxOccurs="unbounded" minOccurs="0"&gt;
* &lt;complexType&gt;
* &lt;complexContent&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
* &lt;sequence&gt;
* &lt;element name="POSNR" minOccurs="0"&gt;
* &lt;simpleType&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"&gt;
* &lt;maxLength value="6"/&gt;
* &lt;/restriction&gt;
* &lt;/simpleType&gt;
* &lt;/element&gt;
* &lt;element name="VTEXT" minOccurs="0"&gt;
* &lt;simpleType&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"&gt;
* &lt;maxLength value="40"/&gt;
* &lt;/restriction&gt;
* &lt;/simpleType&gt;
* &lt;/element&gt;
* &lt;element name="MATNR" minOccurs="0"&gt;
* &lt;simpleType&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"&gt;
* &lt;maxLength value="18"/&gt;
* &lt;/restriction&gt;
* &lt;/simpleType&gt;
* &lt;/element&gt;
* &lt;element name="KWMENG" minOccurs="0"&gt;
* &lt;simpleType&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"&gt;
* &lt;maxLength value="15"/&gt;
* &lt;/restriction&gt;
* &lt;/simpleType&gt;
* &lt;/element&gt;
* &lt;element name="EDATU" minOccurs="0"&gt;
* &lt;simpleType&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"&gt;
* &lt;maxLength value="8"/&gt;
* &lt;/restriction&gt;
* &lt;/simpleType&gt;
* &lt;/element&gt;
* &lt;/sequence&gt;
* &lt;/restriction&gt;
* &lt;/complexContent&gt;
* &lt;/complexType&gt;
* &lt;/element&gt;
* &lt;/sequence&gt;
* &lt;/restriction&gt;
* &lt;/complexContent&gt;
* &lt;/complexType&gt;
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Z_DT_SD_009_SO_CREATION", propOrder = {
"header",
"item"
})
public class ZDTSD009SOCREATION {
@XmlElement(name = "Header", required = true)
protected ZDTSD009SOCREATION.Header header;
@XmlElement(name = "ITEM")
protected List<ZDTSD009SOCREATION.ITEM> item;
/**
* 获取header属性的值。
*
* @return
* possible object is
* {@link ZDTSD009SOCREATION.Header }
*
*/
public ZDTSD009SOCREATION.Header getHeader() {
return header;
}
/**
* 设置header属性的值。
*
* @param value
* allowed object is
* {@link ZDTSD009SOCREATION.Header }
*
*/
public void setHeader(ZDTSD009SOCREATION.Header value) {
this.header = value;
}
/**
* Gets the value of the item property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the item property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getITEM().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link ZDTSD009SOCREATION.ITEM }
*
*
*/
public List<ZDTSD009SOCREATION.ITEM> getITEM() {
if (item == null) {
item = new ArrayList<ZDTSD009SOCREATION.ITEM>();
}
return this.item;
}
/**
* <p>anonymous complex type的 Java 类。
*
* <p>以下模式片段指定包含在此类中的预期内容。
*
* <pre>
* &lt;complexType&gt;
* &lt;complexContent&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
* &lt;sequence&gt;
* &lt;element name="BSTKD_E" minOccurs="0"&gt;
* &lt;simpleType&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"&gt;
* &lt;maxLength value="36"/&gt;
* &lt;/restriction&gt;
* &lt;/simpleType&gt;
* &lt;/element&gt;
* &lt;element name="VBELN" minOccurs="0"&gt;
* &lt;simpleType&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"&gt;
* &lt;maxLength value="10"/&gt;
* &lt;/restriction&gt;
* &lt;/simpleType&gt;
* &lt;/element&gt;
* &lt;element name="BSTDK" minOccurs="0"&gt;
* &lt;simpleType&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"&gt;
* &lt;maxLength value="8"/&gt;
* &lt;/restriction&gt;
* &lt;/simpleType&gt;
* &lt;/element&gt;
* &lt;element name="KUNNR" minOccurs="0"&gt;
* &lt;simpleType&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"&gt;
* &lt;maxLength value="10"/&gt;
* &lt;/restriction&gt;
* &lt;/simpleType&gt;
* &lt;/element&gt;
* &lt;element name="KGNNR" minOccurs="0"&gt;
* &lt;simpleType&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"&gt;
* &lt;maxLength value="10"/&gt;
* &lt;/restriction&gt;
* &lt;/simpleType&gt;
* &lt;/element&gt;
* &lt;element name="QTFLAG" minOccurs="0"&gt;
* &lt;simpleType&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"&gt;
* &lt;maxLength value="1"/&gt;
* &lt;/restriction&gt;
* &lt;/simpleType&gt;
* &lt;/element&gt;
* &lt;/sequence&gt;
* &lt;/restriction&gt;
* &lt;/complexContent&gt;
* &lt;/complexType&gt;
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"bstkde",
"vbeln",
"bstdk",
"kunnr",
"kgnnr",
"qtflag"
})
public static class Header {
@XmlElement(name = "BSTKD_E")
protected String bstkde;
@XmlElement(name = "VBELN")
protected String vbeln;
@XmlElement(name = "BSTDK")
protected String bstdk;
@XmlElement(name = "KUNNR")
protected String kunnr;
@XmlElement(name = "KGNNR")
protected String kgnnr;
@XmlElement(name = "QTFLAG")
protected String qtflag;
/**
* 获取bstkde属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getBSTKDE() {
return bstkde;
}
/**
* 设置bstkde属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBSTKDE(String value) {
this.bstkde = value;
}
/**
* 获取vbeln属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getVBELN() {
return vbeln;
}
/**
* 设置vbeln属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setVBELN(String value) {
this.vbeln = value;
}
/**
* 获取bstdk属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getBSTDK() {
return bstdk;
}
/**
* 设置bstdk属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBSTDK(String value) {
this.bstdk = value;
}
/**
* 获取kunnr属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getKUNNR() {
return kunnr;
}
/**
* 设置kunnr属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setKUNNR(String value) {
this.kunnr = value;
}
/**
* 获取kgnnr属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getKGNNR() {
return kgnnr;
}
/**
* 设置kgnnr属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setKGNNR(String value) {
this.kgnnr = value;
}
/**
* 获取qtflag属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getQTFLAG() {
return qtflag;
}
/**
* 设置qtflag属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setQTFLAG(String value) {
this.qtflag = value;
}
}
/**
* <p>anonymous complex type的 Java 类。
*
* <p>以下模式片段指定包含在此类中的预期内容。
*
* <pre>
* &lt;complexType&gt;
* &lt;complexContent&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
* &lt;sequence&gt;
* &lt;element name="POSNR" minOccurs="0"&gt;
* &lt;simpleType&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"&gt;
* &lt;maxLength value="6"/&gt;
* &lt;/restriction&gt;
* &lt;/simpleType&gt;
* &lt;/element&gt;
* &lt;element name="VTEXT" minOccurs="0"&gt;
* &lt;simpleType&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"&gt;
* &lt;maxLength value="40"/&gt;
* &lt;/restriction&gt;
* &lt;/simpleType&gt;
* &lt;/element&gt;
* &lt;element name="MATNR" minOccurs="0"&gt;
* &lt;simpleType&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"&gt;
* &lt;maxLength value="18"/&gt;
* &lt;/restriction&gt;
* &lt;/simpleType&gt;
* &lt;/element&gt;
* &lt;element name="KWMENG" minOccurs="0"&gt;
* &lt;simpleType&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"&gt;
* &lt;maxLength value="15"/&gt;
* &lt;/restriction&gt;
* &lt;/simpleType&gt;
* &lt;/element&gt;
* &lt;element name="EDATU" minOccurs="0"&gt;
* &lt;simpleType&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"&gt;
* &lt;maxLength value="8"/&gt;
* &lt;/restriction&gt;
* &lt;/simpleType&gt;
* &lt;/element&gt;
* &lt;/sequence&gt;
* &lt;/restriction&gt;
* &lt;/complexContent&gt;
* &lt;/complexType&gt;
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"posnr",
"vtext",
"matnr",
"kwmeng",
"edatu"
})
public static class ITEM {
@XmlElement(name = "POSNR")
protected String posnr;
@XmlElement(name = "VTEXT")
protected String vtext;
@XmlElement(name = "MATNR")
protected String matnr;
@XmlElement(name = "KWMENG")
protected String kwmeng;
@XmlElement(name = "EDATU")
protected String edatu;
/**
* 获取posnr属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getPOSNR() {
return posnr;
}
/**
* 设置posnr属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPOSNR(String value) {
this.posnr = value;
}
/**
* 获取vtext属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getVTEXT() {
return vtext;
}
/**
* 设置vtext属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setVTEXT(String value) {
this.vtext = value;
}
/**
* 获取matnr属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getMATNR() {
return matnr;
}
/**
* 设置matnr属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMATNR(String value) {
this.matnr = value;
}
/**
* 获取kwmeng属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getKWMENG() {
return kwmeng;
}
/**
* 设置kwmeng属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setKWMENG(String value) {
this.kwmeng = value;
}
/**
* 获取edatu属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getEDATU() {
return edatu;
}
/**
* 设置edatu属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setEDATU(String value) {
this.edatu = value;
}
}
}
package com.schneider_distributor;
import javax.jws.Oneway;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.xml.bind.annotation.XmlSeeAlso;
/**
* This class was generated by Apache CXF 3.2.9
* 2019-07-05T14:08:11.116+08:00
* Generated source version: 3.2.9
*
*/
@WebService(targetNamespace = "http://schneider-distributor.com/", name = "Z_MI_SD_009_SO_CREATION")
@XmlSeeAlso({ObjectFactory.class})
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
public interface ZMISD009SOCREATION {
@WebMethod(operationName = "Z_MI_SD_009_SO_CREATION", action = "http://sap.com/xi/WebService/soap1.1")
@Oneway
public void zMISD009SOCREATION(
@WebParam(partName = "Z_MT_SD_009_SO_CREATION", name = "Z_MT_SD_009_SO_CREATION", targetNamespace = "http://schneider-distributor.com/")
ZDTSD009SOCREATION zMTSD009SOCREATION
);
}
package com.schneider_distributor;
import java.net.MalformedURLException;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import javax.xml.ws.WebEndpoint;
import javax.xml.ws.WebServiceClient;
import javax.xml.ws.WebServiceFeature;
/**
* This class was generated by Apache CXF 3.2.9
* 2019-07-05T14:08:11.147+08:00
* Generated source version: 3.2.9
*
*/
@WebServiceClient(name = "Z_MI_SD_009_SO_CREATIONService",
wsdlLocation = "file:/C:/Users/Quxl/Desktop/Z_MI_SD_009_SO_CREATION.wsdl",
targetNamespace = "http://schneider-distributor.com/")
public class ZMISD009SOCREATIONService extends Service {
public final static URL WSDL_LOCATION;
public final static QName SERVICE = new QName("http://schneider-distributor.com/", "Z_MI_SD_009_SO_CREATIONService");
public final static QName ZMISD009SOCREATIONPort = new QName("http://schneider-distributor.com/", "Z_MI_SD_009_SO_CREATIONPort");
static {
URL url = null;
try {
url = new URL("file:/C:/Users/Quxl/Desktop/Z_MI_SD_009_SO_CREATION.wsdl");
} catch (MalformedURLException e) {
java.util.logging.Logger.getLogger(ZMISD009SOCREATIONService.class.getName())
.log(java.util.logging.Level.INFO,
"Can not initialize the default wsdl from {0}", "file:/C:/Users/Quxl/Desktop/Z_MI_SD_009_SO_CREATION.wsdl");
}
WSDL_LOCATION = url;
}
public ZMISD009SOCREATIONService(URL wsdlLocation) {
super(wsdlLocation, SERVICE);
}
public ZMISD009SOCREATIONService(URL wsdlLocation, QName serviceName) {
super(wsdlLocation, serviceName);
}
public ZMISD009SOCREATIONService() {
super(WSDL_LOCATION, SERVICE);
}
public ZMISD009SOCREATIONService(WebServiceFeature ... features) {
super(WSDL_LOCATION, SERVICE, features);
}
public ZMISD009SOCREATIONService(URL wsdlLocation, WebServiceFeature ... features) {
super(wsdlLocation, SERVICE, features);
}
public ZMISD009SOCREATIONService(URL wsdlLocation, QName serviceName, WebServiceFeature ... features) {
super(wsdlLocation, serviceName, features);
}
/**
*
* @return
* returns ZMISD009SOCREATION
*/
@WebEndpoint(name = "Z_MI_SD_009_SO_CREATIONPort")
public ZMISD009SOCREATION getZMISD009SOCREATIONPort() {
return super.getPort(ZMISD009SOCREATIONPort, ZMISD009SOCREATION.class);
}
/**
*
* @param features
* A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values.
* @return
* returns ZMISD009SOCREATION
*/
@WebEndpoint(name = "Z_MI_SD_009_SO_CREATIONPort")
public ZMISD009SOCREATION getZMISD009SOCREATIONPort(WebServiceFeature... features) {
return super.getPort(ZMISD009SOCREATIONPort, ZMISD009SOCREATION.class, features);
}
}
package com.schneider_distributor;
import java.net.MalformedURLException;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import com.schneider_distributor.ZDTSD009SOCREATION.Header;
import com.schneider_distributor.ZDTSD009SOCREATION.ITEM;
@Component
public class ZMISD009SOCREATIONTask {
@Autowired
private JdbcTemplate jdbcTemplate;
@Value("${SAP.NO009.WSDL}")
private String wsdlLocaltion;
@Scheduled(cron="${SAP.NO009.CRON}")
public void execute() throws Exception {
this.runTask();
}
public void runTask() throws MalformedURLException {
ZMISD009SOCREATIONService service = new ZMISD009SOCREATIONService(new URL(wsdlLocaltion));
this.sendData(service.getZMISD009SOCREATIONPort());
}
private void sendData(ZMISD009SOCREATION ZMISD009SOCREATION) {
List<Map<String, Object>> headerList = jdbcTemplate.queryForList("SELECT * FROM t_so_creation_header WHERE SEND_STATUS = ? LIMIT ?", "N", 1);
if(headerList.size() > 0) {
for(Map<String, Object> headerMap : headerList) {
ZDTSD009SOCREATION ZDTSD009SOCREATIONBean = new ZDTSD009SOCREATION();
Header header = new Header();
Long ID = (Long)headerMap.get("ID");
String BSTKD_E = (String)headerMap.get("BSTKD_E");
String VBELN = (String)headerMap.get("VBELN");
Date BSTDK = (Date)headerMap.get("BSTDK");
String KUNNR = (String)headerMap.get("KUNNR");
String KGNNR = (String)headerMap.get("KGNNR");
String QTFLAG = (String)headerMap.get("QTFLAG");
header.setBSTKDE(BSTKD_E);
header.setVBELN(VBELN);
header.setKUNNR(KUNNR);
header.setKGNNR(KGNNR);
header.setQTFLAG(QTFLAG);
if(BSTDK != null) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
header.setBSTDK(format.format(BSTDK));
}
ZDTSD009SOCREATIONBean.setHeader(header);
List<Map<String, Object>> itemList = jdbcTemplate.queryForList("SELECT * FROM t_so_creation_item WHERE HEADER_ID = ?", ID);
for(Map<String, Object> itemMap : itemList) {
String POSNR = (String)itemMap.get("POSNR");
String VTEXT = (String)itemMap.get("VTEXT");
String MATNR = (String)itemMap.get("MATNR");
Integer KWMENG = (Integer)itemMap.get("KWMENG");
Date EDATU = (Date)itemMap.get("EDATU");
ITEM item = new ITEM();
item.setPOSNR(POSNR);
item.setVTEXT(VTEXT);
item.setMATNR(MATNR);
if(KWMENG != null) {
item.setKWMENG(KWMENG.toString());
}
if(EDATU != null) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
item.setEDATU(format.format(EDATU));
}
ZDTSD009SOCREATIONBean.getITEM().add(item);
}
ZMISD009SOCREATION.zMISD009SOCREATION(ZDTSD009SOCREATIONBean);
jdbcTemplate.update("UPDATE t_so_creation_header SET SEND_STATUS = 'Y', SEND_TIME = NOW() WHERE ID = ?", ID);
}
}
}
}
@javax.xml.bind.annotation.XmlSchema(namespace = "http://schneider-distributor.com/")
package com.schneider_distributor;
/application.properties
wsUsername: test
wsPassword: 78258c537d6e4d5fb210a57d05619fb6
SAP:
NO009:
WSDL: http://schneider-distributor.com/Z_MI_SD_009_SO_CREATION.wsdl
CRON: 0 0 0 * * ?
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://10.10.0.111:3306/sso?useSSL=false&useUnicode=true&characterEncoding=utf8
username: root
password: egolm#2018
maxActive: 20
initialSize: 1
maxWait: 60000
minIdle: 1
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: true
testOnReturn: true
poolPreparedStatements: true
maxOpenPreparedStatements: 20
\ No newline at end of file
wsUsername: schneider
wsPassword: f14d4a80f823438a875b1924384c944c
SAP:
NO009:
WSDL: http://schneider-distributor.com/Z_MI_SD_009_SO_CREATION.wsdl
CRON: 0 0 0 * * ?
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://10.10.0.111:3306/sso?useSSL=false&useUnicode=true&characterEncoding=utf8
username: root
password: egolm#2018
maxActive: 20
initialSize: 1
maxWait: 60000
minIdle: 1
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: true
testOnReturn: true
poolPreparedStatements: true
maxOpenPreparedStatements: 20
wsUsername: test
wsPassword: 78258c537d6e4d5fb210a57d05619fb6
SAP:
NO009:
WSDL: http://schneider-distributor.com/Z_MI_SD_009_SO_CREATION.wsdl
CRON: 0 0 0 * * ?
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://10.10.0.111:3306/sso?useSSL=false&useUnicode=true&characterEncoding=utf8
username: root
password: egolm#2018
maxActive: 20
initialSize: 1
maxWait: 60000
minIdle: 1
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: true
testOnReturn: true
poolPreparedStatements: true
maxOpenPreparedStatements: 20
server:
port: 8080
spring:
profiles:
active: dev
cxf:
path: /sso/services
servlet:
load-on-startup: -1
\ No newline at end of file
log4j.rootLogger=info,appender
log4j.appender.appender=org.apache.log4j.ConsoleAppender
log4j.appender.appender.layout=org.apache.log4j.TTCCLayout
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<include resource="org/springframework/boot/logging/logback/base.xml" />
<appender name="siftingAppender" class="ch.qos.logback.classic.sift.SiftingAppender">
<discriminator>
<key>context</key>
<DefaultValue>logback</DefaultValue>
</discriminator>
<sift>
<appender name="rollingFileAppender"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<FileNamePattern>/data/logs/sso/${context}-%d{yyyy-MM-dd}.log</FileNamePattern>
<MaxHistory>30</MaxHistory>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
</encoder>
</appender>
</sift>
</appender>
<root level="INFO">
<appender-ref ref="siftingAppender" />
</root>
<springProfile name="dev">
<root level="INFO">
<appender-ref ref="siftingAppender" />
</root>
</springProfile>
<springProfile name="pro">
<root level="INFO">
<appender-ref ref="siftingAppender" />
</root>
</springProfile>
<!-- <logger name="com.microsoft" level="INFO" />
<logger name="com.alibaba" level="INFO" />
<logger name="springfox" level="ERROR" />
<logger name="javax" level="ERROR" />
<logger name="java" level="ERROR" />
<logger name="net" level="ERROR" />
<logger name="org" level="INFO" />
<logger name="io" level="INFO" /> -->
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="Z_MI_SD_009_SO_CREATION" targetNamespace="http://schneider-distributor.com/" xmlns:p1="http://schneider-distributor.com/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<xsd:schema targetNamespace="http://schneider-distributor.com/" xmlns="http://schneider-distributor.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="Z_MT_SD_009_SO_CREATION" type="Z_DT_SD_009_SO_CREATION" />
<xsd:complexType name="Z_DT_SD_009_SO_CREATION">
<xsd:sequence>
<xsd:element name="Header">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">a3b37530b5ca11dbadee001641a70fb2</xsd:appinfo>
<xsd:documentation xml:lang="ZH">Header Line</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element name="BSTKD_E" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">a3b37531b5ca11dbafa9001641a70fb2</xsd:appinfo>
<xsd:documentation xml:lang="ZH">Customer purchase order number</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="36" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="VBELN" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">d7dd56f0b5ca11db8a66001641a70fb2</xsd:appinfo>
<xsd:documentation xml:lang="ZH">Quotation Number</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="10" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="BSTDK" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">d7dd56f1b5ca11dbad16001641a70fb2</xsd:appinfo>
<xsd:documentation xml:lang="ZH">PO Date</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="8" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="KUNNR" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">d7dd56f2b5ca11db954a001641a70fb2</xsd:appinfo>
<xsd:documentation xml:lang="ZH">Sold-to party</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="10" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="KGNNR" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">d7dd56f3b5ca11dbc0dc001641a70fb2</xsd:appinfo>
<xsd:documentation xml:lang="ZH">Ship-to party</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="10" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="QTFLAG" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">ebf40260b5ca11dbc7e0001641a70fb2</xsd:appinfo>
<xsd:documentation xml:lang="ZH">Quotation Flag</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="1" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="ITEM" minOccurs="0" maxOccurs="unbounded" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">f60110b0b67711db827c001641a70fb2</xsd:appinfo>
<xsd:documentation xml:lang="ZH">ITEM DATA</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element name="POSNR" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">f60110b1b67711dba026001641a70fb2</xsd:appinfo>
<xsd:documentation xml:lang="ZH">Item number</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="6" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="VTEXT" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">f60110b2b67711dbc938001641a70fb2</xsd:appinfo>
<xsd:documentation xml:lang="ZH">Item number of the underlying customer purchase order</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="40" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="MATNR" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">f60110b3b67711dbc52c001641a70fb2</xsd:appinfo>
<xsd:documentation xml:lang="ZH">Material Number</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="18" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="KWMENG" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">f60110b4b67711db9a2b001641a70fb2</xsd:appinfo>
<xsd:documentation xml:lang="ZH">Quantity Quantity</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="15" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="EDATU" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">f60110b5b67711db9b3f001641a70fb2</xsd:appinfo>
<xsd:documentation xml:lang="ZH">Customer request delivery date</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="8" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
<wsdl:message name="Z_MT_SD_009_SO_CREATION">
<wsdl:part name="Z_MT_SD_009_SO_CREATION" element="p1:Z_MT_SD_009_SO_CREATION" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" />
</wsdl:message>
<wsdl:portType name="Z_MI_SD_009_SO_CREATION">
<wsdl:operation name="Z_MI_SD_009_SO_CREATION">
<wsdl:input message="p1:Z_MT_SD_009_SO_CREATION" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="Z_MI_SD_009_SO_CREATIONBinding" type="p1:Z_MI_SD_009_SO_CREATION" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" />
<wsdl:operation name="Z_MI_SD_009_SO_CREATION">
<soap:operation soapAction="http://sap.com/xi/WebService/soap1.1" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" />
<wsdl:input>
<soap:body use="literal" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" />
</wsdl:input>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="Z_MI_SD_009_SO_CREATIONService">
<wsdl:port name="Z_MI_SD_009_SO_CREATIONPort" binding="p1:Z_MI_SD_009_SO_CREATIONBinding" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<soap:address location="http://xiprd:8000/sap/xi/engine?type=entry&amp;version=3.0&amp;Sender.Service=S000000002&amp;Interface=http%3A%2F%2Fschneider-distributor.com%2F%5EZ_MI_SD_009_SO_CREATION" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
\ No newline at end of file
package test;
import com.egolm.sso.services.confirm_quotation.ConfirmQuotationService;
import com.egolm.sso.services.confirm_quotation.Z_MT_SD_008_SO_CONFIRM_QUOTATION;
import com.egolm.sso.util.ServiceFactory;
import com.egolm.sso.util.StringUtil;
import com.egolm.sso.util.XMLUtil;
public class ConfirmQuotationTest {
public static void main(String[] args) throws Exception {
String wsdlLocation = "http://localhost:8080/sso/services/confirm_quotation?wsdl";
String namespace = "http://confirm_quotation.sso.egolm.com";
String serviceName = "ConfirmQuotationService";
ConfirmQuotationService service = ServiceFactory.create(wsdlLocation, namespace, serviceName, ConfirmQuotationService.class);
String XML = StringUtil.readText("D:/data/sso/008-1.XML");
Z_MT_SD_008_SO_CONFIRM_QUOTATION Z_MT_SD_008_SO_CONFIRM_QUOTATION = XMLUtil.toBeanByJxab(XML, Z_MT_SD_008_SO_CONFIRM_QUOTATION.class);
service.execute(Z_MT_SD_008_SO_CONFIRM_QUOTATION);
}
}
package test;
import com.egolm.sso.services.dn_deletion.DELETED_DOCUMENTS;
import com.egolm.sso.services.dn_deletion.DNDeletionService;
import com.egolm.sso.util.ServiceFactory;
import com.egolm.sso.util.StringUtil;
import com.egolm.sso.util.XMLUtil;
public class DeletionServiceTest {
public static void main(String[] args) throws Exception {
String wsdlLocation = "http://localhost:8080/sso/services/dn_deletion?wsdl";
String namespace = "http://dn_deletion.sso.egolm.com";
String serviceName = "DNDeletionService";
DNDeletionService service = ServiceFactory.create(wsdlLocation, namespace, serviceName, DNDeletionService.class);
String XML = StringUtil.readText("D:/data/sso/010.XML");
DELETED_DOCUMENTS DELETED_DOCUMENTS = XMLUtil.toBeanByJxab(XML, DELETED_DOCUMENTS.class);
service.execute(DELETED_DOCUMENTS);
}
}
package test;
import com.egolm.sso.services.material_master.MaterialMasterService;
import com.egolm.sso.services.material_master.Z_MT_SD_001_MATERIAL_MASTER;
import com.egolm.sso.util.ServiceFactory;
import com.egolm.sso.util.StringUtil;
import com.egolm.sso.util.XMLUtil;
public class MaterialMasterServiceTest {
public static void main(String[] args) throws Exception {
String wsdlLocation = "http://localhost:8080/sso/services/material_master?wsdl";
String namespace = "http://material_master.sso.egolm.com";
String serviceName = "MaterialMasterService";
MaterialMasterService service = ServiceFactory.create(wsdlLocation, namespace, serviceName, MaterialMasterService.class);
String XML = StringUtil.readText("D:/data/sso/001.XML");
Z_MT_SD_001_MATERIAL_MASTER Z_MT_SD_001_MATERIAL_MASTER = XMLUtil.toBeanByJxab(XML, Z_MT_SD_001_MATERIAL_MASTER.class);
service.execute(Z_MT_SD_001_MATERIAL_MASTER);
}
}
package test;
import com.schneider_distributor.ZDTSD009SOCREATION;
import com.schneider_distributor.ZMISD009SOCREATION;
import com.schneider_distributor.ZMISD009SOCREATIONService;
public class OSCreationServiceTest {
public static void main(String[] args) {
ZMISD009SOCREATIONService service = new ZMISD009SOCREATIONService();
ZMISD009SOCREATION ZMISD009SOCREATION = service.getZMISD009SOCREATIONPort();
ZMISD009SOCREATION.zMISD009SOCREATION(getZMTSD009SOCREATION());
}
private static ZDTSD009SOCREATION getZMTSD009SOCREATION() {
return null;
}
}
package test;
import com.egolm.sso.services.prforma_invoice.PrformaInvoiceService;
import com.egolm.sso.services.prforma_invoice.Z_MT_SD_005_PERFORM_INVOICE;
import com.egolm.sso.util.ServiceFactory;
import com.egolm.sso.util.StringUtil;
import com.egolm.sso.util.XMLUtil;
public class PrformaInvoiceServiceTest {
public static void main(String[] args) throws Exception {
String wsdlLocation = "http://localhost:8080/sso/services/prforma_invoice?wsdl";
String namespace = "http://prforma_invoice.sso.egolm.com";
String serviceName = "PrformaInvoiceService";
PrformaInvoiceService service = ServiceFactory.create(wsdlLocation, namespace, serviceName, PrformaInvoiceService.class);
String XML = StringUtil.readText("D:/data/sso/005.XML");
Z_MT_SD_005_PERFORM_INVOICE Z_MT_SD_005_PERFORM_INVOICE = XMLUtil.toBeanByJxab(XML, Z_MT_SD_005_PERFORM_INVOICE.class);
service.execute(Z_MT_SD_005_PERFORM_INVOICE);
}
}
package test;
import com.egolm.sso.services.price_list.PriceListService;
import com.egolm.sso.services.price_list.Z_MT_SD_002_PRICE_LIST;
import com.egolm.sso.util.ServiceFactory;
import com.egolm.sso.util.StringUtil;
import com.egolm.sso.util.XMLUtil;
public class PriceListServiceTest {
public static void main(String[] args) throws Exception {
String wsdlLocation = "http://localhost:8080/sso/services/price_list?wsdl";
String namespace = "http://price_list.sso.egolm.com";
String serviceName = "PriceListService";
PriceListService service = ServiceFactory.create(wsdlLocation, namespace, serviceName, PriceListService.class);
String XML = StringUtil.readText("D:/data/sso/002.XML");
Z_MT_SD_002_PRICE_LIST Z_MT_SD_002_PRICE_LIST = XMLUtil.toBeanByJxab(XML, Z_MT_SD_002_PRICE_LIST.class);
service.execute(Z_MT_SD_002_PRICE_LIST);
}
}
package test;
import com.egolm.sso.services.shipping_notfirmation.ShippingNotificationService;
import com.egolm.sso.services.shipping_notfirmation.Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE;
import com.egolm.sso.util.ServiceFactory;
import com.egolm.sso.util.StringUtil;
import com.egolm.sso.util.XMLUtil;
public class ShippingNotificationTest {
public static void main(String[] args) throws Exception {
String wsdlLocation = "http://localhost:8080/sso/services/shipping_notification?wsdl";
String namespace = "http://shipping_notification.sso.egolm.com";
String serviceName = "ShippingNotificationService";
ShippingNotificationService service = ServiceFactory.create(wsdlLocation, namespace, serviceName, ShippingNotificationService.class);
String XML = StringUtil.readText("D:/data/sso/007.XML");
Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE = XMLUtil.toBeanByJxab(XML, Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE.class);
service.execute(Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE);
}
}
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