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:
+57
@@ -0,0 +1,57 @@
|
||||
package com.bms.price.service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.bms.price.domain.BmsRedlineProduct;
|
||||
import com.bms.price.domain.BmsRedlineProductCountry;
|
||||
import com.bms.price.domain.BmsRedlineProductImportTask;
|
||||
|
||||
/**
|
||||
* redline product list service
|
||||
*
|
||||
* @author bms
|
||||
*/
|
||||
public interface IBmsRedlineProductService
|
||||
{
|
||||
public BmsRedlineProduct selectBmsRedlineProductById(Long productId);
|
||||
|
||||
public List<BmsRedlineProduct> selectBmsRedlineProductList(BmsRedlineProduct product);
|
||||
|
||||
public int insertBmsRedlineProduct(BmsRedlineProduct product);
|
||||
|
||||
public int updateBmsRedlineProduct(BmsRedlineProduct product);
|
||||
|
||||
public int updateBmsRedlineProductCountry(BmsRedlineProductCountry country);
|
||||
|
||||
public int deleteBmsRedlineProductByIds(Long[] productIds);
|
||||
|
||||
public List<BmsRedlineProductCountry> selectCountryListByProductCode(String productCode);
|
||||
|
||||
public List<BmsRedlineProductCountry> selectCountryListByProductCode(String productCode, Date effectiveDate);
|
||||
|
||||
public List<BmsRedlineProductCountry> selectCountryListByProductCode(String productCode, Date effectiveDate, Long productId);
|
||||
|
||||
public String importProductExcel(MultipartFile file, boolean updateSupport, String operName, Date effectiveDate) throws Exception;
|
||||
|
||||
public String importCountryProductExcel(MultipartFile file, String countryCode, String operName, Date effectiveDate) throws Exception;
|
||||
|
||||
/** Submit async all-country import; returns taskId for polling getImportTask. */
|
||||
public String submitImportProductExcelAsync(MultipartFile file, boolean updateSupport, String operName, Date effectiveDate) throws Exception;
|
||||
|
||||
/** Submit async single-country import; returns taskId for polling getImportTask. */
|
||||
public String submitImportCountryProductExcelAsync(MultipartFile file, String countryCode, String operName, Date effectiveDate) throws Exception;
|
||||
|
||||
/** Poll Redis progress for product import task. */
|
||||
public BmsRedlineProductImportTask getImportTask(String taskId);
|
||||
|
||||
/** Sync import from bytes (used by async runner; taskId may be null). */
|
||||
public String importProductExcel(byte[] bytes, String filename, boolean updateSupport, String operName, String taskId, Date effectiveDate) throws Exception;
|
||||
|
||||
/** Sync country import from bytes (used by async runner; taskId may be null). */
|
||||
public String importCountryProductExcel(byte[] bytes, String filename, String countryCode, String operName, String taskId, Date effectiveDate) throws Exception;
|
||||
|
||||
public java.util.Map<String, List<BmsRedlineProductCountry>> parseQuoteExcelByProduct(MultipartFile file) throws Exception;
|
||||
|
||||
public java.util.Map<String, List<BmsRedlineProductCountry>> parseQuoteExcelByProduct(byte[] bytes, String filename) throws Exception;
|
||||
}
|
||||
@@ -14,6 +14,8 @@ public interface IPrcPriceExcelFileService
|
||||
/** Import Excel attachments linked to this product_code via product.pef_id */
|
||||
public List<PrcPriceExcelFile> selectByProductCode(String productCode);
|
||||
|
||||
List<PrcPriceExcelFile> selectByRedlineProductCode(String productCode);
|
||||
|
||||
/**
|
||||
* Persist uploaded Excel under upload/price/excel and insert metadata row.
|
||||
*
|
||||
|
||||
@@ -13,6 +13,8 @@ public interface IPrcSurchargeRelService
|
||||
/** 查询某产品已关联的附加费(含附加费与明细展示字段) */
|
||||
public List<PrcSurchargeRel> selectRelByProductCode(String productCode);
|
||||
|
||||
public List<PrcSurchargeRel> selectRelByProductCode(String productCode, String priceType);
|
||||
|
||||
public List<PrcSurchargeRel> selectPrcSurchargeRelList(PrcSurchargeRel rel);
|
||||
|
||||
public int insertPrcSurchargeRel(PrcSurchargeRel rel);
|
||||
|
||||
+2290
File diff suppressed because it is too large
Load Diff
+11
@@ -48,6 +48,17 @@ public class PrcPriceExcelFileServiceImpl implements IPrcPriceExcelFileService
|
||||
return list == null ? Collections.emptyList() : list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PrcPriceExcelFile> selectByRedlineProductCode(String productCode)
|
||||
{
|
||||
if (productCode == null || productCode.trim().isEmpty())
|
||||
{
|
||||
return java.util.Collections.emptyList();
|
||||
}
|
||||
List<PrcPriceExcelFile> list = excelFileMapper.selectByRedlineProductCode(productCode.trim());
|
||||
return list == null ? java.util.Collections.emptyList() : list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PrcPriceExcelFile saveImportExcel(String excelType, Date effectiveTime, byte[] bytes,
|
||||
String filename, String operName) throws Exception
|
||||
|
||||
+9
-19
@@ -23,30 +23,20 @@ public class PrcSurchargeRelServiceImpl implements IPrcSurchargeRelService
|
||||
|
||||
@Override
|
||||
public List<PrcSurchargeRel> selectRelByProductCode(String productCode)
|
||||
{
|
||||
return selectRelByProductCode(productCode, PrcSurchargeRel.PRICE_TYPE_PRODUCT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PrcSurchargeRel> selectRelByProductCode(String productCode, String priceType)
|
||||
{
|
||||
PrcSurchargeRel query = new PrcSurchargeRel();
|
||||
query.setProductCode(productCode);
|
||||
List<PrcSurchargeRel> list = relMapper.selectPrcSurchargeRelList(query);
|
||||
if (list == null || list.isEmpty())
|
||||
if (StringUtils.isNotEmpty(priceType))
|
||||
{
|
||||
return list;
|
||||
query.setPriceType(priceType.trim().toUpperCase());
|
||||
}
|
||||
// Product drawer: PRODUCT + REDLINE only (SALES binds psp_id/psd_id)
|
||||
List<PrcSurchargeRel> filtered = new java.util.ArrayList<PrcSurchargeRel>();
|
||||
for (PrcSurchargeRel rel : list)
|
||||
{
|
||||
if (rel == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
String type = rel.getPriceType();
|
||||
if (StringUtils.isEmpty(type) || PrcSurchargeRel.PRICE_TYPE_PRODUCT.equals(type)
|
||||
|| PrcSurchargeRel.PRICE_TYPE_REDLINE.equals(type))
|
||||
{
|
||||
filtered.add(rel);
|
||||
}
|
||||
}
|
||||
return filtered;
|
||||
return relMapper.selectPrcSurchargeRelList(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+35
@@ -25,6 +25,7 @@ import com.bms.customer.customerinfo.domain.BmsCustomer;
|
||||
import com.bms.customer.customerinfo.mapper.BmsCustomerMapper;
|
||||
import com.bms.price.domain.BmsProduct;
|
||||
import com.bms.price.domain.BmsProductCountry;
|
||||
import com.bms.price.domain.BmsRedlineProductCountry;
|
||||
import com.bms.price.domain.PrcCustomerPriceSet;
|
||||
import com.bms.price.domain.PrcPriceSet;
|
||||
import com.bms.price.domain.PrcPriceSetDetail;
|
||||
@@ -42,6 +43,7 @@ import com.bms.price.domain.vo.TmsPriceQuoteResult;
|
||||
import com.bms.price.enums.BillCustomerActiveStatus;
|
||||
import com.bms.price.mapper.BmsProductCountryMapper;
|
||||
import com.bms.price.mapper.BmsProductMapper;
|
||||
import com.bms.price.mapper.BmsRedlineProductCountryMapper;
|
||||
import com.bms.price.mapper.PrcCustomerPriceSetMapper;
|
||||
import com.bms.price.mapper.PrcPriceSetDetailMapper;
|
||||
import com.bms.price.mapper.PrcPriceSetMapper;
|
||||
@@ -94,6 +96,9 @@ public class TmsPriceQuoteServiceImpl implements ITmsPriceQuoteService
|
||||
@Autowired
|
||||
private BmsProductCountryMapper productCountryMapper;
|
||||
|
||||
@Autowired
|
||||
private BmsRedlineProductCountryMapper redlineProductCountryMapper;
|
||||
|
||||
@Autowired
|
||||
private BmsProductMapper productMapper;
|
||||
|
||||
@@ -874,6 +879,7 @@ public class TmsPriceQuoteServiceImpl implements ITmsPriceQuoteService
|
||||
r.setRoundMode(mode);
|
||||
r.setFromCache(false);
|
||||
fillProductAmountAndPay(r, catalog, weight, rm, mode);
|
||||
fillRedlineAmount(r, weight, rm);
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -929,6 +935,7 @@ public class TmsPriceQuoteServiceImpl implements ITmsPriceQuoteService
|
||||
r.setRoundMode(mode);
|
||||
r.setFromCache(false);
|
||||
fillProductAmountAndPay(r, base, weight, rm, mode);
|
||||
fillRedlineAmount(r, weight, rm);
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -961,6 +968,30 @@ public class TmsPriceQuoteServiceImpl implements ITmsPriceQuoteService
|
||||
r.setPayFeeDetails(payLines);
|
||||
}
|
||||
|
||||
/**
|
||||
* Redline catalog amount from redline_product_country (same match keys as product catalog).
|
||||
*/
|
||||
private void fillRedlineAmount(TmsPriceQuoteResult r, BigDecimal weight, RoundingMode rm)
|
||||
{
|
||||
if (r == null || weight == null || StringUtils.isEmpty(r.getProductCode()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
BmsRedlineProductCountry base = redlineProductCountryMapper.selectMatchByProductCountryWeight(
|
||||
r.getProductCode(), r.getCountryCode(), r.getCountryName(), r.getZoneCode(), weight, null);
|
||||
if (base == null || base.getFreightPrice() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (base.getDetailId() != null)
|
||||
{
|
||||
r.setRedlineCountryId(base.getDetailId());
|
||||
}
|
||||
BigDecimal baseReg = base.getRegistrationFee() == null ? BigDecimal.ZERO : base.getRegistrationFee();
|
||||
BigDecimal freight = base.getFreightPrice().multiply(weight).setScale(2, rm);
|
||||
r.setRedlineAmount(freight.add(baseReg).setScale(2, rm));
|
||||
}
|
||||
|
||||
private void applySurchargesAndFees(TmsPriceQuoteResult result)
|
||||
{
|
||||
BigDecimal freightAmount = nvl(result.getFreightAmount());
|
||||
@@ -1140,6 +1171,10 @@ public class TmsPriceQuoteServiceImpl implements ITmsPriceQuoteService
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (PrcSurchargeRel.PRICE_TYPE_REDLINE.equals(rel.getPriceType()))
|
||||
{
|
||||
return result.getRedlineCountryId() != null && rel.getDetailId().equals(result.getRedlineCountryId());
|
||||
}
|
||||
return result.getProductCountryId() != null && rel.getDetailId().equals(result.getProductCountryId());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user