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);
|
2024-01-10 16:38:06 +08:00
|
|
|
// TODO 跳过微信支付
|
|
|
|
orderService.paySuccess(ordersPaymentDTO.getOrderNumber());
|
2024-01-10 13:43:58 +08:00
|
|
|
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
|
|
|
}
|