线上溢价率新增
This commit is contained in:
parent
072bf26b12
commit
6b4785b006
@ -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
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
1
sql/shop/dev/20251028_dml.sql
Normal file
1
sql/shop/dev/20251028_dml.sql
Normal file
@ -0,0 +1 @@
|
||||
ALTER table product_mapping add column premium_rate decimal(18,4) NOT NULL default '100' COMMENT '线上溢价率';
|
||||
Loading…
Reference in New Issue
Block a user