...
|
...
|
@@ -21,6 +21,7 @@ import org.xml.sax.SAXParseException; |
|
|
import javax.annotation.PostConstruct;
|
|
|
import java.io.File;
|
|
|
import java.io.FileNotFoundException;
|
|
|
import java.io.IOException;
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
import java.util.concurrent.CountDownLatch;
|
|
|
|
...
|
...
|
@@ -43,6 +44,10 @@ public class CustomXmlHandleThread implements Runnable{ |
|
|
@Value("${custom.errBakDir}")
|
|
|
private String errBakDir;
|
|
|
|
|
|
//匹配技术回执正则
|
|
|
@Value("${custom.delTechnologyReceptMatch}")
|
|
|
private String delTechnologyReceptMatch;
|
|
|
|
|
|
private File xmlfile;
|
|
|
|
|
|
private static CustomXmlHandleThread customXmlHandle;
|
...
|
...
|
@@ -87,12 +92,22 @@ public class CustomXmlHandleThread implements Runnable{ |
|
|
|
|
|
customXmlHandle.errBakDir = this.errBakDir;
|
|
|
|
|
|
customXmlHandle.delTechnologyReceptMatch = this.delTechnologyReceptMatch;
|
|
|
|
|
|
// 初使化时将已静态化的testService实例化
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void run() {
|
|
|
log.info("线程:{}开始",xmlfile.getName());
|
|
|
String filename = xmlfile.getName();
|
|
|
log.info("线程:{}开始",filename);
|
|
|
if(filename.matches(customXmlHandle.delTechnologyReceptMatch)){
|
|
|
log.warn("{}报文为技术回执,剪切到错误备份目录,不解析",filename);
|
|
|
errBak(xmlfile);
|
|
|
log.info("{}报文为技术回执,剪切备份成功..开始解析下一文件,当前线程即将结束",filename);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
try{
|
|
|
int i =handelXmlDocument();
|
|
|
String today = DateUtil.getTodayBy_yyyyMMdd();
|
...
|
...
|
@@ -113,6 +128,8 @@ public class CustomXmlHandleThread implements Runnable{ |
|
|
e.printStackTrace();
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
log.info("线程:{}结束",xmlfile.getName());
|
|
|
latch.countDown();
|
|
|
log.info("剩余线程数量{}",latch.getCount());
|
...
|
...
|
@@ -330,4 +347,5 @@ public class CustomXmlHandleThread implements Runnable{ |
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|