Commit 71b0f4bb by xiaoer.li@freemud.com

MaterialId->spuId 及将小料价格合到主商品行记录上

parent dacabbca
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>assortment-shoppingcart-sdk</artifactId> <artifactId>assortment-shoppingcart-sdk</artifactId>
<version>1.1.3.732.RELEASE</version> <version>1.1.3.733.RELEASE</version>
<dependencies> <dependencies>
<dependency> <dependency>
......
...@@ -352,11 +352,11 @@ public class ShoppingCartAdapter { ...@@ -352,11 +352,11 @@ public class ShoppingCartAdapter {
Long originalMaterAmount = 0L; Long originalMaterAmount = 0L;
String materialSubName = cartGoods.getSubName(); String materialSubName = cartGoods.getSubName();
for (CartGoods.MaterialGoods materialGoods : cartGoods.getProductMaterialList()) { for (CartGoods.MaterialGoods materialGoods : cartGoods.getProductMaterialList()) {
ProductBeanDTO.ProductGroupType.GroupDetailType detail = materialHash.get(materialGoods.getMaterialId()); ProductBeanDTO.ProductGroupType.GroupDetailType detail = materialHash.get(materialGoods.getSpuId());
if (detail == null) continue; if (detail == null) continue;
CartGoods.MaterialGoods material = new CartGoods.MaterialGoods(); CartGoods.MaterialGoods material = new CartGoods.MaterialGoods();
material.setMaterialName(detail.getProductName()); material.setSpuName(detail.getProductName());
material.setMaterialId(detail.getProductId()); material.setSpuId(detail.getProductId());
//行单价 \ 行总价 //行单价 \ 行总价
material.setFinalPrice(detail.getProductFinalPrice().longValue()); material.setFinalPrice(detail.getProductFinalPrice().longValue());
material.setAmount(detail.getProductFinalPrice().longValue()); material.setAmount(detail.getProductFinalPrice().longValue());
......
...@@ -302,11 +302,11 @@ public class CartGoods { ...@@ -302,11 +302,11 @@ public class CartGoods {
/** /**
* 加料Id * 加料Id
*/ */
private String materialId; private String spuId;
/** /**
* 加料名称 * 加料名称
*/ */
private String materialName; private String spuName;
/** /**
* 购物车一行商品的现单价 * 购物车一行商品的现单价
*/ */
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
<dependency> <dependency>
<groupId>cn.freemud</groupId> <groupId>cn.freemud</groupId>
<artifactId>assortment-shoppingcart-sdk</artifactId> <artifactId>assortment-shoppingcart-sdk</artifactId>
<version>1.1.3.732.RELEASE</version> <version>1.1.3.733.RELEASE</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.freemud.application.service.sdk</groupId> <groupId>com.freemud.application.service.sdk</groupId>
......
...@@ -115,8 +115,8 @@ public class ShoppingCartConvertAdapter { ...@@ -115,8 +115,8 @@ public class ShoppingCartConvertAdapter {
List<ShoppingCartGoodsDto.CartGoodsDetailDto.MaterialGoods> materialList = new ArrayList<>(0); List<ShoppingCartGoodsDto.CartGoodsDetailDto.MaterialGoods> materialList = new ArrayList<>(0);
for (CartGoods.MaterialGoods materialGoods : cartGoods.getProductMaterialList()) { for (CartGoods.MaterialGoods materialGoods : cartGoods.getProductMaterialList()) {
ShoppingCartGoodsDto.CartGoodsDetailDto.MaterialGoods goods = new ShoppingCartGoodsDto.CartGoodsDetailDto.MaterialGoods(); ShoppingCartGoodsDto.CartGoodsDetailDto.MaterialGoods goods = new ShoppingCartGoodsDto.CartGoodsDetailDto.MaterialGoods();
goods.setMaterialId(materialGoods.getMaterialId()); goods.setSpuId(materialGoods.getSpuId());
goods.setMaterialName(materialGoods.getMaterialName()); goods.setSpuName(materialGoods.getSpuName());
goods.setOriginalPrice(materialGoods.getOriginalPrice()); goods.setOriginalPrice(materialGoods.getOriginalPrice());
goods.setSalePrice(materialGoods.getFinalPrice()); goods.setSalePrice(materialGoods.getFinalPrice());
materialList.add(goods); materialList.add(goods);
...@@ -399,7 +399,7 @@ public class ShoppingCartConvertAdapter { ...@@ -399,7 +399,7 @@ public class ShoppingCartConvertAdapter {
if (CollectionUtils.isNotEmpty(addShoppingCartGoodsRequestVo.getProductMaterialList())) { if (CollectionUtils.isNotEmpty(addShoppingCartGoodsRequestVo.getProductMaterialList())) {
for (MaterialRequestVo materialRequestVo : addShoppingCartGoodsRequestVo.getProductMaterialList()) { for (MaterialRequestVo materialRequestVo : addShoppingCartGoodsRequestVo.getProductMaterialList()) {
CartGoods.MaterialGoods materialGoods = new CartGoods.MaterialGoods(); CartGoods.MaterialGoods materialGoods = new CartGoods.MaterialGoods();
materialGoods.setMaterialId(materialRequestVo.getMaterialId()); materialGoods.setSpuId(materialRequestVo.getSpuId());
materialGoodsList.add(materialGoods); materialGoodsList.add(materialGoods);
} }
} }
......
...@@ -262,8 +262,8 @@ public class ShoppingCartGoodsDto { ...@@ -262,8 +262,8 @@ public class ShoppingCartGoodsDto {
/** /**
* 加料商品ID * 加料商品ID
*/ */
private String materialId; private String spuId;
private String materialName; private String spuName;
/** /**
* 商品行记录:当前元售价 * 商品行记录:当前元售价
*/ */
......
...@@ -381,11 +381,11 @@ public class CartGoods { ...@@ -381,11 +381,11 @@ public class CartGoods {
/** /**
* 加料Id * 加料Id
*/ */
private String materialId; private String spuId;
/** /**
* 加料名称 * 加料名称
*/ */
private String materialName; private String spuName;
/** /**
* 购物车一行商品的原单价 * 购物车一行商品的原单价
*/ */
......
...@@ -19,5 +19,5 @@ public class MaterialRequestVo { ...@@ -19,5 +19,5 @@ public class MaterialRequestVo {
/** /**
* 加料商品ID * 加料商品ID
*/ */
private String materialId; private String spuId;
} }
...@@ -47,7 +47,7 @@ public class MaterialPromotionService implements IPromotionService { ...@@ -47,7 +47,7 @@ public class MaterialPromotionService implements IPromotionService {
for (CartGoods cartGoods : cartGoodsList) { for (CartGoods cartGoods : cartGoodsList) {
if (CollectionUtils.isEmpty(cartGoods.getProductMaterialList())) continue; if (CollectionUtils.isEmpty(cartGoods.getProductMaterialList())) continue;
for (CartGoods.MaterialGoods materialGoods : cartGoods.getProductMaterialList()) { for (CartGoods.MaterialGoods materialGoods : cartGoods.getProductMaterialList()) {
ActivityCalculationDiscountResponseDto.CalculationDiscountResult.ApportionGoods.Material material = map.get(materialGoods.getMaterialId()); ActivityCalculationDiscountResponseDto.CalculationDiscountResult.ApportionGoods.Material material = map.get(materialGoods.getSpuId());
//设置小料行单价和行总价 //设置小料行单价和行总价
if (material.getNowPrice() > 0) { if (material.getNowPrice() > 0) {
materialGoods.setFinalPrice(material.getNowPrice()); materialGoods.setFinalPrice(material.getNowPrice());
...@@ -87,9 +87,9 @@ public class MaterialPromotionService implements IPromotionService { ...@@ -87,9 +87,9 @@ public class MaterialPromotionService implements IPromotionService {
if (map == null && map.isEmpty()) return; if (map == null && map.isEmpty()) return;
List<ShoppingCartGoodsDto.CartGoodsDetailDto> products = shoppingCartGoodsDto.getProducts(); List<ShoppingCartGoodsDto.CartGoodsDetailDto> products = shoppingCartGoodsDto.getProducts();
for (ShoppingCartGoodsDto.CartGoodsDetailDto product : products) { for (ShoppingCartGoodsDto.CartGoodsDetailDto product : products) {
if (product.getMaterialList().size() == 0) return; if (CollectionUtils.isEmpty(product.getMaterialList())) continue;
for (ShoppingCartGoodsDto.CartGoodsDetailDto.MaterialGoods materialGoods : product.getMaterialList()) { for (ShoppingCartGoodsDto.CartGoodsDetailDto.MaterialGoods materialGoods : product.getMaterialList()) {
ActivityCalculationDiscountResponseDto.CalculationDiscountResult.ApportionGoods.Material material = map.get(materialGoods.getMaterialId()); ActivityCalculationDiscountResponseDto.CalculationDiscountResult.ApportionGoods.Material material = map.get(materialGoods.getSpuId());
if (material.getApportionAmount().intValue() == 0) continue; if (material.getApportionAmount().intValue() == 0) continue;
//设置行记录参加的活动及总优惠 //设置行记录参加的活动及总优惠
...@@ -106,6 +106,15 @@ public class MaterialPromotionService implements IPromotionService { ...@@ -106,6 +106,15 @@ public class MaterialPromotionService implements IPromotionService {
product.setProductType(GoodsTypeEnum.MATERIAL.getGoodsType()); product.setProductType(GoodsTypeEnum.MATERIAL.getGoodsType());
} }
} }
//将小料的价格累加到商品行上
for (ShoppingCartGoodsDto.CartGoodsDetailDto product : products) {
if (CollectionUtils.isEmpty(product.getMaterialList())) continue;
for (ShoppingCartGoodsDto.CartGoodsDetailDto.MaterialGoods materialGoods : product.getMaterialList()) {
product.setSalePrice(product.getSalePrice() + materialGoods.getSalePrice());//现金
product.setOriginalPrice(product.getOriginalPrice() + materialGoods.getOriginalPrice());
product.setTotalDiscountAmount(product.getTotalDiscountAmount() + materialGoods.getTotalDiscountAmount());
}
}
} }
/** /**
......
...@@ -857,7 +857,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -857,7 +857,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
for (CartGoods.MaterialGoods materialGoods : cartGoods.getProductMaterialList()) { for (CartGoods.MaterialGoods materialGoods : cartGoods.getProductMaterialList()) {
ActivityCalculationDiscountRequestDto.CalculationDiscountGoods.Material material = new ActivityCalculationDiscountRequestDto.CalculationDiscountGoods.Material(); ActivityCalculationDiscountRequestDto.CalculationDiscountGoods.Material material = new ActivityCalculationDiscountRequestDto.CalculationDiscountGoods.Material();
material.setType(1); material.setType(1);
material.setGoodsId(materialGoods.getMaterialId()); material.setGoodsId(materialGoods.getSpuId());
material.setGoodsQuantity(cartGoods.getQty()); material.setGoodsQuantity(cartGoods.getQty());
material.setOriginalPrice(materialGoods.getFinalPrice()); material.setOriginalPrice(materialGoods.getFinalPrice());
materials.add(material); materials.add(material);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment