|
|
@@ -16,6 +16,7 @@ import com.uas.platform.b2c.prod.product.brand.dao.BrandDao;
|
|
|
import com.uas.platform.b2c.prod.product.brand.modal.Brand;
|
|
|
import com.uas.platform.b2c.prod.product.component.dao.ComponentDao;
|
|
|
import com.uas.platform.b2c.prod.product.component.modal.Component;
|
|
|
+import com.uas.platform.b2c.trade.order.dao.OrderDetailDao;
|
|
|
import com.uas.platform.b2c.trade.order.model.Order;
|
|
|
import com.uas.platform.b2c.trade.order.model.Purchase;
|
|
|
import com.uas.platform.b2c.trade.order.model.PurchaseDetail;
|
|
|
@@ -111,6 +112,12 @@ public class ProductServiceImpl implements ProductService {
|
|
|
@Autowired
|
|
|
private OrderService orderService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ProductDetailDao productDetailDao;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private OrderDetailDao orderDetailDao;
|
|
|
+
|
|
|
private ConcurrentHashMap<String, Field> sortFields = new ConcurrentHashMap<String, Field>();
|
|
|
|
|
|
@Override
|
|
|
@@ -597,5 +604,25 @@ public class ProductServiceImpl implements ProductService {
|
|
|
public List<Product> save(List<Product> products) {
|
|
|
return productDao.save(products);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ProductDetail findByProductId(Long id) {
|
|
|
+ Product product = productDao.findOne(id);
|
|
|
+ if (product == null) {
|
|
|
+ throw new IllegalOperatorException("此产品不存在,请重新确认产品信息");
|
|
|
+ }
|
|
|
+ ProductDetail productDetail = productDetailDao.findByProductId(id);
|
|
|
+ if (productDetail != null) {
|
|
|
+ Double b2cReserve = 0d;
|
|
|
+ if (product.getCmpUuId() != null) {// 获取当前商城已上架数量(含锁库存)
|
|
|
+ b2cReserve = goodsDao.getSumReserveByEnUUAndUuidAndStatus(SystemSession.getUser().getEnterprise().getUu(), product.getCmpUuId(), Status.AVAILABLE.value());
|
|
|
+ Double lockReserve = orderDetailDao.getSumReserveBySupEnUuAndUuidAndStatus(SystemSession.getUser().getEnterprise().getUu(), product.getCmpUuId(), Status.TOBEPAID.value());
|
|
|
+ b2cReserve = b2cReserve + (lockReserve == null ? 0d :lockReserve);
|
|
|
+ }
|
|
|
+ productDetail.setB2cReserve(b2cReserve);
|
|
|
+ }
|
|
|
+
|
|
|
+ return productDetail;
|
|
|
+ }
|
|
|
}
|
|
|
|