tao.mo

PI-11-功能扩展-07:

接口校验信息返回英文描述
mt
2023年3月8日16:59:49
...@@ -38,6 +38,6 @@ public class CommonExceptionAdvice { ...@@ -38,6 +38,6 @@ public class CommonExceptionAdvice {
38 String itemMessage= messageSource.getMessage(x.getDefaultMessage(), null, x.getDefaultMessage(), LocaleContextHolder.getLocale()); 38 String itemMessage= messageSource.getMessage(x.getDefaultMessage(), null, x.getDefaultMessage(), LocaleContextHolder.getLocale());
39 return String.format("%s", itemMessage); 39 return String.format("%s", itemMessage);
40 }).collect(Collectors.toList()); 40 }).collect(Collectors.toList());
41 - return new ResultRS(Boolean.FALSE, ErrorCodeEnum.ERROR_30002.getCode(),errorMessages.toString()); 41 + return new ResultRS(Boolean.FALSE, ErrorCodeEnum.ERROR_30002.getCode(),errorMessages.toString(),null);
42 } 42 }
43 } 43 }
......
...@@ -50,7 +50,7 @@ public class CustomsDataInterface { ...@@ -50,7 +50,7 @@ public class CustomsDataInterface {
50 public ResultRS sendMawb(HttpServletRequest request 50 public ResultRS sendMawb(HttpServletRequest request
51 ,@Validated(MawbAdd.class) @RequestBody Mawb mawb) { 51 ,@Validated(MawbAdd.class) @RequestBody Mawb mawb) {
52 log.info("接收到请求数据billNo:"+mawb.getBillNo()+" data:" + gson.toJson(mawb)); 52 log.info("接收到请求数据billNo:"+mawb.getBillNo()+" data:" + gson.toJson(mawb));
53 - ResultRS result = new ResultRS(Boolean.FALSE,"",""); 53 + ResultRS result = new ResultRS(Boolean.FALSE,null,null,null);
54 54
55 if(Objects.equals(mawb,null)){ 55 if(Objects.equals(mawb,null)){
56 result.setCode(ErrorCodeEnum.ERROR_7.getCode()); 56 result.setCode(ErrorCodeEnum.ERROR_7.getCode());
......
...@@ -91,7 +91,8 @@ public class FedexDataInterface { ...@@ -91,7 +91,8 @@ public class FedexDataInterface {
91 log.info("checkBASFMawbFedex:"+fedexc.toString()); 91 log.info("checkBASFMawbFedex:"+fedexc.toString());
92 log.info("appId:{},appKey:{},timeStamp:{},token:{}",appId,appKey,timeStamp,token); 92 log.info("appId:{},appKey:{},timeStamp:{},token:{}",appId,appKey,timeStamp,token);
93 93
94 - ResultRS result = fedexService.checkBasfInterfaceData(fedexc,appInfo); 94 + //非空校验
95 + ResultRS nonEmptyCheck = fedexService.checkBasfInterfaceData(fedexc,appInfo);
95 96
96 StopWatch sw = new StopWatch("checkBASFMawbFedex"); 97 StopWatch sw = new StopWatch("checkBASFMawbFedex");
97 sw.start("generate FedexMawb"); 98 sw.start("generate FedexMawb");
...@@ -100,30 +101,36 @@ public class FedexDataInterface { ...@@ -100,30 +101,36 @@ public class FedexDataInterface {
100 sw.stop(); 101 sw.stop();
101 102
102 sw.start("checkFedexMawb"); 103 sw.start("checkFedexMawb");
103 - String msg = result.getMsg(); 104 + ResultRS iclearCheckRs = fedexService.checkFedexMawb(saveMawbFedexResult,appInfo);
104 - String iclearCheckMsg = fedexService.checkFedexMawb(saveMawbFedexResult,appInfo).getMsg(); 105 + //返回结果
105 - if(result.getSuccess() && StringUtil.isEmpty(iclearCheckMsg)){ 106 + ResultRS result = new ResultRS(Boolean.TRUE,ErrorCodeEnum.SUCCESS.getCode(),null,null);
107 + if(nonEmptyCheck.getSuccess() && iclearCheckRs.getSuccess()){
108 + //验证通过
106 result.setSuccess(Boolean.TRUE); 109 result.setSuccess(Boolean.TRUE);
110 + result.setCode(ErrorCodeEnum.SUCCESS.getCode());
107 }else{ 111 }else{
108 - if(result.getSuccess()){ 112 + //验证不通过
113 + if(nonEmptyCheck.getSuccess()){
109 //基本非空信息验证通过,并且iclear验证失败 114 //基本非空信息验证通过,并且iclear验证失败
110 - result.setMsg(iclearCheckMsg); 115 + result.setMsg(iclearCheckRs.getMsg());
116 + result.setMsgUS(iclearCheckRs.getMsgUS());
117 + result.setCode(iclearCheckRs.getCode());
118 + result.setSuccess(Boolean.FALSE);
111 }else{ 119 }else{
112 //基本非空信息验证失败,并且iclear验证失败 120 //基本非空信息验证失败,并且iclear验证失败
113 - result.setMsg(msg+";"+iclearCheckMsg); 121 + result.setMsg(nonEmptyCheck.getMsg()+";"+iclearCheckRs.getMsg());
122 + //基本非空信息验证失败,并且iclear验证失败(英文)
123 + result.setMsgUS(iclearCheckRs.getMsgUS());
124 + //非空校验与iclear校验都失败,则优先显示非空失败编码
125 + result.setCode(nonEmptyCheck.getCode());
126 + result.setSuccess(Boolean.FALSE);
114 } 127 }
115 } 128 }
116 sw.stop(); 129 sw.stop();
117 -
118 log.info(sw.prettyPrint()); 130 log.info(sw.prettyPrint());
119 - if(result.getSuccess()){
120 - result.setSuccess(Boolean.TRUE);
121 - result.setCode(ErrorCodeEnum.SUCCESS.getCode());
122 - }
123 tiClearApiCheckLogSave.setResponseText(result.getMsg()); 131 tiClearApiCheckLogSave.setResponseText(result.getMsg());
124 tiClearApiCheckLogSave.setCode(result.getCode()); 132 tiClearApiCheckLogSave.setCode(result.getCode());
125 tiClearApiCheckLogSave.setSuccess(result.getSuccess()); 133 tiClearApiCheckLogSave.setSuccess(result.getSuccess());
126 -
127 iClearApiCheckLogRepository.save(tiClearApiCheckLogSave); 134 iClearApiCheckLogRepository.save(tiClearApiCheckLogSave);
128 log.info(result.toString()); 135 log.info(result.toString());
129 return result; 136 return result;
...@@ -135,7 +142,7 @@ public class FedexDataInterface { ...@@ -135,7 +142,7 @@ public class FedexDataInterface {
135 public ResultRS sendMawbFedex(HttpServletRequest request 142 public ResultRS sendMawbFedex(HttpServletRequest request
136 , @RequestBody Fedexc fedexc) throws HttpProcessException { 143 , @RequestBody Fedexc fedexc) throws HttpProcessException {
137 log.info("接收到请求数据consignmentCode:"+fedexc.getConsignmentCode()+" data:" + gson.toJson(fedexc)); 144 log.info("接收到请求数据consignmentCode:"+fedexc.getConsignmentCode()+" data:" + gson.toJson(fedexc));
138 - ResultRS result = new ResultRS(Boolean.FALSE,"",""); 145 + ResultRS result = new ResultRS(Boolean.FALSE,null,null,null);
139 146
140 if(Objects.equals(fedexc,null)){ 147 if(Objects.equals(fedexc,null)){
141 result.setCode(ErrorCodeEnum.ERROR_7.getCode()); 148 result.setCode(ErrorCodeEnum.ERROR_7.getCode());
......
...@@ -7,9 +7,13 @@ import java.io.Serializable; ...@@ -7,9 +7,13 @@ import java.io.Serializable;
7 7
8 @Data 8 @Data
9 @AllArgsConstructor 9 @AllArgsConstructor
10 -public class IClearCheckResponseResult implements Serializable { 10 +public class IClearCheckResult implements Serializable {
11 //成功标识 11 //成功标识
12 private Boolean success = false; 12 private Boolean success = false;
13 + //中文消息
13 private String message; 14 private String message;
15 + //英文消息
16 + private String messageUS;
17 + //消息编码
14 private String code; 18 private String code;
15 } 19 }
......
...@@ -11,14 +11,11 @@ import java.io.Serializable; ...@@ -11,14 +11,11 @@ import java.io.Serializable;
11 @Data 11 @Data
12 @AllArgsConstructor 12 @AllArgsConstructor
13 public class ResultRS implements Serializable { 13 public class ResultRS implements Serializable {
14 -
15 //成功标识 14 //成功标识
16 private Boolean success = true; 15 private Boolean success = true;
17 private String code; 16 private String code;
18 -
19 //错误信息 17 //错误信息
20 private String msg; 18 private String msg;
21 //Object data; 19 //Object data;
22 - 20 + private String msgUS;
23 -
24 } 21 }
......
...@@ -89,7 +89,7 @@ public class SignInterceptor extends HandlerInterceptorAdapter { ...@@ -89,7 +89,7 @@ public class SignInterceptor extends HandlerInterceptorAdapter {
89 response.setContentType("application/json; charset=utf-8"); 89 response.setContentType("application/json; charset=utf-8");
90 try { 90 try {
91 writer = response.getWriter(); 91 writer = response.getWriter();
92 - ResultRS result = new ResultRS(success,code,msg); 92 + ResultRS result = new ResultRS(success,code,msg,null);
93 writer.print(JSON.toJSONString(result)); 93 writer.print(JSON.toJSONString(result));
94 } catch (IOException e){ 94 } catch (IOException e){
95 log.error("拦截器输出流异常"+e); 95 log.error("拦截器输出流异常"+e);
......
...@@ -494,7 +494,7 @@ public class ChmConsignmentService { ...@@ -494,7 +494,7 @@ public class ChmConsignmentService {
494 * @param timeStamp 494 * @param timeStamp
495 */ 495 */
496 public ResultRS processChmConsignment(Mawb mawb, String timeStamp, String creator) { 496 public ResultRS processChmConsignment(Mawb mawb, String timeStamp, String creator) {
497 - ResultRS result = new ResultRS(Boolean.FALSE,null,null); 497 + ResultRS result = new ResultRS(Boolean.FALSE,null,null,null);
498 try { 498 try {
499 Date pushTime = DateUtils.timeStampToDate(Long.valueOf(timeStamp)); 499 Date pushTime = DateUtils.timeStampToDate(Long.valueOf(timeStamp));
500 ChmConsignment chmConsignment=this.convertToChmConsignment(mawb,pushTime,creator); 500 ChmConsignment chmConsignment=this.convertToChmConsignment(mawb,pushTime,creator);
...@@ -580,7 +580,7 @@ public class ChmConsignmentService { ...@@ -580,7 +580,7 @@ public class ChmConsignmentService {
580 * @param timeStamp 580 * @param timeStamp
581 */ 581 */
582 public ResultRS processChmConsignmentFedex(FedexMawb fedexMawb, String timeStamp, String creator) { 582 public ResultRS processChmConsignmentFedex(FedexMawb fedexMawb, String timeStamp, String creator) {
583 - ResultRS result = new ResultRS(Boolean.FALSE,null,null); 583 + ResultRS result = new ResultRS(Boolean.FALSE,null,null,null);
584 try { 584 try {
585 Date pushTime = DateUtils.timeStampToDate(Long.valueOf(timeStamp)); 585 Date pushTime = DateUtils.timeStampToDate(Long.valueOf(timeStamp));
586 ChmConsignment chmConsignment = this.convertToChmConsignmentFedex(fedexMawb,pushTime,creator,null); 586 ChmConsignment chmConsignment = this.convertToChmConsignmentFedex(fedexMawb,pushTime,creator,null);
......
...@@ -2,7 +2,7 @@ package com.erry.iclear.dateInterface.service; ...@@ -2,7 +2,7 @@ package com.erry.iclear.dateInterface.service;
2 2
3 import com.erry.iclear.dateInterface.enums.ErrorCodeEnum; 3 import com.erry.iclear.dateInterface.enums.ErrorCodeEnum;
4 import com.erry.iclear.dateInterface.api.request.*; 4 import com.erry.iclear.dateInterface.api.request.*;
5 -import com.erry.iclear.dateInterface.api.response.IClearCheckResponseResult; 5 +import com.erry.iclear.dateInterface.api.response.IClearCheckResult;
6 import com.erry.iclear.dateInterface.api.response.ResultRS; 6 import com.erry.iclear.dateInterface.api.response.ResultRS;
7 import com.erry.iclear.dateInterface.entity.AppInfo; 7 import com.erry.iclear.dateInterface.entity.AppInfo;
8 import com.erry.iclear.dateInterface.entity.ChmConsignment; 8 import com.erry.iclear.dateInterface.entity.ChmConsignment;
...@@ -114,7 +114,7 @@ public class FedexService { ...@@ -114,7 +114,7 @@ public class FedexService {
114 * @return 114 * @return
115 */ 115 */
116 public ResultRS checkFedexMawb(FedexMawb fedexMawb,AppInfo appInfo){ 116 public ResultRS checkFedexMawb(FedexMawb fedexMawb,AppInfo appInfo){
117 - ResultRS result = new ResultRS(Boolean.FALSE,null,null); 117 + ResultRS result = new ResultRS(Boolean.FALSE,null,null,null);
118 try{ 118 try{
119 log.info("checkMawb start>>>>>>>>>> mawb:"+gson.toJson(fedexMawb)); 119 log.info("checkMawb start>>>>>>>>>> mawb:"+gson.toJson(fedexMawb));
120 120
...@@ -150,10 +150,11 @@ public class FedexService { ...@@ -150,10 +150,11 @@ public class FedexService {
150 150
151 log.info("iclearCheckUrl:"+json); 151 log.info("iclearCheckUrl:"+json);
152 152
153 - IClearCheckResponseResult iclearCheckResponseResult = JsonToJava.parseJson(json, IClearCheckResponseResult.class); 153 + IClearCheckResult iclearCheckResponseResult = JsonToJava.parseJson(json, IClearCheckResult.class);
154 result.setSuccess(iclearCheckResponseResult.getSuccess()); 154 result.setSuccess(iclearCheckResponseResult.getSuccess());
155 result.setCode(iclearCheckResponseResult.getCode()); 155 result.setCode(iclearCheckResponseResult.getCode());
156 result.setMsg(iclearCheckResponseResult.getMessage()); 156 result.setMsg(iclearCheckResponseResult.getMessage());
157 + result.setMsgUS(iclearCheckResponseResult.getMessageUS());
157 log.info("<<<<<<<< checkMawb start >>>>>>>>>> mawb:"+gson.toJson(fedexMawb) +" result :" +result.getSuccess() +" iclear check response : " + json + " status : " + result.getSuccess()); 158 log.info("<<<<<<<< checkMawb start >>>>>>>>>> mawb:"+gson.toJson(fedexMawb) +" result :" +result.getSuccess() +" iclear check response : " + json + " status : " + result.getSuccess());
158 }catch (Exception e){ 159 }catch (Exception e){
159 log.error("checkMawb() error:",e); 160 log.error("checkMawb() error:",e);
...@@ -169,7 +170,7 @@ public class FedexService { ...@@ -169,7 +170,7 @@ public class FedexService {
169 */ 170 */
170 public ResultRS checkBasfInterfaceData(Fedexc fedexc, AppInfo appInfo){ 171 public ResultRS checkBasfInterfaceData(Fedexc fedexc, AppInfo appInfo){
171 172
172 - ResultRS result = new ResultRS(Boolean.TRUE,null,null); 173 + ResultRS result = new ResultRS(Boolean.TRUE,null,null,null);
173 174
174 if(Objects.equals(fedexc,null)){ 175 if(Objects.equals(fedexc,null)){
175 result.setCode(ErrorCodeEnum.ERROR_7.getCode()); 176 result.setCode(ErrorCodeEnum.ERROR_7.getCode());
......
...@@ -25,7 +25,7 @@ public class MawbDetailService { ...@@ -25,7 +25,7 @@ public class MawbDetailService {
25 } 25 }
26 26
27 public ResultRS checkMawbDetail(Mawb mawb){ 27 public ResultRS checkMawbDetail(Mawb mawb){
28 - ResultRS result = new ResultRS(Boolean.FALSE,null,null); 28 + ResultRS result = new ResultRS(Boolean.FALSE,null,null,null);
29 try{ 29 try{
30 result.setSuccess(Boolean.TRUE); 30 result.setSuccess(Boolean.TRUE);
31 }catch (Exception e){ 31 }catch (Exception e){
......
...@@ -3,7 +3,7 @@ package com.erry.iclear.dateInterface.service; ...@@ -3,7 +3,7 @@ package com.erry.iclear.dateInterface.service;
3 import com.erry.iclear.dateInterface.enums.ErrorCodeEnum; 3 import com.erry.iclear.dateInterface.enums.ErrorCodeEnum;
4 import com.erry.iclear.dateInterface.api.request.Mawb; 4 import com.erry.iclear.dateInterface.api.request.Mawb;
5 import com.erry.iclear.dateInterface.api.request.MawbDetail; 5 import com.erry.iclear.dateInterface.api.request.MawbDetail;
6 -import com.erry.iclear.dateInterface.api.response.IClearCheckResponseResult; 6 +import com.erry.iclear.dateInterface.api.response.IClearCheckResult;
7 import com.erry.iclear.dateInterface.api.response.ResultRS; 7 import com.erry.iclear.dateInterface.api.response.ResultRS;
8 import com.erry.iclear.dateInterface.entity.ChmConsignment; 8 import com.erry.iclear.dateInterface.entity.ChmConsignment;
9 import com.erry.iclear.dateInterface.entity.ChmConsignmentDetail; 9 import com.erry.iclear.dateInterface.entity.ChmConsignmentDetail;
...@@ -172,7 +172,7 @@ public class MawbService { ...@@ -172,7 +172,7 @@ public class MawbService {
172 * @return 172 * @return
173 */ 173 */
174 public ResultRS checkMawb(Mawb mawb){ 174 public ResultRS checkMawb(Mawb mawb){
175 - ResultRS result = new ResultRS(Boolean.FALSE,null,null); 175 + ResultRS result = new ResultRS(Boolean.FALSE,null,null,null);
176 try{ 176 try{
177 log.info("checkMawb start>>>>>>>>>> mawb:"+gson.toJson(mawb)); 177 log.info("checkMawb start>>>>>>>>>> mawb:"+gson.toJson(mawb));
178 //1、将请求转换为运单 178 //1、将请求转换为运单
...@@ -208,7 +208,7 @@ public class MawbService { ...@@ -208,7 +208,7 @@ public class MawbService {
208 Map<String,String> headerMap = new HashMap<>(); 208 Map<String,String> headerMap = new HashMap<>();
209 headerMap.put("Content-Type", "application/json"); 209 headerMap.put("Content-Type", "application/json");
210 String json = HttpUtils.doPost(this.iclearCheckUrl,objJson,headerMap); 210 String json = HttpUtils.doPost(this.iclearCheckUrl,objJson,headerMap);
211 - IClearCheckResponseResult iclearCheckResponseResult = JsonToJava.parseJson(json, IClearCheckResponseResult.class); 211 + IClearCheckResult iclearCheckResponseResult = JsonToJava.parseJson(json, IClearCheckResult.class);
212 result.setSuccess(iclearCheckResponseResult.getSuccess()); 212 result.setSuccess(iclearCheckResponseResult.getSuccess());
213 result.setCode(iclearCheckResponseResult.getCode()); 213 result.setCode(iclearCheckResponseResult.getCode());
214 result.setMsg(iclearCheckResponseResult.getMessage()); 214 result.setMsg(iclearCheckResponseResult.getMessage());
...@@ -226,7 +226,7 @@ public class MawbService { ...@@ -226,7 +226,7 @@ public class MawbService {
226 * @return 226 * @return
227 */ 227 */
228 private ResultRS notBlankCheck(Mawb mawb,String dealMode) { 228 private ResultRS notBlankCheck(Mawb mawb,String dealMode) {
229 - ResultRS result = new ResultRS(Boolean.TRUE, null, null); 229 + ResultRS result = new ResultRS(Boolean.TRUE, null, null,null);
230 //成交方式为CIF时 '参数feeCurr不能为空','参数feeMark不能为空'',参数feeRate不能为空','参数insurCurr不能为空', '参数insurRate不能为空' 230 //成交方式为CIF时 '参数feeCurr不能为空','参数feeMark不能为空'',参数feeRate不能为空','参数insurCurr不能为空', '参数insurRate不能为空'
231 if(dealMode.equals("CIF、CIP、DDP、DDU、DAP")){ 231 if(dealMode.equals("CIF、CIP、DDP、DDU、DAP")){
232 if(StringUtil.isEmpty(mawb.getFeeCurr())){ 232 if(StringUtil.isEmpty(mawb.getFeeCurr())){
......