wei.zhou

日志落地

1 +
2 +
3 +CREATE TABLE T_ICLEAR_API_LOG(
4 + MSGID int identity(1,1) primary key --PK
5 + ,MSG_TYPE VARCHAR(20) --类型
6 + ,APPID VARCHAR(20) --用户ID
7 + ,APPKEY VARCHAR(20) --用户key
8 + ,CREATE_TIME datetime --创建时间
9 + ,UPDATE_TIME datetime --更新时间
10 + --,REQUEST_MSG VARCHAR(500)
11 + ,RECEIVE_RESULT VARCHAR(100) --记录接收后是否验证通过的结果
12 + ,RESPONSE_TIME datetime -- 响应时间
13 + ,SPEND_TIME numeric(5, 0) --消耗时间(ms)
14 + ,SENDTIMES datetime --更新次数
15 + ,BILLNO VARCHAR(20) --运单号
16 + ,CONTRNO VARCHAR(20) --合同号
17 +)
18 +
19 +
20 +
21 +
22 +
23 +CREATE TABLE T_ICLEAR_API_MAWB(
24 + ID int identity(1,1) primary key --PK
25 + ,MSGID int
26 + ,IEFlag varchar(1)
27 + ,TYPE VARCHAR(6)
28 + ,AGENTCODE VARCHAR(18)
29 + ,AGENTNAME VARCHAR(70)
30 + ,BILLNO VARCHAR(32)
31 + ,CONTRNO VARCHAR(32)
32 + ,CUSTOMMASTER VARCHAR(4)
33 + ,CUTMODE VARCHAR(3)
34 + ,DECLTRNREL VARCHAR(1)
35 + ,DISTINATEPORT VARCHAR(6)
36 + ,EDIID VARCHAR(3)
37 + ,ENTRYID VARCHAR(18)
38 + ,FEECURR VARCHAR(3)
39 + ,FEEMARK VARCHAR(1)
40 + ,FEERATE NUMERIC(19,5)
41 + ,CROSSWET NUMERIC(19,5)
42 + ,IEPORT VARCHAR(4)
43 + ,INPUTERNAME VARCHAR(32)
44 + ,INSURCURR VARCHAR(3)
45 + ,INSURMARK VARCHAR(1)
46 + ,INSURRATE NUMERIC(19,5)
47 + ,MANUALNO VARCHAR(12)
48 + ,NETWT NUMERIC(19,5)
49 + ,OTHERCURR VARCHAR(3)
50 + ,OTHERRATE NUMERIC(19,5)
51 + ,OTHERMARK VARCHAR(1)
52 + ,OWNERCODE VARCHAR(18)
53 + ,OWNERNAME VARCHAR(70)
54 + ,PACKNO NUMERIC(9)
55 + ,PREENTRYID VARCHAR(9)
56 + ,TRADECOUNTRY VARCHAR(3)
57 + ,TRADEMODE VARCHAR(4)
58 + ,TRADECODE VARCHAR(18)
59 + ,TRAFMODE VARCHAR(1)
60 + ,TRADENAME VARCHAR(70)
61 + ,TRANSMODE VARCHAR(1)
62 + ,WRAPTYPE VARCHAR(2)
63 + ,TRADECODESCC VARCHAR(18)
64 + ,OWNERCODESCC VARCHAR(18)
65 + ,TRADEAREACODE VARCHAR(3)
66 + ,MARKNO VARCHAR(400)
67 + ,ENTYPORTCODE VARCHAR(8)
68 + ,GOODSPLACE VARCHAR(100)
69 + ,DECLARENAME VARCHAR(50)
70 + ,OVERSEASCONSIGNORCODE VARCHAR(50)
71 + ,OVERSEASCONSIGNEECODE VARCHAR(50)
72 + ,OVERSEASCONSIGNEEENAME VARCHAR(400)
73 +)
74 +
75 +
76 +CREATE TABLE T_ICLEAR_API_MAWBDETAIL(
77 + ID int identity(1,1) primary key --PK
78 + ,MSGID int
79 + ,MAWBID int
80 + ,CLASSMARK VARCHAR(1)
81 + ,CODETS VARCHAR(10)
82 + ,DECLPRICE NUMERIC(19,5)
83 + ,DECLTOTAL NUMERIC(19,5)
84 + ,DUTYMODE VARCHAR(1)
85 + ,EXGNO VARCHAR(30)
86 + ,EXGVERSION VARCHAR(8)
87 + ,FIRSTUNIT VARCHAR(3)
88 + ,FIRSTQTY NUMERIC(19,5)
89 + ,GUNIT VARCHAR(3)
90 + ,GMODE VARCHAR(255)
91 + ,GNAME VARCHAR(255)
92 + ,GNO NUMERIC(19)
93 + ,GQTY NUMERIC(19,5)
94 + ,ORIGINCURRENTY VARCHAR(3)
95 + ,SECONDUNIT VARCHAR(3)
96 + ,SECONDQTY NUMERIC(19,5)
97 + ,TRADECURR VARCHAR(3)
98 + ,USETO VARCHAR(2)
99 + ,WORKUSD NUMERIC(19,4)
100 + ,DESTINATIONCOUNTRY VARCHAR(3)
101 + ,CIQCODE VARCHAR(20)
102 + ,DECLGOODSENAME VARCHAR(100)
103 + ,DESTCODE VARCHAR(8)
104 + ,DISTRICTCODE VARCHAR(5)
105 +
106 +)
...\ No newline at end of file ...\ No newline at end of file
...@@ -39,6 +39,22 @@ ...@@ -39,6 +39,22 @@
39 <scope>provided</scope> 39 <scope>provided</scope>
40 </dependency> 40 </dependency>
41 41
42 + <dependency>
43 + <groupId>org.springframework.boot</groupId>
44 + <artifactId>spring-boot-starter-data-jpa</artifactId>
45 + </dependency>
46 +
47 + <dependency>
48 + <groupId>com.microsoft.sqlserver</groupId>
49 + <artifactId>mssql-jdbc</artifactId>
50 + <scope>runtime</scope>
51 + </dependency>
52 + <dependency>
53 + <groupId>com.alibaba</groupId>
54 + <artifactId>druid</artifactId>
55 + <version>1.1.9</version>
56 + </dependency>
57 +
42 <!-- <dependency>--> 58 <!-- <dependency>-->
43 <!-- <groupId>org.springframework.boot</groupId>--> 59 <!-- <groupId>org.springframework.boot</groupId>-->
44 <!-- <artifactId>spring-boot-actuator</artifactId>--> 60 <!-- <artifactId>spring-boot-actuator</artifactId>-->
...@@ -50,7 +66,6 @@ ...@@ -50,7 +66,6 @@
50 <!-- <version>2.1.7.RELEASE</version>--> 66 <!-- <version>2.1.7.RELEASE</version>-->
51 <!-- </dependency>--> 67 <!-- </dependency>-->
52 68
53 -
54 <dependency> 69 <dependency>
55 <groupId>com.google.code.gson</groupId> 70 <groupId>com.google.code.gson</groupId>
56 <artifactId>gson</artifactId> 71 <artifactId>gson</artifactId>
...@@ -90,6 +105,12 @@ ...@@ -90,6 +105,12 @@
90 <version>20.0</version> 105 <version>20.0</version>
91 </dependency> 106 </dependency>
92 107
108 + <dependency>
109 + <groupId>commons-codec</groupId>
110 + <artifactId>commons-codec</artifactId>
111 + </dependency>
112 +
113 +
93 114
94 </dependencies> 115 </dependencies>
95 116
......
...@@ -11,7 +11,6 @@ import org.springframework.scheduling.annotation.EnableScheduling; ...@@ -11,7 +11,6 @@ import org.springframework.scheduling.annotation.EnableScheduling;
11 */ 11 */
12 12
13 @Slf4j 13 @Slf4j
14 -
15 @SpringBootApplication 14 @SpringBootApplication
16 @EnableScheduling 15 @EnableScheduling
17 public class IClearApiApplication { 16 public class IClearApiApplication {
......
...@@ -2,13 +2,26 @@ package com.erry.iclear.dateInterface.api; ...@@ -2,13 +2,26 @@ package com.erry.iclear.dateInterface.api;
2 2
3 import com.erry.iclear.dateInterface.api.request.Mawb; 3 import com.erry.iclear.dateInterface.api.request.Mawb;
4 import com.erry.iclear.dateInterface.api.response.ResultRS; 4 import com.erry.iclear.dateInterface.api.response.ResultRS;
5 +import com.erry.iclear.dateInterface.common.Constant;
6 +import com.erry.iclear.dateInterface.entity.IClearApiLog;
7 +import com.erry.iclear.dateInterface.service.IClearApiLogService;
8 +import com.erry.iclear.dateInterface.service.MawbDetailService;
9 +import com.erry.iclear.dateInterface.service.MawbService;
10 +import com.erry.iclear.dateInterface.util.MD5Util;
5 import com.google.gson.Gson; 11 import com.google.gson.Gson;
6 import io.swagger.annotations.Api; 12 import io.swagger.annotations.Api;
7 import io.swagger.annotations.ApiOperation; 13 import io.swagger.annotations.ApiOperation;
8 import lombok.extern.slf4j.Slf4j; 14 import lombok.extern.slf4j.Slf4j;
15 +import org.apache.commons.lang3.StringUtils;
16 +import org.springframework.beans.factory.annotation.Autowired;
9 import org.springframework.http.HttpRequest; 17 import org.springframework.http.HttpRequest;
18 +import org.springframework.util.Assert;
10 import org.springframework.web.bind.annotation.*; 19 import org.springframework.web.bind.annotation.*;
11 20
21 +import javax.servlet.http.HttpServletRequest;
22 +import java.util.HashMap;
23 +import java.util.Objects;
24 +
12 /** 25 /**
13 * @author Administrator 26 * @author Administrator
14 */ 27 */
...@@ -19,27 +32,142 @@ public class CustomsDataInterface { ...@@ -19,27 +32,142 @@ public class CustomsDataInterface {
19 32
20 private Gson gson = new Gson(); 33 private Gson gson = new Gson();
21 34
35 + @Autowired
36 + private MawbService mawbService;
37 +
38 + @Autowired
39 + private MawbDetailService mawbDetailServicel;
40 +
41 + @Autowired
42 + private IClearApiLogService iClearApiLogService;
43 +
22 44
23 @ApiOperation(value = "推送主单数据", httpMethod = "POST", notes = "ex: http://192.168.1.75:8080/customs/sendMawb") 45 @ApiOperation(value = "推送主单数据", httpMethod = "POST", notes = "ex: http://192.168.1.75:8080/customs/sendMawb")
24 @PostMapping("/sendMawb") 46 @PostMapping("/sendMawb")
25 @ResponseBody 47 @ResponseBody
26 - public ResultRS sendMawb(@RequestBody Mawb mawb) { 48 + public ResultRS sendMawb(HttpServletRequest request
49 + , @RequestBody Mawb mawb) {
27 log.info("接收到主单数据:" + gson.toJson(mawb)); 50 log.info("接收到主单数据:" + gson.toJson(mawb));
28 ResultRS result = new ResultRS(); 51 ResultRS result = new ResultRS();
29 result.setSuccess(Boolean.FALSE); 52 result.setSuccess(Boolean.FALSE);
30 53
31 - //0、TODO 校验用户名密码 54 + if(Objects.equals(mawb,null)){
55 + result.setCode("-7");
56 + result.setMsg("主单信息不能为空");
57 + return result;
58 + }
59 + //0、保存请求信息,保存到iClear的 SQLServer
60 + String appId=(String) request.getHeader("Appid");
61 + String appkey=(String) request.getHeader("Appkey");
62 + IClearApiLog saveIClearApiLogResult = iClearApiLogService.saveIClearApiLog(iClearApiLogService.convertToIClearApiLog(mawb,appId,appkey));
63 +
64 + if(!Objects.equals(saveIClearApiLogResult,null)){
65 + log.info("请求保存成功,msgId:"+saveIClearApiLogResult.getMsgId());
66 + mawb.setMsgId(saveIClearApiLogResult.getMsgId());
67 +// mawb.getMawbDetailList().forEach(d->{
68 +// d.setMsgId(saveIClearApiLogResult.getMsgId());
69 +// });
70 + Mawb saveMawbResult= mawbService.saveMawb(mawb);
71 + if(!Objects.equals(saveMawbResult,null)){
72 + log.info("请求主单数据保存成功,msgId:"+saveMawbResult.getMsgId());
73 + }else{
74 + log.info("请求主单数据保存失败,msgId:"+saveMawbResult.getMsgId());
75 + }
76 + }else{
77 + log.info("请求保存失败,msgId:"+saveIClearApiLogResult.getMsgId());
78 + }
79 +
80 +
81 +
82 +
83 + //1、TODO 校验用户名密码
84 + result=this.checkAppSecret(request, result);
32 85
33 - //1、TODO 收到主单信息后,数据先落地
34 86
35 - //2、TODO 校验主单
36 87
88 + //2、TODO 校验主单
89 + if(result.getSuccess()==true){
90 + result.setSuccess(mawbService.checkMawb(mawb));
91 + }
37 //3、TODO 校验子单 92 //3、TODO 校验子单
93 + if(result.getSuccess()==true){
38 94
95 + }
39 //4、TODO 保存主单 96 //4、TODO 保存主单
97 + if(result.getSuccess()==true){
98 +
99 + }
100 +
101 +
102 + return result;
103 + }
104 +
105 +
106 + /**
107 + * 校验用户
108 + * @param request
109 + * @param result
110 + */
111 + private ResultRS checkAppSecret(HttpServletRequest request, ResultRS result) {
112 + String appId=(String) request.getHeader("Appid");
113 + String appkey=(String) request.getHeader("Appkey");
114 + String timeStamp=(String) request.getHeader("TimeStamp");
115 + String token= (String) request.getHeader("token");
116 +
40 117
41 118
42 119
120 +
121 + if(StringUtils.isBlank(appId)){
122 + result.setCode("-1");
123 + result.setMsg("Appid 不能为空");
124 + return result;
125 + }
126 +
127 +
128 + if(StringUtils.isBlank(appkey)){
129 + result.setCode("-2");
130 + result.setMsg("Appkey 不能为空");
131 + return result;
132 + }
133 +
134 +
135 + if(StringUtils.isBlank(timeStamp)){
136 + result.setCode("-6");
137 + result.setMsg("TimeStamp 不能为空");
138 + return result;
139 + }
140 +
141 +
142 + if(StringUtils.isBlank(token)){
143 + result.setCode("-4");
144 + result.setMsg("TimeStamp 不能为空");
145 + return result;
146 + }
147 +
148 +
149 + HashMap<String,String> secretMap = Constant.appIdSecurity.get(appId);
150 + if(secretMap==null){
151 + result.setCode("-100");
152 + result.setMsg("系统异常,该appId没有注册");
153 + return result;
154 + }
155 +
156 + String secretInSys = secretMap.get(appkey);
157 + if (StringUtils.isBlank(secretInSys)) {
158 + result.setCode("-101");
159 + result.setMsg("系统异常,该appId没有权限/密码");
160 + return result;
161 + }
162 +
163 + String md5Str= MD5Util.md5(appId+appkey+secretInSys+timeStamp);
164 + if(!token.equals(md5Str)){
165 + result.setCode("-4");
166 + result.setMsg("Token验证失败");
167 + return result;
168 + }
169 +
170 + result.setSuccess(true);
43 return result; 171 return result;
44 } 172 }
45 173
......
...@@ -3,7 +3,10 @@ package com.erry.iclear.dateInterface.api.request; ...@@ -3,7 +3,10 @@ package com.erry.iclear.dateInterface.api.request;
3 import io.swagger.annotations.ApiModel; 3 import io.swagger.annotations.ApiModel;
4 import io.swagger.annotations.ApiModelProperty; 4 import io.swagger.annotations.ApiModelProperty;
5 import lombok.Data; 5 import lombok.Data;
6 +import org.hibernate.annotations.DynamicInsert;
7 +import org.hibernate.annotations.DynamicUpdate;
6 8
9 +import javax.persistence.*;
7 import java.io.Serializable; 10 import java.io.Serializable;
8 import java.math.BigDecimal; 11 import java.math.BigDecimal;
9 import java.util.List; 12 import java.util.List;
...@@ -11,151 +14,213 @@ import java.util.List; ...@@ -11,151 +14,213 @@ import java.util.List;
11 /** 14 /**
12 * @author Administrator 15 * @author Administrator
13 */ 16 */
17 +
14 @ApiModel(value = "mawb", description = "主运单") 18 @ApiModel(value = "mawb", description = "主运单")
19 +@Entity
20 +@Table(name = "T_ICLEAR_API_MAWB")
21 +@DynamicInsert
22 +@DynamicUpdate
15 @Data 23 @Data
16 public class Mawb implements Serializable { 24 public class Mawb implements Serializable {
17 25
26 + @Id
27 + @GeneratedValue(strategy = GenerationType.IDENTITY)
28 + @Column(name = "Id", insertable = false, nullable = false)
29 + private Integer id;
30 +
31 + @Column(name = "MSGID")
32 + private Integer msgId;
33 +
18 @ApiModelProperty(value = "进出口标志", name = "IEFlag", example = "固定值:E") 34 @ApiModelProperty(value = "进出口标志", name = "IEFlag", example = "固定值:E")
35 + @Column(name = "IEFLAG")
19 private String IEFlag; 36 private String IEFlag;
20 37
21 @ApiModelProperty(value = "报关类型", name = "Type", example = "固定值:EX") 38 @ApiModelProperty(value = "报关类型", name = "Type", example = "固定值:EX")
22 - private String Type; 39 + @Column(name = "TYPE")
40 + private String type;
23 41
24 @ApiModelProperty(value = "申报单位代码", name = "agentCode", example = "固定值:1111980005") 42 @ApiModelProperty(value = "申报单位代码", name = "agentCode", example = "固定值:1111980005")
43 + @Column(name = "AGENTCODE")
25 private String agentCode; 44 private String agentCode;
26 45
27 @ApiModelProperty(value = "申报单位名称", name = "agentName", example = "固定值:联邦快递(中国)有限公司") 46 @ApiModelProperty(value = "申报单位名称", name = "agentName", example = "固定值:联邦快递(中国)有限公司")
47 + @Column(name = "AGENTNAME")
28 private String agentName; 48 private String agentName;
29 49
30 @ApiModelProperty(value = "提单号", name = "billNo", example = "固定值:有总单号则取值‘总单号_运单号‘,没有总单号则取值‘运单号‘") 50 @ApiModelProperty(value = "提单号", name = "billNo", example = "固定值:有总单号则取值‘总单号_运单号‘,没有总单号则取值‘运单号‘")
51 + @Column(name = "BILLNO")
31 private String billNo; 52 private String billNo;
32 53
33 @ApiModelProperty(value = "合同号", name = "contrNo", example = "") 54 @ApiModelProperty(value = "合同号", name = "contrNo", example = "")
55 + @Column(name = "CONTRNO")
34 private String contrNo; 56 private String contrNo;
35 57
36 @ApiModelProperty(value = "主管海关(申报地海关)", name = "customMaster", example = "固定值:0101") 58 @ApiModelProperty(value = "主管海关(申报地海关)", name = "customMaster", example = "固定值:0101")
59 + @Column(name = "CUSTOMMASTER")
37 private String customMaster; 60 private String customMaster;
38 61
39 @ApiModelProperty(value = "征免性质", name = "cutMode", example = "101") 62 @ApiModelProperty(value = "征免性质", name = "cutMode", example = "101")
63 + @Column(name = "CUTMODE")
40 private String cutMode; 64 private String cutMode;
41 65
42 @ApiModelProperty(value = "报关/转关关系标志", name = "declTrnRel", example = "固定值:0") 66 @ApiModelProperty(value = "报关/转关关系标志", name = "declTrnRel", example = "固定值:0")
67 + @Column(name = "DECLTRNREL")
43 private String declTrnRel; 68 private String declTrnRel;
44 69
45 @ApiModelProperty(value = "经停港/指运港", name = "distinatePort", example = "ASM000") 70 @ApiModelProperty(value = "经停港/指运港", name = "distinatePort", example = "ASM000")
71 + @Column(name = "DISTINATEPORT")
46 private String distinatePort; 72 private String distinatePort;
47 73
48 @ApiModelProperty(value = "报关标志", name = "EdiId", example = "001") 74 @ApiModelProperty(value = "报关标志", name = "EdiId", example = "001")
75 + @Column(name = "EDIID")
49 private String ediId; 76 private String ediId;
50 77
51 @ApiModelProperty(value = "海关编号", name = "EntryId", example = "001") 78 @ApiModelProperty(value = "海关编号", name = "EntryId", example = "001")
79 + @Column(name = "ENTRYID")
52 private String entryId; 80 private String entryId;
53 81
54 @ApiModelProperty(value = "运费币制", name = "feeCurr", example = "固定值:3") 82 @ApiModelProperty(value = "运费币制", name = "feeCurr", example = "固定值:3")
83 + @Column(name = "FEECURR")
55 private String feeCurr; 84 private String feeCurr;
56 85
57 @ApiModelProperty(value = "运费标记", name = "feeMark", example = "99.22") 86 @ApiModelProperty(value = "运费标记", name = "feeMark", example = "99.22")
87 + @Column(name = "FEEMARK")
58 private String feeMark; 88 private String feeMark;
59 89
60 @ApiModelProperty(value = "运费/率", name = "feeRate", example = "43.34358") 90 @ApiModelProperty(value = "运费/率", name = "feeRate", example = "43.34358")
91 + @Column(name = "FEERATE")
61 private BigDecimal feeRate; 92 private BigDecimal feeRate;
62 93
63 @ApiModelProperty(value = "毛重", name = "grossWet", example = "") 94 @ApiModelProperty(value = "毛重", name = "grossWet", example = "")
95 + @Column(name = "CROSSWET")
64 private Integer grossWet; 96 private Integer grossWet;
65 97
66 @ApiModelProperty(value = "出入境关闭", name = "IEPort", example = "固定值:0101") 98 @ApiModelProperty(value = "出入境关闭", name = "IEPort", example = "固定值:0101")
99 + @Column(name = "IEPORT")
67 private String IEPort; 100 private String IEPort;
68 101
69 @ApiModelProperty(value = "录入人名称", name = "InputerName", example = "固定值:0101") 102 @ApiModelProperty(value = "录入人名称", name = "InputerName", example = "固定值:0101")
103 + @Column(name = "INPUTERNAME")
70 private String inputerName; 104 private String inputerName;
71 105
72 @ApiModelProperty(value = "保险费币制", name = "insurCurr", example = "MOP") 106 @ApiModelProperty(value = "保险费币制", name = "insurCurr", example = "MOP")
107 + @Column(name = "INSURCURR")
73 private String insurCurr; 108 private String insurCurr;
74 109
75 @ApiModelProperty(value = "保险费标记", name = "insurMark", example = "固定值:3") 110 @ApiModelProperty(value = "保险费标记", name = "insurMark", example = "固定值:3")
111 + @Column(name = "INSURMARK")
76 private String insurMark; 112 private String insurMark;
77 113
78 @ApiModelProperty(value = "保险费/率", name = "insurRate", example = "") 114 @ApiModelProperty(value = "保险费/率", name = "insurRate", example = "")
115 + @Column(name = "INSURRATE")
79 private BigDecimal insurRate; 116 private BigDecimal insurRate;
80 117
81 @ApiModelProperty(value = "备案号", name = "manualNo", example = "") 118 @ApiModelProperty(value = "备案号", name = "manualNo", example = "")
119 + @Column(name = "MANUALNO")
82 private String manualNo; 120 private String manualNo;
83 121
84 @ApiModelProperty(value = "净重", name = "netWt", example = "") 122 @ApiModelProperty(value = "净重", name = "netWt", example = "")
123 + @Column(name = "NETWT")
85 private BigDecimal netWt; 124 private BigDecimal netWt;
86 125
87 @ApiModelProperty(value = "杂费币制", name = "otherCurr", example = "") 126 @ApiModelProperty(value = "杂费币制", name = "otherCurr", example = "")
127 + @Column(name = "OTHERCURR")
88 private String otherCurr; 128 private String otherCurr;
89 129
90 @ApiModelProperty(value = "杂费/率", name = "otherRate", example = "") 130 @ApiModelProperty(value = "杂费/率", name = "otherRate", example = "")
131 + @Column(name = "OTHERRATE")
91 private BigDecimal otherRate; 132 private BigDecimal otherRate;
92 133
93 @ApiModelProperty(value = "杂费标志", name = "otherMark", example = "") 134 @ApiModelProperty(value = "杂费标志", name = "otherMark", example = "")
135 + @Column(name = "OTHERMARK")
94 private String otherMark; 136 private String otherMark;
95 137
96 @ApiModelProperty(value = "消费使用/生产销售单位代码", name = "ownerCode", example = "Z321654987") 138 @ApiModelProperty(value = "消费使用/生产销售单位代码", name = "ownerCode", example = "Z321654987")
139 + @Column(name = "OWNERCODE")
97 private String ownerCode; 140 private String ownerCode;
98 141
99 @ApiModelProperty(value = "消费使用/生产销售单位名称", name = "ownerName", example = "上海保险") 142 @ApiModelProperty(value = "消费使用/生产销售单位名称", name = "ownerName", example = "上海保险")
143 + @Column(name = "OWNERNAME")
100 private String ownerName; 144 private String ownerName;
101 145
102 @ApiModelProperty(value = "件数", name = "packNo", example = "") 146 @ApiModelProperty(value = "件数", name = "packNo", example = "")
147 + @Column(name = "PACKNO")
103 private Integer packNo; 148 private Integer packNo;
104 149
105 @ApiModelProperty(value = "预录入编号", name = "preEntryId", example = "") 150 @ApiModelProperty(value = "预录入编号", name = "preEntryId", example = "")
151 + @Column(name = "PREENTRYID")
106 private String preEntryId; 152 private String preEntryId;
107 153
108 @ApiModelProperty(value = "启运国/运抵国", name = "tradeCountry", example = "USA") 154 @ApiModelProperty(value = "启运国/运抵国", name = "tradeCountry", example = "USA")
155 + @Column(name = "TRADECOUNTRY")
109 private String tradeCountry; 156 private String tradeCountry;
110 157
111 @ApiModelProperty(value = "监管方式", name = "tradeMode", example = "0200") 158 @ApiModelProperty(value = "监管方式", name = "tradeMode", example = "0200")
159 + @Column(name = "TRADEMODE")
112 private String tradeMode; 160 private String tradeMode;
113 161
114 @ApiModelProperty(value = "境内收发货人编号", name = "tradeCode", example = "Z321654987") 162 @ApiModelProperty(value = "境内收发货人编号", name = "tradeCode", example = "Z321654987")
163 + @Column(name = "TRADECODE")
115 private String tradeCode; 164 private String tradeCode;
116 165
117 @ApiModelProperty(value = "运输方式代码", name = "trafMode", example = "1") 166 @ApiModelProperty(value = "运输方式代码", name = "trafMode", example = "1")
167 + @Column(name = "TRAFMODE")
118 private String trafMode; 168 private String trafMode;
119 169
120 @ApiModelProperty(value = "境内收发货人名称", name = "tradeName", example = "上海铢怡国际货物运输代理有限公司") 170 @ApiModelProperty(value = "境内收发货人名称", name = "tradeName", example = "上海铢怡国际货物运输代理有限公司")
171 + @Column(name = "TRADENAME")
121 private String tradeName; 172 private String tradeName;
122 173
123 @ApiModelProperty(value = "成交方式", name = "transMode", example = "2") 174 @ApiModelProperty(value = "成交方式", name = "transMode", example = "2")
175 + @Column(name = "TRANSMODE")
124 private String transMode; 176 private String transMode;
125 177
126 @ApiModelProperty(value = "包装种类", name = "wrapType", example = "22") 178 @ApiModelProperty(value = "包装种类", name = "wrapType", example = "22")
179 + @Column(name = "WRAPTYPE")
127 private String wrapType; 180 private String wrapType;
128 181
129 @ApiModelProperty(value = "生产核销单位统一信用代码---报关形式类型", name = "TradeCodeScc", example = "A74125896321456987") 182 @ApiModelProperty(value = "生产核销单位统一信用代码---报关形式类型", name = "TradeCodeScc", example = "A74125896321456987")
183 + @Column(name = "TRADECODESCC")
130 private String tradeCodeScc; 184 private String tradeCodeScc;
131 185
132 @ApiModelProperty(value = "消费使用/生产销售单位单位统一编码", name = "ownerCodeScc", example = "") 186 @ApiModelProperty(value = "消费使用/生产销售单位单位统一编码", name = "ownerCodeScc", example = "")
187 + @Column(name = "OWNERCODESCC")
133 private String ownerCodeScc; 188 private String ownerCodeScc;
134 189
135 @ApiModelProperty(value = "贸易国别", name = "tradeAreaCode", example = "") 190 @ApiModelProperty(value = "贸易国别", name = "tradeAreaCode", example = "")
191 + @Column(name = "TRADEAREACODE")
136 private String tradeAreaCode; 192 private String tradeAreaCode;
137 193
138 @ApiModelProperty(value = "标记及号码", name = "markNo", example = "N/M") 194 @ApiModelProperty(value = "标记及号码", name = "markNo", example = "N/M")
195 + @Column(name = "MARKNO")
139 private String markNo; 196 private String markNo;
140 197
141 @ApiModelProperty(value = "入境口岸代码", name = "entyPortCode", example = "固定值:310302") 198 @ApiModelProperty(value = "入境口岸代码", name = "entyPortCode", example = "固定值:310302")
199 + @Column(name = "ENTYPORTCODE")
142 private String entyPortCode; 200 private String entyPortCode;
143 201
144 @ApiModelProperty(value = "入境口岸代码", name = "goodsPlace", example = "固定值:空值") 202 @ApiModelProperty(value = "入境口岸代码", name = "goodsPlace", example = "固定值:空值")
203 + @Column(name = "GOODSPLACE")
145 private String goodsPlace; 204 private String goodsPlace;
146 205
147 @ApiModelProperty(value = "申报人员姓名---报关员证号", name = "declareName", example = "固定值:空值") 206 @ApiModelProperty(value = "申报人员姓名---报关员证号", name = "declareName", example = "固定值:空值")
207 + @Column(name = "DECLARENAME")
148 private String declareName; 208 private String declareName;
149 209
150 @ApiModelProperty(value = "境外发货人代码", name = "overseasConsignorCode", example = "") 210 @ApiModelProperty(value = "境外发货人代码", name = "overseasConsignorCode", example = "")
211 + @Column(name = "OVERSEASCONSIGNORCODE")
151 private String overseasConsignorCode; 212 private String overseasConsignorCode;
152 213
153 @ApiModelProperty(value = "境外收货人编码", name = "overseasConsigneeCode", example = "") 214 @ApiModelProperty(value = "境外收货人编码", name = "overseasConsigneeCode", example = "")
215 + @Column(name = "OVERSEASCONSIGNEECODE")
154 private String overseasConsigneeCode; 216 private String overseasConsigneeCode;
155 217
156 @ApiModelProperty(value = "境外收货人名称(外文)", name = "overseasConsigneeEname", example = "") 218 @ApiModelProperty(value = "境外收货人名称(外文)", name = "overseasConsigneeEname", example = "")
219 + @Column(name = "OVERSEASCONSIGNEEENAME")
157 private String overseasConsigneeEname; 220 private String overseasConsigneeEname;
158 221
159 @ApiModelProperty(value = "运单明细", name = "mawbDetailList", example = "") 222 @ApiModelProperty(value = "运单明细", name = "mawbDetailList", example = "")
223 + @OneToMany(cascade = CascadeType.PERSIST)
224 + @JoinColumn(name = "MAWBID")
160 private List<MawbDetail> mawbDetailList; 225 private List<MawbDetail> mawbDetailList;
161 } 226 }
......
...@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel; ...@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel;
4 import io.swagger.annotations.ApiModelProperty; 4 import io.swagger.annotations.ApiModelProperty;
5 import lombok.Data; 5 import lombok.Data;
6 6
7 +import javax.persistence.*;
7 import java.io.Serializable; 8 import java.io.Serializable;
8 import java.math.BigDecimal; 9 import java.math.BigDecimal;
9 10
...@@ -12,82 +13,120 @@ import java.math.BigDecimal; ...@@ -12,82 +13,120 @@ import java.math.BigDecimal;
12 * @author Administrator 13 * @author Administrator
13 */ 14 */
14 @ApiModel(value = "mawbDetail", description = "运单明细") 15 @ApiModel(value = "mawbDetail", description = "运单明细")
16 +@Entity
17 +@Table(name = "T_ICLEAR_API_MAWBDETAIL")
15 @Data 18 @Data
16 public class MawbDetail implements Serializable { 19 public class MawbDetail implements Serializable {
17 20
21 + @Id
22 + @GeneratedValue(strategy = GenerationType.IDENTITY)
23 + @Column(name = "Id", insertable = false, nullable = false)
24 + private Integer id;
25 +
26 + @Column(name = "MSGID")
27 + private Integer msgId;
28 +
29 + @Column(name="MAWBID")
30 + private Integer MAWBID;
31 +
18 @ApiModelProperty(value = "商品编号", example = "空值") 32 @ApiModelProperty(value = "商品编号", example = "空值")
33 + @Column(name = "CLASSMARK")
19 private String classMark; 34 private String classMark;
20 35
21 @ApiModelProperty(value = "商品编号") 36 @ApiModelProperty(value = "商品编号")
37 + @Column(name = "CODETS")
22 private String codeTS; 38 private String codeTS;
23 39
24 @ApiModelProperty(value = "申报单价", example = "空值") 40 @ApiModelProperty(value = "申报单价", example = "空值")
41 + @Column(name = "DECLPRICE")
25 private BigDecimal declPrice; 42 private BigDecimal declPrice;
26 43
27 @ApiModelProperty(value = "申报总价") 44 @ApiModelProperty(value = "申报总价")
45 + @Column(name = "DECLTOTAL")
28 private BigDecimal declTotal; 46 private BigDecimal declTotal;
29 47
30 @ApiModelProperty(value = "征免方式") 48 @ApiModelProperty(value = "征免方式")
49 + @Column(name = "DUTYMODE")
31 private String dutyMode; 50 private String dutyMode;
32 51
33 @ApiModelProperty(value = "货号") 52 @ApiModelProperty(value = "货号")
53 + @Column(name = "EXGNO")
34 private String exgNo; 54 private String exgNo;
35 55
36 @ApiModelProperty(value = "货号") 56 @ApiModelProperty(value = "货号")
57 + @Column(name = "EXGVERSION")
37 private String exgVersion; 58 private String exgVersion;
38 59
39 @ApiModelProperty(value = "第一计量单位(法定单位)") 60 @ApiModelProperty(value = "第一计量单位(法定单位)")
61 + @Column(name = "FIRSTUNIT")
40 private String firstUnit; 62 private String firstUnit;
41 63
42 @ApiModelProperty(value = "第一法定数量") 64 @ApiModelProperty(value = "第一法定数量")
65 + @Column(name = "FIRSTQTY")
43 private Integer firstQty; 66 private Integer firstQty;
44 67
45 @ApiModelProperty(value = "成交计量单位") 68 @ApiModelProperty(value = "成交计量单位")
69 + @Column(name = "GUNIT")
46 private String GUnit; 70 private String GUnit;
47 71
48 @ApiModelProperty(value = "商品规格、型号") 72 @ApiModelProperty(value = "商品规格、型号")
73 + @Column(name = "GMODE")
49 private String GModel; 74 private String GModel;
50 75
51 @ApiModelProperty(value = "商品名称") 76 @ApiModelProperty(value = "商品名称")
77 + @Column(name = "GNAME")
52 private String GName; 78 private String GName;
53 79
54 @ApiModelProperty(value = "商品序号") 80 @ApiModelProperty(value = "商品序号")
81 + @Column(name = "GNO")
55 private String GNo; 82 private String GNo;
56 83
57 @ApiModelProperty(value = "成交数量") 84 @ApiModelProperty(value = "成交数量")
85 + @Column(name = "GQTY")
58 private Integer GQty; 86 private Integer GQty;
59 87
60 @ApiModelProperty(value = "原产国") 88 @ApiModelProperty(value = "原产国")
89 + @Column(name = "ORIGINCURRENTY")
61 private String originCountry; 90 private String originCountry;
62 91
63 @ApiModelProperty(value = "第二计量单位") 92 @ApiModelProperty(value = "第二计量单位")
93 + @Column(name = "SECONDUNIT")
64 private String secondUnit; 94 private String secondUnit;
65 95
66 @ApiModelProperty(value = "第二法定数量") 96 @ApiModelProperty(value = "第二法定数量")
97 + @Column(name = "SECONDQTY")
67 private Integer secondQty; 98 private Integer secondQty;
68 99
69 @ApiModelProperty(value = "成交币制") 100 @ApiModelProperty(value = "成交币制")
101 + @Column(name = "TRADECURR")
70 private String tradeCurr; 102 private String tradeCurr;
71 103
72 @ApiModelProperty(value = "用途/生产厂家") 104 @ApiModelProperty(value = "用途/生产厂家")
105 + @Column(name = "USETO")
73 private String useTo; 106 private String useTo;
74 107
75 @ApiModelProperty(value = "工缴费") 108 @ApiModelProperty(value = "工缴费")
109 + @Column(name = "WORKUSD")
76 private BigDecimal workUsd; 110 private BigDecimal workUsd;
77 111
78 @ApiModelProperty(value = "检验检疫编") 112 @ApiModelProperty(value = "检验检疫编")
113 + @Column(name = "CIQCODE")
79 private String ciqCode; 114 private String ciqCode;
80 115
81 @ApiModelProperty(value = "最终目的国(地区)") 116 @ApiModelProperty(value = "最终目的国(地区)")
117 + @Column(name = "DESTINATIONCOUNTRY")
82 private String destinationCountry; 118 private String destinationCountry;
83 119
84 @ApiModelProperty(value = "申报货物英文名称") 120 @ApiModelProperty(value = "申报货物英文名称")
121 + @Column(name = "DECLGOODSENAME")
85 private String declGoodsEname; 122 private String declGoodsEname;
86 123
87 @ApiModelProperty(value = "目的地代码") 124 @ApiModelProperty(value = "目的地代码")
125 + @Column(name = "DESTCODE")
88 private String destCode; 126 private String destCode;
89 127
90 @ApiModelProperty(value = "境内目的地/境内货源地") 128 @ApiModelProperty(value = "境内目的地/境内货源地")
129 + @Column(name = "DISTRICTCODE")
91 private String districtCode; 130 private String districtCode;
92 131
93 132
......
...@@ -13,8 +13,9 @@ public class Constant { ...@@ -13,8 +13,9 @@ public class Constant {
13 13
14 public static Map<String,HashMap<String,String>> appIdSecurity = new HashMap<>(); 14 public static Map<String,HashMap<String,String>> appIdSecurity = new HashMap<>();
15 15
16 + public static String MSG_TYPE_C="C";
16 17
17 - 18 + public static String MSG_TYPE_D="D";
18 19
19 20
20 21
......
1 +package com.erry.iclear.dateInterface.entity;
2 +
3 +
4 +import lombok.Data;
5 +import javax.persistence.*;
6 +import java.io.Serializable;
7 +import java.util.Date;
8 +
9 +/**
10 + * @author Administrator
11 + */
12 +@Entity
13 +@Table(name = "T_ICLEAR_API_LOG")
14 +@Data
15 +public class IClearApiLog implements Serializable {
16 +
17 + private static final long serialVersionUID = 1L;
18 +
19 + @Id
20 + @GeneratedValue(strategy = GenerationType.IDENTITY)
21 + @Column(name = "MSGID", insertable = false, nullable = false)
22 + private Integer msgId;
23 +
24 + @Column(name = "MSG_TYPE")
25 + private String msgType;
26 +
27 + @Column(name = "APPID")
28 + private String appId;
29 +
30 + @Column(name= "APPKEY")
31 + private String appKey;
32 +
33 + @Column(name= "CREATE_TIME")
34 + private Date createTime;
35 +
36 + @Column(name= "UPDATE_TIME")
37 + private Date updateTime;
38 +
39 + //收到的json,用 T_ICLEAR_API_MAWB表保存
40 + //@Column(name= "REQUEST_MSG")
41 + //private String request_msg;
42 +
43 + @Column(name= "RECEIVE_RESULT")
44 + private String receiveResult;
45 +
46 + @Column(name= "RESPONSE_TIME")
47 + private Date responseTime;
48 +
49 + @Column(name= "SPEND_TIME")
50 + private Long spendTime;
51 +
52 + @Column(name= "SENDTIMES")
53 + private int sendTimes;
54 +
55 + @Column(name= "BILLNO")
56 + private String billNo;
57 +
58 + @Column(name= "CONTRNO")
59 + private String contrNo;
60 +
61 +
62 +
63 +
64 +
65 +}
1 +package com.erry.iclear.dateInterface.repository;
2 +
3 +import com.erry.iclear.dateInterface.entity.IClearApiLog;
4 +import org.hibernate.annotations.DynamicInsert;
5 +import org.hibernate.annotations.DynamicUpdate;
6 +import org.springframework.data.jpa.repository.JpaRepository;
7 +import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
8 +import org.springframework.stereotype.Repository;
9 +import org.springframework.transaction.annotation.Transactional;
10 +
11 +/**
12 + * @author Administrator
13 + */
14 +@DynamicUpdate
15 +@DynamicInsert
16 +@Repository
17 +@Transactional(rollbackFor = Exception.class)
18 +public interface IClearApiLogRepository extends JpaRepository<IClearApiLog, Integer>, JpaSpecificationExecutor<IClearApiLog> {
19 +}
1 +package com.erry.iclear.dateInterface.repository;
2 +
3 +import com.erry.iclear.dateInterface.api.request.MawbDetail;
4 +import org.springframework.data.jpa.repository.JpaRepository;
5 +import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
6 +import org.springframework.stereotype.Repository;
7 +import org.springframework.transaction.annotation.Transactional;
8 +
9 +@Repository
10 +@Transactional(rollbackFor = Exception.class)
11 +public interface MawbDetailRepository extends JpaRepository<MawbDetail, Integer>, JpaSpecificationExecutor<MawbDetail> {
12 +}
1 +package com.erry.iclear.dateInterface.repository;
2 +
3 +import com.erry.iclear.dateInterface.api.request.Mawb;
4 +import org.springframework.data.jpa.repository.JpaRepository;
5 +import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
6 +import org.springframework.stereotype.Repository;
7 +import org.springframework.transaction.annotation.Transactional;
8 +
9 +/**
10 + * @author Administrator
11 + */
12 +@Repository
13 +@Transactional(rollbackFor = Exception.class)
14 +public interface MawbRepository extends JpaRepository<Mawb, Integer>, JpaSpecificationExecutor<Mawb> {
15 +}
1 +package com.erry.iclear.dateInterface.service;
2 +
3 +import com.erry.iclear.dateInterface.api.request.Mawb;
4 +import com.erry.iclear.dateInterface.common.Constant;
5 +import com.erry.iclear.dateInterface.entity.IClearApiLog;
6 +import com.erry.iclear.dateInterface.repository.IClearApiLogRepository;
7 +import lombok.extern.slf4j.Slf4j;
8 +import org.springframework.beans.factory.annotation.Autowired;
9 +import org.springframework.stereotype.Service;
10 +
11 +import java.util.Date;
12 +
13 +/**
14 + * @author Administrator
15 + */
16 +@Service
17 +@Slf4j
18 +public class IClearApiLogService {
19 +
20 +
21 + @Autowired
22 + private IClearApiLogRepository iClearApiLogRepository;
23 +
24 + /**
25 + * 保存日志
26 + * @param iClearApiLog
27 + */
28 + public IClearApiLog saveIClearApiLog(IClearApiLog iClearApiLog){
29 + try{
30 + return iClearApiLogRepository.save(iClearApiLog);
31 + }catch (Exception e){
32 + log.error("saveIClearApiLog() error:"+ e.getMessage());
33 + }
34 + return null;
35 + }
36 +
37 + /**
38 + * 创建日志
39 + * @return
40 + */
41 + public IClearApiLog convertToIClearApiLog(Mawb mawb,String appId,String appKey){
42 + IClearApiLog result = new IClearApiLog();
43 + try{
44 + result.setMsgType(Constant.MSG_TYPE_D);
45 + result.setAppId(appId);
46 + result.setAppKey(appKey);
47 + result.setCreateTime(new Date());
48 + result.setUpdateTime(new Date());
49 + result.setReceiveResult(null);
50 + result.setResponseTime(null);
51 + result.setSpendTime(null);
52 + result.setSendTimes(1);
53 + result.setBillNo(mawb.getBillNo());
54 + result.setContrNo(mawb.getContrNo());
55 + }catch (Exception e){
56 + log.error("convertToIClearApiLog() error:"+e.getMessage());
57 + }
58 + return result;
59 + }
60 +
61 +
62 +}
...@@ -2,9 +2,13 @@ package com.erry.iclear.dateInterface.service; ...@@ -2,9 +2,13 @@ package com.erry.iclear.dateInterface.service;
2 2
3 import com.erry.iclear.dateInterface.api.request.Mawb; 3 import com.erry.iclear.dateInterface.api.request.Mawb;
4 import com.erry.iclear.dateInterface.api.request.MawbDetail; 4 import com.erry.iclear.dateInterface.api.request.MawbDetail;
5 +import com.erry.iclear.dateInterface.repository.MawbDetailRepository;
5 import lombok.extern.slf4j.Slf4j; 6 import lombok.extern.slf4j.Slf4j;
7 +import org.springframework.beans.factory.annotation.Autowired;
6 import org.springframework.stereotype.Service; 8 import org.springframework.stereotype.Service;
7 9
10 +import java.util.List;
11 +
8 /** 12 /**
9 * @author Administrator 13 * @author Administrator
10 */ 14 */
...@@ -12,7 +16,10 @@ import org.springframework.stereotype.Service; ...@@ -12,7 +16,10 @@ import org.springframework.stereotype.Service;
12 @Slf4j 16 @Slf4j
13 public class MawbDetailService { 17 public class MawbDetailService {
14 18
15 - public void saveMawbDetail(MawbDetail mawbDetail){ 19 + @Autowired
20 + private MawbDetailRepository mawbDetailRepository;
21 +
22 + public void saveMawbDetail(List<MawbDetail> mawbDetailList){
16 log.info(""); 23 log.info("");
17 24
18 log.info(""); 25 log.info("");
......
1 package com.erry.iclear.dateInterface.service; 1 package com.erry.iclear.dateInterface.service;
2 2
3 import com.erry.iclear.dateInterface.api.request.Mawb; 3 import com.erry.iclear.dateInterface.api.request.Mawb;
4 +import com.erry.iclear.dateInterface.repository.MawbRepository;
4 import com.google.gson.Gson; 5 import com.google.gson.Gson;
5 import lombok.extern.slf4j.Slf4j; 6 import lombok.extern.slf4j.Slf4j;
7 +import org.springframework.beans.factory.annotation.Autowired;
6 import org.springframework.scheduling.annotation.Scheduled; 8 import org.springframework.scheduling.annotation.Scheduled;
7 import org.springframework.stereotype.Service; 9 import org.springframework.stereotype.Service;
8 10
...@@ -15,20 +17,23 @@ public class MawbService { ...@@ -15,20 +17,23 @@ public class MawbService {
15 17
16 private Gson gson = new Gson(); 18 private Gson gson = new Gson();
17 19
20 + @Autowired
21 + private MawbRepository mawbRepository;
18 22
19 /** 23 /**
20 - * 保存主单 24 + * 保存主单Request
21 * @param mawb 25 * @param mawb
22 */ 26 */
23 - public void saveMawb(Mawb mawb){ 27 + public Mawb saveMawb(Mawb mawb){
28 + Mawb result=null;
24 try{ 29 try{
25 log.info("saveMawb start>>>>>>>>>>>"); 30 log.info("saveMawb start>>>>>>>>>>>");
26 - 31 + result =mawbRepository.save(mawb);
27 -
28 log.info("saveMawb end>>>>>>>>>>>"); 32 log.info("saveMawb end>>>>>>>>>>>");
29 }catch (Exception e){ 33 }catch (Exception e){
30 log.error("saveMawb() error:"+e.getMessage()); 34 log.error("saveMawb() error:"+e.getMessage());
31 } 35 }
36 + return result;
32 } 37 }
33 38
34 39
......
1 +package com.erry.iclear.dateInterface.util;
2 +
3 +import java.io.UnsupportedEncodingException;
4 +import java.util.Map;
5 +import java.util.Map.Entry;
6 +import java.util.Set;
7 +import java.util.TreeMap;
8 +
9 +import org.apache.commons.codec.digest.DigestUtils;
10 +import org.apache.commons.logging.Log;
11 +import org.apache.commons.logging.LogFactory;
12 +
13 +import com.alibaba.fastjson.JSON;
14 +import com.alibaba.fastjson.JSONArray;
15 +import com.alibaba.fastjson.JSONException;
16 +import com.alibaba.fastjson.JSONObject;
17 +import com.alibaba.fastjson.parser.Feature;
18 +
19 +/**
20 + * @author Administrator
21 + */
22 +public class MD5Util {
23 + private static Log logger = LogFactory.getLog(MD5Util.class);
24 + public static String md5(String inStr) {
25 + try {
26 + return DigestUtils.md5Hex(inStr.getBytes("UTF-8"));
27 + } catch (UnsupportedEncodingException e) {
28 + throw new RuntimeException("MD5签名过程中出现错误");
29 + }
30 + }
31 +
32 + public static String sign(Map<String, Object> params, String appSecret) {
33 + StringBuilder valueSb = new StringBuilder();
34 + // 将参数以参数名的字典升序排序
35 + Map<String, Object> sortParams = new TreeMap<String, Object>(params);
36 + Set<Entry<String, Object>> entrys = sortParams.entrySet();
37 + // 遍历排序的字典,并拼接value1+value2......格式
38 + for (Entry<String, Object> entry : entrys) {
39 + valueSb.append(entry.getValue());
40 + }
41 + valueSb.append(appSecret);
42 + return md5(valueSb.toString());
43 + }
44 + public static String getParam(JSONObject jsonObj, StringBuffer sb) {
45 + if(jsonObj.get("sign")!=null){
46 + jsonObj.remove("sign");
47 + }
48 + // 将参数以参数名的字典升序排序
49 + for (Entry<String, Object> entry : jsonObj.entrySet()) {
50 + try{
51 + JSONArray array = JSONArray.parseArray(entry.getValue().toString());
52 + if(array!=null) {
53 + for (int i = 0; i < array.size(); i++) {
54 + getParam(array.getJSONObject(i), sb);
55 + }
56 + }
57 +
58 + }catch (JSONException e){
59 + try{
60 + JSONObject obj = JSONObject.parseObject(entry.getValue().toString());
61 + getParam(obj,sb);
62 + }catch (JSONException E2){
63 + sb.append(entry.getValue());
64 + }
65 + }
66 + }
67 + return sb.toString();
68 + }
69 +
70 + public static String md5(Object inStr,String key) {
71 + try {
72 + JSONObject json = JSON.parseObject(JSONObject.toJSONString(inStr), Feature.OrderedField);
73 + String str = MD5Util.getParam(json,new StringBuffer());
74 + return DigestUtils.md5Hex((str+key).getBytes("UTF-8"));
75 + } catch (UnsupportedEncodingException e) {
76 + throw new RuntimeException("MD5签名过程中出现错误");
77 + }
78 + }
79 +
80 +
81 +
82 +
83 +}
...@@ -5,7 +5,25 @@ server: ...@@ -5,7 +5,25 @@ server:
5 spring: 5 spring:
6 application: 6 application:
7 name: iClearExport.DataInterface 7 name: iClearExport.DataInterface
8 + profiles:
9 + active: @activatedProperties@
10 + jpa:
11 + database: sql_server
12 + show-sql: true
13 + hibernate:
14 + ddl-auto: none
15 + naming:
16 + physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
17 + datasource:
18 + url: jdbc:sqlserver://40.73.78.157:1433;DatabaseName=IClearDev
19 + username: sa
20 + password: Fedex_123
21 + driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
22 + type: com.alibaba.druid.pool.DruidDataSource
23 +
8 24
9 25
10 task: 26 task:
11 pushMawbToIClear: 0 0/1 * * * ? 27 pushMawbToIClear: 0 0/1 * * * ?
28 +
29 +
......
...@@ -3,12 +3,11 @@ server: ...@@ -3,12 +3,11 @@ server:
3 3
4 4
5 5
6 -
7 -
8 spring: 6 spring:
9 application: 7 application:
10 name: iClearExport.DataInterface 8 name: iClearExport.DataInterface
11 - 9 + profiles:
10 + active: @activatedProperties@
12 11
13 task: 12 task:
14 pushMawbToIClear: 0 0/1 * * * ? 13 pushMawbToIClear: 0 0/1 * * * ?
...\ No newline at end of file ...\ No newline at end of file
......
1 server: 1 server:
2 port: 8080 2 port: 8080
3 3
4 -
5 -
6 spring: 4 spring:
7 application: 5 application:
8 name: iClearExport.DataInterface 6 name: iClearExport.DataInterface
7 + profiles:
8 + active: @activatedProperties@
9 +
9 10
10 task: 11 task:
11 pushMawbToIClear: 0 0/1 * * * ? 12 pushMawbToIClear: 0 0/1 * * * ?
...\ No newline at end of file ...\ No newline at end of file
......
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<configuration>
3 + <contextName>iClear-api</contextName>
4 +
5 + <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
6 + <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
7 + <layout class="ch.qos.logback.classic.PatternLayout">
8 + <pattern>
9 + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level [%thread{0}] %c{0} - %msg%n</pattern>
10 + </pattern>
11 + </layout>
12 + </encoder>
13 + </appender>
14 +
15 + <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
16 + <prudent>false</prudent>
17 + <append>true</append>
18 + <file>d:/home/app/logs/iClear-api.log</file>
19 + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
20 + <fileNamePattern>d:/home/app/logs/iClear-api-%d.%i.log</fileNamePattern>
21 + <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
22 + <maxFileSize>500MB</maxFileSize>
23 + </timeBasedFileNamingAndTriggeringPolicy>
24 + <maxHistory>30</maxHistory>
25 + <totalSizeCap>1GB</totalSizeCap>
26 + </rollingPolicy>
27 + <encoder>
28 + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level [%thread{0}] %c{0} - %msg%n</pattern>
29 + <charset>utf-8</charset>
30 + </encoder>
31 +
32 + </appender>
33 +
34 + <logger name="io.lettuce.core" level="ERROR" />
35 + <logger name="com.netflix" level="OFF" />
36 +
37 + <springProfile name="dev | test">
38 + <root level="info">
39 + <appender-ref ref="CONSOLE"/>
40 + <appender-ref ref="FILE"/>
41 + </root>
42 + </springProfile>
43 +
44 + <springProfile name="prod">
45 + <root level="info">
46 + <appender-ref ref="CONSOLE"/>
47 + <appender-ref ref="FILE"/>
48 + </root>
49 + </springProfile>
50 +
51 +
52 +</configuration>
...\ No newline at end of file ...\ No newline at end of file
...@@ -104,7 +104,7 @@ public class ApiTest { ...@@ -104,7 +104,7 @@ public class ApiTest {
104 mawb.setInsurRate(BigDecimal.valueOf(23.44)); 104 mawb.setInsurRate(BigDecimal.valueOf(23.44));
105 mawb.setManualNo("备案号"); 105 mawb.setManualNo("备案号");
106 mawb.setNetWt(BigDecimal.valueOf(80)); 106 mawb.setNetWt(BigDecimal.valueOf(80));
107 - mawb.setOtherCurr("杂费币制"); 107 + mawb.setOtherCurr("001");
108 mawb.setOtherRate(BigDecimal.valueOf(10)); 108 mawb.setOtherRate(BigDecimal.valueOf(10));
109 mawb.setOtherMark(""); 109 mawb.setOtherMark("");
110 mawb.setOwnerCode("Z321654987"); 110 mawb.setOwnerCode("Z321654987");
...@@ -128,16 +128,16 @@ public class ApiTest { ...@@ -128,16 +128,16 @@ public class ApiTest {
128 mawb.setOverseasConsignorCode("Z785421"); 128 mawb.setOverseasConsignorCode("Z785421");
129 mawb.setOverseasConsigneeCode("Z785421"); 129 mawb.setOverseasConsigneeCode("Z785421");
130 mawb.setOverseasConsigneeEname("出口时必填收件人公司名(原)"); 130 mawb.setOverseasConsigneeEname("出口时必填收件人公司名(原)");
131 - mawb.setMawbDetailList(mawbDetailList); 131 + //mawb.setMawbDetailList(mawbDetailList);
132 132
133 133
134 134
135 135
136 136
137 - List list=(List<MawbDetail>) mawb.getMawbDetailList(); 137 +// List list=(List<MawbDetail>) mawb.getMawbDetailList();
138 - list.forEach(d->{ 138 +// list.forEach(d->{
139 - System.out.println(d.toString()); 139 +// System.out.println(d.toString());
140 - }); 140 +// });
141 141
142 142
143 143
......