Showing
29 changed files
with
322 additions
and
88 deletions
No preview for this file type
No preview for this file type
sql/BASF校验接口.sql
0 → 100644
| 1 | +create table T_ICLEAR_API_CHECK_LOG | ||
| 2 | +( | ||
| 3 | +ID bigint primary key identity (1,1), | ||
| 4 | +request_appid varchar(200), | ||
| 5 | +request_appkey varchar(200), | ||
| 6 | +request_token varchar(200), | ||
| 7 | +consignment_code varchar(200), | ||
| 8 | +request_text text, | ||
| 9 | +response_text text, | ||
| 10 | +request_ip varchar(200), | ||
| 11 | +create_time datetime, | ||
| 12 | +success int, | ||
| 13 | +code varchar(200), | ||
| 14 | +) |
| ... | @@ -42,7 +42,7 @@ public class CustomsDataInterface { | ... | @@ -42,7 +42,7 @@ public class CustomsDataInterface { |
| 42 | private ChmConsignmentDetailService chmConsignmentDetailService; | 42 | private ChmConsignmentDetailService chmConsignmentDetailService; |
| 43 | 43 | ||
| 44 | 44 | ||
| 45 | - @ApiOperation(value = "推送主单数据", httpMethod = "POST", notes = "ex: http://192.168.1.75:8080/customs/sendMawb") | 45 | + @ApiOperation(value = "D类推送主单数据", httpMethod = "POST", notes = "ex: http://192.168.1.75:8080/customs/sendMawb") |
| 46 | @PostMapping("/sendMawb") | 46 | @PostMapping("/sendMawb") |
| 47 | @ResponseBody | 47 | @ResponseBody |
| 48 | public ResultRS sendMawb(HttpServletRequest request | 48 | public ResultRS sendMawb(HttpServletRequest request |
| ... | @@ -109,12 +109,12 @@ public class CustomsDataInterface { | ... | @@ -109,12 +109,12 @@ public class CustomsDataInterface { |
| 109 | sw.stop(); | 109 | sw.stop(); |
| 110 | 110 | ||
| 111 | // //3、TODO 校验子单 | 111 | // //3、TODO 校验子单 |
| 112 | -// sw.start("checkMawbDetail"); | 112 | + sw.start("checkMawbDetail"); |
| 113 | -// result=mawbDetailServicel.checkMawbDetail(mawb); | 113 | + result=mawbDetailServicel.checkMawbDetail(mawb); |
| 114 | -// if(!result.getSuccess()){ | 114 | + if(!result.getSuccess()){ |
| 115 | -// return result; | 115 | + return result; |
| 116 | -// } | 116 | + } |
| 117 | -// sw.stop(); | 117 | + sw.stop(); |
| 118 | 118 | ||
| 119 | 119 | ||
| 120 | //4、保存运单到iclear中 | 120 | //4、保存运单到iclear中 | ... | ... |
| ... | @@ -12,7 +12,9 @@ import com.erry.iclear.dateInterface.api.response.ResultRS; | ... | @@ -12,7 +12,9 @@ import com.erry.iclear.dateInterface.api.response.ResultRS; |
| 12 | import com.erry.iclear.dateInterface.entity.ChmConsignment; | 12 | import com.erry.iclear.dateInterface.entity.ChmConsignment; |
| 13 | import com.erry.iclear.dateInterface.entity.DeclaredInfo; | 13 | import com.erry.iclear.dateInterface.entity.DeclaredInfo; |
| 14 | import com.erry.iclear.dateInterface.entity.IClearApiLog; | 14 | import com.erry.iclear.dateInterface.entity.IClearApiLog; |
| 15 | +import com.erry.iclear.dateInterface.entity.TIClearApiCheckLog; | ||
| 15 | import com.erry.iclear.dateInterface.repository.ChmConsignmentRepository; | 16 | import com.erry.iclear.dateInterface.repository.ChmConsignmentRepository; |
| 17 | +import com.erry.iclear.dateInterface.repository.IClearApiCheckLogRepository; | ||
| 16 | import com.erry.iclear.dateInterface.service.*; | 18 | import com.erry.iclear.dateInterface.service.*; |
| 17 | import com.erry.iclear.dateInterface.util.JsonToJava; | 19 | import com.erry.iclear.dateInterface.util.JsonToJava; |
| 18 | import com.erry.iclear.dateInterface.util.StringUtil; | 20 | import com.erry.iclear.dateInterface.util.StringUtil; |
| ... | @@ -58,11 +60,74 @@ public class FedexDataInterface { | ... | @@ -58,11 +60,74 @@ public class FedexDataInterface { |
| 58 | @Autowired | 60 | @Autowired |
| 59 | private ChmConsignmentRepository chmConsignmentRepository; | 61 | private ChmConsignmentRepository chmConsignmentRepository; |
| 60 | 62 | ||
| 63 | + @Autowired | ||
| 64 | + private IClearApiCheckLogRepository iClearApiCheckLogRepository; | ||
| 65 | + | ||
| 61 | @Value("${api.address.iclear-submit-url}") | 66 | @Value("${api.address.iclear-submit-url}") |
| 62 | String iclearCSubmitUrl; | 67 | String iclearCSubmitUrl; |
| 63 | 68 | ||
| 64 | 69 | ||
| 65 | - @ApiOperation(value = "Fedex推送运单数据", httpMethod = "POST", notes = "ex: http://192.168.1.75:8080/fedex/sendMawbFedex") | 70 | + @ApiOperation(value = "BASF运单数据校验接口", httpMethod = "POST", notes = "ex: http://192.168.1.75:8080/fedex/checkBASFMawbFedex") |
| 71 | + @PostMapping("/checkBASFMawbFedex") | ||
| 72 | + @ResponseBody | ||
| 73 | + public ResultRS checkBASFMawbFedex(HttpServletRequest request | ||
| 74 | + ,@RequestBody Fedexc fedexc) throws HttpProcessException { | ||
| 75 | + String appId=(String) request.getHeader("Appid"); | ||
| 76 | + String appKey=(String) request.getHeader("Appkey"); | ||
| 77 | + String timeStamp=(String) request.getHeader("TimeStamp"); | ||
| 78 | + String token=(String) request.getHeader("Token"); | ||
| 79 | + String addr = request.getRemoteAddr(); | ||
| 80 | + | ||
| 81 | + | ||
| 82 | + TIClearApiCheckLog tIclearApiCheckLog = new TIClearApiCheckLog(); | ||
| 83 | + tIclearApiCheckLog.setRequestAppid(appId); | ||
| 84 | + tIclearApiCheckLog.setRequestAppkey(appKey); | ||
| 85 | + tIclearApiCheckLog.setRequestIp(addr); | ||
| 86 | + tIclearApiCheckLog.setRequestToken(token); | ||
| 87 | + tIclearApiCheckLog.setConsignmentCode(fedexc.getConsignmentCode()); | ||
| 88 | + tIclearApiCheckLog.setCreateTime(new Date()); | ||
| 89 | + tIclearApiCheckLog.setRequestText( | ||
| 90 | + new String("requestHeader[appId:"+appId+"," + | ||
| 91 | + "appKey:"+appKey+"," + | ||
| 92 | + "timeStamp:"+timeStamp+"," + | ||
| 93 | + "token:"+token) + "]," | ||
| 94 | + + fedexc.toString() | ||
| 95 | + ); | ||
| 96 | + TIClearApiCheckLog tiClearApiCheckLogSave = iClearApiCheckLogRepository.save(tIclearApiCheckLog); | ||
| 97 | + log.info("checkBASFMawbFedex:"+fedexc.toString()); | ||
| 98 | + log.info("appId:{},appKey:{},timeStamp:{},token:{}",appId,appKey,timeStamp,token); | ||
| 99 | + | ||
| 100 | + ResultRS result = fedexService.checkBasfInterfaceData(fedexc); | ||
| 101 | + | ||
| 102 | + StopWatch sw = new StopWatch("checkBASFMawbFedex"); | ||
| 103 | + sw.start("generate FedexMawb"); | ||
| 104 | + fedexc.setAppId(appId); | ||
| 105 | + FedexMawb saveMawbFedexResult = fedexService.generateFedexMawb(fedexc); | ||
| 106 | + sw.stop(); | ||
| 107 | + | ||
| 108 | + sw.start("checkFedexMawb"); | ||
| 109 | + String msg = result.getMsg(); | ||
| 110 | + String iclearCheckMsg = fedexService.checkFedexMawb(saveMawbFedexResult).getMsg(); | ||
| 111 | + result.setMsg(msg+";"+iclearCheckMsg); | ||
| 112 | + sw.stop(); | ||
| 113 | + | ||
| 114 | + log.info(sw.prettyPrint()); | ||
| 115 | + if(result.getSuccess()){ | ||
| 116 | + result.setSuccess(Boolean.TRUE); | ||
| 117 | + result.setCode("0"); | ||
| 118 | + } | ||
| 119 | + tiClearApiCheckLogSave.setResponseText(result.getMsg()); | ||
| 120 | + tiClearApiCheckLogSave.setCode(result.getCode()); | ||
| 121 | + tiClearApiCheckLogSave.setSuccess(result.getSuccess()); | ||
| 122 | + | ||
| 123 | + iClearApiCheckLogRepository.save(tiClearApiCheckLogSave); | ||
| 124 | + log.info(result.toString()); | ||
| 125 | + return result; | ||
| 126 | + } | ||
| 127 | + | ||
| 128 | + | ||
| 129 | + | ||
| 130 | + @ApiOperation(value = "C类Fedex推送运单数据", httpMethod = "POST", notes = "ex: http://192.168.1.75:8080/fedex/sendMawbFedex") | ||
| 66 | @PostMapping("/sendMawbFedex") | 131 | @PostMapping("/sendMawbFedex") |
| 67 | @ResponseBody | 132 | @ResponseBody |
| 68 | public ResultRS sendMawbFedex(HttpServletRequest request | 133 | public ResultRS sendMawbFedex(HttpServletRequest request |
| ... | @@ -283,4 +348,5 @@ public class FedexDataInterface { | ... | @@ -283,4 +348,5 @@ public class FedexDataInterface { |
| 283 | result.setCode("0"); | 348 | result.setCode("0"); |
| 284 | return result; | 349 | return result; |
| 285 | } | 350 | } |
| 351 | + | ||
| 286 | } | 352 | } | ... | ... |
| ... | @@ -57,8 +57,7 @@ public class HsCodeInterface { | ... | @@ -57,8 +57,7 @@ public class HsCodeInterface { |
| 57 | return resultHsCode; | 57 | return resultHsCode; |
| 58 | } | 58 | } |
| 59 | }catch(Exception ex){ | 59 | }catch(Exception ex){ |
| 60 | - log.error(ex.getMessage()); | 60 | + log.error(ex.getMessage(),ex); |
| 61 | - ex.printStackTrace(); | ||
| 62 | resultHsCode = new ResultHsCode(Boolean.FALSE,"30101","数据查询异常",null); | 61 | resultHsCode = new ResultHsCode(Boolean.FALSE,"30101","数据查询异常",null); |
| 63 | return resultHsCode; | 62 | return resultHsCode; |
| 64 | }finally { | 63 | }finally { | ... | ... |
| ... | @@ -30,7 +30,7 @@ public class FedexDetail { | ... | @@ -30,7 +30,7 @@ public class FedexDetail { |
| 30 | private Long basfId; | 30 | private Long basfId; |
| 31 | 31 | ||
| 32 | @Column(name="CONSIGNMENTDETAILID") | 32 | @Column(name="CONSIGNMENTDETAILID") |
| 33 | - @NotNull(message="参数consignmentDetailId不能为空") | 33 | +// @NotNull(message="参数consignmentDetailId不能为空") |
| 34 | private Long consignmentDetailId; | 34 | private Long consignmentDetailId; |
| 35 | 35 | ||
| 36 | @ApiModelProperty(value = "商品编号") | 36 | @ApiModelProperty(value = "商品编号") | ... | ... |
| ... | @@ -50,7 +50,7 @@ public class Fedexc implements Serializable { | ... | @@ -50,7 +50,7 @@ public class Fedexc implements Serializable { |
| 50 | 50 | ||
| 51 | @ApiModelProperty(value = "运单ID", name = "consignmentId", example = "运单记录的唯一ID") | 51 | @ApiModelProperty(value = "运单ID", name = "consignmentId", example = "运单记录的唯一ID") |
| 52 | @Column(name = "CONSIGNMENTID") | 52 | @Column(name = "CONSIGNMENTID") |
| 53 | - @NotNull(message="参数consignmentId不能为空!") | 53 | +// @NotNull(message="参数consignmentId不能为空!") |
| 54 | // @NotBlank(message="参数consignmentId不能为空!") | 54 | // @NotBlank(message="参数consignmentId不能为空!") |
| 55 | private Long consignmentId; | 55 | private Long consignmentId; |
| 56 | 56 | ... | ... |
| ... | @@ -114,7 +114,6 @@ public class MawbDetail implements Serializable{ | ... | @@ -114,7 +114,6 @@ public class MawbDetail implements Serializable{ |
| 114 | private String secondUnit; | 114 | private String secondUnit; |
| 115 | 115 | ||
| 116 | @ApiModelProperty(value = "第二法定数量") | 116 | @ApiModelProperty(value = "第二法定数量") |
| 117 | - @NotNull(message="参数secondQty不能为空") | ||
| 118 | @Column(name = "SECONDQTY") | 117 | @Column(name = "SECONDQTY") |
| 119 | private Integer secondQty; | 118 | private Integer secondQty; |
| 120 | 119 | ... | ... |
| 1 | +package com.erry.iclear.dateInterface.entity; | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +import com.erry.iclear.dateInterface.common.BaseModel; | ||
| 5 | +import lombok.Data; | ||
| 6 | + | ||
| 7 | +import javax.persistence.*; | ||
| 8 | +import java.util.Date; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * BASF校验接口日志表 | ||
| 12 | + * | ||
| 13 | + * sql/BASF校验接口.sql | ||
| 14 | + */ | ||
| 15 | +@Entity | ||
| 16 | +@Table(name = "T_ICLEAR_API_CHECK_LOG") | ||
| 17 | +@Data | ||
| 18 | +public class TIClearApiCheckLog extends BaseModel { | ||
| 19 | + | ||
| 20 | + @Id | ||
| 21 | + @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| 22 | + @Column(name = "ID" ) | ||
| 23 | + private Long id; | ||
| 24 | + | ||
| 25 | + @Column(name = "request_appid" ) | ||
| 26 | + private String requestAppid; | ||
| 27 | + | ||
| 28 | + @Column(name = "request_appkey" ) | ||
| 29 | + private String requestAppkey; | ||
| 30 | + | ||
| 31 | + @Column(name = "request_token" ) | ||
| 32 | + private String requestToken; | ||
| 33 | + | ||
| 34 | + @Column(name = "consignment_code" ) | ||
| 35 | + private String consignmentCode; | ||
| 36 | + | ||
| 37 | + @Column(name = "request_text" ) | ||
| 38 | + private String requestText; | ||
| 39 | + | ||
| 40 | + @Column(name = "response_text" ) | ||
| 41 | + private String responseText; | ||
| 42 | + | ||
| 43 | + @Column(name = "request_ip" ) | ||
| 44 | + private String requestIp; | ||
| 45 | + | ||
| 46 | + @Column(name = "create_time" ) | ||
| 47 | + private Date createTime; | ||
| 48 | + | ||
| 49 | + @Column(name = "success" ) | ||
| 50 | + private Boolean success; | ||
| 51 | + | ||
| 52 | + @Column(name = "code" ) | ||
| 53 | + private String code; | ||
| 54 | + | ||
| 55 | +} |
| ... | @@ -36,22 +36,22 @@ public class HsCodeInterceptor extends HandlerInterceptorAdapter { | ... | @@ -36,22 +36,22 @@ public class HsCodeInterceptor extends HandlerInterceptorAdapter { |
| 36 | //String uri = request.getRequestURI(); | 36 | //String uri = request.getRequestURI(); |
| 37 | 37 | ||
| 38 | if(StringUtils.isBlank(appId)){ | 38 | if(StringUtils.isBlank(appId)){ |
| 39 | - this.returnJson(response,false,"10016","Appid 不能为空"); | 39 | + this.returnJson(response,false,"10016","Appid不能为空"); |
| 40 | return false; | 40 | return false; |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | if(StringUtils.isBlank(appkey)){ | 43 | if(StringUtils.isBlank(appkey)){ |
| 44 | - this.returnJson(response,false,"10017","Appkey 不能为空"); | 44 | + this.returnJson(response,false,"10017","Appkey不能为空"); |
| 45 | return false; | 45 | return false; |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | if(StringUtils.isBlank(timeStamp)){ | 48 | if(StringUtils.isBlank(timeStamp)){ |
| 49 | - this.returnJson(response,false,"10018","TimeStamp 不能为空"); | 49 | + this.returnJson(response,false,"10018","TimeStamp不能为空"); |
| 50 | return false; | 50 | return false; |
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | if(StringUtils.isBlank(token)){ | 53 | if(StringUtils.isBlank(token)){ |
| 54 | - this.returnJson(response,false,"10013","token 不能为空"); | 54 | + this.returnJson(response,false,"10013","token不能为空"); |
| 55 | return false; | 55 | return false; |
| 56 | } | 56 | } |
| 57 | 57 | ... | ... |
| ... | @@ -35,22 +35,22 @@ public class SignInterceptor extends HandlerInterceptorAdapter { | ... | @@ -35,22 +35,22 @@ public class SignInterceptor extends HandlerInterceptorAdapter { |
| 35 | 35 | ||
| 36 | 36 | ||
| 37 | if(StringUtils.isBlank(appId)){ | 37 | if(StringUtils.isBlank(appId)){ |
| 38 | - this.returnJson(response,false,"10016","Appid 不能为空"); | 38 | + this.returnJson(response,false,"10016","Appid不能为空"); |
| 39 | return false; | 39 | return false; |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | if(StringUtils.isBlank(appkey)){ | 42 | if(StringUtils.isBlank(appkey)){ |
| 43 | - this.returnJson(response,false,"10017","Appkey 不能为空"); | 43 | + this.returnJson(response,false,"10017","Appkey不能为空"); |
| 44 | return false; | 44 | return false; |
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | if(StringUtils.isBlank(timeStamp)){ | 47 | if(StringUtils.isBlank(timeStamp)){ |
| 48 | - this.returnJson(response,false,"10018","TimeStamp 不能为空"); | 48 | + this.returnJson(response,false,"10018","TimeStamp不能为空"); |
| 49 | return false; | 49 | return false; |
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | if(StringUtils.isBlank(token)){ | 52 | if(StringUtils.isBlank(token)){ |
| 53 | - this.returnJson(response,false,"10013","token 不能为空"); | 53 | + this.returnJson(response,false,"10013","token不能为空"); |
| 54 | return false; | 54 | return false; |
| 55 | } | 55 | } |
| 56 | 56 | ... | ... |
| 1 | +package com.erry.iclear.dateInterface.repository; | ||
| 2 | + | ||
| 3 | +import com.erry.iclear.dateInterface.entity.IClearApiLog; | ||
| 4 | +import com.erry.iclear.dateInterface.entity.TIClearApiCheckLog; | ||
| 5 | +import org.hibernate.annotations.DynamicInsert; | ||
| 6 | +import org.hibernate.annotations.DynamicUpdate; | ||
| 7 | +import org.springframework.data.jpa.repository.JpaRepository; | ||
| 8 | +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
| 9 | +import org.springframework.stereotype.Repository; | ||
| 10 | +import org.springframework.transaction.annotation.Transactional; | ||
| 11 | + | ||
| 12 | +/** | ||
| 13 | + * @author Administrator | ||
| 14 | + */ | ||
| 15 | +@DynamicUpdate | ||
| 16 | +@DynamicInsert | ||
| 17 | +@Repository | ||
| 18 | +@Transactional(rollbackFor = Exception.class) | ||
| 19 | +public interface IClearApiCheckLogRepository extends JpaRepository<TIClearApiCheckLog, Integer>, JpaSpecificationExecutor<TIClearApiCheckLog> { | ||
| 20 | + | ||
| 21 | + | ||
| 22 | +} |
| ... | @@ -139,6 +139,7 @@ public class ApiService { | ... | @@ -139,6 +139,7 @@ public class ApiService { |
| 139 | //推送时间 | 139 | //推送时间 |
| 140 | declearTask.setPushTime(new Date()); | 140 | declearTask.setPushTime(new Date()); |
| 141 | String objJson = JsonToJava.toJson(d); | 141 | String objJson = JsonToJava.toJson(d); |
| 142 | + log.info("推送海关回执json: " + objJson); | ||
| 142 | //推送海关回执数据 | 143 | //推送海关回执数据 |
| 143 | String json = HttpUtils.doPost(this.customsUrl,objJson,headerMap); | 144 | String json = HttpUtils.doPost(this.customsUrl,objJson,headerMap); |
| 144 | //接口响应时间 | 145 | //接口响应时间 |
| ... | @@ -160,12 +161,12 @@ public class ApiService { | ... | @@ -160,12 +161,12 @@ public class ApiService { |
| 160 | log.info("海关回执推送失败,推送相应码为:"+tokenResult.getErrorcode() + ",推送ID为:" + d.getId()); | 161 | log.info("海关回执推送失败,推送相应码为:"+tokenResult.getErrorcode() + ",推送ID为:" + d.getId()); |
| 161 | } | 162 | } |
| 162 | }catch(Exception ex){ | 163 | }catch(Exception ex){ |
| 164 | + log.error("推送海关回执异常:" + ex.getMessage(), ex); | ||
| 163 | //接口响应时间 | 165 | //接口响应时间 |
| 164 | declearTask.setResponseTime(new Date()); | 166 | declearTask.setResponseTime(new Date()); |
| 165 | declearTask.setResponseResults("99999"); | 167 | declearTask.setResponseResults("99999"); |
| 166 | declearTask.setResponseContent(ex.getMessage()); | 168 | declearTask.setResponseContent(ex.getMessage()); |
| 167 | declearTaskList.add(declearTask); | 169 | declearTaskList.add(declearTask); |
| 168 | - ex.printStackTrace(); | ||
| 169 | } | 170 | } |
| 170 | }); | 171 | }); |
| 171 | declearTaskList.forEach(declearTask -> { | 172 | declearTaskList.forEach(declearTask -> { |
| ... | @@ -203,7 +204,7 @@ public class ApiService { | ... | @@ -203,7 +204,7 @@ public class ApiService { |
| 203 | }); | 204 | }); |
| 204 | this.sendMawb(token,mawbList); | 205 | this.sendMawb(token,mawbList); |
| 205 | }catch(Exception ex){ | 206 | }catch(Exception ex){ |
| 206 | - ex.printStackTrace(); | 207 | + log.error("pushMawbAcc",ex); |
| 207 | } | 208 | } |
| 208 | } | 209 | } |
| 209 | /** | 210 | /** |
| ... | @@ -261,7 +262,7 @@ public class ApiService { | ... | @@ -261,7 +262,7 @@ public class ApiService { |
| 261 | declearTask.setResponseResults("99999"); | 262 | declearTask.setResponseResults("99999"); |
| 262 | declearTask.setResponseContent(ex.getMessage()); | 263 | declearTask.setResponseContent(ex.getMessage()); |
| 263 | declearTaskList.add(declearTask); | 264 | declearTaskList.add(declearTask); |
| 264 | - ex.printStackTrace(); | 265 | + log.error("sendMawb",ex); |
| 265 | } | 266 | } |
| 266 | }); | 267 | }); |
| 267 | declearTaskList.forEach(declearTask -> { | 268 | declearTaskList.forEach(declearTask -> { | ... | ... |
| ... | @@ -234,8 +234,7 @@ public class ChmConsignmentService { | ... | @@ -234,8 +234,7 @@ public class ChmConsignmentService { |
| 234 | 234 | ||
| 235 | }catch (Exception e){ | 235 | }catch (Exception e){ |
| 236 | result=null; | 236 | result=null; |
| 237 | - e.printStackTrace(); | 237 | + log.error("sendMawb",e); |
| 238 | - log.error("convertToChmConsignment() error:"+e.getMessage()); | ||
| 239 | } | 238 | } |
| 240 | return result; | 239 | return result; |
| 241 | } | 240 | } |
| ... | @@ -292,8 +291,7 @@ public class ChmConsignmentService { | ... | @@ -292,8 +291,7 @@ public class ChmConsignmentService { |
| 292 | } | 291 | } |
| 293 | }catch (Exception e){ | 292 | }catch (Exception e){ |
| 294 | result=null; | 293 | result=null; |
| 295 | - e.printStackTrace(); | 294 | + log.error("convertToChmConsignmentFedex() error:"+e.getMessage(),e); |
| 296 | - log.error("convertToChmConsignmentFedex() error:"+e.getMessage()); | ||
| 297 | } | 295 | } |
| 298 | return result; | 296 | return result; |
| 299 | } | 297 | } |
| ... | @@ -430,8 +428,7 @@ public class ChmConsignmentService { | ... | @@ -430,8 +428,7 @@ public class ChmConsignmentService { |
| 430 | result.setOverseasConsigneeEname(consignment.getOverseasConsignorFnCname()); | 428 | result.setOverseasConsigneeEname(consignment.getOverseasConsignorFnCname()); |
| 431 | }catch (Exception e){ | 429 | }catch (Exception e){ |
| 432 | result=null; | 430 | result=null; |
| 433 | - e.printStackTrace(); | 431 | + log.error("convertToChmConsignment() error:"+e.getMessage(),e); |
| 434 | - log.error("convertToChmConsignment() error:"+e.getMessage()); | ||
| 435 | } | 432 | } |
| 436 | return result; | 433 | return result; |
| 437 | } | 434 | } | ... | ... |
| ... | @@ -45,7 +45,7 @@ public class DeclearTaskService{ | ... | @@ -45,7 +45,7 @@ public class DeclearTaskService{ |
| 45 | declareTaskRepository.saveAll(declareTaskList); | 45 | declareTaskRepository.saveAll(declareTaskList); |
| 46 | } | 46 | } |
| 47 | }catch (Exception e){ | 47 | }catch (Exception e){ |
| 48 | - e.printStackTrace(); | 48 | + log.error(e.getMessage(),e); |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | } | 51 | } |
| ... | @@ -70,7 +70,7 @@ public class DeclearTaskService{ | ... | @@ -70,7 +70,7 @@ public class DeclearTaskService{ |
| 70 | declareTaskRepository.saveAll(declareTaskList); | 70 | declareTaskRepository.saveAll(declareTaskList); |
| 71 | } | 71 | } |
| 72 | }catch (Exception e){ | 72 | }catch (Exception e){ |
| 73 | - e.printStackTrace(); | 73 | + log.error(e.getMessage(),e); |
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | } | 76 | } | ... | ... |
| ... | @@ -27,8 +27,7 @@ public class DictionaryEntriesService { | ... | @@ -27,8 +27,7 @@ public class DictionaryEntriesService { |
| 27 | try { | 27 | try { |
| 28 | result=dictionaryEntriesRepository.findAllDictionaryEntries(); | 28 | result=dictionaryEntriesRepository.findAllDictionaryEntries(); |
| 29 | }catch (Exception e){ | 29 | }catch (Exception e){ |
| 30 | - e.printStackTrace(); | 30 | + log.error(e.getMessage(),e); |
| 31 | - log.error("getAllDictionaryEntries() error:"+e.getMessage()); | ||
| 32 | } | 31 | } |
| 33 | return result; | 32 | return result; |
| 34 | } | 33 | } | ... | ... |
| ... | @@ -3,12 +3,14 @@ package com.erry.iclear.dateInterface.service; | ... | @@ -3,12 +3,14 @@ package com.erry.iclear.dateInterface.service; |
| 3 | import com.erry.iclear.dateInterface.api.request.FedexConsignment; | 3 | import com.erry.iclear.dateInterface.api.request.FedexConsignment; |
| 4 | import com.erry.iclear.dateInterface.api.request.ConsignmentDetail; | 4 | import com.erry.iclear.dateInterface.api.request.ConsignmentDetail; |
| 5 | import com.erry.iclear.dateInterface.entity.DeclaredInfo; | 5 | import com.erry.iclear.dateInterface.entity.DeclaredInfo; |
| 6 | +import lombok.extern.slf4j.Slf4j; | ||
| 6 | import org.springframework.stereotype.Service; | 7 | import org.springframework.stereotype.Service; |
| 7 | 8 | ||
| 8 | import java.util.ArrayList; | 9 | import java.util.ArrayList; |
| 9 | import java.util.List; | 10 | import java.util.List; |
| 10 | 11 | ||
| 11 | @Service | 12 | @Service |
| 13 | +@Slf4j | ||
| 12 | public class FedexConsignmentService { | 14 | public class FedexConsignmentService { |
| 13 | 15 | ||
| 14 | public List<FedexConsignment> fedexConsignmentList(List<DeclaredInfo> consignment){ | 16 | public List<FedexConsignment> fedexConsignmentList(List<DeclaredInfo> consignment){ |
| ... | @@ -62,7 +64,7 @@ public class FedexConsignmentService { | ... | @@ -62,7 +64,7 @@ public class FedexConsignmentService { |
| 62 | fedexConsignmentList.add(fedexConsignment); | 64 | fedexConsignmentList.add(fedexConsignment); |
| 63 | } | 65 | } |
| 64 | }catch (Exception e){ | 66 | }catch (Exception e){ |
| 65 | - e.printStackTrace(); | 67 | + log.error(e.getMessage(),e); |
| 66 | } | 68 | } |
| 67 | return fedexConsignmentList; | 69 | return fedexConsignmentList; |
| 68 | } | 70 | } | ... | ... |
| ... | @@ -11,15 +11,22 @@ import com.erry.iclear.dateInterface.entity.ChmConsignmentDetail; | ... | @@ -11,15 +11,22 @@ import com.erry.iclear.dateInterface.entity.ChmConsignmentDetail; |
| 11 | import com.erry.iclear.dateInterface.repository.FedexMawbRepository; | 11 | import com.erry.iclear.dateInterface.repository.FedexMawbRepository; |
| 12 | import com.erry.iclear.dateInterface.util.JsonToJava; | 12 | import com.erry.iclear.dateInterface.util.JsonToJava; |
| 13 | import com.google.gson.Gson; | 13 | import com.google.gson.Gson; |
| 14 | +import io.swagger.annotations.ApiModelProperty; | ||
| 14 | import lombok.extern.slf4j.Slf4j; | 15 | import lombok.extern.slf4j.Slf4j; |
| 16 | +import org.apache.commons.lang3.StringUtils; | ||
| 15 | import org.apache.http.Header; | 17 | import org.apache.http.Header; |
| 16 | import org.springframework.beans.factory.annotation.Autowired; | 18 | import org.springframework.beans.factory.annotation.Autowired; |
| 17 | import org.springframework.beans.factory.annotation.Value; | 19 | import org.springframework.beans.factory.annotation.Value; |
| 18 | import org.springframework.stereotype.Service; | 20 | import org.springframework.stereotype.Service; |
| 19 | 21 | ||
| 22 | +import javax.persistence.*; | ||
| 23 | +import javax.validation.Valid; | ||
| 24 | +import javax.validation.constraints.NotBlank; | ||
| 25 | +import javax.validation.constraints.NotNull; | ||
| 20 | import java.util.ArrayList; | 26 | import java.util.ArrayList; |
| 21 | import java.util.List; | 27 | import java.util.List; |
| 22 | import java.util.Objects; | 28 | import java.util.Objects; |
| 29 | +import java.util.stream.Collectors; | ||
| 23 | 30 | ||
| 24 | /** | 31 | /** |
| 25 | * @author Administrator | 32 | * @author Administrator |
| ... | @@ -50,6 +57,16 @@ public class FedexService { | ... | @@ -50,6 +57,16 @@ public class FedexService { |
| 50 | FedexMawb result=null; | 57 | FedexMawb result=null; |
| 51 | try{ | 58 | try{ |
| 52 | log.info("saveMawb start>>>>>>>>>>>"); | 59 | log.info("saveMawb start>>>>>>>>>>>"); |
| 60 | + FedexMawb fedexMawb = this.generateFedexMawb(fedexc); | ||
| 61 | + result = fedexMawbRepository.save(fedexMawb); | ||
| 62 | + log.info("saveMawb end>>>>>>>>>>>"); | ||
| 63 | + }catch (Exception e){ | ||
| 64 | + log.error("saveMawb() error:"+e.getMessage()); | ||
| 65 | + } | ||
| 66 | + return result; | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + public FedexMawb generateFedexMawb(Fedexc fedexc){ | ||
| 53 | //运单头部信息 | 70 | //运单头部信息 |
| 54 | FedexMawb fedexMawb = new FedexMawb(); | 71 | FedexMawb fedexMawb = new FedexMawb(); |
| 55 | fedexMawb.setAppId(fedexc.getAppId()); | 72 | fedexMawb.setAppId(fedexc.getAppId()); |
| ... | @@ -75,7 +92,8 @@ public class FedexService { | ... | @@ -75,7 +92,8 @@ public class FedexService { |
| 75 | fedexMawb.setEanNo(fedexc.getEanNo()); | 92 | fedexMawb.setEanNo(fedexc.getEanNo()); |
| 76 | //明细 | 93 | //明细 |
| 77 | List<FedexMawbDetail> mawbDetailList = new ArrayList<>(); | 94 | List<FedexMawbDetail> mawbDetailList = new ArrayList<>(); |
| 78 | - if (fedexc.getConsignmentList().size()>0){ | 95 | + List<FedexDetail> consignmentList = fedexc.getConsignmentList(); |
| 96 | + if (Objects.nonNull(consignmentList) &&consignmentList.size()>0){ | ||
| 79 | for (FedexDetail fedexcDetail : fedexc.getConsignmentList()){ | 97 | for (FedexDetail fedexcDetail : fedexc.getConsignmentList()){ |
| 80 | FedexMawbDetail mawbDetail = new FedexMawbDetail(); | 98 | FedexMawbDetail mawbDetail = new FedexMawbDetail(); |
| 81 | mawbDetail.setDetailId(String.valueOf(fedexcDetail.getConsignmentDetailId())); | 99 | mawbDetail.setDetailId(String.valueOf(fedexcDetail.getConsignmentDetailId())); |
| ... | @@ -95,12 +113,8 @@ public class FedexService { | ... | @@ -95,12 +113,8 @@ public class FedexService { |
| 95 | } | 113 | } |
| 96 | } | 114 | } |
| 97 | fedexMawb.setMawbDetailList(mawbDetailList); | 115 | fedexMawb.setMawbDetailList(mawbDetailList); |
| 98 | - result = fedexMawbRepository.save(fedexMawb); | 116 | + |
| 99 | - log.info("saveMawb end>>>>>>>>>>>"); | 117 | + return fedexMawb; |
| 100 | - }catch (Exception e){ | ||
| 101 | - log.error("saveMawb() error:"+e.getMessage()); | ||
| 102 | - } | ||
| 103 | - return result; | ||
| 104 | } | 118 | } |
| 105 | 119 | ||
| 106 | /** | 120 | /** |
| ... | @@ -145,7 +159,56 @@ public class FedexService { | ... | @@ -145,7 +159,56 @@ public class FedexService { |
| 145 | result.setMsg(iclearCheckResponseResult.getMessage()); | 159 | result.setMsg(iclearCheckResponseResult.getMessage()); |
| 146 | log.info("<<<<<<<< checkMawb start >>>>>>>>>> mawb:"+gson.toJson(fedexMawb) +" result :" +result.getSuccess() +" iclear check response : " + json + " status : " + result.getSuccess()); | 160 | log.info("<<<<<<<< checkMawb start >>>>>>>>>> mawb:"+gson.toJson(fedexMawb) +" result :" +result.getSuccess() +" iclear check response : " + json + " status : " + result.getSuccess()); |
| 147 | }catch (Exception e){ | 161 | }catch (Exception e){ |
| 148 | - log.error("checkMawb() error:" + e.getMessage()); | 162 | + log.error("checkMawb() error:",e); |
| 163 | + } | ||
| 164 | + return result; | ||
| 165 | + } | ||
| 166 | + | ||
| 167 | + | ||
| 168 | + /** | ||
| 169 | + * 校验BASF接口信息 | ||
| 170 | + * @param fedexc | ||
| 171 | + * @return | ||
| 172 | + */ | ||
| 173 | + public ResultRS checkBasfInterfaceData(Fedexc fedexc){ | ||
| 174 | + | ||
| 175 | + ResultRS result = new ResultRS(Boolean.FALSE,"",""); | ||
| 176 | + | ||
| 177 | + if(Objects.equals(fedexc,null)){ | ||
| 178 | + result.setCode("-7"); | ||
| 179 | + result.setMsg("请求信息不能为空"); | ||
| 180 | + }else{ | ||
| 181 | + List<String> msgList = new ArrayList<>(); | ||
| 182 | +// 参数consignmentCode不能为空 | ||
| 183 | + String consignmentCode = fedexc.getConsignmentCode(); | ||
| 184 | + if(StringUtils.isEmpty(consignmentCode)){ | ||
| 185 | + msgList.add("参数consignmentCode不能为空"); | ||
| 186 | + } | ||
| 187 | +// 参数consignmentId不能为空 | ||
| 188 | +// Long consignmentId = fedexc.getConsignmentId(); | ||
| 189 | +// if(Objects.isNull(consignmentId)){ | ||
| 190 | +// msgList.add("参数consignmentId不能为空"); | ||
| 191 | +// } | ||
| 192 | +// 参数consType不能为空 | ||
| 193 | + String consType = fedexc.getConsType(); | ||
| 194 | + if(StringUtils.isEmpty(consType)){ | ||
| 195 | + msgList.add("参数consType不能为空"); | ||
| 196 | + } | ||
| 197 | +// 参数sender不能为空 | ||
| 198 | + String sender = fedexc.getSender(); | ||
| 199 | + if(StringUtils.isEmpty(sender)){ | ||
| 200 | + msgList.add("参数sender不能为空"); | ||
| 201 | + } | ||
| 202 | +// 参数shipperSCC不能为空 | ||
| 203 | + String shipperSCC = fedexc.getShipperSCC(); | ||
| 204 | + if(StringUtils.isEmpty(shipperSCC)){ | ||
| 205 | + msgList.add("参数shipperSCC不能为空"); | ||
| 206 | + } | ||
| 207 | + if(msgList.size() > 0){ | ||
| 208 | + String join = msgList.stream().collect(Collectors.joining(";")); | ||
| 209 | + result.setCode("-7"); | ||
| 210 | + result.setMsg(join); | ||
| 211 | + } | ||
| 149 | } | 212 | } |
| 150 | return result; | 213 | return result; |
| 151 | } | 214 | } | ... | ... |
| ... | @@ -61,8 +61,7 @@ public class HsCodeService { | ... | @@ -61,8 +61,7 @@ public class HsCodeService { |
| 61 | resultHsCode.setMsg("操作成功"); | 61 | resultHsCode.setMsg("操作成功"); |
| 62 | resultHsCode.setHsCodeResultList(hsCodeList); | 62 | resultHsCode.setHsCodeResultList(hsCodeList); |
| 63 | }catch(Exception ex){ | 63 | }catch(Exception ex){ |
| 64 | - log.error(ex.getMessage()); | 64 | + log.error(ex.getMessage(),ex); |
| 65 | - ex.printStackTrace(); | ||
| 66 | resultHsCode.setSuccess(Boolean.FALSE); | 65 | resultHsCode.setSuccess(Boolean.FALSE); |
| 67 | resultHsCode.setCode("30101"); | 66 | resultHsCode.setCode("30101"); |
| 68 | resultHsCode.setMsg("数据查询异常"); | 67 | resultHsCode.setMsg("数据查询异常"); |
| ... | @@ -83,8 +82,8 @@ public class HsCodeService { | ... | @@ -83,8 +82,8 @@ public class HsCodeService { |
| 83 | resultHsCode.setMsg("操作成功"); | 82 | resultHsCode.setMsg("操作成功"); |
| 84 | resultHsCode.setHsCodeResultList(hsCodeList); | 83 | resultHsCode.setHsCodeResultList(hsCodeList); |
| 85 | }catch(Exception ex){ | 84 | }catch(Exception ex){ |
| 86 | - log.error(ex.getMessage()); | 85 | + log.error(ex.getMessage(),ex); |
| 87 | - ex.printStackTrace(); | 86 | + |
| 88 | resultHsCode.setSuccess(Boolean.FALSE); | 87 | resultHsCode.setSuccess(Boolean.FALSE); |
| 89 | resultHsCode.setCode("30101"); | 88 | resultHsCode.setCode("30101"); |
| 90 | resultHsCode.setMsg("数据查询异常"); | 89 | resultHsCode.setMsg("数据查询异常"); | ... | ... |
| ... | @@ -44,7 +44,7 @@ public class IClearApiHsCodeLogService { | ... | @@ -44,7 +44,7 @@ public class IClearApiHsCodeLogService { |
| 44 | rs = true; | 44 | rs = true; |
| 45 | } | 45 | } |
| 46 | }catch(Exception ex){ | 46 | }catch(Exception ex){ |
| 47 | - ex.printStackTrace(); | 47 | + log.error(ex.getMessage(),ex); |
| 48 | } | 48 | } |
| 49 | return rs; | 49 | return rs; |
| 50 | } | 50 | } | ... | ... |
| ... | @@ -5,10 +5,12 @@ import com.erry.iclear.dateInterface.api.request.MawbDetail; | ... | @@ -5,10 +5,12 @@ import com.erry.iclear.dateInterface.api.request.MawbDetail; |
| 5 | import com.erry.iclear.dateInterface.api.response.ResultRS; | 5 | import com.erry.iclear.dateInterface.api.response.ResultRS; |
| 6 | import com.erry.iclear.dateInterface.repository.MawbDetailRepository; | 6 | import com.erry.iclear.dateInterface.repository.MawbDetailRepository; |
| 7 | import lombok.extern.slf4j.Slf4j; | 7 | import lombok.extern.slf4j.Slf4j; |
| 8 | +import org.apache.commons.lang3.StringUtils; | ||
| 8 | import org.springframework.beans.factory.annotation.Autowired; | 9 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | import org.springframework.stereotype.Service; | 10 | import org.springframework.stereotype.Service; |
| 10 | 11 | ||
| 11 | import java.util.List; | 12 | import java.util.List; |
| 13 | +import java.util.Objects; | ||
| 12 | 14 | ||
| 13 | /** | 15 | /** |
| 14 | * @author Administrator | 16 | * @author Administrator |
| ... | @@ -29,11 +31,19 @@ public class MawbDetailService { | ... | @@ -29,11 +31,19 @@ public class MawbDetailService { |
| 29 | 31 | ||
| 30 | 32 | ||
| 31 | public ResultRS checkMawbDetail(Mawb mawb){ | 33 | public ResultRS checkMawbDetail(Mawb mawb){ |
| 32 | - ResultRS result = new ResultRS(Boolean.FALSE,null,null); | 34 | + ResultRS result = new ResultRS(Boolean.FALSE,"30002",null); |
| 33 | try{ | 35 | try{ |
| 36 | + for (MawbDetail detail : mawb.getMawbDetailList()) { | ||
| 37 | + String secondUnit = detail.getSecondUnit(); | ||
| 38 | + if (StringUtils.isNotEmpty(secondUnit)) { | ||
| 34 | 39 | ||
| 35 | - | 40 | + Integer secondQty = detail.getSecondQty(); |
| 36 | - | 41 | + if (Objects.isNull(secondQty)) { |
| 42 | + result.setMsg("参数secondQty不能为空"); | ||
| 43 | + return result; | ||
| 44 | + } | ||
| 45 | + } | ||
| 46 | + } | ||
| 37 | result.setSuccess(Boolean.TRUE); | 47 | result.setSuccess(Boolean.TRUE); |
| 38 | }catch (Exception e){ | 48 | }catch (Exception e){ |
| 39 | log.error("checkMawbDetail() error:"+e.getMessage()); | 49 | log.error("checkMawbDetail() error:"+e.getMessage()); | ... | ... |
| ... | @@ -103,7 +103,8 @@ public class IClearApiTask { | ... | @@ -103,7 +103,8 @@ public class IClearApiTask { |
| 103 | this.token = tokenResult.getData().getToken(); | 103 | this.token = tokenResult.getData().getToken(); |
| 104 | } | 104 | } |
| 105 | }catch(Exception ex){ | 105 | }catch(Exception ex){ |
| 106 | - ex.printStackTrace(); | 106 | + |
| 107 | + log.error(ex.getMessage(),ex); | ||
| 107 | } | 108 | } |
| 108 | } | 109 | } |
| 109 | if(this.token == null){ | 110 | if(this.token == null){ | ... | ... |
| ... | @@ -834,7 +834,7 @@ public class DateUtils { | ... | @@ -834,7 +834,7 @@ public class DateUtils { |
| 834 | Date date = df.parse(datetext); | 834 | Date date = df.parse(datetext); |
| 835 | return date; | 835 | return date; |
| 836 | } catch (Exception e) { | 836 | } catch (Exception e) { |
| 837 | - e.printStackTrace(); | 837 | + log.error(e.getMessage(),e); |
| 838 | return null; | 838 | return null; |
| 839 | } | 839 | } |
| 840 | } | 840 | } |
| ... | @@ -895,7 +895,6 @@ public class DateUtils { | ... | @@ -895,7 +895,6 @@ public class DateUtils { |
| 895 | cal.add(GregorianCalendar.YEAR, year); | 895 | cal.add(GregorianCalendar.YEAR, year); |
| 896 | return formatDate(cal.getTime(), "yyyy-MM-dd"); | 896 | return formatDate(cal.getTime(), "yyyy-MM-dd"); |
| 897 | } catch (Exception e) { | 897 | } catch (Exception e) { |
| 898 | - e.printStackTrace(); | ||
| 899 | return ""; | 898 | return ""; |
| 900 | } | 899 | } |
| 901 | } | 900 | } | ... | ... |
| 1 | spring: | 1 | spring: |
| 2 | datasource: | 2 | datasource: |
| 3 | - url: jdbc:sqlserver://40.73.78.157:1433;DatabaseName=IClearUat | 3 | + url: jdbc:sqlserver://40.73.78.157:1433;DatabaseName=IClearDev |
| 4 | username: sa | 4 | username: sa |
| 5 | password: Fedex_123 | 5 | password: Fedex_123 |
| 6 | driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver | 6 | driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver | ... | ... |
| 1 | spring: | 1 | spring: |
| 2 | datasource: | 2 | datasource: |
| 3 | - url: jdbc:sqlserver://40.73.78.157:1433;DatabaseName=IClearDev | 3 | + url: jdbc:sqlserver://40.73.78.157:1433;DatabaseName=IClearUat |
| 4 | username: sa | 4 | username: sa |
| 5 | password: Fedex_123 | 5 | password: Fedex_123 |
| 6 | driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver | 6 | driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver | ... | ... |
| ... | @@ -39,6 +39,10 @@ | ... | @@ -39,6 +39,10 @@ |
| 39 | <appender-ref ref="CONSOLE"/> | 39 | <appender-ref ref="CONSOLE"/> |
| 40 | <appender-ref ref="FILE"/> | 40 | <appender-ref ref="FILE"/> |
| 41 | </root> | 41 | </root> |
| 42 | + <root level="error"> | ||
| 43 | + <appender-ref ref="CONSOLE"/> | ||
| 44 | + <appender-ref ref="FILE"/> | ||
| 45 | + </root> | ||
| 42 | </springProfile> | 46 | </springProfile> |
| 43 | 47 | ||
| 44 | <springProfile name="prod"> | 48 | <springProfile name="prod"> |
| ... | @@ -46,6 +50,10 @@ | ... | @@ -46,6 +50,10 @@ |
| 46 | <appender-ref ref="CONSOLE"/> | 50 | <appender-ref ref="CONSOLE"/> |
| 47 | <appender-ref ref="FILE"/> | 51 | <appender-ref ref="FILE"/> |
| 48 | </root> | 52 | </root> |
| 53 | + <root level="error"> | ||
| 54 | + <appender-ref ref="CONSOLE"/> | ||
| 55 | + <appender-ref ref="FILE"/> | ||
| 56 | + </root> | ||
| 49 | </springProfile> | 57 | </springProfile> |
| 50 | 58 | ||
| 51 | 59 | ... | ... |
| ... | @@ -24,17 +24,17 @@ public class ApiTest { | ... | @@ -24,17 +24,17 @@ public class ApiTest { |
| 24 | //获取HSCODE接口地址 | 24 | //获取HSCODE接口地址 |
| 25 | public static String hscodeRequest = "hscode/hscodeRequest"; | 25 | public static String hscodeRequest = "hscode/hscodeRequest"; |
| 26 | 26 | ||
| 27 | - public static String timeStamp = "1649839249891"; | 27 | + public static String timeStamp = "1645153943"; |
| 28 | public static String appId = "IDE"; | 28 | public static String appId = "IDE"; |
| 29 | public static String appKey = "iClearExport"; | 29 | public static String appKey = "iClearExport"; |
| 30 | //需要申请 | 30 | //需要申请 |
| 31 | - public static String security = "b92131f03f19a348"; | 31 | + public static String security = "bb348f1ba6ab7cc1"; |
| 32 | 32 | ||
| 33 | public static void main(String[] args) throws Exception{ | 33 | public static void main(String[] args) throws Exception{ |
| 34 | //D类申报的数据落地接口 | 34 | //D类申报的数据落地接口 |
| 35 | -// ApiTest.sendMawb(); | 35 | + ApiTest.sendMawb(); |
| 36 | //C类申报的数据落地接口 | 36 | //C类申报的数据落地接口 |
| 37 | - ApiTest.sendMawbBasf(); | 37 | +// ApiTest.sendMawbBasf(); |
| 38 | //C类EDI数据接口 | 38 | //C类EDI数据接口 |
| 39 | // ApiTest.selectDecListBasf(); | 39 | // ApiTest.selectDecListBasf(); |
| 40 | //C类回执数据接口 | 40 | //C类回执数据接口 |
| ... | @@ -51,34 +51,34 @@ public class ApiTest { | ... | @@ -51,34 +51,34 @@ public class ApiTest { |
| 51 | 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\"}]}"; | 51 | 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\"}]}"; |
| 52 | 52 | ||
| 53 | System.out.println(new Date(Long.valueOf(timeStamp))); | 53 | System.out.println(new Date(Long.valueOf(timeStamp))); |
| 54 | - String token = SHA256Util.getSHA256String("IDE" + "iClearExport" + ApiTest.security + ApiTest.timeStamp); | 54 | + String token = SHA256Util.getSHA256String("DEMO1" + "iClearExportDemo1" + ApiTest.security + ApiTest.timeStamp); |
| 55 | System.out.println(token); | 55 | System.out.println(token); |
| 56 | 56 | ||
| 57 | - Header[] headers = HttpHeader.custom() | 57 | +// Header[] headers = HttpHeader.custom() |
| 58 | - .other("Content-Type", "application/json") | 58 | +// .other("Content-Type", "application/json") |
| 59 | - .other("Appid", ApiTest.appId) | 59 | +// .other("Appid", ApiTest.appId) |
| 60 | - .other("appKey", ApiTest.appKey) | 60 | +// .other("appKey", ApiTest.appKey) |
| 61 | - .other("TimeStamp", ApiTest.timeStamp) | 61 | +// .other("TimeStamp", ApiTest.timeStamp) |
| 62 | - .other("token", token) | 62 | +// .other("token", token) |
| 63 | - .build(); | 63 | +// .build(); |
| 64 | - | 64 | +// |
| 65 | - HCB hcb = HCB.custom() | 65 | +// HCB hcb = HCB.custom() |
| 66 | - .timeout(20000) | 66 | +// .timeout(20000) |
| 67 | - .pool(100, 10) | 67 | +// .pool(100, 10) |
| 68 | - .sslpv(SSLs.SSLProtocolVersion.TLSv1_2) | 68 | +// .sslpv(SSLs.SSLProtocolVersion.TLSv1_2) |
| 69 | - .ssl() | 69 | +// .ssl() |
| 70 | - .retry(3); | 70 | +// .retry(3); |
| 71 | - | 71 | +// |
| 72 | - //String url = "https://40.73.78.157:8780/customs/sendMawb"; | 72 | +// //String url = "https://40.73.78.157:8780/customs/sendMawb"; |
| 73 | - String url = ApiTest.url + ApiTest.sendMawb; | 73 | +// String url = ApiTest.url + ApiTest.sendMawb; |
| 74 | - HttpConfig config = HttpConfig.custom() | 74 | +// HttpConfig config = HttpConfig.custom() |
| 75 | - .headers(headers) | 75 | +// .headers(headers) |
| 76 | - .url(url) | 76 | +// .url(url) |
| 77 | - .encoding("utf-8") | 77 | +// .encoding("utf-8") |
| 78 | - .client(hcb.build()) | 78 | +// .client(hcb.build()) |
| 79 | -// .json(new Gson().toJson(createMawb())); | 79 | +//// .json(new Gson().toJson(createMawb())); |
| 80 | - .json(masbJson); | 80 | +// .json(masbJson); |
| 81 | - System.out.println(HttpClientUtil.post(config)); | 81 | +// System.out.println(HttpClientUtil.post(config)); |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | /** | 84 | /** | ... | ... |
| ... | @@ -35,8 +35,8 @@ public class SendMawbFedex { | ... | @@ -35,8 +35,8 @@ public class SendMawbFedex { |
| 35 | */ | 35 | */ |
| 36 | public static void sendMawbBasf() throws Exception{ | 36 | public static void sendMawbBasf() throws Exception{ |
| 37 | //申报数据:consignmentCode 运单号需要修改 | 37 | //申报数据:consignmentCode 运单号需要修改 |
| 38 | - String json ="{\"consignmentCode\":\"271002102051\",\"consignmentId\":164535620,\"consType\":\"C\",\"sender\":\"巴斯夫护理化学品(上海)有限公司\",\"shipperCustomsCode\":\"3119920047\",\"shipperSCC\":\"91310000607239894U\",\"operateUnitName\":\"巴斯夫护理化学品(上海)有限公司\",\"operateUnitCode\":\"3119920047\",\"operateSCC\":\"91310000607239894U\",\"consignmentList\":[{\"consignmentDetailId\":83010676,\"skuCode\":\"2917341090\",\"skuName\":\"邻苯二甲酸二丁酯\",\"model\":\"品名:邻苯二甲酸二丁酯 |品牌类型:0|出口享惠情况:0|成分含量:100% 邻苯二甲酸二丁酯|用途:化学分析用试剂,实验用途|GTIN:|CAS:|其他[非必报要素,请根据实际情况填报]:|\",\"knockdownNumber\":1,\"knockdownUnit\":\"035\",\"qtyLegalFirst\":1,\"unitLegalFirst\":\"035\",\"qtyLegalSecond\":\"1.0000\",\"unitLegalSecond\":\"\",\"declaredAmount\":10,\"currency\":\"USD\",\"declaredWeight\":1}]}"; | 38 | + String json ="{\"consignmentCode\":\"281833508306\",\"consignmentId\":14054615,\"consType\":\"C\",\"sender\":\"鲁泰纺织股份有限公司\",\"operateUnitName\":\"鲁泰纺织股份有限公司\",\"operateUnitCode\":\"3703930116\",\"operateSCC\":\"91370302613281175K\",\"shipperCustomsCode\":\"3703930116\",\"shipperSCC\":\"91370302613281175K\",\"EANNo\":\"0000000001\",\"consignmentList\":[{\"consignmentDetailId\":15815679,\"skuCode\":\"4205001090\",\"skuName\":\"其他动物皮革制的坐具套\",\"model\":\"品名:其他动物皮革制的坐具套|品牌类型:0|出口享惠情况:0|材质[皮革或再生皮革]:皮革|GTIN:|CAS:|其他[非必报要素,请根据实际情况填报]:|\",\"knockdownNumber\":1,\"knockdownUnit\":\"035\",\"qtyLegalFirst\":1,\"unitLegalFirst\":\"035\",\"declaredAmount\":1,\"currency\":\"USD\",\"declaredWeight\":1}]}"; |
| 39 | - | 39 | + System.out.println(json); |
| 40 | String token = SHA256Util.getSHA256String(SendMawbFedex.appId + SendMawbFedex.appKey + SendMawbFedex.security + SendMawbFedex.timeStamp); | 40 | String token = SHA256Util.getSHA256String(SendMawbFedex.appId + SendMawbFedex.appKey + SendMawbFedex.security + SendMawbFedex.timeStamp); |
| 41 | System.out.println(token); | 41 | System.out.println(token); |
| 42 | //消息头 | 42 | //消息头 | ... | ... |
-
Please register or login to post a comment