李俊

内网迁移环境代码调整

......@@ -21,10 +21,6 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
......@@ -98,7 +94,6 @@
<version>1.2.38</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
......@@ -111,23 +106,41 @@
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-legacy</artifactId>
<version>2.0.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-validation</artifactId>-->
<!-- <exclusions>-->
<!-- <exclusion>-->
<!-- <groupId>org.apache.tomcat.embed</groupId>-->
<!-- <artifactId>tomcat-embed-el</artifactId>-->
<!-- </exclusion>-->
<!-- </exclusions>-->
<!-- </dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
<scope>true</scope>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
<exclusion>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
</exclusion>
<exclusion>
<artifactId>hibernate-validator</artifactId>
<groupId>org.hibernate.validator</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
<version>6.0.20.Final</version>
</dependency>
</dependencies>
......
......@@ -2,14 +2,21 @@ package com.erry.iclear.dateInterface;
import com.erry.iclear.dateInterface.service.SimpleJpaRepositoryImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.jndi.JndiObjectFactoryBean;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.bind.annotation.GetMapping;
import javax.sql.DataSource;
/**
* @author Administrator
......@@ -20,16 +27,16 @@ import org.springframework.web.bind.annotation.GetMapping;
@EnableScheduling
//@EnableJpaRepositories(value = "com.erry.iclear.dateInterface.repository", repositoryBaseClass = SimpleJpaRepositoryImpl.class)
public class IClearApiApplication extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(IClearApiApplication.class);
}
public static void main(String[] args) {
SpringApplication.run(IClearApiApplication.class, args);
}
@GetMapping("/test")
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(IClearApiApplication.class);
}
public String test(){
return "test";
}
......
......@@ -16,6 +16,7 @@ import com.erry.iclear.dateInterface.entity.TIClearApiCheckLog;
import com.erry.iclear.dateInterface.repository.ChmConsignmentRepository;
import com.erry.iclear.dateInterface.repository.IClearApiCheckLogRepository;
import com.erry.iclear.dateInterface.service.*;
import com.erry.iclear.dateInterface.util.HttpUtils;
import com.erry.iclear.dateInterface.util.JsonToJava;
import com.erry.iclear.dateInterface.util.StringUtil;
import com.google.gson.Gson;
......@@ -29,9 +30,7 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.*;
@RestController
@RequestMapping("/fedex")
......@@ -135,7 +134,7 @@ public class FedexDataInterface {
@PostMapping("/sendMawbFedex")
@ResponseBody
public ResultRS sendMawbFedex(HttpServletRequest request
, @Validated @RequestBody Fedexc fedexc) throws HttpProcessException {
, @RequestBody Fedexc fedexc) throws HttpProcessException {
log.info("接收到请求数据consignmentCode:"+fedexc.getConsignmentCode()+" data:" + gson.toJson(fedexc));
ResultRS result = new ResultRS(Boolean.FALSE,"","");
......@@ -201,17 +200,23 @@ public class FedexDataInterface {
ChmConsignment chmGetId = chmConsignmentRepository.findChmConsignmentByConsignmentCode(saveIClearApiLogResult.getBillNo(), saveIClearApiLogResult.getCreateTime());
//调用IClear接口进行运单推送EXP002
String objJson = JsonToJava.toJson(chmGetId.getId());
Header[] headers = HttpHeader.custom()
.other("Content-Type", "application/json")
.build();
log.info("******************* : " + this.iclearCSubmitUrl);
//推送海关回执数据
HttpConfig config = HttpConfig.custom()
.headers(headers)
.url(this.iclearCSubmitUrl)
.encoding("utf-8")
.json(objJson);
String json = HttpClientUtil.post(config);
// Header[] headers = HttpHeader.custom()
// .other("Content-Type", "application/json")
// .build();
// log.info("******************* : " + this.iclearCSubmitUrl);
// //推送海关回执数据
// HttpConfig config = HttpConfig.custom()
// .headers(headers)
// .url(this.iclearCSubmitUrl)
// .encoding("utf-8")
// .json(objJson);
// String json = HttpClientUtil.post(config);
Map<String,String> headerMap = new HashMap<>();
headerMap.put("Content-Type", "application/json");
String json = HttpUtils.doPost(this.iclearCSubmitUrl,objJson,headerMap);
log.info("<<<<<<<< checkfedexMawb start >>>>>>>>>> result :" +result.getSuccess() +" iclear check response : " + json + " status : " + result.getSuccess());
......@@ -239,7 +244,7 @@ public class FedexDataInterface {
@PostMapping("/selectDecListFedex")
@ResponseBody
public FedexResultChmRS selectDecListFedex(HttpServletRequest request
, @Validated @RequestBody ConsignmentCode consignmentCode) throws Exception {
, @RequestBody ConsignmentCode consignmentCode) throws Exception {
log.info("接收到请求数据consignmentCode:"+consignmentCode.getConsignmentCode()+" data:" + gson.toJson(consignmentCode));
FedexResultChmRS result = new FedexResultChmRS(Boolean.FALSE,"","",null);
//获取请求的运单号
......@@ -298,7 +303,7 @@ public class FedexDataInterface {
@PostMapping("/selectChmListFedex")
@ResponseBody
public FedexResultRS selectChmListFedex(HttpServletRequest request
, @Validated @RequestBody ConsignmentCode consignmentCode) throws Exception {
, @RequestBody ConsignmentCode consignmentCode) throws Exception {
log.info("接收到请求数据consignmentCode:"+consignmentCode.getConsignmentCode()+" data:" + gson.toJson(consignmentCode));
FedexResultRS result = new FedexResultRS(Boolean.FALSE,"","",null);
//获取请求的运单号
......
......@@ -30,21 +30,17 @@ public class FedexDetail {
private Long basfId;
@Column(name="CONSIGNMENTDETAILID")
@NotNull(message="参数consignmentDetailId不能为空")
private Long consignmentDetailId;
@ApiModelProperty(value = "商品编号")
@NotBlank(message="参数skuCode不能为空")
@Column(name = "SKUCODE")
private String skuCode;
@ApiModelProperty(value = "品名")
@NotBlank(message = "参数skuName不能为空")
@Column(name = "SKUNAME")
private String skuName;
@ApiModelProperty(value = "规格型号")
@NotBlank(message="参数model不能为空")
@Column(name = "MODEL")
private String model;
......
......@@ -8,8 +8,6 @@ import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.*;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;
......@@ -45,23 +43,18 @@ public class Fedexc implements Serializable {
@ApiModelProperty(value = "运单号", name = "consignmentCode")
@Column(name = "CONSIGNMENTCODE")
@NotBlank(message="参数consignmentCode不能为空!")
private String consignmentCode;
@ApiModelProperty(value = "运单ID", name = "consignmentId", example = "运单记录的唯一ID")
@Column(name = "CONSIGNMENTID")
@NotNull(message="参数consignmentId不能为空!")
// @NotBlank(message="参数consignmentId不能为空!")
private Long consignmentId;
@ApiModelProperty(value = "运单类型",name = "consType", example = "A/B/C/D")
@Column(name = "CONSTYPE")
@NotBlank(message = "参数consType不能为空!")
private String consType;
@ApiModelProperty(value = "发件人", name = "sender")
@Column(name = "SENDER")
@NotBlank(message = "参数sender不能为空!")
private String sender;
@ApiModelProperty(value = "发件人海关编码", name = "shipperCustomsCode")
......@@ -70,7 +63,6 @@ public class Fedexc implements Serializable {
@ApiModelProperty(value = "发件人社会信用证代码", name = "shipperSCC")
@Column(name = "SHIPPERSCC")
@NotBlank(message = "参数shipperSCC不能为空!")
private String shipperSCC;
@ApiModelProperty(value = "经营单位", name = "operateUnitName")
......
package com.erry.iclear.dateInterface.service;
import com.alibaba.fastjson.JSON;
import com.arronlong.httpclientutil.HttpClientUtil;
import com.arronlong.httpclientutil.common.HttpConfig;
import com.arronlong.httpclientutil.common.HttpHeader;
......@@ -9,6 +10,7 @@ import com.erry.iclear.dateInterface.api.response.ResultRS;
import com.erry.iclear.dateInterface.entity.ChmConsignment;
import com.erry.iclear.dateInterface.entity.ChmConsignmentDetail;
import com.erry.iclear.dateInterface.repository.FedexMawbRepository;
import com.erry.iclear.dateInterface.util.HttpUtils;
import com.erry.iclear.dateInterface.util.JsonToJava;
import com.google.gson.Gson;
import io.swagger.annotations.ApiModelProperty;
......@@ -17,15 +19,17 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.http.Header;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import javax.persistence.*;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.*;
import java.util.stream.Collectors;
/**
......@@ -142,17 +146,24 @@ public class FedexService {
//调用IClear接口进行运单数据校验
String objJson = JsonToJava.toJson(chmConsignment);
Header[] headers = HttpHeader.custom()
.other("Content-Type", "application/json")
.build();
log.info("******************* : " + this.iclearCheckUrl);
//推送海关回执数据
HttpConfig config = HttpConfig.custom()
.headers(headers)
.url(this.iclearCheckUrl)
.encoding("utf-8")
.json(objJson);
String json = HttpClientUtil.post(config);
// Header[] headers = HttpHeader.custom()
// .other("Content-Type", "application/json")
// .build();
// log.info("******************* : " + this.iclearCheckUrl);
// //推送海关回执数据
// HttpConfig config = HttpConfig.custom()
// .headers(headers)
// .url(this.iclearCheckUrl)
// .encoding("utf-8")
// .json(objJson);
// String json = HttpClientUtil.post(config);
Map<String,String> headerMap = new HashMap<>();
headerMap.put("Content-Type", "application/json");
String json = HttpUtils.doPost(this.iclearCheckUrl,objJson,headerMap);
IClearCheckResponseResult iclearCheckResponseResult = JsonToJava.parseJson(json, IClearCheckResponseResult.class);
result.setSuccess(iclearCheckResponseResult.getSuccess());
result.setCode(iclearCheckResponseResult.getCode());
......
......@@ -9,6 +9,7 @@ import com.erry.iclear.dateInterface.api.response.ResultRS;
import com.erry.iclear.dateInterface.entity.ChmConsignment;
import com.erry.iclear.dateInterface.entity.ChmConsignmentDetail;
import com.erry.iclear.dateInterface.repository.MawbRepository;
import com.erry.iclear.dateInterface.util.HttpUtils;
import com.erry.iclear.dateInterface.util.JsonToJava;
import com.erry.iclear.dateInterface.util.StringUtil;
import com.google.gson.Gson;
......@@ -93,17 +94,24 @@ public class MawbService {
//调用IClear接口进行运单数据校验
String objJson = JsonToJava.toJson(chmConsignment);
Header[] headers = HttpHeader.custom()
.other("Content-Type", "application/json")
.build();
log.info("******************* : " + this.iclearCheckUrl);
//推送海关回执数据
HttpConfig config = HttpConfig.custom()
.headers(headers)
.url(this.iclearCheckUrl)
.encoding("utf-8")
.json(objJson);
String json = HttpClientUtil.post(config);
// Header[] headers = HttpHeader.custom()
// .other("Content-Type", "application/json")
// .build();
// log.info("******************* : " + this.iclearCheckUrl);
// //推送海关回执数据
// HttpConfig config = HttpConfig.custom()
// .headers(headers)
// .url(this.iclearCheckUrl)
// .encoding("utf-8")
// .json(objJson);
// String json = HttpClientUtil.post(config);
Map<String,String> headerMap = new HashMap<>();
headerMap.put("Content-Type", "application/json");
String json = HttpUtils.doPost(this.iclearCheckUrl,objJson,headerMap);
IClearCheckResponseResult iclearCheckResponseResult = JsonToJava.parseJson(json, IClearCheckResponseResult.class);
result.setSuccess(iclearCheckResponseResult.getSuccess());
result.setCode(iclearCheckResponseResult.getCode());
......
......@@ -19,7 +19,7 @@ task:
#推送地址
api:
base-address: http://localhost:8080/Exp
base-address: https://iclearexpuat.fedex.com.cn/Exp
token-info:
#获取token账号
username: iclear_external_ctm
......
......@@ -12,10 +12,10 @@ server:
spring:
application:
name: iClearExport.DataInterface
profiles:
active: @activatedProperties@
application:
name: iClearExport.DataInterface
jpa:
database: sql_server
show-sql: true
......
......@@ -15,9 +15,9 @@
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<prudent>false</prudent>
<append>true</append>
<!-- <file>E:/api/logs/iClear-api.log</file>-->
<file>E:/api/logs/iClear-api.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- <fileNamePattern>E:/api/logs/iClear-api-%d.log</fileNamePattern>-->
<fileNamePattern>E:/api/logs/iClear-api-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>500MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
......
......@@ -2,22 +2,13 @@
<wls:weblogic-web-app
xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.oracle.com/weblogic/weblogic-web-app
http://xmlns.oracle.com/weblogic/weblogic-web-app/1.4/weblogic-web-app.xsd">
<wls:context-root>/API</wls:context-root>
<!-- <container-descriptor>-->
<!-- <servlet-reload-check-secs>-1</servlet-reload-check-secs>-->
<!-- <prefer-web-inf-classes>true</prefer-web-inf-classes>-->
<!-- </container-descriptor>-->
<!-- <wls:library-ref>-->
<!-- <library-name>lib4iClear2</library-name>-->
<!-- <specification-version>1.0</specification-version>-->
<!-- </wls:library-ref>-->
<!-- 配置路径映射 -->
<!-- <virtual-directory-mapping>-->
<!-- <local-path>/var/share/iclear/resources</local-path>-->
<!-- <url-pattern>/*</url-pattern>-->
<!-- </virtual-directory-mapping>-->
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">
<!-- 访问路径 -->
<wls:context-root>API</wls:context-root>
<!-- 优先加载WEB-INF下lib中的jar包 -->
<wls:container-descriptor>
<wls:prefer-application-packages>
<wls:package-name>org.slf4j</wls:package-name>
</wls:prefer-application-packages>
</wls:container-descriptor>
</wls:weblogic-web-app>
......