Showing
11 changed files
with
122 additions
and
99 deletions
| ... | @@ -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> |
| ... | @@ -111,23 +106,41 @@ | ... | @@ -111,23 +106,41 @@ |
| 111 | </dependency> | 106 | </dependency> |
| 112 | <dependency> | 107 | <dependency> |
| 113 | <groupId>org.springframework.boot</groupId> | 108 | <groupId>org.springframework.boot</groupId> |
| 114 | - <artifactId>spring-boot-legacy</artifactId> | ||
| 115 | - <version>2.0.0.RELEASE</version> | ||
| 116 | - </dependency> | ||
| 117 | - <dependency> | ||
| 118 | - <groupId>org.springframework.boot</groupId> | ||
| 119 | - <artifactId>spring-boot-starter-validation</artifactId> | ||
| 120 | - </dependency> | ||
| 121 | - <dependency> | ||
| 122 | - <groupId>org.springframework.boot</groupId> | ||
| 123 | <artifactId>spring-boot-starter-tomcat</artifactId> | 109 | <artifactId>spring-boot-starter-tomcat</artifactId> |
| 124 | <scope>provided</scope> | 110 | <scope>provided</scope> |
| 125 | </dependency> | 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>--> | ||
| 126 | <dependency> | 122 | <dependency> |
| 127 | <groupId>org.springframework.boot</groupId> | 123 | <groupId>org.springframework.boot</groupId> |
| 128 | - <artifactId>spring-boot-devtools</artifactId> | 124 | + <artifactId>spring-boot-starter-web</artifactId> |
| 129 | - <optional>true</optional> | 125 | + <exclusions> |
| 130 | - <scope>true</scope> | 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> | ||
| 131 | </dependency> | 144 | </dependency> |
| 132 | </dependencies> | 145 | </dependencies> |
| 133 | 146 | ... | ... |
| ... | @@ -2,14 +2,21 @@ package com.erry.iclear.dateInterface; | ... | @@ -2,14 +2,21 @@ 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; | ||
| 7 | import org.springframework.boot.builder.SpringApplicationBuilder; | 10 | import org.springframework.boot.builder.SpringApplicationBuilder; |
| 8 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; | 11 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; |
| 12 | +import org.springframework.context.annotation.Bean; | ||
| 9 | import org.springframework.data.jpa.repository.config.EnableJpaRepositories; | 13 | import org.springframework.data.jpa.repository.config.EnableJpaRepositories; |
| 14 | +import org.springframework.jndi.JndiObjectFactoryBean; | ||
| 10 | import org.springframework.scheduling.annotation.EnableScheduling; | 15 | import org.springframework.scheduling.annotation.EnableScheduling; |
| 11 | import org.springframework.web.bind.annotation.GetMapping; | 16 | import org.springframework.web.bind.annotation.GetMapping; |
| 12 | 17 | ||
| 18 | +import javax.sql.DataSource; | ||
| 19 | + | ||
| 13 | 20 | ||
| 14 | /** | 21 | /** |
| 15 | * @author Administrator | 22 | * @author Administrator |
| ... | @@ -20,16 +27,16 @@ import org.springframework.web.bind.annotation.GetMapping; | ... | @@ -20,16 +27,16 @@ import org.springframework.web.bind.annotation.GetMapping; |
| 20 | @EnableScheduling | 27 | @EnableScheduling |
| 21 | //@EnableJpaRepositories(value = "com.erry.iclear.dateInterface.repository", repositoryBaseClass = SimpleJpaRepositoryImpl.class) | 28 | //@EnableJpaRepositories(value = "com.erry.iclear.dateInterface.repository", repositoryBaseClass = SimpleJpaRepositoryImpl.class) |
| 22 | public class IClearApiApplication extends SpringBootServletInitializer { | 29 | public class IClearApiApplication extends SpringBootServletInitializer { |
| 23 | - @Override | ||
| 24 | - protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { | ||
| 25 | - return builder.sources(IClearApiApplication.class); | ||
| 26 | - } | ||
| 27 | 30 | ||
| 28 | public static void main(String[] args) { | 31 | public static void main(String[] args) { |
| 29 | SpringApplication.run(IClearApiApplication.class, args); | 32 | SpringApplication.run(IClearApiApplication.class, args); |
| 30 | } | 33 | } |
| 31 | 34 | ||
| 32 | - @GetMapping("/test") | 35 | + @Override |
| 36 | + protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { | ||
| 37 | + return builder.sources(IClearApiApplication.class); | ||
| 38 | + } | ||
| 39 | + | ||
| 33 | public String test(){ | 40 | public String test(){ |
| 34 | return "test"; | 41 | return "test"; |
| 35 | } | 42 | } | ... | ... |
| ... | @@ -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") |
| ... | @@ -135,7 +134,7 @@ public class FedexDataInterface { | ... | @@ -135,7 +134,7 @@ public class FedexDataInterface { |
| 135 | @PostMapping("/sendMawbFedex") | 134 | @PostMapping("/sendMawbFedex") |
| 136 | @ResponseBody | 135 | @ResponseBody |
| 137 | public ResultRS sendMawbFedex(HttpServletRequest request | 136 | public ResultRS sendMawbFedex(HttpServletRequest request |
| 138 | - , @Validated @RequestBody Fedexc fedexc) throws HttpProcessException { | 137 | + , @RequestBody Fedexc fedexc) throws HttpProcessException { |
| 139 | log.info("接收到请求数据consignmentCode:"+fedexc.getConsignmentCode()+" data:" + gson.toJson(fedexc)); | 138 | log.info("接收到请求数据consignmentCode:"+fedexc.getConsignmentCode()+" data:" + gson.toJson(fedexc)); |
| 140 | ResultRS result = new ResultRS(Boolean.FALSE,"",""); | 139 | ResultRS result = new ResultRS(Boolean.FALSE,"",""); |
| 141 | 140 | ||
| ... | @@ -201,17 +200,23 @@ public class FedexDataInterface { | ... | @@ -201,17 +200,23 @@ public class FedexDataInterface { |
| 201 | ChmConsignment chmGetId = chmConsignmentRepository.findChmConsignmentByConsignmentCode(saveIClearApiLogResult.getBillNo(), saveIClearApiLogResult.getCreateTime()); | 200 | ChmConsignment chmGetId = chmConsignmentRepository.findChmConsignmentByConsignmentCode(saveIClearApiLogResult.getBillNo(), saveIClearApiLogResult.getCreateTime()); |
| 202 | //调用IClear接口进行运单推送EXP002 | 201 | //调用IClear接口进行运单推送EXP002 |
| 203 | String objJson = JsonToJava.toJson(chmGetId.getId()); | 202 | String objJson = JsonToJava.toJson(chmGetId.getId()); |
| 204 | - Header[] headers = HttpHeader.custom() | 203 | +// Header[] headers = HttpHeader.custom() |
| 205 | - .other("Content-Type", "application/json") | 204 | +// .other("Content-Type", "application/json") |
| 206 | - .build(); | 205 | +// .build(); |
| 207 | - log.info("******************* : " + this.iclearCSubmitUrl); | 206 | +// log.info("******************* : " + this.iclearCSubmitUrl); |
| 208 | - //推送海关回执数据 | 207 | +// //推送海关回执数据 |
| 209 | - HttpConfig config = HttpConfig.custom() | 208 | +// HttpConfig config = HttpConfig.custom() |
| 210 | - .headers(headers) | 209 | +// .headers(headers) |
| 211 | - .url(this.iclearCSubmitUrl) | 210 | +// .url(this.iclearCSubmitUrl) |
| 212 | - .encoding("utf-8") | 211 | +// .encoding("utf-8") |
| 213 | - .json(objJson); | 212 | +// .json(objJson); |
| 214 | - 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 | + | ||
| 215 | 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()); |
| 216 | 221 | ||
| 217 | 222 | ||
| ... | @@ -239,7 +244,7 @@ public class FedexDataInterface { | ... | @@ -239,7 +244,7 @@ public class FedexDataInterface { |
| 239 | @PostMapping("/selectDecListFedex") | 244 | @PostMapping("/selectDecListFedex") |
| 240 | @ResponseBody | 245 | @ResponseBody |
| 241 | public FedexResultChmRS selectDecListFedex(HttpServletRequest request | 246 | public FedexResultChmRS selectDecListFedex(HttpServletRequest request |
| 242 | - , @Validated @RequestBody ConsignmentCode consignmentCode) throws Exception { | 247 | + , @RequestBody ConsignmentCode consignmentCode) throws Exception { |
| 243 | log.info("接收到请求数据consignmentCode:"+consignmentCode.getConsignmentCode()+" data:" + gson.toJson(consignmentCode)); | 248 | log.info("接收到请求数据consignmentCode:"+consignmentCode.getConsignmentCode()+" data:" + gson.toJson(consignmentCode)); |
| 244 | FedexResultChmRS result = new FedexResultChmRS(Boolean.FALSE,"","",null); | 249 | FedexResultChmRS result = new FedexResultChmRS(Boolean.FALSE,"","",null); |
| 245 | //获取请求的运单号 | 250 | //获取请求的运单号 |
| ... | @@ -298,7 +303,7 @@ public class FedexDataInterface { | ... | @@ -298,7 +303,7 @@ public class FedexDataInterface { |
| 298 | @PostMapping("/selectChmListFedex") | 303 | @PostMapping("/selectChmListFedex") |
| 299 | @ResponseBody | 304 | @ResponseBody |
| 300 | public FedexResultRS selectChmListFedex(HttpServletRequest request | 305 | public FedexResultRS selectChmListFedex(HttpServletRequest request |
| 301 | - , @Validated @RequestBody ConsignmentCode consignmentCode) throws Exception { | 306 | + , @RequestBody ConsignmentCode consignmentCode) throws Exception { |
| 302 | log.info("接收到请求数据consignmentCode:"+consignmentCode.getConsignmentCode()+" data:" + gson.toJson(consignmentCode)); | 307 | log.info("接收到请求数据consignmentCode:"+consignmentCode.getConsignmentCode()+" data:" + gson.toJson(consignmentCode)); |
| 303 | FedexResultRS result = new FedexResultRS(Boolean.FALSE,"","",null); | 308 | FedexResultRS result = new FedexResultRS(Boolean.FALSE,"","",null); |
| 304 | //获取请求的运单号 | 309 | //获取请求的运单号 | ... | ... |
| ... | @@ -30,21 +30,17 @@ public class FedexDetail { | ... | @@ -30,21 +30,17 @@ public class FedexDetail { |
| 30 | private Long basfId; | 30 | private Long basfId; |
| 31 | 31 | ||
| 32 | @Column(name="CONSIGNMENTDETAILID") | 32 | @Column(name="CONSIGNMENTDETAILID") |
| 33 | - @NotNull(message="参数consignmentDetailId不能为空") | ||
| 34 | private Long consignmentDetailId; | 33 | private Long consignmentDetailId; |
| 35 | 34 | ||
| 36 | @ApiModelProperty(value = "商品编号") | 35 | @ApiModelProperty(value = "商品编号") |
| 37 | - @NotBlank(message="参数skuCode不能为空") | ||
| 38 | @Column(name = "SKUCODE") | 36 | @Column(name = "SKUCODE") |
| 39 | private String skuCode; | 37 | private String skuCode; |
| 40 | 38 | ||
| 41 | @ApiModelProperty(value = "品名") | 39 | @ApiModelProperty(value = "品名") |
| 42 | - @NotBlank(message = "参数skuName不能为空") | ||
| 43 | @Column(name = "SKUNAME") | 40 | @Column(name = "SKUNAME") |
| 44 | private String skuName; | 41 | private String skuName; |
| 45 | 42 | ||
| 46 | @ApiModelProperty(value = "规格型号") | 43 | @ApiModelProperty(value = "规格型号") |
| 47 | - @NotBlank(message="参数model不能为空") | ||
| 48 | @Column(name = "MODEL") | 44 | @Column(name = "MODEL") |
| 49 | private String model; | 45 | private String model; |
| 50 | 46 | ... | ... |
| ... | @@ -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") | ... | ... |
| 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,24 @@ public class FedexService { | ... | @@ -142,17 +146,24 @@ 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 | + | ||
| 165 | + | ||
| 166 | + | ||
| 156 | IClearCheckResponseResult iclearCheckResponseResult = JsonToJava.parseJson(json, IClearCheckResponseResult.class); | 167 | IClearCheckResponseResult iclearCheckResponseResult = JsonToJava.parseJson(json, IClearCheckResponseResult.class); |
| 157 | result.setSuccess(iclearCheckResponseResult.getSuccess()); | 168 | result.setSuccess(iclearCheckResponseResult.getSuccess()); |
| 158 | result.setCode(iclearCheckResponseResult.getCode()); | 169 | result.setCode(iclearCheckResponseResult.getCode()); | ... | ... |
| ... | @@ -9,6 +9,7 @@ import com.erry.iclear.dateInterface.api.response.ResultRS; | ... | @@ -9,6 +9,7 @@ import com.erry.iclear.dateInterface.api.response.ResultRS; |
| 9 | import com.erry.iclear.dateInterface.entity.ChmConsignment; | 9 | import com.erry.iclear.dateInterface.entity.ChmConsignment; |
| 10 | import com.erry.iclear.dateInterface.entity.ChmConsignmentDetail; | 10 | import com.erry.iclear.dateInterface.entity.ChmConsignmentDetail; |
| 11 | import com.erry.iclear.dateInterface.repository.MawbRepository; | 11 | import com.erry.iclear.dateInterface.repository.MawbRepository; |
| 12 | +import com.erry.iclear.dateInterface.util.HttpUtils; | ||
| 12 | import com.erry.iclear.dateInterface.util.JsonToJava; | 13 | import com.erry.iclear.dateInterface.util.JsonToJava; |
| 13 | import com.erry.iclear.dateInterface.util.StringUtil; | 14 | import com.erry.iclear.dateInterface.util.StringUtil; |
| 14 | import com.google.gson.Gson; | 15 | import com.google.gson.Gson; |
| ... | @@ -93,17 +94,24 @@ public class MawbService { | ... | @@ -93,17 +94,24 @@ public class MawbService { |
| 93 | 94 | ||
| 94 | //调用IClear接口进行运单数据校验 | 95 | //调用IClear接口进行运单数据校验 |
| 95 | String objJson = JsonToJava.toJson(chmConsignment); | 96 | String objJson = JsonToJava.toJson(chmConsignment); |
| 96 | - Header[] headers = HttpHeader.custom() | 97 | +// Header[] headers = HttpHeader.custom() |
| 97 | - .other("Content-Type", "application/json") | 98 | +// .other("Content-Type", "application/json") |
| 98 | - .build(); | 99 | +// .build(); |
| 99 | - log.info("******************* : " + this.iclearCheckUrl); | 100 | +// log.info("******************* : " + this.iclearCheckUrl); |
| 100 | - //推送海关回执数据 | 101 | +// //推送海关回执数据 |
| 101 | - HttpConfig config = HttpConfig.custom() | 102 | +// HttpConfig config = HttpConfig.custom() |
| 102 | - .headers(headers) | 103 | +// .headers(headers) |
| 103 | - .url(this.iclearCheckUrl) | 104 | +// .url(this.iclearCheckUrl) |
| 104 | - .encoding("utf-8") | 105 | +// .encoding("utf-8") |
| 105 | - .json(objJson); | 106 | +// .json(objJson); |
| 106 | - String json = HttpClientUtil.post(config); | 107 | +// String json = HttpClientUtil.post(config); |
| 108 | + | ||
| 109 | + Map<String,String> headerMap = new HashMap<>(); | ||
| 110 | + headerMap.put("Content-Type", "application/json"); | ||
| 111 | + String json = HttpUtils.doPost(this.iclearCheckUrl,objJson,headerMap); | ||
| 112 | + | ||
| 113 | + | ||
| 114 | + | ||
| 107 | IClearCheckResponseResult iclearCheckResponseResult = JsonToJava.parseJson(json, IClearCheckResponseResult.class); | 115 | IClearCheckResponseResult iclearCheckResponseResult = JsonToJava.parseJson(json, IClearCheckResponseResult.class); |
| 108 | result.setSuccess(iclearCheckResponseResult.getSuccess()); | 116 | result.setSuccess(iclearCheckResponseResult.getSuccess()); |
| 109 | result.setCode(iclearCheckResponseResult.getCode()); | 117 | result.setCode(iclearCheckResponseResult.getCode()); | ... | ... |
| ... | @@ -19,7 +19,7 @@ task: | ... | @@ -19,7 +19,7 @@ task: |
| 19 | 19 | ||
| 20 | #推送地址 | 20 | #推送地址 |
| 21 | api: | 21 | api: |
| 22 | - base-address: http://localhost:8080/Exp | 22 | + base-address: https://iclearexpuat.fedex.com.cn/Exp |
| 23 | token-info: | 23 | token-info: |
| 24 | #获取token账号 | 24 | #获取token账号 |
| 25 | username: iclear_external_ctm | 25 | username: iclear_external_ctm | ... | ... |
| ... | @@ -12,10 +12,10 @@ server: | ... | @@ -12,10 +12,10 @@ server: |
| 12 | 12 | ||
| 13 | 13 | ||
| 14 | spring: | 14 | spring: |
| 15 | - application: | ||
| 16 | - name: iClearExport.DataInterface | ||
| 17 | profiles: | 15 | profiles: |
| 18 | active: @activatedProperties@ | 16 | active: @activatedProperties@ |
| 17 | + application: | ||
| 18 | + name: iClearExport.DataInterface | ||
| 19 | jpa: | 19 | jpa: |
| 20 | database: sql_server | 20 | database: sql_server |
| 21 | show-sql: true | 21 | show-sql: true | ... | ... |
| ... | @@ -15,9 +15,9 @@ | ... | @@ -15,9 +15,9 @@ |
| 15 | <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | 15 | <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| 16 | <prudent>false</prudent> | 16 | <prudent>false</prudent> |
| 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.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> | ... | ... |
| ... | @@ -2,22 +2,13 @@ | ... | @@ -2,22 +2,13 @@ |
| 2 | <wls:weblogic-web-app | 2 | <wls:weblogic-web-app |
| 3 | xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app" | 3 | xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app" |
| 4 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | 4 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 5 | - xsi:schemaLocation="http://xmlns.oracle.com/weblogic/weblogic-web-app | 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 | - http://xmlns.oracle.com/weblogic/weblogic-web-app/1.4/weblogic-web-app.xsd"> | 6 | + <!-- 访问路径 --> |
| 7 | - <wls:context-root>/API</wls:context-root> | 7 | + <wls:context-root>API</wls:context-root> |
| 8 | - <!-- <container-descriptor>--> | 8 | + <!-- 优先加载WEB-INF下lib中的jar包 --> |
| 9 | - <!-- <servlet-reload-check-secs>-1</servlet-reload-check-secs>--> | 9 | + <wls:container-descriptor> |
| 10 | - <!-- <prefer-web-inf-classes>true</prefer-web-inf-classes>--> | 10 | + <wls:prefer-application-packages> |
| 11 | - <!-- </container-descriptor>--> | 11 | + <wls:package-name>org.slf4j</wls:package-name> |
| 12 | - | 12 | + </wls:prefer-application-packages> |
| 13 | -<!-- <wls:library-ref>--> | 13 | + </wls:container-descriptor> |
| 14 | -<!-- <library-name>lib4iClear2</library-name>--> | ||
| 15 | -<!-- <specification-version>1.0</specification-version>--> | ||
| 16 | -<!-- </wls:library-ref>--> | ||
| 17 | - | ||
| 18 | - <!-- 配置路径映射 --> | ||
| 19 | -<!-- <virtual-directory-mapping>--> | ||
| 20 | -<!-- <local-path>/var/share/iclear/resources</local-path>--> | ||
| 21 | -<!-- <url-pattern>/*</url-pattern>--> | ||
| 22 | -<!-- </virtual-directory-mapping>--> | ||
| 23 | </wls:weblogic-web-app> | 14 | </wls:weblogic-web-app> | ... | ... |
-
Please register or login to post a comment