Commit 8b7c0f86 authored by Quxl's avatar Quxl

x

parent d94d6ff0
...@@ -4,3 +4,4 @@ ...@@ -4,3 +4,4 @@
/.project /.project
/application.properties /application.properties
/bin/ /bin/
/logs/
package com.schneider_distributor; package com.schneider_distributor;
import java.io.File;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
...@@ -8,7 +9,7 @@ import java.util.List; ...@@ -8,7 +9,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.system.ApplicationHome;
import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -22,16 +23,18 @@ public class ZMISD009SOCREATIONTask { ...@@ -22,16 +23,18 @@ public class ZMISD009SOCREATIONTask {
@Autowired @Autowired
private JdbcTemplate jdbcTemplate; private JdbcTemplate jdbcTemplate;
@Value("${SAP.NO009.WSDL}")
private String wsdlLocaltion;
@Scheduled(cron="${SAP.NO009.CRON}") @Scheduled(cron="${SAP.NO009.CRON}")
public void execute() throws Exception { public void execute() throws Exception {
this.runTask(); this.runTask();
} }
public void runTask() throws MalformedURLException { public void runTask() throws MalformedURLException {
ZMISD009SOCREATIONService service = new ZMISD009SOCREATIONService(new URL(wsdlLocaltion)); ApplicationHome home = new ApplicationHome(getClass());
File jarFile = home.getSource();
File folder = jarFile.getParentFile();
String absolutePath = folder.getAbsolutePath();
String wsdlLocation = "file:///" + absolutePath + "/WSDL/Z_MI_SD_009_SO_CREATION.wsdl";
ZMISD009SOCREATIONService service = new ZMISD009SOCREATIONService(new URL(wsdlLocation));
this.sendData(service.getZMISD009SOCREATIONPort()); this.sendData(service.getZMISD009SOCREATIONPort());
} }
...@@ -85,4 +88,12 @@ public class ZMISD009SOCREATIONTask { ...@@ -85,4 +88,12 @@ public class ZMISD009SOCREATIONTask {
} }
} }
} }
public static void main(String[] args) {
String osName = System.getProperty("os.name");
if(osName.toLowerCase().contains("windows")) {
System.out.println(true);
}
System.out.println(osName);
}
} }
...@@ -2,7 +2,6 @@ wsUsername: test ...@@ -2,7 +2,6 @@ wsUsername: test
wsPassword: 78258c537d6e4d5fb210a57d05619fb6 wsPassword: 78258c537d6e4d5fb210a57d05619fb6
SAP: SAP:
NO009: NO009:
WSDL: http://schneider-distributor.com/Z_MI_SD_009_SO_CREATION.wsdl
CRON: 0 0 0 * * ? CRON: 0 0 0 * * ?
spring: spring:
datasource: datasource:
......
...@@ -2,7 +2,6 @@ wsUsername: schneider ...@@ -2,7 +2,6 @@ wsUsername: schneider
wsPassword: f14d4a80f823438a875b1924384c944c wsPassword: f14d4a80f823438a875b1924384c944c
SAP: SAP:
NO009: NO009:
WSDL: http://schneider-distributor.com/Z_MI_SD_009_SO_CREATION.wsdl
CRON: 0 0 0 * * ? CRON: 0 0 0 * * ?
spring: spring:
datasource: datasource:
......
...@@ -2,7 +2,6 @@ wsUsername: test ...@@ -2,7 +2,6 @@ wsUsername: test
wsPassword: 78258c537d6e4d5fb210a57d05619fb6 wsPassword: 78258c537d6e4d5fb210a57d05619fb6
SAP: SAP:
NO009: NO009:
WSDL: http://schneider-distributor.com/Z_MI_SD_009_SO_CREATION.wsdl
CRON: 0 0 0 * * ? CRON: 0 0 0 * * ?
spring: spring:
datasource: datasource:
......
package test; package test;
import java.io.File;
import java.net.URL;
import org.springframework.boot.system.ApplicationHome;
import com.schneider_distributor.ZDTSD009SOCREATION; import com.schneider_distributor.ZDTSD009SOCREATION;
import com.schneider_distributor.ZMISD009SOCREATION; import com.schneider_distributor.ZMISD009SOCREATION;
import com.schneider_distributor.ZMISD009SOCREATIONService; import com.schneider_distributor.ZMISD009SOCREATIONService;
public class OSCreationServiceTest { public class OSCreationServiceTest {
public static void main(String[] args) { public static void main(String[] args) throws Exception {
ZMISD009SOCREATIONService service = new ZMISD009SOCREATIONService(); ApplicationHome home = new ApplicationHome(OSCreationServiceTest.class);
File jarFile = home.getSource();
File folder = jarFile.getParentFile();
String absolutePath = folder.getAbsolutePath();
String wsdlLocation = "file://////" + absolutePath + "/wsdl/Z_MI_SD_009_SO_CREATION.wsdl";
System.out.println(wsdlLocation);
ZMISD009SOCREATIONService service = new ZMISD009SOCREATIONService(new URL(wsdlLocation));
ZMISD009SOCREATION ZMISD009SOCREATION = service.getZMISD009SOCREATIONPort(); ZMISD009SOCREATION ZMISD009SOCREATION = service.getZMISD009SOCREATIONPort();
ZMISD009SOCREATION.zMISD009SOCREATION(getZMTSD009SOCREATION()); ZMISD009SOCREATION.zMISD009SOCREATION(getZMTSD009SOCREATION());
} }
......
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