Jiaqi.xu

Merge remote-tracking branch 'origin/master'

Showing 34 changed files with 654 additions and 197 deletions
......@@ -9,9 +9,9 @@
<relativePath/>
</parent>
<groupId>com.erry.iclear</groupId>
<artifactId>iclear-api</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<artifactId>ICLEAR-API</artifactId>
<version>1.0.1</version>
<packaging>war</packaging>
<name>iClear-api</name>
<description>iClear-api</description>
<properties>
......@@ -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>
......@@ -109,6 +104,44 @@
<artifactId>httpclient</artifactId>
<version>4.5.3</version>
</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-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>
<profiles>
......
create table T_ICLEAR_API_CHECK_LOG
CREATE TABLE [dbo].[T_ICLEAR_API_CHECK_LOG](
[ID] [bigint] IDENTITY(1,1) NOT NULL,
[request_appid] [varchar](200) NULL,
[request_appkey] [varchar](200) NULL,
[request_token] [varchar](200) NULL,
[consignment_code] [varchar](200) NULL,
[request_text] [text] NULL,
[response_text] [text] NULL,
[request_ip] [varchar](200) NULL,
[create_time] [datetime] NULL,
[success] [int] NULL,
[code] [varchar](200) NULL,
PRIMARY KEY CLUSTERED
(
ID bigint primary key identity (1,1),
request_appid varchar(200),
request_appkey varchar(200),
request_token varchar(200),
consignment_code varchar(200),
request_text text,
response_text text,
request_ip varchar(200),
create_time datetime,
success int,
code varchar(200),
)
[ID] ASC
)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]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
......
......@@ -2,10 +2,20 @@ 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;
/**
......@@ -16,10 +26,18 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication
@EnableScheduling
//@EnableJpaRepositories(value = "com.erry.iclear.dateInterface.repository", repositoryBaseClass = SimpleJpaRepositoryImpl.class)
public class IClearApiApplication {
public class IClearApiApplication extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(IClearApiApplication.class, args);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(IClearApiApplication.class);
}
public String test(){
return "test";
}
}
......
package com.erry.iclear.dateInterface;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
/**
* @author Administrator
*/
public class SpringBootStartApplication extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(IClearApiApplication.class);
}
}
\ No newline at end of file
//package com.erry.iclear.dateInterface;
//
//import org.springframework.boot.builder.SpringApplicationBuilder;
//import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
//
///**
// * @author Administrator
// */
//public class SpringBootStartApplication extends SpringBootServletInitializer {
// @Override
// protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
// return builder.sources(IClearApiApplication.class);
// }
//}
......
......@@ -5,6 +5,7 @@ import com.erry.iclear.dateInterface.api.response.ResultRS;
import com.erry.iclear.dateInterface.entity.IClearApiLog;
import com.erry.iclear.dateInterface.repository.MawbAdd;
import com.erry.iclear.dateInterface.service.*;
import com.erry.iclear.dateInterface.util.StringUtil;
import com.google.gson.Gson;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
......@@ -55,6 +56,15 @@ public class CustomsDataInterface {
result.setMsg("请求信息不能为空");
return result;
}
String checkrs = mawbService.checkMawbBaseInfo(mawb);
if(StringUtil.isNotEmpty(checkrs)){
result.setCode("-7");
result.setMsg(checkrs);
return result;
}
//1、保存请求信息,保存到iClear的 SQLServer
StopWatch sw = new StopWatch("receice mawb");
......@@ -66,6 +76,8 @@ public class CustomsDataInterface {
IClearApiLog saveIClearApiLogResult = iClearApiLogService.saveIClearApiLog(iClearApiLogService.convertToIClearApiLog(mawb,appId,appKey,new Date(Long.valueOf(timeStamp))));
mawb.setAppId(appId);
if(!Objects.equals(saveIClearApiLogResult,null)){
log.info("请求保存成功,msgId:"+saveIClearApiLogResult.getMsgId());
......
......@@ -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")
......@@ -67,8 +66,8 @@ public class FedexDataInterface {
String iclearCSubmitUrl;
@ApiOperation(value = "BASF运单数据校验接口", httpMethod = "POST", notes = "ex: http://192.168.1.75:8080/fedex/checkBASFMawbFedex")
@PostMapping("/checkBASFMawbFedex")
@ApiOperation(value = "C类运单数据校验接口", httpMethod = "POST", notes = "ex: http://192.168.1.75:8080/fedex/checkBASFMawbFedex")
@PostMapping("/checkMawbFedexC")
@ResponseBody
public ResultRS checkBASFMawbFedex(HttpServletRequest request
,@RequestBody Fedexc fedexc) throws HttpProcessException {
......@@ -108,7 +107,11 @@ public class FedexDataInterface {
sw.start("checkFedexMawb");
String msg = result.getMsg();
String iclearCheckMsg = fedexService.checkFedexMawb(saveMawbFedexResult).getMsg();
if(StringUtil.isEmpty(msg) && StringUtil.isEmpty(iclearCheckMsg)){
result.setSuccess(Boolean.TRUE);
}else{
result.setMsg(msg+";"+iclearCheckMsg);
}
sw.stop();
log.info(sw.prettyPrint());
......@@ -131,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,"","");
......@@ -197,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());
......@@ -235,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);
//获取请求的运单号
......@@ -294,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);
//获取请求的运单号
......
......@@ -15,6 +15,7 @@ import java.util.Date;
/**
* @author Administrator
* /hscode/hscodeRequest
*/
@RestController
@RequestMapping("/hscode")
......
......@@ -34,17 +34,14 @@ public class FedexDetail {
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,6 +8,7 @@ import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.*;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
......
......@@ -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")
......
......@@ -42,12 +42,10 @@ public class Mawb implements Serializable {
@ApiModelProperty(value = "进出口标志", name = "IEFlag", example = "固定值:E")
@NotBlank(message="参数ieFlag不能为空")
@Column(name = "IEFLAG")
private String ieFlag;
@ApiModelProperty(value = "报关类型", name = "Type", example = "固定值:EX")
@NotBlank(message="参数type不能为空")
@Column(name = "TYPE")
private String type;
......@@ -62,7 +60,7 @@ public class Mawb implements Serializable {
private String agentName;
@ApiModelProperty(value = "提单号", name = "billNo", example = "固定值:有总单号则取值‘总单号_运单号‘,没有总单号则取值‘运单号‘")
@NotBlank(message="参数billNo不能为空")
//@NotBlank(message="参数billNo不能为空")
@Column(name = "BILLNO")
private String billNo;
......@@ -71,12 +69,12 @@ public class Mawb implements Serializable {
private String contrNo;
@ApiModelProperty(value = "主管海关(申报地海关)", name = "customMaster", example = "固定值:0101")
@NotBlank(message="参数customMaster不能为空")
//@NotBlank(message="参数customMaster不能为空")
@Column(name = "CUSTOMMASTER")
private String customMaster;
@ApiModelProperty(value = "征免性质", name = "cutMode", example = "101")
@NotBlank(message="参数cutMode不能为空")
//@NotBlank(message="参数cutMode不能为空")
@Column(name = "CUTMODE")
private String cutMode;
......@@ -86,7 +84,7 @@ public class Mawb implements Serializable {
private String declTrnRel;
@ApiModelProperty(value = "经停港/指运港", name = "distinatePort", example = "ASM000")
@NotBlank(message="参数distinatePort不能为空")
//@NotBlank(message="参数distinatePort不能为空")
@Column(name = "DISTINATEPORT")
private String distinatePort;
......@@ -100,12 +98,12 @@ public class Mawb implements Serializable {
private String entryId;
@ApiModelProperty(value = "运费币制", name = "feeCurr", example = "固定值:3")
// @NotBlank(message="参数feeCurr不能为空")
//@NotBlank(message="参数feeCurr不能为空")
@Column(name = "FEECURR")
private String feeCurr;
@ApiModelProperty(value = "运费标记", name = "feeMark", example = "99.22")
// @NotBlank(message="参数feeMark不能为空")
//@NotBlank(message="参数feeMark不能为空")
@Column(name = "FEEMARK")
private String feeMark;
......@@ -120,7 +118,7 @@ public class Mawb implements Serializable {
private BigDecimal grossWet;
@ApiModelProperty(value = "出入境关闭", name = "IEPort", example = "固定值:0101")
@NotBlank(message="参数iePort不能为空")
//@NotBlank(message="参数iePort不能为空")
@Column(name = "IEPORT")
private String iePort;
......@@ -129,7 +127,7 @@ public class Mawb implements Serializable {
private String inputerName;
@ApiModelProperty(value = "保险费币制", name = "insurCurr", example = "MOP")
// @NotBlank(message="参数insurCurr不能为空")
//@NotBlank(message="参数insurCurr不能为空")
@Column(name = "INSURCURR")
private String insurCurr;
......@@ -164,17 +162,14 @@ public class Mawb implements Serializable {
private String otherMark;
@ApiModelProperty(value = "消费使用/生产销售单位代码", name = "ownerCode", example = "Z321654987")
@NotBlank(message="参数ownerCode不能为空")
@Column(name = "OWNERCODE")
private String ownerCode;
@ApiModelProperty(value = "消费使用/生产销售单位名称", name = "ownerName", example = "上海保险")
@NotBlank(message="参数ownerName不能为空")
@Column(name = "OWNERNAME")
private String ownerName;
@ApiModelProperty(value = "件数", name = "packNo", example = "")
@NotNull(message="参数packNo不能为空")
@Column(name = "PACKNO")
private Integer packNo;
......@@ -182,52 +177,49 @@ public class Mawb implements Serializable {
private String preEntryId;
@ApiModelProperty(value = "启运国/运抵国", name = "tradeCountry", example = "USA")
@NotBlank(message="参数tradeCountry不能为空")
@Column(name = "TRADECOUNTRY")
private String tradeCountry;
@ApiModelProperty(value = "监管方式", name = "tradeMode", example = "0200")
@NotBlank(message="参数tradeMode不能为空")
@Column(name = "TRADEMODE")
private String tradeMode;
@ApiModelProperty(value = "境内收发货人编号", name = "tradeCode", example = "Z321654987")
@NotBlank(message="参数tradeCode不能为空")
@Column(name = "TRADECODE")
private String tradeCode;
@ApiModelProperty(value = "运输方式代码", name = "trafMode", example = "1")
@NotBlank(message="参数trafMode不能为空")
//@NotBlank(message="参数trafMode不能为空")
@Column(name = "TRAFMODE")
private String trafMode;
@ApiModelProperty(value = "境内收发货人名称", name = "tradeName", example = "上海铢怡国际货物运输代理有限公司")
@NotBlank(message="参数tradeName不能为空")
//@NotBlank(message="参数tradeName不能为空")
@Column(name = "TRADENAME")
private String tradeName;
@ApiModelProperty(value = "成交方式", name = "transMode", example = "2")
@NotBlank(message="参数transMode不能为空")
//@NotBlank(message="参数transMode不能为空")
@Column(name = "TRANSMODE")
private String transMode;
@ApiModelProperty(value = "包装种类", name = "wrapType", example = "22")
@NotBlank(message="参数wrapType不能为空")
//@NotBlank(message="参数wrapType不能为空")
@Column(name = "WRAPTYPE")
private String wrapType;
@ApiModelProperty(value = "生产核销单位统一信用代码---报关形式类型", name = "TradeCodeScc", example = "A74125896321456987")
@NotBlank(message="参数tradeCodeScc不能为空")
//@NotBlank(message="参数tradeCodeScc不能为空")
@Column(name = "TRADECODESCC")
private String tradeCodeScc;
@ApiModelProperty(value = "消费使用/生产销售单位单位统一编码", name = "ownerCodeScc", example = "")
@NotBlank(message="参数ownerCodeScc不能为空")
//@NotBlank(message="参数ownerCodeScc不能为空")
@Column(name = "OWNERCODESCC")
private String ownerCodeScc;
@ApiModelProperty(value = "贸易国别", name = "tradeAreaCode", example = "")
@NotBlank(message="参数tradeAreaCode不能为空")
//@NotBlank(message="参数tradeAreaCode不能为空")
@Column(name = "TRADEAREACODE")
private String tradeAreaCode;
......@@ -256,7 +248,7 @@ public class Mawb implements Serializable {
private String overseasConsigneeCode;
@ApiModelProperty(value = "境外收货人名称(外文)", name = "overseasConsigneeEname", example = "")
@NotBlank(message="参数overseasConsigneeEname不能为空")
//@NotBlank(message="参数overseasConsigneeEname不能为空")
@Column(name = "OVERSEASCONSIGNEEENAME")
private String overseasConsigneeEname;
......
......@@ -34,7 +34,7 @@ public class MawbDetail implements Serializable{
private Long mawbId;
@Column(name="DETAILID")
@NotBlank(message="参数detailId不能为空")
//@NotBlank(message="参数detailId不能为空")
private String detailId;
@ApiModelProperty(value = "归类标志", example = "空值")
......@@ -42,7 +42,7 @@ public class MawbDetail implements Serializable{
private String classMark;
@ApiModelProperty(value = "商品编号")
@NotBlank(message="参数codeTS不能为空")
//@NotBlank(message="参数codeTS不能为空")
@Column(name = "CODETS")
private String codeTS;
......@@ -57,7 +57,7 @@ public class MawbDetail implements Serializable{
private BigDecimal declTotal;
@ApiModelProperty(value = "征免方式")
@NotBlank(message="参数dutyMode不能为空")
//@NotBlank(message="参数dutyMode不能为空")
@Column(name = "DUTYMODE")
private String dutyMode;
......@@ -70,7 +70,7 @@ public class MawbDetail implements Serializable{
private String exgVersion;
@ApiModelProperty(value = "第一计量单位(法定单位)")
@NotBlank(message="参数firstUnit不能为空")
//@NotBlank(message="参数firstUnit不能为空")
@Column(name = "FIRSTUNIT")
private String firstUnit;
......@@ -80,22 +80,22 @@ public class MawbDetail implements Serializable{
private Integer firstQty;
@ApiModelProperty(value = "成交计量单位")
@NotBlank(message="参数gunit不能为空")
//@NotBlank(message="参数gunit不能为空")
@Column(name = "GUNIT")
private String gunit;
@ApiModelProperty(value = "商品规格、型号")
@NotBlank(message="参数gmodel不能为空")
//@NotBlank(message="参数gmodel不能为空")
@Column(name = "GMODE")
private String gmodel;
@ApiModelProperty(value = "商品名称")
@NotBlank(message="参数gname不能为空")
//@NotBlank(message="参数gname不能为空")
@Column(name = "GNAME")
private String gname;
@ApiModelProperty(value = "商品序号")
@NotBlank(message="参数gno不能为空")
//@NotBlank(message="参数gno不能为空")
@Column(name = "GNO")
private String gno;
......@@ -105,7 +105,7 @@ public class MawbDetail implements Serializable{
private BigDecimal gqty;
@ApiModelProperty(value = "原产国")
@NotBlank(message="参数originCountry不能为空")
//@NotBlank(message="参数originCountry不能为空")
@Column(name = "ORIGINCURRENTY")
private String originCountry;
......@@ -118,7 +118,7 @@ public class MawbDetail implements Serializable{
private Integer secondQty;
@ApiModelProperty(value = "成交币制")
@NotBlank(message="参数tradeCurr不能为空")
//@NotBlank(message="参数tradeCurr不能为空")
@Column(name = "TRADECURR")
private String tradeCurr;
......@@ -135,7 +135,7 @@ public class MawbDetail implements Serializable{
private String ciqCode;
@ApiModelProperty(value = "最终目的国(地区)")
@NotBlank(message="参数destinationCountry不能为空")
//@NotBlank(message="参数destinationCountry不能为空")
@Column(name = "DESTINATIONCOUNTRY")
private String destinationCountry;
......@@ -148,7 +148,7 @@ public class MawbDetail implements Serializable{
private String destCode;
@ApiModelProperty(value = "境内目的地/境内货源地")
@NotBlank(message="参数districtCode不能为空")
//@NotBlank(message="参数districtCode不能为空")
@Column(name = "DISTRICTCODE")
private String districtCode;
......
......@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RestController;
/**
* @author Administrator
*
*/
@RestController
@RequestMapping("/system")
......
......@@ -62,6 +62,14 @@ public class ApiService {
@Value("${api.address.complete-msg-url}")
String completeMsgUrl;
@Value("${api.address.proxy-url}")
String proxyUrl;
@Value("${api.address.proxy-port}")
Integer proxyPort;
@Value("${spring.profiles.active}")
String env;
@Autowired
ReceiptMessageRepository receiptMessageRepository;
......@@ -89,7 +97,11 @@ public class ApiService {
Map<String,String> map = new HashMap<String,String>();
map.put("username", this.username);
map.put("password", this.password);
String tokenJson = HttpUtils.doPost(this.tokenUrl,map);
// String tokenJson = HttpUtils.doPost(this.tokenUrl,map);
log.info("tokenUrl:"+this.tokenUrl);
String tokenJson = HttpUtils.doProxyPost(this.tokenUrl,map,this.proxyUrl,this.proxyPort);
log.info("getToken:"+tokenJson);
TokenResult tokenResult = JsonToJava.parseJson(tokenJson,TokenResult.class);
return tokenResult;
}
......@@ -109,6 +121,7 @@ public class ApiService {
* 传输海关回执数据
* @param token
* @throws Exception
* GNo、codeTs、gName、gModel、gUnit
*/
public void pushCustoms(String token){
//获取海关回执数据
......@@ -141,7 +154,8 @@ public class ApiService {
String objJson = JsonToJava.toJson(d);
log.info("推送海关回执json: " + objJson);
//推送海关回执数据
String json = HttpUtils.doPost(this.customsUrl,objJson,headerMap);
// String json = HttpUtils.doPost(this.customsUrl,objJson,headerMap);
String json = HttpUtils.doProxyPost(this.customsUrl,objJson,headerMap,this.proxyUrl,this.proxyPort);
//接口响应时间
declearTask.setResponseTime(new Date());
TokenResult tokenResult = JsonToJava.parseJson(json,TokenResult.class);
......@@ -167,6 +181,8 @@ public class ApiService {
declearTask.setResponseResults("99999");
declearTask.setResponseContent(ex.getMessage());
declearTaskList.add(declearTask);
log.error(ex.getMessage(),ex);
}
});
declearTaskList.forEach(declearTask -> {
......@@ -237,7 +253,8 @@ public class ApiService {
declearTask.setPushTime(new Date());
String objJson = JsonToJava.toJson(d);
//推送海关回执数据
String json = HttpUtils.doPost(this.customsUrl,objJson,headerMap);
String json = HttpUtils.doProxyPost(this.customsUrl,objJson,headerMap,this.proxyUrl,this.proxyPort);
log.info("sendMawb:"+json);
//接口响应时间
declearTask.setResponseTime(new Date());
TokenResult tokenResult = JsonToJava.parseJson(json,TokenResult.class);
......@@ -262,7 +279,8 @@ public class ApiService {
declearTask.setResponseResults("99999");
declearTask.setResponseContent(ex.getMessage());
declearTaskList.add(declearTask);
log.error("sendMawb",ex);
log.error(ex.getMessage(),ex);
}
});
declearTaskList.forEach(declearTask -> {
......
......@@ -234,7 +234,7 @@ public class ChmConsignmentService {
}catch (Exception e){
result=null;
log.error("sendMawb",e);
log.error(e.getMessage(),e);
}
return result;
}
......@@ -291,7 +291,7 @@ public class ChmConsignmentService {
}
}catch (Exception e){
result=null;
log.error("convertToChmConsignmentFedex() error:"+e.getMessage(),e);
log.error(e.getMessage(),e);
}
return result;
}
......@@ -428,7 +428,7 @@ public class ChmConsignmentService {
result.setOverseasConsigneeEname(consignment.getOverseasConsignorFnCname());
}catch (Exception e){
result=null;
log.error("convertToChmConsignment() error:"+e.getMessage(),e);
log.error(e.getMessage(),e);
}
return result;
}
......
......@@ -13,6 +13,8 @@ import java.util.List;
@Slf4j
public class FedexConsignmentService {
public List<FedexConsignment> fedexConsignmentList(List<DeclaredInfo> consignment){
List<FedexConsignment> fedexConsignmentList = new ArrayList<>();
try{
......
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,23 @@ 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);
log.info("iclearCheckUrl:"+json);
IClearCheckResponseResult iclearCheckResponseResult = JsonToJava.parseJson(json, IClearCheckResponseResult.class);
result.setSuccess(iclearCheckResponseResult.getSuccess());
result.setCode(iclearCheckResponseResult.getCode());
......
......@@ -83,7 +83,6 @@ public class HsCodeService {
resultHsCode.setHsCodeResultList(hsCodeList);
}catch(Exception ex){
log.error(ex.getMessage(),ex);
resultHsCode.setSuccess(Boolean.FALSE);
resultHsCode.setCode("30101");
resultHsCode.setMsg("数据查询异常");
......
......@@ -2,14 +2,20 @@ package com.erry.iclear.dateInterface.service;
import com.erry.iclear.dateInterface.api.request.Fedexc;
import com.erry.iclear.dateInterface.api.request.Mawb;
import com.erry.iclear.dateInterface.api.request.MawbDetail;
import com.erry.iclear.dateInterface.common.Constant;
import com.erry.iclear.dateInterface.entity.IClearApiLog;
import com.erry.iclear.dateInterface.repository.IClearApiLogRepository;
import com.erry.iclear.dateInterface.util.StringUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import java.util.Date;
import java.util.List;
import java.util.Objects;
/**
* @author Administrator
......@@ -30,7 +36,7 @@ public class IClearApiLogService {
try{
return iClearApiLogRepository.save(iClearApiLog);
}catch (Exception e){
log.error("saveIClearApiLog() error:"+ e.getMessage());
log.error(e.getMessage(),e);
}
return null;
}
......
......@@ -4,11 +4,13 @@ import com.arronlong.httpclientutil.HttpClientUtil;
import com.arronlong.httpclientutil.common.HttpConfig;
import com.arronlong.httpclientutil.common.HttpHeader;
import com.erry.iclear.dateInterface.api.request.Mawb;
import com.erry.iclear.dateInterface.api.request.MawbDetail;
import com.erry.iclear.dateInterface.api.response.IClearCheckResponseResult;
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;
......@@ -62,6 +64,113 @@ public class MawbService {
}
public String checkMawbBaseInfo(Mawb mawb){
if(StringUtil.isEmpty(mawb.getOverseasConsigneeEname())){
return "参数overseasConsigneeEname不能为空";
}
// if(StringUtil.isEmpty(mawb.getEntyPortCode())){
// return "参数entyPortCode不能为空";
// }
if(StringUtil.isEmpty(mawb.getOwnerCodeScc())){
return "参数ownerCodeScc不能为空";
}
if(StringUtil.isEmpty(mawb.getTradeCodeScc())){
return "参数tradeCodeScc不能为空";
}
if(StringUtil.isEmpty(mawb.getTransMode())){
return "参数transMode不能为空";
}
if(StringUtil.isEmpty(mawb.getWrapType())){
return "参数wrapType不能为空";
}
if(StringUtil.isEmpty(mawb.getTradeName())){
return "参数tradeName不能为空";
}
// if(StringUtil.isEmpty(mawb.getInsurCurr())){
// return "参数insurCurr不能为空";
// }
if(StringUtil.isEmpty(mawb.getIePort())){
return "参数iePort不能为空";
}
// if(StringUtil.isEmpty(mawb.getFeeMark())){
// return "参数feeMark不能为空";
// }
// if(StringUtil.isEmpty(mawb.getFeeCurr())){
// return "参数feeCurr不能为空";
// }
// if(StringUtil.isEmpty(mawb.getEdiId())){
// return "参数ediId不能为空";
// }
if(StringUtil.isEmpty(mawb.getDistinatePort())){
return "参数distinatePort不能为空";
}
// if(StringUtil.isEmpty(mawb.getDeclTrnRel())){
// return "参数declTrnRel不能为空";
// }
if(StringUtil.isEmpty(mawb.getCutMode())){
return "参数cutMode不能为空";
}
if(StringUtil.isEmpty(mawb.getCustomMaster())){
return "参数customMaster不能为空";
}
if(StringUtil.isEmpty(mawb.getBillNo())){
return "参数billNo不能为空";
}
if(StringUtil.isEmpty(mawb.getAgentName())){
return "参数agentName不能为空";
}
if(StringUtil.isEmpty(mawb.getAgentCode())){
return "参数agentCode不能为空";
}
List<MawbDetail> mawbDetailList = mawb.getMawbDetailList();
if(Objects.nonNull(mawbDetailList)){
for (int i = 0, maxi = mawbDetailList.size(); i < maxi; i++) {
MawbDetail mawbDetail = mawbDetailList.get(i);
if(StringUtil.isEmpty(mawbDetail.getDetailId())){
return "参数detailId不能为空";
}
if(StringUtil.isEmpty(mawbDetail.getCodeTS())){
return "参数codeTS不能为空";
}
if(StringUtil.isEmpty(mawbDetail.getDutyMode())){
return "参数dutyMode不能为空";
}
if(StringUtil.isEmpty(mawbDetail.getFirstUnit())){
return "参数firstUnit不能为空";
}
if(StringUtil.isEmpty(mawbDetail.getGunit())){
return "参数gunit不能为空";
}
if(StringUtil.isEmpty(mawbDetail.getGmodel())){
return "参数gmodel不能为空";
}
if(StringUtil.isEmpty(mawbDetail.getGname())){
return "参数gname不能为空";
}
if(StringUtil.isEmpty(mawbDetail.getGno())){
return "参数gno不能为空";
}
if(StringUtil.isEmpty(mawbDetail.getOriginCountry())){
return "参数originCountry不能为空";
}
if(StringUtil.isEmpty(mawbDetail.getTradeCurr())){
return "参数tradeCurr不能为空";
}
if(StringUtil.isEmpty(mawbDetail.getDestinationCountry())){
return "参数destinationCountry不能为空";
}
if(StringUtil.isEmpty(mawbDetail.getDistrictCode())){
return "参数districtCode不能为空";
}
}
}
return "";
}
/**
* 校验主单
* @param mawb
......@@ -93,17 +202,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());
......
......@@ -54,6 +54,27 @@ public class IClearApiTask {
log.error("pushMawbTask() error:" +e.getMessage());
}
}
/**
* 获取token
* @throws Exception
*/
private void getToken() throws Exception{
if(token == null){
try {
//获取token
TokenResult tokenResult = apiService.getToken();
if(tokenResult.getErrorcode().equals(Constants.ApiResponseKeys.SUCCESS)){
this.token = tokenResult.getData().getToken();
}
}catch(Exception ex){
log.error(ex.getMessage(),ex);
}
}
if(this.token == null){
throw new Exception("获取token失败!");
}
}
/*
* wy on 2022年1月20日17:50:57
* 经clj确认,这两个任务没有必要
......@@ -90,25 +111,4 @@ public class IClearApiTask {
}*//*
}*/
/**
* 获取token
* @throws Exception
*/
private void getToken() throws Exception{
if(token == null){
try {
//获取token
TokenResult tokenResult = apiService.getToken();
if(tokenResult.getErrorcode().equals(Constants.ApiResponseKeys.SUCCESS)){
this.token = tokenResult.getData().getToken();
}
}catch(Exception ex){
log.error(ex.getMessage(),ex);
}
}
if(this.token == null){
throw new Exception("获取token失败!");
}
}
}
......
package com.erry.iclear.dateInterface.util;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.apache.http.HttpEntity;
import org.apache.http.HttpHost;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.conn.params.ConnRoutePNames;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
/**
* 利用HttpClient进行post请求的工具类
......@@ -23,6 +28,88 @@ import org.apache.http.util.EntityUtils;
public class HttpUtils {
private static String CHARSET = "utf-8";
/**
* post请求
* @param url
* @param json
* @return
*/
public static String doProxyPost(String url,String json,Map<String,String> headerMap,String proxyUrl,Integer port) throws Exception {
HttpClient httpClient = null;
HttpPost httpPost = null;
String result = null;
httpClient = SSLClient.getProxyHttpsClient(proxyUrl,port);
try{
httpPost = new HttpPost(url);
//设置参数
List<NameValuePair> list = new ArrayList<NameValuePair>();
StringEntity entity = new StringEntity(json, HttpUtils.CHARSET);//解决中文乱码问题
entity.setContentEncoding("UTF-8");
entity.setContentType("application/json");
httpPost.setEntity(entity);
Iterator headerIterator = headerMap.entrySet().iterator();
while(headerIterator.hasNext()){
Entry<String,String> elem = (Entry<String, String>) headerIterator.next();
httpPost.addHeader(elem.getKey(),elem.getValue());
}
// /** 设置代理IP **/
// HttpHost proxy = new HttpHost(proxyUrl, 3128);
// httpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY,proxy);
HttpResponse response = httpClient.execute(httpPost);
if(response != null){
HttpEntity resEntity = response.getEntity();
if(resEntity != null){
result = EntityUtils.toString(resEntity,HttpUtils.CHARSET);
}
}
} finally {
httpClient.getConnectionManager().shutdown(); //关闭连接
}
return result;
}
public static String doProxyPost(String url,Map<String,String> paramMap,String proxyUrl,Integer port) throws Exception {
// HttpClient httpClient = null;
HttpPost httpPost = null;
String result = null;
HttpClient httpClient = SSLClient.getProxyHttpsClient(proxyUrl,port);
try{
httpPost = new HttpPost(url);
//设置参数
List<NameValuePair> list = new ArrayList<NameValuePair>();
Iterator iterator = paramMap.entrySet().iterator();
while(iterator.hasNext()){
Entry<String,String> elem = (Entry<String, String>) iterator.next();
list.add(new BasicNameValuePair(elem.getKey(),elem.getValue()));
}
if(list.size() > 0){
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(list,HttpUtils.CHARSET);
httpPost.setEntity(entity);
}
/** 设置代理IP **/
// HttpHost proxy = new HttpHost(proxyUrl, 3128);
// httpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY,proxy);
HttpResponse response = httpClient.execute(httpPost);
if(response != null){
HttpEntity resEntity = response.getEntity();
if(resEntity != null){
result = EntityUtils.toString(resEntity,HttpUtils.CHARSET);
}
}
} finally {
httpClient.getConnectionManager().shutdown(); //关闭连接
}
return result;
}
/**
* post请求
* @param url
......@@ -62,6 +149,7 @@ public class HttpUtils {
return result;
}
/**
* post请求 map参数
* @param url
......
package com.erry.iclear.dateInterface.util;
import java.io.IOException;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import com.alibaba.fastjson.JSONObject;
import org.apache.http.HttpHost;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.conn.ClientConnectionManager;
import org.apache.http.conn.scheme.Scheme;
import org.apache.http.conn.scheme.SchemeRegistry;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.conn.ssl.SSLSocketFactory;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
/**
* 用于进行Https请求的HttpClient,指定传输协议为TLSv1.2
......@@ -19,6 +32,9 @@ import org.apache.http.impl.client.DefaultHttpClient;
public class SSLClient extends DefaultHttpClient{
public SSLClient() throws Exception{
super(); //传输协议需要根据自己的判断 
trustAllHosts();
}
private void trustAllHosts() throws NoSuchAlgorithmException, KeyManagementException {
SSLContext ctx = SSLContext.getInstance("TLSv1.2");
X509TrustManager tm = new X509TrustManager() {
@Override
......@@ -40,4 +56,40 @@ public class SSLClient extends DefaultHttpClient{
SchemeRegistry sr = ccm.getSchemeRegistry();
sr.register(new Scheme("https", 443, ssf));
}
public CloseableHttpClient getProxyHttpClient(String qlb,int port){
HttpHost proxy = new HttpHost(qlb, port, "http");
//把代理设置到请求配置
RequestConfig defaultRequestConfig = RequestConfig.custom()
.setProxy(proxy)
.build();
CloseableHttpClient httpclient = HttpClients.custom().setDefaultRequestConfig(defaultRequestConfig).build();
return httpclient;
}
public static CloseableHttpClient getProxyHttpsClient(String qlb,Integer port) throws NoSuchAlgorithmException, KeyManagementException {
X509TrustManager x509mgr = new X509TrustManager() {
@Override
public void checkClientTrusted(X509Certificate[] xcs, String string) {
}
@Override
public void checkServerTrusted(X509Certificate[] xcs, String string) {
}
@Override
public X509Certificate[] getAcceptedIssuers() {
return null;
}
};
SSLContext sslContext = SSLContext.getInstance("TLS");
sslContext.init(null, new TrustManager[] { x509mgr }, null);
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslContext, SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
HttpHost proxy = new HttpHost(qlb, port, "http");
RequestConfig defaultRequestConfig = RequestConfig.custom()
.setProxy(proxy)
.build();
CloseableHttpClient httpclient = HttpClients.custom().setSSLSocketFactory(sslsf)
.setDefaultRequestConfig(defaultRequestConfig).build();
return httpclient;
}
}
......
spring:
servlet:
context-path: /API
datasource:
url: jdbc:sqlserver://40.73.78.157:1433;DatabaseName=IClearDev
# jndi-name: jdbc/iclearDS
# jndi-name: jdbc/iclearProdTestDS
url: jdbc:sqlserver://40.73.78.157:1433;DatabaseName=IClearUat
username: sa
password: Fedex_123
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
type: com.alibaba.druid.pool.DruidDataSource
task:
#推送海关回执
pushCustomsTask: 0 0/1 * * * ?
pushCustomsTask: 0 0/1 * 1 * ?
#推送完整报文
pushMawbTask: 0 0/1 * * * ?
pushMawbTask: 0 0/1 * 1 * ?
#推送失败的回执数据
pushErrorReturnDate: 0 0/30 * * * ?
pushErrorReturnDate: 0 0/3 * 1 * ?
#推送失败的申报数据
pushErrorDeclareDate: 0 0/30 * * * ?
pushErrorDeclareDate: 0 0/3 * 1 * ?
#推送地址
api:
base-address: https://declarationuat.fedex.com.cn/Exp
token-info:
#获取token账号
username: iclear_external_ctm
#获取token密码
password: toQu3arch6
address:
#IClear校验运单地址
iclear-check-url: http://139.217.114.139:8082/chmConsignmentController/checkChmAndDetaliD
#IClearC类提交运单地址
iclear-submit-url: http://139.217.114.139:8082/chmConsignmentController/submitConsignments
iclear-submit-url: ${api.base-address}/chmConsignmentController/submitConsignments
#IClear校验运单地址
iclear-check-url: ${api.base-address}/chmConsignmentController/checkChmAndDetaliD
#IClear校验C类运单地址
iclear-check-url-c: http://139.217.114.139:8082/chmConsignmentController/checkChmAndDetaliC
iclear-check-url-c: ${api.base-address}/chmConsignmentController/checkChmAndDetaliC
#获取token地址
token-url: https://apiuat.iclrccd-fedex.com/login
# token-url: https://apictm.iclrccd-fedex.com/login
#刷新token地址
refresh-token-url: https://apiuat.iclrccd-fedex.com/admin/user/token/refresh
refresh-token-url: https://apiuat.iclrccd-fedex.com/user/token/refresh
#传输海关回执地址
customs-url: https://apiuat.iclrccd-fedex.com/export/outbound/customs
#推送完整报文地址
complete-msg-url: https://apiuat.iclrccd-fedex.com/export/outbound/mawb
#代理地址(刷新token、传输海关回执地址、推送完整报文地址)
# http://cn2-proxy.apac.fedex.com:3128
# http://internet.proxy.fedex.com
proxy-url: cn2-proxy.apac.fedex.com
proxy-port: 3128
......
spring:
servlet:
context-path: /API
datasource:
url: jdbc:sqlserver://yilansql.database.chinacloudapi.cn:1433;DatabaseName=IClear_Prod
username: sqladmin
password: ZXC1@3asd2019
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
type: com.alibaba.druid.pool.DruidDataSource
jndi-name: jdbc/iclearDS
# jndi-name: jdbc/iclearProdTestDS
# url: jdbc:sqlserver://40.73.78.157:1433;DatabaseName=IClearUat
# username: sa
# password: Fedex_123
# driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
# type: com.alibaba.druid.pool.DruidDataSource
task:
#推送海关回执
......@@ -18,18 +23,19 @@ task:
#推送地址
api:
base-address: https://declaration.fedex.com.cn/Exp
token-info:
#获取token账号 非prod
username: iclear_export_prod
#获取token密码
password: 1qaz@WSX
address:
#IClear校验运单地址
iclear-check-url: https://www.iclrccd-fedex.com/chmConsignmentController/checkChmAndDetaliD
#IClearC类提交运单地址
iclear-submit-url: https://www.iclrccd-fedex.com/chmConsignmentController/submitConsignments
iclear-submit-url: ${api.base-address}/chmConsignmentController/submitConsignments
#IClear校验运单地址
iclear-check-url: ${api.base-address}/chmConsignmentController/checkChmAndDetaliD
#IClear校验C类运单地址
iclear-check-url-c: https://www.iclrccd-fedex.com/chmConsignmentController/checkChmAndDetaliC
iclear-check-url-c: ${api.base-address}/chmConsignmentController/checkChmAndDetaliC
#获取token地址
token-url: https://apictm.iclrccd-fedex.com/login
#刷新token地址
......@@ -38,3 +44,8 @@ api:
customs-url: https://apictm.iclrccd-fedex.com/export/outbound/customs
#推送完整报文地址
complete-msg-url: https://apictm.iclrccd-fedex.com/export/outbound/mawb
#代理地址(刷新token、传输海关回执地址、推送完整报文地址)
# http://cn2-proxy.apac.fedex.com:3128
# http://internet.proxy.fedex.com
proxy-url: cn2-proxy.apac.fedex.com
proxy-port: 3128
......
spring:
servlet:
context-path: /API
datasource:
url: jdbc:sqlserver://40.73.78.157:1433;DatabaseName=IClearUat
username: sa
password: Fedex_123
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
type: com.alibaba.druid.pool.DruidDataSource
jndi-name: jdbc/iclearDS
# jndi-name: jdbc/iclearProdTestDS
# url: jdbc:sqlserver://40.73.78.157:1433;DatabaseName=IClearUat
# username: sa
# password: Fedex_123
# driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
# type: com.alibaba.druid.pool.DruidDataSource
task:
#推送海关回执
......@@ -12,27 +17,36 @@ task:
#推送完整报文
pushMawbTask: 0 0/1 * * * ?
#推送失败的回执数据
pushErrorReturnDate: 0 0/30 * * * ?
pushErrorReturnDate: 0 0/3 * * * ?
#推送失败的申报数据
pushErrorDeclareDate: 0 0/30 * * * ?
pushErrorDeclareDate: 0 0/3 * * * ?
#推送地址
api:
base-address: https://declarationuat.fedex.com.cn/Exp
token-info:
#获取token账号
username: iclear_external_ctm
#获取token密码
password: toQu3arch6
address:
#IClearC类提交运单地址
iclear-submit-url: ${api.base-address}/chmConsignmentController/submitConsignments
#IClear校验运单地址
iclear-check-url: http://139.217.114.139:8082/chmConsignmentController/checkChmAndDetaliD
iclear-check-url: ${api.base-address}/chmConsignmentController/checkChmAndDetaliD
#IClear校验C类运单地址
iclear-check-url-c: http://139.217.114.139:8082/chmConsignmentController/checkChmAndDetaliC
iclear-check-url-c: ${api.base-address}/chmConsignmentController/checkChmAndDetaliC
#获取token地址
token-url: https://apiuat.iclrccd-fedex.com/login
# token-url: https://apictm.iclrccd-fedex.com/login
#刷新token地址
refresh-token-url: https://apiuat.iclrccd-fedex.com/user/token/refresh
#传输海关回执地址
customs-url: https://apiuat.iclrccd-fedex.com/export/outbound/customs
#推送完整报文地址
complete-msg-url: https://apiuat.iclrccd-fedex.com/export/outbound/mawb
#代理地址(刷新token、传输海关回执地址、推送完整报文地址)
# http://cn2-proxy.apac.fedex.com:3128
# http://internet.proxy.fedex.com
proxy-url: cn2-proxy.apac.fedex.com
proxy-port: 3128
......
......@@ -9,13 +9,12 @@ server:
spring:
application:
name: iClearExport.DataInterface
profiles:
active: @activatedProperties@
# active: dev
application:
name: iClearExport.DataInterface
jpa:
database: sql_server
show-sql: true
......
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<contextName>iClear-api</contextName>
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
<property name="LOG_HOME" value="/var/fedex/dxpweb/weblogic/api/log/"/>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="ch.qos.logback.classic.PatternLayout">
<pattern>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level [%thread{0}] %c{0} - %msg%n</pattern>
</pattern>
</layout>
</encoder>
</appender>
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<prudent>false</prudent>
<append>true</append>
<file>${LOG_HOME}/iClear-api.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_HOME}/iClear-api-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>500MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<maxHistory>30</maxHistory>
<totalSizeCap>1GB</totalSizeCap>
</rollingPolicy>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level [%thread{0}] %c{0} - %msg%n</pattern>
<charset>utf-8</charset>
</encoder>
</appender>
<logger name="io.lettuce.core" level="ERROR" />
<logger name="com.netflix" level="OFF" />
<springProfile name="dev | test">
<root level="info">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE"/>
</root>
</springProfile>
<springProfile name="prod">
<root level="info">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE"/>
</root>
</springProfile>
</configuration>
......@@ -17,7 +17,7 @@
<append>true</append>
<file>E:/api/logs/iClear-api.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>E:/api/logs/iClear-api-%d.%i.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>
......@@ -39,10 +39,6 @@
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE"/>
</root>
<root level="error">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE"/>
</root>
</springProfile>
<springProfile name="prod">
......
<?xml version="1.0" encoding="UTF-8"?>
<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://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-web-inf-classes>true</wls:prefer-web-inf-classes>-->
<!-- </wls:container-descriptor>-->
</wls:weblogic-web-app>
......@@ -31,8 +31,13 @@ public class ApiTest {
public static String security = "bb348f1ba6ab7cc1";
public static void main(String[] args) throws Exception{
// BASF,iClearExportC,6db193cb4165a71b
System.out.println(new Date(Long.valueOf(timeStamp)));
String token = SHA256Util.getSHA256String("BASF" + "iClearExportC" + "b92131f03f19a348" + ApiTest.timeStamp);
System.out.println(token);
//D类申报的数据落地接口
ApiTest.sendMawb();
// ApiTest.sendMawb();
//C类申报的数据落地接口
// ApiTest.sendMawbBasf();
//C类EDI数据接口
......@@ -51,7 +56,7 @@ public class ApiTest {
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\"}]}";
System.out.println(new Date(Long.valueOf(timeStamp)));
String token = SHA256Util.getSHA256String("DEMO1" + "iClearExportDemo1" + ApiTest.security + ApiTest.timeStamp);
String token = SHA256Util.getSHA256String("DEMO1" + "iClearExportDemo1" + "bb348f1ba6ab7cc1" + ApiTest.timeStamp);
System.out.println(token);
// Header[] headers = HttpHeader.custom()
......