...
|
...
|
@@ -10,27 +10,29 @@ import org.apache.log4j.Logger; |
|
|
import java.io.File;
|
|
|
import java.util.List;
|
|
|
|
|
|
public class KAKO_Sender extends Thread{
|
|
|
public class KAKO_Sender extends Thread {
|
|
|
|
|
|
protected static final Logger logger = Logger.getLogger(KAKO_Sender.class);
|
|
|
public static boolean isrunning;
|
|
|
public static boolean isrunning;
|
|
|
private IMFClient client;
|
|
|
private String content;
|
|
|
|
|
|
public KAKO_Sender(IMFClient client) {
|
|
|
this.client = client;
|
|
|
}
|
|
|
|
|
|
public KAKO_Sender(IMFClient client, String content) {
|
|
|
this.client = client;
|
|
|
this.content = content;
|
|
|
}
|
|
|
|
|
|
public void run(){
|
|
|
public void run() {
|
|
|
try {
|
|
|
String sendDir = FileTool.readProperties("sendDirectory");
|
|
|
String sendDir = FileTool.readProperties("sendDirectory");
|
|
|
String SNDR = FileTool.readProperties("loginname");
|
|
|
String TYPE = FileTool.readProperties("TYPE");
|
|
|
String STYP = FileTool.readProperties("STYP");
|
|
|
String RCVR = FileTool.readProperties("RCVR");
|
|
|
String TYPE = FileTool.readProperties("TYPE");
|
|
|
String STYP = FileTool.readProperties("STYP");
|
|
|
String RCVR = FileTool.readProperties("RCVR");
|
|
|
// String DDTM = new DateTimeConverter().dateFormat();
|
|
|
// String SEQN = DDTM;
|
|
|
|
...
|
...
|
@@ -38,34 +40,37 @@ public class KAKO_Sender extends Thread{ |
|
|
logger.info("IMFClient has been closed");
|
|
|
return;
|
|
|
}
|
|
|
isrunning=true;
|
|
|
if(IMF_Tesk.LOGIN_OK){
|
|
|
while (true){
|
|
|
List<File> files = FileTool.readDirectoryFiles(new File(sendDir));
|
|
|
for (File file:files) {
|
|
|
String fileContent = FileTool.readfile(file);
|
|
|
String sendMsg = MakeImfMeta.makeImfDocument(SNDR,RCVR,TYPE,STYP,new DateTimeConverter().dateFormat(),new DateTimeConverter().dateFormat(),fileContent);
|
|
|
String returnMsg = this.client.sendMSG(sendMsg);
|
|
|
//发送成功处理,删除已发送成功的目录下的文件
|
|
|
if(returnMsg.indexOf("<CODE>9</CODE>")>=0){
|
|
|
FileUtils.forceDelete(file);
|
|
|
}
|
|
|
}
|
|
|
isrunning = true;
|
|
|
if (IMF_Tesk.LOGIN_OK) {
|
|
|
List<File> files = FileTool.readDirectoryFiles(new File(sendDir));
|
|
|
for (File file : files) {
|
|
|
String fileContent = "";
|
|
|
try {
|
|
|
Thread.sleep(500L);
|
|
|
} catch (InterruptedException var3) {
|
|
|
var3.printStackTrace();
|
|
|
|
|
|
fileContent = FileTool.readfile(file);
|
|
|
} catch (Exception e) {
|
|
|
FileUtils.forceDelete(file);
|
|
|
continue;
|
|
|
}
|
|
|
String sendMsg = MakeImfMeta.makeImfDocument(SNDR, RCVR, TYPE, STYP, new DateTimeConverter().dateFormat(), new DateTimeConverter().dateFormat(), fileContent);
|
|
|
String returnMsg = this.client.sendMSG(sendMsg);
|
|
|
//发送成功处理,删除已发送成功的目录下的文件
|
|
|
String msg = "<CODE>9</CODE>";
|
|
|
if (returnMsg.contains(msg)) {
|
|
|
FileUtils.forceDelete(file);
|
|
|
}
|
|
|
}
|
|
|
try {
|
|
|
Thread.sleep(500L);
|
|
|
} catch (InterruptedException var3) {
|
|
|
var3.printStackTrace();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}catch (Exception var14) {
|
|
|
} catch (Exception var14) {
|
|
|
var14.printStackTrace();
|
|
|
logger.info(var14.getMessage());
|
|
|
}
|
|
|
isrunning=false;
|
|
|
isrunning = false;
|
|
|
logger.info("<<<<<<<<<<<发送线程不在了>>>>>>>>>>>>");
|
|
|
}
|
|
|
} |
...
|
...
|
|