正在显示
15 个修改的文件
包含
640 行增加
和
96 行删除
@@ -59,14 +59,11 @@ spring: | @@ -59,14 +59,11 @@ spring: | ||
59 | # username: root | 59 | # username: root |
60 | # password: | 60 | # password: |
61 | # driver-class-name: com.mysql.jdbc.Driver | 61 | # driver-class-name: com.mysql.jdbc.Driver |
62 | - max-idle: 20 | ||
63 | - max-wait: 10000 | ||
64 | - min-idle: 5 | ||
65 | - initial-size: 5 | 62 | + |
66 | #配置初始化大小/最小/最大 | 63 | #配置初始化大小/最小/最大 |
67 | druid: | 64 | druid: |
68 | - initial-size: 1 | ||
69 | - min-idle: 1 | 65 | + initial-size: 5 |
66 | + min-idle: 5 | ||
70 | #最大并发连接数 | 67 | #最大并发连接数 |
71 | max-active: 40 | 68 | max-active: 40 |
72 | #获取连接等待超时时间 | 69 | #获取连接等待超时时间 |
@@ -80,9 +77,38 @@ spring: | @@ -80,9 +77,38 @@ spring: | ||
80 | #oracle | 77 | #oracle |
81 | validation-query: SELECT 'x' FROM DUAL | 78 | validation-query: SELECT 'x' FROM DUAL |
82 | test-while-idle: true | 79 | test-while-idle: true |
83 | - test-on-borrow: false | 80 | + test-on-borrow: true |
84 | test-on-return: false | 81 | test-on-return: false |
85 | default-auto-commit: true | 82 | default-auto-commit: true |
83 | + query-timeout: 30 | ||
84 | + pool-prepared-statements: true | ||
85 | + max-pool-prepared-statement-per-connection-size: 20 | ||
86 | + use-global-data-source-stat: true | ||
87 | + filters: stat,wall,slf4j | ||
88 | + # 下面3个enabled改为true即开启druid monitor | ||
89 | + filter: | ||
90 | + config: | ||
91 | + enabled: true | ||
92 | + # 配置 DruidStatFilter | ||
93 | + web-stat-filter: | ||
94 | + enabled: true | ||
95 | + url-pattern: /* | ||
96 | + exclusions: .js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/* | ||
97 | + # 配置 DruidStatViewServlet | ||
98 | + stat-view-servlet: | ||
99 | + enabled: true | ||
100 | + url-pattern: /druid/* | ||
101 | + # IP 白名单,没有配置或者为空,则允许所有访问 | ||
102 | + allow: 127.0.0.1 | ||
103 | + # IP 黑名单,若白名单也存在,则优先使用 | ||
104 | + deny: | ||
105 | + # 禁用 HTML 中 Reset All 按钮 | ||
106 | + reset-enable: false | ||
107 | +# # 登录用户名/密码 | ||
108 | +# login-username: 123 | ||
109 | +# login-password: 123 | ||
110 | + | ||
111 | + | ||
86 | 112 | ||
87 | eureka: | 113 | eureka: |
88 | instance: | 114 | instance: |
@@ -91,13 +117,14 @@ eureka: | @@ -91,13 +117,14 @@ eureka: | ||
91 | prefer-ip-address: true | 117 | prefer-ip-address: true |
92 | instance-id: ${spring.cloud.client.ip-address}:${server.port} | 118 | instance-id: ${spring.cloud.client.ip-address}:${server.port} |
93 | hostname: ${spring.cloud.client.ip-address} | 119 | hostname: ${spring.cloud.client.ip-address} |
120 | + lease-renewal-interval-in-seconds: 15 | ||
121 | + lease-expiration-duration-in-seconds: 45 | ||
94 | client: | 122 | client: |
95 | #eureka注册中心服务器地址 | 123 | #eureka注册中心服务器地址 |
96 | service-url: | 124 | service-url: |
97 | defaultZone: http://192.168.1.53:12345/eureka/ | 125 | defaultZone: http://192.168.1.53:12345/eureka/ |
98 | registry-fetch-interval-seconds: 30 | 126 | registry-fetch-interval-seconds: 30 |
99 | - lease-renewal-interval-in-seconds: 15 | ||
100 | - lease-expiration-duration-in-seconds: 45 | 127 | + |
101 | 128 | ||
102 | 129 | ||
103 | 130 | ||
@@ -184,4 +211,4 @@ mq: | @@ -184,4 +211,4 @@ mq: | ||
184 | # port: 5672 | 211 | # port: 5672 |
185 | # vHost: NMMS | 212 | # vHost: NMMS |
186 | # username: mrz | 213 | # username: mrz |
187 | -# password: vmvnv1v2 | ||
214 | +# password: vmvnv1v2 |
@@ -12,7 +12,7 @@ | @@ -12,7 +12,7 @@ | ||
12 | </parent> | 12 | </parent> |
13 | <groupId>com.tianbo</groupId> | 13 | <groupId>com.tianbo</groupId> |
14 | <artifactId>analysis</artifactId> | 14 | <artifactId>analysis</artifactId> |
15 | - <version>1.0-SNAPSHOT</version> | 15 | + <version>1.13-Realese</version> |
16 | <name>customAnalysis</name> | 16 | <name>customAnalysis</name> |
17 | <description>Analysis waybill recept</description> | 17 | <description>Analysis waybill recept</description> |
18 | <properties> | 18 | <properties> |
@@ -71,9 +71,14 @@ | @@ -71,9 +71,14 @@ | ||
71 | <!--数据库--> | 71 | <!--数据库--> |
72 | <dependency> | 72 | <dependency> |
73 | <groupId>com.alibaba</groupId> | 73 | <groupId>com.alibaba</groupId> |
74 | - <artifactId>druid</artifactId> | ||
75 | - <version>${druid.version}</version> | 74 | + <artifactId>druid-spring-boot-starter</artifactId> |
75 | + <version>1.1.10</version> | ||
76 | </dependency> | 76 | </dependency> |
77 | +<!-- <dependency>--> | ||
78 | +<!-- <groupId>com.alibaba</groupId>--> | ||
79 | +<!-- <artifactId>druid</artifactId>--> | ||
80 | +<!-- <version>${druid.version}</version>--> | ||
81 | +<!-- </dependency>--> | ||
77 | <dependency> | 82 | <dependency> |
78 | <groupId>org.mybatis</groupId> | 83 | <groupId>org.mybatis</groupId> |
79 | <artifactId>mybatis</artifactId> | 84 | <artifactId>mybatis</artifactId> |
@@ -438,4 +443,4 @@ | @@ -438,4 +443,4 @@ | ||
438 | <url>https://repo.spring.io/milestone</url> | 443 | <url>https://repo.spring.io/milestone</url> |
439 | </pluginRepository> | 444 | </pluginRepository> |
440 | </pluginRepositories> | 445 | </pluginRepositories> |
441 | -</project> | ||
446 | +</project> |
@@ -4,6 +4,8 @@ | @@ -4,6 +4,8 @@ | ||
4 | */ | 4 | */ |
5 | package com.tianbo.analysis; | 5 | package com.tianbo.analysis; |
6 | 6 | ||
7 | +import com.tianbo.analysis.bean.SpringBeanUtitl; | ||
8 | +import com.tianbo.analysis.bean.WlptBaseModel; | ||
7 | import org.mybatis.spring.annotation.MapperScan; | 9 | import org.mybatis.spring.annotation.MapperScan; |
8 | import org.springframework.boot.SpringApplication; | 10 | import org.springframework.boot.SpringApplication; |
9 | import org.springframework.boot.autoconfigure.SpringBootApplication; | 11 | import org.springframework.boot.autoconfigure.SpringBootApplication; |
@@ -23,18 +25,24 @@ import java.time.Duration; | @@ -23,18 +25,24 @@ import java.time.Duration; | ||
23 | @EnableDiscoveryClient | 25 | @EnableDiscoveryClient |
24 | @EnableTransactionManagement | 26 | @EnableTransactionManagement |
25 | @MapperScan("com.tianbo.analysis.dao") | 27 | @MapperScan("com.tianbo.analysis.dao") |
26 | -public class BootApplication { | 28 | +public class CustomAnalysisBootApplication { |
27 | 29 | ||
28 | public static void main(String[] args) { | 30 | public static void main(String[] args) { |
29 | - SpringApplication.run(BootApplication.class, args); | 31 | + SpringApplication.run(CustomAnalysisBootApplication.class, args); |
32 | +// initCompent(); | ||
30 | } | 33 | } |
31 | 34 | ||
32 | @Bean | 35 | @Bean |
33 | - @LoadBalanced | 36 | +// @LoadBalanced |
34 | RestTemplate restTemplate(RestTemplateBuilder builder){ | 37 | RestTemplate restTemplate(RestTemplateBuilder builder){ |
35 | 38 | ||
36 | - return builder.setConnectTimeout(Duration.ofSeconds(15)).setReadTimeout(Duration.ofSeconds(15)) | 39 | + return builder.setConnectTimeout(Duration.ofSeconds(3)).setReadTimeout(Duration.ofSeconds(3)) |
37 | .build(); | 40 | .build(); |
38 | } | 41 | } |
42 | + | ||
43 | + public static void initCompent(){ | ||
44 | + WlptBaseModel wlptBaseModel = (WlptBaseModel) SpringBeanUtitl.getBean("wlptBase"); | ||
45 | + wlptBaseModel.init(); | ||
46 | + } | ||
39 | } | 47 | } |
40 | 48 |
1 | +package com.tianbo.analysis.bean; | ||
2 | + | ||
3 | +import com.alibaba.druid.pool.DruidDataSource; | ||
4 | +import com.alibaba.druid.support.http.StatViewServlet; | ||
5 | +import com.alibaba.druid.support.http.WebStatFilter; | ||
6 | +import org.mybatis.spring.SqlSessionFactoryBean; | ||
7 | +import org.springframework.beans.factory.annotation.Qualifier; | ||
8 | +import org.springframework.boot.context.properties.ConfigurationProperties; | ||
9 | +import org.springframework.boot.jdbc.DataSourceBuilder; | ||
10 | +import org.springframework.boot.web.servlet.FilterRegistrationBean; | ||
11 | +import org.springframework.boot.web.servlet.ServletRegistrationBean; | ||
12 | +import org.springframework.context.annotation.Bean; | ||
13 | +import org.springframework.context.annotation.Configuration; | ||
14 | +import org.springframework.context.annotation.Primary; | ||
15 | +import org.springframework.core.io.support.PathMatchingResourcePatternResolver; | ||
16 | +import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor; | ||
17 | + | ||
18 | +import javax.servlet.Filter; | ||
19 | +import javax.servlet.Servlet; | ||
20 | +import javax.sql.DataSource; | ||
21 | + | ||
22 | +@Configuration | ||
23 | +public class DruidConfig { | ||
24 | + | ||
25 | + | ||
26 | +// @Primary | ||
27 | +// @Bean | ||
28 | +// @ConfigurationProperties(prefix = "spring.datasource") | ||
29 | +// public DataSource druidDataSource(){ | ||
30 | +// return DataSourceBuilder.create().type(DruidDataSource.class).build(); | ||
31 | +//// return new DruidDataSource(); | ||
32 | +// } | ||
33 | + | ||
34 | + | ||
35 | + /** | ||
36 | + * 配置druid在线监控的账号密码 | ||
37 | + * @return | ||
38 | + */ | ||
39 | + @Bean | ||
40 | + public ServletRegistrationBean<Servlet> druidServlet(){ | ||
41 | + | ||
42 | + StatViewServlet statViewServlet = new StatViewServlet(); | ||
43 | + ServletRegistrationBean<Servlet> srb = new ServletRegistrationBean<>(statViewServlet, "/druid/*"); | ||
44 | + // 白名单 | ||
45 | + srb.addInitParameter("allow", "127.0.0.1"); | ||
46 | + // 黑名单 | ||
47 | +// srb.addInitParameter("deny", "10.*.*.*"); | ||
48 | + // 用户名 | ||
49 | + srb.addInitParameter("loginUsername", "tianbo"); | ||
50 | + // 密码 | ||
51 | + srb.addInitParameter("loginPassword", "vmvnv1v2VV."); | ||
52 | + // 是否可以重置数据源 | ||
53 | + srb.addInitParameter("resetEnable", "false"); | ||
54 | + return srb; | ||
55 | + } | ||
56 | + | ||
57 | +// @Bean | ||
58 | +// public FilterRegistrationBean<Filter> filterRegistrationBean(){ | ||
59 | +// FilterRegistrationBean<Filter> frb = new FilterRegistrationBean<>(); | ||
60 | +// WebStatFilter webStatFilter = new WebStatFilter(); | ||
61 | +// // 所有请求进行监控处理 | ||
62 | +// frb.setFilter(webStatFilter); | ||
63 | +// // 排除名单 | ||
64 | +// frb.addUrlPatterns("/*"); | ||
65 | +// frb.addInitParameter("exclusions", "*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*"); | ||
66 | +// return frb; | ||
67 | +// } | ||
68 | + | ||
69 | +// @Bean | ||
70 | +// PersistenceExceptionTranslationPostProcessor persistenceExceptionTranslationPostProcessor() { | ||
71 | +// return new PersistenceExceptionTranslationPostProcessor(); | ||
72 | +// } | ||
73 | + | ||
74 | +// @Bean | ||
75 | +// public SqlSessionFactoryBean sqlSessionFactory(@Qualifier("dataSource") DataSource dataSource) throws Exception { | ||
76 | +// SqlSessionFactoryBean bean = new SqlSessionFactoryBean(); | ||
77 | +// bean.setDataSource(dataSource); | ||
78 | +// PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); | ||
79 | +// bean.setMapperLocations(resolver.getResources("classpath:/mapping/*.xml")); | ||
80 | +// return bean; | ||
81 | +// } | ||
82 | + | ||
83 | +} |
@@ -7,59 +7,61 @@ import com.tianbo.analysis.service.SendLogService; | @@ -7,59 +7,61 @@ import com.tianbo.analysis.service.SendLogService; | ||
7 | import org.springframework.beans.factory.annotation.Autowired; | 7 | import org.springframework.beans.factory.annotation.Autowired; |
8 | import org.springframework.stereotype.Component; | 8 | import org.springframework.stereotype.Component; |
9 | 9 | ||
10 | -@Component | ||
11 | -public class WlptBaseModel { | 10 | +import javax.annotation.PostConstruct; |
11 | +import javax.annotation.Resource; | ||
12 | 12 | ||
13 | +@Component(value = "wlptBase") | ||
14 | +public class WlptBaseModel { | ||
13 | 15 | ||
14 | - @Autowired | 16 | + @Resource |
15 | public ALLOCATEARRIVALMapper allocatearrivalMapper; | 17 | public ALLOCATEARRIVALMapper allocatearrivalMapper; |
16 | 18 | ||
17 | @Autowired | 19 | @Autowired |
18 | public SendLogService sendLogService; | 20 | public SendLogService sendLogService; |
19 | 21 | ||
20 | - @Autowired | 22 | + @Resource |
21 | public ARRIVEDMASTERMapper arrivedmasterMapper; | 23 | public ARRIVEDMASTERMapper arrivedmasterMapper; |
22 | 24 | ||
23 | - @Autowired | 25 | + @Resource |
24 | public ARRIVEDSECONDARYMapper arrivedsecondaryMapper; | 26 | public ARRIVEDSECONDARYMapper arrivedsecondaryMapper; |
25 | 27 | ||
26 | - @Autowired | 28 | + @Resource |
27 | public DEPARTURESLOADINGMapper departuresloadingMapper; | 29 | public DEPARTURESLOADINGMapper departuresloadingMapper; |
28 | 30 | ||
29 | - @Autowired | 31 | + @Resource |
30 | public INPORTALLOCATEMapper inportallocateMapper; | 32 | public INPORTALLOCATEMapper inportallocateMapper; |
31 | 33 | ||
32 | - @Autowired | 34 | + @Resource |
33 | public INTERNATIONALTRANSITMapper internationaltransitMapper; | 35 | public INTERNATIONALTRANSITMapper internationaltransitMapper; |
34 | 36 | ||
35 | - @Autowired | 37 | + @Resource |
36 | public ORIGINMANIFESTMASTERMapper originmanifestmasterMapper; | 38 | public ORIGINMANIFESTMASTERMapper originmanifestmasterMapper; |
37 | 39 | ||
38 | - @Autowired | 40 | + @Resource |
39 | public OriginmanifestsecondaryMapper originmanifestsecondaryMapper; | 41 | public OriginmanifestsecondaryMapper originmanifestsecondaryMapper; |
40 | 42 | ||
41 | - @Autowired | 43 | + @Resource |
42 | public PREPAREMASTERMapper preparemasterMapper; | 44 | public PREPAREMASTERMapper preparemasterMapper; |
43 | 45 | ||
44 | - @Autowired | 46 | + @Resource |
45 | public PREPARESECONDARYMapper preparesecondaryMapper; | 47 | public PREPARESECONDARYMapper preparesecondaryMapper; |
46 | 48 | ||
47 | - @Autowired | 49 | + @Resource |
48 | public TALLYMASTERMapper tallymasterMapper; | 50 | public TALLYMASTERMapper tallymasterMapper; |
49 | 51 | ||
50 | - @Autowired | 52 | + @Resource |
51 | public TALLYSECONDARYMapper tallysecondaryMapper; | 53 | public TALLYSECONDARYMapper tallysecondaryMapper; |
52 | 54 | ||
53 | - @Autowired | 55 | + @Resource |
54 | public CUSTOMSMESSAGEMapper customsmessageMapper; | 56 | public CUSTOMSMESSAGEMapper customsmessageMapper; |
55 | 57 | ||
56 | @Autowired | 58 | @Autowired |
57 | public CustomMessageService customMessageService; | 59 | public CustomMessageService customMessageService; |
58 | 60 | ||
59 | - @Autowired | 61 | + @Resource |
60 | public MANIFESTLOADMapper manifestloadMapper; | 62 | public MANIFESTLOADMapper manifestloadMapper; |
61 | 63 | ||
62 | - @Autowired | 64 | + @Resource |
63 | public MANIFESTLOSTCHANGEMapper manifestlostchangeMapper; | 65 | public MANIFESTLOSTCHANGEMapper manifestlostchangeMapper; |
64 | 66 | ||
65 | 67 | ||
@@ -119,8 +121,9 @@ public class WlptBaseModel { | @@ -119,8 +121,9 @@ public class WlptBaseModel { | ||
119 | 121 | ||
120 | } | 122 | } |
121 | 123 | ||
122 | - public static void init(){ | ||
123 | - | 124 | + @PostConstruct |
125 | + public void init(){ | ||
126 | + System.out.print("\nWlptBaseModel的初始化值为:"+this.originmanifestmasterMapper); | ||
124 | } | 127 | } |
125 | 128 | ||
126 | public int masterAnalysisReception(){ | 129 | public int masterAnalysisReception(){ |
1 | +package com.tianbo.analysis.controller; | ||
2 | + | ||
3 | + | ||
4 | +import com.tianbo.analysis.handle.CustomResponseHandleThread; | ||
5 | +import com.tianbo.analysis.service.CustomResponseAnalysisService; | ||
6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
7 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
8 | +import org.springframework.web.bind.annotation.RequestParam; | ||
9 | +import org.springframework.web.bind.annotation.RestController; | ||
10 | + | ||
11 | +@RestController | ||
12 | +@RequestMapping("/cust") | ||
13 | +public class CustomResponseController { | ||
14 | + | ||
15 | + @Autowired | ||
16 | + CustomResponseAnalysisService customResponseAnalysisService; | ||
17 | + | ||
18 | + @RequestMapping("analysis") | ||
19 | + public boolean analysis(@RequestParam(value = "xml",required = true) String xml){ | ||
20 | + | ||
21 | + boolean result = customResponseAnalysisService.xmlAnalysis(xml); | ||
22 | + return result; | ||
23 | + } | ||
24 | +} |
1 | package com.tianbo.analysis.handle; | 1 | package com.tianbo.analysis.handle; |
2 | 2 | ||
3 | 3 | ||
4 | +import com.tianbo.analysis.bean.SpringBeanUtitl; | ||
4 | import com.tianbo.analysis.model.Agent_Notice; | 5 | import com.tianbo.analysis.model.Agent_Notice; |
5 | import com.tianbo.analysis.model.CustomReception; | 6 | import com.tianbo.analysis.model.CustomReception; |
6 | import com.tianbo.analysis.tools.AWBTools; | 7 | import com.tianbo.analysis.tools.AWBTools; |
7 | import lombok.extern.slf4j.Slf4j; | 8 | import lombok.extern.slf4j.Slf4j; |
8 | 9 | ||
9 | import org.springframework.beans.factory.annotation.Autowired; | 10 | import org.springframework.beans.factory.annotation.Autowired; |
11 | +import org.springframework.context.annotation.Bean; | ||
10 | import org.springframework.http.client.SimpleClientHttpRequestFactory; | 12 | import org.springframework.http.client.SimpleClientHttpRequestFactory; |
11 | import org.springframework.stereotype.Component; | 13 | import org.springframework.stereotype.Component; |
12 | import org.springframework.web.client.RestTemplate; | 14 | import org.springframework.web.client.RestTemplate; |
@@ -20,14 +22,20 @@ public class AgentXmlHandle { | @@ -20,14 +22,20 @@ public class AgentXmlHandle { | ||
20 | 22 | ||
21 | private static AgentXmlHandle agentXmlHandle; | 23 | private static AgentXmlHandle agentXmlHandle; |
22 | 24 | ||
25 | + @Autowired | ||
26 | + RestTemplate restTemplate; | ||
27 | + | ||
28 | + @PostConstruct | ||
29 | + public void init() { | ||
30 | + agentXmlHandle = this; | ||
31 | + | ||
32 | + agentXmlHandle.restTemplate = this.restTemplate; | ||
33 | + | ||
34 | + // 初使化时将已静态化的testService实例化 | ||
35 | + } | ||
23 | 36 | ||
24 | public void Http_resolver(CustomReception customReception){ | 37 | public void Http_resolver(CustomReception customReception){ |
25 | try{ | 38 | try{ |
26 | - SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory(); | ||
27 | - requestFactory.setConnectTimeout(3000); | ||
28 | - requestFactory.setReadTimeout(3000); | ||
29 | - RestTemplate restTemplate = new RestTemplate(requestFactory); | ||
30 | - | ||
31 | String secondSplit = "_"; | 39 | String secondSplit = "_"; |
32 | String waybillnosecondary=""; | 40 | String waybillnosecondary=""; |
33 | if (customReception.getWayBillSecond()!=null && customReception.getWayBillSecond().contains(secondSplit)){ | 41 | if (customReception.getWayBillSecond()!=null && customReception.getWayBillSecond().contains(secondSplit)){ |
@@ -36,14 +44,14 @@ public class AgentXmlHandle { | @@ -36,14 +44,14 @@ public class AgentXmlHandle { | ||
36 | waybillnosecondary = awbhArr[1]; | 44 | waybillnosecondary = awbhArr[1]; |
37 | } | 45 | } |
38 | 46 | ||
39 | - Agent_Notice notice = restTemplate.getForObject("http://10.50.3.73:1983/agent/receipt/a0608c4054662dd902e1314f7e450e3eaa81c114?message_type={1}&waybillNo={2}&waybillNoSub={3}&response_code={4}&response_text={5}" | 47 | + Agent_Notice notice = agentXmlHandle.restTemplate.getForObject("http://10.50.3.73:1983/agent/receipt/a0608c4054662dd902e1314f7e450e3eaa81c114?message_type={1}&waybillNo={2}&waybillNoSub={3}&response_code={4}&response_text={5}" |
40 | , Agent_Notice.class,"MT2201", AWBTools.awbFormat(customReception.getWayBillMaster()),waybillnosecondary,customReception.getResponseCode(),customReception.getResponseText()); | 48 | , Agent_Notice.class,"MT2201", AWBTools.awbFormat(customReception.getWayBillMaster()),waybillnosecondary,customReception.getResponseCode(),customReception.getResponseText()); |
49 | + | ||
41 | log.info(notice.toString()); | 50 | log.info(notice.toString()); |
42 | }catch (Exception e){ | 51 | }catch (Exception e){ |
43 | log.error("链接代理人服务器超时或者接口异常,{}",e); | 52 | log.error("链接代理人服务器超时或者接口异常,{}",e); |
44 | } | 53 | } |
45 | 54 | ||
46 | - | ||
47 | } | 55 | } |
48 | 56 | ||
49 | } | 57 | } |
@@ -79,8 +79,10 @@ public class CustomXmlHandleThread implements Runnable{ | @@ -79,8 +79,10 @@ public class CustomXmlHandleThread implements Runnable{ | ||
79 | */ | 79 | */ |
80 | public final static String ImportJourneyID = "//Manifest/Response/ImportInformation/BorderTransportMeans/JourneyID"; | 80 | public final static String ImportJourneyID = "//Manifest/Response/ImportInformation/BorderTransportMeans/JourneyID"; |
81 | public final static String ImportWaybillMaster = "//Manifest/Response/ImportInformation/Consignment/TransportContractDocument/ID"; | 81 | public final static String ImportWaybillMaster = "//Manifest/Response/ImportInformation/Consignment/TransportContractDocument/ID"; |
82 | + public final static String ImportWaybillSecond = "//Manifest/Response/ImportInformation/Consignment/AssociatedTransportDocument/ID"; | ||
82 | public final static String ExportJourneyID = "//Manifest/Response/ExportInformation/BorderTransportMeans/JourneyID"; | 83 | public final static String ExportJourneyID = "//Manifest/Response/ExportInformation/BorderTransportMeans/JourneyID"; |
83 | public final static String ExportWaybillMaster = "//Manifest/Response/ExportInformation/Consignment/TransportContractDocument/ID"; | 84 | public final static String ExportWaybillMaster = "//Manifest/Response/ExportInformation/Consignment/TransportContractDocument/ID"; |
85 | + public final static String ExportWaybillSecond = "//Manifest/Response/ExportInformation/Consignment/AssociatedTransportDocument/ID"; | ||
84 | // public final static String TransResponseCode = "//Manifest/Response/ResponseType/Code"; | 86 | // public final static String TransResponseCode = "//Manifest/Response/ResponseType/Code"; |
85 | // public final static String TransResponseText = "//Manifest/Response/ResponseType/Text"; | 87 | // public final static String TransResponseText = "//Manifest/Response/ResponseType/Text"; |
86 | public final static String TransResponseCode = "//ResponseType/Code"; | 88 | public final static String TransResponseCode = "//ResponseType/Code"; |
@@ -347,12 +349,14 @@ public class CustomXmlHandleThread implements Runnable{ | @@ -347,12 +349,14 @@ public class CustomXmlHandleThread implements Runnable{ | ||
347 | 349 | ||
348 | 350 | ||
349 | String importWaybillMaster= XMLXPath.getSingleValueByPath(document,ImportWaybillMaster); | 351 | String importWaybillMaster= XMLXPath.getSingleValueByPath(document,ImportWaybillMaster); |
352 | + String importWaybillSecond= XMLXPath.getSingleValueByPath(document,ImportWaybillSecond); | ||
350 | String transResponseCode=XMLXPath.getSingleValueByPath(document,TransResponseCode); | 353 | String transResponseCode=XMLXPath.getSingleValueByPath(document,TransResponseCode); |
351 | String transResponseText=XMLXPath.getSingleValueByPath(document,TransResponseText); | 354 | String transResponseText=XMLXPath.getSingleValueByPath(document,TransResponseText); |
352 | CustomReception transCustomReception = new CustomReception( customReception.getMessageType(), | 355 | CustomReception transCustomReception = new CustomReception( customReception.getMessageType(), |
353 | importFlightNo, | 356 | importFlightNo, |
354 | importFlightDate, | 357 | importFlightDate, |
355 | importWaybillMaster, | 358 | importWaybillMaster, |
359 | + importWaybillSecond, | ||
356 | transResponseCode, | 360 | transResponseCode, |
357 | transResponseText, | 361 | transResponseText, |
358 | customReception.getMessageID(), | 362 | customReception.getMessageID(), |
@@ -55,6 +55,10 @@ public class CustomReception { | @@ -55,6 +55,10 @@ public class CustomReception { | ||
55 | this.receiverID = receiverID; | 55 | this.receiverID = receiverID; |
56 | this.version = version; | 56 | this.version = version; |
57 | this.functionCode = functionCode; | 57 | this.functionCode = functionCode; |
58 | + | ||
59 | + this.importFlightNo = flightNo; | ||
60 | + this.importFlightDate = flightDate; | ||
61 | + this.importWaybillMaster = wayBillMaster; | ||
58 | } | 62 | } |
59 | 63 | ||
60 | public CustomReception(String messageType, | 64 | public CustomReception(String messageType, |
@@ -3,8 +3,10 @@ package com.tianbo.analysis.model; | @@ -3,8 +3,10 @@ package com.tianbo.analysis.model; | ||
3 | import com.tianbo.analysis.bean.WlptBaseModel; | 3 | import com.tianbo.analysis.bean.WlptBaseModel; |
4 | import com.tianbo.analysis.tools.AWBTools; | 4 | import com.tianbo.analysis.tools.AWBTools; |
5 | import com.tianbo.util.Date.DateUtil; | 5 | import com.tianbo.util.Date.DateUtil; |
6 | +import com.tianbo.util.String.StringUtil; | ||
6 | import lombok.Data; | 7 | import lombok.Data; |
7 | import lombok.extern.slf4j.Slf4j; | 8 | import lombok.extern.slf4j.Slf4j; |
9 | +import org.apache.commons.lang.StringUtils; | ||
8 | 10 | ||
9 | import java.util.Date; | 11 | import java.util.Date; |
10 | import java.util.List; | 12 | import java.util.List; |
@@ -222,8 +224,9 @@ public class INTERNATIONALTRANSIT extends WlptBaseModel { | @@ -222,8 +224,9 @@ public class INTERNATIONALTRANSIT extends WlptBaseModel { | ||
222 | this.originalFlightdate = DateUtil.formatByyyyyMMdd(customReception.getImportFlightDate()); | 224 | this.originalFlightdate = DateUtil.formatByyyyyMMdd(customReception.getImportFlightDate()); |
223 | this.originalBillno = AWBTools.awbFormat(customReception.getImportWaybillMaster()); | 225 | this.originalBillno = AWBTools.awbFormat(customReception.getImportWaybillMaster()); |
224 | //TODO:碰见分单回执再解析 | 226 | //TODO:碰见分单回执再解析 |
225 | - this.originalSubNumber = customReception.getWayBillSecond(); | ||
226 | - | 227 | + if (StringUtils.isNotBlank(customReception.getWayBillSecond())){ |
228 | + this.originalSubNumber = customReception.getWayBillSecond().split("_")[1]; | ||
229 | + } | ||
227 | this.status = AWBTools.transCusRspCode(customReception.getResponseCode()); | 230 | this.status = AWBTools.transCusRspCode(customReception.getResponseCode()); |
228 | this.receiption = customReception.getResponseText(); | 231 | this.receiption = customReception.getResponseText(); |
229 | } | 232 | } |
@@ -237,13 +240,13 @@ public class INTERNATIONALTRANSIT extends WlptBaseModel { | @@ -237,13 +240,13 @@ public class INTERNATIONALTRANSIT extends WlptBaseModel { | ||
237 | String autoId = internationaltransit.getAutoid(); | 240 | String autoId = internationaltransit.getAutoid(); |
238 | 241 | ||
239 | //插入sendlog记录表 | 242 | //插入sendlog记录表 |
240 | - log.info("即将插入国际转运日志运单号为:"+originalBillno+"->autoid="+autoId); | 243 | + log.info("即将插入国际转运日志主运单号为:{},分单:{},->autoid={}",originalBillno,originalSubNumber,autoId); |
241 | int ii =sendLogService.insertSendlog("MT8205",receiption,autoId); | 244 | int ii =sendLogService.insertSendlog("MT8205",receiption,autoId); |
242 | if (i>0 && ii>0){ | 245 | if (i>0 && ii>0){ |
243 | - log.info("运单号 {} 国际转运回执更新成功",originalBillno); | 246 | + log.info("运单号 {}{} 国际转运回执更新成功",originalBillno,originalSubNumber); |
244 | return 1; | 247 | return 1; |
245 | } | 248 | } |
246 | } | 249 | } |
247 | return 0; | 250 | return 0; |
248 | } | 251 | } |
249 | -} | ||
252 | +} |
1 | +package com.tianbo.analysis.service; | ||
2 | + | ||
3 | +/** | ||
4 | + * @author mrz | ||
5 | + */ | ||
6 | +public interface CustomResponseAnalysisService { | ||
7 | + | ||
8 | + /** | ||
9 | + * 解析海关回执xml | ||
10 | + * @param var 回执内容 | ||
11 | + * @return 解析成功或者失败 | ||
12 | + */ | ||
13 | + boolean xmlAnalysis(String var); | ||
14 | + | ||
15 | + /** | ||
16 | + * 备份报文报文名称根据uuid生成 扩展名为xml | ||
17 | + * @param responseText 报文内容 | ||
18 | + * @param dir 备份目录 | ||
19 | + */ | ||
20 | + void bakXml(String responseText,String dir); | ||
21 | +} |
1 | +package com.tianbo.analysis.service.imp; | ||
2 | + | ||
3 | +import com.tianbo.analysis.handle.AgentXmlHandle; | ||
4 | +import com.tianbo.analysis.model.*; | ||
5 | +import com.tianbo.analysis.service.CustomResponseAnalysisService; | ||
6 | +import com.tianbo.analysis.tools.AWBTools; | ||
7 | +import com.tianbo.util.Date.DateUtil; | ||
8 | +import com.tianbo.util.XML.XMLXPath; | ||
9 | +import lombok.extern.slf4j.Slf4j; | ||
10 | +import org.apache.commons.io.FileExistsException; | ||
11 | +import org.apache.commons.io.FileUtils; | ||
12 | +import org.apache.commons.lang.StringUtils; | ||
13 | +import org.dom4j.Document; | ||
14 | +import org.dom4j.DocumentException; | ||
15 | +import org.dom4j.Element; | ||
16 | +import org.dom4j.io.SAXReader; | ||
17 | +import org.springframework.beans.factory.annotation.Value; | ||
18 | +import org.springframework.stereotype.Service; | ||
19 | +import org.xml.sax.SAXParseException; | ||
20 | + | ||
21 | +import java.io.ByteArrayInputStream; | ||
22 | +import java.io.File; | ||
23 | +import java.io.FileNotFoundException; | ||
24 | +import java.io.UnsupportedEncodingException; | ||
25 | +import java.nio.charset.StandardCharsets; | ||
26 | +import java.util.UUID; | ||
27 | + | ||
28 | +@Service | ||
29 | +@Slf4j | ||
30 | +public class CustomResponseAnalysisServiceImp implements CustomResponseAnalysisService { | ||
31 | + | ||
32 | + | ||
33 | + //解析出错转移目录 | ||
34 | + @Value("${custom.errBakDir}") | ||
35 | + private String errBakDir; | ||
36 | + | ||
37 | + @Value("${custom.receptBakDir}") | ||
38 | + private String receptBakDir; | ||
39 | + | ||
40 | + /** | ||
41 | + * 单一窗口回执的技术回执 | ||
42 | + */ | ||
43 | + public final static String DONT_NEED = "<Code>0</Code><Text>接收成功</Text>"; | ||
44 | + | ||
45 | + //海关新舱单回执报头 | ||
46 | + public final static String MessageID = "//Manifest/Head/MessageID"; | ||
47 | + public final static String FunctionCode = "//Manifest/Head/FunctionCode"; | ||
48 | + public final static String MessageType = "//Manifest/Head/MessageType"; | ||
49 | + public final static String SenderID = "//Manifest/Head/SenderID"; | ||
50 | + public final static String ReceiverID = "//Manifest/Head/ReceiverID"; | ||
51 | + public final static String SendTime = "//Manifest/Head/SendTime"; | ||
52 | + public final static String Version = "//Manifest/Head/Version"; | ||
53 | + | ||
54 | + | ||
55 | + /** | ||
56 | + * 海关普通业务新舱单回执报体 | ||
57 | + */ | ||
58 | + public final static String JourneyID = "//Manifest/Response/BorderTransportMeans/JourneyID"; | ||
59 | + public final static String WaybillMaster = "//Manifest/Response/Consignment/TransportContractDocument/ID"; | ||
60 | + public final static String WaybillSecond = "//Manifest/Response/Consignment/AssociatedTransportDocument/ID"; | ||
61 | + public final static String ResponseCode = "//ResponseType/Code"; | ||
62 | + public final static String ResponseText = "//ResponseType/Text"; | ||
63 | + | ||
64 | + /** | ||
65 | + * 海关国际转运业务回执报体 | ||
66 | + */ | ||
67 | + public final static String ImportJourneyID = "//Manifest/Response/ImportInformation/BorderTransportMeans/JourneyID"; | ||
68 | + public final static String ImportWaybillMaster = "//Manifest/Response/ImportInformation/Consignment/TransportContractDocument/ID"; | ||
69 | + public final static String ImportWaybillSecond = "//Manifest/Response/ImportInformation/Consignment/AssociatedTransportDocument/ID"; | ||
70 | + public final static String ExportJourneyID = "//Manifest/Response/ExportInformation/BorderTransportMeans/JourneyID"; | ||
71 | + public final static String ExportWaybillMaster = "//Manifest/Response/ExportInformation/Consignment/TransportContractDocument/ID"; | ||
72 | + // public final static String TransResponseCode = "//Manifest/Response/ResponseType/Code"; | ||
73 | +// public final static String TransResponseText = "//Manifest/Response/ResponseType/Text"; | ||
74 | + public final static String TransResponseCode = "//ResponseType/Code"; | ||
75 | + public final static String TransResponseText = "//ResponseType/Text"; | ||
76 | + | ||
77 | + | ||
78 | + @Override | ||
79 | + public boolean xmlAnalysis(String xmlStr) { | ||
80 | + String today = DateUtil.getTodayBy_yyyyMMdd(); | ||
81 | + String errDirByDay = errBakDir + "/" + today; | ||
82 | + String failDirByDay = errBakDir+ "Fail" + "/" + today; | ||
83 | + String successDir = receptBakDir + "/" + today; | ||
84 | + if(xmlStr.contains(DONT_NEED)){ | ||
85 | +// bakXml(xmlStr,errDirByDay); | ||
86 | + log.info("报文为技术回执备份成功..开始解析下一文件,当前线程即将结束"); | ||
87 | + } | ||
88 | + else | ||
89 | + { | ||
90 | + try{ | ||
91 | + | ||
92 | + int i =handelXmlDocument(xmlStr); | ||
93 | + //操作成功,则转移剪切解析文件到备份目录,否则转移到error目录备份 | ||
94 | + if(i>0){ | ||
95 | +// bakXml(xmlStr,successDir); | ||
96 | + log.info("报文解析入库成功"); | ||
97 | + return true; | ||
98 | + }else { | ||
99 | +// bakXml(xmlStr,errDirByDay); | ||
100 | + return true; | ||
101 | + } | ||
102 | + }catch (Exception e){ | ||
103 | + log.error("报文备份异常",e); | ||
104 | + bakXml(xmlStr,failDirByDay); | ||
105 | + e.printStackTrace(); | ||
106 | + return false; | ||
107 | + } | ||
108 | + | ||
109 | + } | ||
110 | + log.info("线程结束"); | ||
111 | + | ||
112 | + return false; | ||
113 | + } | ||
114 | + | ||
115 | + private int handelXmlDocument(String xml) throws DocumentException, UnsupportedEncodingException, SAXParseException, FileNotFoundException { | ||
116 | + | ||
117 | + int i = 0; | ||
118 | + String secondSplit = "_"; | ||
119 | + SAXReader saxReader = new SAXReader(); | ||
120 | + Document document = saxReader.read(new ByteArrayInputStream(xml.getBytes(StandardCharsets.UTF_8))); | ||
121 | + Element contentRoot = document.getRootElement(); | ||
122 | + | ||
123 | + String flightNo = "UNKONW"; | ||
124 | + String flightDate = "20101010"; | ||
125 | + | ||
126 | + //开始解析 | ||
127 | + String msgType = XMLXPath.getSingleValueByPath(document,MessageType); | ||
128 | + String journeyid = XMLXPath.getSingleValueByPath(document,JourneyID); | ||
129 | +// XMLXPath.getSingleValueByPath(document, ) | ||
130 | + | ||
131 | + | ||
132 | + String awbA = XMLXPath.getSingleValueByPath(document,WaybillMaster); | ||
133 | + //全格式的分单 如 17212345678_ADBD | ||
134 | + String awbH = XMLXPath.getSingleValueByPath(document,WaybillSecond); | ||
135 | + String resCode = XMLXPath.getSingleValueByPath(document,ResponseCode); | ||
136 | + String resText = XMLXPath.getSingleValueByPath(document,ResponseText); | ||
137 | + String messageId = XMLXPath.getSingleValueByPath(document, MessageID); | ||
138 | + String sendTime = XMLXPath.getSingleValueByPath(document,SendTime); | ||
139 | + String sendId = XMLXPath.getSingleValueByPath(document,SenderID); | ||
140 | + String reciveId = XMLXPath.getSingleValueByPath(document,ReceiverID); | ||
141 | + String version = XMLXPath.getSingleValueByPath(document,Version); | ||
142 | + String functionCode = XMLXPath.getSingleValueByPath(document,FunctionCode); | ||
143 | + | ||
144 | + | ||
145 | + | ||
146 | + CustomReception customReception = new CustomReception( msgType, | ||
147 | + flightNo, | ||
148 | + flightDate, | ||
149 | + awbA, | ||
150 | + awbH, | ||
151 | + resCode, | ||
152 | + resText, | ||
153 | + messageId, | ||
154 | + sendTime, | ||
155 | + sendId, | ||
156 | + reciveId, | ||
157 | + version, | ||
158 | + functionCode); | ||
159 | + | ||
160 | + /** | ||
161 | + * 如果回执中没有携带航班信息节点,说明是出错报文 | ||
162 | + * 到发送日志表根据messageid 找到相应的发送日志报文的航班及运单信息,再进行解析 | ||
163 | + */ | ||
164 | + if(!StringUtils.isEmpty(journeyid)){ | ||
165 | + | ||
166 | + String[] flightList = journeyid.split("/"); | ||
167 | + if(flightList.length > 0){ | ||
168 | + flightNo = flightList[0]; | ||
169 | + flightDate = flightList[1]; | ||
170 | + customReception.setFlightNo(flightNo); | ||
171 | + customReception.setFlightDate(flightDate); | ||
172 | + } | ||
173 | + }else { | ||
174 | + CUSTOMSMESSAGE customsmessage = new CUSTOMSMESSAGE(); | ||
175 | + customReception = customsmessage.getWaybillInfoByCutomResponse(customReception); | ||
176 | + } | ||
177 | + | ||
178 | + switch (msgType){ | ||
179 | + case "MT9999": | ||
180 | + if (customReception.getWayBillSecond()!=null && customReception.getWayBillSecond().contains(secondSplit)){ | ||
181 | + PREPARESECONDARY preparesecondary = new PREPARESECONDARY(customReception); | ||
182 | + int pre_i = preparesecondary.secondAnalysisReception(); | ||
183 | + | ||
184 | + if (pre_i>0){ | ||
185 | + i=1; | ||
186 | + }else { | ||
187 | + Originmanifestsecondary originmanifestsecondary = new Originmanifestsecondary(customReception); | ||
188 | + int org_i=originmanifestsecondary.secondAnalysisReception(); | ||
189 | + if (org_i>0){ | ||
190 | + i= 1; | ||
191 | + }else { | ||
192 | + ARRIVEDSECONDARY arrivedsecondary = new ARRIVEDSECONDARY(customReception); | ||
193 | + int arr_i=arrivedsecondary.secondAnalysisReception(); | ||
194 | + if (arr_i>0){ | ||
195 | + i=1; | ||
196 | + } | ||
197 | + } | ||
198 | + } | ||
199 | + }else{ | ||
200 | + ORIGINMANIFESTMASTER originmanifestmaster = new ORIGINMANIFESTMASTER(customReception); | ||
201 | + PREPAREMASTER preparemaster= new PREPAREMASTER(customReception); | ||
202 | + ARRIVEDMASTER arrivedmaster9999 = new ARRIVEDMASTER(customReception); | ||
203 | + if(originmanifestmaster.masterAnalysisReception()>0){ | ||
204 | + i=1; | ||
205 | + }else if(preparemaster.masterAnalysisReception()>0){ | ||
206 | + i=1; | ||
207 | + }else { | ||
208 | + i=arrivedmaster9999.masterAnalysisReception(); | ||
209 | + } | ||
210 | + } | ||
211 | + AgentXmlHandle agentXmlHandle=new AgentXmlHandle(); | ||
212 | + agentXmlHandle.Http_resolver(customReception); | ||
213 | + break; | ||
214 | + case "MT3201": | ||
215 | + if (customReception.getWayBillSecond()!=null && customReception.getWayBillSecond().contains(secondSplit)){ | ||
216 | + ARRIVEDSECONDARY arrivedsecondary = new ARRIVEDSECONDARY(customReception); | ||
217 | + i=arrivedsecondary.secondAnalysisReception(); | ||
218 | + }else { | ||
219 | + ARRIVEDMASTER arrivedmaster = new ARRIVEDMASTER(customReception); | ||
220 | + i=arrivedmaster.masterAnalysisReception(); | ||
221 | + } | ||
222 | + break; | ||
223 | + case "MT5202": | ||
224 | + case "MT5201": | ||
225 | + if (customReception.getWayBillSecond()!=null && customReception.getWayBillSecond().contains(secondSplit)){ | ||
226 | + TALLYSECONDARY tallysecondary = new TALLYSECONDARY(customReception); | ||
227 | + i=tallysecondary.secondAnalysisReception(); | ||
228 | + }else { | ||
229 | + TALLYMASTER tallymaster= new TALLYMASTER(customReception); | ||
230 | + i = tallymaster.masterAnalysisReception(); | ||
231 | + } | ||
232 | + break; | ||
233 | + case "MT4201": | ||
234 | + DEPARTURESLOADING departuresloading = new DEPARTURESLOADING(customReception); | ||
235 | + i=departuresloading.masterAnalysisReception(); | ||
236 | + break; | ||
237 | + case "MT1201": | ||
238 | + if (customReception.getWayBillSecond()!=null && customReception.getWayBillSecond().contains(secondSplit)){ | ||
239 | + Originmanifestsecondary originmanifestsecondary = new Originmanifestsecondary(customReception); | ||
240 | + i=originmanifestsecondary.secondAnalysisReception(); | ||
241 | + }else { | ||
242 | + ORIGINMANIFESTMASTER originmanifestmaster1201 = new ORIGINMANIFESTMASTER(customReception); | ||
243 | + i = originmanifestmaster1201.masterAnalysisReception(); | ||
244 | + } | ||
245 | + break; | ||
246 | + case "MT2201": | ||
247 | + if (customReception.getWayBillSecond()!=null && customReception.getWayBillSecond().contains(secondSplit)){ | ||
248 | + PREPARESECONDARY preparesecondary = new PREPARESECONDARY(customReception); | ||
249 | + i = preparesecondary.secondAnalysisReception(); | ||
250 | + }else { | ||
251 | + PREPAREMASTER preparemaster1201= new PREPAREMASTER(customReception); | ||
252 | + i = preparemaster1201.masterAnalysisReception(); | ||
253 | + } | ||
254 | + break; | ||
255 | + case "MT6202": | ||
256 | + INPORTALLOCATE inportallocate = new INPORTALLOCATE(customReception); | ||
257 | + i = inportallocate.masterAnalysisReception(); | ||
258 | + break; | ||
259 | + case "MT3202": | ||
260 | + ALLOCATEARRIVAL allocatearrival = new ALLOCATEARRIVAL(customReception); | ||
261 | + i= allocatearrival.masterAnalysisReception(); | ||
262 | + break; | ||
263 | + case "MT8205": | ||
264 | + i = transXmlHandel(document,customReception); | ||
265 | + break; | ||
266 | + case "MT8202": | ||
267 | + MANIFESTLOAD manifestload = new MANIFESTLOAD(customReception); | ||
268 | + i= manifestload.secondAnalysisReception(); | ||
269 | + break; | ||
270 | + case "MT8203": | ||
271 | + MANIFESTLOSTCHANGE manifestlostchange = new MANIFESTLOSTCHANGE(customReception); | ||
272 | + i= manifestlostchange.secondAnalysisReception(); | ||
273 | + break; | ||
274 | + default: | ||
275 | + break; | ||
276 | + | ||
277 | + } | ||
278 | + | ||
279 | + updateCustomMessage(customReception); | ||
280 | + return i; | ||
281 | + | ||
282 | + } | ||
283 | + | ||
284 | + | ||
285 | + /** | ||
286 | + * 国际转运回执处理,特殊业务 | ||
287 | + * @param document | ||
288 | + * @param customReception | ||
289 | + * @return | ||
290 | + */ | ||
291 | + private int transXmlHandel(Document document,CustomReception customReception){ | ||
292 | + | ||
293 | + String importJourneyID = XMLXPath.getSingleValueByPath(document,ImportJourneyID); | ||
294 | + String importFlightNo = "UNKONW"; | ||
295 | + String importFlightDate = "20101010"; | ||
296 | + if(!StringUtils.isEmpty(importJourneyID)){ | ||
297 | + importFlightNo = AWBTools.splitFlightAndDate(importJourneyID)[0]; | ||
298 | + importFlightDate = AWBTools.splitFlightAndDate(importJourneyID)[1]; | ||
299 | + } | ||
300 | + | ||
301 | + | ||
302 | + String importWaybillMaster= XMLXPath.getSingleValueByPath(document,ImportWaybillMaster); | ||
303 | + String importWaybillSecond= XMLXPath.getSingleValueByPath(document,ImportWaybillSecond); | ||
304 | + String transResponseCode=XMLXPath.getSingleValueByPath(document,TransResponseCode); | ||
305 | + String transResponseText=XMLXPath.getSingleValueByPath(document,TransResponseText); | ||
306 | + CustomReception transCustomReception = new CustomReception( customReception.getMessageType(), | ||
307 | + importFlightNo, | ||
308 | + importFlightDate, | ||
309 | + importWaybillMaster, | ||
310 | + importWaybillSecond, | ||
311 | + transResponseCode, | ||
312 | + transResponseText, | ||
313 | + customReception.getMessageID(), | ||
314 | + customReception.getSendTime(), | ||
315 | + customReception.getSenderID(), | ||
316 | + customReception.getReceiverID(), | ||
317 | + customReception.getVersion(), | ||
318 | + customReception.getFunctionCode()); | ||
319 | + INTERNATIONALTRANSIT internationaltransit = new INTERNATIONALTRANSIT(transCustomReception); | ||
320 | + | ||
321 | + int i=internationaltransit.masterAnalysisReception(); | ||
322 | + | ||
323 | + return i; | ||
324 | + | ||
325 | + } | ||
326 | + | ||
327 | + public int updateCustomMessage(CustomReception customReception){ | ||
328 | + CUSTOMSMESSAGE customsmessage = new CUSTOMSMESSAGE(customReception); | ||
329 | + return customsmessage.updateMessageByMessageid(); | ||
330 | + } | ||
331 | + | ||
332 | + @Override | ||
333 | + public void bakXml(String responseText, String dir){ | ||
334 | + try { | ||
335 | + | ||
336 | + File errfile = new File(dir + "/" + UUID.randomUUID().toString()+".xml"); | ||
337 | + FileUtils.writeStringToFile(errfile,responseText,"UTF-8"); | ||
338 | + }catch (FileExistsException e){ | ||
339 | + e.printStackTrace(); | ||
340 | + log.error("文件重名,备份失败"); | ||
341 | + }catch (Exception e){ | ||
342 | + e.printStackTrace(); | ||
343 | + } | ||
344 | + } | ||
345 | +} |
@@ -5,9 +5,9 @@ import com.tianbo.analysis.model.SENDLOG; | @@ -5,9 +5,9 @@ import com.tianbo.analysis.model.SENDLOG; | ||
5 | import com.tianbo.analysis.service.SendLogService; | 5 | import com.tianbo.analysis.service.SendLogService; |
6 | import com.tianbo.util.Helper; | 6 | import com.tianbo.util.Helper; |
7 | import lombok.extern.slf4j.Slf4j; | 7 | import lombok.extern.slf4j.Slf4j; |
8 | -import org.springframework.beans.factory.annotation.Autowired; | ||
9 | import org.springframework.stereotype.Service; | 8 | import org.springframework.stereotype.Service; |
10 | 9 | ||
10 | +import javax.annotation.Resource; | ||
11 | import java.math.BigDecimal; | 11 | import java.math.BigDecimal; |
12 | import java.util.Date; | 12 | import java.util.Date; |
13 | 13 | ||
@@ -15,7 +15,7 @@ import java.util.Date; | @@ -15,7 +15,7 @@ import java.util.Date; | ||
15 | @Slf4j | 15 | @Slf4j |
16 | public class SendLogServiceImp implements SendLogService{ | 16 | public class SendLogServiceImp implements SendLogService{ |
17 | 17 | ||
18 | - @Autowired | 18 | + @Resource |
19 | private SENDLOGMapper sendlogMapper; | 19 | private SENDLOGMapper sendlogMapper; |
20 | 20 | ||
21 | @Override | 21 | @Override |
@@ -30,14 +30,14 @@ | @@ -30,14 +30,14 @@ | ||
30 | <result column="CREATEDATE" property="createdate" jdbcType="TIMESTAMP" /> | 30 | <result column="CREATEDATE" property="createdate" jdbcType="TIMESTAMP" /> |
31 | </resultMap> | 31 | </resultMap> |
32 | <sql id="Base_Column_List" > | 32 | <sql id="Base_Column_List" > |
33 | - AUTOID, WAYBILLNOMASTER, TCD_NAME, TCD_TYPECODE, FLIGHTNO, FLIGHTDATE, CARRIER, ORIGINATINGSTATION, | ||
34 | - O_NAME, DESTINATIONSTATION, FD_NAME, ARRIVEDTOTALPIECE, TOTALPIECEQUANTITY, ARRIVEDTOTALWEIGHT, | ||
35 | - GROSSWEIGHTMEASUREUC, TOTALGROSSWEIGHTMEASURE, TOTALGROSSWEIGHTMEASUREUC, CHARGEABLEWEIGHTMEASURE, | ||
36 | - CHARGEABLEWEIGHTMEASUREUC, ARRIVEDDATE, TRANSPORTSPLITDESCRIPTION, CUSTOMSCODE, PRODUCTNAME, | 33 | + AUTOID, WAYBILLNOMASTER, TCD_NAME, TCD_TYPECODE, FLIGHTNO, FLIGHTDATE, CARRIER, ORIGINATINGSTATION, |
34 | + O_NAME, DESTINATIONSTATION, FD_NAME, ARRIVEDTOTALPIECE, TOTALPIECEQUANTITY, ARRIVEDTOTALWEIGHT, | ||
35 | + GROSSWEIGHTMEASUREUC, TOTALGROSSWEIGHTMEASURE, TOTALGROSSWEIGHTMEASUREUC, CHARGEABLEWEIGHTMEASURE, | ||
36 | + CHARGEABLEWEIGHTMEASUREUC, ARRIVEDDATE, TRANSPORTSPLITDESCRIPTION, CUSTOMSCODE, PRODUCTNAME, | ||
37 | STATUS, RECEIPTINFORMATION, CREATEDATE | 37 | STATUS, RECEIPTINFORMATION, CREATEDATE |
38 | </sql> | 38 | </sql> |
39 | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" > | 39 | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" > |
40 | - select | 40 | + select |
41 | <include refid="Base_Column_List" /> | 41 | <include refid="Base_Column_List" /> |
42 | from ARRIVEDMASTER | 42 | from ARRIVEDMASTER |
43 | where AUTOID = #{autoid,jdbcType=VARCHAR} | 43 | where AUTOID = #{autoid,jdbcType=VARCHAR} |
@@ -47,27 +47,27 @@ | @@ -47,27 +47,27 @@ | ||
47 | where AUTOID = #{autoid,jdbcType=VARCHAR} | 47 | where AUTOID = #{autoid,jdbcType=VARCHAR} |
48 | </delete> | 48 | </delete> |
49 | <insert id="insert" parameterType="com.tianbo.analysis.model.ARRIVEDMASTER" > | 49 | <insert id="insert" parameterType="com.tianbo.analysis.model.ARRIVEDMASTER" > |
50 | - insert into ARRIVEDMASTER (AUTOID, WAYBILLNOMASTER, TCD_NAME, | ||
51 | - TCD_TYPECODE, FLIGHTNO, FLIGHTDATE, | ||
52 | - CARRIER, ORIGINATINGSTATION, O_NAME, | ||
53 | - DESTINATIONSTATION, FD_NAME, ARRIVEDTOTALPIECE, | ||
54 | - TOTALPIECEQUANTITY, ARRIVEDTOTALWEIGHT, | ||
55 | - GROSSWEIGHTMEASUREUC, TOTALGROSSWEIGHTMEASURE, | ||
56 | - TOTALGROSSWEIGHTMEASUREUC, CHARGEABLEWEIGHTMEASURE, | ||
57 | - CHARGEABLEWEIGHTMEASUREUC, ARRIVEDDATE, | ||
58 | - TRANSPORTSPLITDESCRIPTION, CUSTOMSCODE, | ||
59 | - PRODUCTNAME, STATUS, RECEIPTINFORMATION, | 50 | + insert into ARRIVEDMASTER (AUTOID, WAYBILLNOMASTER, TCD_NAME, |
51 | + TCD_TYPECODE, FLIGHTNO, FLIGHTDATE, | ||
52 | + CARRIER, ORIGINATINGSTATION, O_NAME, | ||
53 | + DESTINATIONSTATION, FD_NAME, ARRIVEDTOTALPIECE, | ||
54 | + TOTALPIECEQUANTITY, ARRIVEDTOTALWEIGHT, | ||
55 | + GROSSWEIGHTMEASUREUC, TOTALGROSSWEIGHTMEASURE, | ||
56 | + TOTALGROSSWEIGHTMEASUREUC, CHARGEABLEWEIGHTMEASURE, | ||
57 | + CHARGEABLEWEIGHTMEASUREUC, ARRIVEDDATE, | ||
58 | + TRANSPORTSPLITDESCRIPTION, CUSTOMSCODE, | ||
59 | + PRODUCTNAME, STATUS, RECEIPTINFORMATION, | ||
60 | CREATEDATE) | 60 | CREATEDATE) |
61 | - values (#{autoid,jdbcType=VARCHAR}, #{waybillnomaster,jdbcType=VARCHAR}, #{tcdName,jdbcType=VARCHAR}, | ||
62 | - #{tcdTypecode,jdbcType=VARCHAR}, #{flightno,jdbcType=VARCHAR}, #{flightdate,jdbcType=TIMESTAMP}, | ||
63 | - #{carrier,jdbcType=VARCHAR}, #{originatingstation,jdbcType=VARCHAR}, #{oName,jdbcType=VARCHAR}, | ||
64 | - #{destinationstation,jdbcType=VARCHAR}, #{fdName,jdbcType=VARCHAR}, #{arrivedtotalpiece,jdbcType=VARCHAR}, | ||
65 | - #{totalpiecequantity,jdbcType=VARCHAR}, #{arrivedtotalweight,jdbcType=VARCHAR}, | ||
66 | - #{grossweightmeasureuc,jdbcType=VARCHAR}, #{totalgrossweightmeasure,jdbcType=VARCHAR}, | ||
67 | - #{totalgrossweightmeasureuc,jdbcType=VARCHAR}, #{chargeableweightmeasure,jdbcType=VARCHAR}, | ||
68 | - #{chargeableweightmeasureuc,jdbcType=VARCHAR}, #{arriveddate,jdbcType=TIMESTAMP}, | ||
69 | - #{transportsplitdescription,jdbcType=VARCHAR}, #{customscode,jdbcType=VARCHAR}, | ||
70 | - #{productname,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{receiptinformation,jdbcType=VARCHAR}, | 61 | + values (#{autoid,jdbcType=VARCHAR}, #{waybillnomaster,jdbcType=VARCHAR}, #{tcdName,jdbcType=VARCHAR}, |
62 | + #{tcdTypecode,jdbcType=VARCHAR}, #{flightno,jdbcType=VARCHAR}, #{flightdate,jdbcType=TIMESTAMP}, | ||
63 | + #{carrier,jdbcType=VARCHAR}, #{originatingstation,jdbcType=VARCHAR}, #{oName,jdbcType=VARCHAR}, | ||
64 | + #{destinationstation,jdbcType=VARCHAR}, #{fdName,jdbcType=VARCHAR}, #{arrivedtotalpiece,jdbcType=VARCHAR}, | ||
65 | + #{totalpiecequantity,jdbcType=VARCHAR}, #{arrivedtotalweight,jdbcType=VARCHAR}, | ||
66 | + #{grossweightmeasureuc,jdbcType=VARCHAR}, #{totalgrossweightmeasure,jdbcType=VARCHAR}, | ||
67 | + #{totalgrossweightmeasureuc,jdbcType=VARCHAR}, #{chargeableweightmeasure,jdbcType=VARCHAR}, | ||
68 | + #{chargeableweightmeasureuc,jdbcType=VARCHAR}, #{arriveddate,jdbcType=TIMESTAMP}, | ||
69 | + #{transportsplitdescription,jdbcType=VARCHAR}, #{customscode,jdbcType=VARCHAR}, | ||
70 | + #{productname,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{receiptinformation,jdbcType=VARCHAR}, | ||
71 | #{createdate,jdbcType=TIMESTAMP}) | 71 | #{createdate,jdbcType=TIMESTAMP}) |
72 | </insert> | 72 | </insert> |
73 | <insert id="insertSelective" parameterType="com.tianbo.analysis.model.ARRIVEDMASTER" > | 73 | <insert id="insertSelective" parameterType="com.tianbo.analysis.model.ARRIVEDMASTER" > |
@@ -352,25 +352,26 @@ | @@ -352,25 +352,26 @@ | ||
352 | RECEIPTINFORMATION= #{receiptinformation,jdbcType=VARCHAR}, | 352 | RECEIPTINFORMATION= #{receiptinformation,jdbcType=VARCHAR}, |
353 | STATUS = #{status,jdbcType=VARCHAR} | 353 | STATUS = #{status,jdbcType=VARCHAR} |
354 | WHERE | 354 | WHERE |
355 | + WAYBILLNOMASTER = #{waybillnomaster,jdbcType=VARCHAR} | ||
356 | + AND | ||
355 | FLIGHTNO = #{flightno,jdbcType=VARCHAR} | 357 | FLIGHTNO = #{flightno,jdbcType=VARCHAR} |
356 | AND | 358 | AND |
357 | CARRIER = #{carrier,jdbcType=VARCHAR} | 359 | CARRIER = #{carrier,jdbcType=VARCHAR} |
358 | AND | 360 | AND |
359 | trunc(FLIGHTDATE)= #{flightDate,jdbcType=DATE} | 361 | trunc(FLIGHTDATE)= #{flightDate,jdbcType=DATE} |
360 | - AND | ||
361 | - WAYBILLNOMASTER = #{waybillnomaster,jdbcType=VARCHAR} | 362 | + |
362 | </update> | 363 | </update> |
363 | 364 | ||
364 | <select id="selectAutoIdByAwb" parameterType="com.tianbo.analysis.model.ARRIVEDMASTER" resultType="com.tianbo.analysis.model.ARRIVEDMASTER"> | 365 | <select id="selectAutoIdByAwb" parameterType="com.tianbo.analysis.model.ARRIVEDMASTER" resultType="com.tianbo.analysis.model.ARRIVEDMASTER"> |
365 | SELECT AUTOID | 366 | SELECT AUTOID |
366 | FROM ARRIVEDMASTER | 367 | FROM ARRIVEDMASTER |
367 | WHERE | 368 | WHERE |
368 | - FLIGHTNO= #{flightno,jdbcType=VARCHAR} | ||
369 | - AND | ||
370 | - trunc(FLIGHTDATE)= #{flightDate,jdbcType=DATE} | ||
371 | - AND | ||
372 | WAYBILLNOMASTER = #{waybillnomaster,jdbcType=VARCHAR} | 369 | WAYBILLNOMASTER = #{waybillnomaster,jdbcType=VARCHAR} |
373 | AND | 370 | AND |
371 | + FLIGHTNO= #{flightno,jdbcType=VARCHAR} | ||
372 | + AND | ||
374 | CARRIER = #{carrier,jdbcType=VARCHAR} | 373 | CARRIER = #{carrier,jdbcType=VARCHAR} |
374 | + AND | ||
375 | + trunc(FLIGHTDATE)= #{flightDate,jdbcType=DATE} | ||
375 | </select> | 376 | </select> |
376 | -</mapper> | ||
377 | +</mapper> |
@@ -24,20 +24,20 @@ | @@ -24,20 +24,20 @@ | ||
24 | <result column="DESTINATIONSTATION_BILL" property="destinationstationBill" jdbcType="VARCHAR" /> | 24 | <result column="DESTINATIONSTATION_BILL" property="destinationstationBill" jdbcType="VARCHAR" /> |
25 | </resultMap> | 25 | </resultMap> |
26 | <insert id="insert" parameterType="com.tianbo.analysis.model.INTERNATIONALTRANSIT" > | 26 | <insert id="insert" parameterType="com.tianbo.analysis.model.INTERNATIONALTRANSIT" > |
27 | - insert into INTERNATIONALTRANSIT (AUTOID, CREATEDATE, ORIGINAL_CARRIER, | ||
28 | - ORIGINAL_FLIGHTNO, ORIGINAL_FLIGHTDATE, | ||
29 | - ORIGINAL_BILLNO, ORIGINAL_SUB_NUMBER, PRE_CARRIER, | ||
30 | - PRE_FLIGHTNO, PRE_FLIGHTDATE, PRE_BILLNO, | ||
31 | - PRE_SUB_NUMBER, BILLPIECE, BILLWEIGHT, | ||
32 | - PRODUCT, ORIGINATINGSTATION, PACKAGINGTYPE, | 27 | + insert into INTERNATIONALTRANSIT (AUTOID, CREATEDATE, ORIGINAL_CARRIER, |
28 | + ORIGINAL_FLIGHTNO, ORIGINAL_FLIGHTDATE, | ||
29 | + ORIGINAL_BILLNO, ORIGINAL_SUB_NUMBER, PRE_CARRIER, | ||
30 | + PRE_FLIGHTNO, PRE_FLIGHTDATE, PRE_BILLNO, | ||
31 | + PRE_SUB_NUMBER, BILLPIECE, BILLWEIGHT, | ||
32 | + PRODUCT, ORIGINATINGSTATION, PACKAGINGTYPE, | ||
33 | STATUS, RECEIPTION, DESTINATIONSTATION_BILL | 33 | STATUS, RECEIPTION, DESTINATIONSTATION_BILL |
34 | ) | 34 | ) |
35 | - values (#{autoid,jdbcType=VARCHAR}, #{createdate,jdbcType=TIMESTAMP}, #{originalCarrier,jdbcType=VARCHAR}, | ||
36 | - #{originalFlightno,jdbcType=VARCHAR}, #{originalFlightdate,jdbcType=TIMESTAMP}, | ||
37 | - #{originalBillno,jdbcType=VARCHAR}, #{originalSubNumber,jdbcType=VARCHAR}, #{preCarrier,jdbcType=VARCHAR}, | ||
38 | - #{preFlightno,jdbcType=VARCHAR}, #{preFlightdate,jdbcType=TIMESTAMP}, #{preBillno,jdbcType=VARCHAR}, | ||
39 | - #{preSubNumber,jdbcType=VARCHAR}, #{billpiece,jdbcType=VARCHAR}, #{billweight,jdbcType=VARCHAR}, | ||
40 | - #{product,jdbcType=VARCHAR}, #{originatingstation,jdbcType=VARCHAR}, #{packagingtype,jdbcType=VARCHAR}, | 35 | + values (#{autoid,jdbcType=VARCHAR}, #{createdate,jdbcType=TIMESTAMP}, #{originalCarrier,jdbcType=VARCHAR}, |
36 | + #{originalFlightno,jdbcType=VARCHAR}, #{originalFlightdate,jdbcType=TIMESTAMP}, | ||
37 | + #{originalBillno,jdbcType=VARCHAR}, #{originalSubNumber,jdbcType=VARCHAR}, #{preCarrier,jdbcType=VARCHAR}, | ||
38 | + #{preFlightno,jdbcType=VARCHAR}, #{preFlightdate,jdbcType=TIMESTAMP}, #{preBillno,jdbcType=VARCHAR}, | ||
39 | + #{preSubNumber,jdbcType=VARCHAR}, #{billpiece,jdbcType=VARCHAR}, #{billweight,jdbcType=VARCHAR}, | ||
40 | + #{product,jdbcType=VARCHAR}, #{originatingstation,jdbcType=VARCHAR}, #{packagingtype,jdbcType=VARCHAR}, | ||
41 | #{status,jdbcType=VARCHAR}, #{receiption,jdbcType=VARCHAR}, #{destinationstationBill,jdbcType=VARCHAR} | 41 | #{status,jdbcType=VARCHAR}, #{receiption,jdbcType=VARCHAR}, #{destinationstationBill,jdbcType=VARCHAR} |
42 | ) | 42 | ) |
43 | </insert> | 43 | </insert> |
@@ -182,6 +182,10 @@ | @@ -182,6 +182,10 @@ | ||
182 | trunc(ORIGINAL_FLIGHTDATE)= #{originalFlightdate,jdbcType=DATE} | 182 | trunc(ORIGINAL_FLIGHTDATE)= #{originalFlightdate,jdbcType=DATE} |
183 | AND | 183 | AND |
184 | ORIGINAL_BILLNO = #{originalBillno,jdbcType=VARCHAR} | 184 | ORIGINAL_BILLNO = #{originalBillno,jdbcType=VARCHAR} |
185 | + <if test="originalSubNumber != null and originalSubNumber != ''" > | ||
186 | + AND | ||
187 | + ORIGINAL_SUB_NUMBER = #{originalSubNumber,jdbcType=VARCHAR} | ||
188 | + </if> | ||
185 | </update> | 189 | </update> |
186 | 190 | ||
187 | <select id="selectAutoIdByAwb" parameterType="com.tianbo.analysis.model.INTERNATIONALTRANSIT" resultType="com.tianbo.analysis.model.INTERNATIONALTRANSIT"> | 191 | <select id="selectAutoIdByAwb" parameterType="com.tianbo.analysis.model.INTERNATIONALTRANSIT" resultType="com.tianbo.analysis.model.INTERNATIONALTRANSIT"> |
@@ -195,6 +199,10 @@ | @@ -195,6 +199,10 @@ | ||
195 | trunc(ORIGINAL_FLIGHTDATE)= #{originalFlightdate,jdbcType=DATE} | 199 | trunc(ORIGINAL_FLIGHTDATE)= #{originalFlightdate,jdbcType=DATE} |
196 | AND | 200 | AND |
197 | ORIGINAL_BILLNO = #{originalBillno,jdbcType=VARCHAR} | 201 | ORIGINAL_BILLNO = #{originalBillno,jdbcType=VARCHAR} |
202 | + <if test="originalSubNumber != null and originalSubNumber != ''" > | ||
203 | + AND | ||
204 | + ORIGINAL_SUB_NUMBER = #{originalSubNumber,jdbcType=VARCHAR} | ||
205 | + </if> | ||
198 | </select> | 206 | </select> |
199 | 207 | ||
200 | -</mapper> | ||
208 | +</mapper> |
-
请 注册 或 登录 后发表评论