西门子运单,成交方式为FOB时,运费为空,被接口校验退回。这里只有在成交方式为CIF时运费才是必填项
mt 2022年7月15日18:01:11
Showing
3 changed files
with
47 additions
and
5 deletions
No preview for this file type
| ... | @@ -100,17 +100,17 @@ public class Mawb implements Serializable { | ... | @@ -100,17 +100,17 @@ public class Mawb implements Serializable { |
| 100 | private String entryId; | 100 | private String entryId; |
| 101 | 101 | ||
| 102 | @ApiModelProperty(value = "运费币制", name = "feeCurr", example = "固定值:3") | 102 | @ApiModelProperty(value = "运费币制", name = "feeCurr", example = "固定值:3") |
| 103 | - @NotBlank(message="参数feeCurr不能为空") | 103 | +// @NotBlank(message="参数feeCurr不能为空") |
| 104 | @Column(name = "FEECURR") | 104 | @Column(name = "FEECURR") |
| 105 | private String feeCurr; | 105 | private String feeCurr; |
| 106 | 106 | ||
| 107 | @ApiModelProperty(value = "运费标记", name = "feeMark", example = "99.22") | 107 | @ApiModelProperty(value = "运费标记", name = "feeMark", example = "99.22") |
| 108 | - @NotBlank(message="参数feeMark不能为空") | 108 | +// @NotBlank(message="参数feeMark不能为空") |
| 109 | @Column(name = "FEEMARK") | 109 | @Column(name = "FEEMARK") |
| 110 | private String feeMark; | 110 | private String feeMark; |
| 111 | 111 | ||
| 112 | @ApiModelProperty(value = "运费/率", name = "feeRate", example = "43.34358") | 112 | @ApiModelProperty(value = "运费/率", name = "feeRate", example = "43.34358") |
| 113 | - @NotNull(message="参数feeRate不能为空") | 113 | +// @NotNull(message="参数feeRate不能为空") |
| 114 | @Column(name = "FEERATE") | 114 | @Column(name = "FEERATE") |
| 115 | private BigDecimal feeRate; | 115 | private BigDecimal feeRate; |
| 116 | 116 | ||
| ... | @@ -129,7 +129,7 @@ public class Mawb implements Serializable { | ... | @@ -129,7 +129,7 @@ public class Mawb implements Serializable { |
| 129 | private String inputerName; | 129 | private String inputerName; |
| 130 | 130 | ||
| 131 | @ApiModelProperty(value = "保险费币制", name = "insurCurr", example = "MOP") | 131 | @ApiModelProperty(value = "保险费币制", name = "insurCurr", example = "MOP") |
| 132 | - @NotBlank(message="参数insurCurr不能为空") | 132 | +// @NotBlank(message="参数insurCurr不能为空") |
| 133 | @Column(name = "INSURCURR") | 133 | @Column(name = "INSURCURR") |
| 134 | private String insurCurr; | 134 | private String insurCurr; |
| 135 | 135 | ||
| ... | @@ -138,7 +138,7 @@ public class Mawb implements Serializable { | ... | @@ -138,7 +138,7 @@ public class Mawb implements Serializable { |
| 138 | private String insurMark; | 138 | private String insurMark; |
| 139 | 139 | ||
| 140 | @ApiModelProperty(value = "保险费/率", name = "insurRate", example = "") | 140 | @ApiModelProperty(value = "保险费/率", name = "insurRate", example = "") |
| 141 | - @NotNull(message="参数insurRate不能为空") | 141 | +// @NotNull(message="参数insurRate不能为空") |
| 142 | @Column(name = "INSURRATE") | 142 | @Column(name = "INSURRATE") |
| 143 | private BigDecimal insurRate; | 143 | private BigDecimal insurRate; |
| 144 | 144 | ... | ... |
| ... | @@ -10,6 +10,7 @@ import com.erry.iclear.dateInterface.entity.ChmConsignment; | ... | @@ -10,6 +10,7 @@ import com.erry.iclear.dateInterface.entity.ChmConsignment; |
| 10 | import com.erry.iclear.dateInterface.entity.ChmConsignmentDetail; | 10 | import com.erry.iclear.dateInterface.entity.ChmConsignmentDetail; |
| 11 | import com.erry.iclear.dateInterface.repository.MawbRepository; | 11 | import com.erry.iclear.dateInterface.repository.MawbRepository; |
| 12 | import com.erry.iclear.dateInterface.util.JsonToJava; | 12 | import com.erry.iclear.dateInterface.util.JsonToJava; |
| 13 | +import com.erry.iclear.dateInterface.util.StringUtil; | ||
| 13 | import com.google.gson.Gson; | 14 | import com.google.gson.Gson; |
| 14 | import lombok.extern.slf4j.Slf4j; | 15 | import lombok.extern.slf4j.Slf4j; |
| 15 | import org.apache.http.Header; | 16 | import org.apache.http.Header; |
| ... | @@ -78,6 +79,12 @@ public class MawbService { | ... | @@ -78,6 +79,12 @@ public class MawbService { |
| 78 | result.setMsg("数据格式不正确"); | 79 | result.setMsg("数据格式不正确"); |
| 79 | return result; | 80 | return result; |
| 80 | } | 81 | } |
| 82 | + //校验成交方式 成交方式为CIF时 '参数feeCurr不能为空','参数feeMark不能为空'',参数feeRate不能为空','参数insurCurr不能为空', '参数insurRate不能为空' | ||
| 83 | + result = this.notBlankCheck(mawb,chmConsignment.getDealMode()); | ||
| 84 | + if(!result.getSuccess()){ | ||
| 85 | + return result; | ||
| 86 | + } | ||
| 87 | + | ||
| 81 | List<ChmConsignmentDetail> chmConsignmentDetailList = new ArrayList<>(); | 88 | List<ChmConsignmentDetail> chmConsignmentDetailList = new ArrayList<>(); |
| 82 | mawb.getMawbDetailList().forEach(detail ->{ | 89 | mawb.getMawbDetailList().forEach(detail ->{ |
| 83 | chmConsignmentDetailList.add(consignmentDetailService.convertToChmConsignmentDetail(detail,chmConsignment)); | 90 | chmConsignmentDetailList.add(consignmentDetailService.convertToChmConsignmentDetail(detail,chmConsignment)); |
| ... | @@ -107,4 +114,39 @@ public class MawbService { | ... | @@ -107,4 +114,39 @@ public class MawbService { |
| 107 | } | 114 | } |
| 108 | return result; | 115 | return result; |
| 109 | } | 116 | } |
| 117 | + | ||
| 118 | + /** | ||
| 119 | + * 校验成交方式 成交方式为CIF时 '参数feeCurr不能为空','参数feeMark不能为空'',参数feeRate不能为空','参数insurCurr不能为空', '参数insurRate不能为空' | ||
| 120 | + * @param mawb | ||
| 121 | + * @param dealMode 转换过的成交方式 | ||
| 122 | + * @return | ||
| 123 | + */ | ||
| 124 | + private ResultRS notBlankCheck(Mawb mawb,String dealMode) { | ||
| 125 | + ResultRS result = new ResultRS(Boolean.TRUE, null, null); | ||
| 126 | + //成交方式为CIF时 '参数feeCurr不能为空','参数feeMark不能为空'',参数feeRate不能为空','参数insurCurr不能为空', '参数insurRate不能为空' | ||
| 127 | + if(dealMode.equals("CIF")){ | ||
| 128 | + if(StringUtil.isEmpty(mawb.getFeeCurr())){ | ||
| 129 | + result.setSuccess(false); | ||
| 130 | + result.setCode("30002"); | ||
| 131 | + result.setMsg("运费币制不能为空"); | ||
| 132 | + }else if(StringUtil.isEmpty(mawb.getFeeMark())){ | ||
| 133 | + result.setSuccess(false); | ||
| 134 | + result.setCode("30002"); | ||
| 135 | + result.setMsg("运费标记不能为空"); | ||
| 136 | + }else if(mawb.getFeeRate() == null){ | ||
| 137 | + result.setSuccess(false); | ||
| 138 | + result.setCode("30002"); | ||
| 139 | + result.setMsg("运费/率不能为空"); | ||
| 140 | + }else if(StringUtil.isEmpty(mawb.getInsurCurr())){ | ||
| 141 | + result.setSuccess(false); | ||
| 142 | + result.setCode("30002"); | ||
| 143 | + result.setMsg("保险费币制不能为空"); | ||
| 144 | + }else if(mawb.getInsurRate() == null){ | ||
| 145 | + result.setSuccess(false); | ||
| 146 | + result.setCode("30002"); | ||
| 147 | + result.setMsg("保险费/率不能为空"); | ||
| 148 | + } | ||
| 149 | + } | ||
| 150 | + return result; | ||
| 151 | + } | ||
| 110 | } | 152 | } | ... | ... |
-
Please register or login to post a comment