Commit e17741d67a33ebeb6dc4e39b683c10823782d54d
1 parent
4948df24
[modify name]
Showing
6 changed files
with
50 additions
and
23 deletions
src/main/java/com/diligrp/xtrade/order/controllor/OrderApiController.java
1 | 1 | package com.diligrp.xtrade.order.controllor; |
2 | 2 | |
3 | -import java.util.List; | |
4 | - | |
5 | 3 | import javax.annotation.Resource; |
6 | 4 | |
7 | 5 | import org.springframework.validation.annotation.Validated; |
... | ... | @@ -11,10 +9,11 @@ import org.springframework.web.bind.annotation.RequestMethod; |
11 | 9 | import org.springframework.web.bind.annotation.RestController; |
12 | 10 | |
13 | 11 | import com.diligrp.xtrade.order.domain.dto.OrderCreateRequestDto; |
14 | -import com.diligrp.xtrade.order.domain.dto.OrderQueryRequestDto; | |
15 | -import com.diligrp.xtrade.order.domain.dto.OrderQueryResponseDto; | |
12 | +import com.diligrp.xtrade.order.domain.dto.OrderRequestDto; | |
13 | +import com.diligrp.xtrade.order.domain.dto.OrderResponseDto; | |
16 | 14 | import com.diligrp.xtrade.order.service.OrderService; |
17 | 15 | import com.diligrp.xtrade.shared.domain.Message; |
16 | +import com.diligrp.xtrade.shared.domain.Page; | |
18 | 17 | |
19 | 18 | /** |
20 | 19 | * 订单相关接口实现 |
... | ... | @@ -41,7 +40,7 @@ public class OrderApiController { |
41 | 40 | * 订单列表接口 |
42 | 41 | */ |
43 | 42 | @RequestMapping(value = "/listOrders") |
44 | - public Message<List<OrderQueryResponseDto>> listOrders(@RequestBody OrderQueryRequestDto orderQueryRequestDto) { | |
43 | + public Message<Page<OrderResponseDto>> listOrders(@RequestBody OrderRequestDto orderQueryRequestDto) { | |
45 | 44 | return Message.success(orderservice.orderLists(orderQueryRequestDto)); |
46 | 45 | } |
47 | 46 | |
... | ... | @@ -49,7 +48,16 @@ public class OrderApiController { |
49 | 48 | * 订单详情 |
50 | 49 | */ |
51 | 50 | @RequestMapping(value = "/orderDetail") |
52 | - public Message<OrderQueryResponseDto> orderDetail(@RequestBody @Validated OrderQueryRequestDto orderQueryRequestDto) { | |
51 | + public Message<OrderResponseDto> orderDetail(@RequestBody @Validated OrderRequestDto orderQueryRequestDto) { | |
53 | 52 | return Message.success(orderservice.orderDetail(orderQueryRequestDto.getOrderId())); |
54 | 53 | } |
54 | + | |
55 | + /** | |
56 | + * 订单详情 | |
57 | + */ | |
58 | + @RequestMapping(value = "/updateBuyer") | |
59 | + public Message<Boolean> updateBuyer(@RequestBody @Validated OrderRequestDto orderQueryRequestDto) { | |
60 | + orderservice.updateBuyer(orderQueryRequestDto); | |
61 | + return Message.success(Boolean.TRUE); | |
62 | + } | |
55 | 63 | } | ... | ... |
src/main/java/com/diligrp/xtrade/order/domain/builder/OrderDataBuilder.java
... | ... | @@ -5,7 +5,7 @@ import java.util.List; |
5 | 5 | import org.springframework.beans.BeanUtils; |
6 | 6 | |
7 | 7 | import com.diligrp.xtrade.order.domain.dto.OrderItemDto; |
8 | -import com.diligrp.xtrade.order.domain.dto.OrderQueryResponseDto; | |
8 | +import com.diligrp.xtrade.order.domain.dto.OrderResponseDto; | |
9 | 9 | import com.diligrp.xtrade.order.domain.entity.OrderDo; |
10 | 10 | import com.diligrp.xtrade.order.domain.entity.OrderItemDo; |
11 | 11 | |
... | ... | @@ -21,8 +21,8 @@ public class OrderDataBuilder { |
21 | 21 | /** |
22 | 22 | * 构建基本的订单详情数据 TODO need modify because of change |
23 | 23 | */ |
24 | - public static OrderQueryResponseDto buildOrderDetail(OrderDo order, List<OrderItemDo> orderItem) { | |
25 | - OrderQueryResponseDto orderResponseDto = new OrderQueryResponseDto(); | |
24 | + public static OrderResponseDto buildOrderDetail(OrderDo order, List<OrderItemDo> orderItem) { | |
25 | + OrderResponseDto orderResponseDto = new OrderResponseDto(); | |
26 | 26 | BeanUtils.copyProperties(order, orderResponseDto); |
27 | 27 | for (OrderItemDo orderItemDo : orderItem) { |
28 | 28 | OrderItemDto orderItemDto = new OrderItemDto(); | ... | ... |
src/main/java/com/diligrp/xtrade/order/domain/dto/OrderQueryRequestDto.java renamed to src/main/java/com/diligrp/xtrade/order/domain/dto/OrderRequestDto.java
... | ... | @@ -2,6 +2,9 @@ package com.diligrp.xtrade.order.domain.dto; |
2 | 2 | |
3 | 3 | import java.time.LocalDateTime; |
4 | 4 | |
5 | +import javax.validation.constraints.Min; | |
6 | +import javax.validation.constraints.NotNull; | |
7 | + | |
5 | 8 | import com.diligrp.xtrade.shared.domain.BaseDo; |
6 | 9 | |
7 | 10 | /** |
... | ... | @@ -11,9 +14,11 @@ import com.diligrp.xtrade.shared.domain.BaseDo; |
11 | 14 | * @author zhangxing |
12 | 15 | * @date 2020年4月21日 |
13 | 16 | */ |
14 | -public class OrderQueryRequestDto extends BaseDo{ | |
17 | +public class OrderRequestDto extends BaseDo{ | |
15 | 18 | |
16 | 19 | // 订单业务id |
20 | + @NotNull(message = "订单号不能为空") | |
21 | + @Min(message = "订单号非法", value = 1) | |
17 | 22 | private Long orderId; |
18 | 23 | |
19 | 24 | // 卖家账号 | ... | ... |
src/main/java/com/diligrp/xtrade/order/domain/dto/OrderQueryResponseDto.java renamed to src/main/java/com/diligrp/xtrade/order/domain/dto/OrderResponseDto.java
src/main/java/com/diligrp/xtrade/order/service/OrderService.java
1 | 1 | package com.diligrp.xtrade.order.service; |
2 | 2 | |
3 | 3 | import com.diligrp.xtrade.order.domain.dto.OrderCreateRequestDto; |
4 | -import com.diligrp.xtrade.order.domain.dto.OrderQueryRequestDto; | |
5 | -import com.diligrp.xtrade.order.domain.dto.OrderQueryResponseDto; | |
4 | +import com.diligrp.xtrade.order.domain.dto.OrderRequestDto; | |
5 | +import com.diligrp.xtrade.order.domain.dto.OrderResponseDto; | |
6 | 6 | import com.diligrp.xtrade.shared.domain.Page; |
7 | 7 | |
8 | 8 | /** |
... | ... | @@ -24,11 +24,18 @@ public interface OrderService { |
24 | 24 | * @Title orderLists |
25 | 25 | * @Description 获取订单列表 |
26 | 26 | */ |
27 | - Page<OrderQueryResponseDto> orderLists(OrderQueryRequestDto orderQueryRequestDto); | |
27 | + Page<OrderResponseDto> orderLists(OrderRequestDto orderQueryRequestDto); | |
28 | 28 | |
29 | 29 | /** |
30 | 30 | * @Title orderDetail |
31 | 31 | * @Description 获取订单详情 |
32 | 32 | */ |
33 | - OrderQueryResponseDto orderDetail(Long orderId); | |
33 | + OrderResponseDto orderDetail(Long orderId); | |
34 | + | |
35 | + /** | |
36 | + * | |
37 | + * @Title updateBuyer | |
38 | + * @Description 更新买家信息 | |
39 | + */ | |
40 | + void updateBuyer(OrderRequestDto orderQueryRequestDto); | |
34 | 41 | } | ... | ... |
src/main/java/com/diligrp/xtrade/order/service/impl/OrderServiceImpl.java
... | ... | @@ -16,8 +16,8 @@ import com.diligrp.xtrade.order.domain.builder.OrderDataBuilder; |
16 | 16 | import com.diligrp.xtrade.order.domain.dto.AccountDto; |
17 | 17 | import com.diligrp.xtrade.order.domain.dto.OrderCreateRequestDto; |
18 | 18 | import com.diligrp.xtrade.order.domain.dto.OrderItemDto; |
19 | -import com.diligrp.xtrade.order.domain.dto.OrderQueryRequestDto; | |
20 | -import com.diligrp.xtrade.order.domain.dto.OrderQueryResponseDto; | |
19 | +import com.diligrp.xtrade.order.domain.dto.OrderRequestDto; | |
20 | +import com.diligrp.xtrade.order.domain.dto.OrderResponseDto; | |
21 | 21 | import com.diligrp.xtrade.order.domain.emuns.IdGenerator; |
22 | 22 | import com.diligrp.xtrade.order.domain.entity.OrderDo; |
23 | 23 | import com.diligrp.xtrade.order.rpc.feign.AccountResolver; |
... | ... | @@ -65,12 +65,19 @@ public class OrderServiceImpl implements OrderService { |
65 | 65 | // 插入订单信息 |
66 | 66 | orderDao.insertEntity(defaultOrderCreator.createOrder()); |
67 | 67 | } |
68 | + | |
69 | + | |
70 | + @Override | |
71 | + public void updateBuyer(OrderRequestDto orderRequestDto) { | |
72 | + OrderDo orderDo = orderDao.selectEntityByOrderId(orderRequestDto.getOrderId()); | |
73 | + | |
74 | + } | |
68 | 75 | |
69 | 76 | // TODO need modify because of change |
70 | 77 | @Override |
71 | - public Page<OrderQueryResponseDto> orderLists(OrderQueryRequestDto orderQueryRequestDto) { | |
72 | - Page<OrderQueryResponseDto> orderPage = new Page<OrderQueryResponseDto>(); | |
73 | - List<OrderQueryResponseDto> roResponseDtos = new ArrayList<OrderQueryResponseDto>(); | |
78 | + public Page<OrderResponseDto> orderLists(OrderRequestDto orderQueryRequestDto) { | |
79 | + Page<OrderResponseDto> orderPage = new Page<OrderResponseDto>(); | |
80 | + List<OrderResponseDto> roResponseDtos = new ArrayList<OrderResponseDto>(); | |
74 | 81 | orderPage.setData(roResponseDtos); |
75 | 82 | OrderDo order = new OrderDo(); |
76 | 83 | BeanUtils.copyProperties(orderQueryRequestDto, order); |
... | ... | @@ -80,7 +87,7 @@ public class OrderServiceImpl implements OrderService { |
80 | 87 | } |
81 | 88 | List<OrderDo> orderDos = orderDao.selectEntryList(order); |
82 | 89 | for (OrderDo orderDo : orderDos) { |
83 | - OrderQueryResponseDto orderQueryResponseDto = new OrderQueryResponseDto(); | |
90 | + OrderResponseDto orderQueryResponseDto = new OrderResponseDto(); | |
84 | 91 | BeanUtils.copyProperties(orderDo, orderQueryResponseDto); |
85 | 92 | roResponseDtos.add(orderQueryResponseDto); |
86 | 93 | } |
... | ... | @@ -89,8 +96,8 @@ public class OrderServiceImpl implements OrderService { |
89 | 96 | |
90 | 97 | // TODO need modify because of change |
91 | 98 | @Override |
92 | - public OrderQueryResponseDto orderDetail(Long orderId) { | |
93 | - OrderQueryResponseDto orderResponseDto = OrderDataBuilder | |
99 | + public OrderResponseDto orderDetail(Long orderId) { | |
100 | + OrderResponseDto orderResponseDto = OrderDataBuilder | |
94 | 101 | .buildOrderDetail(orderDao.selectEntityByOrderId(orderId), orderItemDao.selectItemsByOrderId(orderId)); |
95 | 102 | return orderResponseDto; |
96 | 103 | } | ... | ... |