|
|
@@ -22,18 +22,16 @@ public class PayService {
|
|
|
private UserWalletService userWalletService;
|
|
|
|
|
|
private final OrderService orderService;
|
|
|
- private final ProductMapper productMapper;
|
|
|
- private MallRepository mallRepository;
|
|
|
+ private final MallRepository mallRepository;
|
|
|
|
|
|
- public PayService(OrderService orderService, ProductMapper productMapper, MallRepository mallRepository) {
|
|
|
+ public PayService(OrderService orderService, MallRepository mallRepository) {
|
|
|
this.orderService = orderService;
|
|
|
- this.productMapper = productMapper;
|
|
|
this.mallRepository = mallRepository;
|
|
|
}
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Result payOrder(long orderId) {
|
|
|
- Order order = orderService.getOrder(orderId);
|
|
|
+ Order order = mallRepository.getOrder(orderId);
|
|
|
if (order != null && order.getStatus() == OrderStatus.toPay.getCode()) {
|
|
|
long sellerId = mallRepository.getProduct(order.getProductId()).getSellerId();
|
|
|
int amount = order.getAmount();
|
|
|
@@ -45,7 +43,6 @@ public class PayService {
|
|
|
Result result = userWalletService.pay(loginUser, quantity, sellerId);
|
|
|
if (result.getCode() == ResultStatus.SUCCESS.getCode()) {
|
|
|
// 更新订单状态
|
|
|
- orderService.payOrder(orderId);
|
|
|
mallRepository.updatePayOrder(orderId);
|
|
|
}
|
|
|
|