Merge branch 'ww' into test

This commit is contained in:
wangw 2024-10-10 16:20:54 +08:00
commit cee923159c
1 changed files with 14 additions and 14 deletions

View File

@ -253,9 +253,13 @@ public class TbProductServiceImpl implements TbProductService {
productNewVo.setLowPrice(product.getLowPrice().toString());
productNewVo.setStockNumber(Double.valueOf(product.getStockNumber()));
List<TbProductSku> tbProductSkus = tbProductSkuRepository.searchSku(product.getId().toString());
if (tbProductSkus.size() > 1) {
BigDecimal maxPrice = tbProductSkus.stream().map(TbProductSku::getSalePrice).max(BigDecimal::compareTo).get();
productNewVo.setLowPrice("" +productNewVo.getLowPrice() + "~¥" + maxPrice);
if ("sku".equals(product.getTypeEnum())){
if(tbProductSkus.size() > 1){
BigDecimal maxPrice = tbProductSkus.stream().map(TbProductSku::getSalePrice).max(BigDecimal::compareTo).get();
productNewVo.setLowPrice("" +productNewVo.getLowPrice() + "~¥" + maxPrice);
}else {
productNewVo.setLowPrice("" +productNewVo.getLowPrice());
}
}
ViewConSku viewConSku = new ViewConSku();
viewConSku.setShopId(Integer.valueOf(product.getShopId()));
@ -433,10 +437,8 @@ public class TbProductServiceImpl implements TbProductService {
product.setStatus(1);
product.setCreatedAt(Instant.now().toEpochMilli());
product.setUpdatedAt(Instant.now().toEpochMilli());
if ("sku".equals(resources.getTypeEnum())) {
List<BigDecimal> collect = resources.getSkuList().stream().map(TbProductSku::getSalePrice).sorted().collect(Collectors.toList());
product.setLowPrice(collect.get(0));
}
List<BigDecimal> lowPrice = resources.getSkuList().stream().map(TbProductSku::getSalePrice).sorted().collect(Collectors.toList());
product.setLowPrice(lowPrice.get(0));
if ("group".equals(resources.getTypeEnum())) {
//套餐内容
if (!resources.getGroupSnap().isEmpty()) {
@ -505,13 +507,13 @@ public class TbProductServiceImpl implements TbProductService {
StringBuilder description = new StringBuilder("商品" + source.getName());
//上架 库存开关 设为推荐
if (resources.getIsHot().equals(source.getIsHot())) {
description.append((resources.getIsHot() == 0 ? ",已取消" : ",已设为") + "推荐");
description.append(resources.getIsHot() == 0 ? ",已取消" : ",已设为").append("推荐");
}
if (resources.getIsGrounding().equals(source.getIsGrounding())) {
description.append((resources.getIsGrounding() == 0 ? ",已取消" : ",已设为") + "上架");
description.append(resources.getIsGrounding() == 0 ? ",已取消" : ",已设为").append("上架");
}
if (resources.getIsStock().equals(source.getIsStock())) {
description.append((resources.getIsStock() == 0 ? ",已关闭" : ",已打开") + "库存开关");
description.append(resources.getIsStock() == 0 ? ",已关闭" : ",已打开").append("库存开关");
}
TbProduct product = new TbProduct();
//组装
@ -540,10 +542,8 @@ public class TbProductServiceImpl implements TbProductService {
product.setUpdatedAt(Instant.now().toEpochMilli());
product.setImages(resources.getImages().toString());
product.setStockNumber(resources.getStockNumber().intValue());
if ("sku".equals(resources.getTypeEnum())) {
List<BigDecimal> collect = resources.getSkuList().stream().map(TbProductSku::getSalePrice).sorted().collect(Collectors.toList());
product.setLowPrice(collect.get(0));
}
List<BigDecimal> lowPrices = resources.getSkuList().stream().map(TbProductSku::getSalePrice).sorted().collect(Collectors.toList());
product.setLowPrice(lowPrices.get(0));
if ("group".equals(resources.getTypeEnum())) {
//套餐内容
if (!resources.getGroupSnap().isEmpty()) {