use of com.paascloud.provider.model.dto.ProductDto in project paascloud-master by paascloud.
the class OmcCartServiceImpl method updateCartList.
@Override
public int updateCartList(List<CartProductVo> cartProductVoList) {
logger.info("updateCartList - 更新购物车集合 cartProductVoList={}", cartProductVoList);
LoginAuthDto loginUser = new LoginAuthDto();
loginUser.setLoginName(GlobalConstant.Sys.SUPER_MANAGER_LOGIN_NAME);
loginUser.setUserId(1L);
for (CartProductVo cartProductVo : cartProductVoList) {
Integer quantity = cartProductVo.getQuantity();
Integer productChecked = cartProductVo.getChecked();
Long productId = cartProductVo.getProductId();
ProductDto productDto = mdcProductService.selectById(productId);
if (PublicUtil.isEmpty(productDto)) {
throw new MdcBizException(ErrorCodeEnum.MDC10021004, productId);
}
OmcCart omcCart = new OmcCart();
omcCart.setUserId(loginUser.getUserId());
omcCart.setQuantity(quantity);
omcCart.setChecked(productChecked);
omcCart.setProductId(productId);
omcCart.setQuantity(quantity);
this.saveCart(omcCart, loginUser);
}
return 1;
}
use of com.paascloud.provider.model.dto.ProductDto in project paascloud-master by paascloud.
the class OmcOrderServiceImpl method reduceProductStock.
private void reduceProductStock(List<OmcOrderDetail> omcOrderDetailList) {
for (OmcOrderDetail orderItem : omcOrderDetailList) {
ProductDto product = mdcProductService.selectById(orderItem.getProductId());
product.setChangeStock(0 - orderItem.getQuantity());
mdcProductService.updateProductStockById(product);
}
}
Aggregations