|
|
|
@ -126,7 +126,7 @@ public class ProductController { |
|
|
|
|
@PostMapping("/save") |
|
|
|
|
@ApiOperation(value = "保存商品信息") |
|
|
|
|
public ServerResponseEntity<String> save(@Valid @RequestBody ProductParam productParam,HttpServletRequest request) { |
|
|
|
|
productParam.setShopId(TokenUtils.getShopIdByJwtToken(request)); |
|
|
|
|
// productParam.setShopId(TokenUtils.getShopIdByJwtToken(request));
|
|
|
|
|
checkParam(productParam); |
|
|
|
|
Product product = BeanUtil.copyProperties(productParam, Product.class); |
|
|
|
|
product.setShopId(TokenUtils.getShopIdByJwtToken(request)); |
|
|
|
@ -144,7 +144,7 @@ public class ProductController { |
|
|
|
|
@PostMapping("/update") |
|
|
|
|
@ApiOperation(value = "修改商品信息") |
|
|
|
|
public ServerResponseEntity<String> update(@Valid @RequestBody ProductParam productParam,HttpServletRequest request) { |
|
|
|
|
productParam.setShopId(TokenUtils.getShopIdByJwtToken(request)); |
|
|
|
|
// productParam.setShopId(TokenUtils.getShopIdByJwtToken(request));
|
|
|
|
|
checkParam(productParam); |
|
|
|
|
Product dbProduct = productService.getProductByProdId(productParam.getProdId()); |
|
|
|
|
if (!Objects.equals(dbProduct.getShopId(), TokenUtils.getShopIdByJwtToken(request))) { |
|
|
|
@ -180,9 +180,9 @@ public class ProductController { |
|
|
|
|
*/ |
|
|
|
|
public ServerResponseEntity<Void> delete(Integer prodId,HttpServletRequest request) { |
|
|
|
|
Product dbProduct = productService.getProductByProdId(prodId); |
|
|
|
|
if (!Objects.equals(dbProduct.getShopId(), TokenUtils.getShopIdByJwtToken(request))) { |
|
|
|
|
throw new YamiShopBindException("无法获取非本店铺商品信息"); |
|
|
|
|
} |
|
|
|
|
// if (!Objects.equals(dbProduct.getShopId(), TokenUtils.getShopIdByJwtToken(request))) {
|
|
|
|
|
// throw new YamiShopBindException("无法获取非本店铺商品信息");
|
|
|
|
|
// }
|
|
|
|
|
List<Sku> dbSkus = skuService.listByProdId(dbProduct.getProdId()); |
|
|
|
|
// 删除商品
|
|
|
|
|
productService.removeProductByProdId(prodId); |
|
|
|
|