forked from Q-1515/reggie_parent
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
707 additions
and
6 deletions.
There are no files selected for viewing
122 changes: 122 additions & 0 deletions
122
reggie_server/src/main/java/com/reggie/controller/user/OrderController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
package com.reggie.controller.user; | ||
|
||
import com.reggie.dto.OrdersPaymentDTO; | ||
import com.reggie.dto.OrdersSubmitDTO; | ||
import com.reggie.result.PageResult; | ||
import com.reggie.result.R; | ||
import com.reggie.service.OrderService; | ||
import com.reggie.vo.OrderPaymentVO; | ||
import com.reggie.vo.OrderSubmitVO; | ||
import com.reggie.vo.OrderVO; | ||
import io.swagger.annotations.Api; | ||
import io.swagger.annotations.ApiOperation; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
/** | ||
* 订单 | ||
*/ | ||
@RestController("userOrderController") | ||
@RequestMapping("/user/order") | ||
@Slf4j | ||
@Api(tags = "C端-订单接口") | ||
public class OrderController { | ||
|
||
@Autowired | ||
private OrderService orderService; | ||
|
||
/** | ||
* 用户下单 | ||
* | ||
* @param ordersSubmitDTO 订单购买信息 | ||
* @return 订单信息(订单id,金额,订单号,下单时间) | ||
*/ | ||
@PostMapping("/submit") | ||
@ApiOperation("用户下单") | ||
public R<OrderSubmitVO> submit(@RequestBody OrdersSubmitDTO ordersSubmitDTO) { | ||
log.info("用户下单:{}", ordersSubmitDTO); | ||
OrderSubmitVO orderSubmitVO = orderService.submitOrder(ordersSubmitDTO); | ||
return R.success(orderSubmitVO); | ||
} | ||
|
||
/** | ||
* 订单支付 | ||
* | ||
* @param ordersPaymentDTO | ||
* @return | ||
*/ | ||
@PutMapping("/payment") | ||
@ApiOperation("订单支付") | ||
public R<OrderPaymentVO> payment(@RequestBody OrdersPaymentDTO ordersPaymentDTO) { | ||
log.info("订单支付:{}",ordersPaymentDTO); | ||
OrderPaymentVO orderPaymentVO = orderService.payment(ordersPaymentDTO); | ||
return R.success(orderPaymentVO); | ||
} | ||
|
||
/** | ||
* 历史订单查询 | ||
* | ||
* @param page | ||
* @param pageSize | ||
* @param status 订单状态 1待付款 2待接单 3已接单 4派送中 5已完成 6已取消 7退款 | ||
* @return | ||
*/ | ||
@GetMapping("/historyOrders") | ||
@ApiOperation("历史订单查询") | ||
public R<PageResult> page(int page, int pageSize, Integer status) { | ||
PageResult pageResult = orderService.pageQuery4User(page, pageSize, status); | ||
return R.success(pageResult); | ||
} | ||
|
||
/** | ||
* 查询订单详情 | ||
* | ||
* @param id | ||
* @return | ||
*/ | ||
@GetMapping("/orderDetail/{id}") | ||
@ApiOperation("查询订单详情") | ||
public R<OrderVO> details(@PathVariable("id") Long id) { | ||
OrderVO orderVO = orderService.details(id); | ||
return R.success(orderVO); | ||
} | ||
|
||
/** | ||
* 催单 | ||
* | ||
* @param id | ||
* @return | ||
*/ | ||
@GetMapping("/reminder/{id}") | ||
@ApiOperation("催单") | ||
public R reminder(@PathVariable("id") Long id) { | ||
orderService.reminder(id); | ||
return R.success(); | ||
} | ||
|
||
/** | ||
* 用户取消订单 | ||
* | ||
* @return | ||
*/ | ||
@PutMapping("/cancel/{id}") | ||
@ApiOperation("取消订单") | ||
public R cancel(@PathVariable("id") Long id) { | ||
orderService.userCancelById(id); | ||
return R.success(); | ||
} | ||
|
||
/** | ||
* 再来一单 | ||
* | ||
* @param id | ||
* @return | ||
*/ | ||
@PostMapping("/repetition/{id}") | ||
@ApiOperation("再来一单") | ||
public R repetition(@PathVariable Long id) { | ||
orderService.repetition(id); | ||
return R.success(); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
reggie_server/src/main/java/com/reggie/mapper/OrderDetailMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.reggie.mapper; | ||
|
||
import com.reggie.entity.OrderDetail; | ||
import org.apache.ibatis.annotations.Mapper; | ||
import java.util.List; | ||
|
||
@Mapper | ||
public interface OrderDetailMapper { | ||
/** | ||
* 批量插入订单明细数据 | ||
* @param orderDetails | ||
*/ | ||
void insertBatch(List<OrderDetail> orderDetails); | ||
|
||
/** | ||
* 根据订单id查询订单明细 | ||
* @param orderId | ||
* @return | ||
*/ | ||
List<OrderDetail> getDetailByOrderId(Long orderId); | ||
|
||
} |
46 changes: 46 additions & 0 deletions
46
reggie_server/src/main/java/com/reggie/mapper/OrderMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.reggie.mapper; | ||
|
||
import com.github.pagehelper.Page; | ||
import com.reggie.entity.Orders; | ||
import org.apache.ibatis.annotations.Mapper; | ||
|
||
import java.util.Map; | ||
|
||
@Mapper | ||
public interface OrderMapper { | ||
/** | ||
* 插入订单数据 | ||
* @param order | ||
*/ | ||
void insert(Orders order); | ||
|
||
/** | ||
* 根据订单号和用户id查询订单 | ||
* @param orderNumber | ||
* @param userId | ||
* @return | ||
*/ | ||
Orders getByNumber(String orderNumber, Long userId); | ||
|
||
/** | ||
* 修改订单信息 | ||
* @param orders | ||
*/ | ||
void updateOrdersById(Orders orders); | ||
|
||
/** | ||
* 分页条件查询并按下单时间排序 | ||
* | ||
* @param map | ||
* @return | ||
*/ | ||
Page<Orders> pageQuerySortByOrderTime(Map map); | ||
|
||
/** | ||
* 根据id查询订单 | ||
* @param id | ||
* @return | ||
*/ | ||
Orders getById(Long id); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
reggie_server/src/main/java/com/reggie/service/OrderDetailService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.reggie.service; | ||
|
||
public interface OrderDetailService { | ||
|
||
} |
32 changes: 32 additions & 0 deletions
32
reggie_server/src/main/java/com/reggie/service/OrderService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.reggie.service; | ||
|
||
import com.reggie.dto.OrdersPaymentDTO; | ||
import com.reggie.dto.OrdersSubmitDTO; | ||
import com.reggie.result.PageResult; | ||
import com.reggie.vo.OrderPaymentVO; | ||
import com.reggie.vo.OrderSubmitVO; | ||
import com.reggie.vo.OrderVO; | ||
|
||
public interface OrderService { | ||
|
||
//用户下单 | ||
OrderSubmitVO submitOrder(OrdersSubmitDTO ordersSubmitDTO); | ||
|
||
//订单支付 | ||
OrderPaymentVO payment(OrdersPaymentDTO ordersPaymentDTO); | ||
|
||
//用户端订单分页查询 | ||
PageResult pageQuery4User(int page, int pageSize, Integer status); | ||
|
||
//查询订单详情 | ||
OrderVO details(Long id); | ||
|
||
//催单 | ||
void reminder(Long id); | ||
|
||
//用户取消订单 | ||
void userCancelById(Long id); | ||
|
||
//再来一单 | ||
void repetition(Long id); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
reggie_server/src/main/java/com/reggie/service/impl/OrderDetailServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.reggie.service.impl; | ||
|
||
import com.reggie.mapper.OrderDetailMapper; | ||
import com.reggie.service.OrderDetailService; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Service; | ||
|
||
/** | ||
* 订单 | ||
*/ | ||
@Service | ||
@Slf4j | ||
public class OrderDetailServiceImpl implements OrderDetailService { | ||
|
||
@Autowired | ||
private OrderDetailMapper orderDetailMapper; | ||
|
||
} |
Oops, something went wrong.