Commit e33e6638a6b6da7fb6cb16d5fa33481e46583506

Authored by zhangxing
1 parent 854e62e5

[order page]

src/main/java/com/diligrp/xtrade/order/domain/dto/OrderRequestDto.java
... ... @@ -56,6 +56,10 @@ public class OrderRequestDto extends BaseDo{
56 56  
57 57 // 支付时间
58 58 private LocalDateTime payTime;
  59 +
  60 + private Integer pageSize = 20;
  61 +
  62 + private Integer currentPage;
59 63  
60 64 public Long getOrderId() {
61 65 return orderId;
... ... @@ -161,4 +165,20 @@ public class OrderRequestDto extends BaseDo{
161 165 this.orderType = orderType;
162 166 }
163 167  
  168 + public Integer getPageSize() {
  169 + return pageSize;
  170 + }
  171 +
  172 + public void setPageSize(Integer pageSize) {
  173 + this.pageSize = pageSize;
  174 + }
  175 +
  176 + public Integer getCurrentPage() {
  177 + return currentPage == null ? 1 : currentPage;
  178 + }
  179 +
  180 + public void setCurrentPage(Integer currentPage) {
  181 + this.currentPage = currentPage;
  182 + }
  183 +
164 184 }
... ...
src/main/java/com/diligrp/xtrade/order/rpc/feign/AccountResolver.java
... ... @@ -24,7 +24,7 @@ public class AccountResolver {
24 24 /**
25 25 * 根据id获取账户信息
26 26 */
27   - public AccountDto getAccount(Long accountId) {
  27 + public AccountDto resolverAccount(Long accountId) {
28 28 Message<AccountDto> message = accountRPC.getDltAccount(accountId);
29 29 if (HttpStatus.OK.value() != message.getCode()) {
30 30 throw new OrderException(message.getMessage());
... ...
src/main/java/com/diligrp/xtrade/order/service/impl/OrderServiceImpl.java
... ... @@ -26,6 +26,7 @@ import com.diligrp.xtrade.order.exception.OrderException;
26 26 import com.diligrp.xtrade.order.rpc.feign.AccountResolver;
27 27 import com.diligrp.xtrade.order.service.OrderService;
28 28 import com.diligrp.xtrade.shared.domain.Page;
  29 +import com.diligrp.xtrade.shared.mybatis.PageHelper;
29 30 import com.diligrp.xtrade.shared.sequence.KeyGeneratorManager;
30 31  
31 32 @Service("orderService")
... ... @@ -91,22 +92,18 @@ public class OrderServiceImpl implements OrderService {
91 92  
92 93 // TODO need modify because of change
93 94 @Override
94   - public Page<OrderResponseDto> orderLists(OrderRequestDto orderQueryRequestDto) {
95   - Page<OrderResponseDto> orderPage = new Page<OrderResponseDto>();
  95 + public Page<OrderResponseDto> orderLists(OrderRequestDto orderRequestDto) {
96 96 List<OrderResponseDto> roResponseDtos = new ArrayList<OrderResponseDto>();
97   - orderPage.setData(roResponseDtos);
  97 + Page<OrderResponseDto> orderPage = PageHelper.startPage(orderRequestDto.getCurrentPage(), orderRequestDto.getPageSize());
98 98 OrderDo order = new OrderDo();
99   - BeanUtils.copyProperties(orderQueryRequestDto, order);
100   - int total = orderDao.selectEntryListCount(order);
101   - if (total == 0) {
102   - return orderPage;
103   - }
  99 + BeanUtils.copyProperties(orderRequestDto, order);
104 100 List<OrderDo> orderDos = orderDao.selectEntryList(order);
105 101 for (OrderDo orderDo : orderDos) {
106 102 OrderResponseDto orderQueryResponseDto = new OrderResponseDto();
107 103 BeanUtils.copyProperties(orderDo, orderQueryResponseDto);
108 104 roResponseDtos.add(orderQueryResponseDto);
109 105 }
  106 + orderPage.setData(roResponseDtos);
110 107 return orderPage;
111 108 }
112 109  
... ...
src/main/resources/mapping/com/diligrp/xtrade/order/OrderDao.xml
... ... @@ -5,7 +5,7 @@
5 5 <sql id="QUERY_COLUMN_LIST">
6 6 <![CDATA[id,`order_id` AS orderId, `saccount`, `scard_no` AS scardNo, `scard_type` AS scardType, `sname`, `smobile`, `baccount`, `bcard_no` AS bcardNo, `bcard_type` AS bcardType,
7 7 `bname`, `bmobile`,`market_code` AS marketCode, `order_status` AS orderStatus, `trade_no` AS tradeNo, `total_money` AS totalMoney,`scommission`, `bcommission`, `weight`, order_type AS orderType,
8   - `pay_type` AS payType, `pay_src` AS paySrc, `created_src` AS createdSrc, `order_type` AS orderType, `pay_time` AS payTime, `created_time` AS createdTime, `modified_time`AS modifiedTime, `deleted`]]>
  8 + `pay_type` AS payType, `pay_src` AS paySrc, `created_src` AS createdSrc, `trade_type` AS tradeType, `pay_time` AS payTime, `created_time` AS createdTime, `modified_time`AS modifiedTime, `deleted`]]>
9 9 </sql>
10 10  
11 11 <sql id="QUERY_WHERE_CLAUSE">
... ... @@ -20,11 +20,11 @@
20 20 <if test="payType != null and payType != ''"><![CDATA[AND xt_order.pay_type = #{payType}]]></if>
21 21 <if test="paySrc != null and paySrc != ''"><![CDATA[AND xt_order.pay_src = #{paySrc}]]></if>
22 22 <if test="createdSrc != null and createdSrc != '0'.toString() "><![CDATA[AND xt_order.created_src = #{createdSrc} ]]></if>
23   - <if test="orderType != null and orderType != '' "><![CDATA[AND xt_order.order_type = #{orderType} ]]></if>
  23 + <if test="tradeType != null and tradeType != '' "><![CDATA[AND xt_order.trade_type = #{tradeType} ]]></if>
24 24 </where>
25 25 </sql>
26 26  
27   - <sql id="QUERY_ORDER_LIMIT_CONDTION">
  27 + <sql id="QUERY_ORDER_LIMIT_CONDTION1">
28 28 <if
29 29 test="orderField != null and orderField != '' and orderFieldType != null and orderFieldType != ''"><![CDATA[ORDER BY etrade_order.${orderField} ${orderFieldType}]]></if>
30 30 <if
... ... @@ -46,7 +46,6 @@
46 46 <include refid="QUERY_COLUMN_LIST" />
47 47 <![CDATA[FROM `xt_order`]]>
48 48 <include refid="QUERY_WHERE_CLAUSE" />
49   - <include refid="QUERY_ORDER_LIMIT_CONDTION" />
50 49 </select>
51 50  
52 51 <select id="selectEntryListCount" parameterType="orderDo"
... ...