正在显示
19 个修改的文件
包含
1284 行增加
和
0 行删除
.gitignore
0 → 100644
1 | +/target/ | ||
2 | +!.mvn/wrapper/maven-wrapper.jar | ||
3 | + | ||
4 | +### STS ### | ||
5 | +.apt_generated | ||
6 | +.classpath | ||
7 | +.factorypath | ||
8 | +.project | ||
9 | +.settings | ||
10 | +.springBeans | ||
11 | +.sts4-cache | ||
12 | + | ||
13 | +### IntelliJ IDEA ### | ||
14 | +.idea | ||
15 | +*.iws | ||
16 | +*.iml | ||
17 | +*.ipr | ||
18 | + | ||
19 | +### NetBeans ### | ||
20 | +/nbproject/private/ | ||
21 | +/build/ | ||
22 | +/nbbuild/ | ||
23 | +/dist/ | ||
24 | +/nbdist/ | ||
25 | +/.nb-gradle/ |
META-INF/MANIFEST.MF
0 → 100644
1 | +Manifest-Version: 1.0 | ||
2 | +Class-Path: ribbon-transport-2.3.0.jar spring-boot-starter-tomcat-2.2. | ||
3 | + 0.BUILD-20181221.162141-59.jar tomcat-embed-core-9.0.14.jar jackson-a | ||
4 | + nnotations-2.9.0.jar commons-math-2.2.jar netflix-statistics-0.1.1.ja | ||
5 | + r spring-boot-starter-aop-2.2.0.BUILD-20181221.162119-59.jar rxnetty- | ||
6 | + 0.4.9.jar hystrix-core-1.5.18.jar eureka-client-1.9.8.jar spring-secu | ||
7 | + rity-crypto-5.1.3.BUILD-20181227.072951-43.jar ribbon-core-2.3.0.jar | ||
8 | + tomcat-embed-websocket-9.0.14.jar spring-webmvc-5.1.4.BUILD-20181226. | ||
9 | + 140909-39.jar jersey-core-1.19.1.jar spring-jcl-5.1.4.BUILD-20181226. | ||
10 | + 140909-39.jar servo-core-0.12.21.jar spring-boot-autoconfigure-2.2.0. | ||
11 | + BUILD-20181221.162052-59.jar xmlbeans-2.4.0.jar mybatis-spring-boot-s | ||
12 | + tarter-1.3.2.jar archaius-core-0.7.6.jar ribbon-loadbalancer-2.3.0.ja | ||
13 | + r jettison-1.3.7.jar spring-cloud-starter-netflix-eureka-client-2.1.0 | ||
14 | + .BUILD-20181228.020430-1172.jar spring-tx-5.1.4.BUILD-20181226.140909 | ||
15 | + -39.jar commons-configuration-1.8.jar bcprov-jdk15on-1.60.jar jackson | ||
16 | + -datatype-jdk8-2.9.8.jar spring-cloud-netflix-ribbon-2.1.0.BUILD-2018 | ||
17 | + 1228.020108-1232.jar jboss-logging-3.3.2.Final.jar spring-cloud-netfl | ||
18 | + ix-archaius-2.1.0.BUILD-20181228.020040-1241.jar spring-cloud-starter | ||
19 | + -netflix-ribbon-2.1.0.BUILD-20181228.020424-1172.jar spring-beans-5.1 | ||
20 | + .4.BUILD-20181226.140909-39.jar spring-cloud-starter-2.1.0.BUILD-2018 | ||
21 | + 1227.235921-1180.jar jackson-datatype-jsr310-2.9.8.jar jaxen-1.1.6.ja | ||
22 | + r commons-lang-2.6.jar log4j-to-slf4j-2.11.1.jar hibernate-validator- | ||
23 | + 6.0.13.Final.jar HdrHistogram-2.1.9.jar dom4j-2.1.0.jar gson-2.8.5.ja | ||
24 | + r xpp3_min-1.1.4c.jar druid-1.1.9.jar commons-jxpath-1.3.jar xstream- | ||
25 | + 1.4.10.jar commons-collections-3.2.2.jar spring-cloud-starter-netflix | ||
26 | + -archaius-2.1.0.BUILD-20181228.020417-1172.jar stringtemplate-3.2.1.j | ||
27 | + ar javax.annotation-api-1.3.2.jar spring-boot-starter-2.2.0.BUILD-201 | ||
28 | + 81221.162144-59.jar spring-web-5.1.4.BUILD-20181226.140909-39.jar com | ||
29 | + mons-io-2.6.jar guava-16.0.jar httpcore-4.4.10.jar spring-core-5.1.4. | ||
30 | + BUILD-20181226.140909-39.jar HikariCP-3.2.0.jar rxjava-1.3.8.jar jers | ||
31 | + ey-apache-client4-1.19.1.jar druid-spring-boot-starter-1.1.9.jar log4 | ||
32 | + j-1.2.16.jar tomcat-embed-el-9.0.14.jar bcpkix-jdk15on-1.60.jar mybat | ||
33 | + is-3.4.6.jar antlr-2.7.7.jar ojdbc6-11.2.0.4.0-atlassian-hosted.jar s | ||
34 | + nakeyaml-1.23.jar netflix-commons-util-0.3.0.jar spring-aop-5.1.4.BUI | ||
35 | + LD-20181226.140909-39.jar ribbon-2.3.0.jar spring-jdbc-5.1.4.BUILD-20 | ||
36 | + 181226.140909-39.jar jackson-module-parameter-names-2.9.8.jar spring- | ||
37 | + cloud-netflix-eureka-client-2.1.0.BUILD-20181228.020404-1172.jar stax | ||
38 | + -api-1.0.1.jar spring-cloud-netflix-hystrix-2.1.0.BUILD-20181228.0201 | ||
39 | + 46-564.jar netflix-eventbus-0.3.0.jar jul-to-slf4j-1.7.25.jar javax.i | ||
40 | + nject-1.jar spring-boot-starter-logging-2.2.0.BUILD-20181221.162136-5 | ||
41 | + 9.jar stax2-api-3.1.4.jar rxnetty-contexts-0.4.9.jar antlr-runtime-3. | ||
42 | + 4.jar spring-expression-5.1.4.BUILD-20181226.140909-39.jar jsr311-api | ||
43 | + -1.1.1.jar ribbon-eureka-2.3.0.jar compactmap-1.2.1.jar spring-boot-2 | ||
44 | + .2.0.BUILD-20181221.162149-59.jar commons-codec-1.11.jar log4j-api-2. | ||
45 | + 11.1.jar spring-cloud-context-2.1.0.BUILD-20181227.235814-1191.jar je | ||
46 | + rsey-client-1.19.1.jar rxnetty-servo-0.4.9.jar slf4j-api-1.6.1.jar sp | ||
47 | + ring-boot-starter-json-2.2.0.BUILD-20181221.162134-59.jar spring-secu | ||
48 | + rity-rsa-1.0.7.RELEASE.jar jackson-databind-2.9.8.jar spring-context- | ||
49 | + 5.1.4.BUILD-20181226.140909-39.jar httpclient-4.5.6.jar ribbon-httpcl | ||
50 | + ient-2.3.0.jar woodstox-core-asl-4.4.1.jar eureka-core-1.9.8.jar logb | ||
51 | + ack-core-1.2.3.jar stax-api-1.0-2.jar mybatis-spring-1.3.2.jar dexx-c | ||
52 | + ollections-0.2.jar xmlpull-1.1.3.1.jar classmate-1.4.0.jar validation | ||
53 | + -api-2.0.1.Final.jar aopalliance-1.0.jar netflix-infix-0.3.0.jar spri | ||
54 | + ng-boot-starter-web-2.2.0.BUILD-20181221.162143-59.jar spring-cloud-c | ||
55 | + ommons-2.1.0.BUILD-20181227.235904-1180.jar joda-time-2.10.1.jar aspe | ||
56 | + ctjweaver-1.9.2.jar jackson-core-2.9.8.jar spring-boot-starter-jdbc-2 | ||
57 | + .2.0.BUILD-20181221.162131-59.jar IMFClient.1.0.0.jar mybatis-spring- | ||
58 | + boot-autoconfigure-1.3.2.jar logback-classic-1.2.3.jar guice-4.1.0.ja | ||
59 | + r | ||
60 | +Main-Class: com.tianbo.warehouse.WarehouseApplication | ||
61 | + |
config/config.properties
0 → 100644
config/imf_config.properties
0 → 100644
config/log4j.properties
0 → 100644
1 | +########Log4j configuration##################################### | ||
2 | +log4j.rootLogger=INFO, stdout, fileout | ||
3 | + | ||
4 | + | ||
5 | +log4j.logger.com.fiscal = INFO | ||
6 | +#******************************* | ||
7 | +log4j.logger.com.system = INFO | ||
8 | +#******************************* | ||
9 | +log4j.appender.stdout=org.apache.log4j.ConsoleAppender | ||
10 | +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout | ||
11 | +log4j.appender.stdout.layout.ConversionPattern=%d{MM-dd HH:mm:ss,SSSS}[%p] %m%n | ||
12 | + | ||
13 | +#yyyy-MM-dd HH:mm:ss | ||
14 | + | ||
15 | + | ||
16 | +log4j.appender.fileout=org.apache.log4j.RollingFileAppender | ||
17 | +log4j.appender.fileout.File=logs/imf.log | ||
18 | +log4j.appender.fileout.MaxFileSize=50MB | ||
19 | +log4j.appender.fileout.MaxBackupIndex=10 | ||
20 | +log4j.appender.fileout.layout=org.apache.log4j.PatternLayout | ||
21 | +log4j.appender.fileout.layout.ConversionPattern=%d{MM-dd HH:mm:ss,SSSS}[%p] %m%n |
pom.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
3 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
4 | + <modelVersion>4.0.0</modelVersion> | ||
5 | + <parent> | ||
6 | + <groupId>org.springframework.boot</groupId> | ||
7 | + <artifactId>spring-boot-starter-parent</artifactId> | ||
8 | + <version>2.2.0.BUILD-SNAPSHOT</version> | ||
9 | + <relativePath/> <!-- lookup parent from repository --> | ||
10 | + </parent> | ||
11 | + <groupId>com.tianbo</groupId> | ||
12 | + <artifactId>warehouse</artifactId> | ||
13 | + <version>0.0.1-SNAPSHOT</version> | ||
14 | + <name>warehouse</name> | ||
15 | + <description>warehouse for Spring Boot</description> | ||
16 | + | ||
17 | + <properties> | ||
18 | + <java.version>1.8</java.version> | ||
19 | + <spring-cloud.version>Greenwich.BUILD-SNAPSHOT</spring-cloud.version> | ||
20 | + </properties> | ||
21 | + | ||
22 | + <dependencies> | ||
23 | + <!--spring boot--> | ||
24 | + <dependency> | ||
25 | + <groupId>org.springframework.boot</groupId> | ||
26 | + <artifactId>spring-boot-starter-jdbc</artifactId> | ||
27 | + </dependency> | ||
28 | + <dependency> | ||
29 | + <groupId>org.mybatis.spring.boot</groupId> | ||
30 | + <artifactId>mybatis-spring-boot-starter</artifactId> | ||
31 | + <version>1.3.2</version> | ||
32 | + </dependency> | ||
33 | + <dependency> | ||
34 | + <groupId>org.springframework.cloud</groupId> | ||
35 | + <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> | ||
36 | + </dependency> | ||
37 | + | ||
38 | + <dependency> | ||
39 | + <groupId>org.springframework.boot</groupId> | ||
40 | + <artifactId>spring-boot-starter-test</artifactId> | ||
41 | + <scope>test</scope> | ||
42 | + </dependency> | ||
43 | + <dependency> | ||
44 | + <groupId>org.springframework.boot</groupId> | ||
45 | + <artifactId>spring-boot-starter-web</artifactId> | ||
46 | + <!--<exclusions>--> | ||
47 | + <!--<exclusion>--> | ||
48 | + <!--<groupId>ch.qos.logback</groupId>--> | ||
49 | + <!--<artifactId>logback-classic</artifactId>--> | ||
50 | + <!--</exclusion>--> | ||
51 | + <!--</exclusions>--> | ||
52 | + </dependency> | ||
53 | + <!--spring boot--> | ||
54 | + <!-- alibaba的druid数据库连接池 --> | ||
55 | + <dependency> | ||
56 | + <groupId>com.alibaba</groupId> | ||
57 | + <artifactId>druid-spring-boot-starter</artifactId> | ||
58 | + <version>1.1.9</version> | ||
59 | + </dependency> | ||
60 | + <dependency> | ||
61 | + <groupId>com.oracle</groupId> | ||
62 | + <artifactId>ojdbc6</artifactId> | ||
63 | + <version>11.2.0.4.0-atlassian-hosted</version> | ||
64 | + </dependency> | ||
65 | + <!-- https://mvnrepository.com/artifact/org.dom4j/dom4j --> | ||
66 | + <dependency> | ||
67 | + <groupId>org.dom4j</groupId> | ||
68 | + <artifactId>dom4j</artifactId> | ||
69 | + <version>2.1.0</version> | ||
70 | + </dependency> | ||
71 | + <dependency> | ||
72 | + <groupId>commons-io</groupId> | ||
73 | + <artifactId>commons-io</artifactId> | ||
74 | + <version>2.6</version> | ||
75 | + </dependency> | ||
76 | + | ||
77 | + <!--IMF需要的包--> | ||
78 | + <!-- https://mvnrepository.com/artifact/org.apache.xmlbeans/xmlbeans --> | ||
79 | + <dependency> | ||
80 | + <groupId>org.apache.xmlbeans</groupId> | ||
81 | + <artifactId>xmlbeans</artifactId> | ||
82 | + <version>2.4.0</version> | ||
83 | + </dependency> | ||
84 | + <!-- https://mvnrepository.com/artifact/org.apache.ws.commons.schema/XmlSchema --> | ||
85 | + <dependency> | ||
86 | + <groupId>org.apache.ws.commons.schema</groupId> | ||
87 | + <artifactId>XmlSchema</artifactId> | ||
88 | + <version>1.4.7</version> | ||
89 | + </dependency> | ||
90 | + <!-- https://mvnrepository.com/artifact/wsdl4j/wsdl4j --> | ||
91 | + <dependency> | ||
92 | + <groupId>wsdl4j</groupId> | ||
93 | + <artifactId>wsdl4j</artifactId> | ||
94 | + <version>1.6.2</version> | ||
95 | + </dependency> | ||
96 | + <!-- https://mvnrepository.com/artifact/org.apache.neethi/neethi --> | ||
97 | + <dependency> | ||
98 | + <groupId>org.apache.neethi</groupId> | ||
99 | + <artifactId>neethi</artifactId> | ||
100 | + <version>2.0.4</version> | ||
101 | + </dependency> | ||
102 | + | ||
103 | + | ||
104 | + | ||
105 | + <!-- LOG --> | ||
106 | + <dependency> | ||
107 | + <groupId>log4j</groupId> | ||
108 | + <artifactId>log4j</artifactId> | ||
109 | + <version>1.2.16</version> | ||
110 | + </dependency> | ||
111 | + <!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api --> | ||
112 | + <dependency> | ||
113 | + <groupId>org.slf4j</groupId> | ||
114 | + <artifactId>slf4j-api</artifactId> | ||
115 | + <version>1.6.1</version> | ||
116 | + </dependency> | ||
117 | + <!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-jdk14 --> | ||
118 | + <dependency> | ||
119 | + <groupId>org.slf4j</groupId> | ||
120 | + <artifactId>slf4j-jdk14</artifactId> | ||
121 | + <version>1.6.1</version> | ||
122 | + <scope>test</scope> | ||
123 | + </dependency> | ||
124 | + <!-- https://mvnrepository.com/artifact/org.apache.cxf.xjcplugins/cxf-xjc-boolean --> | ||
125 | + <dependency> | ||
126 | + <groupId>org.apache.cxf.xjcplugins</groupId> | ||
127 | + <artifactId>cxf-xjc-boolean</artifactId> | ||
128 | + <version>3.2.3</version> | ||
129 | + </dependency> | ||
130 | + | ||
131 | + | ||
132 | + | ||
133 | + <!--添加本地IMF包--> | ||
134 | + <dependency> | ||
135 | + <groupId>com.caac</groupId> | ||
136 | + <artifactId>imf</artifactId> | ||
137 | + <version>1.0.0</version> | ||
138 | + <scope>system</scope> | ||
139 | + <systemPath>${project.basedir}/lib/IMFClient.1.0.0.jar</systemPath> | ||
140 | + </dependency> | ||
141 | + <dependency> | ||
142 | + <groupId>com.caac.imf</groupId> | ||
143 | + <artifactId>imfmessage</artifactId> | ||
144 | + <version>1.0.0</version> | ||
145 | + <scope>system</scope> | ||
146 | + <systemPath>${project.basedir}/lib/imfmsg.jar</systemPath> | ||
147 | + </dependency> | ||
148 | + <dependency> | ||
149 | + <groupId>com.caac.imf</groupId> | ||
150 | + <artifactId>process</artifactId> | ||
151 | + <version>1.0.0</version> | ||
152 | + <scope>system</scope> | ||
153 | + <systemPath>${project.basedir}/lib/ProcessService.jar</systemPath> | ||
154 | + </dependency> | ||
155 | + <dependency> | ||
156 | + <groupId>com.caac.imf</groupId> | ||
157 | + <artifactId>apiconfig</artifactId> | ||
158 | + <version>1.0.0</version> | ||
159 | + <scope>system</scope> | ||
160 | + <systemPath>${project.basedir}/lib/apiConfig.jar</systemPath> | ||
161 | + </dependency> | ||
162 | + <dependency> | ||
163 | + <groupId>com.caac.imf</groupId> | ||
164 | + <artifactId>upload</artifactId> | ||
165 | + <version>1.0.0</version> | ||
166 | + <scope>system</scope> | ||
167 | + <systemPath>${project.basedir}/lib/UploadService.jar</systemPath> | ||
168 | + </dependency> | ||
169 | + <dependency> | ||
170 | + <groupId>com.caac.imf</groupId> | ||
171 | + <artifactId>heartbeat</artifactId> | ||
172 | + <version>1.0.0</version> | ||
173 | + <scope>system</scope> | ||
174 | + <systemPath>${project.basedir}/lib/HeartbeatService.jar</systemPath> | ||
175 | + </dependency> | ||
176 | + <dependency> | ||
177 | + <groupId>com.caac.imf</groupId> | ||
178 | + <artifactId>returnxml</artifactId> | ||
179 | + <version>1.0.0</version> | ||
180 | + <scope>system</scope> | ||
181 | + <systemPath>${project.basedir}/lib/returnXml.jar</systemPath> | ||
182 | + </dependency> | ||
183 | + <!-- https://mvnrepository.com/artifact/org.hyperic/sigar --> | ||
184 | + <dependency> | ||
185 | + <groupId>org.hyperic</groupId> | ||
186 | + <artifactId>sigar</artifactId> | ||
187 | + <version>1.6.4</version> | ||
188 | + <scope>system</scope> | ||
189 | + <systemPath>${project.basedir}/lib/sigar.jar</systemPath> | ||
190 | + </dependency> | ||
191 | + <dependency> | ||
192 | + <groupId>org.apache</groupId> | ||
193 | + <artifactId>cxf</artifactId> | ||
194 | + <version>2.3.2</version> | ||
195 | + <scope>system</scope> | ||
196 | + <systemPath>${project.basedir}/lib/cxf-2.3.2.jar</systemPath> | ||
197 | + </dependency> | ||
198 | + <dependency> | ||
199 | + <groupId>org.apache.cxf</groupId> | ||
200 | + <artifactId>xjc</artifactId> | ||
201 | + <version>2.3.2</version> | ||
202 | + <scope>system</scope> | ||
203 | + <systemPath>${project.basedir}/lib/cxf-xjc-bug671-2.3.2.jar</systemPath> | ||
204 | + </dependency> | ||
205 | + <dependency> | ||
206 | + <groupId>maven.org.apache</groupId> | ||
207 | + <artifactId>cxf</artifactId> | ||
208 | + <version>2.0</version> | ||
209 | + <scope>system</scope> | ||
210 | + <systemPath>${project.basedir}/lib/cxf-manifest.jar</systemPath> | ||
211 | + </dependency> | ||
212 | + <dependency> | ||
213 | + <groupId>org.apache.cxf.xjc</groupId> | ||
214 | + <artifactId>dv</artifactId> | ||
215 | + <version>2.3.2</version> | ||
216 | + <scope>system</scope> | ||
217 | + <systemPath>${project.basedir}/lib/cxf-xjc-dv-2.3.2.jar</systemPath> | ||
218 | + </dependency> | ||
219 | + <dependency> | ||
220 | + <groupId>org.apache.cxf.xjc</groupId> | ||
221 | + <artifactId>ts</artifactId> | ||
222 | + <version>2.3.2</version> | ||
223 | + <scope>system</scope> | ||
224 | + <systemPath>${project.basedir}/lib/cxf-xjc-ts-2.3.2.jar</systemPath> | ||
225 | + </dependency> | ||
226 | + <dependency> | ||
227 | + <groupId>org.apache.xml</groupId> | ||
228 | + <artifactId>xmlsec</artifactId> | ||
229 | + <version>1.4.4</version> | ||
230 | + <scope>system</scope> | ||
231 | + <systemPath>${project.basedir}/lib/xmlsec-1.4.4.jar</systemPath> | ||
232 | + </dependency> | ||
233 | + <dependency> | ||
234 | + <groupId>com.ibm.disthub2.impl</groupId> | ||
235 | + <artifactId>cl3e</artifactId> | ||
236 | + <version>1.0.0</version> | ||
237 | + <scope>system</scope> | ||
238 | + <systemPath>${project.basedir}/lib/CL3Export.jar</systemPath> | ||
239 | + </dependency> | ||
240 | + <dependency> | ||
241 | + <groupId>com.ibm.disthub2.impl</groupId> | ||
242 | + <artifactId>cl3ne</artifactId> | ||
243 | + <version>1.0.0</version> | ||
244 | + <scope>system</scope> | ||
245 | + <systemPath>${project.basedir}/lib/CL3Nonexport.jar</systemPath> | ||
246 | + </dependency> | ||
247 | + <dependency> | ||
248 | + <groupId>com.ibm.mq</groupId> | ||
249 | + <artifactId>axis2</artifactId> | ||
250 | + <version>1.0.0</version> | ||
251 | + <scope>system</scope> | ||
252 | + <systemPath>${project.basedir}/lib/com.ibm.mq.axis2.jar</systemPath> | ||
253 | + </dependency> | ||
254 | + <dependency> | ||
255 | + <groupId>com.ibm.mq</groupId> | ||
256 | + <artifactId>commonservices</artifactId> | ||
257 | + <version>1.0.0</version> | ||
258 | + <scope>system</scope> | ||
259 | + <systemPath>${project.basedir}/lib/com.ibm.mq.commonservices.jar</systemPath> | ||
260 | + </dependency> | ||
261 | + <dependency> | ||
262 | + <groupId>com.ibm.mq</groupId> | ||
263 | + <artifactId>defaultconfig</artifactId> | ||
264 | + <version>1.0.0</version> | ||
265 | + <scope>system</scope> | ||
266 | + <systemPath>${project.basedir}/lib/com.ibm.mq.defaultconfig.jar</systemPath> | ||
267 | + </dependency> | ||
268 | + <dependency> | ||
269 | + <groupId>com.ibm.mq</groupId> | ||
270 | + <artifactId>fta</artifactId> | ||
271 | + <version>1.0.0</version> | ||
272 | + <scope>system</scope> | ||
273 | + <systemPath>${project.basedir}/lib/com.ibm.mq.fta.jar</systemPath> | ||
274 | + </dependency> | ||
275 | + <dependency> | ||
276 | + <groupId>com.ibm.mq</groupId> | ||
277 | + <artifactId>headers</artifactId> | ||
278 | + <version>1.0.0</version> | ||
279 | + <scope>system</scope> | ||
280 | + <systemPath>${project.basedir}/lib/com.ibm.mq.headers.jar</systemPath> | ||
281 | + </dependency> | ||
282 | + <dependency> | ||
283 | + <groupId>com.ibm</groupId> | ||
284 | + <artifactId>mq</artifactId> | ||
285 | + <version>1.0.0</version> | ||
286 | + <scope>system</scope> | ||
287 | + <systemPath>${project.basedir}/lib/com.ibm.mq.jar</systemPath> | ||
288 | + </dependency> | ||
289 | + <dependency> | ||
290 | + <groupId>com.ibm</groupId> | ||
291 | + <artifactId>jmqi</artifactId> | ||
292 | + <version>1.0.0</version> | ||
293 | + <scope>system</scope> | ||
294 | + <systemPath>${project.basedir}/lib/com.ibm.mq.jmqi.jar</systemPath> | ||
295 | + </dependency> | ||
296 | + <dependency> | ||
297 | + <groupId>com.ibm.mq</groupId> | ||
298 | + <artifactId>jms.nojndi</artifactId> | ||
299 | + <version>1.0.0</version> | ||
300 | + <scope>system</scope> | ||
301 | + <systemPath>${project.basedir}/lib/com.ibm.mq.jms.Nojndi.jar</systemPath> | ||
302 | + </dependency> | ||
303 | + <dependency> | ||
304 | + <groupId>com.ibm.mq</groupId> | ||
305 | + <artifactId>pcf</artifactId> | ||
306 | + <version>1.0.0</version> | ||
307 | + <scope>system</scope> | ||
308 | + <systemPath>${project.basedir}/lib/com.ibm.mq.pcf.jar</systemPath> | ||
309 | + </dependency> | ||
310 | + <dependency> | ||
311 | + <groupId>com.ibm.mq</groupId> | ||
312 | + <artifactId>postcard</artifactId> | ||
313 | + <version>1.0.0</version> | ||
314 | + <scope>system</scope> | ||
315 | + <systemPath>${project.basedir}/lib/com.ibm.mq.postcard.jar</systemPath> | ||
316 | + </dependency> | ||
317 | + <dependency> | ||
318 | + <groupId>com.ibm.mq</groupId> | ||
319 | + <artifactId>soap</artifactId> | ||
320 | + <version>1.0.0</version> | ||
321 | + <scope>system</scope> | ||
322 | + <systemPath>${project.basedir}/lib/com.ibm.mq.soap.jar</systemPath> | ||
323 | + </dependency> | ||
324 | + <dependency> | ||
325 | + <groupId>com.ibm.mq</groupId> | ||
326 | + <artifactId>tools.ras</artifactId> | ||
327 | + <version>1.0.0</version> | ||
328 | + <scope>system</scope> | ||
329 | + <systemPath>${project.basedir}/lib/com.ibm.mq.tools.ras.jar</systemPath> | ||
330 | + </dependency> | ||
331 | + <dependency> | ||
332 | + <groupId>com.ibm.mq</groupId> | ||
333 | + <artifactId>etclient</artifactId> | ||
334 | + <version>1.0.0</version> | ||
335 | + <scope>system</scope> | ||
336 | + <systemPath>${project.basedir}/lib/com.ibm.mqetclient.jar</systemPath> | ||
337 | + </dependency> | ||
338 | + <dependency> | ||
339 | + <groupId>com.ibm</groupId> | ||
340 | + <artifactId>mqjms</artifactId> | ||
341 | + <version>1.0.0</version> | ||
342 | + <scope>system</scope> | ||
343 | + <systemPath>${project.basedir}/lib/com.ibm.mqjms.jar</systemPath> | ||
344 | + <!-- https://mvnrepository.com/artifact/javax.resource/connector --> | ||
345 | + </dependency> | ||
346 | + <dependency> | ||
347 | + <groupId>javax.resource</groupId> | ||
348 | + <artifactId>connector</artifactId> | ||
349 | + <version>1.0</version> | ||
350 | + <scope>system</scope> | ||
351 | + <systemPath>${project.basedir}/lib/connector.jar</systemPath> | ||
352 | + </dependency> | ||
353 | + | ||
354 | + </dependencies> | ||
355 | + | ||
356 | + <dependencyManagement> | ||
357 | + <dependencies> | ||
358 | + <dependency> | ||
359 | + <groupId>org.springframework.cloud</groupId> | ||
360 | + <artifactId>spring-cloud-dependencies</artifactId> | ||
361 | + <version>${spring-cloud.version}</version> | ||
362 | + <type>pom</type> | ||
363 | + <scope>import</scope> | ||
364 | + </dependency> | ||
365 | + </dependencies> | ||
366 | + </dependencyManagement> | ||
367 | + | ||
368 | + <build> | ||
369 | + <plugins> | ||
370 | + <plugin> | ||
371 | + <groupId>org.springframework.boot</groupId> | ||
372 | + <artifactId>spring-boot-maven-plugin</artifactId> | ||
373 | + <configuration> | ||
374 | + <includeSystemScope>true</includeSystemScope> | ||
375 | + </configuration> | ||
376 | + </plugin> | ||
377 | + <!-- mybatis generator 自动生成代码插件 --> | ||
378 | + <plugin> | ||
379 | + <groupId>org.mybatis.generator</groupId> | ||
380 | + <artifactId>mybatis-generator-maven-plugin</artifactId> | ||
381 | + <version>1.3.2</version> | ||
382 | + <configuration> | ||
383 | + <configurationFile>${basedir}/src/main/resources/generator/generatorConfig.xml</configurationFile> | ||
384 | + <overwrite>true</overwrite> | ||
385 | + <verbose>true</verbose> | ||
386 | + </configuration> | ||
387 | + </plugin> | ||
388 | + </plugins> | ||
389 | + </build> | ||
390 | + | ||
391 | + <repositories> | ||
392 | + <repository> | ||
393 | + <id>spring-snapshots</id> | ||
394 | + <name>Spring Snapshots</name> | ||
395 | + <url>https://repo.spring.io/snapshot</url> | ||
396 | + <snapshots> | ||
397 | + <enabled>true</enabled> | ||
398 | + </snapshots> | ||
399 | + </repository> | ||
400 | + <repository> | ||
401 | + <id>spring-milestones</id> | ||
402 | + <name>Spring Milestones</name> | ||
403 | + <url>https://repo.spring.io/milestone</url> | ||
404 | + </repository> | ||
405 | + </repositories> | ||
406 | + <pluginRepositories> | ||
407 | + <pluginRepository> | ||
408 | + <id>spring-snapshots</id> | ||
409 | + <name>Spring Snapshots</name> | ||
410 | + <url>https://repo.spring.io/snapshot</url> | ||
411 | + <snapshots> | ||
412 | + <enabled>true</enabled> | ||
413 | + </snapshots> | ||
414 | + </pluginRepository> | ||
415 | + <pluginRepository> | ||
416 | + <id>spring-milestones</id> | ||
417 | + <name>Spring Milestones</name> | ||
418 | + <url>https://repo.spring.io/milestone</url> | ||
419 | + </pluginRepository> | ||
420 | + </pluginRepositories> | ||
421 | + | ||
422 | +</project> |
1 | +package com.tianbo.warehouse; | ||
2 | + | ||
3 | +import org.springframework.boot.SpringApplication; | ||
4 | +import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
5 | +import org.springframework.cloud.netflix.eureka.EnableEurekaClient; | ||
6 | +import org.springframework.context.annotation.ComponentScan; | ||
7 | +import org.springframework.scheduling.annotation.EnableScheduling; | ||
8 | + | ||
9 | +@SpringBootApplication | ||
10 | +@EnableScheduling | ||
11 | +@EnableEurekaClient | ||
12 | +public class WarehouseApplication { | ||
13 | + | ||
14 | + public static void main(String[] args) { | ||
15 | + SpringApplication.run(WarehouseApplication.class, args); | ||
16 | + } | ||
17 | + | ||
18 | +} | ||
19 | + |
1 | +package com.tianbo.warehouse.controller; | ||
2 | + | ||
3 | +import org.springframework.web.bind.annotation.GetMapping; | ||
4 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
5 | +import org.springframework.web.bind.annotation.RestController; | ||
6 | + | ||
7 | + | ||
8 | +@RestController | ||
9 | +@RequestMapping(value = "/") | ||
10 | +public class IndexController { | ||
11 | + | ||
12 | + @GetMapping("index") | ||
13 | + public String index(){ | ||
14 | + return "数据仓库接收,落地报文给新舱单"; | ||
15 | + } | ||
16 | + | ||
17 | +} |
1 | +package com.tianbo.warehouse.imf; | ||
2 | + | ||
3 | +import com.caac.imf.api.IMFClient; | ||
4 | +import com.tianbo.warehouse.schedul.IMF_Task; | ||
5 | +import com.tianbo.warehouse.util.IO.FileTool; | ||
6 | +import org.apache.log4j.Logger; | ||
7 | + | ||
8 | +public class IMF_Reader extends Thread{ | ||
9 | + protected static final Logger logger = Logger.getLogger(IMF_Reader.class); | ||
10 | + private IMFClient client; | ||
11 | + public static boolean isrunning; | ||
12 | + | ||
13 | + public IMF_Reader(IMFClient client) { | ||
14 | + this.client = client; | ||
15 | + } | ||
16 | + | ||
17 | + @Override | ||
18 | + public void run() { | ||
19 | + try{ | ||
20 | + isrunning =true; | ||
21 | + while(true) { | ||
22 | + if (IMF_Task.LOGIN_OK) { | ||
23 | + String message = this.client.getMSG(); | ||
24 | + if (message != null) { | ||
25 | + FileTool.writeFileToBak(message); | ||
26 | +// IMF_Message_MainHandle mainHandle = new IMF_Message_MainHandle(); | ||
27 | +// IMF_META meta = mainHandle.messageHandle(message); | ||
28 | + } | ||
29 | + logger.info("当前线程:"+Thread.currentThread().getName()); | ||
30 | + } else { | ||
31 | + //logger.info("***"); | ||
32 | + } | ||
33 | + | ||
34 | + try { | ||
35 | + Thread.sleep(500L); | ||
36 | + } catch (InterruptedException var3) { | ||
37 | + var3.printStackTrace(); | ||
38 | + | ||
39 | + } | ||
40 | + } | ||
41 | + | ||
42 | + }catch (Exception e){ | ||
43 | + e.printStackTrace(); | ||
44 | + } | ||
45 | + isrunning=false; | ||
46 | + logger.info("****************读取线程不在了****************"); | ||
47 | + } | ||
48 | +} |
1 | +package com.tianbo.warehouse.imf; | ||
2 | + | ||
3 | +import com.caac.imf.api.IMFClient; | ||
4 | +import com.tianbo.warehouse.schedul.IMF_Task; | ||
5 | +import com.tianbo.warehouse.util.Date.DateUtil; | ||
6 | +import com.tianbo.warehouse.util.IO.FileTool; | ||
7 | +import com.tianbo.warehouse.util.XML.MakeImfMeta; | ||
8 | +import org.apache.commons.io.FileUtils; | ||
9 | +import org.apache.log4j.Logger; | ||
10 | +import org.xml.sax.SAXParseException; | ||
11 | + | ||
12 | +import java.io.File; | ||
13 | +import java.util.List; | ||
14 | + | ||
15 | +public class IMF_Sender extends Thread{ | ||
16 | + | ||
17 | + protected static final Logger logger = Logger.getLogger(IMF_Sender.class); | ||
18 | + public static boolean isrunning; | ||
19 | + private IMFClient client; | ||
20 | + private String content; | ||
21 | + public IMF_Sender(IMFClient client) { | ||
22 | + this.client = client; | ||
23 | + } | ||
24 | + public IMF_Sender(IMFClient client, String content) { | ||
25 | + this.client = client; | ||
26 | + this.content = content; | ||
27 | + } | ||
28 | + | ||
29 | + @Override | ||
30 | + public void run(){ | ||
31 | + try { | ||
32 | + String sendDir = FileTool.readProperties("readDirectory"); | ||
33 | + String SNDR = FileTool.readProperties("loginname"); | ||
34 | + String TYPE = FileTool.readProperties("TYPE"); | ||
35 | + String STYP = FileTool.readProperties("STYP"); | ||
36 | + String RCVR = FileTool.readProperties("RCVR"); | ||
37 | + String DDTM = DateUtil.getDDTM(); | ||
38 | + String SEQN = DDTM; | ||
39 | + | ||
40 | + if (this.client == null) { | ||
41 | + logger.info("IMFClient has been closed"); | ||
42 | + return; | ||
43 | + } | ||
44 | + isrunning=true; | ||
45 | + if(IMF_Task.isSuc){ | ||
46 | + if(IMF_Task.LOGIN_OK){ | ||
47 | + while (true){ | ||
48 | + //发送报文 | ||
49 | + List<File> files = FileTool.readDirectoryFiles(new File(sendDir)); | ||
50 | + for (File file:files) { | ||
51 | + | ||
52 | + String sendMsg = MakeImfMeta.makeImfDocument(SNDR,RCVR,TYPE,STYP,DDTM,SEQN,file); | ||
53 | + String returnMsg = this.client.sendMSG(sendMsg); | ||
54 | + | ||
55 | + //发送成功处理,删除已发送成功的目录下的文件 | ||
56 | + if(returnMsg.indexOf("<CODE>9</CODE>")>=0){ | ||
57 | + FileUtils.forceDelete(file); | ||
58 | + } | ||
59 | + } | ||
60 | + try { | ||
61 | + Thread.sleep(500L); | ||
62 | + } catch (InterruptedException var3) { | ||
63 | + var3.printStackTrace(); | ||
64 | + } | ||
65 | + } | ||
66 | + }else{ | ||
67 | + logger.info("<<<<<<<<<<<登陆中>>>>>>>>>>>>"); | ||
68 | + } | ||
69 | + } | ||
70 | + | ||
71 | + }catch (Exception var14) { | ||
72 | + var14.printStackTrace(); | ||
73 | + logger.info(var14.getMessage()); | ||
74 | + } | ||
75 | + | ||
76 | + isrunning=false; | ||
77 | + logger.info("<<<<<<<<<<<发送线程结束>>>>>>>>>>>>"); | ||
78 | + } | ||
79 | +} |
1 | +package com.tianbo.warehouse.schedul; | ||
2 | + | ||
3 | +import com.caac.imf.api.IMFClient; | ||
4 | +import com.caac.imf.api.IMFClientFactory; | ||
5 | +import com.tianbo.warehouse.imf.IMF_Reader; | ||
6 | +import com.tianbo.warehouse.imf.IMF_Sender; | ||
7 | +import com.tianbo.warehouse.util.IO.FileTool; | ||
8 | +import org.apache.log4j.Logger; | ||
9 | +import org.apache.log4j.PropertyConfigurator; | ||
10 | +import org.springframework.scheduling.annotation.Scheduled; | ||
11 | +import org.springframework.stereotype.Component; | ||
12 | + | ||
13 | +import java.text.SimpleDateFormat; | ||
14 | + | ||
15 | +@Component | ||
16 | +public class IMF_Task { | ||
17 | + protected static final Logger logger = Logger.getLogger(IMF_Task.class); | ||
18 | + private static final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | ||
19 | + public static boolean LOGIN_OK = false; | ||
20 | + public static boolean isSuc = true; | ||
21 | + public static IMFClient client = null; | ||
22 | + | ||
23 | + @Scheduled(fixedRate = 5000) | ||
24 | + private static void start() throws Exception { | ||
25 | + PropertyConfigurator.configure("config/log4j.properties"); | ||
26 | + client = IMFClientFactory.createInstance(); | ||
27 | + String loginname = FileTool.readProperties("loginname"); | ||
28 | + String loginpass = FileTool.readProperties("loginpass"); | ||
29 | + | ||
30 | + | ||
31 | + if (client != null) { | ||
32 | + IMF_Reader reader = new IMF_Reader(client); | ||
33 | + if (!IMF_Reader.isrunning) { | ||
34 | + reader.start(); | ||
35 | + logger.info("*********KAKO读取线程已开启***********"); | ||
36 | + } else { | ||
37 | + // logger.info("*********KAKO读取线程已开启-不再启动线程*********"); | ||
38 | + } | ||
39 | + | ||
40 | + IMF_Sender kako_sender = new IMF_Sender(client); | ||
41 | + if(!IMF_Sender.isrunning) { | ||
42 | + kako_sender.start(); | ||
43 | + } | ||
44 | + } | ||
45 | + | ||
46 | + if (!LOGIN_OK) { | ||
47 | + loginIMF(client, loginname, loginpass, "config/imf_config.properties"); | ||
48 | + } | ||
49 | + | ||
50 | + | ||
51 | + } | ||
52 | + | ||
53 | + public void sendMsg(String msg){ | ||
54 | + if (!msg.equals(null) && !msg.isEmpty()){ | ||
55 | + if(LOGIN_OK){ | ||
56 | + IMF_Sender sender = new IMF_Sender(client,msg); | ||
57 | + sender.start(); | ||
58 | + } | ||
59 | + | ||
60 | + } | ||
61 | + | ||
62 | + } | ||
63 | + | ||
64 | + private static void loginIMF(IMFClient client, String userName, String password, String confFileName) { | ||
65 | + if (client.initial(confFileName)) { | ||
66 | + String message = client.login(userName, password); | ||
67 | + logger.info("message=" + message); | ||
68 | + if (message.indexOf("<CODE>1</CODE>") > 0) { | ||
69 | + logger.info("登陆成功"); | ||
70 | + LOGIN_OK = true; | ||
71 | + } else { | ||
72 | + int times = 0; | ||
73 | + | ||
74 | + while(times <= 3) { | ||
75 | + logger.info("try connection..."); | ||
76 | + ++times; | ||
77 | + logger.info("message.=" + message); | ||
78 | + if (message.indexOf("<CODE>1</CODE>") > 0) { | ||
79 | + logger.info("登陆成功"); | ||
80 | + LOGIN_OK = true; | ||
81 | + break; | ||
82 | + } | ||
83 | + | ||
84 | + logger.info("登录失败~~~~"); | ||
85 | + message = client.login(userName, password); | ||
86 | + | ||
87 | + try { | ||
88 | + Thread.sleep(4000L); | ||
89 | + } catch (InterruptedException var7) { | ||
90 | + var7.printStackTrace(); | ||
91 | + } | ||
92 | + } | ||
93 | + | ||
94 | + if (!LOGIN_OK) { | ||
95 | + logger.info("多次尝试登录失败,退出登陆"); | ||
96 | + client.disconnect(); | ||
97 | + isSuc =false; | ||
98 | + System.exit(-1); | ||
99 | + } | ||
100 | + } | ||
101 | + } | ||
102 | + | ||
103 | + } | ||
104 | + | ||
105 | +} |
1 | +package com.tianbo.warehouse.util.Date; | ||
2 | + | ||
3 | +import java.text.SimpleDateFormat; | ||
4 | +import java.util.Date; | ||
5 | + | ||
6 | +public final class DateUtil { | ||
7 | + private static Date currentDate = new Date(); | ||
8 | + private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | ||
9 | + private static SimpleDateFormat timesdf = new SimpleDateFormat("yyyyMMddHHmmss"); | ||
10 | + | ||
11 | + public static String getToday(){ | ||
12 | + return sdf.format(currentDate); | ||
13 | + } | ||
14 | + public static String getDDTM(){ | ||
15 | + return timesdf.format(currentDate); | ||
16 | + } | ||
17 | +} |
1 | +package com.tianbo.warehouse.util; | ||
2 | + | ||
3 | + | ||
4 | + | ||
5 | +import java.math.BigDecimal; | ||
6 | +import java.math.BigInteger; | ||
7 | +import java.util.Map; | ||
8 | +import java.util.UUID; | ||
9 | + | ||
10 | +public class Helper { | ||
11 | + | ||
12 | + /** | ||
13 | + * Object转BigDecimal类型-MRZ-2018年5月14日09:56:26 | ||
14 | + * | ||
15 | + * @param value 要转的object类型 | ||
16 | + * @return 转成的BigDecimal类型数据 | ||
17 | + */ | ||
18 | + static public BigDecimal getBigDecimal(Object value) { | ||
19 | + BigDecimal ret = null; | ||
20 | + if (value != null) { | ||
21 | + if (value instanceof BigDecimal) { | ||
22 | + ret = (BigDecimal) value; | ||
23 | + } else if (value instanceof String) { | ||
24 | + ret = new BigDecimal((String) value); | ||
25 | + } else if (value instanceof BigInteger) { | ||
26 | + ret = new BigDecimal((BigInteger) value); | ||
27 | + } else if (value instanceof Number) { | ||
28 | + ret = new BigDecimal(((Number) value).doubleValue()); | ||
29 | + } else { | ||
30 | + throw new ClassCastException("Not possible to coerce [" + value + "] from class " + value.getClass() + " into a BigDecimal."); | ||
31 | + } | ||
32 | + } | ||
33 | + return ret; | ||
34 | + } | ||
35 | + | ||
36 | + | ||
37 | + | ||
38 | + public static String getUUID(){ | ||
39 | + return UUID.randomUUID().toString().replace("-", ""); | ||
40 | + } | ||
41 | +} |
1 | +package com.tianbo.warehouse.util.IO; | ||
2 | + | ||
3 | +import com.tianbo.warehouse.util.Date.DateUtil; | ||
4 | +import com.tianbo.warehouse.util.Helper; | ||
5 | +import org.apache.commons.io.FileUtils; | ||
6 | + | ||
7 | +import java.io.*; | ||
8 | +import java.util.List; | ||
9 | +import java.util.Properties; | ||
10 | + | ||
11 | + | ||
12 | +public final class FileTool { | ||
13 | + private final static String errorRootDirectory = "errorLogs";//错误的根目录名 | ||
14 | + private final static String xmlRootDirectory = "xmlLog"; //记录已收到的报文目录 | ||
15 | + private final static String Cherector = "UTF-8"; | ||
16 | + | ||
17 | + /** | ||
18 | + * 写入文件 | ||
19 | + * @param path 二级目录 | ||
20 | + * @param content 写入内容 | ||
21 | + * @param rightOrwrong 是写入错误记录目录还是记录目录 | ||
22 | + */ | ||
23 | + public static void writeFile(String path,String content,boolean rightOrwrong){ | ||
24 | + StringBuffer stringBuffer = new StringBuffer(); | ||
25 | + | ||
26 | + if (rightOrwrong){ | ||
27 | + stringBuffer.append(xmlRootDirectory).append("/").append(path).append("/").append(DateUtil.getToday()).append("/").append(Helper.getUUID()).append(".log"); | ||
28 | + }else { | ||
29 | + stringBuffer.append(errorRootDirectory).append("/").append(path).append("/").append(DateUtil.getToday()).append("/").append(Helper.getUUID()).append(".log"); | ||
30 | + } | ||
31 | + | ||
32 | + File file = new File(stringBuffer.toString()); | ||
33 | + | ||
34 | + try{ | ||
35 | + FileUtils.writeStringToFile(file,content,Cherector); | ||
36 | + }catch (IOException e){ | ||
37 | + e.printStackTrace(); | ||
38 | + } | ||
39 | + | ||
40 | + } | ||
41 | + public static String readfile(File file) throws IOException{ | ||
42 | + String fileToString = FileUtils.readFileToString(file, "GB2312"); | ||
43 | + return fileToString; | ||
44 | + } | ||
45 | + | ||
46 | + public static List<File> readDirectoryFiles(File dir){ | ||
47 | + List<File> files = (List<File>)FileUtils.listFiles(dir,new String[]{"xml"},false); | ||
48 | + return files; | ||
49 | + } | ||
50 | + public static void writeWaybill(String path,String content,String waybillNo){ | ||
51 | + StringBuffer stringBuffer = new StringBuffer(); | ||
52 | + stringBuffer.append(xmlRootDirectory).append("/").append(path).append("/").append(DateUtil.getToday()).append("/").append(waybillNo).append(".log"); | ||
53 | + File file = new File(stringBuffer.toString()); | ||
54 | + try{ | ||
55 | + FileUtils.writeStringToFile(file,content,Cherector); | ||
56 | + }catch (IOException e){ | ||
57 | + e.printStackTrace(); | ||
58 | + } | ||
59 | + | ||
60 | + } | ||
61 | + | ||
62 | + public static void writeFileToBak(String content){ | ||
63 | + String bakDir = readProperties("bakDirectory"); | ||
64 | + StringBuffer stringBuffer = new StringBuffer(); | ||
65 | + stringBuffer.append(bakDir).append("/").append(Helper.getUUID()).append(".txt"); | ||
66 | + | ||
67 | + File file = new File(stringBuffer.toString()); | ||
68 | + | ||
69 | + try{ | ||
70 | + FileUtils.writeStringToFile(file,content,Cherector); | ||
71 | + }catch (IOException e){ | ||
72 | + e.printStackTrace(); | ||
73 | + } | ||
74 | + | ||
75 | + } | ||
76 | + | ||
77 | + public static String readProperties(String key){ | ||
78 | + Properties properties = new Properties(); | ||
79 | + String value = ""; | ||
80 | + try{ | ||
81 | + BufferedReader bufferedReader = new BufferedReader(new FileReader("config/config.properties")); | ||
82 | + properties.load(bufferedReader); | ||
83 | + //获取key对应的value值 | ||
84 | + value= properties.getProperty(key); | ||
85 | + }catch (Exception e){ | ||
86 | + e.printStackTrace(); | ||
87 | + } | ||
88 | + return value; | ||
89 | + | ||
90 | + } | ||
91 | + | ||
92 | + | ||
93 | +} |
1 | +package com.tianbo.warehouse.util.XML; | ||
2 | + | ||
3 | +import org.dom4j.Document; | ||
4 | +import org.dom4j.DocumentException; | ||
5 | +import org.dom4j.DocumentHelper; | ||
6 | +import org.dom4j.Element; | ||
7 | +import org.dom4j.io.SAXReader; | ||
8 | +import org.xml.sax.SAXParseException; | ||
9 | + | ||
10 | +import java.io.ByteArrayInputStream; | ||
11 | +import java.io.File; | ||
12 | +import java.io.UnsupportedEncodingException; | ||
13 | + | ||
14 | +public class MakeImfMeta { | ||
15 | + | ||
16 | + public static String makeImfDocument(String SNDR,String RCVR,String TYPE,String STYP,String DDTM,String SEQN,File Content) throws DocumentException,UnsupportedEncodingException,SAXParseException{ | ||
17 | + Document document = DocumentHelper.createDocument(); | ||
18 | + Element root = document.addElement( "MSG" ); | ||
19 | + Element meta = root.addElement("META"); | ||
20 | + meta.addElement("SNDR").addText(SNDR); | ||
21 | + meta.addElement("RCVR").addText(RCVR); | ||
22 | + meta.addElement("SEQN").addText(SEQN); | ||
23 | + meta.addElement("DDTM").addText(DDTM); | ||
24 | + meta.addElement("TYPE").addText(TYPE); | ||
25 | + meta.addElement("STYP").addText(STYP); | ||
26 | + | ||
27 | + SAXReader saxReader = new SAXReader(); | ||
28 | + Document doc = saxReader.read(Content); | ||
29 | + Element contentRoot = doc.getRootElement(); | ||
30 | + root.add(contentRoot); | ||
31 | + | ||
32 | + | ||
33 | + return document.asXML(); | ||
34 | + } | ||
35 | +} |
1 | +package com.tianbo.warehouse.util.XML; | ||
2 | + | ||
3 | +import java.util.ArrayList; | ||
4 | +import java.util.HashMap; | ||
5 | +import java.util.Iterator; | ||
6 | +import java.util.List; | ||
7 | +import java.util.Map; | ||
8 | + | ||
9 | +import org.dom4j.Attribute; | ||
10 | +import org.dom4j.Document; | ||
11 | +import org.dom4j.Element; | ||
12 | + | ||
13 | +public class XML2ENTITY { | ||
14 | + @SuppressWarnings("unchecked") | ||
15 | + /**取KEY的VALUE | ||
16 | + * | ||
17 | + */ | ||
18 | + public Map<String, Object> Dom2Map(Document doc){ | ||
19 | + Map<String, Object> map = new HashMap<String, Object>(); | ||
20 | + if(doc == null) | ||
21 | + return map; | ||
22 | + Element root = doc.getRootElement(); | ||
23 | + for (Iterator iterator = root.elementIterator(); iterator.hasNext();) { | ||
24 | + Element e = (Element) iterator.next(); | ||
25 | + List list = e.elements(); | ||
26 | + if(list.size() > 0){ | ||
27 | + map.put(e.getName(), Dom2Map(e)); | ||
28 | + }else | ||
29 | + map.put(e.getName(), e.getText()); | ||
30 | + } | ||
31 | + return map; | ||
32 | + } | ||
33 | + @SuppressWarnings("unchecked") | ||
34 | + public Map Dom2Map(Element e){ | ||
35 | + Map map = new HashMap(); | ||
36 | + List list = e.elements(); | ||
37 | + if(list.size() > 0){ | ||
38 | + for (int i = 0;i < list.size(); i++) { | ||
39 | + Element iter = (Element) list.get(i); | ||
40 | + List mapList = new ArrayList(); | ||
41 | + | ||
42 | + if(iter.elements().size() > 0){ | ||
43 | + Map m = Dom2Map(iter); | ||
44 | + if(map.get(iter.getName()) != null){ | ||
45 | + Object obj = map.get(iter.getName()); | ||
46 | + if(!obj.getClass().getName().equals("java.util.ArrayList")){ | ||
47 | + mapList = new ArrayList(); | ||
48 | + mapList.add(obj); | ||
49 | + mapList.add(m); | ||
50 | + } | ||
51 | + if(obj.getClass().getName().equals("java.util.ArrayList")){ | ||
52 | + mapList = (List) obj; | ||
53 | + mapList.add(m); | ||
54 | + } | ||
55 | + map.put(iter.getName(), mapList); | ||
56 | + }else | ||
57 | + map.put(iter.getName(), m); | ||
58 | + } | ||
59 | + else{ | ||
60 | + if(map.get(iter.getName()) != null){ | ||
61 | + Object obj = map.get(iter.getName()); | ||
62 | + if(!obj.getClass().getName().equals("java.util.ArrayList")){ | ||
63 | + mapList = new ArrayList(); | ||
64 | + mapList.add(obj); | ||
65 | + mapList.add(iter.getText()); | ||
66 | + } | ||
67 | + if(obj.getClass().getName().equals("java.util.ArrayList")){ | ||
68 | + mapList = (List) obj; | ||
69 | + mapList.add(iter.getText()); | ||
70 | + } | ||
71 | + map.put(iter.getName(), mapList); | ||
72 | + }else | ||
73 | + map.put(iter.getName(), iter.getText()); | ||
74 | + } | ||
75 | + } | ||
76 | + }else | ||
77 | + map.put(e.getName(), e.getText()); | ||
78 | + return map; | ||
79 | + } | ||
80 | + | ||
81 | + public List<Map> attrOfElement(Element e){ | ||
82 | + List attList = new ArrayList(); | ||
83 | + List<Attribute> listAttr = e.attributes(); | ||
84 | + for(Attribute attr:listAttr){//遍历当前节点的所有属性 | ||
85 | + String name=attr.getName();//属性名称 | ||
86 | + String value=attr.getValue();//属性的值 | ||
87 | + Map<String, Object> attMap = new HashMap<String, Object>(); | ||
88 | + attMap.put(name,value); | ||
89 | + attList.add(attMap); | ||
90 | + } | ||
91 | + return attList; | ||
92 | + } | ||
93 | + @SuppressWarnings("unchecked") | ||
94 | + /**遍历所有节点的属性值 | ||
95 | + * | ||
96 | + */ | ||
97 | + public Map<String, Object> Dom2Map_propety(Document doc){ | ||
98 | + Map<String, Object> map = new HashMap<String, Object>(); | ||
99 | + if(doc == null) | ||
100 | + return map; | ||
101 | + Element root = doc.getRootElement(); | ||
102 | + for (Iterator iterator = root.elementIterator(); iterator.hasNext();) { | ||
103 | + Element e = (Element) iterator.next(); | ||
104 | + List list = e.elements(); | ||
105 | + if(list.size() > 0){ | ||
106 | + map.put(e.getName(), Dom2Map_propety(e)); | ||
107 | + }else { | ||
108 | + map.put(e.getName(), attrOfElement(e)); | ||
109 | + } | ||
110 | + } | ||
111 | + return map; | ||
112 | + } | ||
113 | + @SuppressWarnings("unchecked") | ||
114 | + public Map Dom2Map_propety(Element e){ | ||
115 | + Map map = new HashMap(); | ||
116 | + List list = e.elements(); | ||
117 | + if(list.size() > 0){ | ||
118 | + for (int i = 0;i < list.size(); i++) { | ||
119 | + Element iter = (Element) list.get(i); | ||
120 | + List mapList = new ArrayList(); | ||
121 | + | ||
122 | + if(iter.elements().size() > 0){ | ||
123 | + Map m = Dom2Map_propety(iter); | ||
124 | + if(map.get(iter.getName()) != null){ | ||
125 | + Object obj = map.get(iter.getName()); | ||
126 | + if(!obj.getClass().getName().equals("java.util.ArrayList")){ | ||
127 | + mapList = new ArrayList(); | ||
128 | + mapList.add(obj); | ||
129 | + mapList.add(m); | ||
130 | + } | ||
131 | + if(obj.getClass().getName().equals("java.util.ArrayList")){ | ||
132 | + mapList = (List) obj; | ||
133 | + mapList.add(m); | ||
134 | + } | ||
135 | + map.put(iter.getName(), mapList); | ||
136 | + }else | ||
137 | + map.put(iter.getName(), m); | ||
138 | + } | ||
139 | + else{ | ||
140 | + if(map.get(iter.getName()) != null){ | ||
141 | + Object obj = map.get(iter.getName()); | ||
142 | + if(!obj.getClass().getName().equals("java.util.ArrayList")){ | ||
143 | + mapList = new ArrayList(); | ||
144 | + mapList.add(obj); | ||
145 | + mapList.add(iter.getText()); | ||
146 | + } | ||
147 | + if(obj.getClass().getName().equals("java.util.ArrayList")){ | ||
148 | + mapList = (List) obj; | ||
149 | + mapList.add(iter.getText()); | ||
150 | + } | ||
151 | + map.put(iter.getName(), mapList); | ||
152 | + }else{ | ||
153 | + map.put(iter.getName(), attrOfElement(iter)); | ||
154 | + } | ||
155 | + | ||
156 | + | ||
157 | + } | ||
158 | + } | ||
159 | + }else { | ||
160 | + map.put(e.getName(), attrOfElement(e)); | ||
161 | + } | ||
162 | + return map; | ||
163 | + } | ||
164 | + | ||
165 | + /** | ||
166 | + * 判断map是否包含key,包含返回KEY值,不包含返回NULL | ||
167 | + * @param map | ||
168 | + * @param key | ||
169 | + * @return | ||
170 | + */ | ||
171 | + | ||
172 | + public static Object getMap(Map map, String key){ | ||
173 | + if(map!=null && map.containsKey(key)){ | ||
174 | + return map.get(key); | ||
175 | + } else { | ||
176 | + return null; | ||
177 | + } | ||
178 | + } | ||
179 | + | ||
180 | + | ||
181 | +} | ||
182 | + | ||
183 | + |
1 | +package com.tianbo.warehouse.util.XML; | ||
2 | + | ||
3 | +import org.dom4j.Attribute; | ||
4 | +import org.dom4j.Document; | ||
5 | +import org.dom4j.Node; | ||
6 | + | ||
7 | +import java.util.Iterator; | ||
8 | +import java.util.List; | ||
9 | +import java.util.Map; | ||
10 | + | ||
11 | +public class XMLXPath { | ||
12 | + | ||
13 | + public static String getSingleValueByPath(Document document,String path){ | ||
14 | + Node node = document.selectSingleNode(path); | ||
15 | + if (node!=null){ | ||
16 | + String nodeValue = node.getStringValue(); | ||
17 | + return nodeValue; | ||
18 | + }else { | ||
19 | + return null; | ||
20 | + } | ||
21 | + | ||
22 | + } | ||
23 | + public static List<Node> getPathValues(Document document,String path){ | ||
24 | + List<Node> nodes= document.selectNodes(path); | ||
25 | + return nodes; | ||
26 | + } | ||
27 | + | ||
28 | + public static void getPathValues2(Document document,String path){ | ||
29 | + List list = document.selectNodes(path); | ||
30 | + for (Iterator it = list.iterator(); it.hasNext();) { | ||
31 | + Attribute attr = (Attribute) it.next(); | ||
32 | + //TODO | ||
33 | + } | ||
34 | + } | ||
35 | +} |
src/main/resources/application.properties
0 → 100644
1 | + | ||
2 | +#服务端口 | ||
3 | +server.port=7003 | ||
4 | +#eureka主机名,会在控制页面中显示 | ||
5 | +eureka.instance.hostname=localhost | ||
6 | +#eureka服务器页面中status的请求路径 | ||
7 | +eureka.instance.status-page-url=http://localhost:7003/index | ||
8 | +#eureka注册中心服务器地址 | ||
9 | +eureka.client.service-url.defaultZone=http://10.50.3.82:19527/eureka/ | ||
10 | +#服务名 | ||
11 | +spring.application.name=imf-warehouse-reader | ||
12 | + | ||
13 | +#spring.datasource.name=CGOETL | ||
14 | +spring.datasource.type=com.alibaba.druid.pool.DruidDataSource | ||
15 | +spring.datasource.driver-class-name=oracle.jdbc.OracleDriver | ||
16 | +spring.datasource.url=jdbc:oracle:thin:@10.50.3.70:1521:CGODB | ||
17 | +spring.datasource.username=CGONMS | ||
18 | +spring.datasource.password=1q2w3e4r | ||
19 | +#配置初始化大小/最小/最大 | ||
20 | +spring.datasource.druid.initial-size=1 | ||
21 | +spring.datasource.druid.min-idle=1 | ||
22 | +spring.datasource.druid.max-active=20 | ||
23 | +#获取连接等待超时时间 | ||
24 | +spring.datasource.druid.max-wait=60000 | ||
25 | +#一个连接在池中最小生存的时间 | ||
26 | +spring.datasource.druid.min-evictable-idle-time-millis=300000 | ||
27 | +#间隔多久进行一次检测,检测需要关闭的空闲连接 | ||
28 | +spring.datasource.druid.time-between-eviction-runs-millis=60000 | ||
29 | +spring.datasource.druid.validation-query=SELECT 'x' FROM DUAL | ||
30 | +spring.datasource.druid.test-while-idle=true | ||
31 | +spring.datasource.druid.test-on-borrow=false | ||
32 | +spring.datasource.druid.test-on-return=false | ||
33 | +spring.datasource.druid.default-auto-commit=true | ||
34 | + | ||
35 | +mybatis.mapper-locations=classpath:mapping/*.xml | ||
36 | +mybatis.type-aliases-package=com.example.demo.model | ||
37 | +logging.level.com.example.demo.mapper=DEBUG | ||
38 | + | ||
39 | +pagehelper.helper-dialect=oracle | ||
40 | +#pagehelper.auto-dialect=true | ||
41 | +#pagehelper.auto-runtime-dialect=true | ||
42 | +pagehelper.reasonable=true | ||
43 | +pagehelper.support-methods-arguments=true | ||
44 | +pagehelper.params=count=countSql | ||
45 | + | ||
46 | + |
1 | +package com.tianbo.warehouse; | ||
2 | + | ||
3 | +import org.junit.Test; | ||
4 | +import org.junit.runner.RunWith; | ||
5 | +import org.springframework.boot.test.context.SpringBootTest; | ||
6 | +import org.springframework.test.context.junit4.SpringRunner; | ||
7 | + | ||
8 | +@RunWith(SpringRunner.class) | ||
9 | +@SpringBootTest | ||
10 | +public class WarehouseApplicationTests { | ||
11 | + | ||
12 | + @Test | ||
13 | + public void contextLoads() { | ||
14 | + } | ||
15 | + | ||
16 | +} | ||
17 | + |
-
请 注册 或 登录 后发表评论