Merge branches 'API-2023-03-12' and 'master' of http://118.178.128.178//Fedex/iClear-api
Conflicts: doc/FedEx在线申报系统API - HSCode.docx src/main/java/com/erry/iclear/dateInterface/api/FedexDataInterface.java src/main/java/com/erry/iclear/dateInterface/interceptor/HsCodeInterceptor.java src/main/java/com/erry/iclear/dateInterface/interceptor/SignInterceptor.java src/main/java/com/erry/iclear/dateInterface/service/MawbDetailService.java
Showing
42 changed files
with
471 additions
and
311 deletions
No preview for this file type
doc/TariffCCC.xlsx
0 → 100644
No preview for this file type
sql/C类运单号校验/C类运单号校验.sql
0 → 100644
| 1 | +ALTER TABLE T_ICLEAR_API_APPINFO | ||
| 2 | +ADD C_CODE_CHECK VARCHAR(1) | ||
| 3 | + | ||
| 4 | +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'C类校验是否校验运单号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'T_ICLEAR_API_APPINFO', @level2type=N'COLUMN',@level2name=N'C_CODE_CHECK' | ||
| 5 | +GO | ||
| 6 | + | ||
| 7 | +/****** 创建hscode表索引 ******/ | ||
| 8 | +CREATE NONCLUSTERED INDEX [nci_wi_T_CC_HS_CODE_SKU_CODE_SKUNAME] ON T_CC_HS_CODE | ||
| 9 | +( | ||
| 10 | + SKU_CODE ASC, | ||
| 11 | + SKUNAME ASC | ||
| 12 | +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] | ||
| 13 | +GO | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -36,8 +36,4 @@ public class IClearApiApplication extends SpringBootServletInitializer { | ... | @@ -36,8 +36,4 @@ public class IClearApiApplication extends SpringBootServletInitializer { |
| 36 | protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { | 36 | protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { |
| 37 | return builder.sources(IClearApiApplication.class); | 37 | return builder.sources(IClearApiApplication.class); |
| 38 | } | 38 | } |
| 39 | - | ||
| 40 | - public String test(){ | ||
| 41 | - return "test"; | ||
| 42 | - } | ||
| 43 | } | 39 | } | ... | ... |
| 1 | -//package com.erry.iclear.dateInterface; | ||
| 2 | -// | ||
| 3 | -//import org.springframework.boot.builder.SpringApplicationBuilder; | ||
| 4 | -//import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; | ||
| 5 | -// | ||
| 6 | -///** | ||
| 7 | -// * @author Administrator | ||
| 8 | -// */ | ||
| 9 | -//public class SpringBootStartApplication extends SpringBootServletInitializer { | ||
| 10 | -// @Override | ||
| 11 | -// protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { | ||
| 12 | -// return builder.sources(IClearApiApplication.class); | ||
| 13 | -// } | ||
| 14 | -//} |
| 1 | package com.erry.iclear.dateInterface.api; | 1 | package com.erry.iclear.dateInterface.api; |
| 2 | 2 | ||
| 3 | +import com.erry.iclear.dateInterface.enums.ErrorCodeEnum; | ||
| 3 | import com.erry.iclear.dateInterface.api.response.ResultRS; | 4 | import com.erry.iclear.dateInterface.api.response.ResultRS; |
| 4 | import lombok.extern.slf4j.Slf4j; | 5 | import lombok.extern.slf4j.Slf4j; |
| 5 | import org.springframework.beans.factory.annotation.Autowired; | 6 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | @@ -37,8 +38,6 @@ public class CommonExceptionAdvice { | ... | @@ -37,8 +38,6 @@ public class CommonExceptionAdvice { |
| 37 | String itemMessage= messageSource.getMessage(x.getDefaultMessage(), null, x.getDefaultMessage(), LocaleContextHolder.getLocale()); | 38 | String itemMessage= messageSource.getMessage(x.getDefaultMessage(), null, x.getDefaultMessage(), LocaleContextHolder.getLocale()); |
| 38 | return String.format("%s", itemMessage); | 39 | return String.format("%s", itemMessage); |
| 39 | }).collect(Collectors.toList()); | 40 | }).collect(Collectors.toList()); |
| 40 | - | 41 | + return new ResultRS(Boolean.FALSE, ErrorCodeEnum.ERROR_30002.getCode(),errorMessages.toString()); |
| 41 | - | ||
| 42 | - return new ResultRS(Boolean.FALSE,"30002",errorMessages.toString()); | ||
| 43 | } | 42 | } |
| 44 | } | 43 | } | ... | ... |
| 1 | package com.erry.iclear.dateInterface.api; | 1 | package com.erry.iclear.dateInterface.api; |
| 2 | 2 | ||
| 3 | +import com.erry.iclear.dateInterface.enums.ErrorCodeEnum; | ||
| 3 | import com.erry.iclear.dateInterface.api.request.Mawb; | 4 | import com.erry.iclear.dateInterface.api.request.Mawb; |
| 4 | import com.erry.iclear.dateInterface.api.response.ResultRS; | 5 | import com.erry.iclear.dateInterface.api.response.ResultRS; |
| 5 | import com.erry.iclear.dateInterface.entity.IClearApiLog; | 6 | import com.erry.iclear.dateInterface.entity.IClearApiLog; |
| ... | @@ -52,19 +53,18 @@ public class CustomsDataInterface { | ... | @@ -52,19 +53,18 @@ public class CustomsDataInterface { |
| 52 | ResultRS result = new ResultRS(Boolean.FALSE,"",""); | 53 | ResultRS result = new ResultRS(Boolean.FALSE,"",""); |
| 53 | 54 | ||
| 54 | if(Objects.equals(mawb,null)){ | 55 | if(Objects.equals(mawb,null)){ |
| 55 | - result.setCode("-7"); | 56 | + result.setCode(ErrorCodeEnum.ERROR_7.getCode()); |
| 56 | - result.setMsg("请求信息不能为空"); | 57 | + result.setMsg(ErrorCodeEnum.ERROR_7.getName()); |
| 57 | return result; | 58 | return result; |
| 58 | } | 59 | } |
| 59 | 60 | ||
| 60 | String checkrs = mawbService.checkMawbBaseInfo(mawb); | 61 | String checkrs = mawbService.checkMawbBaseInfo(mawb); |
| 61 | if(StringUtil.isNotEmpty(checkrs)){ | 62 | if(StringUtil.isNotEmpty(checkrs)){ |
| 62 | - result.setCode("-7"); | 63 | + result.setCode(ErrorCodeEnum.ERROR_7.getCode()); |
| 63 | result.setMsg(checkrs); | 64 | result.setMsg(checkrs); |
| 64 | return result; | 65 | return result; |
| 65 | } | 66 | } |
| 66 | 67 | ||
| 67 | - | ||
| 68 | //1、保存请求信息,保存到iClear的 SQLServer | 68 | //1、保存请求信息,保存到iClear的 SQLServer |
| 69 | 69 | ||
| 70 | StopWatch sw = new StopWatch("receice mawb"); | 70 | StopWatch sw = new StopWatch("receice mawb"); |
| ... | @@ -75,9 +75,6 @@ public class CustomsDataInterface { | ... | @@ -75,9 +75,6 @@ public class CustomsDataInterface { |
| 75 | String timeStamp=(String) request.getHeader("TimeStamp"); | 75 | String timeStamp=(String) request.getHeader("TimeStamp"); |
| 76 | IClearApiLog saveIClearApiLogResult = iClearApiLogService.saveIClearApiLog(iClearApiLogService.convertToIClearApiLog(mawb,appId,appKey,new Date(Long.valueOf(timeStamp)))); | 76 | IClearApiLog saveIClearApiLogResult = iClearApiLogService.saveIClearApiLog(iClearApiLogService.convertToIClearApiLog(mawb,appId,appKey,new Date(Long.valueOf(timeStamp)))); |
| 77 | 77 | ||
| 78 | - | ||
| 79 | - | ||
| 80 | - | ||
| 81 | mawb.setAppId(appId); | 78 | mawb.setAppId(appId); |
| 82 | if(!Objects.equals(saveIClearApiLogResult,null)){ | 79 | if(!Objects.equals(saveIClearApiLogResult,null)){ |
| 83 | log.info("请求保存成功,msgId:"+saveIClearApiLogResult.getMsgId()); | 80 | log.info("请求保存成功,msgId:"+saveIClearApiLogResult.getMsgId()); |
| ... | @@ -102,7 +99,7 @@ public class CustomsDataInterface { | ... | @@ -102,7 +99,7 @@ public class CustomsDataInterface { |
| 102 | } | 99 | } |
| 103 | } | 100 | } |
| 104 | sw.stop(); | 101 | sw.stop(); |
| 105 | - result.setCode("30001"); | 102 | + result.setCode(ErrorCodeEnum.ERROR_30001.getCode()); |
| 106 | result.setMsg(msg); | 103 | result.setMsg(msg); |
| 107 | return result; | 104 | return result; |
| 108 | } | 105 | } |
| ... | @@ -128,7 +125,6 @@ public class CustomsDataInterface { | ... | @@ -128,7 +125,6 @@ public class CustomsDataInterface { |
| 128 | } | 125 | } |
| 129 | sw.stop(); | 126 | sw.stop(); |
| 130 | 127 | ||
| 131 | - | ||
| 132 | //4、保存运单到iclear中 | 128 | //4、保存运单到iclear中 |
| 133 | sw.start("processChmConsignment"); | 129 | sw.start("processChmConsignment"); |
| 134 | result = chmConsignmentService.processChmConsignment(mawb, timeStamp,appId); | 130 | result = chmConsignmentService.processChmConsignment(mawb, timeStamp,appId); |
| ... | @@ -137,7 +133,6 @@ public class CustomsDataInterface { | ... | @@ -137,7 +133,6 @@ public class CustomsDataInterface { |
| 137 | } | 133 | } |
| 138 | sw.stop(); | 134 | sw.stop(); |
| 139 | 135 | ||
| 140 | - | ||
| 141 | //5、更新日志 | 136 | //5、更新日志 |
| 142 | sw.start("updateIClearApiLog"); | 137 | sw.start("updateIClearApiLog"); |
| 143 | if(!Objects.equals(saveIClearApiLogResult,null)){ | 138 | if(!Objects.equals(saveIClearApiLogResult,null)){ |
| ... | @@ -154,7 +149,7 @@ public class CustomsDataInterface { | ... | @@ -154,7 +149,7 @@ public class CustomsDataInterface { |
| 154 | 149 | ||
| 155 | //6、return result | 150 | //6、return result |
| 156 | result.setSuccess(Boolean.TRUE); | 151 | result.setSuccess(Boolean.TRUE); |
| 157 | - result.setCode("0"); | 152 | + result.setCode(ErrorCodeEnum.SUCCESS.getCode()); |
| 158 | result.setMsg("操作成功"); | 153 | result.setMsg("操作成功"); |
| 159 | return result; | 154 | return result; |
| 160 | } | 155 | } | ... | ... |
| 1 | package com.erry.iclear.dateInterface.api; | 1 | package com.erry.iclear.dateInterface.api; |
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | -import com.arronlong.httpclientutil.HttpClientUtil; | ||
| 5 | -import com.arronlong.httpclientutil.common.HttpConfig; | ||
| 6 | -import com.arronlong.httpclientutil.common.HttpHeader; | ||
| 7 | import com.arronlong.httpclientutil.exception.HttpProcessException; | 4 | import com.arronlong.httpclientutil.exception.HttpProcessException; |
| 5 | +import com.erry.iclear.dateInterface.enums.ErrorCodeEnum; | ||
| 8 | import com.erry.iclear.dateInterface.api.request.*; | 6 | import com.erry.iclear.dateInterface.api.request.*; |
| 9 | import com.erry.iclear.dateInterface.api.response.FedexResultChmRS; | 7 | import com.erry.iclear.dateInterface.api.response.FedexResultChmRS; |
| 10 | import com.erry.iclear.dateInterface.api.response.FedexResultRS; | 8 | import com.erry.iclear.dateInterface.api.response.FedexResultRS; |
| 11 | import com.erry.iclear.dateInterface.api.response.ResultRS; | 9 | import com.erry.iclear.dateInterface.api.response.ResultRS; |
| 12 | -import com.erry.iclear.dateInterface.entity.ChmConsignment; | 10 | +import com.erry.iclear.dateInterface.common.Constant; |
| 13 | -import com.erry.iclear.dateInterface.entity.DeclaredInfo; | 11 | +import com.erry.iclear.dateInterface.entity.*; |
| 14 | -import com.erry.iclear.dateInterface.entity.IClearApiLog; | ||
| 15 | -import com.erry.iclear.dateInterface.entity.TIClearApiCheckLog; | ||
| 16 | import com.erry.iclear.dateInterface.repository.ChmConsignmentRepository; | 12 | import com.erry.iclear.dateInterface.repository.ChmConsignmentRepository; |
| 17 | import com.erry.iclear.dateInterface.repository.IClearApiCheckLogRepository; | 13 | import com.erry.iclear.dateInterface.repository.IClearApiCheckLogRepository; |
| 18 | import com.erry.iclear.dateInterface.service.*; | 14 | import com.erry.iclear.dateInterface.service.*; |
| ... | @@ -22,11 +18,9 @@ import com.erry.iclear.dateInterface.util.StringUtil; | ... | @@ -22,11 +18,9 @@ import com.erry.iclear.dateInterface.util.StringUtil; |
| 22 | import com.google.gson.Gson; | 18 | import com.google.gson.Gson; |
| 23 | import io.swagger.annotations.ApiOperation; | 19 | import io.swagger.annotations.ApiOperation; |
| 24 | import lombok.extern.slf4j.Slf4j; | 20 | import lombok.extern.slf4j.Slf4j; |
| 25 | -import org.apache.http.Header; | ||
| 26 | import org.springframework.beans.factory.annotation.Autowired; | 21 | import org.springframework.beans.factory.annotation.Autowired; |
| 27 | import org.springframework.beans.factory.annotation.Value; | 22 | import org.springframework.beans.factory.annotation.Value; |
| 28 | import org.springframework.util.StopWatch; | 23 | import org.springframework.util.StopWatch; |
| 29 | -import org.springframework.validation.annotation.Validated; | ||
| 30 | import org.springframework.web.bind.annotation.*; | 24 | import org.springframework.web.bind.annotation.*; |
| 31 | 25 | ||
| 32 | import javax.servlet.http.HttpServletRequest; | 26 | import javax.servlet.http.HttpServletRequest; |
| ... | @@ -65,7 +59,6 @@ public class FedexDataInterface { | ... | @@ -65,7 +59,6 @@ public class FedexDataInterface { |
| 65 | @Value("${api.address.iclear-submit-url}") | 59 | @Value("${api.address.iclear-submit-url}") |
| 66 | String iclearCSubmitUrl; | 60 | String iclearCSubmitUrl; |
| 67 | 61 | ||
| 68 | - | ||
| 69 | @ApiOperation(value = "C类运单数据校验接口", httpMethod = "POST", notes = "ex: http://192.168.1.75:8080/fedex/checkBASFMawbFedex") | 62 | @ApiOperation(value = "C类运单数据校验接口", httpMethod = "POST", notes = "ex: http://192.168.1.75:8080/fedex/checkBASFMawbFedex") |
| 70 | @PostMapping("/checkMawbFedexC") | 63 | @PostMapping("/checkMawbFedexC") |
| 71 | @ResponseBody | 64 | @ResponseBody |
| ... | @@ -77,6 +70,8 @@ public class FedexDataInterface { | ... | @@ -77,6 +70,8 @@ public class FedexDataInterface { |
| 77 | String token=(String) request.getHeader("Token"); | 70 | String token=(String) request.getHeader("Token"); |
| 78 | String addr = request.getRemoteAddr(); | 71 | String addr = request.getRemoteAddr(); |
| 79 | 72 | ||
| 73 | + //获取APPINFO信息 | ||
| 74 | + AppInfo appInfo = Constant.appInfoCache.get(appId + appKey); | ||
| 80 | 75 | ||
| 81 | TIClearApiCheckLog tIclearApiCheckLog = new TIClearApiCheckLog(); | 76 | TIClearApiCheckLog tIclearApiCheckLog = new TIClearApiCheckLog(); |
| 82 | tIclearApiCheckLog.setRequestAppid(appId); | 77 | tIclearApiCheckLog.setRequestAppid(appId); |
| ... | @@ -96,7 +91,7 @@ public class FedexDataInterface { | ... | @@ -96,7 +91,7 @@ public class FedexDataInterface { |
| 96 | log.info("checkBASFMawbFedex:"+fedexc.toString()); | 91 | log.info("checkBASFMawbFedex:"+fedexc.toString()); |
| 97 | log.info("appId:{},appKey:{},timeStamp:{},token:{}",appId,appKey,timeStamp,token); | 92 | log.info("appId:{},appKey:{},timeStamp:{},token:{}",appId,appKey,timeStamp,token); |
| 98 | 93 | ||
| 99 | - ResultRS result = fedexService.checkBasfInterfaceData(fedexc); | 94 | + ResultRS result = fedexService.checkBasfInterfaceData(fedexc,appInfo); |
| 100 | 95 | ||
| 101 | StopWatch sw = new StopWatch("checkBASFMawbFedex"); | 96 | StopWatch sw = new StopWatch("checkBASFMawbFedex"); |
| 102 | sw.start("generate FedexMawb"); | 97 | sw.start("generate FedexMawb"); |
| ... | @@ -106,18 +101,24 @@ public class FedexDataInterface { | ... | @@ -106,18 +101,24 @@ public class FedexDataInterface { |
| 106 | 101 | ||
| 107 | sw.start("checkFedexMawb"); | 102 | sw.start("checkFedexMawb"); |
| 108 | String msg = result.getMsg(); | 103 | String msg = result.getMsg(); |
| 109 | - String iclearCheckMsg = fedexService.checkFedexMawb(saveMawbFedexResult).getMsg(); | 104 | + String iclearCheckMsg = fedexService.checkFedexMawb(saveMawbFedexResult,appInfo).getMsg(); |
| 110 | - if(StringUtil.isEmpty(msg) && StringUtil.isEmpty(iclearCheckMsg)){ | 105 | + if(result.getSuccess() && StringUtil.isEmpty(iclearCheckMsg)){ |
| 111 | result.setSuccess(Boolean.TRUE); | 106 | result.setSuccess(Boolean.TRUE); |
| 112 | }else{ | 107 | }else{ |
| 113 | - result.setMsg(msg+";"+iclearCheckMsg); | 108 | + if(result.getSuccess()){ |
| 109 | + //基本非空信息验证通过,并且iclear验证失败 | ||
| 110 | + result.setMsg(iclearCheckMsg); | ||
| 111 | + }else{ | ||
| 112 | + //基本非空信息验证失败,并且iclear验证失败 | ||
| 113 | + result.setMsg(msg+";"+iclearCheckMsg); | ||
| 114 | + } | ||
| 114 | } | 115 | } |
| 115 | sw.stop(); | 116 | sw.stop(); |
| 116 | 117 | ||
| 117 | log.info(sw.prettyPrint()); | 118 | log.info(sw.prettyPrint()); |
| 118 | if(result.getSuccess()){ | 119 | if(result.getSuccess()){ |
| 119 | result.setSuccess(Boolean.TRUE); | 120 | result.setSuccess(Boolean.TRUE); |
| 120 | - result.setCode("0"); | 121 | + result.setCode(ErrorCodeEnum.SUCCESS.getCode()); |
| 121 | } | 122 | } |
| 122 | tiClearApiCheckLogSave.setResponseText(result.getMsg()); | 123 | tiClearApiCheckLogSave.setResponseText(result.getMsg()); |
| 123 | tiClearApiCheckLogSave.setCode(result.getCode()); | 124 | tiClearApiCheckLogSave.setCode(result.getCode()); |
| ... | @@ -128,9 +129,7 @@ public class FedexDataInterface { | ... | @@ -128,9 +129,7 @@ public class FedexDataInterface { |
| 128 | return result; | 129 | return result; |
| 129 | } | 130 | } |
| 130 | 131 | ||
| 131 | - | 132 | + @ApiOperation(value = "Fedex推送运单数据", httpMethod = "POST", notes = "ex: http://192.168.1.75:8080/fedex/sendMawbFedex") |
| 132 | - | ||
| 133 | - @ApiOperation(value = "C类Fedex推送运单数据", httpMethod = "POST", notes = "ex: http://192.168.1.75:8080/fedex/sendMawbFedex") | ||
| 134 | @PostMapping("/sendMawbFedex") | 133 | @PostMapping("/sendMawbFedex") |
| 135 | @ResponseBody | 134 | @ResponseBody |
| 136 | public ResultRS sendMawbFedex(HttpServletRequest request | 135 | public ResultRS sendMawbFedex(HttpServletRequest request |
| ... | @@ -139,12 +138,11 @@ public class FedexDataInterface { | ... | @@ -139,12 +138,11 @@ public class FedexDataInterface { |
| 139 | ResultRS result = new ResultRS(Boolean.FALSE,"",""); | 138 | ResultRS result = new ResultRS(Boolean.FALSE,"",""); |
| 140 | 139 | ||
| 141 | if(Objects.equals(fedexc,null)){ | 140 | if(Objects.equals(fedexc,null)){ |
| 142 | - result.setCode("-7"); | 141 | + result.setCode(ErrorCodeEnum.ERROR_7.getCode()); |
| 143 | - result.setMsg("请求信息不能为空"); | 142 | + result.setMsg(ErrorCodeEnum.ERROR_7.getName()); |
| 144 | return result; | 143 | return result; |
| 145 | } | 144 | } |
| 146 | //1、保存请求信息,保存到iClear的 SQLServer | 145 | //1、保存请求信息,保存到iClear的 SQLServer |
| 147 | - | ||
| 148 | StopWatch sw = new StopWatch("receice mawbFedex"); | 146 | StopWatch sw = new StopWatch("receice mawbFedex"); |
| 149 | sw.start("save log"); | 147 | sw.start("save log"); |
| 150 | 148 | ||
| ... | @@ -175,7 +173,7 @@ public class FedexDataInterface { | ... | @@ -175,7 +173,7 @@ public class FedexDataInterface { |
| 175 | 173 | ||
| 176 | //2、TODO 校验主单 | 174 | //2、TODO 校验主单 |
| 177 | sw.start("checkFedexMawb"); | 175 | sw.start("checkFedexMawb"); |
| 178 | - result=fedexService.checkFedexMawb(saveMawbFedexResult); | 176 | + result=fedexService.checkFedexMawb(saveMawbFedexResult,null); |
| 179 | if(!result.getSuccess()){ | 177 | if(!result.getSuccess()){ |
| 180 | return result; | 178 | return result; |
| 181 | } | 179 | } |
| ... | @@ -189,7 +187,6 @@ public class FedexDataInterface { | ... | @@ -189,7 +187,6 @@ public class FedexDataInterface { |
| 189 | // } | 187 | // } |
| 190 | // sw.stop(); | 188 | // sw.stop(); |
| 191 | 189 | ||
| 192 | - | ||
| 193 | //4、保存运单到iclear中 | 190 | //4、保存运单到iclear中 |
| 194 | sw.start("processChmConsignment"); | 191 | sw.start("processChmConsignment"); |
| 195 | result = chmConsignmentService.processChmConsignmentFedex(saveMawbFedexResult, timeStamp,appId); | 192 | result = chmConsignmentService.processChmConsignmentFedex(saveMawbFedexResult, timeStamp,appId); |
| ... | @@ -216,10 +213,8 @@ public class FedexDataInterface { | ... | @@ -216,10 +213,8 @@ public class FedexDataInterface { |
| 216 | headerMap.put("Content-Type", "application/json"); | 213 | headerMap.put("Content-Type", "application/json"); |
| 217 | String json = HttpUtils.doPost(this.iclearCSubmitUrl,objJson,headerMap); | 214 | String json = HttpUtils.doPost(this.iclearCSubmitUrl,objJson,headerMap); |
| 218 | 215 | ||
| 219 | - | ||
| 220 | log.info("<<<<<<<< checkfedexMawb start >>>>>>>>>> result :" +result.getSuccess() +" iclear check response : " + json + " status : " + result.getSuccess()); | 216 | log.info("<<<<<<<< checkfedexMawb start >>>>>>>>>> result :" +result.getSuccess() +" iclear check response : " + json + " status : " + result.getSuccess()); |
| 221 | 217 | ||
| 222 | - | ||
| 223 | //5、更新日志 | 218 | //5、更新日志 |
| 224 | sw.start("updateIClearApiLog"); | 219 | sw.start("updateIClearApiLog"); |
| 225 | if(!Objects.equals(saveIClearApiLogResult,null)){ | 220 | if(!Objects.equals(saveIClearApiLogResult,null)){ |
| ... | @@ -236,7 +231,7 @@ public class FedexDataInterface { | ... | @@ -236,7 +231,7 @@ public class FedexDataInterface { |
| 236 | 231 | ||
| 237 | //6、return result | 232 | //6、return result |
| 238 | result.setSuccess(Boolean.TRUE); | 233 | result.setSuccess(Boolean.TRUE); |
| 239 | - result.setCode("0"); | 234 | + result.setCode(ErrorCodeEnum.SUCCESS.getCode()); |
| 240 | return result; | 235 | return result; |
| 241 | } | 236 | } |
| 242 | 237 | ||
| ... | @@ -250,13 +245,13 @@ public class FedexDataInterface { | ... | @@ -250,13 +245,13 @@ public class FedexDataInterface { |
| 250 | //获取请求的运单号 | 245 | //获取请求的运单号 |
| 251 | String[] splitConsignment = StringUtil.split(consignmentCode.getConsignmentCode(),","); | 246 | String[] splitConsignment = StringUtil.split(consignmentCode.getConsignmentCode(),","); |
| 252 | if(splitConsignment.length > 20){ | 247 | if(splitConsignment.length > 20){ |
| 253 | - result.setCode("30001"); | 248 | + result.setCode(ErrorCodeEnum.ERROR_30001.getCode()); |
| 254 | result.setMsg("请求信息不能大于20条运单"); | 249 | result.setMsg("请求信息不能大于20条运单"); |
| 255 | return result; | 250 | return result; |
| 256 | } | 251 | } |
| 257 | if(splitConsignment.length<1){ | 252 | if(splitConsignment.length<1){ |
| 258 | - result.setCode("-7"); | 253 | + result.setCode(ErrorCodeEnum.ERROR_7.getCode()); |
| 259 | - result.setMsg("请求信息不能为空"); | 254 | + result.setMsg(ErrorCodeEnum.ERROR_7.getName()); |
| 260 | return result; | 255 | return result; |
| 261 | } | 256 | } |
| 262 | StopWatch sw = new StopWatch("receice mawbFedex"); | 257 | StopWatch sw = new StopWatch("receice mawbFedex"); |
| ... | @@ -295,7 +290,7 @@ public class FedexDataInterface { | ... | @@ -295,7 +290,7 @@ public class FedexDataInterface { |
| 295 | log.info("Fedex申报数据请求成功!"); | 290 | log.info("Fedex申报数据请求成功!"); |
| 296 | //6、return result | 291 | //6、return result |
| 297 | result.setSuccess(Boolean.TRUE); | 292 | result.setSuccess(Boolean.TRUE); |
| 298 | - result.setCode("0"); | 293 | + result.setCode(ErrorCodeEnum.SUCCESS.getCode()); |
| 299 | return result; | 294 | return result; |
| 300 | } | 295 | } |
| 301 | 296 | ||
| ... | @@ -309,13 +304,13 @@ public class FedexDataInterface { | ... | @@ -309,13 +304,13 @@ public class FedexDataInterface { |
| 309 | //获取请求的运单号 | 304 | //获取请求的运单号 |
| 310 | String[] splitConsignment = StringUtil.split(consignmentCode.getConsignmentCode(),","); | 305 | String[] splitConsignment = StringUtil.split(consignmentCode.getConsignmentCode(),","); |
| 311 | if(splitConsignment.length > 20){ | 306 | if(splitConsignment.length > 20){ |
| 312 | - result.setCode("30001"); | 307 | + result.setCode(ErrorCodeEnum.ERROR_30001.getCode()); |
| 313 | result.setMsg("请求信息不能大于20条运单"); | 308 | result.setMsg("请求信息不能大于20条运单"); |
| 314 | return result; | 309 | return result; |
| 315 | } | 310 | } |
| 316 | if(splitConsignment.length<1){ | 311 | if(splitConsignment.length<1){ |
| 317 | - result.setCode("-7"); | 312 | + result.setCode(ErrorCodeEnum.ERROR_7.getCode()); |
| 318 | - result.setMsg("请求信息不能为空"); | 313 | + result.setMsg(ErrorCodeEnum.ERROR_7.getName()); |
| 319 | return result; | 314 | return result; |
| 320 | } | 315 | } |
| 321 | StopWatch sw = new StopWatch("receice mawbFedex"); | 316 | StopWatch sw = new StopWatch("receice mawbFedex"); |
| ... | @@ -354,8 +349,7 @@ public class FedexDataInterface { | ... | @@ -354,8 +349,7 @@ public class FedexDataInterface { |
| 354 | log.info("Fedex回执数据请求成功!"); | 349 | log.info("Fedex回执数据请求成功!"); |
| 355 | //6、return result | 350 | //6、return result |
| 356 | result.setSuccess(Boolean.TRUE); | 351 | result.setSuccess(Boolean.TRUE); |
| 357 | - result.setCode("0"); | 352 | + result.setCode(ErrorCodeEnum.SUCCESS.getCode()); |
| 358 | return result; | 353 | return result; |
| 359 | } | 354 | } |
| 360 | - | 355 | +} |
| 361 | -} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| 1 | package com.erry.iclear.dateInterface.api; | 1 | package com.erry.iclear.dateInterface.api; |
| 2 | 2 | ||
| 3 | +import com.erry.iclear.dateInterface.enums.ErrorCodeEnum; | ||
| 3 | import com.erry.iclear.dateInterface.api.request.HsCodeParam; | 4 | import com.erry.iclear.dateInterface.api.request.HsCodeParam; |
| 4 | import com.erry.iclear.dateInterface.api.response.ResultHsCode; | 5 | import com.erry.iclear.dateInterface.api.response.ResultHsCode; |
| 5 | import com.erry.iclear.dateInterface.entity.IClearApiHsCodeLog; | 6 | import com.erry.iclear.dateInterface.entity.IClearApiHsCodeLog; |
| ... | @@ -28,7 +29,7 @@ public class HsCodeInterface { | ... | @@ -28,7 +29,7 @@ public class HsCodeInterface { |
| 28 | @Autowired | 29 | @Autowired |
| 29 | IClearApiHsCodeLogService iClearApiHsCodeLogService; | 30 | IClearApiHsCodeLogService iClearApiHsCodeLogService; |
| 30 | 31 | ||
| 31 | - @ApiOperation(value = "获取hscode数据", httpMethod = "POST", notes = "ex: http://192.168.1.71:8080/hscode/hscodeRequest") | 32 | + @ApiOperation(value = "获取最新HS Code信息接口", httpMethod = "POST", notes = "ex: http://192.168.1.71:8080/hscode/hscodeRequest") |
| 32 | @PostMapping("/hscodeRequest") | 33 | @PostMapping("/hscodeRequest") |
| 33 | @ResponseBody | 34 | @ResponseBody |
| 34 | public ResultHsCode hscodeRequest(HttpServletRequest request | 35 | public ResultHsCode hscodeRequest(HttpServletRequest request |
| ... | @@ -48,11 +49,10 @@ public class HsCodeInterface { | ... | @@ -48,11 +49,10 @@ public class HsCodeInterface { |
| 48 | resultHsCode = hsCodeService.findHsCodeListByCode(hscode.getHscode()); | 49 | resultHsCode = hsCodeService.findHsCodeListByCode(hscode.getHscode()); |
| 49 | return resultHsCode; | 50 | return resultHsCode; |
| 50 | } else { | 51 | } else { |
| 51 | - | ||
| 52 | //如果没有传hscode需要限制10分钟只能查询一次 | 52 | //如果没有传hscode需要限制10分钟只能查询一次 |
| 53 | - boolean rs = iClearApiHsCodeLogService.findIClearApiHsCodeLog(); | 53 | + boolean rs = iClearApiHsCodeLogService.findIClearApiHsCodeLog(appId); |
| 54 | if(rs == true){ | 54 | if(rs == true){ |
| 55 | - resultHsCode = new ResultHsCode(Boolean.FALSE,"10019","未指定hscode编码,10分钟之内只允许查询一次",null); | 55 | + resultHsCode = new ResultHsCode(Boolean.FALSE, ErrorCodeEnum.ERROR_10019.getCode(),ErrorCodeEnum.ERROR_10019.getName(),null); |
| 56 | }else{ | 56 | }else{ |
| 57 | resultHsCode = hsCodeService.findAllHsCodeList(); | 57 | resultHsCode = hsCodeService.findAllHsCodeList(); |
| 58 | } | 58 | } |
| ... | @@ -60,7 +60,7 @@ public class HsCodeInterface { | ... | @@ -60,7 +60,7 @@ public class HsCodeInterface { |
| 60 | } | 60 | } |
| 61 | }catch(Exception ex){ | 61 | }catch(Exception ex){ |
| 62 | log.error(ex.getMessage(),ex); | 62 | log.error(ex.getMessage(),ex); |
| 63 | - resultHsCode = new ResultHsCode(Boolean.FALSE,"30101","数据查询异常",null); | 63 | + resultHsCode = new ResultHsCode(Boolean.FALSE,ErrorCodeEnum.ERROR_30101.getCode(),ErrorCodeEnum.ERROR_30101.getName(),null); |
| 64 | return resultHsCode; | 64 | return resultHsCode; |
| 65 | }finally { | 65 | }finally { |
| 66 | iclearApiHsCodeLog.setReceiveResult(resultHsCode.getMsg()); | 66 | iclearApiHsCodeLog.setReceiveResult(resultHsCode.getMsg()); |
| ... | @@ -69,10 +69,51 @@ public class HsCodeInterface { | ... | @@ -69,10 +69,51 @@ public class HsCodeInterface { |
| 69 | long end = System.currentTimeMillis(); | 69 | long end = System.currentTimeMillis(); |
| 70 | iclearApiHsCodeLog.setSpendTime(end-begin); | 70 | iclearApiHsCodeLog.setSpendTime(end-begin); |
| 71 | //如果异常为hscode长度超过2000,将截取0到2000字符 | 71 | //如果异常为hscode长度超过2000,将截取0到2000字符 |
| 72 | - if(resultHsCode.getCode().equals("30102")){ | 72 | + if(resultHsCode.getCode().equals(ErrorCodeEnum.ERROR_30102.getCode())){ |
| 73 | - iclearApiHsCodeLog.setCode(iclearApiHsCodeLog.getCode().substring(0,2000)); | 73 | + iclearApiHsCodeLog.setCode(hscode.getHscode().substring(0,2000)); |
| 74 | } | 74 | } |
| 75 | iClearApiHsCodeLogService.saveIClearApiHsCodeLog(iclearApiHsCodeLog); | 75 | iClearApiHsCodeLogService.saveIClearApiHsCodeLog(iclearApiHsCodeLog); |
| 76 | } | 76 | } |
| 77 | } | 77 | } |
| 78 | + | ||
| 79 | + @ApiOperation(value = "HSCODE通用模糊查询接口", httpMethod = "POST", notes = "ex: http://192.168.1.71:8080/hscode/fuzzyQuery") | ||
| 80 | + @PostMapping("/fuzzyQuery") | ||
| 81 | + @ResponseBody | ||
| 82 | + public ResultHsCode fuzzyQueryHsCode(HttpServletRequest request | ||
| 83 | + , @RequestBody HsCodeParam hscode) { | ||
| 84 | + log.info("接收到请求数据skuCode:【"+hscode.getSkuCode()+"】,skuName:【"+hscode.getSkuName()+"】"); | ||
| 85 | + String appId = (String) request.getHeader("Appid"); | ||
| 86 | + String appkey = (String) request.getHeader("Appkey"); | ||
| 87 | + IClearApiHsCodeLog iclearApiHsCodeLog = new IClearApiHsCodeLog(); | ||
| 88 | + ResultHsCode resultHsCode = null; | ||
| 89 | + long begin = System.currentTimeMillis(); | ||
| 90 | + try { | ||
| 91 | + iclearApiHsCodeLog.setAppId(appId); | ||
| 92 | + iclearApiHsCodeLog.setAppKey(appkey); | ||
| 93 | + iclearApiHsCodeLog.setCreateTime(new Date()); | ||
| 94 | + resultHsCode = hsCodeService.fuzzyQueryHsCode(hscode); | ||
| 95 | + iclearApiHsCodeLog.setReceiveResult(resultHsCode.getMsg()); | ||
| 96 | + iclearApiHsCodeLog.setErrorCode(resultHsCode.getCode()); | ||
| 97 | + iclearApiHsCodeLog.setResponseTime(new Date()); | ||
| 98 | + long end = System.currentTimeMillis(); | ||
| 99 | + iclearApiHsCodeLog.setSpendTime(end-begin); | ||
| 100 | + String skuCode = hscode.getSkuCode(); | ||
| 101 | + if(!StringUtil.isEmpty(skuCode) && skuCode.length() > 50){ | ||
| 102 | + skuCode = skuCode.substring(0,50); | ||
| 103 | + } | ||
| 104 | + String skuName = hscode.getSkuName(); | ||
| 105 | + if(!StringUtil.isEmpty(skuName) && skuName.length() > 1000){ | ||
| 106 | + skuName = skuName.substring(0,1000); | ||
| 107 | + } | ||
| 108 | + iclearApiHsCodeLog.setCode("[skuCode="+skuCode+"],[skuName="+skuName+"]"); | ||
| 109 | + iClearApiHsCodeLogService.saveIClearApiHsCodeLog(iclearApiHsCodeLog); | ||
| 110 | + return resultHsCode; | ||
| 111 | + }catch(Exception ex){ | ||
| 112 | + log.error(ex.getMessage(),ex); | ||
| 113 | + resultHsCode = new ResultHsCode(Boolean.FALSE,ErrorCodeEnum.ERROR_30101.getCode(),ErrorCodeEnum.ERROR_30101.getName(),null); | ||
| 114 | + return resultHsCode; | ||
| 115 | + }finally{ | ||
| 116 | + return resultHsCode; | ||
| 117 | + } | ||
| 118 | + } | ||
| 78 | } | 119 | } | ... | ... |
| ... | @@ -23,7 +23,7 @@ import java.util.Date; | ... | @@ -23,7 +23,7 @@ import java.util.Date; |
| 23 | @Slf4j | 23 | @Slf4j |
| 24 | public class VersionInterface { | 24 | public class VersionInterface { |
| 25 | //当前版本号 | 25 | //当前版本号 |
| 26 | - final String VERSION = "1.5"; | 26 | + final String VERSION = "1.7"; |
| 27 | 27 | ||
| 28 | @ApiOperation(value = "获取当前API版本", httpMethod = "GET", notes = "ex: http://192.168.1.71:8080/version/version") | 28 | @ApiOperation(value = "获取当前API版本", httpMethod = "GET", notes = "ex: http://192.168.1.71:8080/version/version") |
| 29 | @GetMapping("/version") | 29 | @GetMapping("/version") | ... | ... |
| ... | @@ -15,4 +15,8 @@ import java.io.Serializable; | ... | @@ -15,4 +15,8 @@ import java.io.Serializable; |
| 15 | public class HsCodeParam implements Serializable { | 15 | public class HsCodeParam implements Serializable { |
| 16 | private static final long serialVersionUID = 786697399667065141L; | 16 | private static final long serialVersionUID = 786697399667065141L; |
| 17 | String hscode; | 17 | String hscode; |
| 18 | + //hscode编码 | ||
| 19 | + String skuCode; | ||
| 20 | + //商品名称 | ||
| 21 | + String skuName; | ||
| 18 | } | 22 | } | ... | ... |
| ... | @@ -21,6 +21,4 @@ public class BaseModel implements Serializable { | ... | @@ -21,6 +21,4 @@ public class BaseModel implements Serializable { |
| 21 | public void setId(Long id) { | 21 | public void setId(Long id) { |
| 22 | this.id = id; | 22 | this.id = id; |
| 23 | } | 23 | } |
| 24 | - | 24 | +} |
| 25 | - | ||
| 26 | -} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| 1 | package com.erry.iclear.dateInterface.common; | 1 | package com.erry.iclear.dateInterface.common; |
| 2 | 2 | ||
| 3 | -import com.erry.iclear.dateInterface.entity.ChmCarryPort; | 3 | +import com.erry.iclear.dateInterface.entity.*; |
| 4 | -import com.erry.iclear.dateInterface.entity.DictionaryEntries; | ||
| 5 | -import com.erry.iclear.dateInterface.entity.DomesticDestinationMapping; | ||
| 6 | -import com.erry.iclear.dateInterface.entity.OrigplacecodeMapping; | ||
| 7 | import org.springframework.stereotype.Component; | 4 | import org.springframework.stereotype.Component; |
| 8 | 5 | ||
| 9 | import java.util.HashMap; | 6 | import java.util.HashMap; |
| ... | @@ -21,6 +18,11 @@ public class Constant { | ... | @@ -21,6 +18,11 @@ public class Constant { |
| 21 | public static Map<String,HashMap<String,String>> appIdSecurityCache = new HashMap<>(); | 18 | public static Map<String,HashMap<String,String>> appIdSecurityCache = new HashMap<>(); |
| 22 | 19 | ||
| 23 | /** | 20 | /** |
| 21 | + * APP INFO信息 | ||
| 22 | + */ | ||
| 23 | + public static Map<String,AppInfo> appInfoCache = new HashMap<>(); | ||
| 24 | + | ||
| 25 | + /** | ||
| 24 | * 字典表 code:entity | 26 | * 字典表 code:entity |
| 25 | */ | 27 | */ |
| 26 | public static Map<String , DictionaryEntries> dictionaryEntriesCache = new HashMap<>(); | 28 | public static Map<String , DictionaryEntries> dictionaryEntriesCache = new HashMap<>(); |
| ... | @@ -94,5 +96,8 @@ public class Constant { | ... | @@ -94,5 +96,8 @@ public class Constant { |
| 94 | 96 | ||
| 95 | public static String DECLARED_DOC_TYPE_ZERO="declaredDocType_00"; | 97 | public static String DECLARED_DOC_TYPE_ZERO="declaredDocType_00"; |
| 96 | 98 | ||
| 97 | - | 99 | + /** |
| 100 | + * 监管条件 | ||
| 101 | + */ | ||
| 102 | + public static final String supervise_condition = "superviseRestrict"; | ||
| 98 | } | 103 | } | ... | ... |
| 1 | -package com.erry.iclear.dateInterface.common; | ||
| 2 | - | ||
| 3 | -/** | ||
| 4 | - * 常量 | ||
| 5 | - * mt | ||
| 6 | - * 2021年7月29日13:34:15 | ||
| 7 | - */ | ||
| 8 | -public interface Constants { | ||
| 9 | - /** | ||
| 10 | - * api响应码 | ||
| 11 | - */ | ||
| 12 | - public static interface ApiResponseKeys{ | ||
| 13 | - //成功 | ||
| 14 | - public static final String SUCCESS = "0"; | ||
| 15 | - //用户或密码不正确 | ||
| 16 | - public static final String KEY_10001 = "10001"; | ||
| 17 | - //用户不存在 | ||
| 18 | - public static final String KEY_10002 = "10002"; | ||
| 19 | - //账号已过期 | ||
| 20 | - public static final String KEY_10003 = "10003"; | ||
| 21 | - //凭证已过期 | ||
| 22 | - public static final String KEY_10004 = "10004"; | ||
| 23 | - //账号已禁用 | ||
| 24 | - public static final String KEY_10005 = "10005"; | ||
| 25 | - //用户凭证无效 | ||
| 26 | - public static final String KEY_10013 = "10013"; | ||
| 27 | - } | ||
| 28 | -} |
| ... | @@ -16,9 +16,7 @@ public class JsonDateTimeSerializer extends JsonSerializer<Date> { | ... | @@ -16,9 +16,7 @@ public class JsonDateTimeSerializer extends JsonSerializer<Date> { |
| 16 | @Override | 16 | @Override |
| 17 | public void serialize(Date date, JsonGenerator gen, SerializerProvider provider) | 17 | public void serialize(Date date, JsonGenerator gen, SerializerProvider provider) |
| 18 | throws IOException, JsonProcessingException { | 18 | throws IOException, JsonProcessingException { |
| 19 | - | ||
| 20 | String formattedDate = dateFormat.format(date); | 19 | String formattedDate = dateFormat.format(date); |
| 21 | - | ||
| 22 | gen.writeString(formattedDate); | 20 | gen.writeString(formattedDate); |
| 23 | } | 21 | } |
| 24 | -} | 22 | +} |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -48,7 +48,6 @@ public class IClearExportInterface { | ... | @@ -48,7 +48,6 @@ public class IClearExportInterface { |
| 48 | public String refreshSendMawbe() { | 48 | public String refreshSendMawbe() { |
| 49 | try{ | 49 | try{ |
| 50 | 50 | ||
| 51 | - | ||
| 52 | return "Success"; | 51 | return "Success"; |
| 53 | }catch (Exception e){ | 52 | }catch (Exception e){ |
| 54 | log.error("refreshCache() error:"+e.getMessage()); | 53 | log.error("refreshCache() error:"+e.getMessage()); | ... | ... |
| ... | @@ -34,5 +34,9 @@ public class AppInfo implements Serializable { | ... | @@ -34,5 +34,9 @@ public class AppInfo implements Serializable { |
| 34 | @Column(name = "IS_ENABLE") | 34 | @Column(name = "IS_ENABLE") |
| 35 | private String isEnable; | 35 | private String isEnable; |
| 36 | 36 | ||
| 37 | - | 37 | + /** |
| 38 | + * C类校验是否校验运单号,非空则不校验 | ||
| 39 | + */ | ||
| 40 | + @Column(name = "C_CODE_CHECK") | ||
| 41 | + private String codeCheck; | ||
| 38 | } | 42 | } | ... | ... |
| ... | @@ -416,6 +416,11 @@ public class ChmConsignment implements Serializable { | ... | @@ -416,6 +416,11 @@ public class ChmConsignment implements Serializable { |
| 416 | @OneToMany(mappedBy = "chmConsignment", cascade = CascadeType.ALL) | 416 | @OneToMany(mappedBy = "chmConsignment", cascade = CascadeType.ALL) |
| 417 | private List<ChmConsignmentDetail> chmConsignmentDetailList; | 417 | private List<ChmConsignmentDetail> chmConsignmentDetailList; |
| 418 | 418 | ||
| 419 | + /** | ||
| 420 | + * C类校验是否校验运单号,非空则不校验 | ||
| 421 | + */ | ||
| 422 | + @Transient | ||
| 423 | + private String codeCheck; | ||
| 419 | 424 | ||
| 420 | @Override | 425 | @Override |
| 421 | public String toString() { | 426 | public String toString() { | ... | ... |
This diff is collapsed. Click to expand it.
| 1 | +package com.erry.iclear.dateInterface.enums; | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +/** | ||
| 5 | + * 异常编码枚举类 | ||
| 6 | + * mt | ||
| 7 | + * 2023年2月21日16:03:16 | ||
| 8 | + */ | ||
| 9 | +public enum ErrorCodeEnum { | ||
| 10 | + SUCCESS("0","成功"), | ||
| 11 | + ERROR_7("10001","请求信息不能为空"), | ||
| 12 | + ERROR_10001("10001","Appid错误(Appid不存在)"), | ||
| 13 | + ERROR_10002("10002","Appkey错误(Appkey不存在)"), | ||
| 14 | + ERROR_10004("10004","凭证已过期"), | ||
| 15 | + ERROR_10013("10013","无Token(缺少参数)"), | ||
| 16 | + ERROR_10014("10014","Token无效(Token值验证失败)"), | ||
| 17 | + ERROR_10016("10016","无Appid(缺少参数)"), | ||
| 18 | + ERROR_10017("10017","无Appkey(缺少参数)"), | ||
| 19 | + ERROR_10018("10018","无TimeStamp(缺少参数)"), | ||
| 20 | + ERROR_10019("10019","未指定hscode编码,10分钟之内只允许查询一次。"), | ||
| 21 | + ERROR_30001("30001","数据格式不正确"), | ||
| 22 | + ERROR_30002("30002","缺少必填项"), | ||
| 23 | + ERROR_30003("30003","数据校验不通过"), | ||
| 24 | + ERROR_30100("30100","hscode编码个数超过100个"), | ||
| 25 | + ERROR_30101("30101","数据查询异常(访问数据库超时或者其他数据库异常)"), | ||
| 26 | + ERROR_30102("30102","hscode编码字段长度超过2000字符"), | ||
| 27 | + ERROR_30103("30103","skuCode与skuName必须传递一项"), | ||
| 28 | + ERROR_30104("30104","skuCode或skuName长度超出限制"), | ||
| 29 | + ERROR_30105("30105","skuCode编码最少输入4位字符,skuName最少输入2个字符"); | ||
| 30 | + | ||
| 31 | + ErrorCodeEnum(String code,String name){ | ||
| 32 | + this.code = code; | ||
| 33 | + this.name = name; | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + private String code; | ||
| 37 | + private String name; | ||
| 38 | + public String getCode() { | ||
| 39 | + return code; | ||
| 40 | + } | ||
| 41 | + public String getName() { | ||
| 42 | + return name; | ||
| 43 | + } | ||
| 44 | +} |
| 1 | package com.erry.iclear.dateInterface.interceptor; | 1 | package com.erry.iclear.dateInterface.interceptor; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSON; | 3 | import com.alibaba.fastjson.JSON; |
| 4 | +import com.erry.iclear.dateInterface.enums.ErrorCodeEnum; | ||
| 4 | import com.erry.iclear.dateInterface.api.response.ResultHsCode; | 5 | import com.erry.iclear.dateInterface.api.response.ResultHsCode; |
| 5 | -import com.erry.iclear.dateInterface.api.response.ResultRS; | ||
| 6 | import com.erry.iclear.dateInterface.common.Constant; | 6 | import com.erry.iclear.dateInterface.common.Constant; |
| 7 | import com.erry.iclear.dateInterface.util.SHA256Util; | 7 | import com.erry.iclear.dateInterface.util.SHA256Util; |
| 8 | import lombok.extern.slf4j.Slf4j; | 8 | import lombok.extern.slf4j.Slf4j; |
| ... | @@ -15,7 +15,6 @@ import javax.servlet.http.HttpServletRequest; | ... | @@ -15,7 +15,6 @@ import javax.servlet.http.HttpServletRequest; |
| 15 | import javax.servlet.http.HttpServletResponse; | 15 | import javax.servlet.http.HttpServletResponse; |
| 16 | import java.io.IOException; | 16 | import java.io.IOException; |
| 17 | import java.io.PrintWriter; | 17 | import java.io.PrintWriter; |
| 18 | -import java.util.Enumeration; | ||
| 19 | import java.util.HashMap; | 18 | import java.util.HashMap; |
| 20 | 19 | ||
| 21 | /** | 20 | /** |
| ... | @@ -36,40 +35,40 @@ public class HsCodeInterceptor extends HandlerInterceptorAdapter { | ... | @@ -36,40 +35,40 @@ public class HsCodeInterceptor extends HandlerInterceptorAdapter { |
| 36 | //String uri = request.getRequestURI(); | 35 | //String uri = request.getRequestURI(); |
| 37 | 36 | ||
| 38 | if(StringUtils.isBlank(appId)){ | 37 | if(StringUtils.isBlank(appId)){ |
| 39 | - this.returnJson(response,false,"10016","Appid不能为空"); | 38 | + this.returnJson(response,false, ErrorCodeEnum.ERROR_10016.getCode(),ErrorCodeEnum.ERROR_10016.getName()); |
| 40 | return false; | 39 | return false; |
| 41 | } | 40 | } |
| 42 | 41 | ||
| 43 | if(StringUtils.isBlank(appkey)){ | 42 | if(StringUtils.isBlank(appkey)){ |
| 44 | - this.returnJson(response,false,"10017","Appkey不能为空"); | 43 | + this.returnJson(response,false,ErrorCodeEnum.ERROR_10017.getCode(),ErrorCodeEnum.ERROR_10017.getName()); |
| 45 | return false; | 44 | return false; |
| 46 | } | 45 | } |
| 47 | 46 | ||
| 48 | if(StringUtils.isBlank(timeStamp)){ | 47 | if(StringUtils.isBlank(timeStamp)){ |
| 49 | - this.returnJson(response,false,"10018","TimeStamp不能为空"); | 48 | + this.returnJson(response,false,ErrorCodeEnum.ERROR_10018.getCode(),ErrorCodeEnum.ERROR_10018.getName()); |
| 50 | return false; | 49 | return false; |
| 51 | } | 50 | } |
| 52 | 51 | ||
| 53 | if(StringUtils.isBlank(token)){ | 52 | if(StringUtils.isBlank(token)){ |
| 54 | - this.returnJson(response,false,"10013","token不能为空"); | 53 | + this.returnJson(response,false,ErrorCodeEnum.ERROR_10013.getCode(),ErrorCodeEnum.ERROR_10013.getName()); |
| 55 | return false; | 54 | return false; |
| 56 | } | 55 | } |
| 57 | 56 | ||
| 58 | HashMap<String,String> secretMap = Constant.appIdSecurityCache.get(appId); | 57 | HashMap<String,String> secretMap = Constant.appIdSecurityCache.get(appId); |
| 59 | if(secretMap==null){ | 58 | if(secretMap==null){ |
| 60 | - this.returnJson(response,false,"10001","系统异常,该appId没有注册"); | 59 | + this.returnJson(response,false,ErrorCodeEnum.ERROR_10001.getCode(),ErrorCodeEnum.ERROR_10001.getName()); |
| 61 | return false; | 60 | return false; |
| 62 | } | 61 | } |
| 63 | 62 | ||
| 64 | String secretInSys = secretMap.get(appkey); | 63 | String secretInSys = secretMap.get(appkey); |
| 65 | if (StringUtils.isBlank(secretInSys)) { | 64 | if (StringUtils.isBlank(secretInSys)) { |
| 66 | - this.returnJson(response,false,"10002","系统异常,该appId没有当前Appkey的权限"); | 65 | + this.returnJson(response,false,ErrorCodeEnum.ERROR_10002.getCode(),ErrorCodeEnum.ERROR_10002.getName()); |
| 67 | return false; | 66 | return false; |
| 68 | } | 67 | } |
| 69 | 68 | ||
| 70 | String sha256Str = SHA256Util.getSHA256String(appId+appkey+secretInSys+timeStamp); | 69 | String sha256Str = SHA256Util.getSHA256String(appId+appkey+secretInSys+timeStamp); |
| 71 | if(!token.equals(sha256Str)){ | 70 | if(!token.equals(sha256Str)){ |
| 72 | - this.returnJson(response,false,"10014","Token验证失败"); | 71 | + this.returnJson(response,false,ErrorCodeEnum.ERROR_10014.getCode(),ErrorCodeEnum.ERROR_10014.getName()); |
| 73 | return false; | 72 | return false; |
| 74 | } | 73 | } |
| 75 | return true; | 74 | return true; |
| ... | @@ -99,5 +98,4 @@ public class HsCodeInterceptor extends HandlerInterceptorAdapter { | ... | @@ -99,5 +98,4 @@ public class HsCodeInterceptor extends HandlerInterceptorAdapter { |
| 99 | } | 98 | } |
| 100 | } | 99 | } |
| 101 | } | 100 | } |
| 102 | - | ||
| 103 | } | 101 | } |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| 1 | package com.erry.iclear.dateInterface.interceptor; | 1 | package com.erry.iclear.dateInterface.interceptor; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSON; | 3 | import com.alibaba.fastjson.JSON; |
| 4 | +import com.erry.iclear.dateInterface.enums.ErrorCodeEnum; | ||
| 4 | import com.erry.iclear.dateInterface.api.response.ResultRS; | 5 | import com.erry.iclear.dateInterface.api.response.ResultRS; |
| 5 | import com.erry.iclear.dateInterface.common.Constant; | 6 | import com.erry.iclear.dateInterface.common.Constant; |
| 6 | import com.erry.iclear.dateInterface.util.SHA256Util; | 7 | import com.erry.iclear.dateInterface.util.SHA256Util; |
| ... | @@ -35,40 +36,40 @@ public class SignInterceptor extends HandlerInterceptorAdapter { | ... | @@ -35,40 +36,40 @@ public class SignInterceptor extends HandlerInterceptorAdapter { |
| 35 | 36 | ||
| 36 | 37 | ||
| 37 | if(StringUtils.isBlank(appId)){ | 38 | if(StringUtils.isBlank(appId)){ |
| 38 | - this.returnJson(response,false,"10016","Appid不能为空"); | 39 | + this.returnJson(response,false, ErrorCodeEnum.ERROR_10016.getCode(),ErrorCodeEnum.ERROR_10016.getName()); |
| 39 | return false; | 40 | return false; |
| 40 | } | 41 | } |
| 41 | 42 | ||
| 42 | if(StringUtils.isBlank(appkey)){ | 43 | if(StringUtils.isBlank(appkey)){ |
| 43 | - this.returnJson(response,false,"10017","Appkey不能为空"); | 44 | + this.returnJson(response,false,ErrorCodeEnum.ERROR_10017.getCode(),ErrorCodeEnum.ERROR_10017.getName()); |
| 44 | return false; | 45 | return false; |
| 45 | } | 46 | } |
| 46 | 47 | ||
| 47 | if(StringUtils.isBlank(timeStamp)){ | 48 | if(StringUtils.isBlank(timeStamp)){ |
| 48 | - this.returnJson(response,false,"10018","TimeStamp不能为空"); | 49 | + this.returnJson(response,false,ErrorCodeEnum.ERROR_10018.getCode(),ErrorCodeEnum.ERROR_10018.getName()); |
| 49 | return false; | 50 | return false; |
| 50 | } | 51 | } |
| 51 | 52 | ||
| 52 | if(StringUtils.isBlank(token)){ | 53 | if(StringUtils.isBlank(token)){ |
| 53 | - this.returnJson(response,false,"10013","token不能为空"); | 54 | + this.returnJson(response,false,ErrorCodeEnum.ERROR_10013.getCode(),ErrorCodeEnum.ERROR_10013.getName()); |
| 54 | return false; | 55 | return false; |
| 55 | } | 56 | } |
| 56 | 57 | ||
| 57 | HashMap<String,String> secretMap = Constant.appIdSecurityCache.get(appId); | 58 | HashMap<String,String> secretMap = Constant.appIdSecurityCache.get(appId); |
| 58 | if(secretMap==null){ | 59 | if(secretMap==null){ |
| 59 | - this.returnJson(response,false,"10001","系统异常,该appId没有注册"); | 60 | + this.returnJson(response,false,ErrorCodeEnum.ERROR_10001.getCode(),ErrorCodeEnum.ERROR_10001.getName()); |
| 60 | return false; | 61 | return false; |
| 61 | } | 62 | } |
| 62 | 63 | ||
| 63 | String secretInSys = secretMap.get(appkey); | 64 | String secretInSys = secretMap.get(appkey); |
| 64 | if (StringUtils.isBlank(secretInSys)) { | 65 | if (StringUtils.isBlank(secretInSys)) { |
| 65 | - this.returnJson(response,false,"10002","系统异常,该appId没有当前Appkey的权限"); | 66 | + this.returnJson(response,false,ErrorCodeEnum.ERROR_10002.getCode(),ErrorCodeEnum.ERROR_10002.getName()); |
| 66 | return false; | 67 | return false; |
| 67 | } | 68 | } |
| 68 | 69 | ||
| 69 | String sha256Str = SHA256Util.getSHA256String(appId+appkey+secretInSys+timeStamp); | 70 | String sha256Str = SHA256Util.getSHA256String(appId+appkey+secretInSys+timeStamp); |
| 70 | if(!token.equals(sha256Str)){ | 71 | if(!token.equals(sha256Str)){ |
| 71 | - this.returnJson(response,false,"10014","Token验证失败"); | 72 | + this.returnJson(response,false,ErrorCodeEnum.ERROR_10014.getCode(),ErrorCodeEnum.ERROR_10014.getName()); |
| 72 | return false; | 73 | return false; |
| 73 | } | 74 | } |
| 74 | return true; | 75 | return true; |
| ... | @@ -98,5 +99,4 @@ public class SignInterceptor extends HandlerInterceptorAdapter { | ... | @@ -98,5 +99,4 @@ public class SignInterceptor extends HandlerInterceptorAdapter { |
| 98 | } | 99 | } |
| 99 | } | 100 | } |
| 100 | } | 101 | } |
| 101 | - | 102 | +} |
| 102 | -} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -41,4 +41,13 @@ public interface DictionaryEntriesRepository extends JpaRepository<DictionaryEn | ... | @@ -41,4 +41,13 @@ public interface DictionaryEntriesRepository extends JpaRepository<DictionaryEn |
| 41 | @Query(nativeQuery = true, value = "SELECT * FROM T_BI_DICTIONARY_ENTRIES WHERE DICT_CODE = ?1 AND EXT6 = ?2") | 41 | @Query(nativeQuery = true, value = "SELECT * FROM T_BI_DICTIONARY_ENTRIES WHERE DICT_CODE = ?1 AND EXT6 = ?2") |
| 42 | public DictionaryEntries findDictionaryEntriesByDicCode(String code,String numBer); | 42 | public DictionaryEntries findDictionaryEntriesByDicCode(String code,String numBer); |
| 43 | 43 | ||
| 44 | + /** | ||
| 45 | + *监管条件 | ||
| 46 | + * @param dictCode | ||
| 47 | + * @param status | ||
| 48 | + * @return | ||
| 49 | + */ | ||
| 50 | + @Query(nativeQuery = true, value = "select CHINESE_NAME from T_BI_DICTIONARY_ENTRIES where DICT_CODE = ?1 AND STATUS=?2 order by ORDINAL") | ||
| 51 | + public List<String> findDicEntByCodeList(String dictCode, Integer status); | ||
| 52 | + | ||
| 44 | } | 53 | } | ... | ... |
| ... | @@ -16,27 +16,35 @@ import java.util.List; | ... | @@ -16,27 +16,35 @@ import java.util.List; |
| 16 | */ | 16 | */ |
| 17 | @Repository | 17 | @Repository |
| 18 | public interface HsCodeRepository extends JpaSpecificationExecutor<HsCode>, JpaRepository<HsCode, Long> { | 18 | public interface HsCodeRepository extends JpaSpecificationExecutor<HsCode>, JpaRepository<HsCode, Long> { |
| 19 | - /** | ||
| 20 | - * | ||
| 21 | - * 根据hscode编码查询最新一条hscode信息 | ||
| 22 | - * @param code | ||
| 23 | - * @return | ||
| 24 | - */ | ||
| 25 | - @Query(nativeQuery = true,value = "select top 1 * from T_CC_HS_CODE where VALIDATE=1 and SKU_CODE =?1 order by id desc ") | ||
| 26 | - public HsCode findHsCodeByCode(String code); | ||
| 27 | 19 | ||
| 28 | /** | 20 | /** |
| 29 | * 根据hscode编码查询对应的hscode | 21 | * 根据hscode编码查询对应的hscode |
| 30 | * @param skuCodeList | 22 | * @param skuCodeList |
| 31 | * @return | 23 | * @return |
| 32 | */ | 24 | */ |
| 33 | - @Query(nativeQuery = true, value = "select * from [dbo].[T_CC_HS_CODE] where VALIDATE=1 and SKU_CODE in ?1") | 25 | + @Query(nativeQuery = true, value = "select * from T_CC_HS_CODE where VALIDATE=1 and SKU_CODE in ?1") |
| 34 | List<HsCode> findHsCodeListByCode(List<String> skuCodeList); | 26 | List<HsCode> findHsCodeListByCode(List<String> skuCodeList); |
| 35 | 27 | ||
| 36 | /** | 28 | /** |
| 29 | + * 根据hscode编码或者商品名称进行模糊查询 | ||
| 30 | + * @param skuCode | ||
| 31 | + * @param skuName | ||
| 32 | + * @return | ||
| 33 | + */ | ||
| 34 | + @Query(nativeQuery = true, value = "SELECT TOP 50 * FROM T_CC_HS_CODE WHERE VALIDATE=1 and SKU_CODE LIKE ?1 AND SKUNAME LIKE ?2") | ||
| 35 | + List<HsCode> fuzzyQueryHsCode(String skuCode,String skuName); | ||
| 36 | + | ||
| 37 | + /** | ||
| 37 | * 查询所有有效hscode | 38 | * 查询所有有效hscode |
| 38 | * @return | 39 | * @return |
| 39 | */ | 40 | */ |
| 40 | @Query(nativeQuery = true,value = "select * from T_CC_HS_CODE where VALIDATE=1") | 41 | @Query(nativeQuery = true,value = "select * from T_CC_HS_CODE where VALIDATE=1") |
| 41 | - public List<HsCode> findAllHsCodeList(); | 42 | + List<HsCode> findAllHsCodeList(); |
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * 获取监管条件数据 | ||
| 46 | + * @return | ||
| 47 | + */ | ||
| 48 | + @Query(nativeQuery = true,value = "select * from T_CC_HS_CODE where OUT_RATE <> 0 or MONITOR_CONDITION collate Chinese_PRC_CS_AI_WS LIKE ?1") | ||
| 49 | + List<HsCode> findMonitorCondition(String chinsesName); | ||
| 42 | } | 50 | } |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -28,6 +28,6 @@ public interface IClearApiHsCodeLogRepository extends JpaRepository<IClearApiHsC | ... | @@ -28,6 +28,6 @@ public interface IClearApiHsCodeLogRepository extends JpaRepository<IClearApiHsC |
| 28 | * @param createTime yyyy-MM-dd HH:mm | 28 | * @param createTime yyyy-MM-dd HH:mm |
| 29 | * @return | 29 | * @return |
| 30 | */ | 30 | */ |
| 31 | - @Query(nativeQuery = true,value = "select count(1) from T_ICLEAR_API_HSCODE_LOG where CREATE_TIME > ? AND (CODE IS NULL OR CODE = '')") | 31 | + @Query(nativeQuery = true,value = "select count(1) from T_ICLEAR_API_HSCODE_LOG where CREATE_TIME > ?1 AND APPID = ?2 AND (CODE IS NULL OR CODE = '')") |
| 32 | - public Long findIClearApiHsCodeLog(String createTime); | 32 | + public Long findIClearApiHsCodeLog(String createTime,String appId); |
| 33 | } | 33 | } | ... | ... |
| 1 | package com.erry.iclear.dateInterface.service; | 1 | package com.erry.iclear.dateInterface.service; |
| 2 | 2 | ||
| 3 | +import com.erry.iclear.dateInterface.enums.ErrorCodeEnum; | ||
| 3 | import com.erry.iclear.dateInterface.api.request.Mawb; | 4 | import com.erry.iclear.dateInterface.api.request.Mawb; |
| 4 | import com.erry.iclear.dateInterface.api.request.MawbDetail; | 5 | import com.erry.iclear.dateInterface.api.request.MawbDetail; |
| 5 | import com.erry.iclear.dateInterface.api.request.ReceiptMessage; | 6 | import com.erry.iclear.dateInterface.api.request.ReceiptMessage; |
| 6 | import com.erry.iclear.dateInterface.api.response.TokenResult; | 7 | import com.erry.iclear.dateInterface.api.response.TokenResult; |
| 7 | -import com.erry.iclear.dateInterface.common.Constants; | ||
| 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; |
| 10 | import com.erry.iclear.dateInterface.entity.DeclearTask; | 10 | import com.erry.iclear.dateInterface.entity.DeclearTask; |
| ... | @@ -16,28 +16,12 @@ import com.erry.iclear.dateInterface.util.DateUtils; | ... | @@ -16,28 +16,12 @@ import com.erry.iclear.dateInterface.util.DateUtils; |
| 16 | import com.erry.iclear.dateInterface.util.HttpUtils; | 16 | import com.erry.iclear.dateInterface.util.HttpUtils; |
| 17 | import com.erry.iclear.dateInterface.util.JsonToJava; | 17 | import com.erry.iclear.dateInterface.util.JsonToJava; |
| 18 | import lombok.extern.slf4j.Slf4j; | 18 | import lombok.extern.slf4j.Slf4j; |
| 19 | -import org.apache.http.Header; | ||
| 20 | -import org.apache.http.HttpEntity; | ||
| 21 | -import org.apache.http.HttpResponse; | ||
| 22 | -import org.apache.http.client.config.RequestConfig; | ||
| 23 | -import org.apache.http.client.methods.HttpPost; | ||
| 24 | -import org.apache.http.conn.ssl.SSLConnectionSocketFactory; | ||
| 25 | -import org.apache.http.entity.ContentType; | ||
| 26 | -import org.apache.http.entity.StringEntity; | ||
| 27 | -import org.apache.http.impl.client.CloseableHttpClient; | ||
| 28 | -import org.apache.http.impl.client.HttpClients; | ||
| 29 | -import org.apache.http.ssl.SSLContexts; | ||
| 30 | -import org.apache.http.util.EntityUtils; | ||
| 31 | import org.springframework.beans.factory.annotation.Autowired; | 19 | import org.springframework.beans.factory.annotation.Autowired; |
| 32 | import org.springframework.beans.factory.annotation.Value; | 20 | import org.springframework.beans.factory.annotation.Value; |
| 33 | import org.springframework.stereotype.Service; | 21 | import org.springframework.stereotype.Service; |
| 34 | 22 | ||
| 35 | -import javax.net.ssl.SSLContext; | ||
| 36 | import javax.transaction.Transactional; | 23 | import javax.transaction.Transactional; |
| 37 | -import java.io.IOException; | ||
| 38 | import java.math.BigDecimal; | 24 | import java.math.BigDecimal; |
| 39 | -import java.security.KeyManagementException; | ||
| 40 | -import java.security.NoSuchAlgorithmException; | ||
| 41 | import java.util.*; | 25 | import java.util.*; |
| 42 | 26 | ||
| 43 | /** | 27 | /** |
| ... | @@ -160,12 +144,12 @@ public class ApiService { | ... | @@ -160,12 +144,12 @@ public class ApiService { |
| 160 | //接口响应时间 | 144 | //接口响应时间 |
| 161 | declearTask.setResponseTime(new Date()); | 145 | declearTask.setResponseTime(new Date()); |
| 162 | TokenResult tokenResult = JsonToJava.parseJson(json,TokenResult.class); | 146 | TokenResult tokenResult = JsonToJava.parseJson(json,TokenResult.class); |
| 163 | - if(tokenResult.getErrorcode().equals(Constants.ApiResponseKeys.SUCCESS)){ | 147 | + if(tokenResult.getErrorcode().equals(ErrorCodeEnum.SUCCESS.getCode())){ |
| 164 | //推送成功,记录推送状态 | 148 | //推送成功,记录推送状态 |
| 165 | declearTask.setResponseResults(tokenResult.getErrorcode()); | 149 | declearTask.setResponseResults(tokenResult.getErrorcode()); |
| 166 | declearTask.setResponseContent(tokenResult.getErrormessage()); | 150 | declearTask.setResponseContent(tokenResult.getErrormessage()); |
| 167 | declearTaskList.add(declearTask); | 151 | declearTaskList.add(declearTask); |
| 168 | - }else if(tokenResult.getErrorcode().equals(Constants.ApiResponseKeys.KEY_10004) || tokenResult.getErrorcode().equals(Constants.ApiResponseKeys.KEY_10013)){ | 152 | + }else if(tokenResult.getErrorcode().equals(ErrorCodeEnum.ERROR_10004.getCode()) || tokenResult.getErrorcode().equals(ErrorCodeEnum.ERROR_10013.getCode())){ |
| 169 | //如果凭证失效,则刷新凭证 | 153 | //如果凭证失效,则刷新凭证 |
| 170 | refreshToken(token); | 154 | refreshToken(token); |
| 171 | }else{ | 155 | }else{ |
| ... | @@ -259,12 +243,12 @@ public class ApiService { | ... | @@ -259,12 +243,12 @@ public class ApiService { |
| 259 | //接口响应时间 | 243 | //接口响应时间 |
| 260 | declearTask.setResponseTime(new Date()); | 244 | declearTask.setResponseTime(new Date()); |
| 261 | TokenResult tokenResult = JsonToJava.parseJson(json,TokenResult.class); | 245 | TokenResult tokenResult = JsonToJava.parseJson(json,TokenResult.class); |
| 262 | - if(tokenResult.getErrorcode().equals(Constants.ApiResponseKeys.SUCCESS)){ | 246 | + if(tokenResult.getErrorcode().equals(ErrorCodeEnum.SUCCESS.getCode())){ |
| 263 | //推送成功,记录推送状态 | 247 | //推送成功,记录推送状态 |
| 264 | declearTask.setResponseResults(tokenResult.getErrorcode()); | 248 | declearTask.setResponseResults(tokenResult.getErrorcode()); |
| 265 | declearTask.setResponseContent(tokenResult.getErrormessage()); | 249 | declearTask.setResponseContent(tokenResult.getErrormessage()); |
| 266 | declearTaskList.add(declearTask); | 250 | declearTaskList.add(declearTask); |
| 267 | - }else if(tokenResult.getErrorcode().equals(Constants.ApiResponseKeys.KEY_10004) || tokenResult.getErrorcode().equals(Constants.ApiResponseKeys.KEY_10013)){ | 251 | + }else if(tokenResult.getErrorcode().equals(ErrorCodeEnum.ERROR_10004.getCode()) || tokenResult.getErrorcode().equals(ErrorCodeEnum.ERROR_10013.getCode())){ |
| 268 | //如果凭证失效,则刷新凭证 | 252 | //如果凭证失效,则刷新凭证 |
| 269 | refreshToken(token); | 253 | refreshToken(token); |
| 270 | }else{ | 254 | }else{ | ... | ... |
| ... | @@ -43,6 +43,7 @@ public class AppInfoService { | ... | @@ -43,6 +43,7 @@ public class AppInfoService { |
| 43 | HashMap<String, String> appkeyMap = new HashMap<String, String>(); | 43 | HashMap<String, String> appkeyMap = new HashMap<String, String>(); |
| 44 | appkeyMap.put(appInfo.getAppKey(), appInfo.getSecurity()); | 44 | appkeyMap.put(appInfo.getAppKey(), appInfo.getSecurity()); |
| 45 | Constant.appIdSecurityCache.put(appInfo.getAppId(), appkeyMap); | 45 | Constant.appIdSecurityCache.put(appInfo.getAppId(), appkeyMap); |
| 46 | + Constant.appInfoCache.put(appInfo.getAppId()+appInfo.getAppKey(),appInfo); | ||
| 46 | } | 47 | } |
| 47 | } catch (Exception e) { | 48 | } catch (Exception e) { |
| 48 | log.error("initAppInfo() error" + e.getMessage()); | 49 | log.error("initAppInfo() error" + e.getMessage()); | ... | ... |
| ... | @@ -166,13 +166,13 @@ public class ChmConsignmentDetailService { | ... | @@ -166,13 +166,13 @@ public class ChmConsignmentDetailService { |
| 166 | result.setSkuName(mawbDetail.getGname()); | 166 | result.setSkuName(mawbDetail.getGname()); |
| 167 | //成交数量 | 167 | //成交数量 |
| 168 | result.setKnockdownNumber(bigDecimalFormat(BigDecimal.valueOf(mawbDetail.getGqty().doubleValue()))); | 168 | result.setKnockdownNumber(bigDecimalFormat(BigDecimal.valueOf(mawbDetail.getGqty().doubleValue()))); |
| 169 | + //第二法定数量 | ||
| 170 | + result.setQtyLegalSecond(bigDecimalFormat(mawbDetail.getSecondQty())); | ||
| 169 | //第二计量单位 | 171 | //第二计量单位 |
| 170 | DictionaryEntries secondUnitDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.TRANSACTION_UNIT+ mawbDetail.getSecondUnit()); | 172 | DictionaryEntries secondUnitDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.TRANSACTION_UNIT+ mawbDetail.getSecondUnit()); |
| 171 | if(!Objects.equals(secondUnitDictionaryEntries,null)){ | 173 | if(!Objects.equals(secondUnitDictionaryEntries,null)){ |
| 172 | result.setUnitLegalSecondId(secondUnitDictionaryEntries); | 174 | result.setUnitLegalSecondId(secondUnitDictionaryEntries); |
| 173 | result.setUnitLegalSecond(secondUnitDictionaryEntries.getChineseName()); | 175 | result.setUnitLegalSecond(secondUnitDictionaryEntries.getChineseName()); |
| 174 | - //第二法定数量 | ||
| 175 | - result.setQtyLegalSecond(bigDecimalFormat(mawbDetail.getSecondQty())); | ||
| 176 | } | 176 | } |
| 177 | 177 | ||
| 178 | //成交币制 | 178 | //成交币制 | ... | ... |
| 1 | package com.erry.iclear.dateInterface.service; | 1 | package com.erry.iclear.dateInterface.service; |
| 2 | 2 | ||
| 3 | //import cn.hutool.core.date.DateUtil; | 3 | //import cn.hutool.core.date.DateUtil; |
| 4 | +import com.erry.iclear.dateInterface.enums.ErrorCodeEnum; | ||
| 4 | import com.erry.iclear.dateInterface.api.request.FedexMawb; | 5 | import com.erry.iclear.dateInterface.api.request.FedexMawb; |
| 5 | import com.erry.iclear.dateInterface.api.request.FedexReceipt; | 6 | import com.erry.iclear.dateInterface.api.request.FedexReceipt; |
| 6 | import com.erry.iclear.dateInterface.api.request.Mawb; | 7 | import com.erry.iclear.dateInterface.api.request.Mawb; |
| ... | @@ -239,7 +240,7 @@ public class ChmConsignmentService { | ... | @@ -239,7 +240,7 @@ public class ChmConsignmentService { |
| 239 | return result; | 240 | return result; |
| 240 | } | 241 | } |
| 241 | 242 | ||
| 242 | - public ChmConsignment convertToChmConsignmentFedex(FedexMawb mawb, Date pushTime, String creator){ | 243 | + public ChmConsignment convertToChmConsignmentFedex(FedexMawb mawb, Date pushTime, String creator,AppInfo appInfo){ |
| 243 | ChmConsignment result = new ChmConsignment(); | 244 | ChmConsignment result = new ChmConsignment(); |
| 244 | try{ | 245 | try{ |
| 245 | //运单号 | 246 | //运单号 |
| ... | @@ -256,6 +257,11 @@ public class ChmConsignmentService { | ... | @@ -256,6 +257,11 @@ public class ChmConsignmentService { |
| 256 | result.setTradeModeDic(tradeModeDictionaryEntries); | 257 | result.setTradeModeDic(tradeModeDictionaryEntries); |
| 257 | result.setTradeMode(tradeModeDictionaryEntries.getChineseName()); | 258 | result.setTradeMode(tradeModeDictionaryEntries.getChineseName()); |
| 258 | }*/ | 259 | }*/ |
| 260 | + if(appInfo != null){ | ||
| 261 | + //C类校验是否校验运单号,非空则不校验 | ||
| 262 | + result.setCodeCheck(appInfo.getCodeCheck()); | ||
| 263 | + } | ||
| 264 | + | ||
| 259 | //境内收发货人社会信用证代码 | 265 | //境内收发货人社会信用证代码 |
| 260 | result.setTradeCoSCC(mawb.getTradeCodeScc()); | 266 | result.setTradeCoSCC(mawb.getTradeCodeScc()); |
| 261 | //境内发货人(经营单位编码) | 267 | //境内发货人(经营单位编码) |
| ... | @@ -487,8 +493,8 @@ public class ChmConsignmentService { | ... | @@ -487,8 +493,8 @@ public class ChmConsignmentService { |
| 487 | Date pushTime = DateUtils.timeStampToDate(Long.valueOf(timeStamp)); | 493 | Date pushTime = DateUtils.timeStampToDate(Long.valueOf(timeStamp)); |
| 488 | ChmConsignment chmConsignment=this.convertToChmConsignment(mawb,pushTime,creator); | 494 | ChmConsignment chmConsignment=this.convertToChmConsignment(mawb,pushTime,creator); |
| 489 | if(Objects.equals(chmConsignment,null)){ | 495 | if(Objects.equals(chmConsignment,null)){ |
| 490 | - result.setCode("30001"); | 496 | + result.setCode(ErrorCodeEnum.ERROR_30001.getCode()); |
| 491 | - result.setMsg("数据格式不正确"); | 497 | + result.setMsg(ErrorCodeEnum.ERROR_30001.getName()); |
| 492 | return result; | 498 | return result; |
| 493 | } | 499 | } |
| 494 | List<ChmConsignmentDetail> chmConsignmentDetailList = new ArrayList<>(); | 500 | List<ChmConsignmentDetail> chmConsignmentDetailList = new ArrayList<>(); |
| ... | @@ -516,7 +522,7 @@ public class ChmConsignmentService { | ... | @@ -516,7 +522,7 @@ public class ChmConsignmentService { |
| 516 | log.info("主单"+ mawb.getBillNo()+" 保存成功,chmConsignmentId:"+chmConsignmentSaveResult.getId()); | 522 | log.info("主单"+ mawb.getBillNo()+" 保存成功,chmConsignmentId:"+chmConsignmentSaveResult.getId()); |
| 517 | }else{ | 523 | }else{ |
| 518 | log.info("主单"+ mawb.getBillNo()+" 保存失败"); | 524 | log.info("主单"+ mawb.getBillNo()+" 保存失败"); |
| 519 | - result.setCode("30002"); | 525 | + result.setCode(ErrorCodeEnum.ERROR_30002.getCode()); |
| 520 | result.setMsg("主单"+ mawb.getBillNo()+" 保存失败"); | 526 | result.setMsg("主单"+ mawb.getBillNo()+" 保存失败"); |
| 521 | return result; | 527 | return result; |
| 522 | } | 528 | } |
| ... | @@ -571,10 +577,10 @@ public class ChmConsignmentService { | ... | @@ -571,10 +577,10 @@ public class ChmConsignmentService { |
| 571 | ResultRS result = new ResultRS(Boolean.FALSE,null,null); | 577 | ResultRS result = new ResultRS(Boolean.FALSE,null,null); |
| 572 | try { | 578 | try { |
| 573 | Date pushTime = DateUtils.timeStampToDate(Long.valueOf(timeStamp)); | 579 | Date pushTime = DateUtils.timeStampToDate(Long.valueOf(timeStamp)); |
| 574 | - ChmConsignment chmConsignment = this.convertToChmConsignmentFedex(fedexMawb,pushTime,creator); | 580 | + ChmConsignment chmConsignment = this.convertToChmConsignmentFedex(fedexMawb,pushTime,creator,null); |
| 575 | if(Objects.equals(chmConsignment,null)){ | 581 | if(Objects.equals(chmConsignment,null)){ |
| 576 | - result.setCode("30001"); | 582 | + result.setCode(ErrorCodeEnum.ERROR_30001.getCode()); |
| 577 | - result.setMsg("数据格式不正确"); | 583 | + result.setMsg(ErrorCodeEnum.ERROR_30001.getName()); |
| 578 | return result; | 584 | return result; |
| 579 | } | 585 | } |
| 580 | List<ChmConsignmentDetail> chmConsignmentDetailList = new ArrayList<>(); | 586 | List<ChmConsignmentDetail> chmConsignmentDetailList = new ArrayList<>(); |
| ... | @@ -596,7 +602,7 @@ public class ChmConsignmentService { | ... | @@ -596,7 +602,7 @@ public class ChmConsignmentService { |
| 596 | log.info("主单"+ fedexMawb.getBillNo()+" 保存成功,chmConsignmentId:"+chmConsignmentSaveResult.getId()); | 602 | log.info("主单"+ fedexMawb.getBillNo()+" 保存成功,chmConsignmentId:"+chmConsignmentSaveResult.getId()); |
| 597 | }else{ | 603 | }else{ |
| 598 | log.info("主单"+ fedexMawb.getBillNo()+" 保存失败"); | 604 | log.info("主单"+ fedexMawb.getBillNo()+" 保存失败"); |
| 599 | - result.setCode("30002"); | 605 | + result.setCode(ErrorCodeEnum.ERROR_30002.getCode()); |
| 600 | result.setMsg("主单"+ fedexMawb.getBillNo()+" 保存失败"); | 606 | result.setMsg("主单"+ fedexMawb.getBillNo()+" 保存失败"); |
| 601 | return result; | 607 | return result; |
| 602 | } | 608 | } |
| ... | @@ -629,7 +635,7 @@ public class ChmConsignmentService { | ... | @@ -629,7 +635,7 @@ public class ChmConsignmentService { |
| 629 | log.info("主单"+ fedexMawb.getBillNo()+" 更新成功,chmConsignmentId:"+updateResult.getId()); | 635 | log.info("主单"+ fedexMawb.getBillNo()+" 更新成功,chmConsignmentId:"+updateResult.getId()); |
| 630 | }else{ | 636 | }else{ |
| 631 | log.info("主单"+ fedexMawb.getBillNo()+" 更新失败"); | 637 | log.info("主单"+ fedexMawb.getBillNo()+" 更新失败"); |
| 632 | - result.setCode("30003"); | 638 | + result.setCode(ErrorCodeEnum.ERROR_30003.getCode()); |
| 633 | result.setMsg("主单"+ fedexMawb.getBillNo()+" 更新失败"); | 639 | result.setMsg("主单"+ fedexMawb.getBillNo()+" 更新失败"); |
| 634 | return result; | 640 | return result; |
| 635 | } | 641 | } | ... | ... |
| 1 | package com.erry.iclear.dateInterface.service; | 1 | package com.erry.iclear.dateInterface.service; |
| 2 | 2 | ||
| 3 | -import com.alibaba.fastjson.JSON; | 3 | +import com.erry.iclear.dateInterface.enums.ErrorCodeEnum; |
| 4 | -import com.arronlong.httpclientutil.HttpClientUtil; | ||
| 5 | -import com.arronlong.httpclientutil.common.HttpConfig; | ||
| 6 | -import com.arronlong.httpclientutil.common.HttpHeader; | ||
| 7 | import com.erry.iclear.dateInterface.api.request.*; | 4 | import com.erry.iclear.dateInterface.api.request.*; |
| 8 | import com.erry.iclear.dateInterface.api.response.IClearCheckResponseResult; | 5 | import com.erry.iclear.dateInterface.api.response.IClearCheckResponseResult; |
| 9 | 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; | ||
| 10 | import com.erry.iclear.dateInterface.entity.ChmConsignment; | 8 | import com.erry.iclear.dateInterface.entity.ChmConsignment; |
| 11 | import com.erry.iclear.dateInterface.entity.ChmConsignmentDetail; | 9 | import com.erry.iclear.dateInterface.entity.ChmConsignmentDetail; |
| 12 | import com.erry.iclear.dateInterface.repository.FedexMawbRepository; | 10 | import com.erry.iclear.dateInterface.repository.FedexMawbRepository; |
| 13 | import com.erry.iclear.dateInterface.util.HttpUtils; | 11 | import com.erry.iclear.dateInterface.util.HttpUtils; |
| 14 | import com.erry.iclear.dateInterface.util.JsonToJava; | 12 | import com.erry.iclear.dateInterface.util.JsonToJava; |
| 15 | import com.google.gson.Gson; | 13 | import com.google.gson.Gson; |
| 16 | -import io.swagger.annotations.ApiModelProperty; | ||
| 17 | import lombok.extern.slf4j.Slf4j; | 14 | import lombok.extern.slf4j.Slf4j; |
| 18 | import org.apache.commons.lang3.StringUtils; | 15 | import org.apache.commons.lang3.StringUtils; |
| 19 | -import org.apache.http.Header; | ||
| 20 | import org.springframework.beans.factory.annotation.Autowired; | 16 | import org.springframework.beans.factory.annotation.Autowired; |
| 21 | import org.springframework.beans.factory.annotation.Value; | 17 | import org.springframework.beans.factory.annotation.Value; |
| 22 | -import org.springframework.http.HttpEntity; | ||
| 23 | -import org.springframework.http.HttpHeaders; | ||
| 24 | -import org.springframework.http.HttpMethod; | ||
| 25 | -import org.springframework.http.ResponseEntity; | ||
| 26 | import org.springframework.stereotype.Service; | 18 | import org.springframework.stereotype.Service; |
| 27 | - | ||
| 28 | -import javax.persistence.*; | ||
| 29 | -import javax.validation.Valid; | ||
| 30 | -import javax.validation.constraints.NotBlank; | ||
| 31 | -import javax.validation.constraints.NotNull; | ||
| 32 | import java.util.*; | 19 | import java.util.*; |
| 33 | import java.util.stream.Collectors; | 20 | import java.util.stream.Collectors; |
| 34 | 21 | ||
| ... | @@ -126,16 +113,16 @@ public class FedexService { | ... | @@ -126,16 +113,16 @@ public class FedexService { |
| 126 | * @param fedexMawb | 113 | * @param fedexMawb |
| 127 | * @return | 114 | * @return |
| 128 | */ | 115 | */ |
| 129 | - public ResultRS checkFedexMawb(FedexMawb fedexMawb){ | 116 | + public ResultRS checkFedexMawb(FedexMawb fedexMawb,AppInfo appInfo){ |
| 130 | ResultRS result = new ResultRS(Boolean.FALSE,null,null); | 117 | ResultRS result = new ResultRS(Boolean.FALSE,null,null); |
| 131 | try{ | 118 | try{ |
| 132 | log.info("checkMawb start>>>>>>>>>> mawb:"+gson.toJson(fedexMawb)); | 119 | log.info("checkMawb start>>>>>>>>>> mawb:"+gson.toJson(fedexMawb)); |
| 133 | 120 | ||
| 134 | //1、将请求转换为运单 | 121 | //1、将请求转换为运单 |
| 135 | - ChmConsignment chmConsignment=consignmentService.convertToChmConsignmentFedex(fedexMawb,null,"IDE-ICLEAR-API"); | 122 | + ChmConsignment chmConsignment=consignmentService.convertToChmConsignmentFedex(fedexMawb,null,"IDE-ICLEAR-API",appInfo); |
| 136 | if(Objects.equals(chmConsignment,null)){ | 123 | if(Objects.equals(chmConsignment,null)){ |
| 137 | - result.setCode("30001"); | 124 | + result.setCode(ErrorCodeEnum.ERROR_7.getCode()); |
| 138 | - result.setMsg("数据格式不正确"); | 125 | + result.setMsg(ErrorCodeEnum.ERROR_7.getName()); |
| 139 | return result; | 126 | return result; |
| 140 | } | 127 | } |
| 141 | List<ChmConsignmentDetail> chmConsignmentDetailList = new ArrayList<>(); | 128 | List<ChmConsignmentDetail> chmConsignmentDetailList = new ArrayList<>(); |
| ... | @@ -180,18 +167,20 @@ public class FedexService { | ... | @@ -180,18 +167,20 @@ public class FedexService { |
| 180 | * @param fedexc | 167 | * @param fedexc |
| 181 | * @return | 168 | * @return |
| 182 | */ | 169 | */ |
| 183 | - public ResultRS checkBasfInterfaceData(Fedexc fedexc){ | 170 | + public ResultRS checkBasfInterfaceData(Fedexc fedexc, AppInfo appInfo){ |
| 184 | 171 | ||
| 185 | - ResultRS result = new ResultRS(Boolean.FALSE,"",""); | 172 | + ResultRS result = new ResultRS(Boolean.TRUE,null,null); |
| 186 | 173 | ||
| 187 | if(Objects.equals(fedexc,null)){ | 174 | if(Objects.equals(fedexc,null)){ |
| 188 | - result.setCode("-7"); | 175 | + result.setCode(ErrorCodeEnum.ERROR_7.getCode()); |
| 189 | - result.setMsg("请求信息不能为空"); | 176 | + result.setMsg(ErrorCodeEnum.ERROR_7.getName()); |
| 177 | + result.setSuccess(Boolean.FALSE); | ||
| 190 | }else{ | 178 | }else{ |
| 191 | List<String> msgList = new ArrayList<>(); | 179 | List<String> msgList = new ArrayList<>(); |
| 192 | // 参数consignmentCode不能为空 | 180 | // 参数consignmentCode不能为空 |
| 193 | String consignmentCode = fedexc.getConsignmentCode(); | 181 | String consignmentCode = fedexc.getConsignmentCode(); |
| 194 | - if(StringUtils.isEmpty(consignmentCode)){ | 182 | + //C类校验是否校验运单号,非空则不校验 |
| 183 | + if(appInfo.getCodeCheck() == null && StringUtils.isEmpty(consignmentCode)){ | ||
| 195 | msgList.add("参数consignmentCode不能为空"); | 184 | msgList.add("参数consignmentCode不能为空"); |
| 196 | } | 185 | } |
| 197 | // 参数consignmentId不能为空 | 186 | // 参数consignmentId不能为空 |
| ... | @@ -216,8 +205,9 @@ public class FedexService { | ... | @@ -216,8 +205,9 @@ public class FedexService { |
| 216 | } | 205 | } |
| 217 | if(msgList.size() > 0){ | 206 | if(msgList.size() > 0){ |
| 218 | String join = msgList.stream().collect(Collectors.joining(";")); | 207 | String join = msgList.stream().collect(Collectors.joining(";")); |
| 219 | - result.setCode("-7"); | 208 | + result.setCode(ErrorCodeEnum.ERROR_7.getCode()); |
| 220 | result.setMsg(join); | 209 | result.setMsg(join); |
| 210 | + result.setSuccess(Boolean.FALSE); | ||
| 221 | } | 211 | } |
| 222 | } | 212 | } |
| 223 | return result; | 213 | return result; | ... | ... |
| 1 | package com.erry.iclear.dateInterface.service; | 1 | package com.erry.iclear.dateInterface.service; |
| 2 | 2 | ||
| 3 | +import com.erry.iclear.dateInterface.enums.ErrorCodeEnum; | ||
| 4 | +import com.erry.iclear.dateInterface.api.request.HsCodeParam; | ||
| 3 | import com.erry.iclear.dateInterface.api.response.ResultHsCode; | 5 | import com.erry.iclear.dateInterface.api.response.ResultHsCode; |
| 6 | +import com.erry.iclear.dateInterface.common.Constant; | ||
| 4 | import com.erry.iclear.dateInterface.entity.HsCode; | 7 | import com.erry.iclear.dateInterface.entity.HsCode; |
| 8 | +import com.erry.iclear.dateInterface.repository.DictionaryEntriesRepository; | ||
| 5 | import com.erry.iclear.dateInterface.repository.HsCodeRepository; | 9 | import com.erry.iclear.dateInterface.repository.HsCodeRepository; |
| 10 | +import com.erry.iclear.dateInterface.util.StringUtil; | ||
| 6 | import lombok.extern.slf4j.Slf4j; | 11 | import lombok.extern.slf4j.Slf4j; |
| 7 | import org.springframework.beans.factory.annotation.Autowired; | 12 | import org.springframework.beans.factory.annotation.Autowired; |
| 8 | import org.springframework.stereotype.Service; | 13 | import org.springframework.stereotype.Service; |
| 9 | -import java.util.Arrays; | 14 | + |
| 10 | -import java.util.List; | 15 | +import java.util.*; |
| 11 | 16 | ||
| 12 | /** | 17 | /** |
| 13 | * hscode service | 18 | * hscode service |
| ... | @@ -17,8 +22,12 @@ import java.util.List; | ... | @@ -17,8 +22,12 @@ import java.util.List; |
| 17 | @Service | 22 | @Service |
| 18 | @Slf4j | 23 | @Slf4j |
| 19 | public class HsCodeService { | 24 | public class HsCodeService { |
| 25 | + | ||
| 20 | @Autowired | 26 | @Autowired |
| 21 | HsCodeRepository hsCodeRepository; | 27 | HsCodeRepository hsCodeRepository; |
| 28 | + @Autowired | ||
| 29 | + DictionaryEntriesRepository dicEntriesRepository; | ||
| 30 | + | ||
| 22 | /** | 31 | /** |
| 23 | * 根据hscode编码查询对应的hscode | 32 | * 根据hscode编码查询对应的hscode |
| 24 | * @param hscode | 33 | * @param hscode |
| ... | @@ -28,14 +37,14 @@ public class HsCodeService { | ... | @@ -28,14 +37,14 @@ public class HsCodeService { |
| 28 | ResultHsCode resultHsCode = new ResultHsCode(Boolean.FALSE,"","",null); | 37 | ResultHsCode resultHsCode = new ResultHsCode(Boolean.FALSE,"","",null); |
| 29 | try{ | 38 | try{ |
| 30 | if(hscode.length() > 2000){ | 39 | if(hscode.length() > 2000){ |
| 31 | - resultHsCode.setCode("30102"); | 40 | + resultHsCode.setCode(ErrorCodeEnum.ERROR_30102.getCode()); |
| 32 | - resultHsCode.setMsg("参数:hscode编码字段长度超过2000"); | 41 | + resultHsCode.setMsg(ErrorCodeEnum.ERROR_30102.getName()); |
| 33 | return resultHsCode; | 42 | return resultHsCode; |
| 34 | } | 43 | } |
| 35 | String[] hscodeArrays = hscode.split(","); | 44 | String[] hscodeArrays = hscode.split(","); |
| 36 | if(hscodeArrays.length > 100){ | 45 | if(hscodeArrays.length > 100){ |
| 37 | - resultHsCode.setCode("30100"); | 46 | + resultHsCode.setCode(ErrorCodeEnum.ERROR_30100.getCode()); |
| 38 | - resultHsCode.setMsg("hscode编码个数超过100个"); | 47 | + resultHsCode.setMsg(ErrorCodeEnum.ERROR_30100.getName()); |
| 39 | return resultHsCode; | 48 | return resultHsCode; |
| 40 | } | 49 | } |
| 41 | List<String> skuCodeList = Arrays.asList(hscodeArrays); | 50 | List<String> skuCodeList = Arrays.asList(hscodeArrays); |
| ... | @@ -56,15 +65,75 @@ public class HsCodeService { | ... | @@ -56,15 +65,75 @@ public class HsCodeService { |
| 56 | hsCodeList.add(hsCode); | 65 | hsCodeList.add(hsCode); |
| 57 | } | 66 | } |
| 58 | }); | 67 | }); |
| 68 | + //只能申报D类hscode监管条件hscode | ||
| 69 | + this.setHscodeSupervise(hsCodeList); | ||
| 70 | + resultHsCode.setSuccess(Boolean.TRUE); | ||
| 71 | + resultHsCode.setCode(ErrorCodeEnum.SUCCESS.getCode()); | ||
| 72 | + resultHsCode.setMsg(ErrorCodeEnum.SUCCESS.getName()); | ||
| 73 | + resultHsCode.setHsCodeResultList(hsCodeList); | ||
| 74 | + }catch(Exception ex){ | ||
| 75 | + log.error(ex.getMessage(),ex); | ||
| 76 | + resultHsCode.setSuccess(Boolean.FALSE); | ||
| 77 | + resultHsCode.setCode(ErrorCodeEnum.ERROR_30101.getCode()); | ||
| 78 | + resultHsCode.setMsg(ErrorCodeEnum.ERROR_30101.getName()); | ||
| 79 | + } | ||
| 80 | + return resultHsCode; | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + /** | ||
| 84 | + * 根据hscode编码或者商品名称进行模糊查询 | ||
| 85 | + * @param hscode | ||
| 86 | + * @return | ||
| 87 | + */ | ||
| 88 | + public ResultHsCode fuzzyQueryHsCode(HsCodeParam hscode){ | ||
| 89 | + ResultHsCode resultHsCode = new ResultHsCode(Boolean.FALSE,"","",null); | ||
| 90 | + try{ | ||
| 91 | + //编码与品名都为空校验失败 | ||
| 92 | + if(StringUtil.isEmpty(hscode.getSkuCode()) && StringUtil.isEmpty(hscode.getSkuName())){ | ||
| 93 | + resultHsCode.setCode(ErrorCodeEnum.ERROR_30103.getCode()); | ||
| 94 | + resultHsCode.setMsg(ErrorCodeEnum.ERROR_30103.getName()); | ||
| 95 | + return resultHsCode; | ||
| 96 | + } | ||
| 97 | + //编码长度大于50校验失败 | ||
| 98 | + if(!StringUtil.isEmpty(hscode.getSkuCode()) && hscode.getSkuCode().length() > 50){ | ||
| 99 | + resultHsCode.setCode(ErrorCodeEnum.ERROR_30104.getCode()); | ||
| 100 | + resultHsCode.setMsg(ErrorCodeEnum.ERROR_30104.getName()); | ||
| 101 | + return resultHsCode; | ||
| 102 | + } | ||
| 103 | + //品名长度大于1000校验失败 | ||
| 104 | + if(!StringUtil.isEmpty(hscode.getSkuName()) && hscode.getSkuName().length() > 1000){ | ||
| 105 | + resultHsCode.setCode(ErrorCodeEnum.ERROR_30104.getCode()); | ||
| 106 | + resultHsCode.setMsg(ErrorCodeEnum.ERROR_30104.getName()); | ||
| 107 | + return resultHsCode; | ||
| 108 | + } | ||
| 109 | + //编码长度小于4位字符校验失败 | ||
| 110 | + if(!StringUtil.isEmpty(hscode.getSkuCode()) && hscode.getSkuCode().length() < 4){ | ||
| 111 | + resultHsCode.setCode(ErrorCodeEnum.ERROR_30105.getCode()); | ||
| 112 | + resultHsCode.setMsg(ErrorCodeEnum.ERROR_30105.getName()); | ||
| 113 | + return resultHsCode; | ||
| 114 | + } | ||
| 115 | + //品名长度小于2位字符校验失败 | ||
| 116 | + if(!StringUtil.isEmpty(hscode.getSkuName()) && hscode.getSkuName().length() < 2){ | ||
| 117 | + resultHsCode.setCode(ErrorCodeEnum.ERROR_30105.getCode()); | ||
| 118 | + resultHsCode.setMsg(ErrorCodeEnum.ERROR_30105.getName()); | ||
| 119 | + return resultHsCode; | ||
| 120 | + } | ||
| 121 | + String skuCode = "%"+hscode.getSkuCode()+"%"; | ||
| 122 | + String skuName = "%"+hscode.getSkuName()+"%"; | ||
| 123 | + //模糊查询hscode信息 | ||
| 124 | + List<HsCode> hsCodeList = this.hsCodeRepository.fuzzyQueryHsCode(skuCode,skuName); | ||
| 125 | + //对查询数据进行处理,标志数据是否C类限制品名 | ||
| 126 | + //只能申报D类hscode监管条件hscode | ||
| 127 | + this.setHscodeSupervise(hsCodeList); | ||
| 59 | resultHsCode.setSuccess(Boolean.TRUE); | 128 | resultHsCode.setSuccess(Boolean.TRUE); |
| 60 | - resultHsCode.setCode("0"); | 129 | + resultHsCode.setCode(ErrorCodeEnum.SUCCESS.getCode()); |
| 61 | - resultHsCode.setMsg("操作成功"); | 130 | + resultHsCode.setMsg(ErrorCodeEnum.SUCCESS.getName()); |
| 62 | resultHsCode.setHsCodeResultList(hsCodeList); | 131 | resultHsCode.setHsCodeResultList(hsCodeList); |
| 63 | }catch(Exception ex){ | 132 | }catch(Exception ex){ |
| 64 | log.error(ex.getMessage(),ex); | 133 | log.error(ex.getMessage(),ex); |
| 65 | resultHsCode.setSuccess(Boolean.FALSE); | 134 | resultHsCode.setSuccess(Boolean.FALSE); |
| 66 | - resultHsCode.setCode("30101"); | 135 | + resultHsCode.setCode(ErrorCodeEnum.ERROR_30101.getCode()); |
| 67 | - resultHsCode.setMsg("数据查询异常"); | 136 | + resultHsCode.setMsg(ErrorCodeEnum.ERROR_30101.getName()); |
| 68 | } | 137 | } |
| 69 | return resultHsCode; | 138 | return resultHsCode; |
| 70 | } | 139 | } |
| ... | @@ -78,15 +147,105 @@ public class HsCodeService { | ... | @@ -78,15 +147,105 @@ public class HsCodeService { |
| 78 | try{ | 147 | try{ |
| 79 | List<HsCode> hsCodeList = this.hsCodeRepository.findAllHsCodeList(); | 148 | List<HsCode> hsCodeList = this.hsCodeRepository.findAllHsCodeList(); |
| 80 | resultHsCode.setSuccess(Boolean.TRUE); | 149 | resultHsCode.setSuccess(Boolean.TRUE); |
| 81 | - resultHsCode.setCode("0"); | 150 | + resultHsCode.setCode(ErrorCodeEnum.SUCCESS.getCode()); |
| 82 | - resultHsCode.setMsg("操作成功"); | 151 | + resultHsCode.setMsg(ErrorCodeEnum.SUCCESS.getName()); |
| 83 | resultHsCode.setHsCodeResultList(hsCodeList); | 152 | resultHsCode.setHsCodeResultList(hsCodeList); |
| 84 | }catch(Exception ex){ | 153 | }catch(Exception ex){ |
| 85 | log.error(ex.getMessage(),ex); | 154 | log.error(ex.getMessage(),ex); |
| 86 | resultHsCode.setSuccess(Boolean.FALSE); | 155 | resultHsCode.setSuccess(Boolean.FALSE); |
| 87 | - resultHsCode.setCode("30101"); | 156 | + resultHsCode.setCode(ErrorCodeEnum.ERROR_30101.getCode()); |
| 88 | - resultHsCode.setMsg("数据查询异常"); | 157 | + resultHsCode.setMsg(ErrorCodeEnum.ERROR_30101.getName()); |
| 89 | } | 158 | } |
| 90 | return resultHsCode; | 159 | return resultHsCode; |
| 91 | } | 160 | } |
| 92 | -} | 161 | + |
| 162 | + /** | ||
| 163 | + * 只能申报D类hscode监管条件hscode | ||
| 164 | + * 设置hscode | ||
| 165 | + * mt | ||
| 166 | + * 2023年2月24日17:29:49 | ||
| 167 | + */ | ||
| 168 | + public void setHscodeSupervise(List<HsCode> hsCodeList){ | ||
| 169 | + List<Long> hsCodeIds = new ArrayList<>(); | ||
| 170 | + Map<String,Object> hscodeMap = this.getHscodeSupervise(); | ||
| 171 | + StringBuffer shsql = new StringBuffer("'"); | ||
| 172 | + if (hscodeMap !=null && hscodeMap.size()>0){ | ||
| 173 | + for (Map.Entry hscodeEntry :hscodeMap.entrySet()){ | ||
| 174 | + HsCode hsCode = (HsCode) hscodeEntry.getValue(); | ||
| 175 | + hsCodeIds.add(hsCode.getId()); | ||
| 176 | + } | ||
| 177 | + } | ||
| 178 | + hsCodeList.forEach(hsCode->{ | ||
| 179 | + //判断该hscode是否只能申报D类 | ||
| 180 | + if(hsCodeIds.contains(hsCode.getId())){ | ||
| 181 | + //d类 | ||
| 182 | + hsCode.setRestrictedC(1); | ||
| 183 | + }else{ | ||
| 184 | + //C类 | ||
| 185 | + hsCode.setRestrictedC(0); | ||
| 186 | + } | ||
| 187 | + //如果ID为空,则设置为空 | ||
| 188 | + if(hsCode.getId() == null){ | ||
| 189 | + hsCode.setRestrictedC(null); | ||
| 190 | + } | ||
| 191 | + }); | ||
| 192 | + } | ||
| 193 | + | ||
| 194 | + /** | ||
| 195 | + * 根据监管条件获取数据,只能申报D类hscode信息 | ||
| 196 | + * mt | ||
| 197 | + * 2023年2月24日16:43:46 | ||
| 198 | + * @return | ||
| 199 | + */ | ||
| 200 | + private Map<String,Object> getHscodeSupervise(){ | ||
| 201 | + try { | ||
| 202 | + Map<String,Object> returnMap = new HashMap<>(); | ||
| 203 | + List<String> dictionaryEntriesList = dicEntriesRepository.findDicEntByCodeList(Constant.supervise_condition,1); | ||
| 204 | + if (dictionaryEntriesList !=null && dictionaryEntriesList.size()>0){ | ||
| 205 | + String chinsesName = "%["; | ||
| 206 | + for (int i= 0;i<dictionaryEntriesList.size();i++){ | ||
| 207 | + if (dictionaryEntriesList.size() -1 == i){ | ||
| 208 | + chinsesName += dictionaryEntriesList.get(i)+"]%"; | ||
| 209 | + }else{ | ||
| 210 | + chinsesName += dictionaryEntriesList.get(i)+"|"; | ||
| 211 | + } | ||
| 212 | + } | ||
| 213 | + //查询监管条件数据 | ||
| 214 | + List<HsCode> hsCodeList = this.hsCodeRepository.findMonitorCondition(chinsesName); | ||
| 215 | + hsCodeList.forEach(hsCode->{ | ||
| 216 | + String newCode = getSubHscode(hsCode.getSkuCode()); | ||
| 217 | + returnMap.put(newCode,hsCode); | ||
| 218 | + }); | ||
| 219 | + } | ||
| 220 | + return returnMap; | ||
| 221 | + }catch (Exception e){ | ||
| 222 | + log.error(e.getMessage(),e); | ||
| 223 | + } | ||
| 224 | + return null; | ||
| 225 | + } | ||
| 226 | + | ||
| 227 | + /** | ||
| 228 | + * 对商品编码进行处理 | ||
| 229 | + * @param code | ||
| 230 | + * @return | ||
| 231 | + */ | ||
| 232 | + private String getSubHscode(String code){ | ||
| 233 | + try { | ||
| 234 | + if (!StringUtil.isEmptyWithTrim(code) && code.length()>6) { | ||
| 235 | + if (code.length() == 7) { | ||
| 236 | + code = "0" + code + "00"; | ||
| 237 | + } else if (code.length() == 8) { | ||
| 238 | + code = code + "00"; | ||
| 239 | + } else if (code.length() == 9) { | ||
| 240 | + code = "0" + code; | ||
| 241 | + } else if (code.length() > 10) { | ||
| 242 | + code = code.substring(0, 10); | ||
| 243 | + } | ||
| 244 | + return code; | ||
| 245 | + } | ||
| 246 | + }catch (Exception e){ | ||
| 247 | + log.error(e.getMessage(),e); | ||
| 248 | + } | ||
| 249 | + return null; | ||
| 250 | + } | ||
| 251 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -36,10 +36,10 @@ public class IClearApiHsCodeLogService { | ... | @@ -36,10 +36,10 @@ public class IClearApiHsCodeLogService { |
| 36 | * 查询日志,最近10分钟如果有查询过全量hscode则返回true | 36 | * 查询日志,最近10分钟如果有查询过全量hscode则返回true |
| 37 | * @return | 37 | * @return |
| 38 | */ | 38 | */ |
| 39 | - public boolean findIClearApiHsCodeLog(){ | 39 | + public boolean findIClearApiHsCodeLog(String appId){ |
| 40 | boolean rs = false; | 40 | boolean rs = false; |
| 41 | try{ | 41 | try{ |
| 42 | - Long count = iClearApiHsCodeLogRepository.findIClearApiHsCodeLog(DateUtils.getAfter10()); | 42 | + Long count = iClearApiHsCodeLogRepository.findIClearApiHsCodeLog(DateUtils.getAfter10(),appId); |
| 43 | if(count > 0){ | 43 | if(count > 0){ |
| 44 | rs = true; | 44 | rs = true; |
| 45 | } | 45 | } | ... | ... |
| ... | @@ -5,12 +5,10 @@ import com.erry.iclear.dateInterface.api.request.MawbDetail; | ... | @@ -5,12 +5,10 @@ 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; | ||
| 9 | import org.springframework.beans.factory.annotation.Autowired; | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 10 | import org.springframework.stereotype.Service; | 9 | import org.springframework.stereotype.Service; |
| 11 | 10 | ||
| 12 | import java.util.List; | 11 | import java.util.List; |
| 13 | -import java.util.Objects; | ||
| 14 | 12 | ||
| 15 | /** | 13 | /** |
| 16 | * @author Administrator | 14 | * @author Administrator |
| ... | @@ -18,39 +16,21 @@ import java.util.Objects; | ... | @@ -18,39 +16,21 @@ import java.util.Objects; |
| 18 | @Service | 16 | @Service |
| 19 | @Slf4j | 17 | @Slf4j |
| 20 | public class MawbDetailService { | 18 | public class MawbDetailService { |
| 21 | - | ||
| 22 | @Autowired | 19 | @Autowired |
| 23 | private MawbDetailRepository mawbDetailRepository; | 20 | private MawbDetailRepository mawbDetailRepository; |
| 24 | 21 | ||
| 25 | public void saveMawbDetail(List<MawbDetail> mawbDetailList){ | 22 | public void saveMawbDetail(List<MawbDetail> mawbDetailList){ |
| 26 | log.info(""); | 23 | log.info(""); |
| 27 | - | ||
| 28 | log.info(""); | 24 | log.info(""); |
| 29 | - | ||
| 30 | } | 25 | } |
| 31 | 26 | ||
| 32 | - | ||
| 33 | public ResultRS checkMawbDetail(Mawb mawb){ | 27 | public ResultRS checkMawbDetail(Mawb mawb){ |
| 34 | - ResultRS result = new ResultRS(Boolean.FALSE,"30002",null); | 28 | + ResultRS result = new ResultRS(Boolean.FALSE,null,null); |
| 35 | try{ | 29 | try{ |
| 36 | - for (MawbDetail detail : mawb.getMawbDetailList()) { | ||
| 37 | - String secondUnit = detail.getSecondUnit(); | ||
| 38 | - if (StringUtils.isNotEmpty(secondUnit)) { | ||
| 39 | - | ||
| 40 | - Integer secondQty = detail.getSecondQty(); | ||
| 41 | - if (Objects.isNull(secondQty)) { | ||
| 42 | - result.setMsg("参数secondQty不能为空"); | ||
| 43 | - return result; | ||
| 44 | - } | ||
| 45 | - } | ||
| 46 | - } | ||
| 47 | result.setSuccess(Boolean.TRUE); | 30 | result.setSuccess(Boolean.TRUE); |
| 48 | }catch (Exception e){ | 31 | }catch (Exception e){ |
| 49 | log.error("checkMawbDetail() error:"+e.getMessage()); | 32 | log.error("checkMawbDetail() error:"+e.getMessage()); |
| 50 | } | 33 | } |
| 51 | - | ||
| 52 | return result; | 34 | return result; |
| 53 | } | 35 | } |
| 54 | - | 36 | +} |
| 55 | - | ||
| 56 | -} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| 1 | package com.erry.iclear.dateInterface.service; | 1 | package com.erry.iclear.dateInterface.service; |
| 2 | 2 | ||
| 3 | -import com.arronlong.httpclientutil.HttpClientUtil; | 3 | +import com.erry.iclear.dateInterface.enums.ErrorCodeEnum; |
| 4 | -import com.arronlong.httpclientutil.common.HttpConfig; | ||
| 5 | -import com.arronlong.httpclientutil.common.HttpHeader; | ||
| 6 | import com.erry.iclear.dateInterface.api.request.Mawb; | 4 | import com.erry.iclear.dateInterface.api.request.Mawb; |
| 7 | import com.erry.iclear.dateInterface.api.request.MawbDetail; | 5 | import com.erry.iclear.dateInterface.api.request.MawbDetail; |
| 8 | import com.erry.iclear.dateInterface.api.response.IClearCheckResponseResult; | 6 | import com.erry.iclear.dateInterface.api.response.IClearCheckResponseResult; |
| ... | @@ -15,7 +13,6 @@ import com.erry.iclear.dateInterface.util.JsonToJava; | ... | @@ -15,7 +13,6 @@ import com.erry.iclear.dateInterface.util.JsonToJava; |
| 15 | import com.erry.iclear.dateInterface.util.StringUtil; | 13 | import com.erry.iclear.dateInterface.util.StringUtil; |
| 16 | import com.google.gson.Gson; | 14 | import com.google.gson.Gson; |
| 17 | import lombok.extern.slf4j.Slf4j; | 15 | import lombok.extern.slf4j.Slf4j; |
| 18 | -import org.apache.http.Header; | ||
| 19 | import org.springframework.beans.factory.annotation.Autowired; | 16 | import org.springframework.beans.factory.annotation.Autowired; |
| 20 | import org.springframework.beans.factory.annotation.Value; | 17 | import org.springframework.beans.factory.annotation.Value; |
| 21 | import org.springframework.stereotype.Service; | 18 | import org.springframework.stereotype.Service; |
| ... | @@ -166,11 +163,9 @@ public class MawbService { | ... | @@ -166,11 +163,9 @@ public class MawbService { |
| 166 | } | 163 | } |
| 167 | } | 164 | } |
| 168 | } | 165 | } |
| 169 | - | ||
| 170 | return ""; | 166 | return ""; |
| 171 | } | 167 | } |
| 172 | 168 | ||
| 173 | - | ||
| 174 | /** | 169 | /** |
| 175 | * 校验主单 | 170 | * 校验主单 |
| 176 | * @param mawb | 171 | * @param mawb |
| ... | @@ -180,12 +175,11 @@ public class MawbService { | ... | @@ -180,12 +175,11 @@ public class MawbService { |
| 180 | ResultRS result = new ResultRS(Boolean.FALSE,null,null); | 175 | ResultRS result = new ResultRS(Boolean.FALSE,null,null); |
| 181 | try{ | 176 | try{ |
| 182 | log.info("checkMawb start>>>>>>>>>> mawb:"+gson.toJson(mawb)); | 177 | log.info("checkMawb start>>>>>>>>>> mawb:"+gson.toJson(mawb)); |
| 183 | - | ||
| 184 | //1、将请求转换为运单 | 178 | //1、将请求转换为运单 |
| 185 | ChmConsignment chmConsignment=consignmentService.convertToChmConsignment(mawb,null,"IDE-ICLEAR-API"); | 179 | ChmConsignment chmConsignment=consignmentService.convertToChmConsignment(mawb,null,"IDE-ICLEAR-API"); |
| 186 | if(Objects.equals(chmConsignment,null)){ | 180 | if(Objects.equals(chmConsignment,null)){ |
| 187 | - result.setCode("30001"); | 181 | + result.setCode(ErrorCodeEnum.ERROR_30001.getCode()); |
| 188 | - result.setMsg("数据格式不正确"); | 182 | + result.setMsg(ErrorCodeEnum.ERROR_30001.getName()); |
| 189 | return result; | 183 | return result; |
| 190 | } | 184 | } |
| 191 | //校验成交方式 成交方式为CIF时 '参数feeCurr不能为空','参数feeMark不能为空'',参数feeRate不能为空','参数insurCurr不能为空', '参数insurRate不能为空' | 185 | //校验成交方式 成交方式为CIF时 '参数feeCurr不能为空','参数feeMark不能为空'',参数feeRate不能为空','参数insurCurr不能为空', '参数insurRate不能为空' |
| ... | @@ -193,13 +187,11 @@ public class MawbService { | ... | @@ -193,13 +187,11 @@ public class MawbService { |
| 193 | if(!result.getSuccess()){ | 187 | if(!result.getSuccess()){ |
| 194 | return result; | 188 | return result; |
| 195 | } | 189 | } |
| 196 | - | ||
| 197 | List<ChmConsignmentDetail> chmConsignmentDetailList = new ArrayList<>(); | 190 | List<ChmConsignmentDetail> chmConsignmentDetailList = new ArrayList<>(); |
| 198 | mawb.getMawbDetailList().forEach(detail ->{ | 191 | mawb.getMawbDetailList().forEach(detail ->{ |
| 199 | chmConsignmentDetailList.add(consignmentDetailService.convertToChmConsignmentDetail(detail,chmConsignment)); | 192 | chmConsignmentDetailList.add(consignmentDetailService.convertToChmConsignmentDetail(detail,chmConsignment)); |
| 200 | }); | 193 | }); |
| 201 | chmConsignment.setChmConsignmentDetailList(chmConsignmentDetailList); | 194 | chmConsignment.setChmConsignmentDetailList(chmConsignmentDetailList); |
| 202 | - | ||
| 203 | //调用IClear接口进行运单数据校验 | 195 | //调用IClear接口进行运单数据校验 |
| 204 | String objJson = JsonToJava.toJson(chmConsignment); | 196 | String objJson = JsonToJava.toJson(chmConsignment); |
| 205 | // Header[] headers = HttpHeader.custom() | 197 | // Header[] headers = HttpHeader.custom() |
| ... | @@ -213,13 +205,9 @@ public class MawbService { | ... | @@ -213,13 +205,9 @@ public class MawbService { |
| 213 | // .encoding("utf-8") | 205 | // .encoding("utf-8") |
| 214 | // .json(objJson); | 206 | // .json(objJson); |
| 215 | // String json = HttpClientUtil.post(config); | 207 | // String json = HttpClientUtil.post(config); |
| 216 | - | ||
| 217 | Map<String,String> headerMap = new HashMap<>(); | 208 | Map<String,String> headerMap = new HashMap<>(); |
| 218 | headerMap.put("Content-Type", "application/json"); | 209 | headerMap.put("Content-Type", "application/json"); |
| 219 | String json = HttpUtils.doPost(this.iclearCheckUrl,objJson,headerMap); | 210 | String json = HttpUtils.doPost(this.iclearCheckUrl,objJson,headerMap); |
| 220 | - | ||
| 221 | - | ||
| 222 | - | ||
| 223 | IClearCheckResponseResult iclearCheckResponseResult = JsonToJava.parseJson(json, IClearCheckResponseResult.class); | 211 | IClearCheckResponseResult iclearCheckResponseResult = JsonToJava.parseJson(json, IClearCheckResponseResult.class); |
| 224 | result.setSuccess(iclearCheckResponseResult.getSuccess()); | 212 | result.setSuccess(iclearCheckResponseResult.getSuccess()); |
| 225 | result.setCode(iclearCheckResponseResult.getCode()); | 213 | result.setCode(iclearCheckResponseResult.getCode()); |
| ... | @@ -243,23 +231,23 @@ public class MawbService { | ... | @@ -243,23 +231,23 @@ public class MawbService { |
| 243 | if(dealMode.equals("CIF、CIP、DDP、DDU、DAP")){ | 231 | if(dealMode.equals("CIF、CIP、DDP、DDU、DAP")){ |
| 244 | if(StringUtil.isEmpty(mawb.getFeeCurr())){ | 232 | if(StringUtil.isEmpty(mawb.getFeeCurr())){ |
| 245 | result.setSuccess(false); | 233 | result.setSuccess(false); |
| 246 | - result.setCode("30002"); | 234 | + result.setCode(ErrorCodeEnum.ERROR_30002.getCode()); |
| 247 | result.setMsg("运费币制不能为空"); | 235 | result.setMsg("运费币制不能为空"); |
| 248 | }else if(StringUtil.isEmpty(mawb.getFeeMark())){ | 236 | }else if(StringUtil.isEmpty(mawb.getFeeMark())){ |
| 249 | result.setSuccess(false); | 237 | result.setSuccess(false); |
| 250 | - result.setCode("30002"); | 238 | + result.setCode(ErrorCodeEnum.ERROR_30002.getCode()); |
| 251 | result.setMsg("运费标记不能为空"); | 239 | result.setMsg("运费标记不能为空"); |
| 252 | }else if(mawb.getFeeRate() == null){ | 240 | }else if(mawb.getFeeRate() == null){ |
| 253 | result.setSuccess(false); | 241 | result.setSuccess(false); |
| 254 | - result.setCode("30002"); | 242 | + result.setCode(ErrorCodeEnum.ERROR_30002.getCode()); |
| 255 | result.setMsg("运费/率不能为空"); | 243 | result.setMsg("运费/率不能为空"); |
| 256 | }else if(StringUtil.isEmpty(mawb.getInsurCurr())){ | 244 | }else if(StringUtil.isEmpty(mawb.getInsurCurr())){ |
| 257 | result.setSuccess(false); | 245 | result.setSuccess(false); |
| 258 | - result.setCode("30002"); | 246 | + result.setCode(ErrorCodeEnum.ERROR_30002.getCode()); |
| 259 | result.setMsg("保险费币制不能为空"); | 247 | result.setMsg("保险费币制不能为空"); |
| 260 | }else if(mawb.getInsurRate() == null){ | 248 | }else if(mawb.getInsurRate() == null){ |
| 261 | result.setSuccess(false); | 249 | result.setSuccess(false); |
| 262 | - result.setCode("30002"); | 250 | + result.setCode(ErrorCodeEnum.ERROR_30002.getCode()); |
| 263 | result.setMsg("保险费/率不能为空"); | 251 | result.setMsg("保险费/率不能为空"); |
| 264 | } | 252 | } |
| 265 | } | 253 | } | ... | ... |
| ... | @@ -34,8 +34,6 @@ public class OrigplacecodeMappingService { | ... | @@ -34,8 +34,6 @@ public class OrigplacecodeMappingService { |
| 34 | return result; | 34 | return result; |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | - | ||
| 38 | - | ||
| 39 | /** | 37 | /** |
| 40 | * 初始化DomesticDestinationMapping | 38 | * 初始化DomesticDestinationMapping |
| 41 | */ | 39 | */ |
| ... | @@ -50,13 +48,4 @@ public class OrigplacecodeMappingService { | ... | @@ -50,13 +48,4 @@ public class OrigplacecodeMappingService { |
| 50 | log.error("initDomesticDestinationMapping() error" + e.getMessage()); | 48 | log.error("initDomesticDestinationMapping() error" + e.getMessage()); |
| 51 | } | 49 | } |
| 52 | } | 50 | } |
| 53 | - | 51 | +} |
| 54 | - | ||
| 55 | - | ||
| 56 | - | ||
| 57 | - | ||
| 58 | - | ||
| 59 | - | ||
| 60 | - | ||
| 61 | - | ||
| 62 | -} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| 1 | package com.erry.iclear.dateInterface.task; | 1 | package com.erry.iclear.dateInterface.task; |
| 2 | 2 | ||
| 3 | -import com.alibaba.fastjson.JSONObject; | 3 | +import com.erry.iclear.dateInterface.enums.ErrorCodeEnum; |
| 4 | import com.erry.iclear.dateInterface.api.response.TokenResult; | 4 | import com.erry.iclear.dateInterface.api.response.TokenResult; |
| 5 | -import com.erry.iclear.dateInterface.common.Constants; | ||
| 6 | -import com.erry.iclear.dateInterface.entity.HsCode; | ||
| 7 | -import com.erry.iclear.dateInterface.repository.HsCodeRepository; | ||
| 8 | import com.erry.iclear.dateInterface.service.ApiService; | 5 | import com.erry.iclear.dateInterface.service.ApiService; |
| 9 | import lombok.extern.slf4j.Slf4j; | 6 | import lombok.extern.slf4j.Slf4j; |
| 10 | import org.springframework.beans.factory.annotation.Autowired; | 7 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | @@ -62,7 +59,7 @@ public class IClearApiTask { | ... | @@ -62,7 +59,7 @@ public class IClearApiTask { |
| 62 | try { | 59 | try { |
| 63 | //获取token | 60 | //获取token |
| 64 | TokenResult tokenResult = apiService.getToken(); | 61 | TokenResult tokenResult = apiService.getToken(); |
| 65 | - if(tokenResult.getErrorcode().equals(Constants.ApiResponseKeys.SUCCESS)){ | 62 | + if(tokenResult.getErrorcode().equals(ErrorCodeEnum.SUCCESS.getCode())){ |
| 66 | this.token = tokenResult.getData().getToken(); | 63 | this.token = tokenResult.getData().getToken(); |
| 67 | } | 64 | } |
| 68 | }catch(Exception ex){ | 65 | }catch(Exception ex){ | ... | ... |
| ... | @@ -8,13 +8,13 @@ spring.datasource.type=com.alibaba.druid.pool.DruidDataSource | ... | @@ -8,13 +8,13 @@ spring.datasource.type=com.alibaba.druid.pool.DruidDataSource |
| 8 | #spring.datasource.jndi-name=jdbc/iclearProdTestDS | 8 | #spring.datasource.jndi-name=jdbc/iclearProdTestDS |
| 9 | 9 | ||
| 10 | #推送海关回执 | 10 | #推送海关回执 |
| 11 | -task.pushCustomsTask=0 0/1 * 1 * ? | 11 | +task.pushCustomsTask=0 0/1 * * * ? |
| 12 | #推送完整报文 | 12 | #推送完整报文 |
| 13 | -task.pushMawbTask=0 0/1 * 1 * ? | 13 | +task.pushMawbTask=0 0/1 * * * ? |
| 14 | #推送失败的回执数据 | 14 | #推送失败的回执数据 |
| 15 | -task.pushErrorReturnDate=0 0/3 * 1 * ? | 15 | +task.pushErrorReturnDate=0 0/3 * * * ? |
| 16 | #推送失败的申报数据 | 16 | #推送失败的申报数据 |
| 17 | -task.pushErrorDeclareDate=0 0/3 * 1 * ? | 17 | +task.pushErrorDeclareDate=0 0/3 * * * ? |
| 18 | 18 | ||
| 19 | api.base-address=https://declarationuat.fedex.com.cn/Exp | 19 | api.base-address=https://declarationuat.fedex.com.cn/Exp |
| 20 | #获取token账号 | 20 | #获取token账号 | ... | ... |
| ... | @@ -3,7 +3,7 @@ spring.datasource.jndi-name=jdbc/iclearDS | ... | @@ -3,7 +3,7 @@ spring.datasource.jndi-name=jdbc/iclearDS |
| 3 | #推送海关回执 | 3 | #推送海关回执 |
| 4 | task.pushCustomsTask=0 0/1 * * * ? | 4 | task.pushCustomsTask=0 0/1 * * * ? |
| 5 | #推送完整报文 | 5 | #推送完整报文 |
| 6 | -task.pushMawbTask=0 0/1 * 1 * ? | 6 | +task.pushMawbTask=0 0/1 * * * ? |
| 7 | #推送失败的回执数据 | 7 | #推送失败的回执数据 |
| 8 | task.pushErrorReturnDate=0 0/30 * * * ? | 8 | task.pushErrorReturnDate=0 0/30 * * * ? |
| 9 | #推送失败的申报数据 | 9 | #推送失败的申报数据 | ... | ... |
| ... | @@ -3,7 +3,7 @@ spring.datasource.jndi-name=jdbc/iclearDS | ... | @@ -3,7 +3,7 @@ spring.datasource.jndi-name=jdbc/iclearDS |
| 3 | #推送海关回执 | 3 | #推送海关回执 |
| 4 | task.pushCustomsTask=0 0/1 * * * ? | 4 | task.pushCustomsTask=0 0/1 * * * ? |
| 5 | #推送完整报文 | 5 | #推送完整报文 |
| 6 | -task.pushMawbTask=0 0/1 * 1 * ? | 6 | +task.pushMawbTask=0 0/1 * * * ? |
| 7 | #推送失败的回执数据 | 7 | #推送失败的回执数据 |
| 8 | task.pushErrorReturnDate=0 0/3 * * * ? | 8 | task.pushErrorReturnDate=0 0/3 * * * ? |
| 9 | #推送失败的申报数据 | 9 | #推送失败的申报数据 | ... | ... |
| 1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <configuration> | 2 | <configuration> |
| 3 | <contextName>iClear-api</contextName> | 3 | <contextName>iClear-api</contextName> |
| 4 | - | 4 | + <!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径--> |
| 5 | + <property name="LOG_HOME" value="/var/fedex/dxpweb/weblogic/api/log/"/> | ||
| 5 | <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> | 6 | <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> |
| 6 | <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder"> | 7 | <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder"> |
| 7 | <layout class="ch.qos.logback.classic.PatternLayout"> | 8 | <layout class="ch.qos.logback.classic.PatternLayout"> |
| ... | @@ -15,9 +16,9 @@ | ... | @@ -15,9 +16,9 @@ |
| 15 | <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | 16 | <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| 16 | <prudent>false</prudent> | 17 | <prudent>false</prudent> |
| 17 | <append>true</append> | 18 | <append>true</append> |
| 18 | - <file>E:/api/logs/iClear-api.log</file> | 19 | + <file>${LOG_HOME}/iClear-api.log</file> |
| 19 | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | 20 | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| 20 | - <fileNamePattern>E:/api/logs/iClear-api-%d{yyyy-MM-dd}.%i.log</fileNamePattern> | 21 | + <fileNamePattern>${LOG_HOME}/iClear-api-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| 21 | <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> | 22 | <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
| 22 | <maxFileSize>500MB</maxFileSize> | 23 | <maxFileSize>500MB</maxFileSize> |
| 23 | </timeBasedFileNamingAndTriggeringPolicy> | 24 | </timeBasedFileNamingAndTriggeringPolicy> |
| ... | @@ -28,7 +29,6 @@ | ... | @@ -28,7 +29,6 @@ |
| 28 | <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level [%thread{0}] %c{0} - %msg%n</pattern> | 29 | <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level [%thread{0}] %c{0} - %msg%n</pattern> |
| 29 | <charset>utf-8</charset> | 30 | <charset>utf-8</charset> |
| 30 | </encoder> | 31 | </encoder> |
| 31 | - | ||
| 32 | </appender> | 32 | </appender> |
| 33 | 33 | ||
| 34 | <logger name="io.lettuce.core" level="ERROR" /> | 34 | <logger name="io.lettuce.core" level="ERROR" /> |
| ... | @@ -51,6 +51,4 @@ | ... | @@ -51,6 +51,4 @@ |
| 51 | <appender-ref ref="FILE"/> | 51 | <appender-ref ref="FILE"/> |
| 52 | </root> | 52 | </root> |
| 53 | </springProfile> | 53 | </springProfile> |
| 54 | - | ||
| 55 | - | ||
| 56 | </configuration> | 54 | </configuration> | ... | ... |
| ... | @@ -24,7 +24,7 @@ public class ApiTest { | ... | @@ -24,7 +24,7 @@ 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 = "1645153943"; | 27 | + public static String timeStamp = "1624263798669"; |
| 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 | //需要申请 |
| ... | @@ -33,7 +33,7 @@ public class ApiTest { | ... | @@ -33,7 +33,7 @@ public class ApiTest { |
| 33 | public static void main(String[] args) throws Exception{ | 33 | public static void main(String[] args) throws Exception{ |
| 34 | // BASF,iClearExportC,6db193cb4165a71b | 34 | // BASF,iClearExportC,6db193cb4165a71b |
| 35 | System.out.println(new Date(Long.valueOf(timeStamp))); | 35 | System.out.println(new Date(Long.valueOf(timeStamp))); |
| 36 | - String token = SHA256Util.getSHA256String("BASF" + "iClearExportC" + "b92131f03f19a348" + ApiTest.timeStamp); | 36 | + String token = SHA256Util.getSHA256String("DEMO1" + "iClearExportDemo1" + "8c7f1108316abfb1" + ApiTest.timeStamp); |
| 37 | System.out.println(token); | 37 | System.out.println(token); |
| 38 | 38 | ||
| 39 | //D类申报的数据落地接口 | 39 | //D类申报的数据落地接口 | ... | ... |
| ... | @@ -40,22 +40,22 @@ public class ChmConsignmentServiceTest extends IClearApiApplicationTests { | ... | @@ -40,22 +40,22 @@ public class ChmConsignmentServiceTest extends IClearApiApplicationTests { |
| 40 | 40 | ||
| 41 | @Test | 41 | @Test |
| 42 | public void testProcessChmConsignment1(){ | 42 | public void testProcessChmConsignment1(){ |
| 43 | - try{ | 43 | +// try{ |
| 44 | - ResultRS result = new ResultRS(Boolean.FALSE,"",""); | 44 | +// ResultRS result = new ResultRS(Boolean.FALSE,"",""); |
| 45 | - Fedexc fedexc = this.createNewFedex(); | 45 | +// Fedexc fedexc = this.createNewFedex(); |
| 46 | - FedexMawb mawb = fedexService.saveMawbFedex(fedexc); | 46 | +// FedexMawb mawb = fedexService.saveMawbFedex(fedexc); |
| 47 | - //Basfc fedexc = this.createNewBasf(); | 47 | +// //Basfc fedexc = this.createNewBasf(); |
| 48 | - String timeStamp = String.valueOf(new Date().getTime()); | 48 | +// String timeStamp = String.valueOf(new Date().getTime()); |
| 49 | - ResultRS resultRS = chmConsignmentService.processChmConsignmentFedex(mawb, timeStamp, "BASF"); | 49 | +// ResultRS resultRS = chmConsignmentService.processChmConsignmentFedex(mawb, timeStamp, "BASF"); |
| 50 | - /*result=fedexService.checkBasfMawb(mawb); | 50 | +// /*result=fedexService.checkBasfMawb(mawb); |
| 51 | - if(!result.getSuccess()){ | 51 | +// if(!result.getSuccess()){ |
| 52 | - System.out.println(result.getMsg()); | 52 | +// System.out.println(result.getMsg()); |
| 53 | - }*/ | 53 | +// }*/ |
| 54 | - System.out.println(resultRS.toString()); | 54 | +// System.out.println(resultRS.toString()); |
| 55 | - }catch (Exception e){ | 55 | +// }catch (Exception e){ |
| 56 | - e.printStackTrace(); | 56 | +// e.printStackTrace(); |
| 57 | - } | 57 | +// } |
| 58 | - System.out.println("1"); | 58 | +// System.out.println("1"); |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | private Fedexc createNewFedex(){ | 61 | private Fedexc createNewFedex(){ | ... | ... |
-
Please register or login to post a comment