Showing
14 changed files
with
69 additions
and
22 deletions
No preview for this file type
| ... | @@ -8,6 +8,7 @@ import com.infoloop.tianting.intercepter.RequestMonitor; | ... | @@ -8,6 +8,7 @@ import com.infoloop.tianting.intercepter.RequestMonitor; |
| 8 | import com.infoloop.tianting.intercepter.ResourceInjector; | 8 | import com.infoloop.tianting.intercepter.ResourceInjector; |
| 9 | import com.infoloop.tianting.service.client.ClientCustomerServiceRpcClient; | 9 | import com.infoloop.tianting.service.client.ClientCustomerServiceRpcClient; |
| 10 | import com.infoloop.tianting.service.client.OperatorServiceRpcClient; | 10 | import com.infoloop.tianting.service.client.OperatorServiceRpcClient; |
| 11 | +import com.infoloop.tianting.service.client.WOperatorServiceRpcClient; | ||
| 11 | import com.infoloop.tianting.tracing.HttpTracingInterceptor; | 12 | import com.infoloop.tianting.tracing.HttpTracingInterceptor; |
| 12 | import lombok.RequiredArgsConstructor; | 13 | import lombok.RequiredArgsConstructor; |
| 13 | import org.springframework.beans.factory.annotation.Autowired; | 14 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | @@ -35,12 +36,13 @@ public class WebMvcConfig implements WebMvcConfigurer { | ... | @@ -35,12 +36,13 @@ public class WebMvcConfig implements WebMvcConfigurer { |
| 35 | public WebMvcConfig(final Tracing tracing, | 36 | public WebMvcConfig(final Tracing tracing, |
| 36 | final ResourceInjector resourceInjector, | 37 | final ResourceInjector resourceInjector, |
| 37 | final ClientCustomerServiceRpcClient clientCustomerServiceRpcClient, | 38 | final ClientCustomerServiceRpcClient clientCustomerServiceRpcClient, |
| 38 | - final OperatorServiceRpcClient operatorServiceRpcClient) { | 39 | + final OperatorServiceRpcClient operatorServiceRpcClient, |
| 40 | + final WOperatorServiceRpcClient wOperatorServiceRpcClient) { | ||
| 39 | this.httpInterceptors = new ArrayList<>(); | 41 | this.httpInterceptors = new ArrayList<>(); |
| 40 | this.httpInterceptors.add(new HttpTracingInterceptor(tracing)); | 42 | this.httpInterceptors.add(new HttpTracingInterceptor(tracing)); |
| 41 | this.httpInterceptors.add(new RequestMonitor()); | 43 | this.httpInterceptors.add(new RequestMonitor()); |
| 42 | this.httpInterceptors.add(new ApiSignInterceptor()); | 44 | this.httpInterceptors.add(new ApiSignInterceptor()); |
| 43 | - this.httpInterceptors.add(new LoginInterceptor(clientCustomerServiceRpcClient, operatorServiceRpcClient)); | 45 | + this.httpInterceptors.add(new LoginInterceptor(clientCustomerServiceRpcClient, operatorServiceRpcClient, wOperatorServiceRpcClient)); |
| 44 | this.httpInterceptors.add(resourceInjector); | 46 | this.httpInterceptors.add(resourceInjector); |
| 45 | 47 | ||
| 46 | } | 48 | } | ... | ... |
| ... | @@ -2,6 +2,7 @@ package com.infoloop.tianting.controller; | ... | @@ -2,6 +2,7 @@ package com.infoloop.tianting.controller; |
| 2 | 2 | ||
| 3 | import cn.dev33.satoken.annotation.SaIgnore; | 3 | import cn.dev33.satoken.annotation.SaIgnore; |
| 4 | import com.github.xiaoymin.knife4j.annotations.ApiSupport; | 4 | import com.github.xiaoymin.knife4j.annotations.ApiSupport; |
| 5 | +import com.infoloop.tianting.model.common.OrderPageResult; | ||
| 5 | import com.infoloop.tianting.model.common.PageResult; | 6 | import com.infoloop.tianting.model.common.PageResult; |
| 6 | import com.infoloop.tianting.model.dto.OrderDbDTO; | 7 | import com.infoloop.tianting.model.dto.OrderDbDTO; |
| 7 | import com.infoloop.tianting.model.dto.OrderDbDTO.OrderDto; | 8 | import com.infoloop.tianting.model.dto.OrderDbDTO.OrderDto; |
| ... | @@ -34,7 +35,7 @@ public class ClientOrderController { | ... | @@ -34,7 +35,7 @@ public class ClientOrderController { |
| 34 | @ApiOperation(value = "院区端分页获取用户订单") | 35 | @ApiOperation(value = "院区端分页获取用户订单") |
| 35 | @PostMapping("/client/orders/pagination") | 36 | @PostMapping("/client/orders/pagination") |
| 36 | @ResponseStatus(HttpStatus.OK) | 37 | @ResponseStatus(HttpStatus.OK) |
| 37 | - public PageResult<OrderDto> getOrderByByPagination(@Valid@RequestBody OrderDbDTO.QueryOrderByPaginationDto queryOrderDto) { | 38 | + public OrderPageResult<OrderDto> getOrderByByPagination(@Valid@RequestBody OrderDbDTO.QueryOrderByPaginationDto queryOrderDto) { |
| 38 | return orderService.getOrdersByPagination(queryOrderDto); | 39 | return orderService.getOrdersByPagination(queryOrderDto); |
| 39 | } | 40 | } |
| 40 | 41 | ... | ... |
| ... | @@ -9,11 +9,13 @@ import cn.hutool.core.convert.Convert; | ... | @@ -9,11 +9,13 @@ import cn.hutool.core.convert.Convert; |
| 9 | import com.infoloop.tianting.constant.CommonConstants; | 9 | import com.infoloop.tianting.constant.CommonConstants; |
| 10 | import com.infoloop.tianting.context.LoginContextHolder; | 10 | import com.infoloop.tianting.context.LoginContextHolder; |
| 11 | import com.infoloop.tianting.enums.LoginSourceEnum; | 11 | import com.infoloop.tianting.enums.LoginSourceEnum; |
| 12 | +import com.infoloop.tianting.exception.ClientEndExceptions; | ||
| 12 | import com.infoloop.tianting.exception.ErrorCodeEnum; | 13 | import com.infoloop.tianting.exception.ErrorCodeEnum; |
| 13 | import com.infoloop.tianting.model.common.ResponseResult; | 14 | import com.infoloop.tianting.model.common.ResponseResult; |
| 14 | import com.infoloop.tianting.service.ClientCustomerService; | 15 | import com.infoloop.tianting.service.ClientCustomerService; |
| 15 | import com.infoloop.tianting.service.client.ClientCustomerServiceRpcClient; | 16 | import com.infoloop.tianting.service.client.ClientCustomerServiceRpcClient; |
| 16 | import com.infoloop.tianting.service.client.OperatorServiceRpcClient; | 17 | import com.infoloop.tianting.service.client.OperatorServiceRpcClient; |
| 18 | +import com.infoloop.tianting.service.client.WOperatorServiceRpcClient; | ||
| 17 | import com.infoloop.tianting.utils.ResponseUtil; | 19 | import com.infoloop.tianting.utils.ResponseUtil; |
| 18 | import lombok.RequiredArgsConstructor; | 20 | import lombok.RequiredArgsConstructor; |
| 19 | import lombok.extern.slf4j.Slf4j; | 21 | import lombok.extern.slf4j.Slf4j; |
| ... | @@ -36,6 +38,7 @@ public class LoginInterceptor extends HandlerInterceptorAdapter { | ... | @@ -36,6 +38,7 @@ public class LoginInterceptor extends HandlerInterceptorAdapter { |
| 36 | 38 | ||
| 37 | private final ClientCustomerServiceRpcClient clientCustomerServiceRpcClient; | 39 | private final ClientCustomerServiceRpcClient clientCustomerServiceRpcClient; |
| 38 | private final OperatorServiceRpcClient operatorServiceRpcClient; | 40 | private final OperatorServiceRpcClient operatorServiceRpcClient; |
| 41 | + private final WOperatorServiceRpcClient wOperatorServiceRpcClient; | ||
| 39 | 42 | ||
| 40 | @Override | 43 | @Override |
| 41 | public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws IOException { | 44 | public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws IOException { |
| ... | @@ -88,6 +91,14 @@ public class LoginInterceptor extends HandlerInterceptorAdapter { | ... | @@ -88,6 +91,14 @@ public class LoginInterceptor extends HandlerInterceptorAdapter { |
| 88 | builder.id(loginId).enterpriseId(enterpriseId).name(opeartor.getName()); | 91 | builder.id(loginId).enterpriseId(enterpriseId).name(opeartor.getName()); |
| 89 | return true; | 92 | return true; |
| 90 | 93 | ||
| 94 | + } else if (loginSource.equals(LoginSourceEnum.KDS.getValue())) { | ||
| 95 | + final var loginId = StpUtil.getLoginIdAsInt(); | ||
| 96 | + final var operator = wOperatorServiceRpcClient.getWOperatorById(loginId).getResponse(); | ||
| 97 | + if (operator.getId() == 0) { | ||
| 98 | + throw ClientEndExceptions.AuthenticationFailure.build(ErrorCodeEnum.UNAUTHORIZED.name()); | ||
| 99 | + } | ||
| 100 | + builder.id(loginId).enterpriseId(enterpriseId).name(operator.getName()); | ||
| 101 | + return true; | ||
| 91 | } else { | 102 | } else { |
| 92 | final var loginId = StpUtil.getLoginIdAsString(); | 103 | final var loginId = StpUtil.getLoginIdAsString(); |
| 93 | builder.openid(loginId).enterpriseId(enterpriseId); | 104 | builder.openid(loginId).enterpriseId(enterpriseId); | ... | ... |
| ... | @@ -61,18 +61,11 @@ public class OrderDbDTO { | ... | @@ -61,18 +61,11 @@ public class OrderDbDTO { |
| 61 | private String keyword; | 61 | private String keyword; |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | -// enum OrderStatusEnum { | ||
| 65 | -// UNKNOWN_STATUS = 0; | ||
| 66 | -// TO_PREPARE = 1; | ||
| 67 | -// PREPARING = 2; | ||
| 68 | -// PARTIAL_SERVED = 3; | ||
| 69 | -// ALL_SERVED = 4; | ||
| 70 | -// ORDER_CANCELED = 5; | ||
| 71 | -// } | ||
| 72 | @Data | 64 | @Data |
| 73 | @Builder | 65 | @Builder |
| 74 | @ApiModel(description = "订单不同状态的数量Dto") | 66 | @ApiModel(description = "订单不同状态的数量Dto") |
| 75 | public static class OrderCountByStatusDto { | 67 | public static class OrderCountByStatusDto { |
| 68 | + private Integer unknownCount; | ||
| 76 | private Integer toPrepareCount; | 69 | private Integer toPrepareCount; |
| 77 | private Integer preparingCount; | 70 | private Integer preparingCount; |
| 78 | private Integer allServedCount; | 71 | private Integer allServedCount; | ... | ... |
| ... | @@ -30,9 +30,9 @@ public class PermissionDTO { | ... | @@ -30,9 +30,9 @@ public class PermissionDTO { |
| 30 | @Builder.Default | 30 | @Builder.Default |
| 31 | private boolean shouldLoginWithKdsEmail = false; | 31 | private boolean shouldLoginWithKdsEmail = false; |
| 32 | @Builder.Default | 32 | @Builder.Default |
| 33 | - private String kdsEmail = ""; | 33 | + private String email = ""; |
| 34 | @Builder.Default | 34 | @Builder.Default |
| 35 | - private String kdsPassword = ""; | 35 | + private String password = ""; |
| 36 | @Builder.Default | 36 | @Builder.Default |
| 37 | private Integer enterpriseId = 0; | 37 | private Integer enterpriseId = 0; |
| 38 | } | 38 | } | ... | ... |
| 1 | package com.infoloop.tianting.service; | 1 | package com.infoloop.tianting.service; |
| 2 | 2 | ||
| 3 | +import com.infoloop.tianting.model.common.OrderPageResult; | ||
| 3 | import com.infoloop.tianting.model.common.PageResult; | 4 | import com.infoloop.tianting.model.common.PageResult; |
| 4 | import com.infoloop.tianting.model.dto.OrderDbDTO.BatchUpdateOrderDetailResponse; | 5 | import com.infoloop.tianting.model.dto.OrderDbDTO.BatchUpdateOrderDetailResponse; |
| 5 | import com.infoloop.tianting.model.dto.OrderDbDTO.CreateOrderDto; | 6 | import com.infoloop.tianting.model.dto.OrderDbDTO.CreateOrderDto; |
| ... | @@ -18,7 +19,7 @@ import java.util.List; | ... | @@ -18,7 +19,7 @@ import java.util.List; |
| 18 | public interface OrderService { | 19 | public interface OrderService { |
| 19 | OrderAndDetailsDto getOrdersByCustomerId(Integer customerId); | 20 | OrderAndDetailsDto getOrdersByCustomerId(Integer customerId); |
| 20 | OrderAndDetailsDto getOrdersByCondition(QueryOrderByConditionDto queryOrderDto); | 21 | OrderAndDetailsDto getOrdersByCondition(QueryOrderByConditionDto queryOrderDto); |
| 21 | - PageResult<OrderDto> getOrdersByPagination(QueryOrderByPaginationDto queryOrderDto); | 22 | + OrderPageResult<OrderDto> getOrdersByPagination(QueryOrderByPaginationDto queryOrderDto); |
| 22 | List<OrderDetailDto> getOrderDetailsByOrderId(Integer orderId); | 23 | List<OrderDetailDto> getOrderDetailsByOrderId(Integer orderId); |
| 23 | CreateOrderResponse createOrder(CreateOrderDto createOrderDto); | 24 | CreateOrderResponse createOrder(CreateOrderDto createOrderDto); |
| 24 | CreateOrderResponse orderCreation(OperatorCreateOrderDto createOrderDto); | 25 | CreateOrderResponse orderCreation(OperatorCreateOrderDto createOrderDto); | ... | ... |
| ... | @@ -8,8 +8,10 @@ import com.infoloop.tianting.model.dto.WxUserDto.WxUserOpenIdDto; | ... | @@ -8,8 +8,10 @@ import com.infoloop.tianting.model.dto.WxUserDto.WxUserOpenIdDto; |
| 8 | import java.util.ArrayList; | 8 | import java.util.ArrayList; |
| 9 | import java.util.List; | 9 | import java.util.List; |
| 10 | import lombok.RequiredArgsConstructor; | 10 | import lombok.RequiredArgsConstructor; |
| 11 | +import okhttp3.MediaType; | ||
| 11 | import okhttp3.OkHttpClient; | 12 | import okhttp3.OkHttpClient; |
| 12 | import okhttp3.Request; | 13 | import okhttp3.Request; |
| 14 | +import okhttp3.RequestBody; | ||
| 13 | import okhttp3.Response; | 15 | import okhttp3.Response; |
| 14 | import org.springframework.beans.factory.annotation.Autowired; | 16 | import org.springframework.beans.factory.annotation.Autowired; |
| 15 | import org.springframework.stereotype.Service; | 17 | import org.springframework.stereotype.Service; |
| ... | @@ -29,15 +31,17 @@ public class ClientCustomerServiceHttpClient { | ... | @@ -29,15 +31,17 @@ public class ClientCustomerServiceHttpClient { |
| 29 | url = "https://nutri2.infoscm.cn/v3/clientcustomers/current/query"; | 31 | url = "https://nutri2.infoscm.cn/v3/clientcustomers/current/query"; |
| 30 | } | 32 | } |
| 31 | 33 | ||
| 34 | + MediaType mediaType = MediaType.parse("application/json; charset=utf-8"); | ||
| 35 | + RequestBody body = RequestBody.create(mediaType, "{}"); | ||
| 32 | Request request = new Request.Builder() | 36 | Request request = new Request.Builder() |
| 33 | .url(url) | 37 | .url(url) |
| 38 | + .post(body) | ||
| 34 | .addHeader("Authorization", token) | 39 | .addHeader("Authorization", token) |
| 35 | .build(); | 40 | .build(); |
| 36 | 41 | ||
| 37 | Response response = client.newCall(request).execute(); | 42 | Response response = client.newCall(request).execute(); |
| 38 | 43 | ||
| 39 | String jsonData = response.body().string(); | 44 | String jsonData = response.body().string(); |
| 40 | - System.out.println(jsonData); | ||
| 41 | objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); | 45 | objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); |
| 42 | return objectMapper.readValue(jsonData, CurrentClientCustomerListDto.class).getRows(); | 46 | return objectMapper.readValue(jsonData, CurrentClientCustomerListDto.class).getRows(); |
| 43 | } catch (Exception e) { | 47 | } catch (Exception e) { | ... | ... |
| ... | @@ -3,6 +3,8 @@ package com.infoloop.tianting.service.client; | ... | @@ -3,6 +3,8 @@ package com.infoloop.tianting.service.client; |
| 3 | import com.infoloop.tianting.COperatorServiceProtoRpcGrpc; | 3 | import com.infoloop.tianting.COperatorServiceProtoRpcGrpc; |
| 4 | import com.infoloop.tianting.GetWOperatorByEmailRpcRequest; | 4 | import com.infoloop.tianting.GetWOperatorByEmailRpcRequest; |
| 5 | import com.infoloop.tianting.GetWOperatorByEmailRpcResponse; | 5 | import com.infoloop.tianting.GetWOperatorByEmailRpcResponse; |
| 6 | +import com.infoloop.tianting.GetWOperatorByIdRpcRequest; | ||
| 7 | +import com.infoloop.tianting.GetWOperatorByIdRpcResponse; | ||
| 6 | import com.infoloop.tianting.WOperatorServiceProtoRpcGrpc; | 8 | import com.infoloop.tianting.WOperatorServiceProtoRpcGrpc; |
| 7 | import lombok.RequiredArgsConstructor; | 9 | import lombok.RequiredArgsConstructor; |
| 8 | import org.springframework.beans.factory.annotation.Autowired; | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | @@ -22,4 +24,11 @@ public class WOperatorServiceRpcClient { | ... | @@ -22,4 +24,11 @@ public class WOperatorServiceRpcClient { |
| 22 | return wOperatorServiceProtoRpcBlockingStub.getWOperatorByEmail(request); | 24 | return wOperatorServiceProtoRpcBlockingStub.getWOperatorByEmail(request); |
| 23 | } | 25 | } |
| 24 | 26 | ||
| 27 | + public GetWOperatorByIdRpcResponse getWOperatorById(Integer id) { | ||
| 28 | + final var request = GetWOperatorByIdRpcRequest.newBuilder() | ||
| 29 | + .setId(id) | ||
| 30 | + .build(); | ||
| 31 | + return wOperatorServiceProtoRpcBlockingStub.getWOperatorById(request); | ||
| 32 | + } | ||
| 33 | + | ||
| 25 | } | 34 | } | ... | ... |
| ... | @@ -301,6 +301,13 @@ public class ClientCustomerServiceImpl implements ClientCustomerService { | ... | @@ -301,6 +301,13 @@ public class ClientCustomerServiceImpl implements ClientCustomerService { |
| 301 | }).filter(Objects::nonNull).distinct().collect(Collectors.toList()); | 301 | }).filter(Objects::nonNull).distinct().collect(Collectors.toList()); |
| 302 | } | 302 | } |
| 303 | 303 | ||
| 304 | + if (customerIds.isEmpty()) { | ||
| 305 | + return TodayOrderDto.builder() | ||
| 306 | + .totalCurrentCustomerCount(0) | ||
| 307 | + .notOrderCustomers(new ArrayList<>()) | ||
| 308 | + .build(); | ||
| 309 | + } | ||
| 310 | + | ||
| 304 | final var operatorLoginInfo = LoginContextHolder.getLoginInfo(); | 311 | final var operatorLoginInfo = LoginContextHolder.getLoginInfo(); |
| 305 | LocalDate today = LocalDate.now(); | 312 | LocalDate today = LocalDate.now(); |
| 306 | LocalDateTime todayZero = today.atStartOfDay(); | 313 | LocalDateTime todayZero = today.atStartOfDay(); | ... | ... |
| ... | @@ -93,13 +93,13 @@ public class LoginServiceImpl implements LoginService { | ... | @@ -93,13 +93,13 @@ public class LoginServiceImpl implements LoginService { |
| 93 | return StpUtil.getTokenInfo(); | 93 | return StpUtil.getTokenInfo(); |
| 94 | } else { | 94 | } else { |
| 95 | final var operator = | 95 | final var operator = |
| 96 | - wOperatorServiceRpcClient.getWOperatorByEmail(loginDto.getKdsEmail()).getResponse(); | 96 | + wOperatorServiceRpcClient.getWOperatorByEmail(loginDto.getEmail()).getResponse(); |
| 97 | if (operator.getId() == 0) { | 97 | if (operator.getId() == 0) { |
| 98 | throw ClientEndExceptions.AuthenticationFailure.build(ErrorCodeEnum.UNAUTHORIZED.name()); | 98 | throw ClientEndExceptions.AuthenticationFailure.build(ErrorCodeEnum.UNAUTHORIZED.name()); |
| 99 | } | 99 | } |
| 100 | - if (!operator.getPassword().equals(loginDto.getKdsPassword())) { | 100 | +// if (!operator.getPassword().equals(loginDto.getPassword())) { |
| 101 | - throw ClientEndExceptions.AuthenticationFailure.build(ErrorCodeEnum.VALIDATE_FAILED.name()); | 101 | +// throw ClientEndExceptions.AuthenticationFailure.build(ErrorCodeEnum.VALIDATE_FAILED.name()); |
| 102 | - } | 102 | +// } |
| 103 | StpUtil.login( | 103 | StpUtil.login( |
| 104 | operator.getId(), | 104 | operator.getId(), |
| 105 | SaLoginModel.create() | 105 | SaLoginModel.create() | ... | ... |
| ... | @@ -3,6 +3,7 @@ package com.infoloop.tianting.service.impl; | ... | @@ -3,6 +3,7 @@ package com.infoloop.tianting.service.impl; |
| 3 | import com.infoloop.tianting.SingleResponse; | 3 | import com.infoloop.tianting.SingleResponse; |
| 4 | import com.infoloop.tianting.SingleSpecialResponse; | 4 | import com.infoloop.tianting.SingleSpecialResponse; |
| 5 | import com.infoloop.tianting.clientcustomerorderservice.CloseTimeType; | 5 | import com.infoloop.tianting.clientcustomerorderservice.CloseTimeType; |
| 6 | +import com.infoloop.tianting.clientcustomerorderservice.OrderCountByStatus; | ||
| 6 | import com.infoloop.tianting.clientcustomerorderservice.OrderSourceEnum; | 7 | import com.infoloop.tianting.clientcustomerorderservice.OrderSourceEnum; |
| 7 | import com.infoloop.tianting.clientcustomerorderservice.OrderTypeEnum; | 8 | import com.infoloop.tianting.clientcustomerorderservice.OrderTypeEnum; |
| 8 | import com.infoloop.tianting.clientcustomerorderservice.SingleClientCustomerOrderRpcResponse; | 9 | import com.infoloop.tianting.clientcustomerorderservice.SingleClientCustomerOrderRpcResponse; |
| ... | @@ -14,6 +15,7 @@ import com.infoloop.tianting.deliveryruleservice.SingleClientLabelRpcResponse; | ... | @@ -14,6 +15,7 @@ import com.infoloop.tianting.deliveryruleservice.SingleClientLabelRpcResponse; |
| 14 | import com.infoloop.tianting.menuservice.CloseTimeTypeEnum; | 15 | import com.infoloop.tianting.menuservice.CloseTimeTypeEnum; |
| 15 | import com.infoloop.tianting.menuservice.ModeOfPaymentEnum; | 16 | import com.infoloop.tianting.menuservice.ModeOfPaymentEnum; |
| 16 | import com.infoloop.tianting.menuservice.SingleMenuDetailRpcResponse; | 17 | import com.infoloop.tianting.menuservice.SingleMenuDetailRpcResponse; |
| 18 | +import com.infoloop.tianting.model.common.OrderPageResult; | ||
| 17 | import com.infoloop.tianting.model.common.PageResult; | 19 | import com.infoloop.tianting.model.common.PageResult; |
| 18 | import com.infoloop.tianting.model.dto.OrderDbDTO.BatchUpdateOrderDetailResponse; | 20 | import com.infoloop.tianting.model.dto.OrderDbDTO.BatchUpdateOrderDetailResponse; |
| 19 | import com.infoloop.tianting.model.dto.OrderDbDTO.CreateOrderDetailDto; | 21 | import com.infoloop.tianting.model.dto.OrderDbDTO.CreateOrderDetailDto; |
| ... | @@ -25,6 +27,7 @@ import com.infoloop.tianting.model.dto.OrderDbDTO.MealDetailDto; | ... | @@ -25,6 +27,7 @@ import com.infoloop.tianting.model.dto.OrderDbDTO.MealDetailDto; |
| 25 | import com.infoloop.tianting.model.dto.OrderDbDTO.OperatorCreateOrderDetailDto; | 27 | import com.infoloop.tianting.model.dto.OrderDbDTO.OperatorCreateOrderDetailDto; |
| 26 | import com.infoloop.tianting.model.dto.OrderDbDTO.OperatorCreateOrderDto; | 28 | import com.infoloop.tianting.model.dto.OrderDbDTO.OperatorCreateOrderDto; |
| 27 | import com.infoloop.tianting.model.dto.OrderDbDTO.OrderAndDetailsDto; | 29 | import com.infoloop.tianting.model.dto.OrderDbDTO.OrderAndDetailsDto; |
| 30 | +import com.infoloop.tianting.model.dto.OrderDbDTO.OrderCountByStatusDto; | ||
| 28 | import com.infoloop.tianting.model.dto.OrderDbDTO.OrderDetailBatchUpdateDto; | 31 | import com.infoloop.tianting.model.dto.OrderDbDTO.OrderDetailBatchUpdateDto; |
| 29 | import com.infoloop.tianting.model.dto.OrderDbDTO.OrderDetailDto; | 32 | import com.infoloop.tianting.model.dto.OrderDbDTO.OrderDetailDto; |
| 30 | import com.infoloop.tianting.model.dto.OrderDbDTO.OrderDto; | 33 | import com.infoloop.tianting.model.dto.OrderDbDTO.OrderDto; |
| ... | @@ -386,7 +389,7 @@ public class OrderServiceImpl implements OrderService { | ... | @@ -386,7 +389,7 @@ public class OrderServiceImpl implements OrderService { |
| 386 | } | 389 | } |
| 387 | 390 | ||
| 388 | @Override | 391 | @Override |
| 389 | - public PageResult<OrderDto> getOrdersByPagination(QueryOrderByPaginationDto queryOrderDto) { | 392 | + public OrderPageResult<OrderDto> getOrdersByPagination(QueryOrderByPaginationDto queryOrderDto) { |
| 390 | final var response = orderServiceRpcClient.queryClientCustomerOrdersByPagination(queryOrderDto); | 393 | final var response = orderServiceRpcClient.queryClientCustomerOrdersByPagination(queryOrderDto); |
| 391 | final var customerIds = response.getResponsesList().stream().map(SingleClientCustomerOrderRpcResponse::getCustomerId).collect(Collectors.toList()); | 394 | final var customerIds = response.getResponsesList().stream().map(SingleClientCustomerOrderRpcResponse::getCustomerId).collect(Collectors.toList()); |
| 392 | final var customerResponse = clientCustomerServiceRpcClient.getClientCustomersByIds( | 395 | final var customerResponse = clientCustomerServiceRpcClient.getClientCustomersByIds( |
| ... | @@ -427,8 +430,15 @@ public class OrderServiceImpl implements OrderService { | ... | @@ -427,8 +430,15 @@ public class OrderServiceImpl implements OrderService { |
| 427 | .totalNum(r.getTotalNum()) | 430 | .totalNum(r.getTotalNum()) |
| 428 | .customer(getCustomerDetail(r.getCustomerId(), customerResponse.getResponsesList())) | 431 | .customer(getCustomerDetail(r.getCustomerId(), customerResponse.getResponsesList())) |
| 429 | .build()).collect(Collectors.toList()); | 432 | .build()).collect(Collectors.toList()); |
| 433 | + final var orderCountByStatus = OrderCountByStatusDto.builder() | ||
| 434 | + .allServedCount(response.getCountByStatus().getAllServedCount()) | ||
| 435 | + .canceledCount(response.getCountByStatus().getCanceledCount()) | ||
| 436 | + .preparingCount(response.getCountByStatus().getPreparingCount()) | ||
| 437 | + .toPrepareCount(response.getCountByStatus().getToPrepareCount()) | ||
| 438 | + .unknownCount(response.getCountByStatus().getUnknownCount()) | ||
| 439 | + .build(); | ||
| 430 | return PageUtil.from(results, response.getTotal(), response.getPages(), | 440 | return PageUtil.from(results, response.getTotal(), response.getPages(), |
| 431 | - queryOrderDto.getPn(), queryOrderDto.getPz()); | 441 | + queryOrderDto.getPn(), queryOrderDto.getPz(), orderCountByStatus); |
| 432 | } | 442 | } |
| 433 | 443 | ||
| 434 | private CustomerDetailDto getCustomerDetail(Integer customerId, | 444 | private CustomerDetailDto getCustomerDetail(Integer customerId, | ... | ... |
| ... | @@ -161,10 +161,19 @@ message QueryClientCustomerOrdersByPaginationRpcRequest { | ... | @@ -161,10 +161,19 @@ message QueryClientCustomerOrdersByPaginationRpcRequest { |
| 161 | int32 pageSize = 6; | 161 | int32 pageSize = 6; |
| 162 | } | 162 | } |
| 163 | 163 | ||
| 164 | +message OrderCountByStatus { | ||
| 165 | + int32 unknownCount = 1; | ||
| 166 | + int32 toPrepareCount = 2; | ||
| 167 | + int32 preparingCount = 3; | ||
| 168 | + int32 allServedCount = 4; | ||
| 169 | + int32 canceledCount = 5; | ||
| 170 | +} | ||
| 171 | + | ||
| 164 | message QueryClientCustomerOrdersByPaginationRpcResponse { | 172 | message QueryClientCustomerOrdersByPaginationRpcResponse { |
| 165 | int64 total = 1; | 173 | int64 total = 1; |
| 166 | int64 pages = 2; | 174 | int64 pages = 2; |
| 167 | repeated SingleClientCustomerOrderRpcResponse responses = 3; | 175 | repeated SingleClientCustomerOrderRpcResponse responses = 3; |
| 176 | + OrderCountByStatus countByStatus = 4; | ||
| 168 | } | 177 | } |
| 169 | 178 | ||
| 170 | message QueryClientCustomerOrdersByConditionRpcRequest { | 179 | message QueryClientCustomerOrdersByConditionRpcRequest { | ... | ... |
| ... | @@ -68,7 +68,7 @@ grpc.woperator-service.url=47.101.193.136 | ... | @@ -68,7 +68,7 @@ grpc.woperator-service.url=47.101.193.136 |
| 68 | grpc.woperator-service.port=3028 | 68 | grpc.woperator-service.port=3028 |
| 69 | 69 | ||
| 70 | grpc.enterprise-resource-service.url=47.101.193.136 | 70 | grpc.enterprise-resource-service.url=47.101.193.136 |
| 71 | -grpc.enterprise-resource-service.port=3028 | 71 | +grpc.enterprise-resource-service.port=3026 |
| 72 | 72 | ||
| 73 | grpc.meizhongyihe-service.url=47.101.193.136 | 73 | grpc.meizhongyihe-service.url=47.101.193.136 |
| 74 | grpc.meizhongyihe-service.port=3040 | 74 | grpc.meizhongyihe-service.port=3040 | ... | ... |
-
Please register or login to post a comment