Showing
7 changed files
with
181 additions
and
4 deletions
No preview for this file type
| ... | @@ -99,7 +99,7 @@ public class ClientCustomerDbDTO { | ... | @@ -99,7 +99,7 @@ public class ClientCustomerDbDTO { |
| 99 | @Builder | 99 | @Builder |
| 100 | @ApiModel(description = "TodayOrderDto") | 100 | @ApiModel(description = "TodayOrderDto") |
| 101 | public static class NotOrderCustomerDto { | 101 | public static class NotOrderCustomerDto { |
| 102 | - private Integer id; | 102 | + private String id; |
| 103 | private String roomNo; | 103 | private String roomNo; |
| 104 | private String name; | 104 | private String name; |
| 105 | private List<MenuDto> menuList; | 105 | private List<MenuDto> menuList; | ... | ... |
| ... | @@ -2,6 +2,8 @@ package com.infoloop.tianting.model.dto; | ... | @@ -2,6 +2,8 @@ package com.infoloop.tianting.model.dto; |
| 2 | 2 | ||
| 3 | import com.infoloop.tianting.clientcustomerorderservice.OrderStatusEnum; | 3 | import com.infoloop.tianting.clientcustomerorderservice.OrderStatusEnum; |
| 4 | import com.infoloop.tianting.clientcustomerorderservice.ServeStatusEnum; | 4 | import com.infoloop.tianting.clientcustomerorderservice.ServeStatusEnum; |
| 5 | +import com.infoloop.tianting.model.dto.InventoryDbDTO.ClientDto; | ||
| 6 | +import com.infoloop.tianting.model.dto.OrderDbDTO.CustomerDetailDto; | ||
| 5 | import com.infoloop.tianting.model.dto.OrderDbDTO.CustomerNotice; | 7 | import com.infoloop.tianting.model.dto.OrderDbDTO.CustomerNotice; |
| 6 | import io.swagger.annotations.ApiModel; | 8 | import io.swagger.annotations.ApiModel; |
| 7 | import io.swagger.models.auth.In; | 9 | import io.swagger.models.auth.In; |
| ... | @@ -25,12 +27,17 @@ public class KdsDTO { | ... | @@ -25,12 +27,17 @@ public class KdsDTO { |
| 25 | private Integer orderDetailId; | 27 | private Integer orderDetailId; |
| 26 | private String tableCode; | 28 | private String tableCode; |
| 27 | private Integer count; | 29 | private Integer count; |
| 30 | + private Integer price; | ||
| 28 | private String roomNo; | 31 | private String roomNo; |
| 29 | private String remark; | 32 | private String remark; |
| 30 | private CustomerNotice customerNotice; | 33 | private CustomerNotice customerNotice; |
| 31 | private String adjustSkuRemark; | 34 | private String adjustSkuRemark; |
| 32 | private String mealTime; | 35 | private String mealTime; |
| 33 | private ServeStatusEnum serveStatus; | 36 | private ServeStatusEnum serveStatus; |
| 37 | + private String createdAt; | ||
| 38 | + private ClientDto client; | ||
| 39 | + private ClientDto stall; | ||
| 40 | + private CustomerDetailDto customer; | ||
| 34 | } | 41 | } |
| 35 | 42 | ||
| 36 | @Data | 43 | @Data |
| ... | @@ -44,6 +51,7 @@ public class KdsDTO { | ... | @@ -44,6 +51,7 @@ public class KdsDTO { |
| 44 | private String showName; | 51 | private String showName; |
| 45 | private String adjustSkuRemark; | 52 | private String adjustSkuRemark; |
| 46 | private ServeStatusEnum serveStatus; | 53 | private ServeStatusEnum serveStatus; |
| 54 | + private Integer price; | ||
| 47 | } | 55 | } |
| 48 | 56 | ||
| 49 | @Data | 57 | @Data |
| ... | @@ -71,6 +79,13 @@ public class KdsDTO { | ... | @@ -71,6 +79,13 @@ public class KdsDTO { |
| 71 | private String remark; | 79 | private String remark; |
| 72 | private String mealTime; | 80 | private String mealTime; |
| 73 | private CustomerNotice customerNotice; | 81 | private CustomerNotice customerNotice; |
| 82 | + private Integer totalPrice; | ||
| 83 | + private Integer payPrice; | ||
| 84 | + private String createdAt; | ||
| 85 | + private String orderCode; | ||
| 86 | + private ClientDto stall; | ||
| 87 | + private ClientDto client; | ||
| 88 | + private CustomerDetailDto customer; | ||
| 74 | private List<KdsOrderLocationDetailDto> orderDetailList; | 89 | private List<KdsOrderLocationDetailDto> orderDetailList; |
| 75 | } | 90 | } |
| 76 | 91 | ... | ... |
| ... | @@ -26,7 +26,7 @@ public class ClientCustomerServiceHttpClient { | ... | @@ -26,7 +26,7 @@ public class ClientCustomerServiceHttpClient { |
| 26 | try { | 26 | try { |
| 27 | String url = ""; | 27 | String url = ""; |
| 28 | if (isHis) { | 28 | if (isHis) { |
| 29 | - url = "https://nutri2.infoscm.cn/v3/hisClientcustomers/current/query"; | 29 | + url = "https://nutri2.infoscm.cn/v3/hiscustomers/current/query"; |
| 30 | } else { | 30 | } else { |
| 31 | url = "https://nutri2.infoscm.cn/v3/clientcustomers/current/query"; | 31 | url = "https://nutri2.infoscm.cn/v3/clientcustomers/current/query"; |
| 32 | } | 32 | } |
| ... | @@ -46,7 +46,7 @@ public class ClientCustomerServiceHttpClient { | ... | @@ -46,7 +46,7 @@ public class ClientCustomerServiceHttpClient { |
| 46 | return objectMapper.readValue(jsonData, CurrentClientCustomerListDto.class).getRows(); | 46 | return objectMapper.readValue(jsonData, CurrentClientCustomerListDto.class).getRows(); |
| 47 | } catch (Exception e) { | 47 | } catch (Exception e) { |
| 48 | System.out.println("error"+e.getMessage()); | 48 | System.out.println("error"+e.getMessage()); |
| 49 | - throw new IllegalArgumentException("获取用户openid失败"); | 49 | + throw new IllegalArgumentException("获取当日在住客户失败"); |
| 50 | } | 50 | } |
| 51 | } | 51 | } |
| 52 | } | 52 | } |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -2,12 +2,17 @@ package com.infoloop.tianting.service.client; | ... | @@ -2,12 +2,17 @@ package com.infoloop.tianting.service.client; |
| 2 | 2 | ||
| 3 | import com.infoloop.tianting.clientinventoryservice.GetClientByIdRpcRequest; | 3 | import com.infoloop.tianting.clientinventoryservice.GetClientByIdRpcRequest; |
| 4 | import com.infoloop.tianting.clientinventoryservice.GetClientByIdRpcResponse; | 4 | import com.infoloop.tianting.clientinventoryservice.GetClientByIdRpcResponse; |
| 5 | +import com.infoloop.tianting.clientinventoryservice.GetClientsByIdsRpcRequest; | ||
| 6 | +import com.infoloop.tianting.clientinventoryservice.GetClientsByIdsRpcResponse; | ||
| 5 | import com.infoloop.tianting.clientinventoryservice.GetStallsByClientIdRpcRequest; | 7 | import com.infoloop.tianting.clientinventoryservice.GetStallsByClientIdRpcRequest; |
| 6 | import com.infoloop.tianting.clientinventoryservice.GetStallsByClientIdRpcResponse; | 8 | import com.infoloop.tianting.clientinventoryservice.GetStallsByClientIdRpcResponse; |
| 9 | +import com.infoloop.tianting.clientinventoryservice.GetStallsByIdsRpcRequest; | ||
| 10 | +import com.infoloop.tianting.clientinventoryservice.GetStallsByIdsRpcResponse; | ||
| 7 | import com.infoloop.tianting.clientinventoryservice.QueryClientTableCodesByConditionRpcRequest; | 11 | import com.infoloop.tianting.clientinventoryservice.QueryClientTableCodesByConditionRpcRequest; |
| 8 | import com.infoloop.tianting.clientinventoryservice.QueryClientTableCodesByConditionRpcResponse; | 12 | import com.infoloop.tianting.clientinventoryservice.QueryClientTableCodesByConditionRpcResponse; |
| 9 | import com.infoloop.tianting.clientinventoryservice.TiantingClientInventoryServiceRpcGrpc; | 13 | import com.infoloop.tianting.clientinventoryservice.TiantingClientInventoryServiceRpcGrpc; |
| 10 | import com.infoloop.tianting.model.dto.InventoryDbDTO.TableCodeQueryConditionDto; | 14 | import com.infoloop.tianting.model.dto.InventoryDbDTO.TableCodeQueryConditionDto; |
| 15 | +import java.util.List; | ||
| 11 | import lombok.RequiredArgsConstructor; | 16 | import lombok.RequiredArgsConstructor; |
| 12 | import org.springframework.beans.factory.annotation.Autowired; | 17 | import org.springframework.beans.factory.annotation.Autowired; |
| 13 | import org.springframework.stereotype.Service; | 18 | import org.springframework.stereotype.Service; |
| ... | @@ -28,6 +33,24 @@ public class InventoryServiceRpcClient { | ... | @@ -28,6 +33,24 @@ public class InventoryServiceRpcClient { |
| 28 | 33 | ||
| 29 | } | 34 | } |
| 30 | 35 | ||
| 36 | + public GetClientsByIdsRpcResponse getClientsByIds(Integer enterpriseId, List<Integer> clientIds) { | ||
| 37 | + final var request = GetClientsByIdsRpcRequest.newBuilder() | ||
| 38 | + .setEnterpriseId(enterpriseId) | ||
| 39 | + .addAllIds(clientIds) | ||
| 40 | + .setIncludeDeleted(false) | ||
| 41 | + .build(); | ||
| 42 | + return inventoryServiceRpcBlockingStub.getClientsByIds(request); | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + public GetStallsByIdsRpcResponse getStallsByIds(Integer enterpriseId, List<Integer> stallIds) { | ||
| 46 | + final var request = GetStallsByIdsRpcRequest.newBuilder() | ||
| 47 | + .setEnterpriseId(enterpriseId) | ||
| 48 | + .addAllIds(stallIds) | ||
| 49 | + .setIncludeDeleted(false) | ||
| 50 | + .build(); | ||
| 51 | + return inventoryServiceRpcBlockingStub.getStallsByIds(request); | ||
| 52 | + } | ||
| 53 | + | ||
| 31 | public GetStallsByClientIdRpcResponse getStallsByClientId(Integer enterpriseId, Integer clientId) { | 54 | public GetStallsByClientIdRpcResponse getStallsByClientId(Integer enterpriseId, Integer clientId) { |
| 32 | final var request = GetStallsByClientIdRpcRequest.newBuilder() | 55 | final var request = GetStallsByClientIdRpcRequest.newBuilder() |
| 33 | .setEnterpriseId(enterpriseId) | 56 | .setEnterpriseId(enterpriseId) | ... | ... |
| ... | @@ -285,12 +285,19 @@ public class ClientCustomerServiceImpl implements ClientCustomerService { | ... | @@ -285,12 +285,19 @@ public class ClientCustomerServiceImpl implements ClientCustomerService { |
| 285 | public TodayOrderDto getTodayOrderStatistic(String token, boolean isHis) { | 285 | public TodayOrderDto getTodayOrderStatistic(String token, boolean isHis) { |
| 286 | List<CurrentClientCustomerDto> currentCustomers = new ArrayList<>(); | 286 | List<CurrentClientCustomerDto> currentCustomers = new ArrayList<>(); |
| 287 | List<Integer> customerIds = new ArrayList<>(); | 287 | List<Integer> customerIds = new ArrayList<>(); |
| 288 | + | ||
| 289 | + // 没有找到clientCustomer的hisCustomerIds | ||
| 290 | + List<CurrentClientCustomerDto> notOrderedHisCustomers = new ArrayList<>(); | ||
| 288 | if (isHis){ | 291 | if (isHis){ |
| 289 | currentCustomers = clientCustomerServiceHttpClient.getCurrentClientCustomer(token, true); | 292 | currentCustomers = clientCustomerServiceHttpClient.getCurrentClientCustomer(token, true); |
| 290 | final var hisCustomerIds = currentCustomers.stream().map(CurrentClientCustomerDto::getId).distinct() | 293 | final var hisCustomerIds = currentCustomers.stream().map(CurrentClientCustomerDto::getId).distinct() |
| 291 | .collect(Collectors.toList()); | 294 | .collect(Collectors.toList()); |
| 292 | final var currentClientCustomers = clientCustomerServiceRpcClient.getClientCustomersByHISCustomerIds(hisCustomerIds).getResponsesList(); | 295 | final var currentClientCustomers = clientCustomerServiceRpcClient.getClientCustomersByHISCustomerIds(hisCustomerIds).getResponsesList(); |
| 293 | customerIds = currentClientCustomers.stream().map(SingleClientCustomerRpcResponse::getId).distinct().collect(Collectors.toList()); | 296 | customerIds = currentClientCustomers.stream().map(SingleClientCustomerRpcResponse::getId).distinct().collect(Collectors.toList()); |
| 297 | + final var mappingHisCustomerIds = currentClientCustomers.stream().map(SingleClientCustomerRpcResponse::getHISCustomerId).collect(Collectors.toList()); | ||
| 298 | +// final var notOrderedHisCustomerIds = hisCustomerIds.stream().filter(i -> !mappingHisCustomerIds.contains(i)).collect(Collectors.toList()); | ||
| 299 | + notOrderedHisCustomers = currentCustomers.stream().filter(c -> !mappingHisCustomerIds.contains(c.getId())).collect( | ||
| 300 | + Collectors.toList()); | ||
| 294 | } else { | 301 | } else { |
| 295 | currentCustomers = clientCustomerServiceHttpClient.getCurrentClientCustomer(token, false); | 302 | currentCustomers = clientCustomerServiceHttpClient.getCurrentClientCustomer(token, false); |
| 296 | customerIds = currentCustomers.stream().map(CurrentClientCustomerDto::getId).map(id -> {try{ | 303 | customerIds = currentCustomers.stream().map(CurrentClientCustomerDto::getId).map(id -> {try{ |
| ... | @@ -386,13 +393,25 @@ public class ClientCustomerServiceImpl implements ClientCustomerService { | ... | @@ -386,13 +393,25 @@ public class ClientCustomerServiceImpl implements ClientCustomerService { |
| 386 | .publishAt(DateUtil.formatDate(menu.getPublishAt())) | 393 | .publishAt(DateUtil.formatDate(menu.getPublishAt())) |
| 387 | .build()).collect(Collectors.toList()); | 394 | .build()).collect(Collectors.toList()); |
| 388 | final var resNotOrderCustomer = NotOrderCustomerDto.builder() | 395 | final var resNotOrderCustomer = NotOrderCustomerDto.builder() |
| 389 | - .id(notOrderCustomerId) | 396 | + .id(notOrderCustomerId.toString()) |
| 390 | .name(notOrderCustomer.getName()) | 397 | .name(notOrderCustomer.getName()) |
| 391 | .roomNo(notOrderCustomer.getRoomNo()) | 398 | .roomNo(notOrderCustomer.getRoomNo()) |
| 392 | .menuList(curMenuDtos) | 399 | .menuList(curMenuDtos) |
| 393 | .build(); | 400 | .build(); |
| 394 | resNotOrderCustomers.add(resNotOrderCustomer); | 401 | resNotOrderCustomers.add(resNotOrderCustomer); |
| 395 | } | 402 | } |
| 403 | + if (isHis) { | ||
| 404 | + for (CurrentClientCustomerDto currentClientCustomer: notOrderedHisCustomers) { | ||
| 405 | + final var resNotOrderCustomer = NotOrderCustomerDto.builder() | ||
| 406 | + .id(currentClientCustomer.getId()) | ||
| 407 | + .name(currentClientCustomer.getName()) | ||
| 408 | + .roomNo(currentClientCustomer.getRoomNo()) | ||
| 409 | + .menuList(new ArrayList<>()) | ||
| 410 | + .build(); | ||
| 411 | + resNotOrderCustomers.add(resNotOrderCustomer); | ||
| 412 | + } | ||
| 413 | + | ||
| 414 | + } | ||
| 396 | 415 | ||
| 397 | return TodayOrderDto.builder() | 416 | return TodayOrderDto.builder() |
| 398 | .totalCurrentCustomerCount(currentCustomers.size()) | 417 | .totalCurrentCustomerCount(currentCustomers.size()) | ... | ... |
| ... | @@ -4,6 +4,7 @@ import com.infoloop.tianting.clientcustomerorderservice.OrderStatusEnum; | ... | @@ -4,6 +4,7 @@ import com.infoloop.tianting.clientcustomerorderservice.OrderStatusEnum; |
| 4 | import com.infoloop.tianting.clientcustomerorderservice.SingleClientCustomerOrderDetailRpcResponse; | 4 | import com.infoloop.tianting.clientcustomerorderservice.SingleClientCustomerOrderDetailRpcResponse; |
| 5 | import com.infoloop.tianting.clientcustomerorderservice.SingleClientCustomerOrderRpcResponse; | 5 | import com.infoloop.tianting.clientcustomerorderservice.SingleClientCustomerOrderRpcResponse; |
| 6 | import com.infoloop.tianting.context.LoginContextHolder; | 6 | import com.infoloop.tianting.context.LoginContextHolder; |
| 7 | +import com.infoloop.tianting.model.dto.InventoryDbDTO.ClientDto; | ||
| 7 | import com.infoloop.tianting.model.dto.KdsDTO.KdsMealDetailDto; | 8 | import com.infoloop.tianting.model.dto.KdsDTO.KdsMealDetailDto; |
| 8 | import com.infoloop.tianting.model.dto.KdsDTO.KdsOrderLocationDetailDto; | 9 | import com.infoloop.tianting.model.dto.KdsDTO.KdsOrderLocationDetailDto; |
| 9 | import com.infoloop.tianting.model.dto.KdsDTO.KdsOrderLocationDto; | 10 | import com.infoloop.tianting.model.dto.KdsDTO.KdsOrderLocationDto; |
| ... | @@ -11,11 +12,14 @@ import com.infoloop.tianting.model.dto.KdsDTO.KdsOrderLocationQueryDto; | ... | @@ -11,11 +12,14 @@ import com.infoloop.tianting.model.dto.KdsDTO.KdsOrderLocationQueryDto; |
| 11 | import com.infoloop.tianting.model.dto.KdsDTO.KdsOrderSkuDetailDto; | 12 | import com.infoloop.tianting.model.dto.KdsDTO.KdsOrderSkuDetailDto; |
| 12 | import com.infoloop.tianting.model.dto.KdsDTO.KdsOrderSkuDto; | 13 | import com.infoloop.tianting.model.dto.KdsDTO.KdsOrderSkuDto; |
| 13 | import com.infoloop.tianting.model.dto.KdsDTO.KdsOrderSkuQueryDto; | 14 | import com.infoloop.tianting.model.dto.KdsDTO.KdsOrderSkuQueryDto; |
| 15 | +import com.infoloop.tianting.model.dto.OrderDbDTO.CustomerDetailDto; | ||
| 14 | import com.infoloop.tianting.model.dto.OrderDbDTO.CustomerNotice; | 16 | import com.infoloop.tianting.model.dto.OrderDbDTO.CustomerNotice; |
| 15 | import com.infoloop.tianting.model.dto.OrderDbDTO.QueryOrderByConditionDto; | 17 | import com.infoloop.tianting.model.dto.OrderDbDTO.QueryOrderByConditionDto; |
| 16 | import com.infoloop.tianting.service.KdsService; | 18 | import com.infoloop.tianting.service.KdsService; |
| 17 | import com.infoloop.tianting.service.MealService; | 19 | import com.infoloop.tianting.service.MealService; |
| 20 | +import com.infoloop.tianting.service.client.ClientCustomerServiceRpcClient; | ||
| 18 | import com.infoloop.tianting.service.client.EnterpriseResourceServiceRpcClient; | 21 | import com.infoloop.tianting.service.client.EnterpriseResourceServiceRpcClient; |
| 22 | +import com.infoloop.tianting.service.client.InventoryServiceRpcClient; | ||
| 19 | import com.infoloop.tianting.service.client.MealServiceRpcClient; | 23 | import com.infoloop.tianting.service.client.MealServiceRpcClient; |
| 20 | import com.infoloop.tianting.service.client.MenuServiceRpcClient; | 24 | import com.infoloop.tianting.service.client.MenuServiceRpcClient; |
| 21 | import com.infoloop.tianting.service.client.OrderServiceRpcClient; | 25 | import com.infoloop.tianting.service.client.OrderServiceRpcClient; |
| ... | @@ -27,10 +31,12 @@ import java.time.LocalDateTime; | ... | @@ -27,10 +31,12 @@ import java.time.LocalDateTime; |
| 27 | import java.util.ArrayList; | 31 | import java.util.ArrayList; |
| 28 | import java.util.List; | 32 | import java.util.List; |
| 29 | import java.util.stream.Collectors; | 33 | import java.util.stream.Collectors; |
| 34 | +import java.util.stream.IntStream; | ||
| 30 | import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; | 35 | import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; |
| 31 | import lombok.RequiredArgsConstructor; | 36 | import lombok.RequiredArgsConstructor; |
| 32 | import lombok.extern.slf4j.Slf4j; | 37 | import lombok.extern.slf4j.Slf4j; |
| 33 | import org.springframework.beans.factory.annotation.Autowired; | 38 | import org.springframework.beans.factory.annotation.Autowired; |
| 39 | +import org.springframework.boot.autoconfigure.integration.IntegrationProperties.RSocket.Client; | ||
| 34 | import org.springframework.stereotype.Service; | 40 | import org.springframework.stereotype.Service; |
| 35 | 41 | ||
| 36 | @Slf4j | 42 | @Slf4j |
| ... | @@ -43,6 +49,8 @@ public class KdsServiceImpl implements KdsService { | ... | @@ -43,6 +49,8 @@ public class KdsServiceImpl implements KdsService { |
| 43 | private final WOperatorServiceRpcClient wOperatorServiceRpcClient; | 49 | private final WOperatorServiceRpcClient wOperatorServiceRpcClient; |
| 44 | private final MealServiceRpcClient mealServiceRpcClient; | 50 | private final MealServiceRpcClient mealServiceRpcClient; |
| 45 | private final SkuServiceRpcClient skuServiceRpcClient; | 51 | private final SkuServiceRpcClient skuServiceRpcClient; |
| 52 | + private final InventoryServiceRpcClient inventoryServiceRpcClient; | ||
| 53 | + private final ClientCustomerServiceRpcClient clientCustomerServiceRpcClient; | ||
| 46 | 54 | ||
| 47 | @Override | 55 | @Override |
| 48 | public List<KdsOrderSkuDto> getOrderDetailBySku(KdsOrderSkuQueryDto queryDto) { | 56 | public List<KdsOrderSkuDto> getOrderDetailBySku(KdsOrderSkuQueryDto queryDto) { |
| ... | @@ -79,6 +87,24 @@ public class KdsServiceImpl implements KdsService { | ... | @@ -79,6 +87,24 @@ public class KdsServiceImpl implements KdsService { |
| 79 | .map(SingleClientCustomerOrderRpcResponse::getId) | 87 | .map(SingleClientCustomerOrderRpcResponse::getId) |
| 80 | .distinct() | 88 | .distinct() |
| 81 | .collect(Collectors.toList()); | 89 | .collect(Collectors.toList()); |
| 90 | + final var clientIds = orderList.stream() | ||
| 91 | + .map(SingleClientCustomerOrderRpcResponse::getClientId) | ||
| 92 | + .distinct() | ||
| 93 | + .collect(Collectors.toList()); | ||
| 94 | + final var clients = inventoryServiceRpcClient.getClientsByIds( | ||
| 95 | + operator.getEnterpriseId(), clientIds); | ||
| 96 | + | ||
| 97 | + final var orderStallIds = orderList.stream() | ||
| 98 | + .map(SingleClientCustomerOrderRpcResponse::getStallId) | ||
| 99 | + .distinct() | ||
| 100 | + .collect(Collectors.toList()); | ||
| 101 | + final var stalls = inventoryServiceRpcClient.getStallsByIds( | ||
| 102 | + operator.getEnterpriseId(), orderStallIds); | ||
| 103 | + | ||
| 104 | + final var customerIds = orderList.stream().map(SingleClientCustomerOrderRpcResponse::getCustomerId).collect(Collectors.toList()); | ||
| 105 | + final var customerResponse = clientCustomerServiceRpcClient.getClientCustomersByIds( | ||
| 106 | + queryOrderDto.getEnterpriseId(), customerIds); | ||
| 107 | + | ||
| 82 | final var orderDetailList = orderServiceRpcClient.getOrderDetailsByOrderIds(orderIds); | 108 | final var orderDetailList = orderServiceRpcClient.getOrderDetailsByOrderIds(orderIds); |
| 83 | final var filteredOrderDetailList = orderDetailList.stream() | 109 | final var filteredOrderDetailList = orderDetailList.stream() |
| 84 | .filter(od -> od.getServeStatus() == queryDto.getServeStatus() && od.getMealId() == queryDto.getMealId()) | 110 | .filter(od -> od.getServeStatus() == queryDto.getServeStatus() && od.getMealId() == queryDto.getMealId()) |
| ... | @@ -113,6 +139,35 @@ public class KdsServiceImpl implements KdsService { | ... | @@ -113,6 +139,35 @@ public class KdsServiceImpl implements KdsService { |
| 113 | if (order.isEmpty()) { | 139 | if (order.isEmpty()) { |
| 114 | continue; | 140 | continue; |
| 115 | } | 141 | } |
| 142 | + final var optionalClient = clients.getClientsList().stream().filter(c -> c.getId() == order.get().getClientId()).findFirst(); | ||
| 143 | + ClientDto client = ClientDto.builder().build(); | ||
| 144 | + if (optionalClient.isPresent()) { | ||
| 145 | + client = ClientDto.builder() | ||
| 146 | + .id(optionalClient.get().getId()) | ||
| 147 | + .name(optionalClient.get().getName()) | ||
| 148 | + .build(); | ||
| 149 | + } | ||
| 150 | + | ||
| 151 | + final var optionalStall = stalls.getClientsList().stream().filter(s -> s.getId() == order.get().getStallId()).findFirst(); | ||
| 152 | + ClientDto stall = ClientDto.builder().build(); | ||
| 153 | + if (optionalStall.isPresent()) { | ||
| 154 | + stall = ClientDto.builder() | ||
| 155 | + .id(optionalStall.get().getId()) | ||
| 156 | + .name(optionalStall.get().getName()) | ||
| 157 | + .build(); | ||
| 158 | + } | ||
| 159 | + | ||
| 160 | + final var optionalCustomer = customerResponse.getResponsesList().stream() | ||
| 161 | + .filter(c -> c.getId() == order.get().getCustomerId()) | ||
| 162 | + .findFirst(); | ||
| 163 | + CustomerDetailDto customer = CustomerDetailDto.builder().build(); | ||
| 164 | + if(optionalCustomer.isPresent()) { | ||
| 165 | + customer = CustomerDetailDto.builder() | ||
| 166 | + .id(optionalCustomer.get().getId()) | ||
| 167 | + .phone(optionalCustomer.get().getMobile()) | ||
| 168 | + .name(optionalCustomer.get().getName()) | ||
| 169 | + .build(); | ||
| 170 | + } | ||
| 116 | final var kdsOrder = KdsOrderSkuDetailDto.builder() | 171 | final var kdsOrder = KdsOrderSkuDetailDto.builder() |
| 117 | .count(detail.getCount()) | 172 | .count(detail.getCount()) |
| 118 | .orderDetailId(detail.getId()) | 173 | .orderDetailId(detail.getId()) |
| ... | @@ -126,7 +181,12 @@ public class KdsServiceImpl implements KdsService { | ... | @@ -126,7 +181,12 @@ public class KdsServiceImpl implements KdsService { |
| 126 | .build()) | 181 | .build()) |
| 127 | .adjustSkuRemark(detail.getAdjustSkuRemark()) | 182 | .adjustSkuRemark(detail.getAdjustSkuRemark()) |
| 128 | .mealTime(DateUtil.formatDate(order.get().getMealTime())) | 183 | .mealTime(DateUtil.formatDate(order.get().getMealTime())) |
| 184 | + .createdAt(DateUtil.formatDate(order.get().getCreatedAt())) | ||
| 185 | + .client(client) | ||
| 186 | + .stall(stall) | ||
| 187 | + .customer(customer) | ||
| 129 | .serveStatus(detail.getServeStatus()) | 188 | .serveStatus(detail.getServeStatus()) |
| 189 | + .price(detail.getPrice()) | ||
| 130 | .build(); | 190 | .build(); |
| 131 | kdsOrders.add(kdsOrder); | 191 | kdsOrders.add(kdsOrder); |
| 132 | } | 192 | } |
| ... | @@ -261,6 +321,24 @@ public class KdsServiceImpl implements KdsService { | ... | @@ -261,6 +321,24 @@ public class KdsServiceImpl implements KdsService { |
| 261 | .map(SingleClientCustomerOrderRpcResponse::getId) | 321 | .map(SingleClientCustomerOrderRpcResponse::getId) |
| 262 | .distinct() | 322 | .distinct() |
| 263 | .collect(Collectors.toList()); | 323 | .collect(Collectors.toList()); |
| 324 | + final var clientIds = orderList.stream() | ||
| 325 | + .map(SingleClientCustomerOrderRpcResponse::getClientId) | ||
| 326 | + .distinct() | ||
| 327 | + .collect(Collectors.toList()); | ||
| 328 | + final var clients = inventoryServiceRpcClient.getClientsByIds( | ||
| 329 | + operator.getEnterpriseId(), clientIds); | ||
| 330 | + | ||
| 331 | + final var orderStallIds = orderList.stream() | ||
| 332 | + .map(SingleClientCustomerOrderRpcResponse::getStallId) | ||
| 333 | + .distinct() | ||
| 334 | + .collect(Collectors.toList()); | ||
| 335 | + final var stalls = inventoryServiceRpcClient.getStallsByIds( | ||
| 336 | + operator.getEnterpriseId(), orderStallIds); | ||
| 337 | + | ||
| 338 | + final var customerIds = orderList.stream().map(SingleClientCustomerOrderRpcResponse::getCustomerId).collect(Collectors.toList()); | ||
| 339 | + final var customerResponse = clientCustomerServiceRpcClient.getClientCustomersByIds( | ||
| 340 | + queryOrderDto.getEnterpriseId(), customerIds); | ||
| 341 | + | ||
| 264 | final var orderDetailList = orderServiceRpcClient.getOrderDetailsByOrderIds(orderIds); | 342 | final var orderDetailList = orderServiceRpcClient.getOrderDetailsByOrderIds(orderIds); |
| 265 | final var filteredOrderDetailList = orderDetailList.stream() | 343 | final var filteredOrderDetailList = orderDetailList.stream() |
| 266 | .filter(od -> od.getMealId() == queryDto.getMealId()) | 344 | .filter(od -> od.getMealId() == queryDto.getMealId()) |
| ... | @@ -285,8 +363,43 @@ public class KdsServiceImpl implements KdsService { | ... | @@ -285,8 +363,43 @@ public class KdsServiceImpl implements KdsService { |
| 285 | .orderDetailId(od.getId()) | 363 | .orderDetailId(od.getId()) |
| 286 | .serveStatus(od.getServeStatus()) | 364 | .serveStatus(od.getServeStatus()) |
| 287 | .showName(od.getShowName()) | 365 | .showName(od.getShowName()) |
| 366 | + .price(od.getPrice()) | ||
| 288 | .build() | 367 | .build() |
| 289 | ).collect(Collectors.toList()); | 368 | ).collect(Collectors.toList()); |
| 369 | + final var detailPriceList = curOrderDetails.stream() | ||
| 370 | + .map(d -> d.getPrice() * d.getCount()) | ||
| 371 | + .collect(Collectors.toList()); | ||
| 372 | + final var totalPrice = detailPriceList.stream().mapToInt(integer -> integer).sum(); | ||
| 373 | + final var optionalClient = clients.getClientsList().stream().filter(c -> c.getId() == order.getClientId()).findFirst(); | ||
| 374 | + ClientDto client = ClientDto.builder().build(); | ||
| 375 | + if (optionalClient.isPresent()) { | ||
| 376 | + client = ClientDto.builder() | ||
| 377 | + .id(optionalClient.get().getId()) | ||
| 378 | + .name(optionalClient.get().getName()) | ||
| 379 | + .build(); | ||
| 380 | + } | ||
| 381 | + | ||
| 382 | + final var optionalStall = stalls.getClientsList().stream().filter(s -> s.getId() == order.getStallId()).findFirst(); | ||
| 383 | + ClientDto stall = ClientDto.builder().build(); | ||
| 384 | + if (optionalStall.isPresent()) { | ||
| 385 | + stall = ClientDto.builder() | ||
| 386 | + .id(optionalStall.get().getId()) | ||
| 387 | + .name(optionalStall.get().getName()) | ||
| 388 | + .build(); | ||
| 389 | + } | ||
| 390 | + | ||
| 391 | + final var optionalCustomer = customerResponse.getResponsesList().stream() | ||
| 392 | + .filter(c -> c.getId() == order.getCustomerId()) | ||
| 393 | + .findFirst(); | ||
| 394 | + CustomerDetailDto customer = CustomerDetailDto.builder().build(); | ||
| 395 | + if(optionalCustomer.isPresent()) { | ||
| 396 | + customer = CustomerDetailDto.builder() | ||
| 397 | + .id(optionalCustomer.get().getId()) | ||
| 398 | + .phone(optionalCustomer.get().getMobile()) | ||
| 399 | + .name(optionalCustomer.get().getName()) | ||
| 400 | + .build(); | ||
| 401 | + } | ||
| 402 | + | ||
| 290 | final var kdsOrder = KdsOrderLocationDto.builder() | 403 | final var kdsOrder = KdsOrderLocationDto.builder() |
| 291 | .totalCount(order.getTotalNum()) | 404 | .totalCount(order.getTotalNum()) |
| 292 | .remark(order.getRemark()) | 405 | .remark(order.getRemark()) |
| ... | @@ -299,6 +412,13 @@ public class KdsServiceImpl implements KdsService { | ... | @@ -299,6 +412,13 @@ public class KdsServiceImpl implements KdsService { |
| 299 | .build()) | 412 | .build()) |
| 300 | .orderDetailList(kdsOrderDetails) | 413 | .orderDetailList(kdsOrderDetails) |
| 301 | .mealTime(DateUtil.formatDate(order.getMealTime())) | 414 | .mealTime(DateUtil.formatDate(order.getMealTime())) |
| 415 | + .orderCode(order.getOrderCode()) | ||
| 416 | + .payPrice(order.getPayPrice()) | ||
| 417 | + .totalPrice(totalPrice) | ||
| 418 | + .createdAt(DateUtil.formatDate(order.getCreatedAt())) | ||
| 419 | + .client(client) | ||
| 420 | + .stall(stall) | ||
| 421 | + .customer(customer) | ||
| 302 | .build(); | 422 | .build(); |
| 303 | kdsOrderLocationList.add(kdsOrder); | 423 | kdsOrderLocationList.add(kdsOrder); |
| 304 | } | 424 | } | ... | ... |
-
Please register or login to post a comment