From 82c598e172a86acc444d8a482752a2b3c3a27ea5 Mon Sep 17 00:00:00 2001 From: wangjinlei <751475802@qq.com> Date: Thu, 23 Nov 2023 11:01:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=AF=E6=BE=B3=E5=8F=B0=E8=BF=90=E8=B4=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ExpressFeeServiceImpl.java | 65 ++++++++++++------- 1 file changed, 42 insertions(+), 23 deletions(-) diff --git a/src/main/java/com/peanut/modules/book/service/impl/ExpressFeeServiceImpl.java b/src/main/java/com/peanut/modules/book/service/impl/ExpressFeeServiceImpl.java index a2c83790..03920d99 100644 --- a/src/main/java/com/peanut/modules/book/service/impl/ExpressFeeServiceImpl.java +++ b/src/main/java/com/peanut/modules/book/service/impl/ExpressFeeServiceImpl.java @@ -40,30 +40,49 @@ public class ExpressFeeServiceImpl extends ServiceImpl= 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)); + BigDecimal flag ; + if(regionCode.equals("710000")){//台湾 + BigDecimal addWF ; + if(weight.compareTo(new BigDecimal(1))>0){ + addWF = (weight.subtract(new BigDecimal(1))).multiply(new BigDecimal(20)); + }else { + addWF = new BigDecimal(0); + } + flag = addWF.add(new BigDecimal(28)); + } else if (regionCode.equals("810000")||regionCode.equals("820000")) {//香港澳门 + BigDecimal addWF ; + 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 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 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); - return firstWeightFee.add(additionalWeightFee); + return flag; } /**