Showing
2 changed files
with
78 additions
and
1 deletions
| ... | @@ -36,6 +36,9 @@ public class FedexDataInterface { | ... | @@ -36,6 +36,9 @@ public class FedexDataInterface { |
| 36 | private FedexService fedexService; | 36 | private FedexService fedexService; |
| 37 | 37 | ||
| 38 | @Autowired | 38 | @Autowired |
| 39 | + private MawbService mawbService; | ||
| 40 | + | ||
| 41 | + @Autowired | ||
| 39 | private ChmConsignmentService chmConsignmentService; | 42 | private ChmConsignmentService chmConsignmentService; |
| 40 | 43 | ||
| 41 | @Autowired | 44 | @Autowired |
| ... | @@ -98,6 +101,12 @@ public class FedexDataInterface { | ... | @@ -98,6 +101,12 @@ public class FedexDataInterface { |
| 98 | sw.start("generate FedexMawb"); | 101 | sw.start("generate FedexMawb"); |
| 99 | fedexc.setAppId(appId); | 102 | fedexc.setAppId(appId); |
| 100 | FedexMawb saveMawbFedexResult = fedexService.generateFedexMawb(fedexc); | 103 | FedexMawb saveMawbFedexResult = fedexService.generateFedexMawb(fedexc); |
| 104 | + | ||
| 105 | + //检验运单币制是否有效 | ||
| 106 | + ResultRS resultRS = mawbService.checkCurrency(saveMawbFedexResult); | ||
| 107 | + if(!resultRS.getSuccess()){ | ||
| 108 | + return resultRS; | ||
| 109 | + } | ||
| 101 | sw.stop(); | 110 | sw.stop(); |
| 102 | 111 | ||
| 103 | sw.start("checkFedexMawb"); | 112 | sw.start("checkFedexMawb"); |
| ... | @@ -186,6 +195,12 @@ public class FedexDataInterface { | ... | @@ -186,6 +195,12 @@ public class FedexDataInterface { |
| 186 | } | 195 | } |
| 187 | sw.stop(); | 196 | sw.stop(); |
| 188 | 197 | ||
| 198 | + //检验运单币制是否有效 | ||
| 199 | + ResultRS resultRS = mawbService.checkCurrency(saveMawbFedexResult); | ||
| 200 | + if(!resultRS.getSuccess()){ | ||
| 201 | + return resultRS; | ||
| 202 | + } | ||
| 203 | + | ||
| 189 | // //3、TODO 校验子单 | 204 | // //3、TODO 校验子单 |
| 190 | // sw.start("checkMawbDetail"); | 205 | // sw.start("checkMawbDetail"); |
| 191 | // result=mawbDetailServicel.checkMawbDetail(mawb); | 206 | // result=mawbDetailServicel.checkMawbDetail(mawb); |
| ... | @@ -359,4 +374,4 @@ public class FedexDataInterface { | ... | @@ -359,4 +374,4 @@ public class FedexDataInterface { |
| 359 | result.setCode(ErrorCodeEnum.SUCCESS.getCode()); | 374 | result.setCode(ErrorCodeEnum.SUCCESS.getCode()); |
| 360 | return result; | 375 | return result; |
| 361 | } | 376 | } |
| 362 | -} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 377 | +} | ... | ... |
| 1 | package com.erry.iclear.dateInterface.service; | 1 | package com.erry.iclear.dateInterface.service; |
| 2 | 2 | ||
| 3 | +import com.erry.iclear.dateInterface.api.request.FedexMawb; | ||
| 4 | +import com.erry.iclear.dateInterface.api.request.FedexMawbDetail; | ||
| 3 | import com.erry.iclear.dateInterface.common.Constant; | 5 | import com.erry.iclear.dateInterface.common.Constant; |
| 4 | import com.erry.iclear.dateInterface.entity.DictionaryEntries; | 6 | import com.erry.iclear.dateInterface.entity.DictionaryEntries; |
| 5 | import com.erry.iclear.dateInterface.enums.ErrorCodeEnum; | 7 | import com.erry.iclear.dateInterface.enums.ErrorCodeEnum; |
| ... | @@ -21,6 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired; | ... | @@ -21,6 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
| 21 | import org.springframework.beans.factory.annotation.Value; | 23 | import org.springframework.beans.factory.annotation.Value; |
| 22 | import org.springframework.stereotype.Service; | 24 | import org.springframework.stereotype.Service; |
| 23 | 25 | ||
| 26 | +import javax.validation.Valid; | ||
| 24 | import java.util.*; | 27 | import java.util.*; |
| 25 | 28 | ||
| 26 | /** | 29 | /** |
| ... | @@ -232,7 +235,66 @@ public class MawbService { | ... | @@ -232,7 +235,66 @@ public class MawbService { |
| 232 | 235 | ||
| 233 | return result; | 236 | return result; |
| 234 | } | 237 | } |
| 238 | + /** | ||
| 239 | + * 检查成交币制在系统中是否有效 Constant.CURRENCY_SYSTEM+ mawbDetail.getTradeCurr(); | ||
| 240 | + * 成交币制 TradeCurr | ||
| 241 | + * 杂费币制 OtherCurr | ||
| 242 | + * 运费币制 FeeCurr | ||
| 243 | + * 保费币制 InsurCurr | ||
| 244 | + * | ||
| 245 | + */ | ||
| 246 | + public ResultRS checkCurrency(FedexMawb mawb){ | ||
| 247 | + ResultRS result = new ResultRS(Boolean.TRUE,null,null,null); | ||
| 248 | + | ||
| 249 | + String feeCurr = mawb.getFeeCurr(); | ||
| 250 | + DictionaryEntries feeCurrDict = Constant.dictionaryEntriesCache.get(Constant.CURRENCY_SYSTEM + feeCurr); | ||
| 251 | + | ||
| 252 | + String otherCurr = mawb.getOtherCurr(); | ||
| 253 | + DictionaryEntries otherCurrDict = Constant.dictionaryEntriesCache.get(Constant.CURRENCY_SYSTEM + otherCurr); | ||
| 254 | + | ||
| 255 | + String insurCurr = mawb.getInsurCurr(); | ||
| 256 | + DictionaryEntries insurCurrDict = Constant.dictionaryEntriesCache.get(Constant.CURRENCY_SYSTEM + insurCurr); | ||
| 257 | + | ||
| 258 | + //运费币制检查 | ||
| 259 | + if (StringUtils.isNotEmpty(feeCurr) && Objects.isNull(feeCurrDict) ){ | ||
| 260 | + result.setSuccess(Boolean.FALSE); | ||
| 261 | + result.setCode(ErrorCodeEnum.ERROR_30106.getCode()); | ||
| 262 | + result.setMsg(ErrorCodeEnum.ERROR_30106.getName().replace("{columnName}","运费")); | ||
| 263 | + return result; | ||
| 264 | + } | ||
| 265 | + | ||
| 266 | + //杂费币制检查 | ||
| 267 | + if (StringUtils.isNotEmpty(otherCurr) && Objects.isNull(otherCurrDict) ){ | ||
| 268 | + result.setSuccess(Boolean.FALSE); | ||
| 269 | + result.setCode(ErrorCodeEnum.ERROR_30106.getCode()); | ||
| 270 | + result.setMsg(ErrorCodeEnum.ERROR_30106.getName().replace("{columnName}","杂费")); | ||
| 271 | + return result; | ||
| 272 | + } | ||
| 273 | + | ||
| 274 | + //保费币制检查 | ||
| 275 | + if (StringUtils.isNotEmpty(insurCurr) && Objects.isNull(insurCurrDict) ){ | ||
| 276 | + result.setSuccess(Boolean.FALSE); | ||
| 277 | + result.setCode(ErrorCodeEnum.ERROR_30106.getCode()); | ||
| 278 | + result.setMsg(ErrorCodeEnum.ERROR_30106.getName().replace("{columnName}","保费")); | ||
| 279 | + return result; | ||
| 280 | + } | ||
| 235 | 281 | ||
| 282 | + //申报币制检查 | ||
| 283 | + List<FedexMawbDetail> mawbDetailList = mawb.getMawbDetailList(); | ||
| 284 | + for (int i = 0, maxi = mawbDetailList.size(); i < maxi; i++) { | ||
| 285 | + FedexMawbDetail mawbDetail = mawbDetailList.get(i); | ||
| 286 | + String tradeCurr = mawbDetail.getTradeCurr(); | ||
| 287 | + DictionaryEntries tradeCurrDict = Constant.dictionaryEntriesCache.get(Constant.CURRENCY_SYSTEM + tradeCurr); | ||
| 288 | + if((StringUtils.isNotEmpty(tradeCurr) && Objects.isNull(tradeCurrDict))){ | ||
| 289 | + result.setSuccess(Boolean.FALSE); | ||
| 290 | + result.setCode(ErrorCodeEnum.ERROR_30106.getCode()); | ||
| 291 | + result.setMsg(ErrorCodeEnum.ERROR_30106.getName().replace("{columnName}","")); | ||
| 292 | + break; | ||
| 293 | + } | ||
| 294 | + } | ||
| 295 | + | ||
| 296 | + return result; | ||
| 297 | + } | ||
| 236 | 298 | ||
| 237 | /** | 299 | /** |
| 238 | * 校验主单 | 300 | * 校验主单 | ... | ... |
-
Please register or login to post a comment