|
|
@@ -57,8 +57,7 @@ public class OrderServiceImpl implements OrderService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- //参数可能要加优惠券Id
|
|
|
- public Boolean pay(Integer orderId) {
|
|
|
+ public Boolean pay(Integer orderId,Integer couponId) {
|
|
|
Order order = orderRepository.findById(orderId).orElse(null);
|
|
|
if(order == null){
|
|
|
throw BlueWhaleException.orderNotExists();
|
|
|
@@ -67,8 +66,9 @@ public class OrderServiceImpl implements OrderService {
|
|
|
throw BlueWhaleException.orderStatusError();
|
|
|
}
|
|
|
order.setStatus(OrderStatusEnum.UNSEND);
|
|
|
- double price=productRepository.findById(order.getProductId()).get().getPrice();
|
|
|
- order.setPaid(price*order.getAmount());
|
|
|
+ //double price=productRepository.findById(order.getProductId()).get().getPrice();
|
|
|
+ //order.setPaid(price*order.getAmount());
|
|
|
+ order.setPaid(calculate(orderId,couponId));
|
|
|
orderRepository.save(order);
|
|
|
return true;
|
|
|
}
|
|
|
@@ -136,6 +136,11 @@ public class OrderServiceImpl implements OrderService {
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Double calculate(Integer orderId, Integer couponId) {
|
|
|
+ return 0.0;
|
|
|
+ }
|
|
|
+
|
|
|
private OrderVO wrapWithProductId(OrderVO orderVO){
|
|
|
Integer productId=orderVO.getProductId();
|
|
|
Product product=productRepository.findById(productId).get();
|