Jiaqi.xu

Merge remote-tracking branch 'origin/master'

...@@ -23,6 +23,12 @@ ...@@ -23,6 +23,12 @@
23 <groupId>org.springframework.boot</groupId> 23 <groupId>org.springframework.boot</groupId>
24 <artifactId>spring-boot-starter-test</artifactId> 24 <artifactId>spring-boot-starter-test</artifactId>
25 <scope>test</scope> 25 <scope>test</scope>
26 + <exclusions>
27 + <exclusion>
28 + <groupId>org.yaml</groupId>
29 + <artifactId>snakeyaml</artifactId>
30 + </exclusion>
31 + </exclusions>
26 </dependency> 32 </dependency>
27 <dependency> 33 <dependency>
28 <groupId>org.springframework.boot</groupId> 34 <groupId>org.springframework.boot</groupId>
...@@ -179,8 +185,8 @@ ...@@ -179,8 +185,8 @@
179 <directory>src/main/resources</directory> 185 <directory>src/main/resources</directory>
180 <filtering>true</filtering> 186 <filtering>true</filtering>
181 <includes> 187 <includes>
182 - <include>application.yml</include> 188 + <include>application.properties</include>
183 - <include>application-${activatedProperties}.yml</include> 189 + <include>application-${activatedProperties}.properties</include>
184 </includes> 190 </includes>
185 </resource> 191 </resource>
186 <resource> 192 <resource>
......
...@@ -48,6 +48,7 @@ public class HsCodeInterface { ...@@ -48,6 +48,7 @@ public class HsCodeInterface {
48 resultHsCode = hsCodeService.findHsCodeListByCode(hscode.getHscode()); 48 resultHsCode = hsCodeService.findHsCodeListByCode(hscode.getHscode());
49 return resultHsCode; 49 return resultHsCode;
50 } else { 50 } else {
51 +
51 //如果没有传hscode需要限制10分钟只能查询一次 52 //如果没有传hscode需要限制10分钟只能查询一次
52 boolean rs = iClearApiHsCodeLogService.findIClearApiHsCodeLog(); 53 boolean rs = iClearApiHsCodeLogService.findIClearApiHsCodeLog();
53 if(rs == true){ 54 if(rs == true){
......
1 +package com.erry.iclear.dateInterface.api;
2 +
3 +import com.erry.iclear.dateInterface.api.request.HsCodeParam;
4 +import com.erry.iclear.dateInterface.api.response.ResultHsCode;
5 +import com.erry.iclear.dateInterface.entity.IClearApiHsCodeLog;
6 +import com.erry.iclear.dateInterface.service.HsCodeService;
7 +import com.erry.iclear.dateInterface.service.IClearApiHsCodeLogService;
8 +import com.erry.iclear.dateInterface.util.StringUtil;
9 +import io.swagger.annotations.ApiOperation;
10 +import lombok.extern.slf4j.Slf4j;
11 +import org.springframework.beans.factory.annotation.Autowired;
12 +import org.springframework.web.bind.annotation.*;
13 +
14 +import javax.servlet.http.HttpServletRequest;
15 +import java.util.Date;
16 +
17 +/**
18 + * @author Administrator
19 + * /hscode/hscodeRequest
20 + */
21 +@RestController
22 +@RequestMapping("/version")
23 +@Slf4j
24 +public class VersionInterface {
25 + //当前版本号
26 + final String VERSION = "1.4";
27 +
28 + @ApiOperation(value = "获取当前API版本", httpMethod = "GET", notes = "ex: http://192.168.1.71:8080/version/version")
29 + @GetMapping("/version")
30 + @ResponseBody
31 + public String version(HttpServletRequest request) {
32 + String msg = "当前API版本号为:" + this.VERSION;
33 + return msg;
34 + }
35 +}
...@@ -114,7 +114,7 @@ public class ApiService { ...@@ -114,7 +114,7 @@ public class ApiService {
114 public void refreshToken(String token) throws Exception{ 114 public void refreshToken(String token) throws Exception{
115 Map<String,String> map = new HashMap<String,String>(); 115 Map<String,String> map = new HashMap<String,String>();
116 map.put("token", token); 116 map.put("token", token);
117 - HttpUtils.doPost(this.refreshTokenUrl,map); 117 + HttpUtils.doProxyPost(this.refreshTokenUrl,map,this.proxyUrl,this.proxyPort);
118 } 118 }
119 119
120 /** 120 /**
...@@ -156,6 +156,7 @@ public class ApiService { ...@@ -156,6 +156,7 @@ public class ApiService {
156 //推送海关回执数据 156 //推送海关回执数据
157 // String json = HttpUtils.doPost(this.customsUrl,objJson,headerMap); 157 // String json = HttpUtils.doPost(this.customsUrl,objJson,headerMap);
158 String json = HttpUtils.doProxyPost(this.customsUrl,objJson,headerMap,this.proxyUrl,this.proxyPort); 158 String json = HttpUtils.doProxyPost(this.customsUrl,objJson,headerMap,this.proxyUrl,this.proxyPort);
159 + log.info("sendCustoms:"+json);
159 //接口响应时间 160 //接口响应时间
160 declearTask.setResponseTime(new Date()); 161 declearTask.setResponseTime(new Date());
161 TokenResult tokenResult = JsonToJava.parseJson(json,TokenResult.class); 162 TokenResult tokenResult = JsonToJava.parseJson(json,TokenResult.class);
......
...@@ -55,11 +55,10 @@ public class IClearApiTask { ...@@ -55,11 +55,10 @@ public class IClearApiTask {
55 } 55 }
56 } 56 }
57 /** 57 /**
58 - * 获取token 58 + * 每次请求获取最新token
59 * @throws Exception 59 * @throws Exception
60 */ 60 */
61 private void getToken() throws Exception{ 61 private void getToken() throws Exception{
62 - if(token == null){
63 try { 62 try {
64 //获取token 63 //获取token
65 TokenResult tokenResult = apiService.getToken(); 64 TokenResult tokenResult = apiService.getToken();
...@@ -69,7 +68,6 @@ public class IClearApiTask { ...@@ -69,7 +68,6 @@ public class IClearApiTask {
69 }catch(Exception ex){ 68 }catch(Exception ex){
70 log.error(ex.getMessage(),ex); 69 log.error(ex.getMessage(),ex);
71 } 70 }
72 - }
73 if(this.token == null){ 71 if(this.token == null){
74 throw new Exception("获取token失败!"); 72 throw new Exception("获取token失败!");
75 } 73 }
......
1 +spring.servlet.context-path=/API
2 +
3 +spring.datasource.url=jdbc:sqlserver://192.168.1.250:1433;DatabaseName=IClearDev
4 +spring.datasource.username=iclear
5 +spring.datasource.password=root1234
6 +spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
7 +spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
8 +#spring.datasource.jndi-name=jdbc/iclearProdTestDS
9 +
10 +#推送海关回执
11 +task.pushCustomsTask=0 0/1 * 1 * ?
12 +#推送完整报文
13 +task.pushMawbTask=0 0/1 * 1 * ?
14 +#推送失败的回执数据
15 +task.pushErrorReturnDate=0 0/3 * 1 * ?
16 +#推送失败的申报数据
17 +task.pushErrorDeclareDate=0 0/3 * 1 * ?
18 +
19 +api.base-address=https://declarationuat.fedex.com.cn/Exp
20 +#获取token账号
21 +api.token-info.username=iclear_external_ctm
22 +#获取token密码
23 +api.token-info.password=toQu3arch6
24 +#IClearC类提交运单地址
25 +api.address.iclear-submit-url=${api.base-address}/chmConsignmentController/submitConsignments
26 +#IClear校验运单地址
27 +api.address.iclear-check-url=${api.base-address}/chmConsignmentController/checkChmAndDetaliD
28 +#IClear校验C类运单地址
29 +api.address.iclear-check-url-c=${api.base-address}/chmConsignmentController/checkChmAndDetaliC
30 +#获取token地址
31 +api.address.token-url=https://apiuat.iclrccd-fedex.com/login
32 +#刷新token地址
33 +api.address.refresh-token-url=https://apiuat.iclrccd-fedex.com/user/token/refresh
34 +#传输海关回执地址
35 +api.address.customs-url=https://apiuat.iclrccd-fedex.com/export/outbound/customs
36 +#推送完整报文地址
37 +api.address.complete-msg-url=https://apiuat.iclrccd-fedex.com/export/outbound/mawb
38 +#代理地址(刷新token、传输海关回执地址、推送完整报文地址)
39 +api.address.proxy-url=cn2-proxy.apac.fedex.com
40 +api.address.proxy-port=3128
...\ No newline at end of file ...\ No newline at end of file
1 -spring:
2 - servlet:
3 - context-path: /API
4 - datasource:
5 - # jndi-name: jdbc/iclearDS
6 -# jndi-name: jdbc/iclearProdTestDS
7 - url: jdbc:sqlserver://40.73.78.157:1433;DatabaseName=IClearUat
8 - username: sa
9 - password: Fedex_123
10 - driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
11 - type: com.alibaba.druid.pool.DruidDataSource
12 -
13 -
14 -task:
15 - #推送海关回执
16 - pushCustomsTask: 0 0/1 * 1 * ?
17 - #推送完整报文
18 - pushMawbTask: 0 0/1 * 1 * ?
19 - #推送失败的回执数据
20 - pushErrorReturnDate: 0 0/3 * 1 * ?
21 - #推送失败的申报数据
22 - pushErrorDeclareDate: 0 0/3 * 1 * ?
23 -
24 -#推送地址
25 -api:
26 - base-address: https://declarationuat.fedex.com.cn/Exp
27 - token-info:
28 - #获取token账号
29 - username: iclear_external_ctm
30 - #获取token密码
31 - password: toQu3arch6
32 - address:
33 - #IClearC类提交运单地址
34 - iclear-submit-url: ${api.base-address}/chmConsignmentController/submitConsignments
35 - #IClear校验运单地址
36 - iclear-check-url: ${api.base-address}/chmConsignmentController/checkChmAndDetaliD
37 - #IClear校验C类运单地址
38 - iclear-check-url-c: ${api.base-address}/chmConsignmentController/checkChmAndDetaliC
39 - #获取token地址
40 - token-url: https://apiuat.iclrccd-fedex.com/login
41 - # token-url: https://apictm.iclrccd-fedex.com/login
42 - #刷新token地址
43 - refresh-token-url: https://apiuat.iclrccd-fedex.com/user/token/refresh
44 - #传输海关回执地址
45 - customs-url: https://apiuat.iclrccd-fedex.com/export/outbound/customs
46 - #推送完整报文地址
47 - complete-msg-url: https://apiuat.iclrccd-fedex.com/export/outbound/mawb
48 - #代理地址(刷新token、传输海关回执地址、推送完整报文地址)
49 - # http://cn2-proxy.apac.fedex.com:3128
50 - # http://internet.proxy.fedex.com
51 - proxy-url: cn2-proxy.apac.fedex.com
52 - proxy-port: 3128
1 +spring.servlet.context-path=/API
2 +spring.datasource.jndi-name=jdbc/iclearDS
3 +#推送海关回执
4 +task.pushCustomsTask=0 0/1 * * * ?
5 +#推送完整报文
6 +task.pushMawbTask=0 0/1 * 1 * ?
7 +#推送失败的回执数据
8 +task.pushErrorReturnDate=0 0/30 * * * ?
9 +#推送失败的申报数据
10 +task.pushErrorDeclareDate=0 0/30 * * * ?
11 +
12 +api.base-address=https://declaration.fedex.com.cn/Exp
13 +#获取token账号
14 +api.token-info.username=iclear_export_prod
15 +#获取token密码
16 +api.token-info.password=1qaz@WSX
17 +#IClearC类提交运单地址
18 +api.address.iclear-submit-url=${api.base-address}/chmConsignmentController/submitConsignments
19 +#IClear校验运单地址
20 +api.address.iclear-check-url=${api.base-address}/chmConsignmentController/checkChmAndDetaliD
21 +#IClear校验C类运单地址
22 +api.address.iclear-check-url-c=${api.base-address}/chmConsignmentController/checkChmAndDetaliC
23 +#获取token地址
24 +api.address.token-url=https://apictm.iclrccd-fedex.com/login
25 +#刷新token地址
26 +api.address.refresh-token-url=https://apictm.iclrccd-fedex.com/admin/user/token/refresh
27 +#传输海关回执地址
28 +api.address.customs-url=https://apictm.iclrccd-fedex.com/export/outbound/customs
29 +#推送完整报文地址
30 +api.address.complete-msg-url=https://apictm.iclrccd-fedex.com/export/outbound/mawb
31 +#代理地址(刷新token、传输海关回执地址、推送完整报文地址)
32 +api.address.proxy-url=cn2-proxy.apac.fedex.com
33 +api.address.proxy-port=3128
...\ No newline at end of file ...\ No newline at end of file
1 -spring:
2 - servlet:
3 - context-path: /API
4 - datasource:
5 - jndi-name: jdbc/iclearDS
6 -# jndi-name: jdbc/iclearProdTestDS
7 -# url: jdbc:sqlserver://40.73.78.157:1433;DatabaseName=IClearUat
8 -# username: sa
9 -# password: Fedex_123
10 -# driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
11 -# type: com.alibaba.druid.pool.DruidDataSource
12 -
13 -
14 -task:
15 - #推送海关回执
16 - pushCustomsTask: 0 0/1 * * * ?
17 - #推送完整报文
18 - pushMawbTask: 0 0/1 * * * ?
19 - #推送失败的回执数据
20 - pushErrorReturnDate: 0 0/30 * * * ?
21 - #推送失败的申报数据
22 - pushErrorDeclareDate: 0 0/30 * * * ?
23 -
24 -#推送地址
25 -api:
26 - base-address: https://declaration.fedex.com.cn/Exp
27 - token-info:
28 - #获取token账号 非prod
29 - username: iclear_export_prod
30 - #获取token密码
31 - password: 1qaz@WSX
32 - address:
33 - #IClearC类提交运单地址
34 - iclear-submit-url: ${api.base-address}/chmConsignmentController/submitConsignments
35 - #IClear校验运单地址
36 - iclear-check-url: ${api.base-address}/chmConsignmentController/checkChmAndDetaliD
37 - #IClear校验C类运单地址
38 - iclear-check-url-c: ${api.base-address}/chmConsignmentController/checkChmAndDetaliC
39 - #获取token地址
40 - token-url: https://apictm.iclrccd-fedex.com/login
41 - #刷新token地址
42 - refresh-token-url: https://apictm.iclrccd-fedex.com/admin/user/token/refresh
43 - #传输海关回执地址
44 - customs-url: https://apictm.iclrccd-fedex.com/export/outbound/customs
45 - #推送完整报文地址
46 - complete-msg-url: https://apictm.iclrccd-fedex.com/export/outbound/mawb
47 - #代理地址(刷新token、传输海关回执地址、推送完整报文地址)
48 - # http://cn2-proxy.apac.fedex.com:3128
49 - # http://internet.proxy.fedex.com
50 - proxy-url: cn2-proxy.apac.fedex.com
51 - proxy-port: 3128
1 +spring.servlet.context-path=/API
2 +spring.datasource.jndi-name=jdbc/iclearDS
3 +#推送海关回执
4 +task.pushCustomsTask=0 0/1 * * * ?
5 +#推送完整报文
6 +task.pushMawbTask=0 0/1 * 1 * ?
7 +#推送失败的回执数据
8 +task.pushErrorReturnDate=0 0/3 * * * ?
9 +#推送失败的申报数据
10 +task.pushErrorDeclareDate=0 0/3 * * * ?
11 +
12 +api.base-address=https://declarationuat.fedex.com.cn/Exp
13 +#获取token账号
14 +api.token-info.username=iclear_external_ctm
15 +#获取token密码
16 +api.token-info.password=toQu3arch6
17 +#IClearC类提交运单地址
18 +api.address.iclear-submit-url=${api.base-address}/chmConsignmentController/submitConsignments
19 +#IClear校验运单地址
20 +api.address.iclear-check-url=${api.base-address}/chmConsignmentController/checkChmAndDetaliD
21 +#IClear校验C类运单地址
22 +api.address.iclear-check-url-c=${api.base-address}/chmConsignmentController/checkChmAndDetaliC
23 +#获取token地址
24 +api.address.token-url=https://apiuat.iclrccd-fedex.com/login
25 +#刷新token地址
26 +api.address.refresh-token-url=https://apiuat.iclrccd-fedex.com/user/token/refresh
27 +#传输海关回执地址
28 +api.address.customs-url=https://apiuat.iclrccd-fedex.com/export/outbound/customs
29 +#推送完整报文地址
30 +api.address.complete-msg-url=https://apiuat.iclrccd-fedex.com/export/outbound/mawb
31 +#代理地址(刷新token、传输海关回执地址、推送完整报文地址)
32 +api.address.proxy-url=cn2-proxy.apac.fedex.com
33 +api.address.proxy-port=3128
...\ No newline at end of file ...\ No newline at end of file
1 -spring:
2 - servlet:
3 - context-path: /API
4 - datasource:
5 - jndi-name: jdbc/iclearDS
6 -# jndi-name: jdbc/iclearProdTestDS
7 -# url: jdbc:sqlserver://40.73.78.157:1433;DatabaseName=IClearUat
8 -# username: sa
9 -# password: Fedex_123
10 -# driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
11 -# type: com.alibaba.druid.pool.DruidDataSource
12 -
13 -
14 -task:
15 - #推送海关回执
16 - pushCustomsTask: 0 0/1 * * * ?
17 - #推送完整报文
18 - pushMawbTask: 0 0/1 * * * ?
19 - #推送失败的回执数据
20 - pushErrorReturnDate: 0 0/3 * * * ?
21 - #推送失败的申报数据
22 - pushErrorDeclareDate: 0 0/3 * * * ?
23 -
24 -#推送地址
25 -api:
26 - base-address: https://declarationuat.fedex.com.cn/Exp
27 - token-info:
28 - #获取token账号
29 - username: iclear_external_ctm
30 - #获取token密码
31 - password: toQu3arch6
32 - address:
33 - #IClearC类提交运单地址
34 - iclear-submit-url: ${api.base-address}/chmConsignmentController/submitConsignments
35 - #IClear校验运单地址
36 - iclear-check-url: ${api.base-address}/chmConsignmentController/checkChmAndDetaliD
37 - #IClear校验C类运单地址
38 - iclear-check-url-c: ${api.base-address}/chmConsignmentController/checkChmAndDetaliC
39 - #获取token地址
40 - token-url: https://apiuat.iclrccd-fedex.com/login
41 -# token-url: https://apictm.iclrccd-fedex.com/login
42 - #刷新token地址
43 - refresh-token-url: https://apiuat.iclrccd-fedex.com/user/token/refresh
44 - #传输海关回执地址
45 - customs-url: https://apiuat.iclrccd-fedex.com/export/outbound/customs
46 - #推送完整报文地址
47 - complete-msg-url: https://apiuat.iclrccd-fedex.com/export/outbound/mawb
48 - #代理地址(刷新token、传输海关回执地址、推送完整报文地址)
49 -# http://cn2-proxy.apac.fedex.com:3128
50 -# http://internet.proxy.fedex.com
51 - proxy-url: cn2-proxy.apac.fedex.com
52 - proxy-port: 3128
1 +server.port=8780
2 +server.ssl.enabled=true
3 +server.ssl.key-store-type=PKCS12
4 +server.ssl.key-store=classpath:iclearApiSSL.p12
5 +server.ssl.key-store-password=iclear
6 +server.ssl.key-alias=iclearApiSSL
7 +
8 +spring.profiles.active=@activatedProperties@
9 +spring.application.name=iClearExport.DataInterface
10 +spring.jpa.database=sql_server
11 +spring.jpa.show-sql=true
12 +spring.jpa.hibernate.ddl-auto=none
13 +spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
14 +spring.jpa.properties.event.merge.entity_copy_observer=allow
...\ No newline at end of file ...\ No newline at end of file
1 -server:
2 - port: 8780
3 - ssl:
4 - enabled: true
5 - key-store-type: PKCS12
6 - key-store: classpath:iclearApiSSL.p12
7 - key-store-password: iclear
8 - key-alias: iclearApiSSL
9 -
10 -
11 -
12 -spring:
13 - profiles:
14 - active: @activatedProperties@
15 -# active: dev
16 - application:
17 - name: iClearExport.DataInterface
18 - jpa:
19 - database: sql_server
20 - show-sql: true
21 - hibernate:
22 - ddl-auto: none
23 - naming:
24 - physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
25 - properties:
26 - event:
27 - merge:
28 - entity_copy_observer: allow