Merge branch 'ww' into test
This commit is contained in:
commit
21d0a29878
|
|
@ -205,4 +205,8 @@ public interface TbProductSkuRepository extends JpaRepository<TbProductSku, Inte
|
||||||
@Modifying
|
@Modifying
|
||||||
@Query("update TbProductSku set isGrounding=:isGrounding where id=:skuId")
|
@Query("update TbProductSku set isGrounding=:isGrounding where id=:skuId")
|
||||||
void updateGrounding(Integer skuId,int isGrounding);
|
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);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -379,6 +379,12 @@ public class StockServiceImpl implements StockService {
|
||||||
description.append(" 库存数量修改为:"+updateValueVO.getValue()+" 原库存:"+product.getStockNumber());
|
description.append(" 库存数量修改为:"+updateValueVO.getValue()+" 原库存:"+product.getStockNumber());
|
||||||
sqlQuery.append(" set stock_number = ").append(updateValueVO.getValue());
|
sqlQuery.append(" set stock_number = ").append(updateValueVO.getValue());
|
||||||
break;
|
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"://库存开关
|
// case "stock"://库存开关
|
||||||
// if (!"0".equals(updateValueVO.getValue()) && !"1".equals(updateValueVO.getValue())) {
|
// if (!"0".equals(updateValueVO.getValue()) && !"1".equals(updateValueVO.getValue())) {
|
||||||
// throw new BadRequestException("无效值");
|
// throw new BadRequestException("无效值");
|
||||||
|
|
|
||||||
|
|
@ -249,6 +249,7 @@ public class TbProductServiceImpl implements TbProductService {
|
||||||
TbProductNewVo productNewVo = new TbProductNewVo();
|
TbProductNewVo productNewVo = new TbProductNewVo();
|
||||||
BeanUtils.copyProperties(product, productNewVo);
|
BeanUtils.copyProperties(product, productNewVo);
|
||||||
productNewVo.setLowPrice("¥" + product.getLowPrice().toString());
|
productNewVo.setLowPrice("¥" + product.getLowPrice().toString());
|
||||||
|
productNewVo.setStockNumber(Double.valueOf(product.getStockNumber()));
|
||||||
List<TbProductSku> tbProductSkus = tbProductSkuRepository.searchSku(product.getId().toString());
|
List<TbProductSku> tbProductSkus = tbProductSkuRepository.searchSku(product.getId().toString());
|
||||||
if (tbProductSkus.size() > 1) {
|
if (tbProductSkus.size() > 1) {
|
||||||
BigDecimal maxPrice = tbProductSkus.stream().map(TbProductSku::getSalePrice).max(BigDecimal::compareTo).get();
|
BigDecimal maxPrice = tbProductSkus.stream().map(TbProductSku::getSalePrice).max(BigDecimal::compareTo).get();
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ public class StockUpdateValueVO {
|
||||||
private String shopId;
|
private String shopId;
|
||||||
@NotNull
|
@NotNull
|
||||||
private boolean isSku;
|
private boolean isSku;
|
||||||
@NotNull(message = "主键不可为空")
|
// @NotNull(message = "主键不可为空")
|
||||||
private String id;
|
private String id;
|
||||||
@NotNull(message = "key不可为空")
|
@NotNull(message = "key不可为空")
|
||||||
private String key;
|
private String key;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue