gongzuming
2024-10-11 34a5c00c80235213fca81689636c79fbad47a5fe
src/main/java/com/mzl/flower/web/customer/OrderCustomerController.java
@@ -11,7 +11,9 @@
import com.mzl.flower.dto.response.payment.OrderDTO;
import com.mzl.flower.dto.response.payment.OrderItemListDTO;
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;
@@ -36,7 +38,7 @@
    private OrderService orderService;
    @Autowired
    private UserPaymentV3Service paymentV3Service;
    private UserPaymentSybService paymentSybService;
    @GetMapping("/list")
    @ApiOperation(value = "查询订单列表")
@@ -68,7 +70,8 @@
            @ApiImplicitParam(name = "id", value = "订单id", required = true, dataType = "String", paramType = "query")
    })
    public ResponseEntity<ReturnDataDTO<?>> confirmOrderReceive(String id){
        orderService.confirmOrderReceive(id);
        Order o = orderService.confirmOrderReceive(id);
        orderService.processAfterReceive(o);
        return returnData(R.SUCCESS.getCode(), null);
    }
@@ -77,12 +80,12 @@
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "订单id", required = true, dataType = "String", paramType = "query")
    })
    public ResponseEntity<ReturnDataDTO<?>> payAgain(String id){
        boolean f = paymentV3Service.checkOrderStatus(id, true);
    public ResponseEntity<ReturnDataDTO<?>> payAgain(String id) throws Exception {
        boolean f = paymentSybService.checkOrderStatusPayAgain(id);
        if(f){
            throw new ValidationException("订单不可再支付");
        }
        return returnData(R.SUCCESS.getCode(), paymentV3Service.payAgain(id));
        return returnData(R.SUCCESS.getCode(), paymentSybService.payAgain(id));
    }
    @GetMapping(value = "/refund")
@@ -90,20 +93,15 @@
            @ApiImplicitParam(name = "id", value = "订单id", required = true, dataType = "String", paramType = "query"),
    })
    @ApiOperation(value = "退款")
    public ResponseEntity<ReturnDataDTO> refundOrder(String id) {
    public ResponseEntity<ReturnDataDTO> refundOrder(String id) throws Exception {
        orderService.refundCheck(id);
        paymentV3Service.refundOrder(id);
        boolean f = paymentSybService.checkOrderStatusRefund(id);
        if(f) {
            throw new ValidationException("订单不可退款");
        }
        paymentSybService.refundOrderCustomer(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 = "评价")
@@ -129,11 +127,8 @@
            @ApiImplicitParam(name = "id", value = "订单id", required = true, dataType = "String", paramType = "query"),
    })
    @ApiOperation(value = "取消订单")
    public ResponseEntity<ReturnDataDTO> cancelOrder(String id) {
        boolean f = paymentV3Service.checkOrderStatus(id);
        if(!f){
            paymentV3Service.cancelOrder(id);
        }
    public ResponseEntity<ReturnDataDTO> cancelOrder(String id) throws Exception {
        paymentSybService.cancelOrder(id);
        return returnData(R.SUCCESS.getCode(), null);
    }
@@ -146,4 +141,19 @@
        orderService.deleteOrder(id);
        return returnData(R.SUCCESS.getCode(), null);
    }
    @GetMapping(value = "/copyOrder")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "订单id", required = true, dataType = "String", paramType = "query"),
    })
    @ApiOperation(value = "再来一单")
    public ResponseEntity<ReturnDataDTO> copyOrder(String id) {
        String message=orderService.copyOrder(id);
        return returnData(R.SUCCESS.getCode(),null, message);
    }
}