44 lines
1.5 KiB
Java
Raw Normal View History

2024-04-23 12:23:43 +08:00
package com.sky.controller.user;
2024-08-07 14:11:29 +08:00
import com.sky.dto.OrdersPaymentDTO;
2024-04-23 12:23:43 +08:00
import com.sky.dto.OrdersSubmitDTO;
import com.sky.result.Result;
import com.sky.service.OrderService;
2024-08-07 14:11:29 +08:00
import com.sky.vo.OrderPaymentVO;
2024-04-23 12:23:43 +08:00
import com.sky.vo.OrderSubmitVO;
import io.swagger.annotations.Api;
2024-08-07 14:11:29 +08:00
import io.swagger.annotations.ApiOperation;
2024-04-23 12:23:43 +08:00
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
2024-08-07 14:11:29 +08:00
import org.springframework.web.bind.annotation.*;
2024-04-23 12:23:43 +08:00
@RestController
@Api("用户订单相关接口")
@Slf4j
@RequestMapping("/user/order")
public class OrderController {
@Autowired
private OrderService orderService;
@PostMapping("/submit")
2024-08-07 14:11:29 +08:00
@ApiOperation("提交订单")
2024-04-23 12:23:43 +08:00
public Result<OrderSubmitVO> submit(@RequestBody OrdersSubmitDTO ordersSubmitDTO){
OrderSubmitVO orderSubmitVO=orderService.submit(ordersSubmitDTO);
return Result.success(orderSubmitVO);
}
2024-08-07 14:11:29 +08:00
/**
* 订单支付
*
* @param ordersPaymentDTO
* @return
*/
@PutMapping("/payment")
@ApiOperation("订单支付")
public Result<OrderPaymentVO> payment(@RequestBody OrdersPaymentDTO ordersPaymentDTO) throws Exception {
log.info("订单支付:{}", ordersPaymentDTO);
OrderPaymentVO orderPaymentVO = orderService.payment(ordersPaymentDTO);
log.info("生成预支付交易单:{}", orderPaymentVO);
orderService.paySuccess(ordersPaymentDTO.getOrderNumber());
return Result.success(orderPaymentVO);
}
2024-04-23 12:23:43 +08:00
}