sky-take-out/sky-server/src/main/java/com/sky/controller/user/OrderController.java

66 lines
1.9 KiB
Java
Raw Normal View History

2024-01-10 10:49:58 +08:00
package com.sky.controller.user;
2024-01-10 13:43:58 +08:00
import com.sky.dto.OrdersPaymentDTO;
2024-01-10 10:49:58 +08:00
import com.sky.dto.OrdersSubmitDTO;
import com.sky.result.Result;
import com.sky.service.OrderService;
2024-01-10 13:43:58 +08:00
import com.sky.vo.OrderPaymentVO;
2024-01-10 10:49:58 +08:00
import com.sky.vo.OrderSubmitVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
2024-01-10 13:43:58 +08:00
import org.springframework.web.bind.annotation.*;
2024-01-10 10:49:58 +08:00
import javax.annotation.Resource;
@RestController("userOrderController")
@RequestMapping("/user/order")
@Api(tags = "用户端订单相关接口")
@Slf4j
public class OrderController {
@Resource
private OrderService orderService;
/**
* 用户下单
*
* @param ordersSubmitDTO 订单请求数据
* @return Result<OrderSubmitVO>
*/
@ApiOperation("用户下单")
@PostMapping("/submit")
public Result<OrderSubmitVO> submit(@RequestBody OrdersSubmitDTO ordersSubmitDTO) {
log.info("用户下单:{}", ordersSubmitDTO);
OrderSubmitVO orderSubmitVO = orderService.submitOrder(ordersSubmitDTO);
return Result.success(orderSubmitVO);
}
2024-01-10 13:43:58 +08:00
/**
* 订单支付
*
2024-01-10 16:23:29 +08:00
* @param ordersPaymentDTO OrdersPaymentDTO
* @return Result<OrderPaymentVO>
2024-01-10 13:43:58 +08:00
*/
@PutMapping("/payment")
@ApiOperation("订单支付")
public Result<OrderPaymentVO> payment(@RequestBody OrdersPaymentDTO ordersPaymentDTO) throws Exception {
log.info("订单支付:{}", ordersPaymentDTO);
OrderPaymentVO orderPaymentVO = orderService.payment(ordersPaymentDTO);
log.info("生成预支付交易单:{}", orderPaymentVO);
return Result.success(orderPaymentVO);
}
2024-01-10 16:23:29 +08:00
/**
* 客户催单
*
* @param id Long
* @return Result<String>
*/
@ApiOperation("客户催单")
@GetMapping("/reminder/{id}")
public Result<String> reminder(@PathVariable("id") Long id) {
orderService.reminder(id);
return Result.success();
}
2024-01-10 10:49:58 +08:00
}