cloudroam
2024-11-04 7a5095c394467dacd285009ab88ccf46efcc4732
src/main/java/com/mzl/flower/web/customer/OrderCustomerController.java
@@ -13,7 +13,6 @@
import com.mzl.flower.dto.response.payment.OrderListDTO;
import com.mzl.flower.entity.payment.Order;
import com.mzl.flower.service.payment.OrderService;
import com.mzl.flower.service.payment.UserPaymentSybService;
import com.mzl.flower.service.payment.UserPaymentV3Service;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@@ -38,7 +37,7 @@
    private OrderService orderService;
    @Autowired
    private UserPaymentSybService paymentSybService;
    private UserPaymentV3Service paymentV3Service;
    @GetMapping("/list")
    @ApiOperation(value = "查询订单列表")
@@ -80,12 +79,12 @@
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "订单id", required = true, dataType = "String", paramType = "query")
    })
    public ResponseEntity<ReturnDataDTO<?>> payAgain(String id) throws Exception {
        boolean f = paymentSybService.checkOrderStatusPayAgain(id);
    public ResponseEntity<ReturnDataDTO<?>> payAgain(String id){
        boolean f = paymentV3Service.checkOrderStatus(id, true);
        if(f){
            throw new ValidationException("订单不可再支付");
        }
        return returnData(R.SUCCESS.getCode(), paymentSybService.payAgain(id));
        return returnData(R.SUCCESS.getCode(), paymentV3Service.payAgain(id));
    }
    @GetMapping(value = "/refund")
@@ -95,13 +94,18 @@
    @ApiOperation(value = "退款")
    public ResponseEntity<ReturnDataDTO> refundOrder(String id) throws Exception {
        orderService.refundCheck(id);
        boolean f = paymentSybService.checkOrderStatusRefund(id);
        if(f) {
            throw new ValidationException("订单不可退款");
        }
        paymentSybService.refundOrderCustomer(id);
        paymentV3Service.refundOrder(id);
        return returnData(R.SUCCESS.getCode(), null);
    }
    /*@GetMapping(value = "/refund/check")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "订单id", required = true, dataType = "String", paramType = "query"),
    })
    @ApiOperation(value = "查询退款")
    public ResponseEntity<ReturnDataDTO> refundQuery(String id) {
        return returnData(R.SUCCESS.getCode(), paymentV3Service.refundQuery(id));
    }*/
    @PostMapping("/evaluate")
    @ApiOperation(value = "评价")
@@ -127,8 +131,11 @@
            @ApiImplicitParam(name = "id", value = "订单id", required = true, dataType = "String", paramType = "query"),
    })
    @ApiOperation(value = "取消订单")
    public ResponseEntity<ReturnDataDTO> cancelOrder(String id) throws Exception {
        paymentSybService.cancelOrder(id);
    public ResponseEntity<ReturnDataDTO> cancelOrder(String id) {
        boolean f = paymentV3Service.checkOrderStatus(id);
        if(!f){
            paymentV3Service.cancelOrder(id);
        }
        return returnData(R.SUCCESS.getCode(), null);
    }