线上溢价率新增

This commit is contained in:
liyj 2025-10-28 16:02:48 +08:00
parent d3500e62f1
commit f061da5fea
4 changed files with 15 additions and 2 deletions

View File

@ -81,6 +81,10 @@ public class ProductMapping implements Serializable {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
@TableField(value ="premium_rate",updateStrategy=NOT_EMPTY)
@ApiModelProperty("线上溢价率")
private BigDecimal premiumRate;
/**
* 生成唯一键productName + productNumber + storeId

View File

@ -32,6 +32,9 @@ public class ProductMappingExcel {
@ExcelProperty(value = "排序值", index = 7)
private Integer sortOrder;
@ExcelProperty(value = "线上溢价率", index = 8)
private BigDecimal premiumRate;
// 转换为实体对象
public ProductMapping toEntity() {
ProductMapping entity = new ProductMapping();
@ -43,6 +46,7 @@ public class ProductMappingExcel {
entity.setSpecUnit(this.specUnit);
entity.setDescription(this.description);
entity.setSortOrder(this.sortOrder);
entity.setPremiumRate(this.premiumRate);
return entity;
}
@ -57,6 +61,7 @@ public class ProductMappingExcel {
excel.setSpecUnit(entity.getSpecUnit());
excel.setDescription(entity.getDescription());
excel.setSortOrder(entity.getSortOrder());
excel.setPremiumRate(entity.getPremiumRate());
return excel;
}

View File

@ -61,6 +61,7 @@ import javax.validation.ValidationException;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.URLEncoder;
import java.nio.file.Files;
import java.nio.file.Path;
@ -420,8 +421,10 @@ public class ProductMappingServiceImpl extends BaseServiceImpl<ProductMappingMap
ProductMapping productMapping= (ProductMapping) productMappingMap.get(productNumber);
//String Spec_item_name=productMapping.getProductName()+ BigDecimalFormatter.formatWithoutTrailingZeros(productMapping.getSpecValue())+productMapping.getSpecUnit();
String Spec_item_name=BigDecimalFormatter.formatWithoutTrailingZeros(productMapping.getSpecValue())+productMapping.getSpecUnit();
//计算价格
BigDecimal[] bigDecimals= ProductPriceCalculator.calculatePriceAndQuantity(base.getUnit_price(),base.getShop_weight(),productMapping.getSpecValue(),productMapping.getSpecUnit());
BigDecimal premiumRate= new BigDecimal("100").add(productMapping.getPremiumRate()).divide(new BigDecimal("100"),2,RoundingMode.HALF_UP);
BigDecimal unitPrice=base.getUnit_price().multiply(premiumRate).setScale(2, RoundingMode.HALF_UP);
//计算价格
BigDecimal[] bigDecimals= ProductPriceCalculator.calculatePriceAndQuantity(unitPrice,base.getShop_weight(),productMapping.getSpecValue(),productMapping.getSpecUnit());
addShopProductSpecItem.setItemPrice(bigDecimals[0]);
addShopProductSpecItem.setItemQuantity(bigDecimals[1]);
Integer Spec_item_id = null;

View File

@ -0,0 +1 @@
ALTER table product_mapping add column premium_rate decimal(18,4) NOT NULL default '100' COMMENT '线上溢价率';