...
|
...
|
@@ -2,13 +2,14 @@ package com.tianbo.imfClient.schedul; |
|
|
|
|
|
import com.caac.imf.api.IMFClient;
|
|
|
import com.caac.imf.api.IMFClientFactory;
|
|
|
import com.tianbo.imfClient.IMF_Reader;
|
|
|
import com.tianbo.imfClient.IMF_Sender;
|
|
|
import com.tianbo.util.IO.FileTool;
|
|
|
import org.apache.log4j.Logger;
|
|
|
import org.apache.log4j.PropertyConfigurator;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springframework.web.client.RestOperations;
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
|
@Component
|
...
|
...
|
@@ -22,15 +23,29 @@ public class IMF_Task { |
|
|
public static String loginpass;
|
|
|
public static String isNeedSend = "N";
|
|
|
|
|
|
@Autowired
|
|
|
private RestOperations restTemplate;
|
|
|
|
|
|
|
|
|
// @Scheduled(fixedRate = 5000)
|
|
|
public static void start() throws Exception {
|
|
|
@Scheduled(fixedRate = 5000)
|
|
|
public void start() throws Exception {
|
|
|
PropertyConfigurator.configure("config/log4j.properties");
|
|
|
client = IMFClientFactory.createInstance();
|
|
|
loginname= FileTool.readProperties("loginname");
|
|
|
loginpass= FileTool.readProperties("loginpass");
|
|
|
isNeedSend= FileTool.readProperties("isNeedSend");
|
|
|
|
|
|
logger.info(restTemplate);
|
|
|
restTemplate.put("http://fimsagentserver/msgAgent","<MSG>\n" +
|
|
|
"\t<META>\n" +
|
|
|
"\t\t<SNDR>FIMS</SNDR>\n" +
|
|
|
"\t\t<RCVR/>\n" +
|
|
|
"\t\t<SEQN>315756</SEQN>\n" +
|
|
|
"\t\t<DDTM>20190401020521</DDTM>\n" +
|
|
|
"\t\t<TYPE>DFOE</TYPE>\n" +
|
|
|
"\t\t<STYP>DFDL</STYP>\n" +
|
|
|
"\t</META>" +
|
|
|
"</MSG>");
|
|
|
|
|
|
//登录
|
|
|
if (!LOGIN_OK) {
|
...
|
...
|
@@ -39,7 +54,7 @@ public class IMF_Task { |
|
|
|
|
|
//启动读取线程
|
|
|
if (client != null) {
|
|
|
IMF_Reader reader = new IMF_Reader(client);
|
|
|
IMF_Reader reader = new IMF_Reader();
|
|
|
|
|
|
if (!IMF_Reader.isrunning) {
|
|
|
reader.start();
|
...
|
...
|
|