feat(order): 添加订单用餐时间查询功能
- 在OrderDbDTO中新增mealTime字段用于存储用餐时间- 在OrderServiceRpcClient中引入日期处理工具类 - 实现根据用餐时间范围过滤订单的查询逻辑 -优化代码格式并保持方法参数对齐
Showing
2 changed files
with
10 additions
and
3 deletions
| ... | @@ -71,6 +71,7 @@ public class OrderDbDTO { | ... | @@ -71,6 +71,7 @@ public class OrderDbDTO { |
| 71 | private OrderStatusEnum status; | 71 | private OrderStatusEnum status; |
| 72 | private String keyword; | 72 | private String keyword; |
| 73 | private List<Integer> stallIds; | 73 | private List<Integer> stallIds; |
| 74 | + private String mealTime; | ||
| 74 | } | 75 | } |
| 75 | 76 | ||
| 76 | @Data | 77 | @Data | ... | ... |
| 1 | package com.infoloop.tianting.service.client; | 1 | package com.infoloop.tianting.service.client; |
| 2 | 2 | ||
| 3 | +import cn.hutool.core.date.DateTime; | ||
| 3 | import com.infoloop.tianting.SingleResponse; | 4 | import com.infoloop.tianting.SingleResponse; |
| 4 | import com.infoloop.tianting.SingleSkuResponse; | 5 | import com.infoloop.tianting.SingleSkuResponse; |
| 5 | import com.infoloop.tianting.SingleSpecialResponse; | 6 | import com.infoloop.tianting.SingleSpecialResponse; |
| ... | @@ -494,9 +495,14 @@ public class OrderServiceRpcClient { | ... | @@ -494,9 +495,14 @@ public class OrderServiceRpcClient { |
| 494 | .setStatus(queryOrderDto.getStatus()) | 495 | .setStatus(queryOrderDto.getStatus()) |
| 495 | .setEnterpriseId(queryOrderDto.getEnterpriseId()) | 496 | .setEnterpriseId(queryOrderDto.getEnterpriseId()) |
| 496 | .setShouldFilterClientIds(true).addClientIds(queryOrderDto.getClientId()) | 497 | .setShouldFilterClientIds(true).addClientIds(queryOrderDto.getClientId()) |
| 497 | - .setShouldFilterStallIds(true).addAllStallIds(queryOrderDto.getStallIds()) | 498 | + .setShouldFilterStallIds(true).addAllStallIds(queryOrderDto.getStallIds()); |
| 498 | - .build(); | 499 | + if (StringUtils.isNotEmpty(queryOrderDto.getMealTime())) { |
| 499 | - return orderServiceRpcBlockingStub.queryClientCustomerOrdersByCondition(request); | 500 | + DateTime date = cn.hutool.core.date.DateUtil.parse(queryOrderDto.getMealTime()); |
| 501 | + long startOfDay = cn.hutool.core.date.DateUtil.beginOfDay(date).getTime(); | ||
| 502 | + long endOfDay = cn.hutool.core.date.DateUtil.endOfDay(date).getTime(); | ||
| 503 | + request.setShouldFilterMealTimeStart(true).setMealTimeStart(startOfDay).setShouldFilterMealTimeEnd(true).setMealTimeEnd(endOfDay); | ||
| 504 | + } | ||
| 505 | + return orderServiceRpcBlockingStub.queryClientCustomerOrdersByCondition(request.build()); | ||
| 500 | } | 506 | } |
| 501 | 507 | ||
| 502 | public QueryClientCustomerOrdersByPaginationRpcResponse queryRefundClientCustomerOrdersByPagination( | 508 | public QueryClientCustomerOrdersByPaginationRpcResponse queryRefundClientCustomerOrdersByPagination( | ... | ... |
-
Please register or login to post a comment