diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/domain/logistic/CostTrialCalculation.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/domain/logistic/CostTrialCalculation.java index 9a5cdc5bf..0e6a3f34f 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/domain/logistic/CostTrialCalculation.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/domain/logistic/CostTrialCalculation.java @@ -24,6 +24,9 @@ public class CostTrialCalculation { @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") private final Date effectiveDate; + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") + private final Date previousEffectiveDate; + private final BigDecimal unitPrice; private final BigDecimal shippingCost; @@ -44,7 +47,7 @@ public class CostTrialCalculation { private CostTrialCalculation(String countryCode, String logisticsChannelName, String logisticChannelCode, BigDecimal unitPrice, BigDecimal shippingCost, BigDecimal registrationCost, BigDecimal additionalCost, Date effectiveDate, - BigDecimal previousUnitPrice,BigDecimal previousShippingCost, BigDecimal previousRegistrationCost, BigDecimal previousAdditionalCost) { + BigDecimal previousUnitPrice,BigDecimal previousShippingCost, BigDecimal previousRegistrationCost, BigDecimal previousAdditionalCost, Date previousEffectiveDate) { this.countryCode = countryCode; this.logisticsChannelName = logisticsChannelName; this.logisticChannelCode = logisticChannelCode; @@ -57,12 +60,13 @@ public class CostTrialCalculation { this.previousShippingCost = previousShippingCost; this.previousRegistrationCost = previousRegistrationCost; this.previousAdditionalCost = previousAdditionalCost; + this.previousEffectiveDate = previousEffectiveDate; } public CostTrialCalculation(LogisticChannelPrice price, LogisticChannelPrice previousPrice,int weight, String logisticsChannelName, String code) { this(price.getEffectiveCountry(), logisticsChannelName, code, price.getCalUnitPrice(), price.calculateShippingPrice(BigDecimal.valueOf(weight)), price.getRegistrationFee(), price.getAdditionalCost(), price.getEffectiveDate(), - previousPrice.getCalUnitPrice(), previousPrice.calculateShippingPrice(BigDecimal.valueOf(weight)), previousPrice.getRegistrationFee(), previousPrice.getAdditionalCost() + previousPrice.getCalUnitPrice(), previousPrice.calculateShippingPrice(BigDecimal.valueOf(weight)), previousPrice.getRegistrationFee(), previousPrice.getAdditionalCost(), previousPrice.getEffectiveDate() ); } diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/LogisticChannelPriceMapper.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/LogisticChannelPriceMapper.java index 955969d8f..72e63e9ac 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/LogisticChannelPriceMapper.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/LogisticChannelPriceMapper.java @@ -39,6 +39,11 @@ public interface LogisticChannelPriceMapper extends BaseMapper countryList); + LogisticChannelPrice findPrevious( + @Param("channelName") String channelName, + @Param("date") Date shippingTime, + @Param("trueWeight") BigDecimal weight, + @Param("countryList") List countryList); /** * Find logistic channel price by indicating platform order's shipping time diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/xml/LogisticChannelPriceMapper.xml b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/xml/LogisticChannelPriceMapper.xml index a36890c23..83cc06ce9 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/xml/LogisticChannelPriceMapper.xml +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/xml/LogisticChannelPriceMapper.xml @@ -33,8 +33,71 @@ AND effective_date <= #{date} AND active = 1 ORDER BY effective_date DESC - LIMIT 2 - + LIMIT 2 + +