Explorar o código

更新 content-service mall 模块

reghao hai 1 ano
pai
achega
8afb292ebb

+ 0 - 5
content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/service/OrderService.java

@@ -84,11 +84,6 @@ public class OrderService {
         return orderId;
     }
 
-    public void payOrder(long orderId) {
-        int status = OrderStatus.toDelivery.getCode();
-        orderMapper.updateOrderStatus(orderId, status);
-    }
-
     public void deliveryOrder(long orderId) {
         int status = OrderStatus.toConfirm.getCode();
         orderMapper.updateOrderStatus(orderId, status);

+ 3 - 6
content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/service/PayService.java

@@ -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);
             }