作者 zhangFan

kakoIMF check some message

正在显示 89 个修改的文件 包含 618 行增加363 行删除
Manifest-Version: 1.0
Class-Path: jackson-datatype-jdk8-2.9.7.jar jackson-databind-2.9.7.jar
jsqlparser-1.0.jar druid-spring-boot-starter-1.1.9.jar com.ibm.mq.to
ols.ras.jar pagehelper-spring-boot-starter-1.2.3.jar spring-context-5
.1.2.RELEASE.jar spring-aop-5.1.2.RELEASE.jar ProcessService.jar drui
d-1.1.9.jar com.ibm.mq.postcard.jar com.ibm.mq.soap.jar commons-loggi
ng-1.1.1.jar wstx-asl-3.2.4.jar commons-lang-2.4.jar returnXml.jar my
batis-spring-1.3.2.jar imfmsg.jar spring-tx-5.1.2.RELEASE.jar jackson
-core-2.9.7.jar cxf-xjc-ts-2.3.2.jar cxf-xjc-dv-2.3.2.jar log4j-to-sl
f4j-2.11.1.jar HeartbeatService.jar javax.annotation-api-1.3.2.jar my
batis-spring-boot-starter-1.3.2.jar xml-apis-1.4.01.jar neethi-2.0.4.
jar commons-io-2.5.jar hibernate-validator-6.0.13.Final.jar com.ibm.m
q.jmqi.jar jackson-datatype-jsr310-2.9.7.jar snakeyaml-1.23.jar slf4j
-api-1.7.25.jar spring-jcl-5.1.2.RELEASE.jar spring-jdbc-5.1.2.RELEAS
E.jar UploadService.jar cxf-2.3.2.jar axiom-impl-1.2.7.jar spring-boo
t-starter-web-2.1.0.RELEASE.jar com.ibm.mqjms.jar com.ibm.mq.headers.
jar jul-to-slf4j-1.7.25.jar com.ibm.mq.commonservices.jar com.ibm.mqe
tclient.jar apiConfig.jar mybatis-3.4.6.jar spring-expression-5.1.2.R
ELEASE.jar wsdl4j-1.6.2.jar xstream-1.4.10.jar com.ibm.mq.fta.jar ger
onimo-javamail_1.4_spec-1.2.jar xmlbeans-2.4.0.jar spring-boot-autoco
nfigure-2.1.0.RELEASE.jar cxf-xjc-boolean-3.2.3.jar dom4j-2.1.0.jar g
eronimo-stax-api_1.0_spec-1.0.1.jar classmate-1.4.0.jar xpp3_min-1.1.
4c.jar HikariCP-3.2.0.jar CL3Nonexport.jar jboss-logging-3.3.2.Final.
jar spring-beans-5.1.2.RELEASE.jar spring-boot-starter-json-2.1.0.REL
EASE.jar jackson-annotations-2.9.0.jar sigar.jar mybatis-spring-boot-
autoconfigure-1.3.2.jar axiom-api-1.2.7.jar IMFClient.1.0.0.jar com.i
bm.mq.axis2.jar XmlSchema-1.4.7.jar com.ibm.mq.defaultconfig.jar com.
ibm.mq.pcf.jar pagehelper-spring-boot-autoconfigure-1.2.3.jar validat
ion-api-2.0.1.Final.jar mybatis-generator-core-1.3.6.jar com.ibm.mq.j
ms.Nojndi.jar spring-boot-starter-logging-2.1.0.RELEASE.jar spring-we
b-5.1.2.RELEASE.jar mysql-connector-java-8.0.13.jar spring-boot-start
er-jdbc-2.1.0.RELEASE.jar cxf-manifest.jar xmlsec-1.4.4.jar jaxen-1.1
.6.jar spring-core-5.1.2.RELEASE.jar pagehelper-5.1.2.jar CL3Export.j
ar spring-boot-2.1.0.RELEASE.jar cxf-xjc-bug671-2.3.2.jar geronimo-ac
tivation_1.1_spec-1.0.1.jar log4j-api-2.11.1.jar spring-webmvc-5.1.2.
RELEASE.jar logback-classic-1.2.3.jar com.ibm.mq.jar connector.jar lo
g4j-1.2.17.jar jackson-module-parameter-names-2.9.7.jar spring-boot-s
tarter-2.1.0.RELEASE.jar stax-api-1.0.1.jar xmlpull-1.1.3.1.jar logba
ck-core-1.2.3.jar
Main-Class: com.sy.AnalysisImfApplication
... ...
#登录账号
loginname = KAKO
#登录密码
loginpass = KAKO
#发送报文目录,相对程序目录
readDirectory = sendDirectory
#接收存储报文目录
bakDirectory = receiveDirectory
#IMF MEAT报头配置
RCVR=
TYPE=KAKO
STYP=CARM
\ No newline at end of file
... ...
log4j=log_api.xml
#log4j=log_api.xml
isneedlog=N
psip=10.50.3.74
psport=7484
encoding=UTF-8
... ...
#log4j.rootLogger=DEBUG, Console
#Console
#log4j.appender.Console=org.apache.log4j.ConsoleAppender
#log4j.appender.Console.layout=org.apache.log4j.PatternLayout
#log4j.appender.Console.layout.ConversionPattern=%d [%t] %-5p [%c] - %m%n
#log4j.logger.java.sql.ResultSet=INFO
#log4j.logger.org.apache=INFO
#log4j.logger.net.cxp.blog.dao=DEBUG
#log4j.logger.java.sql.Connection=DEBUG
#log4j.logger.java.sql.Statement=DEBUG
#log4j.logger.java.sql.PreparedStatement=DEBUG
# Output pattern : date [thread] priority category - message FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7
log4j.rootLogger=INFO, stdout, fileout
log4j.logger.com.fiscal = INFO
... ...
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>
<appender name="INFOFILE" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="Logs/INFO.log" />
<param name="MaxFileSize" value="3000KB" />
<param name="MaxBackupIndex" value="20" />
<param name="Encoding" value="UTF-8" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[runtime] %d -%-4r [%t] %x - %m%n" />
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="levelMin" value="debug" />
<param name="levelMax" value="info" />
<param name="AcceptOnMatch" value="true" />
</filter>
</appender>
<appender name="ERRFILE" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="Logs/ERROR.log" />
<param name="MaxFileSize" value="3000KB" />
<param name="MaxBackupIndex" value="20" />
<param name="Encoding" value="UTF-8" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[runtime] %d -%-4r [%t] %x - %m%n" />
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="levelMin" value="error" />
<param name="levelMax" value="error" />
<param name="AcceptOnMatch" value="true" />
</filter>
</appender>
<appender name="WSINFOFILE" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="Logs/wsINFO.log" />
<param name="MaxFileSize" value="3000KB" />
<param name="MaxBackupIndex" value="20" />
<param name="Encoding" value="UTF-8" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[runtime] %d -%-4r [%t] %x - %m%n" />
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="levelMin" value="debug" />
<param name="levelMax" value="info" />
<param name="AcceptOnMatch" value="true" />
</filter>
</appender>
<appender name="WSERRFILE" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="Logs/wsERROR.log" />
<param name="MaxFileSize" value="3000KB" />
<param name="MaxBackupIndex" value="20" />
<param name="Encoding" value="UTF-8" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[runtime] %d -%-4r [%t] %x - %m%n" />
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="levelMin" value="error" />
<param name="levelMax" value="error" />
<param name="AcceptOnMatch" value="true" />
</filter>
</appender>
<logger name="apiLog">
<level value="INFO" />
<appender-ref ref="INFOFILE" />
<appender-ref ref="ERRFILE" />
</logger>
<logger name="WS">
<appender-ref ref="WSINFOFILE" />
<appender-ref ref="WSERRFILE" />
</logger>
<root>
<priority value="ERROR" />
</root>
</log4j:configuration>
\ No newline at end of file
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
此 diff 太大无法显示。
... ... @@ -6,7 +6,7 @@
<groupId>com.sy</groupId>
<artifactId>analysis_imf</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<packaging>jar</packaging>
<name>analysis_imf</name>
<description>Demo project for Spring Boot</description>
... ... @@ -66,11 +66,11 @@
<version>1.1.9</version>
</dependency>
<dependency>
<!-- <dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
</dependency>-->
<dependency>
<groupId>com.github.pagehelper</groupId>
... ... @@ -85,16 +85,312 @@
</dependency>
<dependency>
<groupId>org.dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>2.1.0</version>
</dependency>
<!--IMF need jar-->
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.schema</groupId>
<artifactId>XmlSchema</artifactId>
<version>1.4.7</version>
</dependency>
<dependency>
<groupId>wsdl4j</groupId>
<artifactId>wsdl4j</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.neethi</groupId>
<artifactId>neethi</artifactId>
<version>2.0.4</version>
</dependency>
<dependency>
<groupId>org.apache.cxf.xjcplugins</groupId>
<artifactId>cxf-xjc-boolean</artifactId>
<version>3.2.3</version>
</dependency>
<dependency>
<groupId>org.apache.cxf.xjcplugins</groupId>
<artifactId>cxf-xjc-dv</artifactId>
<version>2.3.2</version>
</dependency>
<dependency>
<groupId>org.apache.cxf.xjcplugins</groupId>
<artifactId>cxf-xjc-bug671</artifactId>
<version>2.3.2</version>
</dependency>
<dependency>
<groupId>org.apache.cxf.xjcplugins</groupId>
<artifactId>cxf-xjc-ts</artifactId>
<version>2.3.2</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.10</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>wstx-asl</artifactId>
<version>3.2.4</version>
</dependency>
<!-- <dependency>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
<version>3.3</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-activation_1.1_spec</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-annotation_1.0_spec</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-javamail_1.4_spec</artifactId>
<version>1.7.1</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jaxws_2.2_spec</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jms_1.1_spec</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-stax-api_1.0_spec</artifactId>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-ws-metadata_2.0_spec</artifactId>
<version>1.1.3</version>
</dependency>-->
<!--添加本地IMF包-->
<dependency>
<groupId>com.caac</groupId>
<artifactId>imf</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/IMFClient.1.0.0.jar</systemPath>
</dependency>
<dependency>
<groupId>com.caac.imf</groupId>
<artifactId>imfmessage</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/imfmsg.jar</systemPath>
</dependency>
<dependency>
<groupId>com.caac.imf</groupId>
<artifactId>process</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/ProcessService.jar</systemPath>
</dependency>
<dependency>
<groupId>com.caac.imf</groupId>
<artifactId>apiconfig</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/apiConfig.jar</systemPath>
</dependency>
<dependency>
<groupId>com.caac.imf</groupId>
<artifactId>upload</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/UploadService.jar</systemPath>
</dependency>
<dependency>
<groupId>com.caac.imf</groupId>
<artifactId>heartbeat</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/HeartbeatService.jar</systemPath>
</dependency>
<dependency>
<groupId>com.caac.imf</groupId>
<artifactId>returnxml</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/returnXml.jar</systemPath>
</dependency>
<dependency>
<groupId>org.hyperic</groupId>
<artifactId>sigar</artifactId>
<version>1.6.4</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/sigar.jar</systemPath>
</dependency>
<dependency>
<groupId>org.apache</groupId>
<artifactId>cxf</artifactId>
<version>2.3.2</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/cxf-2.3.2.jar</systemPath>
</dependency>
<dependency>
<groupId>maven.org.apache</groupId>
<artifactId>cxf</artifactId>
<version>2.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/cxf-manifest.jar</systemPath>
</dependency>
<dependency>
<groupId>org.apache.xml</groupId>
<artifactId>xmlsec</artifactId>
<version>1.4.4</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/xmlsec-1.4.4.jar</systemPath>
</dependency>
<dependency>
<groupId>com.ibm.disthub2.impl</groupId>
<artifactId>cl3e</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/CL3Export.jar</systemPath>
</dependency>
<dependency>
<groupId>com.ibm.disthub2.impl</groupId>
<artifactId>cl3ne</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/CL3Nonexport.jar</systemPath>
</dependency>
<dependency>
<groupId>com.ibm.mq</groupId>
<artifactId>axis2</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/com.ibm.mq.axis2.jar</systemPath>
</dependency>
<dependency>
<groupId>com.ibm.mq</groupId>
<artifactId>commonservices</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/com.ibm.mq.commonservices.jar</systemPath>
</dependency>
<dependency>
<groupId>com.ibm.mq</groupId>
<artifactId>defaultconfig</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/com.ibm.mq.defaultconfig.jar</systemPath>
</dependency>
<dependency>
<groupId>com.ibm.mq</groupId>
<artifactId>fta</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/com.ibm.mq.fta.jar</systemPath>
</dependency>
<dependency>
<groupId>com.ibm.mq</groupId>
<artifactId>headers</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/com.ibm.mq.headers.jar</systemPath>
</dependency>
<dependency>
<groupId>com.ibm</groupId>
<artifactId>mq</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/com.ibm.mq.jar</systemPath>
</dependency>
<dependency>
<groupId>com.ibm</groupId>
<artifactId>jmqi</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/com.ibm.mq.jmqi.jar</systemPath>
</dependency>
<dependency>
<groupId>com.ibm.mq</groupId>
<artifactId>jms.nojndi</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/com.ibm.mq.jms.Nojndi.jar</systemPath>
</dependency>
<dependency>
<groupId>com.ibm.mq</groupId>
<artifactId>pcf</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/com.ibm.mq.pcf.jar</systemPath>
</dependency>
<dependency>
<groupId>com.ibm.mq</groupId>
<artifactId>postcard</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/com.ibm.mq.postcard.jar</systemPath>
</dependency>
<dependency>
<groupId>com.ibm.mq</groupId>
<artifactId>soap</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/com.ibm.mq.soap.jar</systemPath>
</dependency>
<dependency>
<groupId>com.ibm.mq</groupId>
<artifactId>tools.ras</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/com.ibm.mq.tools.ras.jar</systemPath>
</dependency>
<dependency>
<groupId>com.ibm.mq</groupId>
<artifactId>etclient</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/com.ibm.mqetclient.jar</systemPath>
</dependency>
<dependency>
<groupId>com.ibm</groupId>
<artifactId>mqjms</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/com.ibm.mqjms.jar</systemPath>
</dependency>
<dependency>
<groupId>javax.resource</groupId>
<artifactId>connector</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/connector.jar</systemPath>
</dependency>
</dependencies>
<dependencyManagement>
... ... @@ -113,6 +409,19 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
<!--<configuration>-->
<!--<mainClass>com.sy.AnalysisImfApplication</mainClass>-->
<!--</configuration>-->
<!--<executions>-->
<!--<execution>-->
<!--<goals>-->
<!--<goal>repackage</goal>-->
<!--</goals>-->
<!--</execution>-->
<!--</executions>-->
</plugin>
<!-- mybatis generator 自动生成代码插件 -->
<plugin>
... ...
... ... @@ -2,6 +2,7 @@ package com.sy.IMF;
import com.caac.imf.api.IMFClient;
import com.caac.imf.api.IMFClientFactory;
import com.sy.utils.FileTool;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
import org.springframework.scheduling.annotation.Scheduled;
... ... @@ -20,6 +21,8 @@ public class IMF_Tesk {
private static void start() throws Exception {
PropertyConfigurator.configure("config/log4j.properties");
client = IMFClientFactory.createInstance();
String loginname = FileTool.readProperties("loginname");
String loginpass = FileTool.readProperties("loginpass");
if (client != null) {
... ... @@ -41,7 +44,7 @@ public class IMF_Tesk {
}
if (!LOGIN_OK){
loginIMF(client, "KKW1", "KKW1", "config/imf_config.properties");
loginIMF(client, loginname, loginpass, "config/imf_config.properties");
}
... ...
... ... @@ -21,7 +21,7 @@ public class KAKO_Reader extends Thread{
if (IMF_Tesk.LOGIN_OK) synchronized (this) {
String message = this.client.getMSG();
if (message != null) {
// logger.info(message);
logger.info(message);
AnalysisRoute route = new AnalysisRoute();
route.analysis(message);
}
... ... @@ -39,9 +39,8 @@ public class KAKO_Reader extends Thread{
}
}catch (Exception e){
isrunning=false;
logger.info("****************读取线程不在了****************");
}
isrunning=false;
logger.info("****************读取线程不在了****************");
}
}
... ...
package com.sy.IMF;
import com.caac.imf.api.IMFClient;
import com.sy.utils.DateTimeConverter;
import com.sy.utils.FileTool;
import com.sy.utils.MakeImfMeta;
import org.apache.commons.io.FileUtils;
import org.apache.log4j.Logger;
import java.io.File;
import java.util.List;
public class KAKO_Sender extends Thread{
protected static final Logger logger = Logger.getLogger(KAKO_Sender.class);
public static boolean isrunning;
private IMFClient client;
private String content;
public KAKO_Sender(IMFClient client) {
this.client = client;
}
private String SendMsg = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
"<Msg>\n" +
"\t<META>\n" +
"\t\t<SNDR>ZWY</SNDR>\n" +
"\t\t<RCVR/>\n" +
"\t\t<SEQN>16078357182</SEQN>\n" +
"\t\t<DDTM>20181116175107671</DDTM>\n" +
"\t\t<TYPE>HYXX</TYPE>\n" +
"\t\t<STYP>NDLR</STYP>\n" +
"\t</META>\n" +
"\t<DECLAREPREPAREMASTERXMLBODY>\n" +
"\t\t<Head>\n" +
"\t\t\t<MessageID>CN_MT2201_1p1_4604729604327_20181116174636305</MessageID>\n" +
"\t\t\t<FunctionCode>9</FunctionCode>\n" +
"\t\t\t<MessageType>MT2201MASTER</MessageType>\n" +
"\t\t\t<SenderID>460470678920X_DXPENT0000460002_20181116175107671</SenderID>\n" +
"\t\t\t<ReceiverID>4604_20181116175107671</ReceiverID>\n" +
"\t\t\t<SendTime>20181116175107671</SendTime>\n" +
"\t\t\t<Version>1.0</Version>\n" +
"\t\t</Head>\n" +
"\t\t<Declaration>\n" +
"\t\t\t<Carrier>\n" +
"\t\t\t\t<ID>KA</ID>\n" +
"\t\t\t</Carrier>\n" +
"\t\t\t<ORG>\n" +
"\t\t\t\t<ID>CGO</ID>\n" +
"\t\t\t</ORG>\n" +
"\t\t\t<DES>\n" +
"\t\t\t\t<ID>LAX</ID>\n" +
"\t\t\t</DES>\n" +
"\t\t\t<BorderTransportMeans>\n" +
"\t\t\t\t<JourneyID>749/2018-11-18</JourneyID>\n" +
"\t\t\t</BorderTransportMeans>\n" +
"\t\t\t<Consignment>\n" +
"\t\t\t\t<TransportContractDocument>\n" +
"\t\t\t\t\t<ID>160-78357182</ID>\n" +
"\t\t\t\t</TransportContractDocument>\n" +
"\t\t\t\t<AssociatedTransportDocument>\n" +
"\t\t\t\t\t<ID/>\n" +
"\t\t\t\t</AssociatedTransportDocument>\n" +
"\t\t\t\t<LoadingLocation>\n" +
"\t\t\t\t\t<ID>CGO/4620</ID>\n" +
"\t\t\t\t\t<LoadingDate>2018-11-16 21:46</LoadingDate>\n" +
"\t\t\t\t</LoadingLocation>\n" +
"\t\t\t\t<UnloadingLocation>\n" +
"\t\t\t\t\t<ID>CGO/4620</ID>\n" +
"\t\t\t\t</UnloadingLocation>\n" +
"\t\t\t\t<TransportSplitIndicator>0</TransportSplitIndicator>\n" +
"\t\t\t\t<ConsignmentPackaging>\n" +
"\t\t\t\t\t<QuantityQuantity>1</QuantityQuantity>\n" +
"\t\t\t\t</ConsignmentPackaging>\n" +
"\t\t\t\t<TotalGrossMassMeasure>65</TotalGrossMassMeasure>\n" +
"\t\t\t\t<PreQuantityQuantity>1</PreQuantityQuantity>\n" +
"\t\t\t\t<PreTotalGrossMassMeasure>65</PreTotalGrossMassMeasure>\n" +
"\t\t\t\t<CustomsStatus>001</CustomsStatus>\n" +
"\t\t\t\t<FreightPayment>\n" +
"\t\t\t\t\t<MethodCode>PP</MethodCode>\n" +
"\t\t\t\t</FreightPayment>\n" +
"\t\t\t\t<ProductName>CELL PHONE</ProductName>\n" +
"\t\t\t\t<PrepareTime>2018-11-16 21:46</PrepareTime>\n" +
"\t\t\t\t<CustomsCode>4620</CustomsCode>\n" +
"\t\t\t\t<AgentName>中外运空运发展股份有限公司郑州分公司</AgentName>\n" +
"\t\t\t\t<AgentCompany>中外运空运发展股份有限公司郑州分公司</AgentCompany>\n" +
"\t\t\t\t<NameOfgoods>CELL PHONE</NameOfgoods>\n" +
"\t\t\t\t<DeliveryStation>001</DeliveryStation>\n" +
"\t\t\t\t<UNnumber/>\n" +
"\t\t\t\t<Category/>\n" +
"\t\t\t\t<Consignee>\n" +
"\t\t\t\t\t<Name>FEDEX TRADE NETWORKS TRANSPORT</Name>\n" +
"\t\t\t\t\t<Address>\n" +
"\t\t\t\t\t\t<Line>17210 SOUTH MAIN STREET GARDENA</Line>\n" +
"\t\t\t\t\t\t<CityName>LOS ANGELES</CityName>\n" +
"\t\t\t\t\t\t<CountryCode>US</CountryCode>\n" +
"\t\t\t\t\t\t<ZipCode/>\n" +
"\t\t\t\t\t\t<PROVINCECODE/>\n" +
"\t\t\t\t\t\t<PROVINCENAME/>\n" +
"\t\t\t\t\t\t<Deltaname/>\n" +
"\t\t\t\t\t\t<TelePhone>3109655000</TelePhone>\n" +
"\t\t\t\t\t\t<Fax/>\n" +
"\t\t\t\t\t\t<CNECUSID>EIN+160807223</CNECUSID>\n" +
"\t\t\t\t\t\t<CNEAEO/>\n" +
"\t\t\t\t\t\t<Unlodingcode>LAX</Unlodingcode>\n" +
"\t\t\t\t\t</Address>\n" +
"\t\t\t\t</Consignee>\n" +
"\t\t\t\t<Consignor>\n" +
"\t\t\t\t\t<name>FEDEX</name>\n" +
"\t\t\t\t\t<Address>\n" +
"\t\t\t\t\t\t<Line>ROOM7</Line>\n" +
"\t\t\t\t\t\t<CountryCode>CN</CountryCode>\n" +
"\t\t\t\t\t\t<ZipCode/>\n" +
"\t\t\t\t\t\t<Deltaname/>\n" +
"\t\t\t\t\t\t<TelePhone>8637155131789</TelePhone>\n" +
"\t\t\t\t\t\t<Fax/>\n" +
"\t\t\t\t\t\t<SHPAEO/>\n" +
"\t\t\t\t\t\t<SHPCUSID>USCI+91410100053384175K</SHPCUSID>\n" +
"\t\t\t\t\t</Address>\n" +
"\t\t\t\t</Consignor>\n" +
"\t\t\t</Consignment>\n" +
"\t\t</Declaration>\n" +
"\t</DECLAREPREPAREMASTERXMLBODY>\n" +
"</Msg>";
public KAKO_Sender(IMFClient client, String content) {
this.client = client;
this.content = content;
}
public void run(){
try {
String sendDir = FileTool.readProperties("readDirectory");
String SNDR = FileTool.readProperties("loginname");
String TYPE = FileTool.readProperties("TYPE");
String STYP = FileTool.readProperties("STYP");
String RCVR = FileTool.readProperties("RCVR");
String DDTM = DateTimeConverter.getFormat();
String SEQN = DDTM;
if (this.client == null) {
logger.info("IMFClient has been closed");
return;
}
isrunning=true;
if(IMF_Tesk.isSuc){
// logger.info("<<<<<<<<<<<主线程初始化成功>>>>>>>>>>>>");
if(IMF_Tesk.LOGIN_OK){
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,DDTM,SEQN,fileContent);
String returnMsg = this.client.sendMSG(sendMsg);
//发送成功处理,删除已发送成功的目录下的文件
if(returnMsg.indexOf("<CODE>9</CODE>")>=0){
FileUtils.forceDelete(file);
}
}
try {
Thread.sleep(500L);
} catch (InterruptedException var3) {
var3.printStackTrace();
String returnMsg = this.client.sendMSG(SendMsg);
logger.info("《--------发送信息成功开始轮询500mm一次--------"+returnMsg);
}else{
logger.info("<<<<<<<<<<<登陆中>>>>>>>>>>>>");
}
}
}
}catch (Exception var14) {
var14.printStackTrace();
logger.info(var14.getMessage());
}
isrunning=false;
logger.info("<<<<<<<<<<<发送线程不在了>>>>>>>>>>>>");
}
... ...
package com.sy;
import com.sy.controller.AnalysisRoute;
/**
* @author zhangfan
* @web www.sy.com
* @company 郑州商友科技有限公司
* @time 2018-11-29 12:58
*/
public class TestAnalysis {
public static void main(String[] args) {
AnalysisRoute route = new AnalysisRoute();
route.analysis("str");
}
}
... ... @@ -5,78 +5,15 @@ import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.DomDriver;
import com.thoughtworks.xstream.io.xml.XmlFriendlyNameCoder;
import java.io.UnsupportedEncodingException;
public class MessageAnalysis {
public static Message msg = null;
public Message readTicketsXml(String str) {
// str = utf8Togb2312(str);
return getMessage(str);
}
public static String getUTF8StringFromGBKString(String gbkStr) {
try {
return new String(getUTF8BytesFromGBKString(gbkStr), "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new InternalError();
}
}
public static byte[] getUTF8BytesFromGBKString(String gbkStr) {
int n = gbkStr.length();
byte[] utfBytes = new byte[3 * n];
int k = 0;
for (int i = 0; i < n; i++) {
int m = gbkStr.charAt(i);
if (m < 128 && m >= 0) {
utfBytes[k++] = (byte) m;
continue;
}
utfBytes[k++] = (byte) (0xe0 | (m >> 12));
utfBytes[k++] = (byte) (0x80 | ((m >> 6) & 0x3f));
utfBytes[k++] = (byte) (0x80 | (m & 0x3f));
}
if (k < utfBytes.length) {
byte[] tmp = new byte[k];
System.arraycopy(utfBytes, 0, tmp, 0, k);
return tmp;
}
return utfBytes;
}
public static String utf8Togb2312(String str) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < str.length(); i++) {
char c = str.charAt(i);
switch (c) {
case '+':
sb.append(' ');
break;
case '%':
try {
sb.append((char) Integer.parseInt(
str.substring(i + 1, i + 3), 16));
} catch (NumberFormatException e) {
throw new IllegalArgumentException();
}
i += 2;
break;
default:
sb.append(c);
break;
}
}
String result = sb.toString();
String res = null;
try {
byte[] inputBytes = result.getBytes("8859_1");
res = new String(inputBytes, "UTF-8");
} catch (Exception e) {
}
return res;
}
static Message getMessage(String str) {
... ...
... ... @@ -2,12 +2,6 @@ package com.sy.service;
import com.sy.model.v_express_billno;
/**
* @author zhangfan
* @web www.sy.com
* @company 郑州商友科技有限公司
* @time 2018-11-28 16:40
*/
public interface CLRService {
int save(v_express_billno billno);
... ...
... ... @@ -4,12 +4,6 @@ import com.sy.model.port_manifest_body;
import com.sy.model.port_manifest_head;
import com.sy.model.port_manifest_head_stat;
/**
* @author zhangfan
* @web www.sy.com
* @company 郑州商友科技有限公司
* @time 2018-11-28 16:40
*/
public interface GATService {
int savePortHead(port_manifest_head head);
... ...
... ... @@ -2,12 +2,6 @@ package com.sy.service;
import com.sy.model.messagehead;
/**
* @author zhangfan
* @web www.sy.com
* @company 郑州商友科技有限公司
* @time 2018-11-28 16:42
*/
public interface MessageHeadService {
int save(messagehead messagehead);
... ...
... ... @@ -2,13 +2,6 @@ package com.sy.service;
import com.sy.model.airone_ex_stock;
/**
* @author zhangfan
* @web www.sy.com
* @company 郑州商友科技有限公司
* @time 2018-11-28 9:27
*/
public interface aironeExStockService {
int save(airone_ex_stock ex);
... ...
... ... @@ -2,12 +2,6 @@ package com.sy.service;
import com.sy.model.airone_im_stock;
/**
* @author zhangfan
* @web www.sy.com
* @company 郑州商友科技有限公司
* @time 2018-11-28 16:26
*/
public interface aironeImStockService {
int save(airone_im_stock im);
... ...
... ... @@ -6,12 +6,6 @@ import com.sy.service.CLRService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author zhangfan
* @web www.sy.com
* @company 郑州商友科技有限公司
* @time 2018-11-28 16:47
*/
@Service
public class CLRServiceImpl implements CLRService {
... ...
... ... @@ -9,13 +9,6 @@ import com.sy.model.port_manifest_head_stat;
import com.sy.service.GATService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author zhangfan
* @web www.sy.com
* @company 郑州商友科技有限公司
* @time 2018-11-28 16:48
*/
@Service
public class GATServiceImpl implements GATService {
... ...
... ... @@ -6,12 +6,6 @@ import com.sy.service.aironeExStockService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author zhangfan
* @web www.sy.com
* @company 郑州商友科技有限公司
* @time 2018-11-28 9:28
*/
@Service("exStockService")
public class aironeExStockServiceImpl implements aironeExStockService {
... ...
... ... @@ -5,13 +5,6 @@ import com.sy.model.airone_im_stock;
import com.sy.service.aironeImStockService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author zhangfan
* @web www.sy.com
* @company 郑州商友科技有限公司
* @time 2018-11-28 16:46
*/
@Service
public class aironeImStockServiceImpl implements aironeImStockService {
... ...
package com.sy.utils;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
public class CharasetCheck {
public static String chechUTF8(String path){
File file = new File(path);
String str = null;
try{
str = FileUtils.readFileToString(file,"GB2312");
// str = getUTF8String(str);
}catch (IOException e){
e.printStackTrace();
}
return str;
}
public static String getUTF8String(String gbkStr) {
try {
return new String(getUTF8Bytes(gbkStr), "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new InternalError();
}
}
public static byte[] getUTF8Bytes(String gbkStr) {
int n = gbkStr.length();
byte[] utfBytes = new byte[3 * n];
int k = 0;
for (int i = 0; i < n; i++) {
int m = gbkStr.charAt(i);
if (m < 128 && m >= 0) {
utfBytes[k++] = (byte) m;
continue;
}
utfBytes[k++] = (byte) (0xe0 | (m >> 12));
utfBytes[k++] = (byte) (0x80 | ((m >> 6) & 0x3f));
utfBytes[k++] = (byte) (0x80 | (m & 0x3f));
}
if (k < utfBytes.length) {
byte[] tmp = new byte[k];
System.arraycopy(utfBytes, 0, tmp, 0, k);
return tmp;
}
return utfBytes;
}
}
... ...
... ... @@ -14,7 +14,9 @@ public class DateTimeConverter extends AbstractSingleValueConverter {
private static final DateFormat DATETIME = new SimpleDateFormat("yyyyMMddHHmmss");
private static final DateFormat DATETIME_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
private static final DateFormat DEFAULT_DATEFORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
private static SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
private static SimpleDateFormat date = new SimpleDateFormat("yyyyy-MM-dd");
public boolean canConvert(Class type) {
return type.equals(Date.class);
}
... ... @@ -43,8 +45,11 @@ public class DateTimeConverter extends AbstractSingleValueConverter {
throw new ConversionException("Cannot parse date " + str);
}
public String toString(Object obj) {
return DEFAULT_DATEFORMAT.format((Date) obj);
public static String getFormat() {
return dateFormat.format(new Date());
}
public static String getDay() {
return date.format(new Date());
}
}
... ...
package com.sy.utils;
import org.apache.commons.io.FileUtils;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.List;
import java.util.Properties;
public final class FileTool {
private final static String errorRootDirectory = "errorLogs";//错误的根目录名
private final static String xmlRootDirectory = "xmlLog"; //记录已收到的报文目录
private final static String Cherector = "UTF-8";
/**
* 写入文件
* @param path 二级目录
* @param content 写入内容
* @param rightOrwrong 是写入错误记录目录还是记录目录
*/
public static void writeFile(String path,String content,boolean rightOrwrong){
StringBuffer stringBuffer = new StringBuffer();
if (rightOrwrong){
stringBuffer.append(xmlRootDirectory).append("/").append(path).append("/").append(DateTimeConverter.getFormat())
.append("/").append(uuidCreate.getUUID()).append(".log");
}else {
stringBuffer.append(errorRootDirectory).append("/").append(path).append("/").append(DateTimeConverter.getDay())
.append("/").append(uuidCreate.getUUID()).append(".log");
}
File file = new File(stringBuffer.toString());
try{
FileUtils.writeStringToFile(file,content,Cherector);
}catch (IOException e){
e.printStackTrace();
}
}
public static String readfile(File file) throws IOException{
String fileToString = FileUtils.readFileToString(file, "UTF-8");
return fileToString;
}
public static List<File> readDirectoryFiles(File dir){
List<File> files = (List<File>)FileUtils.listFiles(dir,new String[]{"xml"},false);
return files;
}
public static void writeWaybill(String path,String content,String waybillNo){
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(xmlRootDirectory).append("/").append(path).append("/").append(DateTimeConverter.getDay()).append
("/")
.append(waybillNo).append(".log");
File file = new File(stringBuffer.toString());
try{
FileUtils.writeStringToFile(file,content,Cherector);
}catch (IOException e){
e.printStackTrace();
}
}
public static void writeFileToBak(String content){
String bakDir = readProperties("bakDirectory");
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(bakDir).append("/").append(uuidCreate.getUUID()).append(".txt");
File file = new File(stringBuffer.toString());
try{
FileUtils.writeStringToFile(file,content,Cherector);
}catch (IOException e){
e.printStackTrace();
}
}
public static String readProperties(String key){
Properties properties = new Properties();
String value = "";
try{
BufferedReader bufferedReader = new BufferedReader(new FileReader("config/config.properties"));
properties.load(bufferedReader);
//获取key对应的value值
value= properties.getProperty(key);
}catch (Exception e){
e.printStackTrace();
}
return value;
}
}
... ...
package com.sy.utils;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
import java.io.ByteArrayInputStream;
import java.io.UnsupportedEncodingException;
public class MakeImfMeta {
public static String makeImfDocument(String SNDR,String RCVR,String TYPE,String STYP,String DDTM,String SEQN,String Content) throws DocumentException,UnsupportedEncodingException{
Document document = DocumentHelper.createDocument();
Element root = document.addElement( "MSG" );
Element meta = root.addElement("META");
meta.addElement("SNDR").addText(SNDR);
meta.addElement("RCVR").addText(RCVR);
meta.addElement("SEQN").addText(SEQN);
meta.addElement("DDTM").addText(DDTM);
meta.addElement("TYPE").addText(TYPE);
meta.addElement("STYP").addText(STYP);
SAXReader saxReader = new SAXReader();
Document doc = saxReader.read(new ByteArrayInputStream(Content.getBytes("GB2312")));
Element contentRoot = doc.getRootElement();
root.add(contentRoot);
return document.asXML();
}
}
... ...
... ... @@ -2,16 +2,10 @@ package com.sy.utils;
import java.util.UUID;
/**
* @author zhangfan
* @web www.sy.com
* @company 郑州商友科技有限公司
* @time 2018-11-28 11:00
*/
public class uuidCreate {
public static String getUUID() {
String uuid = UUID.randomUUID().toString();
uuid =uuid+uuid.substring(0,14);
String uuid = UUID.randomUUID().toString().replace("-","");
return uuid;
}
}
... ...
... ... @@ -13,16 +13,16 @@ spring.devtools.restart.additional-paths=src/main/java
spring.mvc.view.suffix=/WEB-INF/jsp/
#映射后缀
spring.mvc.view.prefix=.jsp
#设置数据源
#数据库连接用户名
#设置本地数据源
spring.datasource.username=root
#数据库连接密码
spring.datasource.password=root
#驱动
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
#数据库连接路径
spring.datasource.url=jdbc:mysql://localhost:3306/bysj?useUnicode=true&characterEncoding=utf8&autoReconnect=true&failOverReadOnly=false&allowMultiQueries=true&useSSL=true&serverTimezone=Asia/Shanghai
#设置线上数据源
#spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
#spring.datasource.url=jdbc:mysql://10.50.7.10:3306/station?characterEncoding=utf8&useSSL=false&serverTimezone=UTC&rewriteBatchedStatements=true
#spring.datasource.username=kako
#spring.datasource.password=mysql10.50.7.10
#连接池类
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
#连接池配置,因为springboot默认是开启了连接池的,它有默认配置,这一段可以忽略
... ...