From 4138fbb0a67b070beda2d13b27ff213ccf2a24de Mon Sep 17 00:00:00 2001
From: gongzuming <gongzuming>
Date: 星期二, 29 十月 2024 11:33:58 +0800
Subject: [PATCH] 优化
---
src/main/java/com/mzl/flower/web/customer/OrderCustomerController.java | 52 +++++++++++++++++++++++++++++++---------------------
1 files changed, 31 insertions(+), 21 deletions(-)
diff --git a/src/main/java/com/mzl/flower/web/customer/OrderCustomerController.java b/src/main/java/com/mzl/flower/web/customer/OrderCustomerController.java
index cf1772b..4247628 100644
--- a/src/main/java/com/mzl/flower/web/customer/OrderCustomerController.java
+++ b/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);
+ }
+
}
--
Gitblit v1.9.3