| | |
| | | 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; |
| | |
| | | private OrderService orderService; |
| | | |
| | | @Autowired |
| | | private UserPaymentV3Service paymentV3Service; |
| | | private UserPaymentSybService paymentSybService; |
| | | |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "查询订单列表") |
| | |
| | | @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); |
| | | } |
| | | |
| | |
| | | @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") |
| | |
| | | @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 = "评价") |
| | |
| | | @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); |
| | | } |
| | | |
| | |
| | | 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); |
| | | } |
| | | |
| | | } |