Showing
9 changed files
with
58 additions
and
35 deletions
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 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -9,10 +9,8 @@ import com.erry.iclear.dateInterface.api.request.*; | ... | @@ -9,10 +9,8 @@ import com.erry.iclear.dateInterface.api.request.*; |
| 9 | import com.erry.iclear.dateInterface.api.response.FedexResultChmRS; | 9 | import com.erry.iclear.dateInterface.api.response.FedexResultChmRS; |
| 10 | import com.erry.iclear.dateInterface.api.response.FedexResultRS; | 10 | import com.erry.iclear.dateInterface.api.response.FedexResultRS; |
| 11 | import com.erry.iclear.dateInterface.api.response.ResultRS; | 11 | import com.erry.iclear.dateInterface.api.response.ResultRS; |
| 12 | -import com.erry.iclear.dateInterface.entity.ChmConsignment; | 12 | +import com.erry.iclear.dateInterface.common.Constant; |
| 13 | -import com.erry.iclear.dateInterface.entity.DeclaredInfo; | 13 | +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; | 14 | import com.erry.iclear.dateInterface.repository.ChmConsignmentRepository; |
| 17 | import com.erry.iclear.dateInterface.repository.IClearApiCheckLogRepository; | 15 | import com.erry.iclear.dateInterface.repository.IClearApiCheckLogRepository; |
| 18 | import com.erry.iclear.dateInterface.service.*; | 16 | import com.erry.iclear.dateInterface.service.*; |
| ... | @@ -77,6 +75,8 @@ public class FedexDataInterface { | ... | @@ -77,6 +75,8 @@ public class FedexDataInterface { |
| 77 | String token=(String) request.getHeader("Token"); | 75 | String token=(String) request.getHeader("Token"); |
| 78 | String addr = request.getRemoteAddr(); | 76 | String addr = request.getRemoteAddr(); |
| 79 | 77 | ||
| 78 | + //获取APPINFO信息 | ||
| 79 | + AppInfo appInfo = Constant.appInfoCache.get(appId + appKey); | ||
| 80 | 80 | ||
| 81 | TIClearApiCheckLog tIclearApiCheckLog = new TIClearApiCheckLog(); | 81 | TIClearApiCheckLog tIclearApiCheckLog = new TIClearApiCheckLog(); |
| 82 | tIclearApiCheckLog.setRequestAppid(appId); | 82 | tIclearApiCheckLog.setRequestAppid(appId); |
| ... | @@ -96,7 +96,7 @@ public class FedexDataInterface { | ... | @@ -96,7 +96,7 @@ public class FedexDataInterface { |
| 96 | log.info("checkBASFMawbFedex:"+fedexc.toString()); | 96 | log.info("checkBASFMawbFedex:"+fedexc.toString()); |
| 97 | log.info("appId:{},appKey:{},timeStamp:{},token:{}",appId,appKey,timeStamp,token); | 97 | log.info("appId:{},appKey:{},timeStamp:{},token:{}",appId,appKey,timeStamp,token); |
| 98 | 98 | ||
| 99 | - ResultRS result = fedexService.checkBasfInterfaceData(fedexc); | 99 | + ResultRS result = fedexService.checkBasfInterfaceData(fedexc,appInfo); |
| 100 | 100 | ||
| 101 | StopWatch sw = new StopWatch("checkBASFMawbFedex"); | 101 | StopWatch sw = new StopWatch("checkBASFMawbFedex"); |
| 102 | sw.start("generate FedexMawb"); | 102 | sw.start("generate FedexMawb"); |
| ... | @@ -106,7 +106,7 @@ public class FedexDataInterface { | ... | @@ -106,7 +106,7 @@ public class FedexDataInterface { |
| 106 | 106 | ||
| 107 | sw.start("checkFedexMawb"); | 107 | sw.start("checkFedexMawb"); |
| 108 | String msg = result.getMsg(); | 108 | String msg = result.getMsg(); |
| 109 | - String iclearCheckMsg = fedexService.checkFedexMawb(saveMawbFedexResult).getMsg(); | 109 | + String iclearCheckMsg = fedexService.checkFedexMawb(saveMawbFedexResult,appInfo).getMsg(); |
| 110 | if(StringUtil.isEmpty(msg) && StringUtil.isEmpty(iclearCheckMsg)){ | 110 | if(StringUtil.isEmpty(msg) && StringUtil.isEmpty(iclearCheckMsg)){ |
| 111 | result.setSuccess(Boolean.TRUE); | 111 | result.setSuccess(Boolean.TRUE); |
| 112 | }else{ | 112 | }else{ |
| ... | @@ -144,7 +144,6 @@ public class FedexDataInterface { | ... | @@ -144,7 +144,6 @@ public class FedexDataInterface { |
| 144 | return result; | 144 | return result; |
| 145 | } | 145 | } |
| 146 | //1、保存请求信息,保存到iClear的 SQLServer | 146 | //1、保存请求信息,保存到iClear的 SQLServer |
| 147 | - | ||
| 148 | StopWatch sw = new StopWatch("receice mawbFedex"); | 147 | StopWatch sw = new StopWatch("receice mawbFedex"); |
| 149 | sw.start("save log"); | 148 | sw.start("save log"); |
| 150 | 149 | ||
| ... | @@ -175,7 +174,7 @@ public class FedexDataInterface { | ... | @@ -175,7 +174,7 @@ public class FedexDataInterface { |
| 175 | 174 | ||
| 176 | //2、TODO 校验主单 | 175 | //2、TODO 校验主单 |
| 177 | sw.start("checkFedexMawb"); | 176 | sw.start("checkFedexMawb"); |
| 178 | - result=fedexService.checkFedexMawb(saveMawbFedexResult); | 177 | + result=fedexService.checkFedexMawb(saveMawbFedexResult,null); |
| 179 | if(!result.getSuccess()){ | 178 | if(!result.getSuccess()){ |
| 180 | return result; | 179 | return result; |
| 181 | } | 180 | } | ... | ... |
| 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<>(); | ... | ... |
| ... | @@ -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() { | ... | ... |
| ... | @@ -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()); | ... | ... |
| ... | @@ -241,7 +241,7 @@ public class ChmConsignmentService { | ... | @@ -241,7 +241,7 @@ public class ChmConsignmentService { |
| 241 | return result; | 241 | return result; |
| 242 | } | 242 | } |
| 243 | 243 | ||
| 244 | - public ChmConsignment convertToChmConsignmentFedex(FedexMawb mawb, Date pushTime, String creator){ | 244 | + public ChmConsignment convertToChmConsignmentFedex(FedexMawb mawb, Date pushTime, String creator,AppInfo appInfo){ |
| 245 | ChmConsignment result = new ChmConsignment(); | 245 | ChmConsignment result = new ChmConsignment(); |
| 246 | try{ | 246 | try{ |
| 247 | //运单号 | 247 | //运单号 |
| ... | @@ -258,6 +258,11 @@ public class ChmConsignmentService { | ... | @@ -258,6 +258,11 @@ public class ChmConsignmentService { |
| 258 | result.setTradeModeDic(tradeModeDictionaryEntries); | 258 | result.setTradeModeDic(tradeModeDictionaryEntries); |
| 259 | result.setTradeMode(tradeModeDictionaryEntries.getChineseName()); | 259 | result.setTradeMode(tradeModeDictionaryEntries.getChineseName()); |
| 260 | }*/ | 260 | }*/ |
| 261 | + if(appInfo != null){ | ||
| 262 | + //C类校验是否校验运单号,非空则不校验 | ||
| 263 | + result.setCodeCheck(appInfo.getCodeCheck()); | ||
| 264 | + } | ||
| 265 | + | ||
| 261 | //境内收发货人社会信用证代码 | 266 | //境内收发货人社会信用证代码 |
| 262 | result.setTradeCoSCC(mawb.getTradeCodeScc()); | 267 | result.setTradeCoSCC(mawb.getTradeCodeScc()); |
| 263 | //境内发货人(经营单位编码) | 268 | //境内发货人(经营单位编码) |
| ... | @@ -577,7 +582,7 @@ public class ChmConsignmentService { | ... | @@ -577,7 +582,7 @@ public class ChmConsignmentService { |
| 577 | ResultRS result = new ResultRS(Boolean.FALSE,null,null); | 582 | ResultRS result = new ResultRS(Boolean.FALSE,null,null); |
| 578 | try { | 583 | try { |
| 579 | Date pushTime = DateUtils.timeStampToDate(Long.valueOf(timeStamp)); | 584 | Date pushTime = DateUtils.timeStampToDate(Long.valueOf(timeStamp)); |
| 580 | - ChmConsignment chmConsignment = this.convertToChmConsignmentFedex(fedexMawb,pushTime,creator); | 585 | + ChmConsignment chmConsignment = this.convertToChmConsignmentFedex(fedexMawb,pushTime,creator,null); |
| 581 | if(Objects.equals(chmConsignment,null)){ | 586 | if(Objects.equals(chmConsignment,null)){ |
| 582 | result.setCode("30001"); | 587 | result.setCode("30001"); |
| 583 | result.setMsg("数据格式不正确"); | 588 | result.setMsg("数据格式不正确"); | ... | ... |
| ... | @@ -7,6 +7,7 @@ import com.arronlong.httpclientutil.common.HttpHeader; | ... | @@ -7,6 +7,7 @@ import com.arronlong.httpclientutil.common.HttpHeader; |
| 7 | import com.erry.iclear.dateInterface.api.request.*; | 7 | import com.erry.iclear.dateInterface.api.request.*; |
| 8 | import com.erry.iclear.dateInterface.api.response.IClearCheckResponseResult; | 8 | import com.erry.iclear.dateInterface.api.response.IClearCheckResponseResult; |
| 9 | import com.erry.iclear.dateInterface.api.response.ResultRS; | 9 | import com.erry.iclear.dateInterface.api.response.ResultRS; |
| 10 | +import com.erry.iclear.dateInterface.entity.AppInfo; | ||
| 10 | import com.erry.iclear.dateInterface.entity.ChmConsignment; | 11 | import com.erry.iclear.dateInterface.entity.ChmConsignment; |
| 11 | import com.erry.iclear.dateInterface.entity.ChmConsignmentDetail; | 12 | import com.erry.iclear.dateInterface.entity.ChmConsignmentDetail; |
| 12 | import com.erry.iclear.dateInterface.repository.FedexMawbRepository; | 13 | import com.erry.iclear.dateInterface.repository.FedexMawbRepository; |
| ... | @@ -126,13 +127,13 @@ public class FedexService { | ... | @@ -126,13 +127,13 @@ public class FedexService { |
| 126 | * @param fedexMawb | 127 | * @param fedexMawb |
| 127 | * @return | 128 | * @return |
| 128 | */ | 129 | */ |
| 129 | - public ResultRS checkFedexMawb(FedexMawb fedexMawb){ | 130 | + public ResultRS checkFedexMawb(FedexMawb fedexMawb,AppInfo appInfo){ |
| 130 | ResultRS result = new ResultRS(Boolean.FALSE,null,null); | 131 | ResultRS result = new ResultRS(Boolean.FALSE,null,null); |
| 131 | try{ | 132 | try{ |
| 132 | log.info("checkMawb start>>>>>>>>>> mawb:"+gson.toJson(fedexMawb)); | 133 | log.info("checkMawb start>>>>>>>>>> mawb:"+gson.toJson(fedexMawb)); |
| 133 | 134 | ||
| 134 | //1、将请求转换为运单 | 135 | //1、将请求转换为运单 |
| 135 | - ChmConsignment chmConsignment=consignmentService.convertToChmConsignmentFedex(fedexMawb,null,"IDE-ICLEAR-API"); | 136 | + ChmConsignment chmConsignment=consignmentService.convertToChmConsignmentFedex(fedexMawb,null,"IDE-ICLEAR-API",appInfo); |
| 136 | if(Objects.equals(chmConsignment,null)){ | 137 | if(Objects.equals(chmConsignment,null)){ |
| 137 | result.setCode("30001"); | 138 | result.setCode("30001"); |
| 138 | result.setMsg("数据格式不正确"); | 139 | result.setMsg("数据格式不正确"); |
| ... | @@ -180,7 +181,7 @@ public class FedexService { | ... | @@ -180,7 +181,7 @@ public class FedexService { |
| 180 | * @param fedexc | 181 | * @param fedexc |
| 181 | * @return | 182 | * @return |
| 182 | */ | 183 | */ |
| 183 | - public ResultRS checkBasfInterfaceData(Fedexc fedexc){ | 184 | + public ResultRS checkBasfInterfaceData(Fedexc fedexc, AppInfo appInfo){ |
| 184 | 185 | ||
| 185 | ResultRS result = new ResultRS(Boolean.FALSE,"",""); | 186 | ResultRS result = new ResultRS(Boolean.FALSE,"",""); |
| 186 | 187 | ||
| ... | @@ -191,7 +192,8 @@ public class FedexService { | ... | @@ -191,7 +192,8 @@ public class FedexService { |
| 191 | List<String> msgList = new ArrayList<>(); | 192 | List<String> msgList = new ArrayList<>(); |
| 192 | // 参数consignmentCode不能为空 | 193 | // 参数consignmentCode不能为空 |
| 193 | String consignmentCode = fedexc.getConsignmentCode(); | 194 | String consignmentCode = fedexc.getConsignmentCode(); |
| 194 | - if(StringUtils.isEmpty(consignmentCode)){ | 195 | + //C类校验是否校验运单号,非空则不校验 |
| 196 | + if(appInfo.getCodeCheck() == null && StringUtils.isEmpty(consignmentCode)){ | ||
| 195 | msgList.add("参数consignmentCode不能为空"); | 197 | msgList.add("参数consignmentCode不能为空"); |
| 196 | } | 198 | } |
| 197 | // 参数consignmentId不能为空 | 199 | // 参数consignmentId不能为空 | ... | ... |
| ... | @@ -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