李俊

Merge branch 'master-weblogic'

# Conflicts:
#	doc/FedEx在线申报系统API - 数据落地接口(C类).docx
#	sql/BASF校验接口.sql
#	src/main/java/com/erry/iclear/dateInterface/api/request/FedexDetail.java
#	src/main/java/com/erry/iclear/dateInterface/api/request/Fedexc.java
#	src/main/java/com/erry/iclear/dateInterface/service/ApiService.java
#	src/main/java/com/erry/iclear/dateInterface/service/ChmConsignmentService.java
#	src/main/java/com/erry/iclear/dateInterface/service/DeclearTaskService.java
#	src/main/java/com/erry/iclear/dateInterface/service/DictionaryEntriesService.java
#	src/main/java/com/erry/iclear/dateInterface/service/FedexConsignmentService.java
#	src/main/java/com/erry/iclear/dateInterface/service/HsCodeService.java
#	src/main/java/com/erry/iclear/dateInterface/service/IClearApiHsCodeLogService.java
#	src/main/java/com/erry/iclear/dateInterface/task/IClearApiTask.java
#	src/test/java/com/erry/iclear/dateInterface/ApiTest.java
Showing 34 changed files with 669 additions and 208 deletions
...@@ -9,9 +9,9 @@ ...@@ -9,9 +9,9 @@
9 <relativePath/> 9 <relativePath/>
10 </parent> 10 </parent>
11 <groupId>com.erry.iclear</groupId> 11 <groupId>com.erry.iclear</groupId>
12 - <artifactId>iclear-api</artifactId> 12 + <artifactId>ICLEAR-API</artifactId>
13 - <version>0.0.1-SNAPSHOT</version> 13 + <version>1.0.1</version>
14 - <packaging>jar</packaging> 14 + <packaging>war</packaging>
15 <name>iClear-api</name> 15 <name>iClear-api</name>
16 <description>iClear-api</description> 16 <description>iClear-api</description>
17 <properties> 17 <properties>
...@@ -21,10 +21,6 @@ ...@@ -21,10 +21,6 @@
21 21
22 <dependency> 22 <dependency>
23 <groupId>org.springframework.boot</groupId> 23 <groupId>org.springframework.boot</groupId>
24 - <artifactId>spring-boot-starter-web</artifactId>
25 - </dependency>
26 - <dependency>
27 - <groupId>org.springframework.boot</groupId>
28 <artifactId>spring-boot-starter-test</artifactId> 24 <artifactId>spring-boot-starter-test</artifactId>
29 <scope>test</scope> 25 <scope>test</scope>
30 </dependency> 26 </dependency>
...@@ -98,7 +94,6 @@ ...@@ -98,7 +94,6 @@
98 <version>1.2.38</version> 94 <version>1.2.38</version>
99 </dependency> 95 </dependency>
100 96
101 -
102 <dependency> 97 <dependency>
103 <groupId>org.apache.httpcomponents</groupId> 98 <groupId>org.apache.httpcomponents</groupId>
104 <artifactId>httpcore</artifactId> 99 <artifactId>httpcore</artifactId>
...@@ -109,6 +104,44 @@ ...@@ -109,6 +104,44 @@
109 <artifactId>httpclient</artifactId> 104 <artifactId>httpclient</artifactId>
110 <version>4.5.3</version> 105 <version>4.5.3</version>
111 </dependency> 106 </dependency>
107 + <dependency>
108 + <groupId>org.springframework.boot</groupId>
109 + <artifactId>spring-boot-starter-tomcat</artifactId>
110 + <scope>provided</scope>
111 + </dependency>
112 + <dependency>
113 + <groupId>org.springframework.boot</groupId>
114 + <artifactId>spring-boot-starter-validation</artifactId>
115 + <exclusions>
116 + <exclusion>
117 + <groupId>org.apache.tomcat.embed</groupId>
118 + <artifactId>tomcat-embed-el</artifactId>
119 + </exclusion>
120 + </exclusions>
121 + </dependency>
122 + <dependency>
123 + <groupId>org.springframework.boot</groupId>
124 + <artifactId>spring-boot-starter-web</artifactId>
125 + <exclusions>
126 + <exclusion>
127 + <groupId>org.springframework.boot</groupId>
128 + <artifactId>spring-boot-starter-tomcat</artifactId>
129 + </exclusion>
130 + <exclusion>
131 + <groupId>org.hibernate</groupId>
132 + <artifactId>hibernate-validator</artifactId>
133 + </exclusion>
134 + <exclusion>
135 + <artifactId>hibernate-validator</artifactId>
136 + <groupId>org.hibernate.validator</groupId>
137 + </exclusion>
138 + </exclusions>
139 + </dependency>
140 + <dependency>
141 + <groupId>org.hibernate.validator</groupId>
142 + <artifactId>hibernate-validator</artifactId>
143 + <version>6.0.20.Final</version>
144 + </dependency>
112 </dependencies> 145 </dependencies>
113 146
114 <profiles> 147 <profiles>
......
1 -create table T_ICLEAR_API_CHECK_LOG 1 +
2 +
3 +CREATE TABLE [dbo].[T_ICLEAR_API_CHECK_LOG](
4 + [ID] [bigint] IDENTITY(1,1) NOT NULL,
5 + [request_appid] [varchar](200) NULL,
6 + [request_appkey] [varchar](200) NULL,
7 + [request_token] [varchar](200) NULL,
8 + [consignment_code] [varchar](200) NULL,
9 + [request_text] [text] NULL,
10 + [response_text] [text] NULL,
11 + [request_ip] [varchar](200) NULL,
12 + [create_time] [datetime] NULL,
13 + [success] [int] NULL,
14 + [code] [varchar](200) NULL,
15 +PRIMARY KEY CLUSTERED
2 ( 16 (
3 -ID bigint primary key identity (1,1), 17 + [ID] ASC
4 -request_appid varchar(200), 18 +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
5 -request_appkey varchar(200), 19 +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
6 -request_token varchar(200), 20 +GO
7 -consignment_code varchar(200), 21 +
8 -request_text text, 22 +
9 -response_text text,
10 -request_ip varchar(200),
11 -create_time datetime,
12 -success int,
13 -code varchar(200),
14 -)
......
...@@ -2,10 +2,20 @@ package com.erry.iclear.dateInterface; ...@@ -2,10 +2,20 @@ package com.erry.iclear.dateInterface;
2 2
3 import com.erry.iclear.dateInterface.service.SimpleJpaRepositoryImpl; 3 import com.erry.iclear.dateInterface.service.SimpleJpaRepositoryImpl;
4 import lombok.extern.slf4j.Slf4j; 4 import lombok.extern.slf4j.Slf4j;
5 +import org.springframework.beans.factory.annotation.Autowired;
6 +import org.springframework.beans.factory.annotation.Value;
5 import org.springframework.boot.SpringApplication; 7 import org.springframework.boot.SpringApplication;
6 import org.springframework.boot.autoconfigure.SpringBootApplication; 8 import org.springframework.boot.autoconfigure.SpringBootApplication;
9 +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
10 +import org.springframework.boot.builder.SpringApplicationBuilder;
11 +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
12 +import org.springframework.context.annotation.Bean;
7 import org.springframework.data.jpa.repository.config.EnableJpaRepositories; 13 import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
14 +import org.springframework.jndi.JndiObjectFactoryBean;
8 import org.springframework.scheduling.annotation.EnableScheduling; 15 import org.springframework.scheduling.annotation.EnableScheduling;
16 +import org.springframework.web.bind.annotation.GetMapping;
17 +
18 +import javax.sql.DataSource;
9 19
10 20
11 /** 21 /**
...@@ -16,10 +26,18 @@ import org.springframework.scheduling.annotation.EnableScheduling; ...@@ -16,10 +26,18 @@ import org.springframework.scheduling.annotation.EnableScheduling;
16 @SpringBootApplication 26 @SpringBootApplication
17 @EnableScheduling 27 @EnableScheduling
18 //@EnableJpaRepositories(value = "com.erry.iclear.dateInterface.repository", repositoryBaseClass = SimpleJpaRepositoryImpl.class) 28 //@EnableJpaRepositories(value = "com.erry.iclear.dateInterface.repository", repositoryBaseClass = SimpleJpaRepositoryImpl.class)
19 -public class IClearApiApplication { 29 +public class IClearApiApplication extends SpringBootServletInitializer {
20 30
21 public static void main(String[] args) { 31 public static void main(String[] args) {
22 SpringApplication.run(IClearApiApplication.class, args); 32 SpringApplication.run(IClearApiApplication.class, args);
23 } 33 }
24 34
35 + @Override
36 + protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
37 + return builder.sources(IClearApiApplication.class);
38 + }
39 +
40 + public String test(){
41 + return "test";
42 + }
25 } 43 }
......
1 -package com.erry.iclear.dateInterface;
2 -
3 -import org.springframework.boot.builder.SpringApplicationBuilder;
4 -import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
5 -
6 -/**
7 - * @author Administrator
8 - */
9 -public class SpringBootStartApplication extends SpringBootServletInitializer {
10 - @Override
11 - protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
12 - return builder.sources(IClearApiApplication.class);
13 - }
14 -}
...\ No newline at end of file ...\ No newline at end of file
1 +//package com.erry.iclear.dateInterface;
2 +//
3 +//import org.springframework.boot.builder.SpringApplicationBuilder;
4 +//import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
5 +//
6 +///**
7 +// * @author Administrator
8 +// */
9 +//public class SpringBootStartApplication extends SpringBootServletInitializer {
10 +// @Override
11 +// protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
12 +// return builder.sources(IClearApiApplication.class);
13 +// }
14 +//}
......
...@@ -5,6 +5,7 @@ import com.erry.iclear.dateInterface.api.response.ResultRS; ...@@ -5,6 +5,7 @@ import com.erry.iclear.dateInterface.api.response.ResultRS;
5 import com.erry.iclear.dateInterface.entity.IClearApiLog; 5 import com.erry.iclear.dateInterface.entity.IClearApiLog;
6 import com.erry.iclear.dateInterface.repository.MawbAdd; 6 import com.erry.iclear.dateInterface.repository.MawbAdd;
7 import com.erry.iclear.dateInterface.service.*; 7 import com.erry.iclear.dateInterface.service.*;
8 +import com.erry.iclear.dateInterface.util.StringUtil;
8 import com.google.gson.Gson; 9 import com.google.gson.Gson;
9 import io.swagger.annotations.ApiOperation; 10 import io.swagger.annotations.ApiOperation;
10 import lombok.extern.slf4j.Slf4j; 11 import lombok.extern.slf4j.Slf4j;
...@@ -55,6 +56,15 @@ public class CustomsDataInterface { ...@@ -55,6 +56,15 @@ public class CustomsDataInterface {
55 result.setMsg("请求信息不能为空"); 56 result.setMsg("请求信息不能为空");
56 return result; 57 return result;
57 } 58 }
59 +
60 + String checkrs = mawbService.checkMawbBaseInfo(mawb);
61 + if(StringUtil.isNotEmpty(checkrs)){
62 + result.setCode("-7");
63 + result.setMsg(checkrs);
64 + return result;
65 + }
66 +
67 +
58 //1、保存请求信息,保存到iClear的 SQLServer 68 //1、保存请求信息,保存到iClear的 SQLServer
59 69
60 StopWatch sw = new StopWatch("receice mawb"); 70 StopWatch sw = new StopWatch("receice mawb");
...@@ -66,6 +76,8 @@ public class CustomsDataInterface { ...@@ -66,6 +76,8 @@ public class CustomsDataInterface {
66 IClearApiLog saveIClearApiLogResult = iClearApiLogService.saveIClearApiLog(iClearApiLogService.convertToIClearApiLog(mawb,appId,appKey,new Date(Long.valueOf(timeStamp)))); 76 IClearApiLog saveIClearApiLogResult = iClearApiLogService.saveIClearApiLog(iClearApiLogService.convertToIClearApiLog(mawb,appId,appKey,new Date(Long.valueOf(timeStamp))));
67 77
68 78
79 +
80 +
69 mawb.setAppId(appId); 81 mawb.setAppId(appId);
70 if(!Objects.equals(saveIClearApiLogResult,null)){ 82 if(!Objects.equals(saveIClearApiLogResult,null)){
71 log.info("请求保存成功,msgId:"+saveIClearApiLogResult.getMsgId()); 83 log.info("请求保存成功,msgId:"+saveIClearApiLogResult.getMsgId());
......
...@@ -16,6 +16,7 @@ import com.erry.iclear.dateInterface.entity.TIClearApiCheckLog; ...@@ -16,6 +16,7 @@ import com.erry.iclear.dateInterface.entity.TIClearApiCheckLog;
16 import com.erry.iclear.dateInterface.repository.ChmConsignmentRepository; 16 import com.erry.iclear.dateInterface.repository.ChmConsignmentRepository;
17 import com.erry.iclear.dateInterface.repository.IClearApiCheckLogRepository; 17 import com.erry.iclear.dateInterface.repository.IClearApiCheckLogRepository;
18 import com.erry.iclear.dateInterface.service.*; 18 import com.erry.iclear.dateInterface.service.*;
19 +import com.erry.iclear.dateInterface.util.HttpUtils;
19 import com.erry.iclear.dateInterface.util.JsonToJava; 20 import com.erry.iclear.dateInterface.util.JsonToJava;
20 import com.erry.iclear.dateInterface.util.StringUtil; 21 import com.erry.iclear.dateInterface.util.StringUtil;
21 import com.google.gson.Gson; 22 import com.google.gson.Gson;
...@@ -29,9 +30,7 @@ import org.springframework.validation.annotation.Validated; ...@@ -29,9 +30,7 @@ import org.springframework.validation.annotation.Validated;
29 import org.springframework.web.bind.annotation.*; 30 import org.springframework.web.bind.annotation.*;
30 31
31 import javax.servlet.http.HttpServletRequest; 32 import javax.servlet.http.HttpServletRequest;
32 -import java.util.Date; 33 +import java.util.*;
33 -import java.util.List;
34 -import java.util.Objects;
35 34
36 @RestController 35 @RestController
37 @RequestMapping("/fedex") 36 @RequestMapping("/fedex")
...@@ -67,8 +66,8 @@ public class FedexDataInterface { ...@@ -67,8 +66,8 @@ public class FedexDataInterface {
67 String iclearCSubmitUrl; 66 String iclearCSubmitUrl;
68 67
69 68
70 - @ApiOperation(value = "BASF运单数据校验接口", httpMethod = "POST", notes = "ex: http://192.168.1.75:8080/fedex/checkBASFMawbFedex") 69 + @ApiOperation(value = "C类运单数据校验接口", httpMethod = "POST", notes = "ex: http://192.168.1.75:8080/fedex/checkBASFMawbFedex")
71 - @PostMapping("/checkBASFMawbFedex") 70 + @PostMapping("/checkMawbFedexC")
72 @ResponseBody 71 @ResponseBody
73 public ResultRS checkBASFMawbFedex(HttpServletRequest request 72 public ResultRS checkBASFMawbFedex(HttpServletRequest request
74 ,@RequestBody Fedexc fedexc) throws HttpProcessException { 73 ,@RequestBody Fedexc fedexc) throws HttpProcessException {
...@@ -108,7 +107,11 @@ public class FedexDataInterface { ...@@ -108,7 +107,11 @@ public class FedexDataInterface {
108 sw.start("checkFedexMawb"); 107 sw.start("checkFedexMawb");
109 String msg = result.getMsg(); 108 String msg = result.getMsg();
110 String iclearCheckMsg = fedexService.checkFedexMawb(saveMawbFedexResult).getMsg(); 109 String iclearCheckMsg = fedexService.checkFedexMawb(saveMawbFedexResult).getMsg();
111 - result.setMsg(msg+";"+iclearCheckMsg); 110 + if(StringUtil.isEmpty(msg) && StringUtil.isEmpty(iclearCheckMsg)){
111 + result.setSuccess(Boolean.TRUE);
112 + }else{
113 + result.setMsg(msg+";"+iclearCheckMsg);
114 + }
112 sw.stop(); 115 sw.stop();
113 116
114 log.info(sw.prettyPrint()); 117 log.info(sw.prettyPrint());
...@@ -131,7 +134,7 @@ public class FedexDataInterface { ...@@ -131,7 +134,7 @@ public class FedexDataInterface {
131 @PostMapping("/sendMawbFedex") 134 @PostMapping("/sendMawbFedex")
132 @ResponseBody 135 @ResponseBody
133 public ResultRS sendMawbFedex(HttpServletRequest request 136 public ResultRS sendMawbFedex(HttpServletRequest request
134 - , @Validated @RequestBody Fedexc fedexc) throws HttpProcessException { 137 + , @RequestBody Fedexc fedexc) throws HttpProcessException {
135 log.info("接收到请求数据consignmentCode:"+fedexc.getConsignmentCode()+" data:" + gson.toJson(fedexc)); 138 log.info("接收到请求数据consignmentCode:"+fedexc.getConsignmentCode()+" data:" + gson.toJson(fedexc));
136 ResultRS result = new ResultRS(Boolean.FALSE,"",""); 139 ResultRS result = new ResultRS(Boolean.FALSE,"","");
137 140
...@@ -197,17 +200,23 @@ public class FedexDataInterface { ...@@ -197,17 +200,23 @@ public class FedexDataInterface {
197 ChmConsignment chmGetId = chmConsignmentRepository.findChmConsignmentByConsignmentCode(saveIClearApiLogResult.getBillNo(), saveIClearApiLogResult.getCreateTime()); 200 ChmConsignment chmGetId = chmConsignmentRepository.findChmConsignmentByConsignmentCode(saveIClearApiLogResult.getBillNo(), saveIClearApiLogResult.getCreateTime());
198 //调用IClear接口进行运单推送EXP002 201 //调用IClear接口进行运单推送EXP002
199 String objJson = JsonToJava.toJson(chmGetId.getId()); 202 String objJson = JsonToJava.toJson(chmGetId.getId());
200 - Header[] headers = HttpHeader.custom() 203 +// Header[] headers = HttpHeader.custom()
201 - .other("Content-Type", "application/json") 204 +// .other("Content-Type", "application/json")
202 - .build(); 205 +// .build();
203 - log.info("******************* : " + this.iclearCSubmitUrl); 206 +// log.info("******************* : " + this.iclearCSubmitUrl);
204 - //推送海关回执数据 207 +// //推送海关回执数据
205 - HttpConfig config = HttpConfig.custom() 208 +// HttpConfig config = HttpConfig.custom()
206 - .headers(headers) 209 +// .headers(headers)
207 - .url(this.iclearCSubmitUrl) 210 +// .url(this.iclearCSubmitUrl)
208 - .encoding("utf-8") 211 +// .encoding("utf-8")
209 - .json(objJson); 212 +// .json(objJson);
210 - String json = HttpClientUtil.post(config); 213 +// String json = HttpClientUtil.post(config);
214 +
215 + Map<String,String> headerMap = new HashMap<>();
216 + headerMap.put("Content-Type", "application/json");
217 + String json = HttpUtils.doPost(this.iclearCSubmitUrl,objJson,headerMap);
218 +
219 +
211 log.info("<<<<<<<< checkfedexMawb start >>>>>>>>>> result :" +result.getSuccess() +" iclear check response : " + json + " status : " + result.getSuccess()); 220 log.info("<<<<<<<< checkfedexMawb start >>>>>>>>>> result :" +result.getSuccess() +" iclear check response : " + json + " status : " + result.getSuccess());
212 221
213 222
...@@ -235,7 +244,7 @@ public class FedexDataInterface { ...@@ -235,7 +244,7 @@ public class FedexDataInterface {
235 @PostMapping("/selectDecListFedex") 244 @PostMapping("/selectDecListFedex")
236 @ResponseBody 245 @ResponseBody
237 public FedexResultChmRS selectDecListFedex(HttpServletRequest request 246 public FedexResultChmRS selectDecListFedex(HttpServletRequest request
238 - , @Validated @RequestBody ConsignmentCode consignmentCode) throws Exception { 247 + , @RequestBody ConsignmentCode consignmentCode) throws Exception {
239 log.info("接收到请求数据consignmentCode:"+consignmentCode.getConsignmentCode()+" data:" + gson.toJson(consignmentCode)); 248 log.info("接收到请求数据consignmentCode:"+consignmentCode.getConsignmentCode()+" data:" + gson.toJson(consignmentCode));
240 FedexResultChmRS result = new FedexResultChmRS(Boolean.FALSE,"","",null); 249 FedexResultChmRS result = new FedexResultChmRS(Boolean.FALSE,"","",null);
241 //获取请求的运单号 250 //获取请求的运单号
...@@ -294,7 +303,7 @@ public class FedexDataInterface { ...@@ -294,7 +303,7 @@ public class FedexDataInterface {
294 @PostMapping("/selectChmListFedex") 303 @PostMapping("/selectChmListFedex")
295 @ResponseBody 304 @ResponseBody
296 public FedexResultRS selectChmListFedex(HttpServletRequest request 305 public FedexResultRS selectChmListFedex(HttpServletRequest request
297 - , @Validated @RequestBody ConsignmentCode consignmentCode) throws Exception { 306 + , @RequestBody ConsignmentCode consignmentCode) throws Exception {
298 log.info("接收到请求数据consignmentCode:"+consignmentCode.getConsignmentCode()+" data:" + gson.toJson(consignmentCode)); 307 log.info("接收到请求数据consignmentCode:"+consignmentCode.getConsignmentCode()+" data:" + gson.toJson(consignmentCode));
299 FedexResultRS result = new FedexResultRS(Boolean.FALSE,"","",null); 308 FedexResultRS result = new FedexResultRS(Boolean.FALSE,"","",null);
300 //获取请求的运单号 309 //获取请求的运单号
......
...@@ -15,6 +15,7 @@ import java.util.Date; ...@@ -15,6 +15,7 @@ import java.util.Date;
15 15
16 /** 16 /**
17 * @author Administrator 17 * @author Administrator
18 + * /hscode/hscodeRequest
18 */ 19 */
19 @RestController 20 @RestController
20 @RequestMapping("/hscode") 21 @RequestMapping("/hscode")
......
...@@ -34,17 +34,14 @@ public class FedexDetail { ...@@ -34,17 +34,14 @@ public class FedexDetail {
34 private Long consignmentDetailId; 34 private Long consignmentDetailId;
35 35
36 @ApiModelProperty(value = "商品编号") 36 @ApiModelProperty(value = "商品编号")
37 - @NotBlank(message="参数skuCode不能为空")
38 @Column(name = "SKUCODE") 37 @Column(name = "SKUCODE")
39 private String skuCode; 38 private String skuCode;
40 39
41 @ApiModelProperty(value = "品名") 40 @ApiModelProperty(value = "品名")
42 - @NotBlank(message = "参数skuName不能为空")
43 @Column(name = "SKUNAME") 41 @Column(name = "SKUNAME")
44 private String skuName; 42 private String skuName;
45 43
46 @ApiModelProperty(value = "规格型号") 44 @ApiModelProperty(value = "规格型号")
47 - @NotBlank(message="参数model不能为空")
48 @Column(name = "MODEL") 45 @Column(name = "MODEL")
49 private String model; 46 private String model;
50 47
......
...@@ -8,6 +8,7 @@ import org.hibernate.annotations.DynamicUpdate; ...@@ -8,6 +8,7 @@ import org.hibernate.annotations.DynamicUpdate;
8 8
9 import javax.persistence.*; 9 import javax.persistence.*;
10 import javax.validation.Valid; 10 import javax.validation.Valid;
11 +import javax.validation.constraints.NotBlank;
11 import java.io.Serializable; 12 import java.io.Serializable;
12 import java.math.BigDecimal; 13 import java.math.BigDecimal;
13 import java.util.List; 14 import java.util.List;
......
...@@ -8,8 +8,6 @@ import org.hibernate.annotations.DynamicUpdate; ...@@ -8,8 +8,6 @@ import org.hibernate.annotations.DynamicUpdate;
8 8
9 import javax.persistence.*; 9 import javax.persistence.*;
10 import javax.validation.Valid; 10 import javax.validation.Valid;
11 -import javax.validation.constraints.NotBlank;
12 -import javax.validation.constraints.NotNull;
13 import java.io.Serializable; 11 import java.io.Serializable;
14 import java.util.List; 12 import java.util.List;
15 13
...@@ -45,23 +43,18 @@ public class Fedexc implements Serializable { ...@@ -45,23 +43,18 @@ public class Fedexc implements Serializable {
45 43
46 @ApiModelProperty(value = "运单号", name = "consignmentCode") 44 @ApiModelProperty(value = "运单号", name = "consignmentCode")
47 @Column(name = "CONSIGNMENTCODE") 45 @Column(name = "CONSIGNMENTCODE")
48 - @NotBlank(message="参数consignmentCode不能为空!")
49 private String consignmentCode; 46 private String consignmentCode;
50 47
51 @ApiModelProperty(value = "运单ID", name = "consignmentId", example = "运单记录的唯一ID") 48 @ApiModelProperty(value = "运单ID", name = "consignmentId", example = "运单记录的唯一ID")
52 @Column(name = "CONSIGNMENTID") 49 @Column(name = "CONSIGNMENTID")
53 -// @NotNull(message="参数consignmentId不能为空!")
54 -// @NotBlank(message="参数consignmentId不能为空!")
55 private Long consignmentId; 50 private Long consignmentId;
56 51
57 @ApiModelProperty(value = "运单类型",name = "consType", example = "A/B/C/D") 52 @ApiModelProperty(value = "运单类型",name = "consType", example = "A/B/C/D")
58 @Column(name = "CONSTYPE") 53 @Column(name = "CONSTYPE")
59 - @NotBlank(message = "参数consType不能为空!")
60 private String consType; 54 private String consType;
61 55
62 @ApiModelProperty(value = "发件人", name = "sender") 56 @ApiModelProperty(value = "发件人", name = "sender")
63 @Column(name = "SENDER") 57 @Column(name = "SENDER")
64 - @NotBlank(message = "参数sender不能为空!")
65 private String sender; 58 private String sender;
66 59
67 @ApiModelProperty(value = "发件人海关编码", name = "shipperCustomsCode") 60 @ApiModelProperty(value = "发件人海关编码", name = "shipperCustomsCode")
...@@ -70,7 +63,6 @@ public class Fedexc implements Serializable { ...@@ -70,7 +63,6 @@ public class Fedexc implements Serializable {
70 63
71 @ApiModelProperty(value = "发件人社会信用证代码", name = "shipperSCC") 64 @ApiModelProperty(value = "发件人社会信用证代码", name = "shipperSCC")
72 @Column(name = "SHIPPERSCC") 65 @Column(name = "SHIPPERSCC")
73 - @NotBlank(message = "参数shipperSCC不能为空!")
74 private String shipperSCC; 66 private String shipperSCC;
75 67
76 @ApiModelProperty(value = "经营单位", name = "operateUnitName") 68 @ApiModelProperty(value = "经营单位", name = "operateUnitName")
......
...@@ -42,12 +42,10 @@ public class Mawb implements Serializable { ...@@ -42,12 +42,10 @@ public class Mawb implements Serializable {
42 42
43 43
44 @ApiModelProperty(value = "进出口标志", name = "IEFlag", example = "固定值:E") 44 @ApiModelProperty(value = "进出口标志", name = "IEFlag", example = "固定值:E")
45 - @NotBlank(message="参数ieFlag不能为空")
46 @Column(name = "IEFLAG") 45 @Column(name = "IEFLAG")
47 private String ieFlag; 46 private String ieFlag;
48 47
49 @ApiModelProperty(value = "报关类型", name = "Type", example = "固定值:EX") 48 @ApiModelProperty(value = "报关类型", name = "Type", example = "固定值:EX")
50 - @NotBlank(message="参数type不能为空")
51 @Column(name = "TYPE") 49 @Column(name = "TYPE")
52 private String type; 50 private String type;
53 51
...@@ -62,7 +60,7 @@ public class Mawb implements Serializable { ...@@ -62,7 +60,7 @@ public class Mawb implements Serializable {
62 private String agentName; 60 private String agentName;
63 61
64 @ApiModelProperty(value = "提单号", name = "billNo", example = "固定值:有总单号则取值‘总单号_运单号‘,没有总单号则取值‘运单号‘") 62 @ApiModelProperty(value = "提单号", name = "billNo", example = "固定值:有总单号则取值‘总单号_运单号‘,没有总单号则取值‘运单号‘")
65 - @NotBlank(message="参数billNo不能为空") 63 + //@NotBlank(message="参数billNo不能为空")
66 @Column(name = "BILLNO") 64 @Column(name = "BILLNO")
67 private String billNo; 65 private String billNo;
68 66
...@@ -71,12 +69,12 @@ public class Mawb implements Serializable { ...@@ -71,12 +69,12 @@ public class Mawb implements Serializable {
71 private String contrNo; 69 private String contrNo;
72 70
73 @ApiModelProperty(value = "主管海关(申报地海关)", name = "customMaster", example = "固定值:0101") 71 @ApiModelProperty(value = "主管海关(申报地海关)", name = "customMaster", example = "固定值:0101")
74 - @NotBlank(message="参数customMaster不能为空") 72 + //@NotBlank(message="参数customMaster不能为空")
75 @Column(name = "CUSTOMMASTER") 73 @Column(name = "CUSTOMMASTER")
76 private String customMaster; 74 private String customMaster;
77 75
78 @ApiModelProperty(value = "征免性质", name = "cutMode", example = "101") 76 @ApiModelProperty(value = "征免性质", name = "cutMode", example = "101")
79 - @NotBlank(message="参数cutMode不能为空") 77 + //@NotBlank(message="参数cutMode不能为空")
80 @Column(name = "CUTMODE") 78 @Column(name = "CUTMODE")
81 private String cutMode; 79 private String cutMode;
82 80
...@@ -86,7 +84,7 @@ public class Mawb implements Serializable { ...@@ -86,7 +84,7 @@ public class Mawb implements Serializable {
86 private String declTrnRel; 84 private String declTrnRel;
87 85
88 @ApiModelProperty(value = "经停港/指运港", name = "distinatePort", example = "ASM000") 86 @ApiModelProperty(value = "经停港/指运港", name = "distinatePort", example = "ASM000")
89 - @NotBlank(message="参数distinatePort不能为空") 87 + //@NotBlank(message="参数distinatePort不能为空")
90 @Column(name = "DISTINATEPORT") 88 @Column(name = "DISTINATEPORT")
91 private String distinatePort; 89 private String distinatePort;
92 90
...@@ -100,12 +98,12 @@ public class Mawb implements Serializable { ...@@ -100,12 +98,12 @@ public class Mawb implements Serializable {
100 private String entryId; 98 private String entryId;
101 99
102 @ApiModelProperty(value = "运费币制", name = "feeCurr", example = "固定值:3") 100 @ApiModelProperty(value = "运费币制", name = "feeCurr", example = "固定值:3")
103 -// @NotBlank(message="参数feeCurr不能为空") 101 +//@NotBlank(message="参数feeCurr不能为空")
104 @Column(name = "FEECURR") 102 @Column(name = "FEECURR")
105 private String feeCurr; 103 private String feeCurr;
106 104
107 @ApiModelProperty(value = "运费标记", name = "feeMark", example = "99.22") 105 @ApiModelProperty(value = "运费标记", name = "feeMark", example = "99.22")
108 -// @NotBlank(message="参数feeMark不能为空") 106 +//@NotBlank(message="参数feeMark不能为空")
109 @Column(name = "FEEMARK") 107 @Column(name = "FEEMARK")
110 private String feeMark; 108 private String feeMark;
111 109
...@@ -120,7 +118,7 @@ public class Mawb implements Serializable { ...@@ -120,7 +118,7 @@ public class Mawb implements Serializable {
120 private BigDecimal grossWet; 118 private BigDecimal grossWet;
121 119
122 @ApiModelProperty(value = "出入境关闭", name = "IEPort", example = "固定值:0101") 120 @ApiModelProperty(value = "出入境关闭", name = "IEPort", example = "固定值:0101")
123 - @NotBlank(message="参数iePort不能为空") 121 + //@NotBlank(message="参数iePort不能为空")
124 @Column(name = "IEPORT") 122 @Column(name = "IEPORT")
125 private String iePort; 123 private String iePort;
126 124
...@@ -129,7 +127,7 @@ public class Mawb implements Serializable { ...@@ -129,7 +127,7 @@ public class Mawb implements Serializable {
129 private String inputerName; 127 private String inputerName;
130 128
131 @ApiModelProperty(value = "保险费币制", name = "insurCurr", example = "MOP") 129 @ApiModelProperty(value = "保险费币制", name = "insurCurr", example = "MOP")
132 -// @NotBlank(message="参数insurCurr不能为空") 130 +//@NotBlank(message="参数insurCurr不能为空")
133 @Column(name = "INSURCURR") 131 @Column(name = "INSURCURR")
134 private String insurCurr; 132 private String insurCurr;
135 133
...@@ -164,17 +162,14 @@ public class Mawb implements Serializable { ...@@ -164,17 +162,14 @@ public class Mawb implements Serializable {
164 private String otherMark; 162 private String otherMark;
165 163
166 @ApiModelProperty(value = "消费使用/生产销售单位代码", name = "ownerCode", example = "Z321654987") 164 @ApiModelProperty(value = "消费使用/生产销售单位代码", name = "ownerCode", example = "Z321654987")
167 - @NotBlank(message="参数ownerCode不能为空")
168 @Column(name = "OWNERCODE") 165 @Column(name = "OWNERCODE")
169 private String ownerCode; 166 private String ownerCode;
170 167
171 @ApiModelProperty(value = "消费使用/生产销售单位名称", name = "ownerName", example = "上海保险") 168 @ApiModelProperty(value = "消费使用/生产销售单位名称", name = "ownerName", example = "上海保险")
172 - @NotBlank(message="参数ownerName不能为空")
173 @Column(name = "OWNERNAME") 169 @Column(name = "OWNERNAME")
174 private String ownerName; 170 private String ownerName;
175 171
176 @ApiModelProperty(value = "件数", name = "packNo", example = "") 172 @ApiModelProperty(value = "件数", name = "packNo", example = "")
177 - @NotNull(message="参数packNo不能为空")
178 @Column(name = "PACKNO") 173 @Column(name = "PACKNO")
179 private Integer packNo; 174 private Integer packNo;
180 175
...@@ -182,52 +177,49 @@ public class Mawb implements Serializable { ...@@ -182,52 +177,49 @@ public class Mawb implements Serializable {
182 private String preEntryId; 177 private String preEntryId;
183 178
184 @ApiModelProperty(value = "启运国/运抵国", name = "tradeCountry", example = "USA") 179 @ApiModelProperty(value = "启运国/运抵国", name = "tradeCountry", example = "USA")
185 - @NotBlank(message="参数tradeCountry不能为空")
186 @Column(name = "TRADECOUNTRY") 180 @Column(name = "TRADECOUNTRY")
187 private String tradeCountry; 181 private String tradeCountry;
188 182
189 @ApiModelProperty(value = "监管方式", name = "tradeMode", example = "0200") 183 @ApiModelProperty(value = "监管方式", name = "tradeMode", example = "0200")
190 - @NotBlank(message="参数tradeMode不能为空")
191 @Column(name = "TRADEMODE") 184 @Column(name = "TRADEMODE")
192 private String tradeMode; 185 private String tradeMode;
193 186
194 @ApiModelProperty(value = "境内收发货人编号", name = "tradeCode", example = "Z321654987") 187 @ApiModelProperty(value = "境内收发货人编号", name = "tradeCode", example = "Z321654987")
195 - @NotBlank(message="参数tradeCode不能为空")
196 @Column(name = "TRADECODE") 188 @Column(name = "TRADECODE")
197 private String tradeCode; 189 private String tradeCode;
198 190
199 @ApiModelProperty(value = "运输方式代码", name = "trafMode", example = "1") 191 @ApiModelProperty(value = "运输方式代码", name = "trafMode", example = "1")
200 - @NotBlank(message="参数trafMode不能为空") 192 + //@NotBlank(message="参数trafMode不能为空")
201 @Column(name = "TRAFMODE") 193 @Column(name = "TRAFMODE")
202 private String trafMode; 194 private String trafMode;
203 195
204 @ApiModelProperty(value = "境内收发货人名称", name = "tradeName", example = "上海铢怡国际货物运输代理有限公司") 196 @ApiModelProperty(value = "境内收发货人名称", name = "tradeName", example = "上海铢怡国际货物运输代理有限公司")
205 - @NotBlank(message="参数tradeName不能为空") 197 + //@NotBlank(message="参数tradeName不能为空")
206 @Column(name = "TRADENAME") 198 @Column(name = "TRADENAME")
207 private String tradeName; 199 private String tradeName;
208 200
209 @ApiModelProperty(value = "成交方式", name = "transMode", example = "2") 201 @ApiModelProperty(value = "成交方式", name = "transMode", example = "2")
210 - @NotBlank(message="参数transMode不能为空") 202 + //@NotBlank(message="参数transMode不能为空")
211 @Column(name = "TRANSMODE") 203 @Column(name = "TRANSMODE")
212 private String transMode; 204 private String transMode;
213 205
214 @ApiModelProperty(value = "包装种类", name = "wrapType", example = "22") 206 @ApiModelProperty(value = "包装种类", name = "wrapType", example = "22")
215 - @NotBlank(message="参数wrapType不能为空") 207 + //@NotBlank(message="参数wrapType不能为空")
216 @Column(name = "WRAPTYPE") 208 @Column(name = "WRAPTYPE")
217 private String wrapType; 209 private String wrapType;
218 210
219 @ApiModelProperty(value = "生产核销单位统一信用代码---报关形式类型", name = "TradeCodeScc", example = "A74125896321456987") 211 @ApiModelProperty(value = "生产核销单位统一信用代码---报关形式类型", name = "TradeCodeScc", example = "A74125896321456987")
220 - @NotBlank(message="参数tradeCodeScc不能为空") 212 + //@NotBlank(message="参数tradeCodeScc不能为空")
221 @Column(name = "TRADECODESCC") 213 @Column(name = "TRADECODESCC")
222 private String tradeCodeScc; 214 private String tradeCodeScc;
223 215
224 @ApiModelProperty(value = "消费使用/生产销售单位单位统一编码", name = "ownerCodeScc", example = "") 216 @ApiModelProperty(value = "消费使用/生产销售单位单位统一编码", name = "ownerCodeScc", example = "")
225 - @NotBlank(message="参数ownerCodeScc不能为空") 217 + //@NotBlank(message="参数ownerCodeScc不能为空")
226 @Column(name = "OWNERCODESCC") 218 @Column(name = "OWNERCODESCC")
227 private String ownerCodeScc; 219 private String ownerCodeScc;
228 220
229 @ApiModelProperty(value = "贸易国别", name = "tradeAreaCode", example = "") 221 @ApiModelProperty(value = "贸易国别", name = "tradeAreaCode", example = "")
230 - @NotBlank(message="参数tradeAreaCode不能为空") 222 + //@NotBlank(message="参数tradeAreaCode不能为空")
231 @Column(name = "TRADEAREACODE") 223 @Column(name = "TRADEAREACODE")
232 private String tradeAreaCode; 224 private String tradeAreaCode;
233 225
...@@ -256,7 +248,7 @@ public class Mawb implements Serializable { ...@@ -256,7 +248,7 @@ public class Mawb implements Serializable {
256 private String overseasConsigneeCode; 248 private String overseasConsigneeCode;
257 249
258 @ApiModelProperty(value = "境外收货人名称(外文)", name = "overseasConsigneeEname", example = "") 250 @ApiModelProperty(value = "境外收货人名称(外文)", name = "overseasConsigneeEname", example = "")
259 - @NotBlank(message="参数overseasConsigneeEname不能为空") 251 + //@NotBlank(message="参数overseasConsigneeEname不能为空")
260 @Column(name = "OVERSEASCONSIGNEEENAME") 252 @Column(name = "OVERSEASCONSIGNEEENAME")
261 private String overseasConsigneeEname; 253 private String overseasConsigneeEname;
262 254
......
...@@ -34,7 +34,7 @@ public class MawbDetail implements Serializable{ ...@@ -34,7 +34,7 @@ public class MawbDetail implements Serializable{
34 private Long mawbId; 34 private Long mawbId;
35 35
36 @Column(name="DETAILID") 36 @Column(name="DETAILID")
37 - @NotBlank(message="参数detailId不能为空") 37 + //@NotBlank(message="参数detailId不能为空")
38 private String detailId; 38 private String detailId;
39 39
40 @ApiModelProperty(value = "归类标志", example = "空值") 40 @ApiModelProperty(value = "归类标志", example = "空值")
...@@ -42,7 +42,7 @@ public class MawbDetail implements Serializable{ ...@@ -42,7 +42,7 @@ public class MawbDetail implements Serializable{
42 private String classMark; 42 private String classMark;
43 43
44 @ApiModelProperty(value = "商品编号") 44 @ApiModelProperty(value = "商品编号")
45 - @NotBlank(message="参数codeTS不能为空") 45 + //@NotBlank(message="参数codeTS不能为空")
46 @Column(name = "CODETS") 46 @Column(name = "CODETS")
47 private String codeTS; 47 private String codeTS;
48 48
...@@ -57,7 +57,7 @@ public class MawbDetail implements Serializable{ ...@@ -57,7 +57,7 @@ public class MawbDetail implements Serializable{
57 private BigDecimal declTotal; 57 private BigDecimal declTotal;
58 58
59 @ApiModelProperty(value = "征免方式") 59 @ApiModelProperty(value = "征免方式")
60 - @NotBlank(message="参数dutyMode不能为空") 60 + //@NotBlank(message="参数dutyMode不能为空")
61 @Column(name = "DUTYMODE") 61 @Column(name = "DUTYMODE")
62 private String dutyMode; 62 private String dutyMode;
63 63
...@@ -70,7 +70,7 @@ public class MawbDetail implements Serializable{ ...@@ -70,7 +70,7 @@ public class MawbDetail implements Serializable{
70 private String exgVersion; 70 private String exgVersion;
71 71
72 @ApiModelProperty(value = "第一计量单位(法定单位)") 72 @ApiModelProperty(value = "第一计量单位(法定单位)")
73 - @NotBlank(message="参数firstUnit不能为空") 73 + //@NotBlank(message="参数firstUnit不能为空")
74 @Column(name = "FIRSTUNIT") 74 @Column(name = "FIRSTUNIT")
75 private String firstUnit; 75 private String firstUnit;
76 76
...@@ -80,22 +80,22 @@ public class MawbDetail implements Serializable{ ...@@ -80,22 +80,22 @@ public class MawbDetail implements Serializable{
80 private Integer firstQty; 80 private Integer firstQty;
81 81
82 @ApiModelProperty(value = "成交计量单位") 82 @ApiModelProperty(value = "成交计量单位")
83 - @NotBlank(message="参数gunit不能为空") 83 + //@NotBlank(message="参数gunit不能为空")
84 @Column(name = "GUNIT") 84 @Column(name = "GUNIT")
85 private String gunit; 85 private String gunit;
86 86
87 @ApiModelProperty(value = "商品规格、型号") 87 @ApiModelProperty(value = "商品规格、型号")
88 - @NotBlank(message="参数gmodel不能为空") 88 + //@NotBlank(message="参数gmodel不能为空")
89 @Column(name = "GMODE") 89 @Column(name = "GMODE")
90 private String gmodel; 90 private String gmodel;
91 91
92 @ApiModelProperty(value = "商品名称") 92 @ApiModelProperty(value = "商品名称")
93 - @NotBlank(message="参数gname不能为空") 93 + //@NotBlank(message="参数gname不能为空")
94 @Column(name = "GNAME") 94 @Column(name = "GNAME")
95 private String gname; 95 private String gname;
96 96
97 @ApiModelProperty(value = "商品序号") 97 @ApiModelProperty(value = "商品序号")
98 - @NotBlank(message="参数gno不能为空") 98 + //@NotBlank(message="参数gno不能为空")
99 @Column(name = "GNO") 99 @Column(name = "GNO")
100 private String gno; 100 private String gno;
101 101
...@@ -105,7 +105,7 @@ public class MawbDetail implements Serializable{ ...@@ -105,7 +105,7 @@ public class MawbDetail implements Serializable{
105 private BigDecimal gqty; 105 private BigDecimal gqty;
106 106
107 @ApiModelProperty(value = "原产国") 107 @ApiModelProperty(value = "原产国")
108 - @NotBlank(message="参数originCountry不能为空") 108 + //@NotBlank(message="参数originCountry不能为空")
109 @Column(name = "ORIGINCURRENTY") 109 @Column(name = "ORIGINCURRENTY")
110 private String originCountry; 110 private String originCountry;
111 111
...@@ -118,7 +118,7 @@ public class MawbDetail implements Serializable{ ...@@ -118,7 +118,7 @@ public class MawbDetail implements Serializable{
118 private Integer secondQty; 118 private Integer secondQty;
119 119
120 @ApiModelProperty(value = "成交币制") 120 @ApiModelProperty(value = "成交币制")
121 - @NotBlank(message="参数tradeCurr不能为空") 121 + //@NotBlank(message="参数tradeCurr不能为空")
122 @Column(name = "TRADECURR") 122 @Column(name = "TRADECURR")
123 private String tradeCurr; 123 private String tradeCurr;
124 124
...@@ -135,7 +135,7 @@ public class MawbDetail implements Serializable{ ...@@ -135,7 +135,7 @@ public class MawbDetail implements Serializable{
135 private String ciqCode; 135 private String ciqCode;
136 136
137 @ApiModelProperty(value = "最终目的国(地区)") 137 @ApiModelProperty(value = "最终目的国(地区)")
138 - @NotBlank(message="参数destinationCountry不能为空") 138 + //@NotBlank(message="参数destinationCountry不能为空")
139 @Column(name = "DESTINATIONCOUNTRY") 139 @Column(name = "DESTINATIONCOUNTRY")
140 private String destinationCountry; 140 private String destinationCountry;
141 141
...@@ -148,7 +148,7 @@ public class MawbDetail implements Serializable{ ...@@ -148,7 +148,7 @@ public class MawbDetail implements Serializable{
148 private String destCode; 148 private String destCode;
149 149
150 @ApiModelProperty(value = "境内目的地/境内货源地") 150 @ApiModelProperty(value = "境内目的地/境内货源地")
151 - @NotBlank(message="参数districtCode不能为空") 151 + //@NotBlank(message="参数districtCode不能为空")
152 @Column(name = "DISTRICTCODE") 152 @Column(name = "DISTRICTCODE")
153 private String districtCode; 153 private String districtCode;
154 154
......
...@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RestController;
10 10
11 /** 11 /**
12 * @author Administrator 12 * @author Administrator
13 + *
13 */ 14 */
14 @RestController 15 @RestController
15 @RequestMapping("/system") 16 @RequestMapping("/system")
...@@ -46,7 +47,7 @@ public class IClearExportInterface { ...@@ -46,7 +47,7 @@ public class IClearExportInterface {
46 @GetMapping("/refreshSendMawbe") 47 @GetMapping("/refreshSendMawbe")
47 public String refreshSendMawbe() { 48 public String refreshSendMawbe() {
48 try{ 49 try{
49 - 50 +
50 51
51 return "Success"; 52 return "Success";
52 }catch (Exception e){ 53 }catch (Exception e){
......
...@@ -62,6 +62,14 @@ public class ApiService { ...@@ -62,6 +62,14 @@ public class ApiService {
62 @Value("${api.address.complete-msg-url}") 62 @Value("${api.address.complete-msg-url}")
63 String completeMsgUrl; 63 String completeMsgUrl;
64 64
65 + @Value("${api.address.proxy-url}")
66 + String proxyUrl;
67 + @Value("${api.address.proxy-port}")
68 + Integer proxyPort;
69 +
70 + @Value("${spring.profiles.active}")
71 + String env;
72 +
65 @Autowired 73 @Autowired
66 ReceiptMessageRepository receiptMessageRepository; 74 ReceiptMessageRepository receiptMessageRepository;
67 75
...@@ -89,7 +97,11 @@ public class ApiService { ...@@ -89,7 +97,11 @@ public class ApiService {
89 Map<String,String> map = new HashMap<String,String>(); 97 Map<String,String> map = new HashMap<String,String>();
90 map.put("username", this.username); 98 map.put("username", this.username);
91 map.put("password", this.password); 99 map.put("password", this.password);
92 - String tokenJson = HttpUtils.doPost(this.tokenUrl,map); 100 +// String tokenJson = HttpUtils.doPost(this.tokenUrl,map);
101 + log.info("tokenUrl:"+this.tokenUrl);
102 + String tokenJson = HttpUtils.doProxyPost(this.tokenUrl,map,this.proxyUrl,this.proxyPort);
103 + log.info("getToken:"+tokenJson);
104 +
93 TokenResult tokenResult = JsonToJava.parseJson(tokenJson,TokenResult.class); 105 TokenResult tokenResult = JsonToJava.parseJson(tokenJson,TokenResult.class);
94 return tokenResult; 106 return tokenResult;
95 } 107 }
...@@ -109,6 +121,7 @@ public class ApiService { ...@@ -109,6 +121,7 @@ public class ApiService {
109 * 传输海关回执数据 121 * 传输海关回执数据
110 * @param token 122 * @param token
111 * @throws Exception 123 * @throws Exception
124 + * GNo、codeTs、gName、gModel、gUnit
112 */ 125 */
113 public void pushCustoms(String token){ 126 public void pushCustoms(String token){
114 //获取海关回执数据 127 //获取海关回执数据
...@@ -141,7 +154,8 @@ public class ApiService { ...@@ -141,7 +154,8 @@ public class ApiService {
141 String objJson = JsonToJava.toJson(d); 154 String objJson = JsonToJava.toJson(d);
142 log.info("推送海关回执json: " + objJson); 155 log.info("推送海关回执json: " + objJson);
143 //推送海关回执数据 156 //推送海关回执数据
144 - 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);
145 //接口响应时间 159 //接口响应时间
146 declearTask.setResponseTime(new Date()); 160 declearTask.setResponseTime(new Date());
147 TokenResult tokenResult = JsonToJava.parseJson(json,TokenResult.class); 161 TokenResult tokenResult = JsonToJava.parseJson(json,TokenResult.class);
...@@ -167,6 +181,8 @@ public class ApiService { ...@@ -167,6 +181,8 @@ public class ApiService {
167 declearTask.setResponseResults("99999"); 181 declearTask.setResponseResults("99999");
168 declearTask.setResponseContent(ex.getMessage()); 182 declearTask.setResponseContent(ex.getMessage());
169 declearTaskList.add(declearTask); 183 declearTaskList.add(declearTask);
184 +
185 + log.error(ex.getMessage(),ex);
170 } 186 }
171 }); 187 });
172 declearTaskList.forEach(declearTask -> { 188 declearTaskList.forEach(declearTask -> {
...@@ -237,7 +253,8 @@ public class ApiService { ...@@ -237,7 +253,8 @@ public class ApiService {
237 declearTask.setPushTime(new Date()); 253 declearTask.setPushTime(new Date());
238 String objJson = JsonToJava.toJson(d); 254 String objJson = JsonToJava.toJson(d);
239 //推送海关回执数据 255 //推送海关回执数据
240 - String json = HttpUtils.doPost(this.customsUrl,objJson,headerMap); 256 + String json = HttpUtils.doProxyPost(this.customsUrl,objJson,headerMap,this.proxyUrl,this.proxyPort);
257 + log.info("sendMawb:"+json);
241 //接口响应时间 258 //接口响应时间
242 declearTask.setResponseTime(new Date()); 259 declearTask.setResponseTime(new Date());
243 TokenResult tokenResult = JsonToJava.parseJson(json,TokenResult.class); 260 TokenResult tokenResult = JsonToJava.parseJson(json,TokenResult.class);
...@@ -262,7 +279,8 @@ public class ApiService { ...@@ -262,7 +279,8 @@ public class ApiService {
262 declearTask.setResponseResults("99999"); 279 declearTask.setResponseResults("99999");
263 declearTask.setResponseContent(ex.getMessage()); 280 declearTask.setResponseContent(ex.getMessage());
264 declearTaskList.add(declearTask); 281 declearTaskList.add(declearTask);
265 - log.error("sendMawb",ex); 282 +
283 + log.error(ex.getMessage(),ex);
266 } 284 }
267 }); 285 });
268 declearTaskList.forEach(declearTask -> { 286 declearTaskList.forEach(declearTask -> {
......
...@@ -234,7 +234,7 @@ public class ChmConsignmentService { ...@@ -234,7 +234,7 @@ public class ChmConsignmentService {
234 234
235 }catch (Exception e){ 235 }catch (Exception e){
236 result=null; 236 result=null;
237 - log.error("sendMawb",e); 237 + log.error(e.getMessage(),e);
238 } 238 }
239 return result; 239 return result;
240 } 240 }
...@@ -291,7 +291,7 @@ public class ChmConsignmentService { ...@@ -291,7 +291,7 @@ public class ChmConsignmentService {
291 } 291 }
292 }catch (Exception e){ 292 }catch (Exception e){
293 result=null; 293 result=null;
294 - log.error("convertToChmConsignmentFedex() error:"+e.getMessage(),e); 294 + log.error(e.getMessage(),e);
295 } 295 }
296 return result; 296 return result;
297 } 297 }
...@@ -428,7 +428,7 @@ public class ChmConsignmentService { ...@@ -428,7 +428,7 @@ public class ChmConsignmentService {
428 result.setOverseasConsigneeEname(consignment.getOverseasConsignorFnCname()); 428 result.setOverseasConsigneeEname(consignment.getOverseasConsignorFnCname());
429 }catch (Exception e){ 429 }catch (Exception e){
430 result=null; 430 result=null;
431 - log.error("convertToChmConsignment() error:"+e.getMessage(),e); 431 + log.error(e.getMessage(),e);
432 } 432 }
433 return result; 433 return result;
434 } 434 }
......
...@@ -13,6 +13,8 @@ import java.util.List; ...@@ -13,6 +13,8 @@ import java.util.List;
13 @Slf4j 13 @Slf4j
14 public class FedexConsignmentService { 14 public class FedexConsignmentService {
15 15
16 +
17 +
16 public List<FedexConsignment> fedexConsignmentList(List<DeclaredInfo> consignment){ 18 public List<FedexConsignment> fedexConsignmentList(List<DeclaredInfo> consignment){
17 List<FedexConsignment> fedexConsignmentList = new ArrayList<>(); 19 List<FedexConsignment> fedexConsignmentList = new ArrayList<>();
18 try{ 20 try{
......
1 package com.erry.iclear.dateInterface.service; 1 package com.erry.iclear.dateInterface.service;
2 2
3 +import com.alibaba.fastjson.JSON;
3 import com.arronlong.httpclientutil.HttpClientUtil; 4 import com.arronlong.httpclientutil.HttpClientUtil;
4 import com.arronlong.httpclientutil.common.HttpConfig; 5 import com.arronlong.httpclientutil.common.HttpConfig;
5 import com.arronlong.httpclientutil.common.HttpHeader; 6 import com.arronlong.httpclientutil.common.HttpHeader;
...@@ -9,6 +10,7 @@ import com.erry.iclear.dateInterface.api.response.ResultRS; ...@@ -9,6 +10,7 @@ import com.erry.iclear.dateInterface.api.response.ResultRS;
9 import com.erry.iclear.dateInterface.entity.ChmConsignment; 10 import com.erry.iclear.dateInterface.entity.ChmConsignment;
10 import com.erry.iclear.dateInterface.entity.ChmConsignmentDetail; 11 import com.erry.iclear.dateInterface.entity.ChmConsignmentDetail;
11 import com.erry.iclear.dateInterface.repository.FedexMawbRepository; 12 import com.erry.iclear.dateInterface.repository.FedexMawbRepository;
13 +import com.erry.iclear.dateInterface.util.HttpUtils;
12 import com.erry.iclear.dateInterface.util.JsonToJava; 14 import com.erry.iclear.dateInterface.util.JsonToJava;
13 import com.google.gson.Gson; 15 import com.google.gson.Gson;
14 import io.swagger.annotations.ApiModelProperty; 16 import io.swagger.annotations.ApiModelProperty;
...@@ -17,15 +19,17 @@ import org.apache.commons.lang3.StringUtils; ...@@ -17,15 +19,17 @@ import org.apache.commons.lang3.StringUtils;
17 import org.apache.http.Header; 19 import org.apache.http.Header;
18 import org.springframework.beans.factory.annotation.Autowired; 20 import org.springframework.beans.factory.annotation.Autowired;
19 import org.springframework.beans.factory.annotation.Value; 21 import org.springframework.beans.factory.annotation.Value;
22 +import org.springframework.http.HttpEntity;
23 +import org.springframework.http.HttpHeaders;
24 +import org.springframework.http.HttpMethod;
25 +import org.springframework.http.ResponseEntity;
20 import org.springframework.stereotype.Service; 26 import org.springframework.stereotype.Service;
21 27
22 import javax.persistence.*; 28 import javax.persistence.*;
23 import javax.validation.Valid; 29 import javax.validation.Valid;
24 import javax.validation.constraints.NotBlank; 30 import javax.validation.constraints.NotBlank;
25 import javax.validation.constraints.NotNull; 31 import javax.validation.constraints.NotNull;
26 -import java.util.ArrayList; 32 +import java.util.*;
27 -import java.util.List;
28 -import java.util.Objects;
29 import java.util.stream.Collectors; 33 import java.util.stream.Collectors;
30 34
31 /** 35 /**
...@@ -142,17 +146,23 @@ public class FedexService { ...@@ -142,17 +146,23 @@ public class FedexService {
142 146
143 //调用IClear接口进行运单数据校验 147 //调用IClear接口进行运单数据校验
144 String objJson = JsonToJava.toJson(chmConsignment); 148 String objJson = JsonToJava.toJson(chmConsignment);
145 - Header[] headers = HttpHeader.custom() 149 +// Header[] headers = HttpHeader.custom()
146 - .other("Content-Type", "application/json") 150 +// .other("Content-Type", "application/json")
147 - .build(); 151 +// .build();
148 - log.info("******************* : " + this.iclearCheckUrl); 152 +// log.info("******************* : " + this.iclearCheckUrl);
149 - //推送海关回执数据 153 +// //推送海关回执数据
150 - HttpConfig config = HttpConfig.custom() 154 +// HttpConfig config = HttpConfig.custom()
151 - .headers(headers) 155 +// .headers(headers)
152 - .url(this.iclearCheckUrl) 156 +// .url(this.iclearCheckUrl)
153 - .encoding("utf-8") 157 +// .encoding("utf-8")
154 - .json(objJson); 158 +// .json(objJson);
155 - String json = HttpClientUtil.post(config); 159 +// String json = HttpClientUtil.post(config);
160 + Map<String,String> headerMap = new HashMap<>();
161 + headerMap.put("Content-Type", "application/json");
162 + String json = HttpUtils.doPost(this.iclearCheckUrl,objJson,headerMap);
163 +
164 + log.info("iclearCheckUrl:"+json);
165 +
156 IClearCheckResponseResult iclearCheckResponseResult = JsonToJava.parseJson(json, IClearCheckResponseResult.class); 166 IClearCheckResponseResult iclearCheckResponseResult = JsonToJava.parseJson(json, IClearCheckResponseResult.class);
157 result.setSuccess(iclearCheckResponseResult.getSuccess()); 167 result.setSuccess(iclearCheckResponseResult.getSuccess());
158 result.setCode(iclearCheckResponseResult.getCode()); 168 result.setCode(iclearCheckResponseResult.getCode());
......
...@@ -83,7 +83,6 @@ public class HsCodeService { ...@@ -83,7 +83,6 @@ public class HsCodeService {
83 resultHsCode.setHsCodeResultList(hsCodeList); 83 resultHsCode.setHsCodeResultList(hsCodeList);
84 }catch(Exception ex){ 84 }catch(Exception ex){
85 log.error(ex.getMessage(),ex); 85 log.error(ex.getMessage(),ex);
86 -
87 resultHsCode.setSuccess(Boolean.FALSE); 86 resultHsCode.setSuccess(Boolean.FALSE);
88 resultHsCode.setCode("30101"); 87 resultHsCode.setCode("30101");
89 resultHsCode.setMsg("数据查询异常"); 88 resultHsCode.setMsg("数据查询异常");
......
...@@ -44,7 +44,7 @@ public class IClearApiHsCodeLogService { ...@@ -44,7 +44,7 @@ public class IClearApiHsCodeLogService {
44 rs = true; 44 rs = true;
45 } 45 }
46 }catch(Exception ex){ 46 }catch(Exception ex){
47 - log.error(ex.getMessage(),ex); 47 + log.error(ex.getMessage(),ex);
48 } 48 }
49 return rs; 49 return rs;
50 } 50 }
......
...@@ -2,14 +2,20 @@ package com.erry.iclear.dateInterface.service; ...@@ -2,14 +2,20 @@ package com.erry.iclear.dateInterface.service;
2 2
3 import com.erry.iclear.dateInterface.api.request.Fedexc; 3 import com.erry.iclear.dateInterface.api.request.Fedexc;
4 import com.erry.iclear.dateInterface.api.request.Mawb; 4 import com.erry.iclear.dateInterface.api.request.Mawb;
5 +import com.erry.iclear.dateInterface.api.request.MawbDetail;
5 import com.erry.iclear.dateInterface.common.Constant; 6 import com.erry.iclear.dateInterface.common.Constant;
6 import com.erry.iclear.dateInterface.entity.IClearApiLog; 7 import com.erry.iclear.dateInterface.entity.IClearApiLog;
7 import com.erry.iclear.dateInterface.repository.IClearApiLogRepository; 8 import com.erry.iclear.dateInterface.repository.IClearApiLogRepository;
9 +import com.erry.iclear.dateInterface.util.StringUtil;
8 import lombok.extern.slf4j.Slf4j; 10 import lombok.extern.slf4j.Slf4j;
9 import org.springframework.beans.factory.annotation.Autowired; 11 import org.springframework.beans.factory.annotation.Autowired;
10 import org.springframework.stereotype.Service; 12 import org.springframework.stereotype.Service;
11 13
14 +import javax.validation.Valid;
15 +import javax.validation.constraints.NotBlank;
12 import java.util.Date; 16 import java.util.Date;
17 +import java.util.List;
18 +import java.util.Objects;
13 19
14 /** 20 /**
15 * @author Administrator 21 * @author Administrator
...@@ -30,7 +36,7 @@ public class IClearApiLogService { ...@@ -30,7 +36,7 @@ public class IClearApiLogService {
30 try{ 36 try{
31 return iClearApiLogRepository.save(iClearApiLog); 37 return iClearApiLogRepository.save(iClearApiLog);
32 }catch (Exception e){ 38 }catch (Exception e){
33 - log.error("saveIClearApiLog() error:"+ e.getMessage()); 39 + log.error(e.getMessage(),e);
34 } 40 }
35 return null; 41 return null;
36 } 42 }
......
...@@ -4,11 +4,13 @@ import com.arronlong.httpclientutil.HttpClientUtil; ...@@ -4,11 +4,13 @@ import com.arronlong.httpclientutil.HttpClientUtil;
4 import com.arronlong.httpclientutil.common.HttpConfig; 4 import com.arronlong.httpclientutil.common.HttpConfig;
5 import com.arronlong.httpclientutil.common.HttpHeader; 5 import com.arronlong.httpclientutil.common.HttpHeader;
6 import com.erry.iclear.dateInterface.api.request.Mawb; 6 import com.erry.iclear.dateInterface.api.request.Mawb;
7 +import com.erry.iclear.dateInterface.api.request.MawbDetail;
7 import com.erry.iclear.dateInterface.api.response.IClearCheckResponseResult; 8 import com.erry.iclear.dateInterface.api.response.IClearCheckResponseResult;
8 import com.erry.iclear.dateInterface.api.response.ResultRS; 9 import com.erry.iclear.dateInterface.api.response.ResultRS;
9 import com.erry.iclear.dateInterface.entity.ChmConsignment; 10 import com.erry.iclear.dateInterface.entity.ChmConsignment;
10 import com.erry.iclear.dateInterface.entity.ChmConsignmentDetail; 11 import com.erry.iclear.dateInterface.entity.ChmConsignmentDetail;
11 import com.erry.iclear.dateInterface.repository.MawbRepository; 12 import com.erry.iclear.dateInterface.repository.MawbRepository;
13 +import com.erry.iclear.dateInterface.util.HttpUtils;
12 import com.erry.iclear.dateInterface.util.JsonToJava; 14 import com.erry.iclear.dateInterface.util.JsonToJava;
13 import com.erry.iclear.dateInterface.util.StringUtil; 15 import com.erry.iclear.dateInterface.util.StringUtil;
14 import com.google.gson.Gson; 16 import com.google.gson.Gson;
...@@ -62,6 +64,113 @@ public class MawbService { ...@@ -62,6 +64,113 @@ public class MawbService {
62 } 64 }
63 65
64 66
67 + public String checkMawbBaseInfo(Mawb mawb){
68 +
69 + if(StringUtil.isEmpty(mawb.getOverseasConsigneeEname())){
70 + return "参数overseasConsigneeEname不能为空";
71 + }
72 +// if(StringUtil.isEmpty(mawb.getEntyPortCode())){
73 +// return "参数entyPortCode不能为空";
74 +// }
75 + if(StringUtil.isEmpty(mawb.getOwnerCodeScc())){
76 + return "参数ownerCodeScc不能为空";
77 + }
78 + if(StringUtil.isEmpty(mawb.getTradeCodeScc())){
79 + return "参数tradeCodeScc不能为空";
80 + }
81 + if(StringUtil.isEmpty(mawb.getTransMode())){
82 + return "参数transMode不能为空";
83 + }
84 + if(StringUtil.isEmpty(mawb.getWrapType())){
85 + return "参数wrapType不能为空";
86 + }
87 + if(StringUtil.isEmpty(mawb.getTradeName())){
88 + return "参数tradeName不能为空";
89 + }
90 +// if(StringUtil.isEmpty(mawb.getInsurCurr())){
91 +// return "参数insurCurr不能为空";
92 +// }
93 + if(StringUtil.isEmpty(mawb.getIePort())){
94 + return "参数iePort不能为空";
95 + }
96 +// if(StringUtil.isEmpty(mawb.getFeeMark())){
97 +// return "参数feeMark不能为空";
98 +// }
99 +// if(StringUtil.isEmpty(mawb.getFeeCurr())){
100 +// return "参数feeCurr不能为空";
101 +// }
102 +// if(StringUtil.isEmpty(mawb.getEdiId())){
103 +// return "参数ediId不能为空";
104 +// }
105 + if(StringUtil.isEmpty(mawb.getDistinatePort())){
106 + return "参数distinatePort不能为空";
107 + }
108 +// if(StringUtil.isEmpty(mawb.getDeclTrnRel())){
109 +// return "参数declTrnRel不能为空";
110 +// }
111 + if(StringUtil.isEmpty(mawb.getCutMode())){
112 + return "参数cutMode不能为空";
113 + }
114 + if(StringUtil.isEmpty(mawb.getCustomMaster())){
115 + return "参数customMaster不能为空";
116 + }
117 + if(StringUtil.isEmpty(mawb.getBillNo())){
118 + return "参数billNo不能为空";
119 + }
120 + if(StringUtil.isEmpty(mawb.getAgentName())){
121 + return "参数agentName不能为空";
122 + }
123 + if(StringUtil.isEmpty(mawb.getAgentCode())){
124 + return "参数agentCode不能为空";
125 + }
126 +
127 + List<MawbDetail> mawbDetailList = mawb.getMawbDetailList();
128 + if(Objects.nonNull(mawbDetailList)){
129 + for (int i = 0, maxi = mawbDetailList.size(); i < maxi; i++) {
130 + MawbDetail mawbDetail = mawbDetailList.get(i);
131 + if(StringUtil.isEmpty(mawbDetail.getDetailId())){
132 + return "参数detailId不能为空";
133 + }
134 + if(StringUtil.isEmpty(mawbDetail.getCodeTS())){
135 + return "参数codeTS不能为空";
136 + }
137 + if(StringUtil.isEmpty(mawbDetail.getDutyMode())){
138 + return "参数dutyMode不能为空";
139 + }
140 + if(StringUtil.isEmpty(mawbDetail.getFirstUnit())){
141 + return "参数firstUnit不能为空";
142 + }
143 + if(StringUtil.isEmpty(mawbDetail.getGunit())){
144 + return "参数gunit不能为空";
145 + }
146 + if(StringUtil.isEmpty(mawbDetail.getGmodel())){
147 + return "参数gmodel不能为空";
148 + }
149 + if(StringUtil.isEmpty(mawbDetail.getGname())){
150 + return "参数gname不能为空";
151 + }
152 + if(StringUtil.isEmpty(mawbDetail.getGno())){
153 + return "参数gno不能为空";
154 + }
155 + if(StringUtil.isEmpty(mawbDetail.getOriginCountry())){
156 + return "参数originCountry不能为空";
157 + }
158 + if(StringUtil.isEmpty(mawbDetail.getTradeCurr())){
159 + return "参数tradeCurr不能为空";
160 + }
161 + if(StringUtil.isEmpty(mawbDetail.getDestinationCountry())){
162 + return "参数destinationCountry不能为空";
163 + }
164 + if(StringUtil.isEmpty(mawbDetail.getDistrictCode())){
165 + return "参数districtCode不能为空";
166 + }
167 + }
168 + }
169 +
170 + return "";
171 + }
172 +
173 +
65 /** 174 /**
66 * 校验主单 175 * 校验主单
67 * @param mawb 176 * @param mawb
...@@ -93,17 +202,24 @@ public class MawbService { ...@@ -93,17 +202,24 @@ public class MawbService {
93 202
94 //调用IClear接口进行运单数据校验 203 //调用IClear接口进行运单数据校验
95 String objJson = JsonToJava.toJson(chmConsignment); 204 String objJson = JsonToJava.toJson(chmConsignment);
96 - Header[] headers = HttpHeader.custom() 205 +// Header[] headers = HttpHeader.custom()
97 - .other("Content-Type", "application/json") 206 +// .other("Content-Type", "application/json")
98 - .build(); 207 +// .build();
99 - log.info("******************* : " + this.iclearCheckUrl); 208 +// log.info("******************* : " + this.iclearCheckUrl);
100 - //推送海关回执数据 209 +// //推送海关回执数据
101 - HttpConfig config = HttpConfig.custom() 210 +// HttpConfig config = HttpConfig.custom()
102 - .headers(headers) 211 +// .headers(headers)
103 - .url(this.iclearCheckUrl) 212 +// .url(this.iclearCheckUrl)
104 - .encoding("utf-8") 213 +// .encoding("utf-8")
105 - .json(objJson); 214 +// .json(objJson);
106 - String json = HttpClientUtil.post(config); 215 +// String json = HttpClientUtil.post(config);
216 +
217 + Map<String,String> headerMap = new HashMap<>();
218 + headerMap.put("Content-Type", "application/json");
219 + String json = HttpUtils.doPost(this.iclearCheckUrl,objJson,headerMap);
220 +
221 +
222 +
107 IClearCheckResponseResult iclearCheckResponseResult = JsonToJava.parseJson(json, IClearCheckResponseResult.class); 223 IClearCheckResponseResult iclearCheckResponseResult = JsonToJava.parseJson(json, IClearCheckResponseResult.class);
108 result.setSuccess(iclearCheckResponseResult.getSuccess()); 224 result.setSuccess(iclearCheckResponseResult.getSuccess());
109 result.setCode(iclearCheckResponseResult.getCode()); 225 result.setCode(iclearCheckResponseResult.getCode());
......
...@@ -54,10 +54,31 @@ public class IClearApiTask { ...@@ -54,10 +54,31 @@ public class IClearApiTask {
54 log.error("pushMawbTask() error:" +e.getMessage()); 54 log.error("pushMawbTask() error:" +e.getMessage());
55 } 55 }
56 } 56 }
57 - /* 57 + /**
58 - * wy on 2022年1月20日17:50:57 58 + * 获取token
59 - * 经clj确认,这两个任务没有必要 59 + * @throws Exception
60 - * *//** 60 + */
61 + private void getToken() throws Exception{
62 + if(token == null){
63 + try {
64 + //获取token
65 + TokenResult tokenResult = apiService.getToken();
66 + if(tokenResult.getErrorcode().equals(Constants.ApiResponseKeys.SUCCESS)){
67 + this.token = tokenResult.getData().getToken();
68 + }
69 + }catch(Exception ex){
70 + log.error(ex.getMessage(),ex);
71 + }
72 + }
73 + if(this.token == null){
74 + throw new Exception("获取token失败!");
75 + }
76 + }
77 +
78 + /*
79 + * wy on 2022年1月20日17:50:57
80 + * 经clj确认,这两个任务没有必要
81 + * *//**
61 * TODO 定时任务:每分钟推送: 推送失败的回执数据, 82 * TODO 定时任务:每分钟推送: 推送失败的回执数据,
62 *//* 83 *//*
63 @Scheduled(cron = "${task.pushErrorReturnDate}") 84 @Scheduled(cron = "${task.pushErrorReturnDate}")
...@@ -90,25 +111,4 @@ public class IClearApiTask { ...@@ -90,25 +111,4 @@ public class IClearApiTask {
90 }*//* 111 }*//*
91 }*/ 112 }*/
92 113
93 - /**
94 - * 获取token
95 - * @throws Exception
96 - */
97 - private void getToken() throws Exception{
98 - if(token == null){
99 - try {
100 - //获取token
101 - TokenResult tokenResult = apiService.getToken();
102 - if(tokenResult.getErrorcode().equals(Constants.ApiResponseKeys.SUCCESS)){
103 - this.token = tokenResult.getData().getToken();
104 - }
105 - }catch(Exception ex){
106 -
107 - log.error(ex.getMessage(),ex);
108 - }
109 - }
110 - if(this.token == null){
111 - throw new Exception("获取token失败!");
112 - }
113 - }
114 } 114 }
......
1 package com.erry.iclear.dateInterface.util; 1 package com.erry.iclear.dateInterface.util;
2 2
3 +import java.io.IOException;
3 import java.util.ArrayList; 4 import java.util.ArrayList;
4 import java.util.Iterator; 5 import java.util.Iterator;
5 import java.util.List; 6 import java.util.List;
6 import java.util.Map; 7 import java.util.Map;
7 import java.util.Map.Entry; 8 import java.util.Map.Entry;
8 import org.apache.http.HttpEntity; 9 import org.apache.http.HttpEntity;
10 +import org.apache.http.HttpHost;
9 import org.apache.http.HttpResponse; 11 import org.apache.http.HttpResponse;
10 import org.apache.http.NameValuePair; 12 import org.apache.http.NameValuePair;
11 import org.apache.http.client.HttpClient; 13 import org.apache.http.client.HttpClient;
12 import org.apache.http.client.entity.UrlEncodedFormEntity; 14 import org.apache.http.client.entity.UrlEncodedFormEntity;
13 import org.apache.http.client.methods.HttpPost; 15 import org.apache.http.client.methods.HttpPost;
16 +import org.apache.http.conn.params.ConnRoutePNames;
14 import org.apache.http.entity.StringEntity; 17 import org.apache.http.entity.StringEntity;
18 +import org.apache.http.impl.client.HttpClientBuilder;
15 import org.apache.http.message.BasicNameValuePair; 19 import org.apache.http.message.BasicNameValuePair;
16 import org.apache.http.util.EntityUtils; 20 import org.apache.http.util.EntityUtils;
21 +import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
17 22
18 /** 23 /**
19 * 利用HttpClient进行post请求的工具类 24 * 利用HttpClient进行post请求的工具类
...@@ -23,6 +28,88 @@ import org.apache.http.util.EntityUtils; ...@@ -23,6 +28,88 @@ import org.apache.http.util.EntityUtils;
23 public class HttpUtils { 28 public class HttpUtils {
24 private static String CHARSET = "utf-8"; 29 private static String CHARSET = "utf-8";
25 30
31 +
32 + /**
33 + * post请求
34 + * @param url
35 + * @param json
36 + * @return
37 + */
38 + public static String doProxyPost(String url,String json,Map<String,String> headerMap,String proxyUrl,Integer port) throws Exception {
39 + HttpClient httpClient = null;
40 + HttpPost httpPost = null;
41 + String result = null;
42 +
43 + httpClient = SSLClient.getProxyHttpsClient(proxyUrl,port);
44 +
45 + try{
46 + httpPost = new HttpPost(url);
47 + //设置参数
48 + List<NameValuePair> list = new ArrayList<NameValuePair>();
49 + StringEntity entity = new StringEntity(json, HttpUtils.CHARSET);//解决中文乱码问题
50 + entity.setContentEncoding("UTF-8");
51 + entity.setContentType("application/json");
52 + httpPost.setEntity(entity);
53 +
54 + Iterator headerIterator = headerMap.entrySet().iterator();
55 + while(headerIterator.hasNext()){
56 + Entry<String,String> elem = (Entry<String, String>) headerIterator.next();
57 + httpPost.addHeader(elem.getKey(),elem.getValue());
58 + }
59 +
60 +// /** 设置代理IP **/
61 +// HttpHost proxy = new HttpHost(proxyUrl, 3128);
62 +// httpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY,proxy);
63 +
64 + HttpResponse response = httpClient.execute(httpPost);
65 + if(response != null){
66 + HttpEntity resEntity = response.getEntity();
67 + if(resEntity != null){
68 + result = EntityUtils.toString(resEntity,HttpUtils.CHARSET);
69 + }
70 + }
71 + } finally {
72 + httpClient.getConnectionManager().shutdown(); //关闭连接
73 + }
74 + return result;
75 + }
76 +
77 +
78 + public static String doProxyPost(String url,Map<String,String> paramMap,String proxyUrl,Integer port) throws Exception {
79 +
80 +// HttpClient httpClient = null;
81 + HttpPost httpPost = null;
82 + String result = null;
83 + HttpClient httpClient = SSLClient.getProxyHttpsClient(proxyUrl,port);
84 + try{
85 + httpPost = new HttpPost(url);
86 + //设置参数
87 + List<NameValuePair> list = new ArrayList<NameValuePair>();
88 + Iterator iterator = paramMap.entrySet().iterator();
89 + while(iterator.hasNext()){
90 + Entry<String,String> elem = (Entry<String, String>) iterator.next();
91 + list.add(new BasicNameValuePair(elem.getKey(),elem.getValue()));
92 + }
93 + if(list.size() > 0){
94 + UrlEncodedFormEntity entity = new UrlEncodedFormEntity(list,HttpUtils.CHARSET);
95 + httpPost.setEntity(entity);
96 + }
97 + /** 设置代理IP **/
98 +// HttpHost proxy = new HttpHost(proxyUrl, 3128);
99 +// httpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY,proxy);
100 +
101 + HttpResponse response = httpClient.execute(httpPost);
102 + if(response != null){
103 + HttpEntity resEntity = response.getEntity();
104 + if(resEntity != null){
105 + result = EntityUtils.toString(resEntity,HttpUtils.CHARSET);
106 + }
107 + }
108 + } finally {
109 + httpClient.getConnectionManager().shutdown(); //关闭连接
110 + }
111 + return result;
112 + }
26 /** 113 /**
27 * post请求 114 * post请求
28 * @param url 115 * @param url
...@@ -62,6 +149,7 @@ public class HttpUtils { ...@@ -62,6 +149,7 @@ public class HttpUtils {
62 return result; 149 return result;
63 } 150 }
64 151
152 +
65 /** 153 /**
66 * post请求 map参数 154 * post请求 map参数
67 * @param url 155 * @param url
...@@ -141,4 +229,4 @@ public class HttpUtils { ...@@ -141,4 +229,4 @@ public class HttpUtils {
141 } 229 }
142 return result; 230 return result;
143 } 231 }
144 -}
...\ No newline at end of file ...\ No newline at end of file
232 +}
......
1 package com.erry.iclear.dateInterface.util; 1 package com.erry.iclear.dateInterface.util;
2 2
3 +import java.io.IOException;
4 +import java.security.KeyManagementException;
5 +import java.security.NoSuchAlgorithmException;
3 import java.security.cert.CertificateException; 6 import java.security.cert.CertificateException;
4 import java.security.cert.X509Certificate; 7 import java.security.cert.X509Certificate;
5 import javax.net.ssl.SSLContext; 8 import javax.net.ssl.SSLContext;
6 import javax.net.ssl.TrustManager; 9 import javax.net.ssl.TrustManager;
7 import javax.net.ssl.X509TrustManager; 10 import javax.net.ssl.X509TrustManager;
11 +
12 +import com.alibaba.fastjson.JSONObject;
13 +import org.apache.http.HttpHost;
14 +import org.apache.http.client.config.RequestConfig;
15 +import org.apache.http.client.methods.CloseableHttpResponse;
16 +import org.apache.http.client.methods.HttpGet;
8 import org.apache.http.conn.ClientConnectionManager; 17 import org.apache.http.conn.ClientConnectionManager;
9 import org.apache.http.conn.scheme.Scheme; 18 import org.apache.http.conn.scheme.Scheme;
10 import org.apache.http.conn.scheme.SchemeRegistry; 19 import org.apache.http.conn.scheme.SchemeRegistry;
20 +import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
11 import org.apache.http.conn.ssl.SSLSocketFactory; 21 import org.apache.http.conn.ssl.SSLSocketFactory;
22 +import org.apache.http.impl.client.CloseableHttpClient;
12 import org.apache.http.impl.client.DefaultHttpClient; 23 import org.apache.http.impl.client.DefaultHttpClient;
24 +import org.apache.http.impl.client.HttpClients;
25 +import org.apache.http.util.EntityUtils;
13 26
14 /** 27 /**
15 * 用于进行Https请求的HttpClient,指定传输协议为TLSv1.2 28 * 用于进行Https请求的HttpClient,指定传输协议为TLSv1.2
...@@ -19,6 +32,9 @@ import org.apache.http.impl.client.DefaultHttpClient; ...@@ -19,6 +32,9 @@ import org.apache.http.impl.client.DefaultHttpClient;
19 public class SSLClient extends DefaultHttpClient{ 32 public class SSLClient extends DefaultHttpClient{
20 public SSLClient() throws Exception{ 33 public SSLClient() throws Exception{
21 super(); //传输协议需要根据自己的判断  34 super(); //传输协议需要根据自己的判断 
35 + trustAllHosts();
36 + }
37 + private void trustAllHosts() throws NoSuchAlgorithmException, KeyManagementException {
22 SSLContext ctx = SSLContext.getInstance("TLSv1.2"); 38 SSLContext ctx = SSLContext.getInstance("TLSv1.2");
23 X509TrustManager tm = new X509TrustManager() { 39 X509TrustManager tm = new X509TrustManager() {
24 @Override 40 @Override
...@@ -40,4 +56,40 @@ public class SSLClient extends DefaultHttpClient{ ...@@ -40,4 +56,40 @@ public class SSLClient extends DefaultHttpClient{
40 SchemeRegistry sr = ccm.getSchemeRegistry(); 56 SchemeRegistry sr = ccm.getSchemeRegistry();
41 sr.register(new Scheme("https", 443, ssf)); 57 sr.register(new Scheme("https", 443, ssf));
42 } 58 }
43 -}
...\ No newline at end of file ...\ No newline at end of file
59 +
60 + public CloseableHttpClient getProxyHttpClient(String qlb,int port){
61 + HttpHost proxy = new HttpHost(qlb, port, "http");
62 + //把代理设置到请求配置
63 + RequestConfig defaultRequestConfig = RequestConfig.custom()
64 + .setProxy(proxy)
65 + .build();
66 + CloseableHttpClient httpclient = HttpClients.custom().setDefaultRequestConfig(defaultRequestConfig).build();
67 + return httpclient;
68 + }
69 +
70 + public static CloseableHttpClient getProxyHttpsClient(String qlb,Integer port) throws NoSuchAlgorithmException, KeyManagementException {
71 + X509TrustManager x509mgr = new X509TrustManager() {
72 + @Override
73 + public void checkClientTrusted(X509Certificate[] xcs, String string) {
74 + }
75 + @Override
76 + public void checkServerTrusted(X509Certificate[] xcs, String string) {
77 + }
78 + @Override
79 + public X509Certificate[] getAcceptedIssuers() {
80 + return null;
81 + }
82 + };
83 + SSLContext sslContext = SSLContext.getInstance("TLS");
84 + sslContext.init(null, new TrustManager[] { x509mgr }, null);
85 + SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslContext, SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
86 + HttpHost proxy = new HttpHost(qlb, port, "http");
87 + RequestConfig defaultRequestConfig = RequestConfig.custom()
88 + .setProxy(proxy)
89 + .build();
90 + CloseableHttpClient httpclient = HttpClients.custom().setSSLSocketFactory(sslsf)
91 + .setDefaultRequestConfig(defaultRequestConfig).build();
92 + return httpclient;
93 + }
94 +
95 +}
......
1 spring: 1 spring:
2 + servlet:
3 + context-path: /API
2 datasource: 4 datasource:
3 - url: jdbc:sqlserver://40.73.78.157:1433;DatabaseName=IClearDev 5 + # jndi-name: jdbc/iclearDS
4 - username: sa 6 + jndi-name: jdbc/iclearProdTestDS
5 - password: Fedex_123 7 +# url: jdbc:sqlserver://40.73.78.157:1433;DatabaseName=IClearUat
6 - driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver 8 +# username: sa
7 - type: com.alibaba.druid.pool.DruidDataSource 9 +# password: Fedex_123
10 +# driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
11 +# type: com.alibaba.druid.pool.DruidDataSource
12 +
8 13
9 task: 14 task:
10 #推送海关回执 15 #推送海关回执
11 - pushCustomsTask: 0 0/1 * * * ? 16 + pushCustomsTask: 0 0/1 * 1 * ?
12 #推送完整报文 17 #推送完整报文
13 - pushMawbTask: 0 0/1 * * * ? 18 + pushMawbTask: 0 0/1 * 1 * ?
14 #推送失败的回执数据 19 #推送失败的回执数据
15 - pushErrorReturnDate: 0 0/30 * * * ? 20 + pushErrorReturnDate: 0 0/3 * 1 * ?
16 #推送失败的申报数据 21 #推送失败的申报数据
17 - pushErrorDeclareDate: 0 0/30 * * * ? 22 + pushErrorDeclareDate: 0 0/3 * 1 * ?
18 -
19 23
20 #推送地址 24 #推送地址
21 api: 25 api:
26 + base-address: https://declarationuat.fedex.com.cn/Exp
22 token-info: 27 token-info:
23 #获取token账号 28 #获取token账号
24 username: iclear_external_ctm 29 username: iclear_external_ctm
25 #获取token密码 30 #获取token密码
26 password: toQu3arch6 31 password: toQu3arch6
27 address: 32 address:
28 - #IClear校验运单地址
29 - iclear-check-url: http://139.217.114.139:8082/chmConsignmentController/checkChmAndDetaliD
30 #IClearC类提交运单地址 33 #IClearC类提交运单地址
31 - iclear-submit-url: http://139.217.114.139:8082/chmConsignmentController/submitConsignments 34 + iclear-submit-url: ${api.base-address}/chmConsignmentController/submitConsignments
35 + #IClear校验运单地址
36 + iclear-check-url: ${api.base-address}/chmConsignmentController/checkChmAndDetaliD
32 #IClear校验C类运单地址 37 #IClear校验C类运单地址
33 - iclear-check-url-c: http://139.217.114.139:8082/chmConsignmentController/checkChmAndDetaliC 38 + iclear-check-url-c: ${api.base-address}/chmConsignmentController/checkChmAndDetaliC
34 #获取token地址 39 #获取token地址
35 token-url: https://apiuat.iclrccd-fedex.com/login 40 token-url: https://apiuat.iclrccd-fedex.com/login
41 + # token-url: https://apictm.iclrccd-fedex.com/login
36 #刷新token地址 42 #刷新token地址
37 - refresh-token-url: https://apiuat.iclrccd-fedex.com/admin/user/token/refresh 43 + refresh-token-url: https://apiuat.iclrccd-fedex.com/user/token/refresh
38 #传输海关回执地址 44 #传输海关回执地址
39 customs-url: https://apiuat.iclrccd-fedex.com/export/outbound/customs 45 customs-url: https://apiuat.iclrccd-fedex.com/export/outbound/customs
40 #推送完整报文地址 46 #推送完整报文地址
41 complete-msg-url: https://apiuat.iclrccd-fedex.com/export/outbound/mawb 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: 1 spring:
2 + servlet:
3 + context-path: /API
2 datasource: 4 datasource:
3 - url: jdbc:sqlserver://yilansql.database.chinacloudapi.cn:1433;DatabaseName=IClear_Prod 5 + jndi-name: jdbc/iclearDS
4 - username: sqladmin 6 +# jndi-name: jdbc/iclearProdTestDS
5 - password: ZXC1@3asd2019 7 +# url: jdbc:sqlserver://40.73.78.157:1433;DatabaseName=IClearUat
6 - driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver 8 +# username: sa
7 - type: com.alibaba.druid.pool.DruidDataSource 9 +# password: Fedex_123
10 +# driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
11 +# type: com.alibaba.druid.pool.DruidDataSource
12 +
8 13
9 task: 14 task:
10 #推送海关回执 15 #推送海关回执
...@@ -18,18 +23,19 @@ task: ...@@ -18,18 +23,19 @@ task:
18 23
19 #推送地址 24 #推送地址
20 api: 25 api:
26 + base-address: https://declaration.fedex.com.cn/Exp
21 token-info: 27 token-info:
22 #获取token账号 非prod 28 #获取token账号 非prod
23 username: iclear_export_prod 29 username: iclear_export_prod
24 #获取token密码 30 #获取token密码
25 password: 1qaz@WSX 31 password: 1qaz@WSX
26 address: 32 address:
27 - #IClear校验运单地址
28 - iclear-check-url: https://www.iclrccd-fedex.com/chmConsignmentController/checkChmAndDetaliD
29 #IClearC类提交运单地址 33 #IClearC类提交运单地址
30 - iclear-submit-url: https://www.iclrccd-fedex.com/chmConsignmentController/submitConsignments 34 + iclear-submit-url: ${api.base-address}/chmConsignmentController/submitConsignments
35 + #IClear校验运单地址
36 + iclear-check-url: ${api.base-address}/chmConsignmentController/checkChmAndDetaliD
31 #IClear校验C类运单地址 37 #IClear校验C类运单地址
32 - iclear-check-url-c: https://www.iclrccd-fedex.com/chmConsignmentController/checkChmAndDetaliC 38 + iclear-check-url-c: ${api.base-address}/chmConsignmentController/checkChmAndDetaliC
33 #获取token地址 39 #获取token地址
34 token-url: https://apictm.iclrccd-fedex.com/login 40 token-url: https://apictm.iclrccd-fedex.com/login
35 #刷新token地址 41 #刷新token地址
...@@ -37,4 +43,9 @@ api: ...@@ -37,4 +43,9 @@ api:
37 #传输海关回执地址 43 #传输海关回执地址
38 customs-url: https://apictm.iclrccd-fedex.com/export/outbound/customs 44 customs-url: https://apictm.iclrccd-fedex.com/export/outbound/customs
39 #推送完整报文地址 45 #推送完整报文地址
40 - complete-msg-url: https://apictm.iclrccd-fedex.com/export/outbound/mawb
...\ No newline at end of file ...\ No newline at end of file
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: 1 spring:
2 + servlet:
3 + context-path: /API
2 datasource: 4 datasource:
3 - url: jdbc:sqlserver://40.73.78.157:1433;DatabaseName=IClearUat 5 + jndi-name: jdbc/iclearDS
4 - username: sa 6 +# jndi-name: jdbc/iclearProdTestDS
5 - password: Fedex_123 7 +# url: jdbc:sqlserver://40.73.78.157:1433;DatabaseName=IClearUat
6 - driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver 8 +# username: sa
7 - type: com.alibaba.druid.pool.DruidDataSource 9 +# password: Fedex_123
10 +# driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
11 +# type: com.alibaba.druid.pool.DruidDataSource
12 +
8 13
9 task: 14 task:
10 #推送海关回执 15 #推送海关回执
...@@ -12,27 +17,36 @@ task: ...@@ -12,27 +17,36 @@ task:
12 #推送完整报文 17 #推送完整报文
13 pushMawbTask: 0 0/1 * * * ? 18 pushMawbTask: 0 0/1 * * * ?
14 #推送失败的回执数据 19 #推送失败的回执数据
15 - pushErrorReturnDate: 0 0/30 * * * ? 20 + pushErrorReturnDate: 0 0/3 * * * ?
16 #推送失败的申报数据 21 #推送失败的申报数据
17 - pushErrorDeclareDate: 0 0/30 * * * ? 22 + pushErrorDeclareDate: 0 0/3 * * * ?
18 23
19 #推送地址 24 #推送地址
20 api: 25 api:
26 + base-address: https://declarationuat.fedex.com.cn/Exp
21 token-info: 27 token-info:
22 #获取token账号 28 #获取token账号
23 username: iclear_external_ctm 29 username: iclear_external_ctm
24 #获取token密码 30 #获取token密码
25 password: toQu3arch6 31 password: toQu3arch6
26 address: 32 address:
33 + #IClearC类提交运单地址
34 + iclear-submit-url: ${api.base-address}/chmConsignmentController/submitConsignments
27 #IClear校验运单地址 35 #IClear校验运单地址
28 - iclear-check-url: http://139.217.114.139:8082/chmConsignmentController/checkChmAndDetaliD 36 + iclear-check-url: ${api.base-address}/chmConsignmentController/checkChmAndDetaliD
29 #IClear校验C类运单地址 37 #IClear校验C类运单地址
30 - iclear-check-url-c: http://139.217.114.139:8082/chmConsignmentController/checkChmAndDetaliC 38 + iclear-check-url-c: ${api.base-address}/chmConsignmentController/checkChmAndDetaliC
31 #获取token地址 39 #获取token地址
32 token-url: https://apiuat.iclrccd-fedex.com/login 40 token-url: https://apiuat.iclrccd-fedex.com/login
41 +# token-url: https://apictm.iclrccd-fedex.com/login
33 #刷新token地址 42 #刷新token地址
34 refresh-token-url: https://apiuat.iclrccd-fedex.com/user/token/refresh 43 refresh-token-url: https://apiuat.iclrccd-fedex.com/user/token/refresh
35 #传输海关回执地址 44 #传输海关回执地址
36 customs-url: https://apiuat.iclrccd-fedex.com/export/outbound/customs 45 customs-url: https://apiuat.iclrccd-fedex.com/export/outbound/customs
37 #推送完整报文地址 46 #推送完整报文地址
38 complete-msg-url: https://apiuat.iclrccd-fedex.com/export/outbound/mawb 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
......
...@@ -9,13 +9,12 @@ server: ...@@ -9,13 +9,12 @@ server:
9 9
10 10
11 11
12 -
13 -
14 spring: 12 spring:
15 - application:
16 - name: iClearExport.DataInterface
17 profiles: 13 profiles:
18 active: @activatedProperties@ 14 active: @activatedProperties@
15 +# active: dev
16 + application:
17 + name: iClearExport.DataInterface
19 jpa: 18 jpa:
20 database: sql_server 19 database: sql_server
21 show-sql: true 20 show-sql: true
......
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<configuration>
3 + <contextName>iClear-api</contextName>
4 + <!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
5 + <property name="LOG_HOME" value="/var/fedex/dxpweb/weblogic/api/log/"/>
6 + <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
7 + <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
8 + <layout class="ch.qos.logback.classic.PatternLayout">
9 + <pattern>
10 + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level [%thread{0}] %c{0} - %msg%n</pattern>
11 + </pattern>
12 + </layout>
13 + </encoder>
14 + </appender>
15 +
16 + <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
17 + <prudent>false</prudent>
18 + <append>true</append>
19 + <file>${LOG_HOME}/iClear-api.log</file>
20 + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
21 + <fileNamePattern>${LOG_HOME}/iClear-api-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
22 + <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
23 + <maxFileSize>500MB</maxFileSize>
24 + </timeBasedFileNamingAndTriggeringPolicy>
25 + <maxHistory>30</maxHistory>
26 + <totalSizeCap>1GB</totalSizeCap>
27 + </rollingPolicy>
28 + <encoder>
29 + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level [%thread{0}] %c{0} - %msg%n</pattern>
30 + <charset>utf-8</charset>
31 + </encoder>
32 +
33 + </appender>
34 +
35 + <logger name="io.lettuce.core" level="ERROR" />
36 + <logger name="com.netflix" level="OFF" />
37 +
38 + <springProfile name="dev | test">
39 + <root level="info">
40 + <appender-ref ref="CONSOLE"/>
41 + <appender-ref ref="FILE"/>
42 + </root>
43 + </springProfile>
44 +
45 + <springProfile name="prod">
46 + <root level="info">
47 + <appender-ref ref="CONSOLE"/>
48 + <appender-ref ref="FILE"/>
49 + </root>
50 + </springProfile>
51 +
52 +
53 +</configuration>
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
17 <append>true</append> 17 <append>true</append>
18 <file>E:/api/logs/iClear-api.log</file> 18 <file>E:/api/logs/iClear-api.log</file>
19 <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> 19 <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
20 - <fileNamePattern>E:/api/logs/iClear-api-%d.%i.log</fileNamePattern> 20 + <fileNamePattern>E:/api/logs/iClear-api-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
21 <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> 21 <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
22 <maxFileSize>500MB</maxFileSize> 22 <maxFileSize>500MB</maxFileSize>
23 </timeBasedFileNamingAndTriggeringPolicy> 23 </timeBasedFileNamingAndTriggeringPolicy>
...@@ -57,4 +57,4 @@ ...@@ -57,4 +57,4 @@
57 </springProfile> 57 </springProfile>
58 58
59 59
60 -</configuration>
...\ No newline at end of file ...\ No newline at end of file
60 +</configuration>
......
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<wls:weblogic-web-app
3 + xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app"
4 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5 + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.4/weblogic-web-app.xsd">
6 + <!-- 访问路径 -->
7 + <wls:context-root>API</wls:context-root>
8 + <!-- 优先加载WEB-INF下lib中的jar包 -->
9 +<!-- <wls:container-descriptor>-->
10 +<!-- <wls:prefer-web-inf-classes>true</wls:prefer-web-inf-classes>-->
11 +<!-- </wls:container-descriptor>-->
12 +
13 +</wls:weblogic-web-app>
...@@ -31,8 +31,13 @@ public class ApiTest { ...@@ -31,8 +31,13 @@ public class ApiTest {
31 public static String security = "bb348f1ba6ab7cc1"; 31 public static String security = "bb348f1ba6ab7cc1";
32 32
33 public static void main(String[] args) throws Exception{ 33 public static void main(String[] args) throws Exception{
34 +// BASF,iClearExportC,6db193cb4165a71b
35 + System.out.println(new Date(Long.valueOf(timeStamp)));
36 + String token = SHA256Util.getSHA256String("BASF" + "iClearExportC" + "b92131f03f19a348" + ApiTest.timeStamp);
37 + System.out.println(token);
38 +
34 //D类申报的数据落地接口 39 //D类申报的数据落地接口
35 - ApiTest.sendMawb(); 40 +// ApiTest.sendMawb();
36 //C类申报的数据落地接口 41 //C类申报的数据落地接口
37 // ApiTest.sendMawbBasf(); 42 // ApiTest.sendMawbBasf();
38 //C类EDI数据接口 43 //C类EDI数据接口
...@@ -51,7 +56,7 @@ public class ApiTest { ...@@ -51,7 +56,7 @@ public class ApiTest {
51 String masbJson ="{\"ieFlag\":\"E\",\"type\":\"EX\",\"agentCode\":\"1111980005\",\"agentName\":\"联邦快递(中国)有限公司\",\"billNo\":\"202204141\",\"contrNo\":\"3006622200\",\"customMaster\":\"0208\",\"cutMode\":\"601\",\"declTrnRel\":\"0\",\"distinatePort\":\"DEU000\",\"ediId\":\"001\",\"feeCurr\":\"EUR\",\"feeMark\":\"3\",\"feeRate\":110.9,\"grossWet\":4.6,\"iePort\":\"0101\",\"insurCurr\":\"EUR\",\"insurMark\":\"3\",\"insurRate\":0.74,\"netWt\":32,\"ownerCode\":\"3118962277\",\"ownerName\":\"测试核销单位\",\"packNo\":1,\"tradeCountry\":\"USA\",\"tradeMode\":\"110\",\"tradeCode\":\"32099616DM\",\"trafMode\":\"5\",\"tradeName\":\"测试发件人\",\"transMode\":\"1\",\"wrapType\":\"23\",\"tradeCodeScc\":\"A74125896321456987\",\"ownerCodeScc\":\"913100007421296207\",\"tradeAreaCode\":\"DEU\",\"entyPortCode\":\"310302\",\"goodsPlace\":\"\",\"declareName\":\"Jimmy shen\",\"overseasConsigneeEname\":\"PRYSMIAN KABEL UND SYSTEME GMBH\",\"mawbDetailList\":[{\"detailId\":\"204\",\"classMark\":\"\",\"codeTS\":\"8504409999\",\"declPrice\":3365,\"declTotal\":3365,\"dutyMode\":\"1\",\"exgNo\":\"\",\"exgVersion\":\"\",\"firstUnit\":\"007\",\"firstQty\":1,\"originCountry\":\"CHN\",\"secondUnit\":\"035\",\"secondQty\":1,\"tradeCurr\":\"EUR\",\"useTo\":\"03\",\"destinationCountry\":\"DEU\",\"ciqCode\":\"\",\"destCode\":\"110102\",\"districtCode\":\"44079\",\"gno\":1,\"gname\":\"变频调速装置\",\"gmodel\":\"4|0|控制电机用|240KW|西门子/SIEMENS|6RA8081-6GV62-0AA0|||\",\"gqty\":1,\"gunit\":\"007\"}]}"; 56 String masbJson ="{\"ieFlag\":\"E\",\"type\":\"EX\",\"agentCode\":\"1111980005\",\"agentName\":\"联邦快递(中国)有限公司\",\"billNo\":\"202204141\",\"contrNo\":\"3006622200\",\"customMaster\":\"0208\",\"cutMode\":\"601\",\"declTrnRel\":\"0\",\"distinatePort\":\"DEU000\",\"ediId\":\"001\",\"feeCurr\":\"EUR\",\"feeMark\":\"3\",\"feeRate\":110.9,\"grossWet\":4.6,\"iePort\":\"0101\",\"insurCurr\":\"EUR\",\"insurMark\":\"3\",\"insurRate\":0.74,\"netWt\":32,\"ownerCode\":\"3118962277\",\"ownerName\":\"测试核销单位\",\"packNo\":1,\"tradeCountry\":\"USA\",\"tradeMode\":\"110\",\"tradeCode\":\"32099616DM\",\"trafMode\":\"5\",\"tradeName\":\"测试发件人\",\"transMode\":\"1\",\"wrapType\":\"23\",\"tradeCodeScc\":\"A74125896321456987\",\"ownerCodeScc\":\"913100007421296207\",\"tradeAreaCode\":\"DEU\",\"entyPortCode\":\"310302\",\"goodsPlace\":\"\",\"declareName\":\"Jimmy shen\",\"overseasConsigneeEname\":\"PRYSMIAN KABEL UND SYSTEME GMBH\",\"mawbDetailList\":[{\"detailId\":\"204\",\"classMark\":\"\",\"codeTS\":\"8504409999\",\"declPrice\":3365,\"declTotal\":3365,\"dutyMode\":\"1\",\"exgNo\":\"\",\"exgVersion\":\"\",\"firstUnit\":\"007\",\"firstQty\":1,\"originCountry\":\"CHN\",\"secondUnit\":\"035\",\"secondQty\":1,\"tradeCurr\":\"EUR\",\"useTo\":\"03\",\"destinationCountry\":\"DEU\",\"ciqCode\":\"\",\"destCode\":\"110102\",\"districtCode\":\"44079\",\"gno\":1,\"gname\":\"变频调速装置\",\"gmodel\":\"4|0|控制电机用|240KW|西门子/SIEMENS|6RA8081-6GV62-0AA0|||\",\"gqty\":1,\"gunit\":\"007\"}]}";
52 57
53 System.out.println(new Date(Long.valueOf(timeStamp))); 58 System.out.println(new Date(Long.valueOf(timeStamp)));
54 - String token = SHA256Util.getSHA256String("DEMO1" + "iClearExportDemo1" + ApiTest.security + ApiTest.timeStamp); 59 + String token = SHA256Util.getSHA256String("DEMO1" + "iClearExportDemo1" + "bb348f1ba6ab7cc1" + ApiTest.timeStamp);
55 System.out.println(token); 60 System.out.println(token);
56 61
57 // Header[] headers = HttpHeader.custom() 62 // Header[] headers = HttpHeader.custom()
......