重构产品价和红线价功能
This commit is contained in:
+20
-2
@@ -17,6 +17,8 @@ public interface BmsProductCountryMapper
|
||||
|
||||
public int insertBmsProductCountry(BmsProductCountry country);
|
||||
|
||||
public int insertBmsProductCountryBatch(@Param("list") List<BmsProductCountry> list);
|
||||
|
||||
/** 按明细行主键更新可编辑字段(重量段/运费/挂号费/尺寸/尾程/时效/生效失效日期) */
|
||||
public int updateBmsProductCountry(BmsProductCountry country);
|
||||
|
||||
@@ -65,9 +67,18 @@ public interface BmsProductCountryMapper
|
||||
@Param("productCode") String productCode,
|
||||
@Param("effectiveDate") Date effectiveDate);
|
||||
|
||||
/** Hard-delete all detail rows of one product (psp_id). */
|
||||
public int physicalDeleteByPspId(@Param("productId") Long productId);
|
||||
|
||||
/** Hard-delete detail rows of one product + country (psp_id scope). */
|
||||
public int physicalDeleteByPspIdAndCountry(
|
||||
@Param("productId") Long productId,
|
||||
@Param("countryCode") String countryCode,
|
||||
@Param("countryName") String countryName);
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* Hard-delete draft/pending detail rows for one product + country (same-version replace).
|
||||
* Only versions with status draft(0) or pending(3) are affected.
|
||||
*/
|
||||
public int deleteOpenByProductCodeAndCountryOnDate(
|
||||
@Param("productCode") String productCode,
|
||||
@@ -75,6 +86,13 @@ public interface BmsProductCountryMapper
|
||||
@Param("countryName") String countryName,
|
||||
@Param("effectiveDate") Date effectiveDate);
|
||||
|
||||
/** Hard-delete surcharge_rel rows linked to draft/pending details for product+country. */
|
||||
public int deleteSurchargeRelByProductCodeAndCountryOnDate(
|
||||
@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<BmsProductCountry> selectOpenByProductCode(@Param("productCode") String productCode);
|
||||
|
||||
|
||||
@@ -21,6 +21,9 @@ public interface BmsProductMapper
|
||||
public BmsProduct selectBmsProductByCodeAndDate(@Param("productCode") String productCode,
|
||||
@Param("effectiveDate") Date effectiveDate);
|
||||
|
||||
/** Product row in a specific version */
|
||||
public BmsProduct selectByCodeAndPsvId(@Param("productCode") String productCode, @Param("psvId") Long psvId);
|
||||
|
||||
/** Product version effective on bizDate */
|
||||
public BmsProduct selectEffectiveBmsProductByCode(@Param("productCode") String productCode,
|
||||
@Param("bizDate") Date bizDate);
|
||||
|
||||
+20
-2
@@ -17,6 +17,8 @@ public interface BmsRedlineProductCountryMapper
|
||||
|
||||
public int insertBmsRedlineProductCountry(BmsRedlineProductCountry country);
|
||||
|
||||
public int insertBmsRedlineProductCountryBatch(@Param("list") List<BmsRedlineProductCountry> list);
|
||||
|
||||
/** 按明细行主键更新可编辑字段(重量段/运费/挂号费/尺寸/尾程/时效/生效失效日期) */
|
||||
public int updateBmsRedlineProductCountry(BmsRedlineProductCountry country);
|
||||
|
||||
@@ -62,9 +64,18 @@ public interface BmsRedlineProductCountryMapper
|
||||
@Param("productCode") String productCode,
|
||||
@Param("effectiveDate") Date effectiveDate);
|
||||
|
||||
/** Hard-delete all detail rows of one product (psp_id). */
|
||||
public int physicalDeleteByPspId(@Param("productId") Long productId);
|
||||
|
||||
/** Hard-delete detail rows of one product + country (psp_id scope). */
|
||||
public int physicalDeleteByPspIdAndCountry(
|
||||
@Param("productId") Long productId,
|
||||
@Param("countryCode") String countryCode,
|
||||
@Param("countryName") String countryName);
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* Hard-delete draft/pending detail rows for one product + country (same-version replace).
|
||||
* Only versions with status draft(0) or pending(3) are affected.
|
||||
*/
|
||||
public int deleteOpenByProductCodeAndCountryOnDate(
|
||||
@Param("productCode") String productCode,
|
||||
@@ -72,6 +83,13 @@ public interface BmsRedlineProductCountryMapper
|
||||
@Param("countryName") String countryName,
|
||||
@Param("effectiveDate") Date effectiveDate);
|
||||
|
||||
/** Hard-delete surcharge_rel rows linked to draft/pending details for product+country. */
|
||||
public int deleteSurchargeRelByProductCodeAndCountryOnDate(
|
||||
@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);
|
||||
|
||||
|
||||
@@ -21,6 +21,9 @@ public interface BmsRedlineProductMapper
|
||||
public BmsRedlineProduct selectBmsRedlineProductByCodeAndDate(@Param("productCode") String productCode,
|
||||
@Param("effectiveDate") Date effectiveDate);
|
||||
|
||||
/** Product row in a specific version */
|
||||
public BmsRedlineProduct selectByCodeAndPsvId(@Param("productCode") String productCode, @Param("psvId") Long psvId);
|
||||
|
||||
/** Product version effective on bizDate */
|
||||
public BmsRedlineProduct selectEffectiveBmsRedlineProductByCode(@Param("productCode") String productCode,
|
||||
@Param("bizDate") Date bizDate);
|
||||
|
||||
@@ -13,14 +13,12 @@ public interface PrcPriceExcelFileMapper
|
||||
|
||||
public List<PrcPriceExcelFile> selectPrcPriceExcelFileList(PrcPriceExcelFile query);
|
||||
|
||||
/** 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);
|
||||
|
||||
/** Distinct excel files linked by prc_price_set_product.pef_id for a version. */
|
||||
/** Excel files bound to a version via psv_id */
|
||||
public List<PrcPriceExcelFile> selectByPsvId(@Param("psvId") Long psvId);
|
||||
|
||||
/** Hard delete attachments of a version. */
|
||||
public int physicalDeleteByPsvId(@Param("psvId") Long psvId);
|
||||
|
||||
public int insertPrcPriceExcelFile(PrcPriceExcelFile row);
|
||||
|
||||
public int updatePrcPriceExcelFile(PrcPriceExcelFile row);
|
||||
|
||||
+43
-28
@@ -7,9 +7,7 @@ import org.apache.ibatis.annotations.Param;
|
||||
import com.bms.price.domain.PrcPriceSetDetail;
|
||||
|
||||
/**
|
||||
* 价格套餐明细 数据层
|
||||
*
|
||||
* @author bms
|
||||
* Price detail mapper (PRODUCT / REDLINE / SALES)
|
||||
*/
|
||||
public interface PrcPriceSetDetailMapper
|
||||
{
|
||||
@@ -17,23 +15,24 @@ public interface PrcPriceSetDetailMapper
|
||||
|
||||
public List<PrcPriceSetDetail> selectPrcPriceSetDetailList(PrcPriceSetDetail detail);
|
||||
|
||||
/** 版本内去重后的 产品/国家/维度组合行(用于明细搜索下拉选项) */
|
||||
public List<PrcPriceSetDetail> selectDetailOptionRows(@Param("psvId") Long psvId);
|
||||
|
||||
public int insertPrcPriceSetDetail(PrcPriceSetDetail detail);
|
||||
|
||||
/** Batch insert details; fills generated psdId on each item. */
|
||||
public int insertPrcPriceSetDetailBatch(@Param("list") List<PrcPriceSetDetail> list);
|
||||
|
||||
public int updatePrcPriceSetDetail(PrcPriceSetDetail detail);
|
||||
|
||||
public int deletePrcPriceSetDetailByIds(Long[] psdIds);
|
||||
|
||||
/** Delete SALES details for all versions of a price set */
|
||||
public int deletePrcPriceSetDetailByPriceSetId(Long priceSetId);
|
||||
|
||||
public int deletePrcPriceSetDetailByPsvId(Long psvId);
|
||||
|
||||
/** legacy rows: price_set_id match but psv_id is null */
|
||||
/** Hard delete all detail rows under a version. */
|
||||
public int physicalDeleteByPsvId(@Param("psvId") Long psvId);
|
||||
|
||||
public int deleteOrphanDetailsByPriceSetId(Long priceSetId);
|
||||
|
||||
public int countProductByPriceSetId(Long priceSetId);
|
||||
@@ -42,32 +41,23 @@ public interface PrcPriceSetDetailMapper
|
||||
|
||||
public int countByPsvId(Long psvId);
|
||||
|
||||
/** Copy all details from src version into new version (new psd_id, same price_set_id) */
|
||||
public int copyDetailsFromVersion(@Param("srcPsvId") Long srcPsvId, @Param("newPsvId") Long newPsvId);
|
||||
|
||||
/** FIXED: insert details from product country library (asOf window or openOnly). */
|
||||
/** Copy version effective time, expire time and status onto catalog detail rows. */
|
||||
public int syncEffectByPriceType(@Param("priceType") String priceType);
|
||||
|
||||
public int insertFixedDetailsFromLibrary(
|
||||
@Param("priceSetId") Long priceSetId,
|
||||
@Param("psvId") Long psvId,
|
||||
@Param("asOf") Date asOf,
|
||||
@Param("openOnly") boolean openOnly);
|
||||
|
||||
/** Preview: FIXED details from product country library (no insert). */
|
||||
public List<PrcPriceSetDetail> selectFixedDetailsFromLibrary(
|
||||
@Param("asOf") Date asOf,
|
||||
@Param("openOnly") boolean openOnly);
|
||||
|
||||
/** DISCOUNT: one detail row per effective product */
|
||||
public int insertDiscountDetailsFromLibrary(
|
||||
@Param("priceSetId") Long priceSetId,
|
||||
@Param("psvId") Long psvId);
|
||||
public int insertDiscountDetailsFromLibrary(@Param("psvId") Long psvId);
|
||||
|
||||
/**
|
||||
* FIXED match on package snapshot: product + country + zone + weight band.
|
||||
* Does not depend on live product_country.detail_id.
|
||||
*/
|
||||
public PrcPriceSetDetail selectFixedMatch(
|
||||
@Param("priceSetId") Long priceSetId,
|
||||
@Param("psvId") Long psvId,
|
||||
@Param("productCode") String productCode,
|
||||
@Param("countryCode") String countryCode,
|
||||
@@ -75,22 +65,16 @@ public interface PrcPriceSetDetailMapper
|
||||
@Param("zoneCode") String zoneCode,
|
||||
@Param("weight") BigDecimal weight);
|
||||
|
||||
/** Count version details that have zone for product + country (postcode gate). */
|
||||
public int countZonedByPsvProductCountry(
|
||||
@Param("psvId") Long psvId,
|
||||
@Param("productCode") String productCode,
|
||||
@Param("countryCode") String countryCode,
|
||||
@Param("countryName") String countryName);
|
||||
|
||||
/** Count FIXED details by version + product (ignore country/zone/weight). */
|
||||
public int countByPsvProduct(
|
||||
@Param("psvId") Long psvId,
|
||||
@Param("productCode") String productCode);
|
||||
|
||||
/**
|
||||
* Count FIXED details by version + product + country + zone (ignore weight).
|
||||
* Used to diagnose country miss vs weight miss.
|
||||
*/
|
||||
public int countByPsvProductCountryZone(
|
||||
@Param("psvId") Long psvId,
|
||||
@Param("productCode") String productCode,
|
||||
@@ -98,15 +82,46 @@ public interface PrcPriceSetDetailMapper
|
||||
@Param("countryName") String countryName,
|
||||
@Param("zoneCode") String zoneCode);
|
||||
|
||||
/** DISCOUNT by product; optional psvId scopes to version */
|
||||
public PrcPriceSetDetail selectDiscountMatch(
|
||||
@Param("priceSetId") Long priceSetId,
|
||||
@Param("psvId") Long psvId,
|
||||
@Param("productCode") String productCode);
|
||||
|
||||
/** Update package freight / registration; null args keep existing columns. */
|
||||
public int updateDetailPrices(
|
||||
@Param("psdId") Long psdId,
|
||||
@Param("fvValue") BigDecimal fvValue,
|
||||
@Param("fvRegistrationFee") BigDecimal fvRegistrationFee);
|
||||
|
||||
public int updatePriceTypeByPsvId(@Param("psvId") Long psvId, @Param("priceType") String priceType);
|
||||
|
||||
/**
|
||||
* Match PRODUCT/REDLINE detail by catalog type + bizDate window on version.
|
||||
*/
|
||||
public PrcPriceSetDetail selectCatalogMatch(
|
||||
@Param("priceType") String priceType,
|
||||
@Param("productCode") String productCode,
|
||||
@Param("countryCode") String countryCode,
|
||||
@Param("countryName") String countryName,
|
||||
@Param("zoneCode") String zoneCode,
|
||||
@Param("weight") BigDecimal weight,
|
||||
@Param("bizDate") Date bizDate);
|
||||
|
||||
public int countCatalogByProduct(
|
||||
@Param("priceType") String priceType,
|
||||
@Param("productCode") String productCode,
|
||||
@Param("bizDate") Date bizDate);
|
||||
|
||||
public int countCatalogZonedByProductCountry(
|
||||
@Param("priceType") String priceType,
|
||||
@Param("productCode") String productCode,
|
||||
@Param("countryCode") String countryCode,
|
||||
@Param("countryName") String countryName,
|
||||
@Param("bizDate") Date bizDate);
|
||||
|
||||
public int countCatalogByProductCountryZone(
|
||||
@Param("priceType") String priceType,
|
||||
@Param("productCode") String productCode,
|
||||
@Param("countryCode") String countryCode,
|
||||
@Param("countryName") String countryName,
|
||||
@Param("zoneCode") String zoneCode,
|
||||
@Param("bizDate") Date bizDate);
|
||||
}
|
||||
|
||||
+11
-9
@@ -5,7 +5,7 @@ import org.apache.ibatis.annotations.Param;
|
||||
import com.bms.price.domain.PrcPriceSetProduct;
|
||||
|
||||
/**
|
||||
* Package intermediate product mapper
|
||||
* Price product mapper (PRODUCT / REDLINE / SALES)
|
||||
*/
|
||||
public interface PrcPriceSetProductMapper
|
||||
{
|
||||
@@ -23,19 +23,21 @@ public interface PrcPriceSetProductMapper
|
||||
|
||||
public int deleteByPsvIdAndCode(@Param("psvId") Long psvId, @Param("productCode") String productCode);
|
||||
|
||||
/** Copy active library products into this version (ignore duplicates). */
|
||||
public int insertFromLibrary(@Param("priceSetId") Long priceSetId, @Param("psvId") Long psvId);
|
||||
/** Hard delete all product rows under a version. */
|
||||
public int physicalDeleteByPsvId(@Param("psvId") Long psvId);
|
||||
|
||||
/** Preview: active library products without writing set-product rows. */
|
||||
/** Copy active PRODUCT catalog into this SALES version. */
|
||||
public int insertFromLibrary(@Param("psvId") Long psvId);
|
||||
|
||||
/** Preview: active PRODUCT catalog products. */
|
||||
public List<PrcPriceSetProduct> selectFromLibrary();
|
||||
|
||||
/** Copy set products from one version to another. */
|
||||
public int copyFromVersion(@Param("srcPsvId") Long srcPsvId, @Param("newPsvId") Long newPsvId);
|
||||
|
||||
/** Bind detail.psp_id from set product by psv + product_code. */
|
||||
public int bindDetailPspByPsvId(@Param("psvId") Long psvId);
|
||||
|
||||
/** Stamp Excel attachment id on set products under this version (optional code filter). */
|
||||
public int updatePefIdByPsvId(@Param("psvId") Long psvId, @Param("pefId") Long pefId,
|
||||
@Param("productCodes") List<String> productCodes);
|
||||
public int updatePriceTypeByPsvId(@Param("psvId") Long psvId, @Param("priceType") String priceType);
|
||||
|
||||
/** Copy version effective_time and status onto catalog product rows. */
|
||||
public int syncEffectByPriceType(@Param("priceType") String priceType);
|
||||
}
|
||||
|
||||
+19
-3
@@ -6,7 +6,7 @@ import org.apache.ibatis.annotations.Param;
|
||||
import com.bms.price.domain.PrcPriceSetVersion;
|
||||
|
||||
/**
|
||||
* Price set version
|
||||
* Price version (PRODUCT / REDLINE / SALES)
|
||||
*/
|
||||
public interface PrcPriceSetVersionMapper
|
||||
{
|
||||
@@ -14,8 +14,16 @@ public interface PrcPriceSetVersionMapper
|
||||
|
||||
public List<PrcPriceSetVersion> selectPrcPriceSetVersionList(PrcPriceSetVersion version);
|
||||
|
||||
/** Catalog versions (price_set_id null) with product/detail counts. */
|
||||
public List<PrcPriceSetVersion> selectCatalogVersionList(PrcPriceSetVersion version);
|
||||
|
||||
/** Max seq for SALES by price_set_id */
|
||||
public Integer selectMaxVersionSeq(@Param("priceSetId") Long priceSetId);
|
||||
|
||||
/** Max seq for catalog type (price_set_id null) or SALES when priceSetId set */
|
||||
public Integer selectMaxVersionSeqByType(@Param("priceType") String priceType,
|
||||
@Param("priceSetId") Long priceSetId);
|
||||
|
||||
public int insertPrcPriceSetVersion(PrcPriceSetVersion version);
|
||||
|
||||
public int updatePrcPriceSetVersion(PrcPriceSetVersion version);
|
||||
@@ -27,10 +35,18 @@ public interface PrcPriceSetVersionMapper
|
||||
public List<Long> selectPriceSetIds();
|
||||
|
||||
/**
|
||||
* Version effective at asOf: effective_time <= asOf and (expire_time null or > asOf).
|
||||
* Prefer latest effective_time.
|
||||
* SALES version effective at asOf for a price set.
|
||||
*/
|
||||
public PrcPriceSetVersion selectActiveByPriceSetAt(
|
||||
@Param("priceSetId") Long priceSetId,
|
||||
@Param("asOf") Date asOf);
|
||||
|
||||
/**
|
||||
* Catalog (PRODUCT/REDLINE) version effective at asOf.
|
||||
*/
|
||||
public PrcPriceSetVersion selectActiveByTypeAt(
|
||||
@Param("priceType") String priceType,
|
||||
@Param("asOf") Date asOf);
|
||||
|
||||
public int refreshCatalogStatusByDates(@Param("priceType") String priceType);
|
||||
}
|
||||
|
||||
@@ -35,6 +35,9 @@ public interface PrcSurchargeRelMapper
|
||||
@Param("productIds") List<Long> productIds,
|
||||
@Param("priceType") String priceType);
|
||||
|
||||
/** Hard delete surcharge rows linked to products/details under a version. */
|
||||
public int physicalDeleteByPsvId(@Param("psvId") Long psvId);
|
||||
|
||||
/** 附加费版本化编辑后,把产品关联从旧记录重指向新记录 */
|
||||
public int rebindRelScId(@Param("oldScId") Long oldScId, @Param("newScId") Long newScId, @Param("operator") String operator);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user