feat:查询超市商品更新
This commit is contained in:
1 parent
c7b5785f66
commit
13d9bee30c
1 file changed
+11
-2
+11
-2
@@ -34,6 +34,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
@@ -165,8 +166,15 @@ public class HardCarServiceImpl extends ServiceImpl<HardCarMapper, HardCarEntity
|
||||
for (HardCreateCarDto v : list) {
|
||||
supList.stream().filter(i -> ObjectUtil.equals(i.getId(), v.getProductId())).findFirst().ifPresent(spu -> {
|
||||
Integer price = getSupermarket(spu);
|
||||
int itemTotalPrice = v.getProductCount() * price;
|
||||
supermarketTotalPrice.addAndGet(itemTotalPrice);
|
||||
if (ObjectUtil.isNotEmpty(v.getProductCount()) && !ObjectUtil.equals(v.getProductCount(), 0)) {
|
||||
int itemTotalPrice = v.getProductCount() * price;
|
||||
supermarketTotalPrice.addAndGet(itemTotalPrice);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(v.getProductWeight()) && !ObjectUtil.equals(v.getProductWeight(), 0)) {
|
||||
// 向上取整
|
||||
int itemTotalPrice = v.getProductWeight().multiply(BigDecimal.valueOf(price)).setScale(0, RoundingMode.CEILING).intValue();
|
||||
supermarketTotalPrice.addAndGet(itemTotalPrice);
|
||||
}
|
||||
});
|
||||
}
|
||||
yield supermarketTotalPrice.get();
|
||||
@@ -301,6 +309,7 @@ public class HardCarServiceImpl extends ServiceImpl<HardCarMapper, HardCarEntity
|
||||
);
|
||||
}
|
||||
|
||||
// 获取超市商品价格
|
||||
private Integer getSupermarket(SmErpUnitWithSpuVo vo) {
|
||||
if (ObjectUtil.isEmpty(vo)) return 0;
|
||||
if (ObjectUtil.isNotEmpty(vo.getPromotionPrice()) && !ObjectUtil.equals(vo.getPromotionPrice(), 0)) {
|
||||
|
||||
Reference in new issue
Block a user