Commit a920c8ce authored by Quxl's avatar Quxl

x

parent a2fa9b4a
package com.schneider_distributor;
import java.net.MalformedURLException;
import java.util.LinkedHashMap;
import java.util.Map;
......@@ -42,7 +43,7 @@ public class TestController {
}
@RequestMapping(value= {"/009_SO_CREATION"}, method = {RequestMethod.GET, RequestMethod.POST})
public String executeZMISD009SOCREATIONTask() {
public String executeZMISD009SOCREATIONTask() throws MalformedURLException {
this.verify();
task.runTask();
return "OK";
......
......@@ -2,11 +2,12 @@ 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;
import javax.xml.ws.Service;
/**
* This class was generated by Apache CXF 3.2.9
......
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("${wsdlLocation.009}")
private String wsdlLocaltion;
@Scheduled(cron="0 0 3 * * ?")
public void execute() {
public void execute() throws Exception {
this.runTask();
}
public void runTask() {
ZMISD009SOCREATIONService service = new ZMISD009SOCREATIONService();
ZMISD009SOCREATION ZMISD009SOCREATION = service.getZMISD009SOCREATIONPort();
ZMISD009SOCREATION.zMISD009SOCREATION(null);
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);
}
}
}
}
wsUsername: test
wsPassword: 78258c537d6e4d5fb210a57d05619fb6
wsdlLocation:
009: http://schneider-distributor.com/Z_MI_SD_009_SO_CREATION.wsdl
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
......
wsUsername: schneider
wsPassword: f14d4a80f823438a875b1924384c944c
wsdlLocation:
009: http://schneider-distributor.com/Z_MI_SD_009_SO_CREATION.wsdl
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
......
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