商品映射市场价更改

This commit is contained in:
liyj 2025-10-28 18:26:52 +08:00
parent f16582a5db
commit 3c067f4233
2 changed files with 12 additions and 5 deletions

View File

@ -56,6 +56,10 @@ public class ShopProductSpecItem implements Serializable {
@TableField(exist=false)
private BigDecimal itemPrice;
@ApiModelProperty(value = "市场价")
@TableField(exist=false)
private BigDecimal marketPrice;
@ApiModelProperty(value = "切割后的库存")
@TableField(exist=false)
private BigDecimal itemQuantity;

View File

@ -251,9 +251,10 @@ public class ProductMappingServiceImpl extends BaseServiceImpl<ProductMappingMap
}
shopProductItems.get(i).setItem_is_default(1);
if(shopProductSpecItem.isUpdate()){
shopProductBaseList.get(i).setProduct_unit_price(shopProductSpecItem.getItemPrice());
updateShopProductSpecItemList.add(shopProductSpecItem);
}
shopProductBaseList.get(i).setProduct_unit_price(shopProductSpecItem.getItemPrice());
shopProductBaseList.get(i).setProduct_market_price(shopProductSpecItem.getMarketPrice());
// else {
// shopProductBaseList.get(i).setProduct_unit_price(shopProductSpecItem.getItemPrice());
// shopProductBaseList.get(i).setProduct_market_price(shopProductSpecItem.getItemPrice());
@ -421,11 +422,13 @@ 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 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]);
BigDecimal premiumRate= new BigDecimal("100").add(productMapping.getPremiumRate()).divide(new BigDecimal("100"),2,RoundingMode.HALF_UP);
BigDecimal[] bigDecimals= ProductPriceCalculator.calculatePriceAndQuantity(base.getUnit_price(),base.getShop_weight(),productMapping.getSpecValue(),productMapping.getSpecUnit());
BigDecimal itemPrice=bigDecimals[0].multiply(premiumRate).setScale(2, RoundingMode.HALF_UP);
addShopProductSpecItem.setItemPrice(itemPrice);
addShopProductSpecItem.setMarketPrice(bigDecimals[0]);
addShopProductSpecItem.setItemQuantity(bigDecimals[1]);
Integer Spec_item_id = null;
addShopProductSpecItem.setUpdate(true);