港澳台运费

This commit is contained in:
wangjinlei
2023-11-23 11:01:21 +08:00
parent c45c3d9c11
commit 82c598e172

View File

@@ -40,30 +40,49 @@ public class ExpressFeeServiceImpl extends ServiceImpl<ExpressFeeDao, ExpressFee
* @return 费用 * @return 费用
*/ */
private BigDecimal calculateSFExpressFee(BigDecimal weight, String regionCode) { private BigDecimal calculateSFExpressFee(BigDecimal weight, String regionCode) {
// 判断运费计算区间 BigDecimal flag ;
int weightInterval; if(regionCode.equals("710000")){//台湾
BigDecimal additionalWeight; BigDecimal addWF ;
if (weight.compareTo(new BigDecimal(0)) >= 0 && weight.compareTo(new BigDecimal(3)) < 0) { if(weight.compareTo(new BigDecimal(1))>0){
weightInterval = 1; addWF = (weight.subtract(new BigDecimal(1))).multiply(new BigDecimal(20));
additionalWeight = weight.subtract(new BigDecimal(1)); }else {
} else if (weight.compareTo(new BigDecimal(3)) >= 0 && weight.compareTo(new BigDecimal(15)) < 0) { addWF = new BigDecimal(0);
weightInterval = 2; }
additionalWeight = weight.subtract(new BigDecimal(3)); flag = addWF.add(new BigDecimal(28));
} else { } else if (regionCode.equals("810000")||regionCode.equals("820000")) {//香港澳门
weightInterval = 3; BigDecimal addWF ;
additionalWeight = weight.subtract(new BigDecimal(15)); if(weight.compareTo(new BigDecimal(1))>0){
addWF = (weight.subtract(new BigDecimal(1))).multiply(new BigDecimal(11));
}else {
addWF = new BigDecimal(0);
}
flag = addWF.add(new BigDecimal(24));
}else{
int weightInterval;
BigDecimal additionalWeight;
if (weight.compareTo(new BigDecimal(0)) >= 0 && weight.compareTo(new BigDecimal(3)) < 0) {
weightInterval = 1;
additionalWeight = weight.subtract(new BigDecimal(1));
} else if (weight.compareTo(new BigDecimal(3)) >= 0 && weight.compareTo(new BigDecimal(15)) < 0) {
weightInterval = 2;
additionalWeight = weight.subtract(new BigDecimal(3));
} else {
weightInterval = 3;
additionalWeight = weight.subtract(new BigDecimal(15));
}
QueryWrapper<ExpressFee> queryWrapper = new QueryWrapper<>();
if (!regionCode.startsWith("11") && !regionCode.startsWith("12") && !regionCode.startsWith("31") && !regionCode.startsWith("50")) {
regionCode = regionCode.substring(0, 4).concat("00");
}
queryWrapper.eq("dest_code", regionCode);
queryWrapper.eq("weight_interval", weightInterval);
queryWrapper.eq("express_code", "SF");
ExpressFee expressFee = this.getOne(queryWrapper);
BigDecimal firstWeightFee = expressFee.getFirstWeightFee();
BigDecimal additionalWeightFee = (expressFee.getAdditionalWeightFee()).multiply(additionalWeight);
flag = firstWeightFee.add(additionalWeightFee);
} }
QueryWrapper<ExpressFee> queryWrapper = new QueryWrapper<>(); return flag;
if (!regionCode.startsWith("11") && !regionCode.startsWith("12") && !regionCode.startsWith("31") && !regionCode.startsWith("50")) {
regionCode = regionCode.substring(0, 4).concat("00");
}
queryWrapper.eq("dest_code", regionCode);
queryWrapper.eq("weight_interval", weightInterval);
queryWrapper.eq("express_code", "SF");
ExpressFee expressFee = this.getOne(queryWrapper);
BigDecimal firstWeightFee = expressFee.getFirstWeightFee();
BigDecimal additionalWeightFee = (expressFee.getAdditionalWeightFee()).multiply(additionalWeight);
return firstWeightFee.add(additionalWeightFee);
} }
/** /**