|
@@ -21,6 +21,7 @@ import org.xml.sax.SAXParseException; |
|
@@ -21,6 +21,7 @@ import org.xml.sax.SAXParseException; |
21
|
import javax.annotation.PostConstruct;
|
21
|
import javax.annotation.PostConstruct;
|
22
|
import java.io.File;
|
22
|
import java.io.File;
|
23
|
import java.io.FileNotFoundException;
|
23
|
import java.io.FileNotFoundException;
|
|
|
24
|
+import java.io.IOException;
|
24
|
import java.io.UnsupportedEncodingException;
|
25
|
import java.io.UnsupportedEncodingException;
|
25
|
import java.util.concurrent.CountDownLatch;
|
26
|
import java.util.concurrent.CountDownLatch;
|
26
|
|
27
|
|
|
@@ -43,6 +44,10 @@ public class CustomXmlHandleThread implements Runnable{ |
|
@@ -43,6 +44,10 @@ public class CustomXmlHandleThread implements Runnable{ |
43
|
@Value("${custom.errBakDir}")
|
44
|
@Value("${custom.errBakDir}")
|
44
|
private String errBakDir;
|
45
|
private String errBakDir;
|
45
|
|
46
|
|
|
|
47
|
+ //匹配技术回执正则
|
|
|
48
|
+ @Value("${custom.delTechnologyReceptMatch}")
|
|
|
49
|
+ private String delTechnologyReceptMatch;
|
|
|
50
|
+
|
46
|
private File xmlfile;
|
51
|
private File xmlfile;
|
47
|
|
52
|
|
48
|
private static CustomXmlHandleThread customXmlHandle;
|
53
|
private static CustomXmlHandleThread customXmlHandle;
|
|
@@ -87,12 +92,22 @@ public class CustomXmlHandleThread implements Runnable{ |
|
@@ -87,12 +92,22 @@ public class CustomXmlHandleThread implements Runnable{ |
87
|
|
92
|
|
88
|
customXmlHandle.errBakDir = this.errBakDir;
|
93
|
customXmlHandle.errBakDir = this.errBakDir;
|
89
|
|
94
|
|
|
|
95
|
+ customXmlHandle.delTechnologyReceptMatch = this.delTechnologyReceptMatch;
|
|
|
96
|
+
|
90
|
// 初使化时将已静态化的testService实例化
|
97
|
// 初使化时将已静态化的testService实例化
|
91
|
}
|
98
|
}
|
92
|
|
99
|
|
93
|
@Override
|
100
|
@Override
|
94
|
public void run() {
|
101
|
public void run() {
|
95
|
- log.info("线程:{}开始",xmlfile.getName());
|
102
|
+ String filename = xmlfile.getName();
|
|
|
103
|
+ log.info("线程:{}开始",filename);
|
|
|
104
|
+ if(filename.matches(customXmlHandle.delTechnologyReceptMatch)){
|
|
|
105
|
+ log.warn("{}报文为技术回执,剪切到错误备份目录,不解析",filename);
|
|
|
106
|
+ errBak(xmlfile);
|
|
|
107
|
+ log.info("{}报文为技术回执,剪切备份成功..开始解析下一文件,当前线程即将结束",filename);
|
|
|
108
|
+ }
|
|
|
109
|
+ else
|
|
|
110
|
+ {
|
96
|
try{
|
111
|
try{
|
97
|
int i =handelXmlDocument();
|
112
|
int i =handelXmlDocument();
|
98
|
String today = DateUtil.getTodayBy_yyyyMMdd();
|
113
|
String today = DateUtil.getTodayBy_yyyyMMdd();
|
|
@@ -113,6 +128,8 @@ public class CustomXmlHandleThread implements Runnable{ |
|
@@ -113,6 +128,8 @@ public class CustomXmlHandleThread implements Runnable{ |
113
|
e.printStackTrace();
|
128
|
e.printStackTrace();
|
114
|
}
|
129
|
}
|
115
|
|
130
|
|
|
|
131
|
+ }
|
|
|
132
|
+
|
116
|
log.info("线程:{}结束",xmlfile.getName());
|
133
|
log.info("线程:{}结束",xmlfile.getName());
|
117
|
latch.countDown();
|
134
|
latch.countDown();
|
118
|
log.info("剩余线程数量{}",latch.getCount());
|
135
|
log.info("剩余线程数量{}",latch.getCount());
|
|
@@ -330,4 +347,5 @@ public class CustomXmlHandleThread implements Runnable{ |
|
@@ -330,4 +347,5 @@ public class CustomXmlHandleThread implements Runnable{ |
330
|
e.printStackTrace();
|
347
|
e.printStackTrace();
|
331
|
}
|
348
|
}
|
332
|
}
|
349
|
}
|
|
|
350
|
+
|
333
|
} |
351
|
} |