Merge branch 'ww' into test

This commit is contained in:
wangw 2024-09-23 14:00:39 +08:00
commit 21d0a29878
4 changed files with 12 additions and 1 deletions

View File

@ -205,4 +205,8 @@ public interface TbProductSkuRepository extends JpaRepository<TbProductSku, Inte
@Modifying
@Query("update TbProductSku set isGrounding=:isGrounding where id=:skuId")
void updateGrounding(Integer skuId,int isGrounding);
@Modifying
@Query("update TbProductSku set salePrice = :salePrice where productId=:productId")
void upSalePrice(@Param("productId") Integer productId, @Param("lowPrice") BigDecimal salePrice);
}

View File

@ -379,6 +379,12 @@ public class StockServiceImpl implements StockService {
description.append(" 库存数量修改为:"+updateValueVO.getValue()+" 原库存:"+product.getStockNumber());
sqlQuery.append(" set stock_number = ").append(updateValueVO.getValue());
break;
case "salePrice"://价格
description.append("修改价格为" + updateValueVO.getValue());
sqlQuery.append(" set low_price = ").append(updateValueVO.getValue());
tbProductRepository.upLowPrice(product.getId(),new BigDecimal(updateValueVO.getValue()));
tbProductSkuRepository.upSalePrice(product.getId(),new BigDecimal(updateValueVO.getValue()));
break;
// case "stock"://库存开关
// if (!"0".equals(updateValueVO.getValue()) && !"1".equals(updateValueVO.getValue())) {
// throw new BadRequestException("无效值");

View File

@ -249,6 +249,7 @@ public class TbProductServiceImpl implements TbProductService {
TbProductNewVo productNewVo = new TbProductNewVo();
BeanUtils.copyProperties(product, productNewVo);
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();

View File

@ -13,7 +13,7 @@ public class StockUpdateValueVO {
private String shopId;
@NotNull
private boolean isSku;
@NotNull(message = "主键不可为空")
// @NotNull(message = "主键不可为空")
private String id;
@NotNull(message = "key不可为空")
private String key;