Enhance surcharge management by adding support for price type filtering in SurchargeController and related services. Introduce new methods for handling redline product codes in mappers and services. Update front-end API to accommodate price type parameters in surcharge queries. Modify database schema to include redline product and country tables for improved surcharge calculations.

This commit is contained in:
wuweihua
2026-10-09 17:30:29 +08:00
parent 380577f691
commit f1f6ddd368
34 changed files with 5196 additions and 30 deletions
@@ -0,0 +1,99 @@
package com.bms.price.mapper;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.bms.price.domain.BmsRedlineProductCountry;
/**
* 红线价国家明细 数据层
*
* @author bms
*/
public interface BmsRedlineProductCountryMapper
{
public List<BmsRedlineProductCountry> selectBmsRedlineProductCountryList(BmsRedlineProductCountry country);
public int insertBmsRedlineProductCountry(BmsRedlineProductCountry country);
/** 按明细行主键更新可编辑字段(重量段/运费/挂号费/尺寸/尾程/时效/生效失效日期) */
public int updateBmsRedlineProductCountry(BmsRedlineProductCountry country);
/** Import overlay: update price/zone/attrs on matched country row */
public int updateBmsRedlineProductCountryImport(BmsRedlineProductCountry country);
public int deleteByProductId(Long productId);
public int deleteByProductCode(String productCode);
public int deleteByProductCodeAndEffectiveDate(
@Param("productCode") String productCode,
@Param("effectiveDate") Date effectiveDate);
/** Max open (expire_date is null) effective_date for product */
public Date selectMaxOpenEffectiveDate(@Param("productCode") String productCode);
/** Close open versions: set expire_date = newEffectiveDate where effective_date &lt; newEffectiveDate */
public int expireOpenByProductCode(
@Param("productCode") String productCode,
@Param("newEffectiveDate") Date newEffectiveDate);
/**
* Close open rows for one product + country where effective_date &lt; newEffectiveDate.
* Match by country_code when present, otherwise country_name.
*/
public int expireOpenByProductCodeAndCountry(
@Param("productCode") String productCode,
@Param("countryCode") String countryCode,
@Param("countryName") String countryName,
@Param("newEffectiveDate") Date newEffectiveDate);
/** Recompute status from effective_date / expire_date vs today */
public int refreshStatusByDates();
/** Replace same-day version only */
public int deleteOpenByProductCodeAndEffectiveDate(
@Param("productCode") String productCode,
@Param("effectiveDate") Date effectiveDate);
/**
* Delete open rows for one product + country on a given effective_date (same-day replace).
* Needed because unique key keeps expired same-day weight bands.
*/
public int deleteOpenByProductCodeAndCountryOnDate(
@Param("productCode") String productCode,
@Param("countryCode") String countryCode,
@Param("countryName") String countryName,
@Param("effectiveDate") Date effectiveDate);
/** Open country rows (expire_date is null) for product */
public List<BmsRedlineProductCountry> selectOpenByProductCode(@Param("productCode") String productCode);
/** Copy previously open rows into a new effective_date (caller must expire first) */
public int copyOpenCountries(
@Param("productCode") String productCode,
@Param("productId") Long productId,
@Param("effectiveDate") Date effectiveDate,
@Param("status") String status);
/**
* Match by product + country + weight + bizDate (+ optional zoneCode).
* When zoneCode is empty, prefer rows without zone.
* When zoneCode is set, require matching zone_code.
*/
public BmsRedlineProductCountry selectMatchByProductCountryWeight(
@Param("productCode") String productCode,
@Param("countryCode") String countryCode,
@Param("countryName") String countryName,
@Param("zoneCode") String zoneCode,
@Param("weight") BigDecimal weight,
@Param("bizDate") Date bizDate);
/** Count product-country rows that have a zone for this product+country+bizDate */
public int countZonedByProductCountry(
@Param("productCode") String productCode,
@Param("countryCode") String countryCode,
@Param("countryName") String countryName,
@Param("bizDate") Date bizDate);
}
@@ -0,0 +1,44 @@
package com.bms.price.mapper;
import java.util.Date;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.bms.price.domain.BmsRedlineProduct;
/**
* 产品主表 数据层
*
* @author bms
*/
public interface BmsRedlineProductMapper
{
public BmsRedlineProduct selectBmsRedlineProductById(Long productId);
/** Latest row by product_code (effective_date desc) */
public BmsRedlineProduct selectBmsRedlineProductByCode(String productCode);
/** Unique business key: product_code + effective_date */
public BmsRedlineProduct selectBmsRedlineProductByCodeAndDate(@Param("productCode") String productCode,
@Param("effectiveDate") Date effectiveDate);
/** Product version effective on bizDate */
public BmsRedlineProduct selectEffectiveBmsRedlineProductByCode(@Param("productCode") String productCode,
@Param("bizDate") Date bizDate);
public List<BmsRedlineProduct> selectBmsRedlineProductList(BmsRedlineProduct product);
public int insertBmsRedlineProduct(BmsRedlineProduct product);
public int updateBmsRedlineProduct(BmsRedlineProduct product);
public int deleteBmsRedlineProductByIds(Long[] productIds);
/** Close previous open versions: expire_date = newEffectiveDate */
public int expireOpenByProductCode(
@Param("productCode") String productCode,
@Param("newEffectiveDate") Date newEffectiveDate,
@Param("excludeId") Long excludeId);
/** Recompute status from effective_date / expire_date vs today */
public int refreshStatusByDates();
}
@@ -16,6 +16,8 @@ public interface PrcPriceExcelFileMapper
/** Distinct PRODUCT excel files linked by product.pef_id for this product_code */
public List<PrcPriceExcelFile> selectByProductCode(@Param("productCode") String productCode);
public List<PrcPriceExcelFile> selectByRedlineProductCode(@Param("productCode") String productCode);
public int insertPrcPriceExcelFile(PrcPriceExcelFile row);
public int updatePrcPriceExcelFile(PrcPriceExcelFile row);