正在显示
111 个修改的文件
包含
319 行增加
和
15 行删除
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 |
lib/CL3Export.jar
0 → 100755
不能预览此文件类型
lib/CL3Nonexport.jar
0 → 100755
不能预览此文件类型
lib/FastInfoset-1.2.8.jar
0 → 100755
不能预览此文件类型
lib/HeartbeatService.jar
0 → 100755
不能预览此文件类型
lib/IMFClient.1.0.0.jar
0 → 100755
不能预览此文件类型
lib/ProcessService.jar
0 → 100755
不能预览此文件类型
lib/UploadService.jar
0 → 100755
不能预览此文件类型
lib/XmlSchema-1.4.7.jar
0 → 100755
不能预览此文件类型
lib/antlr-2.7.7.jar
0 → 100755
不能预览此文件类型
lib/antlr-3.2.jar
0 → 100755
不能预览此文件类型
lib/antlr-runtime-3.2.jar
0 → 100755
不能预览此文件类型
lib/aopalliance-1.0.jar
0 → 100755
不能预览此文件类型
lib/apiConfig.jar
0 → 100755
不能预览此文件类型
lib/asm-3.3.jar
0 → 100755
不能预览此文件类型
lib/bcprov-jdk15-1.45.jar
0 → 100755
不能预览此文件类型
lib/com.ibm.mq.axis2.jar
0 → 100755
不能预览此文件类型
lib/com.ibm.mq.commonservices.jar
0 → 100755
不能预览此文件类型
lib/com.ibm.mq.defaultconfig.jar
0 → 100755
不能预览此文件类型
lib/com.ibm.mq.fta.jar
0 → 100755
不能预览此文件类型
lib/com.ibm.mq.headers.jar
0 → 100755
不能预览此文件类型
lib/com.ibm.mq.jar
0 → 100755
不能预览此文件类型
lib/com.ibm.mq.jmqi.jar
0 → 100755
不能预览此文件类型
lib/com.ibm.mq.jms.Nojndi.jar
0 → 100755
不能预览此文件类型
lib/com.ibm.mq.pcf.jar
0 → 100755
不能预览此文件类型
lib/com.ibm.mq.postcard.jar
0 → 100755
不能预览此文件类型
lib/com.ibm.mq.soap.jar
0 → 100755
不能预览此文件类型
lib/com.ibm.mq.tools.ras.jar
0 → 100755
不能预览此文件类型
lib/com.ibm.mqetclient.jar
0 → 100755
不能预览此文件类型
lib/com.ibm.mqjms.jar
0 → 100755
不能预览此文件类型
lib/commons-collections-3.2.1.jar
0 → 100755
不能预览此文件类型
lib/commons-lang-2.5.jar
0 → 100755
不能预览此文件类型
lib/commons-logging-1.1.1.jar
0 → 100755
不能预览此文件类型
lib/commons-pool-1.5.5.jar
0 → 100755
不能预览此文件类型
lib/connector.jar
0 → 100755
不能预览此文件类型
lib/cxf-2.3.2.jar
0 → 100755
不能预览此文件类型
lib/cxf-manifest.jar
0 → 100755
不能预览此文件类型
lib/cxf-xjc-boolean-2.3.2.jar
0 → 100755
不能预览此文件类型
lib/cxf-xjc-bug671-2.3.2.jar
0 → 100755
不能预览此文件类型
lib/cxf-xjc-dv-2.3.2.jar
0 → 100755
不能预览此文件类型
lib/cxf-xjc-ts-2.3.2.jar
0 → 100755
不能预览此文件类型
lib/dhbcore.jar
0 → 100755
不能预览此文件类型
lib/fscontext.jar
0 → 100755
不能预览此文件类型
lib/geronimo-activation_1.1_spec-1.1.jar
0 → 100755
不能预览此文件类型
lib/geronimo-annotation_1.0_spec-1.1.1.jar
0 → 100755
不能预览此文件类型
lib/geronimo-javamail_1.4_spec-1.7.1.jar
0 → 100755
不能预览此文件类型
lib/geronimo-jaxws_2.2_spec-1.0.jar
0 → 100755
不能预览此文件类型
lib/geronimo-jms_1.1_spec-1.1.1.jar
0 → 100755
不能预览此文件类型
lib/geronimo-servlet_3.0_spec-1.0.jar
0 → 100755
不能预览此文件类型
lib/geronimo-stax-api_1.0_spec-1.0.1.jar
0 → 100755
不能预览此文件类型
lib/geronimo-ws-metadata_2.0_spec-1.1.3.jar
0 → 100755
不能预览此文件类型
lib/imfmsg.jar
0 → 100755
不能预览此文件类型
lib/jaxb-api-2.2.1.jar
0 → 100755
不能预览此文件类型
lib/jaxb-impl-2.2.1.1.jar
0 → 100755
不能预览此文件类型
lib/jaxb-xjc-2.2.1.1.jar
0 → 100755
不能预览此文件类型
lib/jettison-1.2.jar
0 → 100755
不能预览此文件类型
lib/jetty-continuation-7.2.2.v20101205.jar
0 → 100755
不能预览此文件类型
lib/jetty-http-7.2.2.v20101205.jar
0 → 100755
不能预览此文件类型
lib/jetty-io-7.2.2.v20101205.jar
0 → 100755
不能预览此文件类型
lib/jetty-server-7.2.2.v20101205.jar
0 → 100755
不能预览此文件类型
lib/jetty-util-7.2.2.v20101205.jar
0 → 100755
不能预览此文件类型
lib/jms.jar
0 → 100755
不能预览此文件类型
lib/jndi.jar
0 → 100755
不能预览此文件类型
lib/jra-1.0-alpha-4.jar
0 → 100755
不能预览此文件类型
lib/js-1.7R2.jar
0 → 100755
不能预览此文件类型
lib/jsr173_1.0_api.jar
0 → 100755
不能预览此文件类型
lib/jsr311-api-1.1.1.jar
0 → 100755
不能预览此文件类型
lib/jta.jar
0 → 100755
不能预览此文件类型
lib/ldap.jar
0 → 100755
不能预览此文件类型
lib/log4j-1.2.16.jar
0 → 100755
不能预览此文件类型
lib/neethi-2.0.4.jar
0 → 100755
不能预览此文件类型
lib/oro-2.0.8.jar
0 → 100755
不能预览此文件类型
lib/providerutil.jar
0 → 100755
不能预览此文件类型
lib/resolver.jar
0 → 100755
不能预览此文件类型
lib/returnXml.jar
0 → 100755
不能预览此文件类型
lib/rmm.jar
0 → 100755
不能预览此文件类型
lib/saaj-api-1.3.jar
0 → 100755
不能预览此文件类型
lib/saaj-impl-1.3.2.jar
0 → 100755
不能预览此文件类型
lib/serializer-2.7.1.jar
0 → 100755
不能预览此文件类型
lib/sigar.jar
0 → 100755
不能预览此文件类型
lib/slf4j-api-1.6.1.jar
0 → 100755
不能预览此文件类型
lib/slf4j-jdk14-1.6.1.jar
0 → 100755
不能预览此文件类型
lib/spring-aop-3.0.5.RELEASE.jar
0 → 100755
不能预览此文件类型
lib/spring-asm-3.0.5.RELEASE.jar
0 → 100755
不能预览此文件类型
lib/spring-beans-3.0.5.RELEASE.jar
0 → 100755
不能预览此文件类型
lib/spring-context-3.0.5.RELEASE.jar
0 → 100755
不能预览此文件类型
lib/spring-core-3.0.5.RELEASE.jar
0 → 100755
不能预览此文件类型
lib/spring-expression-3.0.5.RELEASE.jar
0 → 100755
不能预览此文件类型
lib/spring-jms-3.0.5.RELEASE.jar
0 → 100755
不能预览此文件类型
lib/spring-tx-3.0.5.RELEASE.jar
0 → 100755
不能预览此文件类型
lib/spring-web-3.0.5.RELEASE.jar
0 → 100755
不能预览此文件类型
lib/stax2-api-3.0.2.jar
0 → 100755
不能预览此文件类型
lib/stringtemplate-3.2.jar
0 → 100755
不能预览此文件类型
lib/velocity-1.6.4.jar
0 → 100755
不能预览此文件类型
lib/woodstox-core-asl-4.0.8.jar
0 → 100755
不能预览此文件类型
lib/wsdl4j-1.6.2.jar
0 → 100755
不能预览此文件类型
lib/wss4j-1.5.11.jar
0 → 100755
不能预览此文件类型
lib/xalan-2.7.1.jar
0 → 100755
不能预览此文件类型
lib/xbean.jar
0 → 100755
不能预览此文件类型
lib/xbean_xpath.jar
0 → 100755
不能预览此文件类型
lib/xml-resolver-1.2.jar
0 → 100755
不能预览此文件类型
lib/xmlbeans-qname.jar
0 → 100755
不能预览此文件类型
lib/xmlpublic.jar
0 → 100755
不能预览此文件类型
lib/xmlsec-1.4.4.jar
0 → 100755
不能预览此文件类型
| 1 | package com.example.demo; | 1 | package com.example.demo; |
| 2 | 2 | ||
| 3 | - | ||
| 4 | import org.slf4j.Logger; | 3 | import org.slf4j.Logger; |
| 5 | import org.slf4j.LoggerFactory; | 4 | import org.slf4j.LoggerFactory; |
| 6 | import org.mybatis.spring.annotation.MapperScan; | 5 | import org.mybatis.spring.annotation.MapperScan; |
| @@ -11,15 +10,15 @@ import org.springframework.cloud.netflix.eureka.EnableEurekaClient; | @@ -11,15 +10,15 @@ import org.springframework.cloud.netflix.eureka.EnableEurekaClient; | ||
| 11 | import org.springframework.scheduling.annotation.EnableScheduling; | 10 | import org.springframework.scheduling.annotation.EnableScheduling; |
| 12 | 11 | ||
| 13 | 12 | ||
| 13 | + | ||
| 14 | @SpringBootApplication | 14 | @SpringBootApplication |
| 15 | @EnableScheduling | 15 | @EnableScheduling |
| 16 | @EnableEurekaClient | 16 | @EnableEurekaClient |
| 17 | @MapperScan("com.example.demo.mapper")//将项目中对应的mapper类的路径加进来就可以了 | 17 | @MapperScan("com.example.demo.mapper")//将项目中对应的mapper类的路径加进来就可以了 |
| 18 | public class DemoApplication { | 18 | public class DemoApplication { |
| 19 | + protected static final Logger logger = LoggerFactory.getLogger(DemoApplication.class); | ||
| 19 | 20 | ||
| 20 | public static void main(String[] args) { | 21 | public static void main(String[] args) { |
| 21 | - | ||
| 22 | SpringApplication.run(DemoApplication.class, args); | 22 | SpringApplication.run(DemoApplication.class, args); |
| 23 | - | ||
| 24 | } | 23 | } |
| 25 | } | 24 | } |
| 1 | +package com.example.demo.handle.IMF; | ||
| 2 | + | ||
| 3 | +import com.caac.imf.api.IMFClient; | ||
| 4 | +import com.example.demo.scheduled.IMF_KAKO_Task; | ||
| 5 | +import org.apache.log4j.Logger; | ||
| 6 | + | ||
| 7 | +public class KAKO_Reader extends Thread{ | ||
| 8 | + protected static final Logger logger = Logger.getLogger(KAKO_Reader.class); | ||
| 9 | + private IMFClient client; | ||
| 10 | + public static boolean isrunning; | ||
| 11 | + | ||
| 12 | + public KAKO_Reader(IMFClient client) { | ||
| 13 | + this.client = client; | ||
| 14 | + } | ||
| 15 | + | ||
| 16 | + public void run() { | ||
| 17 | + | ||
| 18 | + try{ | ||
| 19 | + isrunning =true; | ||
| 20 | + while(true) { | ||
| 21 | + if (IMF_KAKO_Task.LOGIN_OK) { | ||
| 22 | + synchronized(this) { | ||
| 23 | + String message = this.client.getMSG(); | ||
| 24 | + if (message != null) { | ||
| 25 | + logger.info(message); | ||
| 26 | + } | ||
| 27 | + } | ||
| 28 | + } else { | ||
| 29 | + //logger.info("***"); | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + try { | ||
| 33 | + Thread.sleep(100L); | ||
| 34 | + } catch (InterruptedException var3) { | ||
| 35 | + var3.printStackTrace(); | ||
| 36 | + | ||
| 37 | + } | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + }catch (Exception e){ | ||
| 41 | + | ||
| 42 | + } | ||
| 43 | + isrunning=false; | ||
| 44 | + logger.info("****************读取线程不在了****************"); | ||
| 45 | + } | ||
| 46 | +} |
| 1 | +package com.example.demo.handle.IMF; | ||
| 2 | + | ||
| 3 | +import com.caac.imf.api.IMFClient; | ||
| 4 | +import com.example.demo.scheduled.IMF_KAKO_Task; | ||
| 5 | +import org.apache.log4j.Logger; | ||
| 6 | +import org.slf4j.LoggerFactory; | ||
| 7 | + | ||
| 8 | +public class KAKO_Sender extends Thread{ | ||
| 9 | + | ||
| 10 | + protected static final Logger logger = Logger.getLogger(KAKO_Sender.class); | ||
| 11 | + public static boolean isrunning; | ||
| 12 | + private IMFClient client; | ||
| 13 | + public KAKO_Sender(IMFClient client) { | ||
| 14 | + this.client = client; | ||
| 15 | + } | ||
| 16 | + private String SendMsg = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + | ||
| 17 | + "<Msg>\n" + | ||
| 18 | + "\t<META>\n" + | ||
| 19 | + "\t\t<SNDR>ZWY</SNDR>\n" + | ||
| 20 | + "\t\t<RCVR/>\n" + | ||
| 21 | + "\t\t<SEQN>16078357182</SEQN>\n" + | ||
| 22 | + "\t\t<DDTM>20181116175107671</DDTM>\n" + | ||
| 23 | + "\t\t<TYPE>HYXX</TYPE>\n" + | ||
| 24 | + "\t\t<STYP>NDLR</STYP>\n" + | ||
| 25 | + "\t</META>\n" + | ||
| 26 | + "\t<DECLAREPREPAREMASTERXMLBODY>\n" + | ||
| 27 | + "\t\t<Head>\n" + | ||
| 28 | + "\t\t\t<MessageID>CN_MT2201_1p1_4604729604327_20181116174636305</MessageID>\n" + | ||
| 29 | + "\t\t\t<FunctionCode>9</FunctionCode>\n" + | ||
| 30 | + "\t\t\t<MessageType>MT2201MASTER</MessageType>\n" + | ||
| 31 | + "\t\t\t<SenderID>460470678920X_DXPENT0000460002_20181116175107671</SenderID>\n" + | ||
| 32 | + "\t\t\t<ReceiverID>4604_20181116175107671</ReceiverID>\n" + | ||
| 33 | + "\t\t\t<SendTime>20181116175107671</SendTime>\n" + | ||
| 34 | + "\t\t\t<Version>1.0</Version>\n" + | ||
| 35 | + "\t\t</Head>\n" + | ||
| 36 | + "\t\t<Declaration>\n" + | ||
| 37 | + "\t\t\t<Carrier>\n" + | ||
| 38 | + "\t\t\t\t<ID>KA</ID>\n" + | ||
| 39 | + "\t\t\t</Carrier>\n" + | ||
| 40 | + "\t\t\t<ORG>\n" + | ||
| 41 | + "\t\t\t\t<ID>CGO</ID>\n" + | ||
| 42 | + "\t\t\t</ORG>\n" + | ||
| 43 | + "\t\t\t<DES>\n" + | ||
| 44 | + "\t\t\t\t<ID>LAX</ID>\n" + | ||
| 45 | + "\t\t\t</DES>\n" + | ||
| 46 | + "\t\t\t<BorderTransportMeans>\n" + | ||
| 47 | + "\t\t\t\t<JourneyID>749/2018-11-18</JourneyID>\n" + | ||
| 48 | + "\t\t\t</BorderTransportMeans>\n" + | ||
| 49 | + "\t\t\t<Consignment>\n" + | ||
| 50 | + "\t\t\t\t<TransportContractDocument>\n" + | ||
| 51 | + "\t\t\t\t\t<ID>160-78357182</ID>\n" + | ||
| 52 | + "\t\t\t\t</TransportContractDocument>\n" + | ||
| 53 | + "\t\t\t\t<AssociatedTransportDocument>\n" + | ||
| 54 | + "\t\t\t\t\t<ID/>\n" + | ||
| 55 | + "\t\t\t\t</AssociatedTransportDocument>\n" + | ||
| 56 | + "\t\t\t\t<LoadingLocation>\n" + | ||
| 57 | + "\t\t\t\t\t<ID>CGO/4620</ID>\n" + | ||
| 58 | + "\t\t\t\t\t<LoadingDate>2018-11-16 21:46</LoadingDate>\n" + | ||
| 59 | + "\t\t\t\t</LoadingLocation>\n" + | ||
| 60 | + "\t\t\t\t<UnloadingLocation>\n" + | ||
| 61 | + "\t\t\t\t\t<ID>CGO/4620</ID>\n" + | ||
| 62 | + "\t\t\t\t</UnloadingLocation>\n" + | ||
| 63 | + "\t\t\t\t<TransportSplitIndicator>0</TransportSplitIndicator>\n" + | ||
| 64 | + "\t\t\t\t<ConsignmentPackaging>\n" + | ||
| 65 | + "\t\t\t\t\t<QuantityQuantity>1</QuantityQuantity>\n" + | ||
| 66 | + "\t\t\t\t</ConsignmentPackaging>\n" + | ||
| 67 | + "\t\t\t\t<TotalGrossMassMeasure>65</TotalGrossMassMeasure>\n" + | ||
| 68 | + "\t\t\t\t<PreQuantityQuantity>1</PreQuantityQuantity>\n" + | ||
| 69 | + "\t\t\t\t<PreTotalGrossMassMeasure>65</PreTotalGrossMassMeasure>\n" + | ||
| 70 | + "\t\t\t\t<CustomsStatus>001</CustomsStatus>\n" + | ||
| 71 | + "\t\t\t\t<FreightPayment>\n" + | ||
| 72 | + "\t\t\t\t\t<MethodCode>PP</MethodCode>\n" + | ||
| 73 | + "\t\t\t\t</FreightPayment>\n" + | ||
| 74 | + "\t\t\t\t<ProductName>CELL PHONE</ProductName>\n" + | ||
| 75 | + "\t\t\t\t<PrepareTime>2018-11-16 21:46</PrepareTime>\n" + | ||
| 76 | + "\t\t\t\t<CustomsCode>4620</CustomsCode>\n" + | ||
| 77 | + "\t\t\t\t<AgentName>中外运空运发展股份有限公司郑州分公司</AgentName>\n" + | ||
| 78 | + "\t\t\t\t<AgentCompany>中外运空运发展股份有限公司郑州分公司</AgentCompany>\n" + | ||
| 79 | + "\t\t\t\t<NameOfgoods>CELL PHONE</NameOfgoods>\n" + | ||
| 80 | + "\t\t\t\t<DeliveryStation>001</DeliveryStation>\n" + | ||
| 81 | + "\t\t\t\t<UNnumber/>\n" + | ||
| 82 | + "\t\t\t\t<Category/>\n" + | ||
| 83 | + "\t\t\t\t<Consignee>\n" + | ||
| 84 | + "\t\t\t\t\t<Name>FEDEX TRADE NETWORKS TRANSPORT</Name>\n" + | ||
| 85 | + "\t\t\t\t\t<Address>\n" + | ||
| 86 | + "\t\t\t\t\t\t<Line>17210 SOUTH MAIN STREET GARDENA</Line>\n" + | ||
| 87 | + "\t\t\t\t\t\t<CityName>LOS ANGELES</CityName>\n" + | ||
| 88 | + "\t\t\t\t\t\t<CountryCode>US</CountryCode>\n" + | ||
| 89 | + "\t\t\t\t\t\t<ZipCode/>\n" + | ||
| 90 | + "\t\t\t\t\t\t<PROVINCECODE/>\n" + | ||
| 91 | + "\t\t\t\t\t\t<PROVINCENAME/>\n" + | ||
| 92 | + "\t\t\t\t\t\t<Deltaname/>\n" + | ||
| 93 | + "\t\t\t\t\t\t<TelePhone>3109655000</TelePhone>\n" + | ||
| 94 | + "\t\t\t\t\t\t<Fax/>\n" + | ||
| 95 | + "\t\t\t\t\t\t<CNECUSID>EIN+160807223</CNECUSID>\n" + | ||
| 96 | + "\t\t\t\t\t\t<CNEAEO/>\n" + | ||
| 97 | + "\t\t\t\t\t\t<Unlodingcode>LAX</Unlodingcode>\n" + | ||
| 98 | + "\t\t\t\t\t</Address>\n" + | ||
| 99 | + "\t\t\t\t</Consignee>\n" + | ||
| 100 | + "\t\t\t\t<Consignor>\n" + | ||
| 101 | + "\t\t\t\t\t<name>FEDEX</name>\n" + | ||
| 102 | + "\t\t\t\t\t<Address>\n" + | ||
| 103 | + "\t\t\t\t\t\t<Line>ROOM7</Line>\n" + | ||
| 104 | + "\t\t\t\t\t\t<CountryCode>CN</CountryCode>\n" + | ||
| 105 | + "\t\t\t\t\t\t<ZipCode/>\n" + | ||
| 106 | + "\t\t\t\t\t\t<Deltaname/>\n" + | ||
| 107 | + "\t\t\t\t\t\t<TelePhone>8637155131789</TelePhone>\n" + | ||
| 108 | + "\t\t\t\t\t\t<Fax/>\n" + | ||
| 109 | + "\t\t\t\t\t\t<SHPAEO/>\n" + | ||
| 110 | + "\t\t\t\t\t\t<SHPCUSID>USCI+91410100053384175K</SHPCUSID>\n" + | ||
| 111 | + "\t\t\t\t\t</Address>\n" + | ||
| 112 | + "\t\t\t\t</Consignor>\n" + | ||
| 113 | + "\t\t\t</Consignment>\n" + | ||
| 114 | + "\t\t</Declaration>\n" + | ||
| 115 | + "\t</DECLAREPREPAREMASTERXMLBODY>\n" + | ||
| 116 | + "</Msg>"; | ||
| 117 | + | ||
| 118 | + public void run(){ | ||
| 119 | + try { | ||
| 120 | + | ||
| 121 | + if (this.client == null) { | ||
| 122 | + logger.info("IMFClient has been closed"); | ||
| 123 | + return; | ||
| 124 | + } | ||
| 125 | + isrunning=true; | ||
| 126 | + if(IMF_KAKO_Task.isSuc){ | ||
| 127 | +// logger.info("<<<<<<<<<<<主线程初始化成功>>>>>>>>>>>>"); | ||
| 128 | + if(IMF_KAKO_Task.LOGIN_OK){ | ||
| 129 | + | ||
| 130 | + String returnMsg = this.client.sendMSG(SendMsg); | ||
| 131 | + logger.info("《--------发送信息成功开始轮询500mm一次--------"+returnMsg); | ||
| 132 | + }else{ | ||
| 133 | + logger.info("<<<<<<<<<<<登陆中>>>>>>>>>>>>"); | ||
| 134 | + } | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + }catch (Exception var14) { | ||
| 138 | + var14.printStackTrace(); | ||
| 139 | + logger.info(var14.getMessage()); | ||
| 140 | + } | ||
| 141 | + | ||
| 142 | + | ||
| 143 | + | ||
| 144 | + | ||
| 145 | + isrunning=false; | ||
| 146 | + logger.info("<<<<<<<<<<<发送线程不在了>>>>>>>>>>>>"); | ||
| 147 | + } | ||
| 148 | +} |
| @@ -2,13 +2,8 @@ package com.example.demo.scheduled; | @@ -2,13 +2,8 @@ package com.example.demo.scheduled; | ||
| 2 | 2 | ||
| 3 | import com.example.demo.handle.T_ETL_FWB_Handle; | 3 | import com.example.demo.handle.T_ETL_FWB_Handle; |
| 4 | import com.example.demo.model.T_ETL_MESSAGE; | 4 | import com.example.demo.model.T_ETL_MESSAGE; |
| 5 | -import com.example.demo.model.T_TXD_FWB; | ||
| 6 | -import com.example.demo.model.T_TXD_FWBPARTY; | ||
| 7 | import com.example.demo.service.T_ETL_MESSAGE_Service; | 5 | import com.example.demo.service.T_ETL_MESSAGE_Service; |
| 8 | -import com.example.demo.service.T_TXD_FWB_Service; | ||
| 9 | -import com.example.demo.util.XML.XML2ENTITY; | ||
| 10 | -import org.dom4j.Document; | ||
| 11 | -import org.dom4j.DocumentHelper; | 6 | + |
| 12 | import org.slf4j.Logger; | 7 | import org.slf4j.Logger; |
| 13 | import org.slf4j.LoggerFactory; | 8 | import org.slf4j.LoggerFactory; |
| 14 | import org.springframework.beans.factory.annotation.Autowired; | 9 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -16,12 +11,9 @@ import org.springframework.scheduling.annotation.Scheduled; | @@ -16,12 +11,9 @@ import org.springframework.scheduling.annotation.Scheduled; | ||
| 16 | import org.springframework.stereotype.Component; | 11 | import org.springframework.stereotype.Component; |
| 17 | 12 | ||
| 18 | import java.math.BigDecimal; | 13 | import java.math.BigDecimal; |
| 19 | -import java.math.BigInteger; | ||
| 20 | import java.text.SimpleDateFormat; | 14 | import java.text.SimpleDateFormat; |
| 21 | -import java.time.ZonedDateTime; | ||
| 22 | import java.util.Date; | 15 | import java.util.Date; |
| 23 | import java.util.List; | 16 | import java.util.List; |
| 24 | -import java.util.Map; | ||
| 25 | 17 | ||
| 26 | /** | 18 | /** |
| 27 | * 定时任务 | 19 | * 定时任务 |
| @@ -36,7 +28,7 @@ public class FWBTask { | @@ -36,7 +28,7 @@ public class FWBTask { | ||
| 36 | private T_ETL_MESSAGE_Service message_service; | 28 | private T_ETL_MESSAGE_Service message_service; |
| 37 | 29 | ||
| 38 | // @Scheduled(fixedRate = 5000) | 30 | // @Scheduled(fixedRate = 5000) |
| 39 | - @Scheduled(cron="0/10 * * * * ?") | 31 | +// @Scheduled(cron="0/10 * * * * ?") |
| 40 | public void FWB_analysis(){ | 32 | public void FWB_analysis(){ |
| 41 | logger.info("scheduled - fixedRate - print time every 5 seconds:{}", format.format(new Date()) ); | 33 | logger.info("scheduled - fixedRate - print time every 5 seconds:{}", format.format(new Date()) ); |
| 42 | 34 | ||
| @@ -71,7 +63,7 @@ public class FWBTask { | @@ -71,7 +63,7 @@ public class FWBTask { | ||
| 71 | "0 10,44 14 ? 3 WED" 三月的每周三的14:10和14:44触发 | 63 | "0 10,44 14 ? 3 WED" 三月的每周三的14:10和14:44触发 |
| 72 | "0 15 10 ? * MON-FRI" 每个周一、周二、周三、周四、周五的10:15触发 | 64 | "0 15 10 ? * MON-FRI" 每个周一、周二、周三、周四、周五的10:15触发 |
| 73 | */ | 65 | */ |
| 74 | - @Scheduled(cron="0/10 * * * * ?") | 66 | +// @Scheduled(cron="0/10 * * * * ?") |
| 75 | public void scheduledCronDemo(){ | 67 | public void scheduledCronDemo(){ |
| 76 | logger.info("scheduled - cron - print time every 10 seconds:{}", format.format(new Date()) ); | 68 | logger.info("scheduled - cron - print time every 10 seconds:{}", format.format(new Date()) ); |
| 77 | 69 |
| 1 | +package com.example.demo.scheduled; | ||
| 2 | + | ||
| 3 | +import com.caac.imf.api.IMFClient; | ||
| 4 | +import com.caac.imf.api.IMFClientFactory; | ||
| 5 | +import com.example.demo.handle.IMF.KAKO_Reader; | ||
| 6 | +import com.example.demo.handle.IMF.KAKO_Sender; | ||
| 7 | +import org.apache.log4j.Logger; | ||
| 8 | +import org.apache.log4j.PropertyConfigurator; | ||
| 9 | +import org.springframework.scheduling.annotation.Scheduled; | ||
| 10 | +import org.springframework.stereotype.Component; | ||
| 11 | + | ||
| 12 | +@Component | ||
| 13 | +public class IMF_KAKO_Task { | ||
| 14 | + protected static final Logger logger = Logger.getLogger(IMF_KAKO_Task.class); | ||
| 15 | + | ||
| 16 | + public static boolean LOGIN_OK = false; | ||
| 17 | + public static boolean isSuc = true; | ||
| 18 | + public static IMFClient client = null; | ||
| 19 | + | ||
| 20 | + @Scheduled(fixedRate = 5000) | ||
| 21 | + private static void start() throws Exception { | ||
| 22 | + PropertyConfigurator.configure("config/log4j.properties"); | ||
| 23 | + client = IMFClientFactory.createInstance(); | ||
| 24 | + | ||
| 25 | + | ||
| 26 | + if (client != null) { | ||
| 27 | + if (!KAKO_Reader.isrunning) { | ||
| 28 | + KAKO_Reader kako_reader = new KAKO_Reader(client); | ||
| 29 | + kako_reader.start(); | ||
| 30 | + logger.info("*********KAKO读取线程已开启***********"); | ||
| 31 | + } else { | ||
| 32 | + logger.info("*********KAKO读取线程已开启-不再启动线程*********"); | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + if(!KAKO_Sender.isrunning){ | ||
| 36 | + KAKO_Sender kako_sender = new KAKO_Sender(client); | ||
| 37 | + kako_sender.start(); | ||
| 38 | + logger.info("<<<<<<<<<KAKO发送线程已开启>>>>>>>>>>>>"); | ||
| 39 | + }else { | ||
| 40 | + logger.info("<<<<<<<<<KAKO发送线程已开启-不再启动线程>>>>>>>>>>>>"); | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + } | ||
| 44 | + if (!LOGIN_OK){ | ||
| 45 | + loginIMF(client, "KAKO", "KAKO", "config/imf_config.properties"); | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + | ||
| 49 | + | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + private static void loginIMF(IMFClient client, String userName, String password, String confFileName) { | ||
| 53 | + if (client.initial(confFileName)) { | ||
| 54 | + String message = client.login(userName, password); | ||
| 55 | + logger.info("message=" + message); | ||
| 56 | + if (message.indexOf("<CODE>1</CODE>") > 0) { | ||
| 57 | + logger.info("登陆成功"); | ||
| 58 | + LOGIN_OK = true; | ||
| 59 | + } else { | ||
| 60 | + int times = 0; | ||
| 61 | + | ||
| 62 | + while(times <= 3) { | ||
| 63 | + logger.info("try connection..."); | ||
| 64 | + ++times; | ||
| 65 | + logger.info("message.=" + message); | ||
| 66 | + if (message.indexOf("<CODE>1</CODE>") > 0) { | ||
| 67 | + logger.info("登陆成功"); | ||
| 68 | + LOGIN_OK = true; | ||
| 69 | + break; | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + logger.info("登录失败~~~~"); | ||
| 73 | + message = client.login(userName, password); | ||
| 74 | + | ||
| 75 | + try { | ||
| 76 | + Thread.sleep(4000L); | ||
| 77 | + } catch (InterruptedException var7) { | ||
| 78 | + var7.printStackTrace(); | ||
| 79 | + } | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + if (!LOGIN_OK) { | ||
| 83 | + logger.info("多次尝试登录失败,退出登陆"); | ||
| 84 | + client.disconnect(); | ||
| 85 | + isSuc =false; | ||
| 86 | + System.exit(-1); | ||
| 87 | + } | ||
| 88 | + } | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + } | ||
| 92 | +} |
| @@ -8,7 +8,7 @@ eureka.instance.status-page-url=http://localhost:7002/index | @@ -8,7 +8,7 @@ eureka.instance.status-page-url=http://localhost:7002/index | ||
| 8 | #eureka注册中心服务器地址 | 8 | #eureka注册中心服务器地址 |
| 9 | eureka.client.service-url.defaultZone=http://localhost:7001/eureka/ | 9 | eureka.client.service-url.defaultZone=http://localhost:7001/eureka/ |
| 10 | #服务名 | 10 | #服务名 |
| 11 | -spring.application.name=fileServer-01 | 11 | +spring.application.name=wareHouseAnalysis |
| 12 | 12 | ||
| 13 | #spring.datasource.name=CGOETL | 13 | #spring.datasource.name=CGOETL |
| 14 | spring.datasource.type=com.alibaba.druid.pool.DruidDataSource | 14 | spring.datasource.type=com.alibaba.druid.pool.DruidDataSource |
-
请 注册 或 登录 后发表评论