zhuyifan

同步房间号

Showing 38 changed files with 442 additions and 244 deletions
...@@ -8,6 +8,7 @@ import com.infoloop.tianting.WOperatorServiceProtoRpcGrpc; ...@@ -8,6 +8,7 @@ import com.infoloop.tianting.WOperatorServiceProtoRpcGrpc;
8 import com.infoloop.tianting.clientcustomerorderservice.ClientCustomerOrderServiceRpcGrpc; 8 import com.infoloop.tianting.clientcustomerorderservice.ClientCustomerOrderServiceRpcGrpc;
9 import com.infoloop.tianting.clientcustomerservice.ClientCustomerServiceRpcGrpc; 9 import com.infoloop.tianting.clientcustomerservice.ClientCustomerServiceRpcGrpc;
10 import com.infoloop.tianting.clientinventoryservice.TiantingClientInventoryServiceRpcGrpc; 10 import com.infoloop.tianting.clientinventoryservice.TiantingClientInventoryServiceRpcGrpc;
11 +import com.infoloop.tianting.clientresourcetagservice.ClientResourceTagServiceRpcGrpc;
11 import com.infoloop.tianting.deliveryruleservice.TiantingDeliveryRuleServiceRpcGrpc; 12 import com.infoloop.tianting.deliveryruleservice.TiantingDeliveryRuleServiceRpcGrpc;
12 import com.infoloop.tianting.enterpriseresourcetagservice.EnterpriseResourceTagServiceRpcGrpc; 13 import com.infoloop.tianting.enterpriseresourcetagservice.EnterpriseResourceTagServiceRpcGrpc;
13 import com.infoloop.tianting.menuservice.MenuServiceRpcGrpc; 14 import com.infoloop.tianting.menuservice.MenuServiceRpcGrpc;
...@@ -32,6 +33,9 @@ import static com.infoloop.tianting.constant.ConfigConstants.CLIENT_CUSTOMER_SER ...@@ -32,6 +33,9 @@ import static com.infoloop.tianting.constant.ConfigConstants.CLIENT_CUSTOMER_SER
32 import static com.infoloop.tianting.constant.ConfigConstants.CLIENT_INVENTORY_SERVICE_CHANNEL; 33 import static com.infoloop.tianting.constant.ConfigConstants.CLIENT_INVENTORY_SERVICE_CHANNEL;
33 import static com.infoloop.tianting.constant.ConfigConstants.CLIENT_INVENTORY_SERVICE_RPC_PORT; 34 import static com.infoloop.tianting.constant.ConfigConstants.CLIENT_INVENTORY_SERVICE_RPC_PORT;
34 import static com.infoloop.tianting.constant.ConfigConstants.CLIENT_INVENTORY_SERVICE_RPC_URL; 35 import static com.infoloop.tianting.constant.ConfigConstants.CLIENT_INVENTORY_SERVICE_RPC_URL;
36 +import static com.infoloop.tianting.constant.ConfigConstants.CLIENT_RESOURCE_SERVICE_CHANNEL;
37 +import static com.infoloop.tianting.constant.ConfigConstants.CLIENT_RESOURCE_SERVICE_RPC_PORT;
38 +import static com.infoloop.tianting.constant.ConfigConstants.CLIENT_RESOURCE_SERVICE_RPC_URL;
35 import static com.infoloop.tianting.constant.ConfigConstants.DELIVERY_SERVICE_CHANNEL; 39 import static com.infoloop.tianting.constant.ConfigConstants.DELIVERY_SERVICE_CHANNEL;
36 import static com.infoloop.tianting.constant.ConfigConstants.DELIVERY_SERVICE_RPC_PORT; 40 import static com.infoloop.tianting.constant.ConfigConstants.DELIVERY_SERVICE_RPC_PORT;
37 import static com.infoloop.tianting.constant.ConfigConstants.DELIVERY_SERVICE_RPC_URL; 41 import static com.infoloop.tianting.constant.ConfigConstants.DELIVERY_SERVICE_RPC_URL;
...@@ -268,4 +272,21 @@ public class GrpcConfig { ...@@ -268,4 +272,21 @@ public class GrpcConfig {
268 public MeiZhongYiHeServiceRpcGrpc.MeiZhongYiHeServiceRpcBlockingStub meiZhongYiHeServiceRpcBlockingStub(@Autowired @Qualifier(MEIZHONGYIHE_SERVICE_CHANNEL) final ManagedChannel channel) { 272 public MeiZhongYiHeServiceRpcGrpc.MeiZhongYiHeServiceRpcBlockingStub meiZhongYiHeServiceRpcBlockingStub(@Autowired @Qualifier(MEIZHONGYIHE_SERVICE_CHANNEL) final ManagedChannel channel) {
269 return MeiZhongYiHeServiceRpcGrpc.newBlockingStub(channel); 273 return MeiZhongYiHeServiceRpcGrpc.newBlockingStub(channel);
270 } 274 }
275 +
276 + @Bean(CLIENT_RESOURCE_SERVICE_CHANNEL)
277 + public ManagedChannel clientResourceServiceChannel(@Value(CLIENT_RESOURCE_SERVICE_RPC_URL) final String url,
278 + @Value(CLIENT_RESOURCE_SERVICE_RPC_PORT) final int port,
279 + @Autowired final ClientInterceptor clientInterceptor) {
280 + return NettyChannelBuilder.forAddress(url, port)
281 + .idleTimeout(DEFAULT_TIMEOUT_DAYS, TimeUnit.DAYS)
282 + .intercept(clientInterceptor)
283 + .usePlaintext()
284 + .maxInboundMessageSize(Integer.MAX_VALUE)
285 + .build();
286 + }
287 +
288 + @Bean
289 + public ClientResourceTagServiceRpcGrpc.ClientResourceTagServiceRpcBlockingStub clientResourceTagServiceRpcBlockingStub(@Autowired @Qualifier(CLIENT_RESOURCE_SERVICE_CHANNEL) final ManagedChannel channel) {
290 + return ClientResourceTagServiceRpcGrpc.newBlockingStub(channel);
291 + }
271 } 292 }
......
...@@ -4,6 +4,7 @@ import com.infoloop.tianting.context.LoginContextHolder; ...@@ -4,6 +4,7 @@ import com.infoloop.tianting.context.LoginContextHolder;
4 import lombok.extern.slf4j.Slf4j; 4 import lombok.extern.slf4j.Slf4j;
5 import org.springframework.context.annotation.Bean; 5 import org.springframework.context.annotation.Bean;
6 import org.springframework.context.annotation.Configuration; 6 import org.springframework.context.annotation.Configuration;
7 +import org.springframework.context.annotation.Primary;
7 import org.springframework.core.task.TaskDecorator; 8 import org.springframework.core.task.TaskDecorator;
8 import org.springframework.scheduling.TaskScheduler; 9 import org.springframework.scheduling.TaskScheduler;
9 import org.springframework.scheduling.annotation.EnableAsync; 10 import org.springframework.scheduling.annotation.EnableAsync;
...@@ -23,6 +24,7 @@ import static com.infoloop.tianting.constant.ConfigConstants.SCHEDULED_TASK_EXEC ...@@ -23,6 +24,7 @@ import static com.infoloop.tianting.constant.ConfigConstants.SCHEDULED_TASK_EXEC
23 @EnableAsync 24 @EnableAsync
24 public class TaskPoolConfig { 25 public class TaskPoolConfig {
25 26
27 + @Primary
26 @Bean(SCHEDULED_TASK_EXECUTOR) 28 @Bean(SCHEDULED_TASK_EXECUTOR)
27 public TaskScheduler scheduledExecutorService() { 29 public TaskScheduler scheduledExecutorService() {
28 final var scheduler = new ThreadPoolTaskScheduler(); 30 final var scheduler = new ThreadPoolTaskScheduler();
......
...@@ -76,6 +76,10 @@ public interface ConfigConstants { ...@@ -76,6 +76,10 @@ public interface ConfigConstants {
76 String MEIZHONGYIHE_SERVICE_RPC_PORT = "${grpc.meizhongyihe-service.port}"; 76 String MEIZHONGYIHE_SERVICE_RPC_PORT = "${grpc.meizhongyihe-service.port}";
77 String MEIZHONGYIHE_SERVICE_CHANNEL = "meizhongyihe-service-channel"; 77 String MEIZHONGYIHE_SERVICE_CHANNEL = "meizhongyihe-service-channel";
78 78
79 + String CLIENT_RESOURCE_SERVICE_RPC_URL = "${grpc.client-resource-service.url}";
80 + String CLIENT_RESOURCE_SERVICE_RPC_PORT = "${grpc.client-resource-service.port}";
81 + String CLIENT_RESOURCE_SERVICE_CHANNEL = "client-resource-tag-service-channel";
82 +
79 String ASYNC_EXECUTOR = "asyncExecutor"; 83 String ASYNC_EXECUTOR = "asyncExecutor";
80 String SCHEDULED_TASK_EXECUTOR = "scheduledTaskExecutor"; 84 String SCHEDULED_TASK_EXECUTOR = "scheduledTaskExecutor";
81 85
......
1 package com.infoloop.tianting.context; 1 package com.infoloop.tianting.context;
2 2
3 +import com.infoloop.tianting.enums.LoginSourceEnum;
3 import lombok.AllArgsConstructor; 4 import lombok.AllArgsConstructor;
4 import lombok.Builder; 5 import lombok.Builder;
5 import lombok.Data; 6 import lombok.Data;
...@@ -61,6 +62,8 @@ public class LoginContextHolder { ...@@ -61,6 +62,8 @@ public class LoginContextHolder {
61 @Builder.Default 62 @Builder.Default
62 private String openId = ""; 63 private String openId = "";
63 64
65 + private LoginSourceEnum loginSource;
66 +
64 } 67 }
65 68
66 } 69 }
......
...@@ -5,17 +5,17 @@ import com.infoloop.tianting.model.dto.CategoryDbDTO.CategoryDto; ...@@ -5,17 +5,17 @@ import com.infoloop.tianting.model.dto.CategoryDbDTO.CategoryDto;
5 import com.infoloop.tianting.service.CategoriesService; 5 import com.infoloop.tianting.service.CategoriesService;
6 import io.swagger.annotations.Api; 6 import io.swagger.annotations.Api;
7 import io.swagger.annotations.ApiOperation; 7 import io.swagger.annotations.ApiOperation;
8 -import java.util.List;
9 import lombok.RequiredArgsConstructor; 8 import lombok.RequiredArgsConstructor;
10 import lombok.extern.slf4j.Slf4j; 9 import lombok.extern.slf4j.Slf4j;
11 import org.springframework.beans.factory.annotation.Autowired; 10 import org.springframework.beans.factory.annotation.Autowired;
12 import org.springframework.http.HttpStatus; 11 import org.springframework.http.HttpStatus;
13 import org.springframework.validation.annotation.Validated; 12 import org.springframework.validation.annotation.Validated;
14 import org.springframework.web.bind.annotation.GetMapping; 13 import org.springframework.web.bind.annotation.GetMapping;
15 -import org.springframework.web.bind.annotation.PathVariable;
16 import org.springframework.web.bind.annotation.ResponseStatus; 14 import org.springframework.web.bind.annotation.ResponseStatus;
17 import org.springframework.web.bind.annotation.RestController; 15 import org.springframework.web.bind.annotation.RestController;
18 16
17 +import java.util.List;
18 +
19 @Api(tags = "Category") 19 @Api(tags = "Category")
20 @ApiSupport(order = -1) 20 @ApiSupport(order = -1)
21 @Slf4j 21 @Slf4j
...@@ -26,7 +26,7 @@ public class CategoryController { ...@@ -26,7 +26,7 @@ public class CategoryController {
26 26
27 private final CategoriesService categoriesService; 27 private final CategoriesService categoriesService;
28 28
29 - @ApiOperation(value = "根据enterpriseId获取CategoriesAll") 29 + @ApiOperation(value = "获取企业所有品类信息")
30 @GetMapping("/enterprise/categories") 30 @GetMapping("/enterprise/categories")
31 @ResponseStatus(HttpStatus.OK) 31 @ResponseStatus(HttpStatus.OK)
32 public List<CategoryDto> queryCategoriesAll() { 32 public List<CategoryDto> queryCategoriesAll() {
......
...@@ -14,13 +14,15 @@ import org.springframework.http.HttpStatus; ...@@ -14,13 +14,15 @@ import org.springframework.http.HttpStatus;
14 import org.springframework.validation.annotation.Validated; 14 import org.springframework.validation.annotation.Validated;
15 import org.springframework.web.bind.annotation.GetMapping; 15 import org.springframework.web.bind.annotation.GetMapping;
16 import org.springframework.web.bind.annotation.PathVariable; 16 import org.springframework.web.bind.annotation.PathVariable;
17 +import org.springframework.web.bind.annotation.PostMapping;
17 import org.springframework.web.bind.annotation.RequestParam; 18 import org.springframework.web.bind.annotation.RequestParam;
18 import org.springframework.web.bind.annotation.ResponseStatus; 19 import org.springframework.web.bind.annotation.ResponseStatus;
19 import org.springframework.web.bind.annotation.RestController; 20 import org.springframework.web.bind.annotation.RestController;
20 21
22 +import java.io.IOException;
21 import java.util.List; 23 import java.util.List;
22 24
23 -@Api(tags = "ClientCustomer") 25 +@Api(tags = "客户")
24 @ApiSupport(order = -1) 26 @ApiSupport(order = -1)
25 @Slf4j 27 @Slf4j
26 @Validated 28 @Validated
...@@ -28,57 +30,63 @@ import java.util.List; ...@@ -28,57 +30,63 @@ import java.util.List;
28 @RequiredArgsConstructor(onConstructor = @__(@Autowired)) 30 @RequiredArgsConstructor(onConstructor = @__(@Autowired))
29 public class ClientCustomerController { 31 public class ClientCustomerController {
30 32
31 - private final ClientCustomerService clientCustomerService; 33 + private final ClientCustomerService clientCustomerService;
32 34
33 - @ApiOperation(value = "根据hisCustomerId获取ClientCustomer") 35 + @ApiOperation(value = "根据hisCustomerId获取ClientCustomer")
34 - @GetMapping("/customers/his/{hisCustomerId}") 36 + @GetMapping("/customers/his/{hisCustomerId}")
35 - @ResponseStatus(HttpStatus.OK) 37 + @ResponseStatus(HttpStatus.OK)
36 - public ClientCustomerDto getClientCustomerByHISCustomerId(@PathVariable String hisCustomerId) { 38 + public ClientCustomerDto getClientCustomerByHISCustomerId(@PathVariable String hisCustomerId) {
37 - return clientCustomerService.getClientCustomerByHISCustomerId(hisCustomerId); 39 + return clientCustomerService.getClientCustomerByHISCustomerId(hisCustomerId);
38 - } 40 + }
39 41
40 - @ApiOperation(value = "根据hisCustomerNo获取ClientCustomer") 42 + @ApiOperation(value = "根据hisCustomerNo获取ClientCustomer")
41 - @GetMapping("/his/customer/{hisCustomerNo}") 43 + @GetMapping("/his/customer/{hisCustomerNo}")
42 - @ResponseStatus(HttpStatus.OK) 44 + @ResponseStatus(HttpStatus.OK)
43 - public ClientCustomerDto getClientCustomerByHISCustomerNo(@PathVariable String hisCustomerNo) { 45 + public ClientCustomerDto getClientCustomerByHISCustomerNo(@PathVariable String hisCustomerNo) {
44 - return clientCustomerService.getClientCustomerByHISCustomerNo(hisCustomerNo); 46 + return clientCustomerService.getClientCustomerByHISCustomerNo(hisCustomerNo);
45 - } 47 + }
46 48
47 - @ApiOperation(value = "根据customerId获取ClientCustomer") 49 + @ApiOperation(value = "根据customerId获取ClientCustomer")
48 - @GetMapping("/customers/{customerId}") 50 + @GetMapping("/customers/{customerId}")
49 - @ResponseStatus(HttpStatus.OK) 51 + @ResponseStatus(HttpStatus.OK)
50 - public ClientCustomerDto getClientCustomerByCustomerId(@PathVariable Integer customerId) { 52 + public ClientCustomerDto getClientCustomerByCustomerId(@PathVariable Integer customerId) {
51 - return clientCustomerService.getClientCustomerByCustomerId(customerId); 53 + return clientCustomerService.getClientCustomerByCustomerId(customerId);
52 - } 54 + }
53 55
54 - @ApiOperation(value = "根据phone获取ClientCustomer") 56 + @ApiOperation(value = "根据phone获取ClientCustomer")
55 - @GetMapping("/customers/phone/{phone}") 57 + @GetMapping("/customers/phone/{phone}")
56 - @ResponseStatus(HttpStatus.OK) 58 + @ResponseStatus(HttpStatus.OK)
57 - public ClientCustomerDto getClientCustomerByPhone(@PathVariable String phone) { 59 + public ClientCustomerDto getClientCustomerByPhone(@PathVariable String phone) {
58 - return clientCustomerService.getClientCustomerByPhone(phone); 60 + return clientCustomerService.getClientCustomerByPhone(phone);
59 - } 61 + }
60 62
61 - @ApiOperation(value = "根据customerId获取住院记录") 63 + @ApiOperation(value = "根据customerId获取住院记录")
62 - @GetMapping("/enterprise/{enterpriseId}/hospitalRecords/customers/{customerId}") 64 + @GetMapping("/enterprise/{enterpriseId}/hospitalRecords/customers/{customerId}")
63 - @ResponseStatus(HttpStatus.OK) 65 + @ResponseStatus(HttpStatus.OK)
64 - public List<HospitalRecordDto> getHospitalRecords(@PathVariable Integer enterpriseId, 66 + public List<HospitalRecordDto> getHospitalRecords(@PathVariable Integer enterpriseId,
65 - @PathVariable Integer customerId) { 67 + @PathVariable Integer customerId) {
66 - return clientCustomerService.getClientCustomerHospitalRecordsByCustomerId( 68 + return clientCustomerService.getClientCustomerHospitalRecordsByCustomerId(enterpriseId, customerId);
67 - enterpriseId, customerId); 69 + }
68 - }
69 70
70 - @ApiOperation(value = "获取今日在住") 71 + @ApiOperation(value = "获取今日在住")
71 - @GetMapping("/clientCustomers/today/statistic") 72 + @GetMapping("/clientCustomers/today/statistic")
72 - @ResponseStatus(HttpStatus.OK) 73 + @ResponseStatus(HttpStatus.OK)
73 - public TodayOrderDto getClientCustomerTodayOrderStatistic(@RequestParam String customerToken) { 74 + public TodayOrderDto getClientCustomerTodayOrderStatistic(@RequestParam String customerToken) {
74 - return clientCustomerService.getTodayOrderStatistic(customerToken); 75 + return clientCustomerService.getTodayOrderStatistic(customerToken);
75 - } 76 + }
76 77
77 - @ApiOperation(value = "获取his今日在住") 78 + @ApiOperation(value = "获取his今日在住")
78 - @GetMapping("/hisClientCustomers/today/statistic") 79 + @GetMapping("/hisClientCustomers/today/statistic")
79 - @ResponseStatus(HttpStatus.OK) 80 + @ResponseStatus(HttpStatus.OK)
80 - public TodayOrderDto getHisClientCustomerTodayOrderStatistic(@RequestParam String customerToken) { 81 + public TodayOrderDto getHisClientCustomerTodayOrderStatistic(@RequestParam String customerToken) {
81 - return clientCustomerService.getTodayOrderStatisticForHis(customerToken); 82 + return clientCustomerService.getTodayOrderStatisticForHis(customerToken);
82 - } 83 + }
84 +
85 + @ApiOperation(value = "同步his客户信息")
86 + @PostMapping("/hisclientcustomers/synchronization")
87 + @ResponseStatus(HttpStatus.OK)
88 + public void synchronizationHisClientCustomer() throws IOException {
89 + clientCustomerService.synchronizationHisClientCustomer();
90 + }
83 91
84 } 92 }
......
...@@ -26,13 +26,13 @@ import javax.validation.Valid; ...@@ -26,13 +26,13 @@ import javax.validation.Valid;
26 @RestController 26 @RestController
27 @RequiredArgsConstructor(onConstructor = @__(@Autowired)) 27 @RequiredArgsConstructor(onConstructor = @__(@Autowired))
28 public class ClientOrderController { 28 public class ClientOrderController {
29 - private final OrderService orderService; 29 + private final OrderService orderService;
30 30
31 - @ApiOperation(value = "院区端分页获取用户订单") 31 + @ApiOperation(value = "院区端订单")
32 - @PostMapping("/client/orders/pagination") 32 + @PostMapping("/client/orders/pagination")
33 - @ResponseStatus(HttpStatus.OK) 33 + @ResponseStatus(HttpStatus.OK)
34 - public OrderPageResult<OrderDto> getOrderByByPagination(@Valid@RequestBody OrderDbDTO.QueryOrderByPaginationDto queryOrderDto) { 34 + public OrderPageResult<OrderDto> getOrderByByPagination(@Valid @RequestBody OrderDbDTO.QueryOrderByPaginationDto queryOrderDto) {
35 - return orderService.getOrdersByPagination(queryOrderDto); 35 + return orderService.getOrdersByPagination(queryOrderDto);
36 - } 36 + }
37 37
38 } 38 }
......
...@@ -43,16 +43,14 @@ public class InventoryController { ...@@ -43,16 +43,14 @@ public class InventoryController {
43 @ApiOperation(value = "根据ClientId获取Stalls") 43 @ApiOperation(value = "根据ClientId获取Stalls")
44 @GetMapping("/enterprises/{enterpriseId}/clients/{clientId}/stalls") 44 @GetMapping("/enterprises/{enterpriseId}/clients/{clientId}/stalls")
45 @ResponseStatus(HttpStatus.OK) 45 @ResponseStatus(HttpStatus.OK)
46 - public List<ClientDto> getStallsByClientId( 46 + public List<ClientDto> getStallsByClientId(@PathVariable Integer enterpriseId, @PathVariable Integer clientId) {
47 - @PathVariable Integer enterpriseId, @PathVariable Integer clientId) {
48 return inventoryService.getStallsByClientId(enterpriseId, clientId); 47 return inventoryService.getStallsByClientId(enterpriseId, clientId);
49 } 48 }
50 49
51 @ApiOperation(value = "获取桌号") 50 @ApiOperation(value = "获取桌号")
52 @PostMapping("/tableCodes") 51 @PostMapping("/tableCodes")
53 @ResponseStatus(HttpStatus.OK) 52 @ResponseStatus(HttpStatus.OK)
54 - public List<ClientTableCodeDto> getTableCodes(@Valid @RequestBody 53 + public List<ClientTableCodeDto> getTableCodes(@Valid @RequestBody TableCodeQueryConditionDto tableCodeQueryConditionDto) {
55 - TableCodeQueryConditionDto tableCodeQueryConditionDto) {
56 return inventoryService.queryClientTableCodesByCondition(tableCodeQueryConditionDto); 54 return inventoryService.queryClientTableCodesByCondition(tableCodeQueryConditionDto);
57 } 55 }
58 } 56 }
......
1 package com.infoloop.tianting.controller; 1 package com.infoloop.tianting.controller;
2 2
3 import com.github.xiaoymin.knife4j.annotations.ApiSupport; 3 import com.github.xiaoymin.knife4j.annotations.ApiSupport;
4 -import com.infoloop.tianting.clientcustomerservice.BatchCreateClientCustomerLabelRefsRpcRequest;
5 import com.infoloop.tianting.model.dto.ClientLabelDTO; 4 import com.infoloop.tianting.model.dto.ClientLabelDTO;
6 import com.infoloop.tianting.model.dto.ClientLabelDTO.BatchCreateCustomerLabelRefResponseDto; 5 import com.infoloop.tianting.model.dto.ClientLabelDTO.BatchCreateCustomerLabelRefResponseDto;
7 -import com.infoloop.tianting.model.dto.ClientLabelDTO.BatchDeleteCustomerLabelRefRequestDto;
8 import com.infoloop.tianting.model.dto.ClientLabelDTO.BatchDeleteCustomerLabelRefResponseDto; 6 import com.infoloop.tianting.model.dto.ClientLabelDTO.BatchDeleteCustomerLabelRefResponseDto;
9 import com.infoloop.tianting.model.dto.ClientLabelDTO.CustomerLabelRefDetailDto; 7 import com.infoloop.tianting.model.dto.ClientLabelDTO.CustomerLabelRefDetailDto;
10 import com.infoloop.tianting.model.dto.ClientLabelDTO.HisAllergy; 8 import com.infoloop.tianting.model.dto.ClientLabelDTO.HisAllergy;
11 import com.infoloop.tianting.model.dto.ClientLabelDTO.HisMedicalAdviceDto; 9 import com.infoloop.tianting.model.dto.ClientLabelDTO.HisMedicalAdviceDto;
12 import com.infoloop.tianting.model.dto.ClientLabelDTO.LabelDto; 10 import com.infoloop.tianting.model.dto.ClientLabelDTO.LabelDto;
13 -import com.infoloop.tianting.model.dto.MealDbDTO;
14 -import com.infoloop.tianting.model.dto.MealDbDTO.MealDto;
15 import com.infoloop.tianting.service.ClientCustomerService; 11 import com.infoloop.tianting.service.ClientCustomerService;
16 import com.infoloop.tianting.service.DeliveryRuleService; 12 import com.infoloop.tianting.service.DeliveryRuleService;
17 import com.infoloop.tianting.service.MeiZhongYiHeService; 13 import com.infoloop.tianting.service.MeiZhongYiHeService;
18 import io.swagger.annotations.Api; 14 import io.swagger.annotations.Api;
19 import io.swagger.annotations.ApiOperation; 15 import io.swagger.annotations.ApiOperation;
20 -import java.util.List;
21 -import javax.validation.Valid;
22 import lombok.RequiredArgsConstructor; 16 import lombok.RequiredArgsConstructor;
23 import lombok.extern.slf4j.Slf4j; 17 import lombok.extern.slf4j.Slf4j;
24 import org.springframework.beans.factory.annotation.Autowired; 18 import org.springframework.beans.factory.annotation.Autowired;
...@@ -32,6 +26,9 @@ import org.springframework.web.bind.annotation.RequestBody; ...@@ -32,6 +26,9 @@ import org.springframework.web.bind.annotation.RequestBody;
32 import org.springframework.web.bind.annotation.ResponseStatus; 26 import org.springframework.web.bind.annotation.ResponseStatus;
33 import org.springframework.web.bind.annotation.RestController; 27 import org.springframework.web.bind.annotation.RestController;
34 28
29 +import javax.validation.Valid;
30 +import java.util.List;
31 +
35 @Api(tags = "标签") 32 @Api(tags = "标签")
36 @ApiSupport(order = -1) 33 @ApiSupport(order = -1)
37 @Slf4j 34 @Slf4j
...@@ -39,53 +36,50 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -39,53 +36,50 @@ import org.springframework.web.bind.annotation.RestController;
39 @RestController 36 @RestController
40 @RequiredArgsConstructor(onConstructor = @__(@Autowired)) 37 @RequiredArgsConstructor(onConstructor = @__(@Autowired))
41 public class LabelController { 38 public class LabelController {
42 - private final DeliveryRuleService deliveryRuleService;
43 - private final ClientCustomerService clientCustomerService;
44 - private final MeiZhongYiHeService meiZhongYiHeService;
45 39
46 - @ApiOperation(value = "按类型获取标签") 40 + private final DeliveryRuleService deliveryRuleService;
47 - @PostMapping("/labels") 41 + private final ClientCustomerService clientCustomerService;
48 - @ResponseStatus(HttpStatus.OK) 42 + private final MeiZhongYiHeService meiZhongYiHeService;
49 - public List<LabelDto> getMiniProgramLabels(@Valid @RequestBody ClientLabelDTO.QueryLabelsDto queryLabelsDto) { 43 +
50 - return deliveryRuleService.getLabelsByTypes(queryLabelsDto); 44 + @ApiOperation(value = "按类型获取标签")
51 - } 45 + @PostMapping("/labels")
46 + @ResponseStatus(HttpStatus.OK)
47 + public List<LabelDto> getMiniProgramLabels(@Valid @RequestBody ClientLabelDTO.QueryLabelsDto queryLabelsDto) {
48 + return deliveryRuleService.getLabelsByTypes(queryLabelsDto);
49 + }
52 50
53 - @ApiOperation(value = "批量创建用户绑定标签") 51 + @ApiOperation(value = "批量创建用户绑定标签")
54 - @PostMapping("/labels/batch") 52 + @PostMapping("/labels/batch")
55 - @ResponseStatus(HttpStatus.OK) 53 + @ResponseStatus(HttpStatus.OK)
56 - public BatchCreateCustomerLabelRefResponseDto batchCreateCustomerLabelRef( 54 + public BatchCreateCustomerLabelRefResponseDto batchCreateCustomerLabelRef(@Valid @RequestBody ClientLabelDTO.BatchCreateCustomerLabelRefDto batchCreateCustomerLabelRefDto) {
57 - @Valid @RequestBody ClientLabelDTO.BatchCreateCustomerLabelRefDto 55 + return clientCustomerService.batchCreateClientCustomerLabelRefs(batchCreateCustomerLabelRefDto);
58 - batchCreateCustomerLabelRefDto) { 56 + }
59 - return clientCustomerService.batchCreateClientCustomerLabelRefs(batchCreateCustomerLabelRefDto);
60 - }
61 57
62 - @ApiOperation(value = "获取用户已绑定的标签") 58 + @ApiOperation(value = "获取用户已绑定的标签")
63 - @PostMapping("/enterprises/{enterpriseId}/labels/customers/{customerId}") 59 + @PostMapping("/enterprises/{enterpriseId}/labels/customers/{customerId}")
64 - @ResponseStatus(HttpStatus.OK) 60 + @ResponseStatus(HttpStatus.OK)
65 - public List<CustomerLabelRefDetailDto> getCustomerLabelsByCustomerId( 61 + public List<CustomerLabelRefDetailDto> getCustomerLabelsByCustomerId(@PathVariable Integer enterpriseId, @PathVariable Integer customerId) {
66 - @PathVariable Integer enterpriseId, @PathVariable Integer customerId) { 62 + return clientCustomerService.getCustomerLabelsByCustomerId(enterpriseId, customerId);
67 - return clientCustomerService.getCustomerLabelsByCustomerId(enterpriseId, customerId); 63 + }
68 - }
69 64
70 - @ApiOperation(value = "批量删除用户绑定的标签") 65 + @ApiOperation(value = "批量删除用户绑定的标签")
71 - @DeleteMapping("/customer/label/refs") 66 + @DeleteMapping("/customer/label/refs")
72 - @ResponseStatus(HttpStatus.OK) 67 + @ResponseStatus(HttpStatus.OK)
73 - public BatchDeleteCustomerLabelRefResponseDto getCustomerLabelsByCustomerId( 68 + public BatchDeleteCustomerLabelRefResponseDto getCustomerLabelsByCustomerId(@Valid @RequestBody ClientLabelDTO.BatchDeleteCustomerLabelRefRequestDto request) {
74 - @Valid@RequestBody ClientLabelDTO.BatchDeleteCustomerLabelRefRequestDto request) { 69 + return clientCustomerService.deleteClientCustomerLabelRefsByIds(request);
75 - return clientCustomerService.deleteClientCustomerLabelRefsByIds(request); 70 + }
76 - }
77 71
78 - @ApiOperation(value = "根据hisCustomerId查询用户绑定过敏源标签") 72 + @ApiOperation(value = "根据hisCustomerId查询用户绑定过敏源标签")
79 - @GetMapping("/allergy/hisCustomer/{hisCustomerId}") 73 + @GetMapping("/allergy/hisCustomer/{hisCustomerId}")
80 - @ResponseStatus(HttpStatus.OK) 74 + @ResponseStatus(HttpStatus.OK)
81 - public List<HisAllergy> getHisCustomerAllergiesByCustomerId(@PathVariable String hisCustomerId) { 75 + public List<HisAllergy> getHisCustomerAllergiesByCustomerId(@PathVariable String hisCustomerId) {
82 - return meiZhongYiHeService.getHisCustomerAllergiesByCustomerId(hisCustomerId); 76 + return meiZhongYiHeService.getHisCustomerAllergiesByCustomerId(hisCustomerId);
83 - } 77 + }
84 78
85 - @ApiOperation(value = "根据contractNo查询His用户医嘱") 79 + @ApiOperation(value = "根据contractNo查询His用户医嘱")
86 - @GetMapping("/medicalAdvice/hisCustomer/{contractNo}") 80 + @GetMapping("/medicalAdvice/hisCustomer/{contractNo}")
87 - @ResponseStatus(HttpStatus.OK) 81 + @ResponseStatus(HttpStatus.OK)
88 - public List<HisMedicalAdviceDto> getHisCustomerMedicalAdviceByContractNo(@PathVariable String contractNo) { 82 + public List<HisMedicalAdviceDto> getHisCustomerMedicalAdviceByContractNo(@PathVariable String contractNo) {
89 - return meiZhongYiHeService.getHisCustomerMedicalAdvicesByContractNo(contractNo); 83 + return meiZhongYiHeService.getHisCustomerMedicalAdvicesByContractNo(contractNo);
90 - } 84 + }
91 } 85 }
......
...@@ -27,13 +27,13 @@ import java.security.NoSuchAlgorithmException; ...@@ -27,13 +27,13 @@ import java.security.NoSuchAlgorithmException;
27 @RestController 27 @RestController
28 @RequiredArgsConstructor(onConstructor = @__(@Autowired)) 28 @RequiredArgsConstructor(onConstructor = @__(@Autowired))
29 public class LoginController { 29 public class LoginController {
30 - private final LoginService loginService; 30 + private final LoginService loginService;
31 31
32 - @SaIgnore 32 + @SaIgnore
33 - @ApiOperation(value = "登陆") 33 + @ApiOperation(value = "登陆")
34 - @PostMapping("/login") 34 + @PostMapping("/login")
35 - @ResponseStatus(HttpStatus.OK) 35 + @ResponseStatus(HttpStatus.OK)
36 - public SaTokenInfo login(@Valid @RequestBody PermissionDTO.LoginDto loginDto) throws NoSuchAlgorithmException { 36 + public SaTokenInfo login(@Valid @RequestBody PermissionDTO.LoginDto loginDto) throws NoSuchAlgorithmException {
37 - return loginService.login(loginDto); 37 + return loginService.login(loginDto);
38 - } 38 + }
39 } 39 }
......
...@@ -6,20 +6,20 @@ import com.infoloop.tianting.model.dto.MealDbDTO.MealIdsDto; ...@@ -6,20 +6,20 @@ import com.infoloop.tianting.model.dto.MealDbDTO.MealIdsDto;
6 import com.infoloop.tianting.service.MealService; 6 import com.infoloop.tianting.service.MealService;
7 import io.swagger.annotations.Api; 7 import io.swagger.annotations.Api;
8 import io.swagger.annotations.ApiOperation; 8 import io.swagger.annotations.ApiOperation;
9 -import java.util.List;
10 -import javax.validation.Valid;
11 import lombok.RequiredArgsConstructor; 9 import lombok.RequiredArgsConstructor;
12 import lombok.extern.slf4j.Slf4j; 10 import lombok.extern.slf4j.Slf4j;
13 import org.springframework.beans.factory.annotation.Autowired; 11 import org.springframework.beans.factory.annotation.Autowired;
14 import org.springframework.http.HttpStatus; 12 import org.springframework.http.HttpStatus;
15 import org.springframework.validation.annotation.Validated; 13 import org.springframework.validation.annotation.Validated;
16 import org.springframework.web.bind.annotation.GetMapping; 14 import org.springframework.web.bind.annotation.GetMapping;
17 -import org.springframework.web.bind.annotation.PathVariable;
18 import org.springframework.web.bind.annotation.PostMapping; 15 import org.springframework.web.bind.annotation.PostMapping;
19 import org.springframework.web.bind.annotation.RequestBody; 16 import org.springframework.web.bind.annotation.RequestBody;
20 import org.springframework.web.bind.annotation.ResponseStatus; 17 import org.springframework.web.bind.annotation.ResponseStatus;
21 import org.springframework.web.bind.annotation.RestController; 18 import org.springframework.web.bind.annotation.RestController;
22 19
20 +import javax.validation.Valid;
21 +import java.util.List;
22 +
23 @Api(tags = "餐别") 23 @Api(tags = "餐别")
24 @ApiSupport(order = -1) 24 @ApiSupport(order = -1)
25 @Slf4j 25 @Slf4j
...@@ -27,20 +27,20 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -27,20 +27,20 @@ import org.springframework.web.bind.annotation.RestController;
27 @RestController 27 @RestController
28 @RequiredArgsConstructor(onConstructor = @__(@Autowired)) 28 @RequiredArgsConstructor(onConstructor = @__(@Autowired))
29 public class MealController { 29 public class MealController {
30 - private final MealService mealService; 30 + private final MealService mealService;
31 31
32 - @ApiOperation(value = "根据ids获取餐别") 32 + @ApiOperation(value = "根据ids获取餐别")
33 - @PostMapping("/meals") 33 + @PostMapping("/meals")
34 - @ResponseStatus(HttpStatus.OK) 34 + @ResponseStatus(HttpStatus.OK)
35 - public List<MealDto> getMealsByIds(@Valid @RequestBody MealIdsDto mealIdsDto) { 35 + public List<MealDto> getMealsByIds(@Valid @RequestBody MealIdsDto mealIdsDto) {
36 - return mealService.getMealsByIds(mealIdsDto.getEnterpriseId(), mealIdsDto.getIds()); 36 + return mealService.getMealsByIds(mealIdsDto.getEnterpriseId(), mealIdsDto.getIds());
37 - } 37 + }
38 38
39 - @ApiOperation(value = "获取enterprise所有餐别") 39 + @ApiOperation(value = "获取enterprise所有餐别")
40 - @GetMapping("/enterprises/meals") 40 + @GetMapping("/enterprises/meals")
41 - @ResponseStatus(HttpStatus.OK) 41 + @ResponseStatus(HttpStatus.OK)
42 - public List<MealDto> getAllMeals() { 42 + public List<MealDto> getAllMeals() {
43 - return mealService.getAllMeals(); 43 + return mealService.getAllMeals();
44 - } 44 + }
45 45
46 } 46 }
......
...@@ -36,52 +36,42 @@ public class MenuController { ...@@ -36,52 +36,42 @@ public class MenuController {
36 @ApiOperation(value = "根据stallId获取小程序已发布餐单") 36 @ApiOperation(value = "根据stallId获取小程序已发布餐单")
37 @GetMapping("/enterprises/{enterpriseId}/stalls/{stallId}/menus") 37 @GetMapping("/enterprises/{enterpriseId}/stalls/{stallId}/menus")
38 @ResponseStatus(HttpStatus.OK) 38 @ResponseStatus(HttpStatus.OK)
39 - public List<MenuDto> queryMiniProgramPublishedMenusByStallIds( 39 + public List<MenuDto> queryMiniProgramPublishedMenusByStallIds(@PathVariable Integer enterpriseId, @PathVariable Integer stallId) {
40 - @PathVariable Integer enterpriseId, @PathVariable Integer stallId) {
41 return menuService.queryMiniProgramPublishedMenusByStallId(enterpriseId, stallId); 40 return menuService.queryMiniProgramPublishedMenusByStallId(enterpriseId, stallId);
42 } 41 }
43 42
44 @ApiOperation(value = "根据stallId获取所有已发布餐单") 43 @ApiOperation(value = "根据stallId获取所有已发布餐单")
45 @GetMapping("/enterprises/{enterpriseId}/stalls/{stallId}/all/menus") 44 @GetMapping("/enterprises/{enterpriseId}/stalls/{stallId}/all/menus")
46 @ResponseStatus(HttpStatus.OK) 45 @ResponseStatus(HttpStatus.OK)
47 - public List<MenuDto> queryPublishedMenusByStallIds( 46 + public List<MenuDto> queryPublishedMenusByStallIds(@PathVariable Integer enterpriseId, @PathVariable Integer stallId) {
48 - @PathVariable Integer enterpriseId, @PathVariable Integer stallId) {
49 return menuService.queryPublishedMenusByStallId(enterpriseId, stallId); 47 return menuService.queryPublishedMenusByStallId(enterpriseId, stallId);
50 } 48 }
51 49
52 @ApiOperation(value = "根据MenuId获取餐单") 50 @ApiOperation(value = "根据MenuId获取餐单")
53 @GetMapping("/enterprises/{enterpriseId}/menus/{menuId}") 51 @GetMapping("/enterprises/{enterpriseId}/menus/{menuId}")
54 @ResponseStatus(HttpStatus.OK) 52 @ResponseStatus(HttpStatus.OK)
55 - public MenuDto getMenuById( 53 + public MenuDto getMenuById(@PathVariable Integer enterpriseId, @PathVariable Integer menuId) {
56 - @PathVariable Integer enterpriseId, @PathVariable Integer menuId
57 - ) {
58 return menuService.getMenuById(enterpriseId, menuId); 54 return menuService.getMenuById(enterpriseId, menuId);
59 } 55 }
60 56
61 @ApiOperation(value = "根据MenuId获取餐单详情") 57 @ApiOperation(value = "根据MenuId获取餐单详情")
62 @GetMapping("/enterprises/{enterpriseId}/menusDetails/{menuId}") 58 @GetMapping("/enterprises/{enterpriseId}/menusDetails/{menuId}")
63 @ResponseStatus(HttpStatus.OK) 59 @ResponseStatus(HttpStatus.OK)
64 - public List<MenuDetailDto> queryMenuDetailsByMenuIds( 60 + public List<MenuDetailDto> queryMenuDetailsByMenuIds(@PathVariable Integer enterpriseId, @PathVariable Integer menuId) {
65 - @PathVariable Integer enterpriseId, @PathVariable Integer menuId
66 - ) {
67 return menuService.queryMenuDetailsByMenuId(enterpriseId, menuId); 61 return menuService.queryMenuDetailsByMenuId(enterpriseId, menuId);
68 } 62 }
69 63
70 @ApiOperation(value = "获取餐单绑定") 64 @ApiOperation(value = "获取餐单绑定")
71 @GetMapping("/enterprises/{enterpriseId}/menuRefs/{customerId}") 65 @GetMapping("/enterprises/{enterpriseId}/menuRefs/{customerId}")
72 @ResponseStatus(HttpStatus.OK) 66 @ResponseStatus(HttpStatus.OK)
73 - public List<MenuRefDto> queryMenuRefsByCustomerId( 67 + public List<MenuRefDto> queryMenuRefsByCustomerId(@PathVariable Integer enterpriseId, @PathVariable Integer customerId) {
74 - @PathVariable Integer enterpriseId, @PathVariable Integer customerId
75 - ) {
76 return menuService.getClientCustomerMenuRefsByCustomerId(enterpriseId, customerId); 68 return menuService.getClientCustomerMenuRefsByCustomerId(enterpriseId, customerId);
77 } 69 }
78 70
79 @ApiOperation(value = "批量创建餐单绑定") 71 @ApiOperation(value = "批量创建餐单绑定")
80 @PostMapping("/menuRefs/creation") 72 @PostMapping("/menuRefs/creation")
81 @ResponseStatus(HttpStatus.OK) 73 @ResponseStatus(HttpStatus.OK)
82 - public BatchCreateMenuRefsResponseDto batchCreateMenuRefsByCustomerId( 74 + public BatchCreateMenuRefsResponseDto batchCreateMenuRefsByCustomerId(@Valid @RequestBody BatchCreateMenuRefsDto batchCreateMenuRefsDto) {
83 - @Valid @RequestBody BatchCreateMenuRefsDto batchCreateMenuRefsDto
84 - ) {
85 return menuService.batchCreateMenuRefs(batchCreateMenuRefsDto); 75 return menuService.batchCreateMenuRefs(batchCreateMenuRefsDto);
86 } 76 }
87 77
......
...@@ -67,7 +67,6 @@ public class LoginInterceptor extends HandlerInterceptorAdapter { ...@@ -67,7 +67,6 @@ public class LoginInterceptor extends HandlerInterceptorAdapter {
67 StpUtil.checkLogin(); 67 StpUtil.checkLogin();
68 final var enterpriseId = Convert.toInt(StpUtil.getExtra(CommonConstants.ENTERPRISE_ID)); 68 final var enterpriseId = Convert.toInt(StpUtil.getExtra(CommonConstants.ENTERPRISE_ID));
69 final var loginSource = Convert.toInt(StpUtil.getExtra(CommonConstants.LOGIN_SOURCE)); 69 final var loginSource = Convert.toInt(StpUtil.getExtra(CommonConstants.LOGIN_SOURCE));
70 - log.info("Login success, enterpriseId: {}, loginSource: {}", enterpriseId, loginSource);
71 if (loginSource.equals(LoginSourceEnum.CUSTOMER.getValue())) { 70 if (loginSource.equals(LoginSourceEnum.CUSTOMER.getValue())) {
72 final var openId = Convert.toStr(StpUtil.getExtra(CommonConstants.OPEN_ID)); 71 final var openId = Convert.toStr(StpUtil.getExtra(CommonConstants.OPEN_ID));
73 final var loginId = StpUtil.getLoginIdAsInt(); 72 final var loginId = StpUtil.getLoginIdAsInt();
...@@ -77,8 +76,7 @@ public class LoginInterceptor extends HandlerInterceptorAdapter { ...@@ -77,8 +76,7 @@ public class LoginInterceptor extends HandlerInterceptorAdapter {
77 ResponseUtil.write(response, ResponseResult.failed(ErrorCodeEnum.VALIDATE_FAILED)); 76 ResponseUtil.write(response, ResponseResult.failed(ErrorCodeEnum.VALIDATE_FAILED));
78 return false; 77 return false;
79 } 78 }
80 - log.info("Customer login success, customerId: {}, enterpriseId: {}, openId:{}", loginId, enterpriseId, openId); 79 + builder.id(loginId).enterpriseId(enterpriseId).name(customer.getResponse().getName()).openId(openId).loginSource(LoginSourceEnum.CUSTOMER);
81 - builder.id(loginId).enterpriseId(enterpriseId).name(customer.getResponse().getName()).openId(openId);
82 return true; 80 return true;
83 } else if (loginSource.equals(LoginSourceEnum.OPERATOR.getValue())){ 81 } else if (loginSource.equals(LoginSourceEnum.OPERATOR.getValue())){
84 final var loginId = StpUtil.getLoginIdAsInt(); 82 final var loginId = StpUtil.getLoginIdAsInt();
...@@ -88,20 +86,19 @@ public class LoginInterceptor extends HandlerInterceptorAdapter { ...@@ -88,20 +86,19 @@ public class LoginInterceptor extends HandlerInterceptorAdapter {
88 ResponseUtil.write(response, ResponseResult.failed(ErrorCodeEnum.VALIDATE_FAILED)); 86 ResponseUtil.write(response, ResponseResult.failed(ErrorCodeEnum.VALIDATE_FAILED));
89 return false; 87 return false;
90 } 88 }
91 - builder.id(loginId).enterpriseId(enterpriseId).name(opeartor.getName()); 89 + builder.id(loginId).enterpriseId(enterpriseId).name(opeartor.getName()).loginSource(LoginSourceEnum.OPERATOR);
92 return true; 90 return true;
93 -
94 } else if (loginSource.equals(LoginSourceEnum.KDS.getValue())) { 91 } else if (loginSource.equals(LoginSourceEnum.KDS.getValue())) {
95 final var loginId = StpUtil.getLoginIdAsInt(); 92 final var loginId = StpUtil.getLoginIdAsInt();
96 final var operator = wOperatorServiceRpcClient.getWOperatorById(loginId).getResponse(); 93 final var operator = wOperatorServiceRpcClient.getWOperatorById(loginId).getResponse();
97 if (operator.getId() == 0) { 94 if (operator.getId() == 0) {
98 throw ClientEndExceptions.AuthenticationFailure.build(ErrorCodeEnum.UNAUTHORIZED.name()); 95 throw ClientEndExceptions.AuthenticationFailure.build(ErrorCodeEnum.UNAUTHORIZED.name());
99 } 96 }
100 - builder.id(loginId).enterpriseId(enterpriseId).name(operator.getName()); 97 + builder.id(loginId).enterpriseId(enterpriseId).name(operator.getName()).loginSource(LoginSourceEnum.KDS);
101 return true; 98 return true;
102 } else { 99 } else {
103 final var loginId = StpUtil.getLoginIdAsString(); 100 final var loginId = StpUtil.getLoginIdAsString();
104 - builder.openId(loginId).enterpriseId(enterpriseId); 101 + builder.openId(loginId).enterpriseId(enterpriseId).loginSource(LoginSourceEnum.MINI_PROGRAM);
105 return true; 102 return true;
106 } 103 }
107 } 104 }
......
1 package com.infoloop.tianting.intercepter; 1 package com.infoloop.tianting.intercepter;
2 2
3 -import cn.dev33.satoken.stp.StpUtil;
4 -import cn.hutool.core.convert.Convert;
5 import com.infoloop.tianting.constant.CommonConstants; 3 import com.infoloop.tianting.constant.CommonConstants;
6 -import com.infoloop.tianting.enums.LoginSourceEnum;
7 import org.springframework.http.server.ServerHttpRequest; 4 import org.springframework.http.server.ServerHttpRequest;
8 import org.springframework.http.server.ServerHttpResponse; 5 import org.springframework.http.server.ServerHttpResponse;
9 -import org.springframework.util.StringUtils; 6 +import org.springframework.http.server.ServletServerHttpRequest;
10 import org.springframework.web.socket.WebSocketHandler; 7 import org.springframework.web.socket.WebSocketHandler;
11 import org.springframework.web.socket.server.HandshakeInterceptor; 8 import org.springframework.web.socket.server.HandshakeInterceptor;
12 9
...@@ -17,15 +14,15 @@ public class WebSocketHandshakeInterceptor implements HandshakeInterceptor { ...@@ -17,15 +14,15 @@ public class WebSocketHandshakeInterceptor implements HandshakeInterceptor {
17 14
18 @Override 15 @Override
19 public boolean beforeHandshake(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler, Map<String, Object> attributes) { 16 public boolean beforeHandshake(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler, Map<String, Object> attributes) {
20 - final var authorization = request.getHeaders().getFirst(CommonConstants.AUTHORIZATION); 17 + if (request instanceof ServletServerHttpRequest) {
21 - if (StringUtils.isEmpty(authorization)) { 18 + ServletServerHttpRequest servletRequest = (ServletServerHttpRequest) request;
22 - return false; 19 + String userType = servletRequest.getServletRequest().getParameter(CommonConstants.USER_TYPE);
20 + String userId = servletRequest.getServletRequest().getParameter(CommonConstants.USER_ID);
21 + attributes.put(CommonConstants.USER_TYPE, userType);
22 + attributes.put(CommonConstants.USER_ID, userId);
23 + return true;
23 } 24 }
24 - final var loginSource = Convert.toInt(StpUtil.getExtra(CommonConstants.LOGIN_SOURCE)); 25 + return false;
25 - final var loginSourceEnum = LoginSourceEnum.getByValue(loginSource);
26 - attributes.put(CommonConstants.USER_TYPE, loginSourceEnum.getUserType().name());
27 - attributes.put(CommonConstants.USER_ID, StpUtil.getLoginIdAsString());
28 - return true;
29 } 26 }
30 27
31 @Override 28 @Override
......
...@@ -17,6 +17,8 @@ import lombok.NoArgsConstructor; ...@@ -17,6 +17,8 @@ import lombok.NoArgsConstructor;
17 import lombok.ToString; 17 import lombok.ToString;
18 18
19 import javax.validation.Valid; 19 import javax.validation.Valid;
20 +import javax.validation.constraints.NotEmpty;
21 +import javax.validation.constraints.NotNull;
20 import java.time.LocalDateTime; 22 import java.time.LocalDateTime;
21 import java.util.ArrayList; 23 import java.util.ArrayList;
22 import java.util.List; 24 import java.util.List;
...@@ -117,6 +119,14 @@ public class OrderDbDTO { ...@@ -117,6 +119,14 @@ public class OrderDbDTO {
117 private Boolean shouldFilterMenuId = false; 119 private Boolean shouldFilterMenuId = false;
118 @Builder.Default 120 @Builder.Default
119 private Integer menuId = 0; 121 private Integer menuId = 0;
122 + @Builder.Default
123 + private Boolean shouldFilterPayStatus = false;
124 + @Builder.Default
125 + private PayStatusEnum payStatus = PayStatusEnum.UNKNOWN_PAY_STATUS;
126 + @Builder.Default
127 + private Boolean shouldFilterStatues = false;
128 + @Builder.Default
129 + private List<OrderStatusEnum> statues = new ArrayList<>();
120 } 130 }
121 131
122 @Data 132 @Data
...@@ -206,15 +216,19 @@ public class OrderDbDTO { ...@@ -206,15 +216,19 @@ public class OrderDbDTO {
206 216
207 @RequestKeyParam 217 @RequestKeyParam
208 @ApiModelProperty(value = "档口 ID") 218 @ApiModelProperty(value = "档口 ID")
219 + @NotNull(message = "档口 ID不能为空")
209 private Integer stallId; 220 private Integer stallId;
210 221
211 @ApiModelProperty(value = "客户 ID") 222 @ApiModelProperty(value = "客户 ID")
223 + @NotNull(message = "客户 ID不能为空")
212 private Integer customerId; 224 private Integer customerId;
213 225
214 @ApiModelProperty(value = "餐单 id") 226 @ApiModelProperty(value = "餐单 id")
227 + @NotNull(message = "餐单 id不能为空")
215 private Integer menuId; 228 private Integer menuId;
216 229
217 @ApiModelProperty(value = "用餐日期") 230 @ApiModelProperty(value = "用餐日期")
231 + @NotNull(message = "用餐日期不能为空")
218 private LocalDateTime mealTime; 232 private LocalDateTime mealTime;
219 233
220 @ApiModelProperty(value = "桌号") 234 @ApiModelProperty(value = "桌号")
...@@ -224,9 +238,11 @@ public class OrderDbDTO { ...@@ -224,9 +238,11 @@ public class OrderDbDTO {
224 private String remark; 238 private String remark;
225 239
226 @ApiModelProperty(value = "支付方式") 240 @ApiModelProperty(value = "支付方式")
241 + @NotNull(message = "支付方式不能为空")
227 private OnlinePayEnum onlinePay; 242 private OnlinePayEnum onlinePay;
228 243
229 @ApiModelProperty(value = "订单菜品详情列表") 244 @ApiModelProperty(value = "订单菜品详情列表")
245 + @NotEmpty(message = "订单菜品详情列表不能为空")
230 private List<OperatorCreateOrderDetailDto> orderDetailDtos; 246 private List<OperatorCreateOrderDetailDto> orderDetailDtos;
231 } 247 }
232 248
...@@ -240,10 +256,12 @@ public class OrderDbDTO { ...@@ -240,10 +256,12 @@ public class OrderDbDTO {
240 private Integer enterpriseId; 256 private Integer enterpriseId;
241 257
242 @ApiModelProperty(value = "院区 ID") 258 @ApiModelProperty(value = "院区 ID")
259 + @NotNull(message = "院区 ID不能为空")
243 private Integer clientId; 260 private Integer clientId;
244 261
245 @RequestKeyParam 262 @RequestKeyParam
246 @ApiModelProperty(value = "档口 ID") 263 @ApiModelProperty(value = "档口 ID")
264 + @NotNull(message = "档口 ID不能为空")
247 private Integer stallId; 265 private Integer stallId;
248 266
249 @ApiModelProperty(value = "需要创建客户 ID") 267 @ApiModelProperty(value = "需要创建客户 ID")
...@@ -256,6 +274,7 @@ public class OrderDbDTO { ...@@ -256,6 +274,7 @@ public class OrderDbDTO {
256 private Integer status; 274 private Integer status;
257 275
258 @ApiModelProperty(value = "餐单 id") 276 @ApiModelProperty(value = "餐单 id")
277 + @NotNull(message = "餐单 id不能为空")
259 private Integer menuId; 278 private Integer menuId;
260 279
261 @ApiModelProperty(value = "订单商品总数") 280 @ApiModelProperty(value = "订单商品总数")
...@@ -265,6 +284,7 @@ public class OrderDbDTO { ...@@ -265,6 +284,7 @@ public class OrderDbDTO {
265 private Integer payPrice; 284 private Integer payPrice;
266 285
267 @ApiModelProperty(value = "支付方式") 286 @ApiModelProperty(value = "支付方式")
287 + @NotNull(message = "支付方式不能为空")
268 private OnlinePayEnum onlinePay; 288 private OnlinePayEnum onlinePay;
269 289
270 @ApiModelProperty(value = "支付时间") 290 @ApiModelProperty(value = "支付时间")
...@@ -280,6 +300,7 @@ public class OrderDbDTO { ...@@ -280,6 +300,7 @@ public class OrderDbDTO {
280 private String transactionId; 300 private String transactionId;
281 301
282 @ApiModelProperty(value = "用餐日期") 302 @ApiModelProperty(value = "用餐日期")
303 + @NotNull(message = "用餐日期不能为空")
283 private LocalDateTime mealTime; 304 private LocalDateTime mealTime;
284 305
285 @ApiModelProperty(value = "订餐地址") 306 @ApiModelProperty(value = "订餐地址")
...@@ -309,7 +330,6 @@ public class OrderDbDTO { ...@@ -309,7 +330,6 @@ public class OrderDbDTO {
309 @ApiModelProperty(value = "修改人 ID,修改人可能是院区端登陆的用户,也可能是 KDS 端登陆用户") 330 @ApiModelProperty(value = "修改人 ID,修改人可能是院区端登陆的用户,也可能是 KDS 端登陆用户")
310 private Integer updatedBy; 331 private Integer updatedBy;
311 332
312 -
313 @ApiModelProperty(value = "更新来源:小程序点餐=1;院区端=2;kds=3;业务中台 = 4") 333 @ApiModelProperty(value = "更新来源:小程序点餐=1;院区端=2;kds=3;业务中台 = 4")
314 private Integer updateSource; 334 private Integer updateSource;
315 335
...@@ -317,6 +337,7 @@ public class OrderDbDTO { ...@@ -317,6 +337,7 @@ public class OrderDbDTO {
317 private CloseTimeType closeTimeType; 337 private CloseTimeType closeTimeType;
318 338
319 @ApiModelProperty(value = "订单菜品详情列表") 339 @ApiModelProperty(value = "订单菜品详情列表")
340 + @NotEmpty(message = "订单菜品详情列表不能为空")
320 private List<CreateOrderDetailDto> orderDetailDtos; 341 private List<CreateOrderDetailDto> orderDetailDtos;
321 } 342 }
322 343
...@@ -392,6 +413,9 @@ public class OrderDbDTO { ...@@ -392,6 +413,9 @@ public class OrderDbDTO {
392 @ApiModelProperty(value = "房间号") 413 @ApiModelProperty(value = "房间号")
393 private String roomNo; 414 private String roomNo;
394 415
416 + @ApiModelProperty(value = "是否变更房间号")
417 + private boolean adjustRoomNo;
418 +
395 @ApiModelProperty(value = "点餐桌码") 419 @ApiModelProperty(value = "点餐桌码")
396 private String tableCode; 420 private String tableCode;
397 421
......
...@@ -24,7 +24,7 @@ import java.util.stream.Collectors; ...@@ -24,7 +24,7 @@ import java.util.stream.Collectors;
24 public class WebSocketServer extends TextWebSocketHandler { 24 public class WebSocketServer extends TextWebSocketHandler {
25 25
26 private static final ConcurrentHashMap<UserSessionKey, UserSessionData> userSessions = new ConcurrentHashMap<>(); 26 private static final ConcurrentHashMap<UserSessionKey, UserSessionData> userSessions = new ConcurrentHashMap<>();
27 - private static final long INACTIVITY_TIMEOUT = 2 * 60 * 60 * 1000; 27 + private static final long INACTIVITY_TIMEOUT = 60 * 60 * 1000;
28 private static final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); 28 private static final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
29 29
30 static { 30 static {
...@@ -34,6 +34,7 @@ public class WebSocketServer extends TextWebSocketHandler { ...@@ -34,6 +34,7 @@ public class WebSocketServer extends TextWebSocketHandler {
34 private static void cleanInactiveSessions() { 34 private static void cleanInactiveSessions() {
35 final var currentTime = System.currentTimeMillis(); 35 final var currentTime = System.currentTimeMillis();
36 final var iterator = userSessions.entrySet().iterator(); 36 final var iterator = userSessions.entrySet().iterator();
37 + log.info("cleanInactiveSessions; sessions:{}", userSessions.keySet());
37 while (iterator.hasNext()) { 38 while (iterator.hasNext()) {
38 final var entry = iterator.next(); 39 final var entry = iterator.next();
39 final var key = entry.getKey(); 40 final var key = entry.getKey();
...@@ -79,6 +80,14 @@ public class WebSocketServer extends TextWebSocketHandler { ...@@ -79,6 +80,14 @@ public class WebSocketServer extends TextWebSocketHandler {
79 sendMessageToUsers(keys, socketMessage); 80 sendMessageToUsers(keys, socketMessage);
80 } 81 }
81 82
83 + public static <T> void sendMessageByUserTypes(List<UserTypeEnum> userTypes, List<String> authUserIds, SocketMessage<T> socketMessage) throws IOException {
84 + final var keys = userSessions.keySet().stream()
85 + .filter(userSessionData -> userTypes.contains(userSessionData.getUserType()))
86 + .filter(userSessionData -> authUserIds.contains(userSessionData.getUserId()))
87 + .collect(Collectors.toList());
88 + sendMessageToUsers(keys, socketMessage);
89 + }
90 +
82 public static void closeConnection(UserSessionKey key) { 91 public static void closeConnection(UserSessionKey key) {
83 final var userData = userSessions.get(key); 92 final var userData = userSessions.get(key);
84 if (userData != null) { 93 if (userData != null) {
...@@ -108,8 +117,17 @@ public class WebSocketServer extends TextWebSocketHandler { ...@@ -108,8 +117,17 @@ public class WebSocketServer extends TextWebSocketHandler {
108 public void afterConnectionEstablished(WebSocketSession session) { 117 public void afterConnectionEstablished(WebSocketSession session) {
109 final var key = getUserSessionKey(session); 118 final var key = getUserSessionKey(session);
110 if (key != null) { 119 if (key != null) {
120 + final var existingSession = userSessions.remove(key);
121 + if (existingSession != null) {
122 + try {
123 + existingSession.closeSession();
124 + log.info("WebSocket old connect closed,userId : {}, userType : {}", key.getUserId(), key.getUserType());
125 + } catch (IOException e) {
126 + log.error("old WebSocket close failed,userId : {}, userType : {}", key.getUserId(), key.getUserType(), e);
127 + }
128 + }
111 userSessions.put(key, new UserSessionData(session)); 129 userSessions.put(key, new UserSessionData(session));
112 - log.info("WebSocket connect success: userId : {}, userType : {}", key.getUserId(), key.getUserType()); 130 + log.info("WebSocket connect success, userId : {}, userType : {}", key.getUserId(), key.getUserType());
113 } else { 131 } else {
114 log.warn("WebSocket connect failed,unable to get valid user information"); 132 log.warn("WebSocket connect failed,unable to get valid user information");
115 } 133 }
......
...@@ -5,7 +5,8 @@ import lombok.Getter; ...@@ -5,7 +5,8 @@ import lombok.Getter;
5 @Getter 5 @Getter
6 public enum MessageTypeEnum { 6 public enum MessageTypeEnum {
7 7
8 - ORDER("订单类型消息"); 8 + ORDER("订单类型消息"),
9 + CUSTOMER("客户类型消息");;
9 10
10 private final String description; 11 private final String description;
11 12
......
...@@ -5,8 +5,10 @@ import lombok.Getter; ...@@ -5,8 +5,10 @@ import lombok.Getter;
5 @Getter 5 @Getter
6 public enum NoticeTypeEnum { 6 public enum NoticeTypeEnum {
7 ORDER_CREATED("下单成功", MessageTypeEnum.ORDER), 7 ORDER_CREATED("下单成功", MessageTypeEnum.ORDER),
8 - ORDER_PAYMENT_SUCCESS("支付成功", MessageTypeEnum.ORDER); 8 + ORDER_PAYMENT_SUCCESS("支付成功", MessageTypeEnum.ORDER),
9 + CUSTOMER_ALTER_ROOM_NO("客户变更房间号", MessageTypeEnum.CUSTOMER),
9 10
11 + ;
10 private final String description; 12 private final String description;
11 13
12 private final MessageTypeEnum messageType; 14 private final MessageTypeEnum messageType;
......
1 +package com.infoloop.tianting.server.message.data;
2 +
3 +import lombok.Builder;
4 +import lombok.Data;
5 +
6 +import java.util.List;
7 +
8 +@Data
9 +@Builder
10 +public class CustomerAlterRoomNoData {
11 +
12 + private List<AlterRoomNoCustomer> alterRoomNoCustomers;
13 +
14 + @Data
15 + @Builder
16 + public static class AlterRoomNoCustomer {
17 +
18 + private int orderId;
19 +
20 + private int customerId;
21 +
22 + private String roomNo;
23 +
24 + private String alterRoomNo;
25 + }
26 +}
...@@ -9,6 +9,7 @@ import com.infoloop.tianting.model.dto.ClientLabelDTO.BatchDeleteCustomerLabelRe ...@@ -9,6 +9,7 @@ import com.infoloop.tianting.model.dto.ClientLabelDTO.BatchDeleteCustomerLabelRe
9 import com.infoloop.tianting.model.dto.ClientLabelDTO.BatchDeleteCustomerLabelRefResponseDto; 9 import com.infoloop.tianting.model.dto.ClientLabelDTO.BatchDeleteCustomerLabelRefResponseDto;
10 import com.infoloop.tianting.model.dto.ClientLabelDTO.CustomerLabelRefDetailDto; 10 import com.infoloop.tianting.model.dto.ClientLabelDTO.CustomerLabelRefDetailDto;
11 11
12 +import java.io.IOException;
12 import java.util.List; 13 import java.util.List;
13 14
14 public interface ClientCustomerService { 15 public interface ClientCustomerService {
...@@ -36,4 +37,6 @@ public interface ClientCustomerService { ...@@ -36,4 +37,6 @@ public interface ClientCustomerService {
36 TodayOrderDto getTodayOrderStatisticForHis(String token); 37 TodayOrderDto getTodayOrderStatisticForHis(String token);
37 38
38 ClientCustomerDto getClientCustomerByHISCustomerNo(String hisCustomerNo); 39 ClientCustomerDto getClientCustomerByHISCustomerNo(String hisCustomerNo);
40 +
41 + void synchronizationHisClientCustomer() throws IOException;
39 } 42 }
......
...@@ -2,7 +2,11 @@ package com.infoloop.tianting.service.client; ...@@ -2,7 +2,11 @@ package com.infoloop.tianting.service.client;
2 2
3 import com.infoloop.tianting.clientcustomerservice.BatchCreateClientCustomerLabelRefsRpcRequest; 3 import com.infoloop.tianting.clientcustomerservice.BatchCreateClientCustomerLabelRefsRpcRequest;
4 import com.infoloop.tianting.clientcustomerservice.BatchCreateClientCustomerLabelRefsRpcResponse; 4 import com.infoloop.tianting.clientcustomerservice.BatchCreateClientCustomerLabelRefsRpcResponse;
5 +import com.infoloop.tianting.clientcustomerservice.BatchCreateClientCustomerOperationRecordsRpcRequest;
6 +import com.infoloop.tianting.clientcustomerservice.BatchUpdateClientCustomerHospitalRecordsRpcRequest;
7 +import com.infoloop.tianting.clientcustomerservice.ClientCustomerHospitalRecordModification;
5 import com.infoloop.tianting.clientcustomerservice.ClientCustomerLabelRefCreation; 8 import com.infoloop.tianting.clientcustomerservice.ClientCustomerLabelRefCreation;
9 +import com.infoloop.tianting.clientcustomerservice.ClientCustomerOperationRecordCreation;
6 import com.infoloop.tianting.clientcustomerservice.ClientCustomerServiceRpcGrpc; 10 import com.infoloop.tianting.clientcustomerservice.ClientCustomerServiceRpcGrpc;
7 import com.infoloop.tianting.clientcustomerservice.DeleteClientCustomerLabelRefsByIdsRpcRequest; 11 import com.infoloop.tianting.clientcustomerservice.DeleteClientCustomerLabelRefsByIdsRpcRequest;
8 import com.infoloop.tianting.clientcustomerservice.DeleteClientCustomerLabelRefsRpcResponse; 12 import com.infoloop.tianting.clientcustomerservice.DeleteClientCustomerLabelRefsRpcResponse;
...@@ -18,12 +22,15 @@ import com.infoloop.tianting.clientcustomerservice.GetClientCustomerByMobileRpcR ...@@ -18,12 +22,15 @@ import com.infoloop.tianting.clientcustomerservice.GetClientCustomerByMobileRpcR
18 import com.infoloop.tianting.clientcustomerservice.GetClientCustomerByMobileRpcResponse; 22 import com.infoloop.tianting.clientcustomerservice.GetClientCustomerByMobileRpcResponse;
19 import com.infoloop.tianting.clientcustomerservice.GetClientCustomerHospitalRecordByCustomerIdRpcRequest; 23 import com.infoloop.tianting.clientcustomerservice.GetClientCustomerHospitalRecordByCustomerIdRpcRequest;
20 import com.infoloop.tianting.clientcustomerservice.GetClientCustomerHospitalRecordByCustomerIdRpcResponse; 24 import com.infoloop.tianting.clientcustomerservice.GetClientCustomerHospitalRecordByCustomerIdRpcResponse;
25 +import com.infoloop.tianting.clientcustomerservice.GetClientCustomerHospitalRecordsByCustomerIdsRpcRequest;
21 import com.infoloop.tianting.clientcustomerservice.GetClientCustomersByHISCustomerIdsRpcRequest; 26 import com.infoloop.tianting.clientcustomerservice.GetClientCustomersByHISCustomerIdsRpcRequest;
22 import com.infoloop.tianting.clientcustomerservice.GetClientCustomersByHISCustomerIdsRpcResponse; 27 import com.infoloop.tianting.clientcustomerservice.GetClientCustomersByHISCustomerIdsRpcResponse;
23 import com.infoloop.tianting.clientcustomerservice.GetClientCustomersByIdsRpcRequest; 28 import com.infoloop.tianting.clientcustomerservice.GetClientCustomersByIdsRpcRequest;
24 import com.infoloop.tianting.clientcustomerservice.GetClientCustomersByIdsRpcResponse; 29 import com.infoloop.tianting.clientcustomerservice.GetClientCustomersByIdsRpcResponse;
25 import com.infoloop.tianting.clientcustomerservice.QueryClientCustomerLabelRefsByConditionRpcRequest; 30 import com.infoloop.tianting.clientcustomerservice.QueryClientCustomerLabelRefsByConditionRpcRequest;
26 import com.infoloop.tianting.clientcustomerservice.QueryClientCustomerLabelRefsByConditionRpcResponse; 31 import com.infoloop.tianting.clientcustomerservice.QueryClientCustomerLabelRefsByConditionRpcResponse;
32 +import com.infoloop.tianting.clientcustomerservice.SingleClientCustomerHospitalRecordRpcResponse;
33 +import com.infoloop.tianting.context.LoginContextHolder;
27 import com.infoloop.tianting.model.dto.ClientLabelDTO.BatchCreateCustomerLabelRefDto; 34 import com.infoloop.tianting.model.dto.ClientLabelDTO.BatchCreateCustomerLabelRefDto;
28 import com.infoloop.tianting.model.dto.ClientLabelDTO.BatchDeleteCustomerLabelRefRequestDto; 35 import com.infoloop.tianting.model.dto.ClientLabelDTO.BatchDeleteCustomerLabelRefRequestDto;
29 import lombok.RequiredArgsConstructor; 36 import lombok.RequiredArgsConstructor;
...@@ -145,4 +152,32 @@ public class ClientCustomerServiceRpcClient { ...@@ -145,4 +152,32 @@ public class ClientCustomerServiceRpcClient {
145 .build(); 152 .build();
146 return clientCustomerServiceRpcBlockingStub.deleteClientCustomerLabelRefsByIds(request); 153 return clientCustomerServiceRpcBlockingStub.deleteClientCustomerLabelRefsByIds(request);
147 } 154 }
155 +
156 + public List<SingleClientCustomerHospitalRecordRpcResponse> getClientCustomerHospitalRecordsByCustomerIds(int enterpriseId, List<Integer> ids) {
157 + final var request = GetClientCustomerHospitalRecordsByCustomerIdsRpcRequest.newBuilder()
158 + .setEnterpriseId(enterpriseId)
159 + .addAllCustomerIds(ids)
160 + .build();
161 + return clientCustomerServiceRpcBlockingStub.getClientCustomerHospitalRecordsByCustomerIds(request).getResponsesList();
162 + }
163 +
164 + public boolean batchUpdateClientCustomerHospitalRecords(LoginContextHolder.LoginInfo loginInfo, List<ClientCustomerHospitalRecordModification> modifications) {
165 + final var request = BatchUpdateClientCustomerHospitalRecordsRpcRequest.newBuilder()
166 + .setEnterpriseId(loginInfo.getEnterpriseId())
167 + .setUpdatedBy(loginInfo.getId())
168 + .setUpdateSource(loginInfo.getLoginSource().getValue())
169 + .addAllModifications(modifications)
170 + .build();
171 + return clientCustomerServiceRpcBlockingStub.batchUpdateClientCustomerHospitalRecords(request).getIsUpdated();
172 + }
173 +
174 + public boolean batchCreateClientCustomerOperationRecords(LoginContextHolder.LoginInfo loginInfo, List<ClientCustomerOperationRecordCreation> creations) {
175 + final var request = BatchCreateClientCustomerOperationRecordsRpcRequest.newBuilder()
176 + .setEnterpriseId(loginInfo.getEnterpriseId())
177 + .setCreatedBy(loginInfo.getId())
178 + .setCreationSource(loginInfo.getLoginSource().getValue())
179 + .addAllCreations(creations)
180 + .build();
181 + return clientCustomerServiceRpcBlockingStub.batchCreateClientCustomerOperationRecords(request).getIsCreated();
182 + }
148 } 183 }
......
1 +package com.infoloop.tianting.service.client;
2 +
3 +import com.infoloop.tianting.clientresourcetagservice.ClientResourceTagServiceRpcGrpc;
4 +import com.infoloop.tianting.clientresourcetagservice.ResourceOperatorIdsGetByStallIdsRequest;
5 +import com.infoloop.tianting.clientresourcetagservice.SingleResourceLabelEntityRefsResponse;
6 +import com.infoloop.tianting.clientresourcetagservice.UserTagsAndResourcesGetRequest;
7 +import com.infoloop.tianting.clientresourcetagservice.UserTagsAndResourcesGetResponse;
8 +import lombok.RequiredArgsConstructor;
9 +import org.springframework.beans.factory.annotation.Autowired;
10 +import org.springframework.stereotype.Service;
11 +
12 +import java.util.List;
13 +
14 +@Service
15 +@RequiredArgsConstructor(onConstructor = @__(@Autowired))
16 +public class ClientResourceTagServiceRpcClient {
17 +
18 + private final ClientResourceTagServiceRpcGrpc.ClientResourceTagServiceRpcBlockingStub clientResourceTagServiceRpcBlockingStub;
19 +
20 + public List<SingleResourceLabelEntityRefsResponse> getOperatorIdsByStallIds(List<Integer> stallIds) {
21 + return clientResourceTagServiceRpcBlockingStub.getOperatorIdsByStallIds(ResourceOperatorIdsGetByStallIdsRequest.newBuilder()
22 + .addAllStallIds(stallIds)
23 + .build()).getLabelEntityRefsList();
24 + }
25 +
26 + public UserTagsAndResourcesGetResponse getUserResources(int enterpriseId, int clientId, int operatorId) {
27 + return clientResourceTagServiceRpcBlockingStub.getUserResources(UserTagsAndResourcesGetRequest.newBuilder()
28 + .setEnterpriseId(enterpriseId)
29 + .setUserId(operatorId)
30 + .setClientId(clientId)
31 + .build());
32 + }
33 +}
1 package com.infoloop.tianting.service.client; 1 package com.infoloop.tianting.service.client;
2 2
3 +import com.infoloop.rpc.meizhongyiheservice.Customer;
3 import com.infoloop.rpc.meizhongyiheservice.GetCustomerAllergiesByCustomerIdsRpcRequest; 4 import com.infoloop.rpc.meizhongyiheservice.GetCustomerAllergiesByCustomerIdsRpcRequest;
4 import com.infoloop.rpc.meizhongyiheservice.GetCustomerAllergiesByCustomerIdsRpcResponse; 5 import com.infoloop.rpc.meizhongyiheservice.GetCustomerAllergiesByCustomerIdsRpcResponse;
6 +import com.infoloop.rpc.meizhongyiheservice.GetCustomerDetailByIdRpcRequest;
5 import com.infoloop.rpc.meizhongyiheservice.GetCustomerMedicalAdvicesByHospitalRecordIdsRpcRequest; 7 import com.infoloop.rpc.meizhongyiheservice.GetCustomerMedicalAdvicesByHospitalRecordIdsRpcRequest;
6 import com.infoloop.rpc.meizhongyiheservice.GetCustomerMedicalAdvicesByHospitalRecordIdsRpcResponse; 8 import com.infoloop.rpc.meizhongyiheservice.GetCustomerMedicalAdvicesByHospitalRecordIdsRpcResponse;
9 +import com.infoloop.rpc.meizhongyiheservice.GetCustomersByConditionRpcRequest;
7 import com.infoloop.rpc.meizhongyiheservice.MeiZhongYiHeServiceRpcGrpc; 10 import com.infoloop.rpc.meizhongyiheservice.MeiZhongYiHeServiceRpcGrpc;
8 import lombok.RequiredArgsConstructor; 11 import lombok.RequiredArgsConstructor;
9 import org.springframework.beans.factory.annotation.Autowired; 12 import org.springframework.beans.factory.annotation.Autowired;
...@@ -31,4 +34,22 @@ public class MeiZhongYiHeServiceClient { ...@@ -31,4 +34,22 @@ public class MeiZhongYiHeServiceClient {
31 .build(); 34 .build();
32 return meiZhongYiHeServiceRpcBlockingStub.getCustomerMedicalAdvicesByHospitalRecordIds(request); 35 return meiZhongYiHeServiceRpcBlockingStub.getCustomerMedicalAdvicesByHospitalRecordIds(request);
33 } 36 }
37 +
38 + public Customer getCustomerDetailById(String HISCustomerId, String contractNo) {
39 + final var customer = meiZhongYiHeServiceRpcBlockingStub.getCustomerDetailById(GetCustomerDetailByIdRpcRequest.newBuilder()
40 + .setCustomerId(HISCustomerId)
41 + .setHospitalRecordId(contractNo)
42 + .build());
43 + if (!customer.hasCustomer()) {
44 + return null;
45 + }
46 + return customer.getCustomer();
47 + }
48 +
49 + public List<Customer> getCustomersByCondition(List<String> stallCodes) {
50 + final var request = GetCustomersByConditionRpcRequest.newBuilder()
51 + .addAllDeptCode(stallCodes)
52 + .build();
53 + return meiZhongYiHeServiceRpcBlockingStub.getCustomersByCondition(request).getCustomersList();
54 + }
34 } 55 }
......
...@@ -21,7 +21,7 @@ public class OperatorServiceRpcClient { ...@@ -21,7 +21,7 @@ public class OperatorServiceRpcClient {
21 return cOperatorServiceProtoRpcBlockingStub.getCOperatorByMobileOrEmail(request).getResponse(); 21 return cOperatorServiceProtoRpcBlockingStub.getCOperatorByMobileOrEmail(request).getResponse();
22 } 22 }
23 23
24 - public SingleCOperatorRpcResponse getCOperatorById(Integer id) { 24 + public SingleCOperatorRpcResponse getCOperatorById(int id) {
25 final var request = GetCOperatorByIdRpcRequest.newBuilder().setId(id).build(); 25 final var request = GetCOperatorByIdRpcRequest.newBuilder().setId(id).build();
26 return cOperatorServiceProtoRpcBlockingStub.getCOperatorById(request).getResponse(); 26 return cOperatorServiceProtoRpcBlockingStub.getCOperatorById(request).getResponse();
27 } 27 }
......
...@@ -120,7 +120,7 @@ public class PayServiceClient { ...@@ -120,7 +120,7 @@ public class PayServiceClient {
120 } 120 }
121 } 121 }
122 122
123 - public boolean callback(PaymentCallbackDTO paymentCallbackDTO) { 123 + public boolean callback(PaymentCallbackDTO paymentCallbackDTO) {
124 log.info("callback request received: {}", paymentCallbackDTO); 124 log.info("callback request received: {}", paymentCallbackDTO);
125 try { 125 try {
126 final var paymentCallbackResult = xmlMapper.readValue(paymentCallbackDTO.getPayResult(), PaymentCallbackResult.class); 126 final var paymentCallbackResult = xmlMapper.readValue(paymentCallbackDTO.getPayResult(), PaymentCallbackResult.class);
...@@ -157,6 +157,7 @@ public class PayServiceClient { ...@@ -157,6 +157,7 @@ public class PayServiceClient {
157 .setShouldUpdatePayTime(true).setPayTime(payTime) 157 .setShouldUpdatePayTime(true).setPayTime(payTime)
158 .setShouldUpdatePayPrice(true).setPayPrice(realAmount.multiply(new BigDecimal("100")).intValue()) 158 .setShouldUpdatePayPrice(true).setPayPrice(realAmount.multiply(new BigDecimal("100")).intValue())
159 .setShouldUpdatePayStatus(true).setPayStatus(PayStatusEnum.SUCCEED) 159 .setShouldUpdatePayStatus(true).setPayStatus(PayStatusEnum.SUCCEED)
160 + .setShouldUpdateStatus(true).setStatus(OrderStatusEnum.PREPARING)
160 .setShouldUpdateTransactionId(true).setTransactionId(paymentCallbackResult.getTransSN()) 161 .setShouldUpdateTransactionId(true).setTransactionId(paymentCallbackResult.getTransSN())
161 .build(); 162 .build();
162 final var updateResponse = orderServiceRpcClient.updateClientCustomerOrderPaymentResult(orderById, build); 163 final var updateResponse = orderServiceRpcClient.updateClientCustomerOrderPaymentResult(orderById, build);
......
...@@ -5,36 +5,34 @@ import com.infoloop.tianting.model.dto.CategoryDbDTO.CategoryDto; ...@@ -5,36 +5,34 @@ import com.infoloop.tianting.model.dto.CategoryDbDTO.CategoryDto;
5 import com.infoloop.tianting.service.CategoriesService; 5 import com.infoloop.tianting.service.CategoriesService;
6 import com.infoloop.tianting.service.client.CategoriesServiceRpcClient; 6 import com.infoloop.tianting.service.client.CategoriesServiceRpcClient;
7 import com.infoloop.tianting.utils.DateUtil; 7 import com.infoloop.tianting.utils.DateUtil;
8 -import java.util.List;
9 -import java.util.stream.Collectors;
10 import lombok.RequiredArgsConstructor; 8 import lombok.RequiredArgsConstructor;
11 import lombok.extern.slf4j.Slf4j; 9 import lombok.extern.slf4j.Slf4j;
12 import org.springframework.beans.factory.annotation.Autowired; 10 import org.springframework.beans.factory.annotation.Autowired;
13 import org.springframework.stereotype.Service; 11 import org.springframework.stereotype.Service;
14 12
13 +import java.util.List;
14 +import java.util.stream.Collectors;
15 +
15 @Slf4j 16 @Slf4j
16 @Service 17 @Service
17 @RequiredArgsConstructor(onConstructor = @__(@Autowired)) 18 @RequiredArgsConstructor(onConstructor = @__(@Autowired))
18 public class CategoriesServiceImpl implements CategoriesService { 19 public class CategoriesServiceImpl implements CategoriesService {
19 20
20 - private final CategoriesServiceRpcClient categoriesServiceRpcClient; 21 + private final CategoriesServiceRpcClient categoriesServiceRpcClient;
21 -
22 - @Override
23 - public List<CategoryDto> queryCategoriesAll() {
24 -
25 - final var operatorLoginInfo = LoginContextHolder.getLoginInfo();
26 - final var response = categoriesServiceRpcClient.queryCategoriesAll(operatorLoginInfo.getEnterpriseId());
27 - return response.getResponsesList().stream().map(category ->
28 - CategoryDto.builder()
29 - .id(category.getId())
30 - .enterpriseId(category.getEnterpriseId())
31 - .code(category.getCode())
32 - .name(category.getName())
33 - .createdAt(DateUtil.formatDate(category.getCreatedAt()))
34 - .updatedAt(DateUtil.formatDate(category.getUpdatedAt()))
35 - .build()
36 - ).collect(Collectors.toList());
37 - }
38 22
23 + @Override
24 + public List<CategoryDto> queryCategoriesAll() {
25 + final var operatorLoginInfo = LoginContextHolder.getLoginInfo();
26 + final var response = categoriesServiceRpcClient.queryCategoriesAll(operatorLoginInfo.getEnterpriseId());
27 + return response.getResponsesList().stream().map(category -> CategoryDto.builder()
28 + .id(category.getId())
29 + .enterpriseId(category.getEnterpriseId())
30 + .code(category.getCode())
31 + .name(category.getName())
32 + .createdAt(DateUtil.formatDate(category.getCreatedAt()))
33 + .updatedAt(DateUtil.formatDate(category.getUpdatedAt()))
34 + .build()
35 + ).collect(Collectors.toList());
36 + }
39 37
40 } 38 }
......
1 package com.infoloop.tianting.service.impl; 1 package com.infoloop.tianting.service.impl;
2 2
3 -import com.infoloop.tianting.deliveryruleservice.ClientLabelTypeEnum;
4 import com.infoloop.tianting.model.dto.ClientLabelDTO.LabelDto; 3 import com.infoloop.tianting.model.dto.ClientLabelDTO.LabelDto;
5 import com.infoloop.tianting.model.dto.ClientLabelDTO.QueryLabelsDto; 4 import com.infoloop.tianting.model.dto.ClientLabelDTO.QueryLabelsDto;
6 import com.infoloop.tianting.service.DeliveryRuleService; 5 import com.infoloop.tianting.service.DeliveryRuleService;
7 import com.infoloop.tianting.service.client.DeliveryRuleServiceRpcClient; 6 import com.infoloop.tianting.service.client.DeliveryRuleServiceRpcClient;
8 -import java.util.List;
9 -import java.util.stream.Collectors;
10 import lombok.RequiredArgsConstructor; 7 import lombok.RequiredArgsConstructor;
11 import lombok.extern.slf4j.Slf4j; 8 import lombok.extern.slf4j.Slf4j;
12 import org.springframework.beans.factory.annotation.Autowired; 9 import org.springframework.beans.factory.annotation.Autowired;
13 import org.springframework.stereotype.Service; 10 import org.springframework.stereotype.Service;
14 11
12 +import java.util.List;
13 +import java.util.stream.Collectors;
14 +
15 @Slf4j 15 @Slf4j
16 @Service 16 @Service
17 @RequiredArgsConstructor(onConstructor = @__(@Autowired)) 17 @RequiredArgsConstructor(onConstructor = @__(@Autowired))
18 public class DeliveryRuleServiceImpl implements DeliveryRuleService { 18 public class DeliveryRuleServiceImpl implements DeliveryRuleService {
19 19
20 - private final DeliveryRuleServiceRpcClient deliveryRuleServiceRpcClient; 20 + private final DeliveryRuleServiceRpcClient deliveryRuleServiceRpcClient;
21 -
22 - @Override
23 - public List<LabelDto> getLabelsByTypes(QueryLabelsDto queryLabelsDto) {
24 21
25 - final var response = deliveryRuleServiceRpcClient.getLabelsByTypes(queryLabelsDto); 22 + @Override
26 - return response.getResponsesList().stream().map( 23 + public List<LabelDto> getLabelsByTypes(QueryLabelsDto queryLabelsDto) {
27 - label -> LabelDto.builder() 24 + final var response = deliveryRuleServiceRpcClient.getLabelsByTypes(queryLabelsDto);
28 - .id(label.getId()) 25 + return response.getResponsesList().stream().map(label -> LabelDto.builder()
29 - .code(label.getCode()) 26 + .id(label.getId())
30 - .name(label.getName()) 27 + .code(label.getCode())
31 - .enterpriseId(label.getEnterpriseId()) 28 + .name(label.getName())
32 - .isDefault(label.getIsDefault()) 29 + .enterpriseId(label.getEnterpriseId())
33 - .remark(label.getRemark()) 30 + .isDefault(label.getIsDefault())
34 - .status(label.getStatus()) 31 + .remark(label.getRemark())
35 - .type(label.getType()) 32 + .status(label.getStatus())
36 - .build() 33 + .type(label.getType())
37 - ).collect(Collectors.toList()); 34 + .build()
38 - } 35 + ).collect(Collectors.toList());
36 + }
39 } 37 }
......
...@@ -68,10 +68,8 @@ public class InventoryServiceImpl implements InventoryService { ...@@ -68,10 +68,8 @@ public class InventoryServiceImpl implements InventoryService {
68 } 68 }
69 69
70 @Override 70 @Override
71 - public List<ClientTableCodeDto> queryClientTableCodesByCondition( 71 + public List<ClientTableCodeDto> queryClientTableCodesByCondition(TableCodeQueryConditionDto tableCodeQueryConditionDto) {
72 - TableCodeQueryConditionDto tableCodeQueryConditionDto) { 72 + final var response = inventoryServiceRpcClient.queryClientTableCodesByCondition(tableCodeQueryConditionDto);
73 - final var response = inventoryServiceRpcClient.queryClientTableCodesByCondition(
74 - tableCodeQueryConditionDto);
75 return response.getResponsesList().stream().map(tableCode -> 73 return response.getResponsesList().stream().map(tableCode ->
76 ClientTableCodeDto.builder() 74 ClientTableCodeDto.builder()
77 .id(tableCode.getId()) 75 .id(tableCode.getId())
......
1 package com.infoloop.tianting.service.impl; 1 package com.infoloop.tianting.service.impl;
2 2
3 import com.infoloop.tianting.clientcustomerorderservice.OrderStatusEnum; 3 import com.infoloop.tianting.clientcustomerorderservice.OrderStatusEnum;
4 +import com.infoloop.tianting.clientcustomerorderservice.PayStatusEnum;
4 import com.infoloop.tianting.clientcustomerorderservice.ServeStatusEnum; 5 import com.infoloop.tianting.clientcustomerorderservice.ServeStatusEnum;
5 import com.infoloop.tianting.clientcustomerorderservice.SingleClientCustomerOrderDetailRpcResponse; 6 import com.infoloop.tianting.clientcustomerorderservice.SingleClientCustomerOrderDetailRpcResponse;
6 import com.infoloop.tianting.clientcustomerorderservice.SingleClientCustomerOrderRpcResponse; 7 import com.infoloop.tianting.clientcustomerorderservice.SingleClientCustomerOrderRpcResponse;
...@@ -51,24 +52,20 @@ public class KdsServiceImpl implements KdsService { ...@@ -51,24 +52,20 @@ public class KdsServiceImpl implements KdsService {
51 52
52 @Override 53 @Override
53 public List<KdsOrderSkuDto> getOrderDetailBySku(KdsOrderSkuQueryDto queryDto) { 54 public List<KdsOrderSkuDto> getOrderDetailBySku(KdsOrderSkuQueryDto queryDto) {
54 -
55 // 获取当日所有的订单 和 订单明细 55 // 获取当日所有的订单 和 订单明细
56 LocalDate today = LocalDate.now(); 56 LocalDate today = LocalDate.now();
57 LocalDateTime todayZero = today.atStartOfDay(); 57 LocalDateTime todayZero = today.atStartOfDay();
58 LocalDate tomorrow = today.plusDays(1); 58 LocalDate tomorrow = today.plusDays(1);
59 LocalDateTime tomorrowZero = tomorrow.atStartOfDay(); 59 LocalDateTime tomorrowZero = tomorrow.atStartOfDay();
60 -
61 final var operatorLoginInfo = LoginContextHolder.getLoginInfo(); 60 final var operatorLoginInfo = LoginContextHolder.getLoginInfo();
62 boolean shouldFilterStallIds = false; 61 boolean shouldFilterStallIds = false;
63 List<Integer> stallIds = new ArrayList<>(); 62 List<Integer> stallIds = new ArrayList<>();
64 final var operator = wOperatorServiceRpcClient.getWOperatorById(operatorLoginInfo.getId()).getResponse(); 63 final var operator = wOperatorServiceRpcClient.getWOperatorById(operatorLoginInfo.getId()).getResponse();
65 if (!operator.getIsSuper()) { 64 if (!operator.getIsSuper()) {
66 shouldFilterStallIds = true; 65 shouldFilterStallIds = true;
67 - final var userResource = enterpriseResourceServiceRpcClient.getUserResources( 66 + final var userResource = enterpriseResourceServiceRpcClient.getUserResources(operatorLoginInfo.getEnterpriseId(), operatorLoginInfo.getId());
68 - operatorLoginInfo.getEnterpriseId(), operatorLoginInfo.getId());
69 stallIds.addAll(userResource.getStallIdsList()); 67 stallIds.addAll(userResource.getStallIdsList());
70 } 68 }
71 -
72 final var queryOrderDto = QueryOrderByConditionDto.builder() 69 final var queryOrderDto = QueryOrderByConditionDto.builder()
73 .enterpriseId(operatorLoginInfo.getEnterpriseId()) 70 .enterpriseId(operatorLoginInfo.getEnterpriseId())
74 .shouldFilterStallIds(shouldFilterStallIds) 71 .shouldFilterStallIds(shouldFilterStallIds)
...@@ -77,6 +74,8 @@ public class KdsServiceImpl implements KdsService { ...@@ -77,6 +74,8 @@ public class KdsServiceImpl implements KdsService {
77 .mealTimeStart(todayZero) 74 .mealTimeStart(todayZero)
78 .shouldFilterMealTimeEnd(true) 75 .shouldFilterMealTimeEnd(true)
79 .mealTimeEnd(tomorrowZero) 76 .mealTimeEnd(tomorrowZero)
77 + .shouldFilterPayStatus(true)
78 + .payStatus(PayStatusEnum.SUCCEED)
80 .build(); 79 .build();
81 final var orderList = orderServiceRpcClient.getOrdersByCondition(queryOrderDto); 80 final var orderList = orderServiceRpcClient.getOrdersByCondition(queryOrderDto);
82 List<Integer> orderIds = orderList.stream() 81 List<Integer> orderIds = orderList.stream()
...@@ -170,7 +169,7 @@ public class KdsServiceImpl implements KdsService { ...@@ -170,7 +169,7 @@ public class KdsServiceImpl implements KdsService {
170 .orderDetailId(detail.getId()) 169 .orderDetailId(detail.getId())
171 .remark(order.get().getRemark()) 170 .remark(order.get().getRemark())
172 .orderId(order.get().getId()) 171 .orderId(order.get().getId())
173 - .roomNo(order.get().getRoomNo()) 172 + .roomNo(order.get().getSyncRoomNo().isEmpty() ? order.get().getRoomNo() : order.get().getSyncRoomNo())
174 .tableCode(order.get().getTableCode()) 173 .tableCode(order.get().getTableCode())
175 .customerNotice(CustomerNotice.builder() 174 .customerNotice(CustomerNotice.builder()
176 .doctors(order.get().getCustomerNoticeJson().getDoctorsList()) 175 .doctors(order.get().getCustomerNoticeJson().getDoctorsList())
...@@ -309,6 +308,8 @@ public class KdsServiceImpl implements KdsService { ...@@ -309,6 +308,8 @@ public class KdsServiceImpl implements KdsService {
309 .mealTimeEnd(tomorrowZero) 308 .mealTimeEnd(tomorrowZero)
310 .shouldFilterStatus(true) 309 .shouldFilterStatus(true)
311 .status(queryDto.getOrderStatus()) 310 .status(queryDto.getOrderStatus())
311 + .shouldFilterPayStatus(true)
312 + .payStatus(PayStatusEnum.SUCCEED)
312 .build(); 313 .build();
313 314
314 final var orderList = orderServiceRpcClient.getOrdersByCondition(queryOrderDto); 315 final var orderList = orderServiceRpcClient.getOrdersByCondition(queryOrderDto);
...@@ -338,13 +339,6 @@ public class KdsServiceImpl implements KdsService { ...@@ -338,13 +339,6 @@ public class KdsServiceImpl implements KdsService {
338 final var filteredOrderDetailList = orderDetailList.stream() 339 final var filteredOrderDetailList = orderDetailList.stream()
339 .filter(od -> od.getMealId() == queryDto.getMealId() && od.getServeStatus() != ServeStatusEnum.SERVE_REJECT) 340 .filter(od -> od.getMealId() == queryDto.getMealId() && od.getServeStatus() != ServeStatusEnum.SERVE_REJECT)
340 .collect(Collectors.toList()); 341 .collect(Collectors.toList());
341 -
342 - //在所有的orderDetail里找出所有所有不同的menuDetailId,然后根据menuDetailId进行分类
343 - final var menuDetailIds = filteredOrderDetailList.stream()
344 - .map(SingleClientCustomerOrderDetailRpcResponse::getMenuDetailId)
345 - .distinct()
346 - .collect(Collectors.toList());
347 -
348 List<KdsOrderLocationDto> kdsOrderLocationList = new ArrayList<>(); 342 List<KdsOrderLocationDto> kdsOrderLocationList = new ArrayList<>();
349 343
350 for (SingleClientCustomerOrderRpcResponse order : orderList) { 344 for (SingleClientCustomerOrderRpcResponse order : orderList) {
...@@ -402,7 +396,7 @@ public class KdsServiceImpl implements KdsService { ...@@ -402,7 +396,7 @@ public class KdsServiceImpl implements KdsService {
402 .totalCount(order.getTotalNum()) 396 .totalCount(order.getTotalNum())
403 .remark(order.getRemark()) 397 .remark(order.getRemark())
404 .orderId(order.getId()) 398 .orderId(order.getId())
405 - .roomNo(order.getRoomNo()) 399 + .roomNo(order.getSyncRoomNo().isEmpty() ? order.getRoomNo() : order.getSyncRoomNo())
406 .tableCode(order.getTableCode()) 400 .tableCode(order.getTableCode())
407 .customerNotice(CustomerNotice.builder() 401 .customerNotice(CustomerNotice.builder()
408 .doctors(order.getCustomerNoticeJson().getDoctorsList()) 402 .doctors(order.getCustomerNoticeJson().getDoctorsList())
......
...@@ -3,6 +3,8 @@ package com.infoloop.tianting.service.impl; ...@@ -3,6 +3,8 @@ package com.infoloop.tianting.service.impl;
3 import cn.dev33.satoken.stp.SaLoginModel; 3 import cn.dev33.satoken.stp.SaLoginModel;
4 import cn.dev33.satoken.stp.SaTokenInfo; 4 import cn.dev33.satoken.stp.SaTokenInfo;
5 import cn.dev33.satoken.stp.StpUtil; 5 import cn.dev33.satoken.stp.StpUtil;
6 +import com.infoloop.rpc.meizhongyiheservice.HospitalStatus;
7 +import com.infoloop.tianting.WOperatorStatus;
6 import com.infoloop.tianting.clientcustomerservice.ClientCustomerHospitalRecordHospitalStatusEnum; 8 import com.infoloop.tianting.clientcustomerservice.ClientCustomerHospitalRecordHospitalStatusEnum;
7 import com.infoloop.tianting.constant.CommonConstants; 9 import com.infoloop.tianting.constant.CommonConstants;
8 import com.infoloop.tianting.exception.ClientEndExceptions; 10 import com.infoloop.tianting.exception.ClientEndExceptions;
...@@ -10,6 +12,7 @@ import com.infoloop.tianting.exception.ErrorCodeEnum; ...@@ -10,6 +12,7 @@ import com.infoloop.tianting.exception.ErrorCodeEnum;
10 import com.infoloop.tianting.model.dto.PermissionDTO.LoginDto; 12 import com.infoloop.tianting.model.dto.PermissionDTO.LoginDto;
11 import com.infoloop.tianting.service.LoginService; 13 import com.infoloop.tianting.service.LoginService;
12 import com.infoloop.tianting.service.client.ClientCustomerServiceRpcClient; 14 import com.infoloop.tianting.service.client.ClientCustomerServiceRpcClient;
15 +import com.infoloop.tianting.service.client.MeiZhongYiHeServiceClient;
13 import com.infoloop.tianting.service.client.OperatorServiceRpcClient; 16 import com.infoloop.tianting.service.client.OperatorServiceRpcClient;
14 import com.infoloop.tianting.service.client.WOperatorServiceRpcClient; 17 import com.infoloop.tianting.service.client.WOperatorServiceRpcClient;
15 import com.infoloop.tianting.service.client.WxMiniProgramHttpClient; 18 import com.infoloop.tianting.service.client.WxMiniProgramHttpClient;
...@@ -30,6 +33,7 @@ public class LoginServiceImpl implements LoginService { ...@@ -30,6 +33,7 @@ public class LoginServiceImpl implements LoginService {
30 private final OperatorServiceRpcClient operatorServiceRpcClient; 33 private final OperatorServiceRpcClient operatorServiceRpcClient;
31 private final WxMiniProgramHttpClient wxMiniProgramHttpClient; 34 private final WxMiniProgramHttpClient wxMiniProgramHttpClient;
32 private final WOperatorServiceRpcClient wOperatorServiceRpcClient; 35 private final WOperatorServiceRpcClient wOperatorServiceRpcClient;
36 + private final MeiZhongYiHeServiceClient meiZhongYiHeServiceClient;
33 37
34 @Override 38 @Override
35 public SaTokenInfo login(LoginDto loginDto) throws NoSuchAlgorithmException { 39 public SaTokenInfo login(LoginDto loginDto) throws NoSuchAlgorithmException {
...@@ -58,6 +62,11 @@ public class LoginServiceImpl implements LoginService { ...@@ -58,6 +62,11 @@ public class LoginServiceImpl implements LoginService {
58 if (!record.hasResponse() || record.getResponse().getHospitalStatus() != ClientCustomerHospitalRecordHospitalStatusEnum.CURRENT) { 62 if (!record.hasResponse() || record.getResponse().getHospitalStatus() != ClientCustomerHospitalRecordHospitalStatusEnum.CURRENT) {
59 throw ClientEndExceptions.IncorrectRequestValue.build(ErrorCodeEnum.VALIDATE_FAILED.name()); 63 throw ClientEndExceptions.IncorrectRequestValue.build(ErrorCodeEnum.VALIDATE_FAILED.name());
60 } 64 }
65 + //还需要去读取HIS系统最新用户住院信息
66 + final var hisCustomerHospitalRecord = meiZhongYiHeServiceClient.getCustomerDetailById(customer.getHISCustomerId(), record.getResponse().getContractNo()).getCustomerHospitalRecord();
67 + if (hisCustomerHospitalRecord.getHospitalStatus() != HospitalStatus.CURRENT) {
68 + throw ClientEndExceptions.IncorrectRequestValue.build(ErrorCodeEnum.VALIDATE_FAILED.name());
69 + }
61 } 70 }
62 final var wxUserOpenIdDto = wxMiniProgramHttpClient.getUserOpenIdByCode(loginDto.getOpenCode()); 71 final var wxUserOpenIdDto = wxMiniProgramHttpClient.getUserOpenIdByCode(loginDto.getOpenCode());
63 StpUtil.login(customer.getId(), SaLoginModel.create() 72 StpUtil.login(customer.getId(), SaLoginModel.create()
...@@ -74,6 +83,9 @@ public class LoginServiceImpl implements LoginService { ...@@ -74,6 +83,9 @@ public class LoginServiceImpl implements LoginService {
74 if (!operator.getPassword().equals(sha1Hash(loginDto.getPassword()))) { 83 if (!operator.getPassword().equals(sha1Hash(loginDto.getPassword()))) {
75 throw ClientEndExceptions.AuthenticationFailure.build(ErrorCodeEnum.VALIDATE_FAILED.name()); 84 throw ClientEndExceptions.AuthenticationFailure.build(ErrorCodeEnum.VALIDATE_FAILED.name());
76 } 85 }
86 + if (operator.getStatus() != 1) {
87 + throw ClientEndExceptions.AuthenticationFailure.build(ErrorCodeEnum.VALIDATE_FAILED.name());
88 + }
77 StpUtil.login(operator.getId(), SaLoginModel.create() 89 StpUtil.login(operator.getId(), SaLoginModel.create()
78 .setExtra(CommonConstants.ENTERPRISE_ID, operator.getEnterpriseId()) 90 .setExtra(CommonConstants.ENTERPRISE_ID, operator.getEnterpriseId())
79 .setExtra(CommonConstants.LOGIN_SOURCE, loginDto.getLoginSourceEnum().getValue()) 91 .setExtra(CommonConstants.LOGIN_SOURCE, loginDto.getLoginSourceEnum().getValue())
...@@ -87,6 +99,9 @@ public class LoginServiceImpl implements LoginService { ...@@ -87,6 +99,9 @@ public class LoginServiceImpl implements LoginService {
87 if (!operator.getPassword().equals(sha1Hash(loginDto.getPassword()))) { 99 if (!operator.getPassword().equals(sha1Hash(loginDto.getPassword()))) {
88 throw ClientEndExceptions.AuthenticationFailure.build(ErrorCodeEnum.VALIDATE_FAILED.name()); 100 throw ClientEndExceptions.AuthenticationFailure.build(ErrorCodeEnum.VALIDATE_FAILED.name());
89 } 101 }
102 + if (operator.getStatus() != WOperatorStatus.SHOW) {
103 + throw ClientEndExceptions.AuthenticationFailure.build(ErrorCodeEnum.VALIDATE_FAILED.name());
104 + }
90 StpUtil.login(operator.getId(), SaLoginModel.create() 105 StpUtil.login(operator.getId(), SaLoginModel.create()
91 .setExtra(CommonConstants.ENTERPRISE_ID, operator.getEnterpriseId()) 106 .setExtra(CommonConstants.ENTERPRISE_ID, operator.getEnterpriseId())
92 .setExtra(CommonConstants.LOGIN_SOURCE, loginDto.getLoginSourceEnum().getValue()) 107 .setExtra(CommonConstants.LOGIN_SOURCE, loginDto.getLoginSourceEnum().getValue())
......
...@@ -30,8 +30,7 @@ public class MenuServiceImpl implements MenuService { ...@@ -30,8 +30,7 @@ public class MenuServiceImpl implements MenuService {
30 30
31 @Override 31 @Override
32 public List<MenuDto> queryMiniProgramPublishedMenusByStallId(Integer enterpriseId, Integer stallId) { 32 public List<MenuDto> queryMiniProgramPublishedMenusByStallId(Integer enterpriseId, Integer stallId) {
33 - final var response = menuServiceRpcClient.queryMiniProgramPublishedMenusByStallId( 33 + final var response = menuServiceRpcClient.queryMiniProgramPublishedMenusByStallId(enterpriseId, stallId);
34 - enterpriseId, stallId);
35 return response.getResponsesList().stream().map(menu -> 34 return response.getResponsesList().stream().map(menu ->
36 MenuDto.builder() 35 MenuDto.builder()
37 .id(menu.getId()) 36 .id(menu.getId())
...@@ -69,10 +68,8 @@ public class MenuServiceImpl implements MenuService { ...@@ -69,10 +68,8 @@ public class MenuServiceImpl implements MenuService {
69 } 68 }
70 69
71 @Override 70 @Override
72 - public List<MenuDto> queryPublishedMenusByStallId( 71 + public List<MenuDto> queryPublishedMenusByStallId(Integer enterpriseId, Integer stallId) {
73 - Integer enterpriseId, Integer stallId) { 72 + final var response = menuServiceRpcClient.queryPublishedMenusByStallId(enterpriseId, stallId);
74 - final var response = menuServiceRpcClient.queryPublishedMenusByStallId(
75 - enterpriseId, stallId);
76 return response.getResponsesList().stream().map(menu -> 73 return response.getResponsesList().stream().map(menu ->
77 MenuDto.builder() 74 MenuDto.builder()
78 .id(menu.getId()) 75 .id(menu.getId())
......
...@@ -299,7 +299,7 @@ public class OrderServiceImpl implements OrderService { ...@@ -299,7 +299,7 @@ public class OrderServiceImpl implements OrderService {
299 .menuId(r.getMenuId()) 299 .menuId(r.getMenuId())
300 .pickupCode(r.getPickupCode()) 300 .pickupCode(r.getPickupCode())
301 .tableCode(r.getTableCode()) 301 .tableCode(r.getTableCode())
302 - .roomNo(r.getRoomNo()) 302 + .roomNo(r.getSyncRoomNo().isEmpty() ? r.getRoomNo() : r.getSyncRoomNo())
303 .status(r.getStatus()) 303 .status(r.getStatus())
304 .customerNoticeJson(CustomerNotice.builder() 304 .customerNoticeJson(CustomerNotice.builder()
305 .avoids(r.getCustomerNoticeJson().getAvoidsList()) 305 .avoids(r.getCustomerNoticeJson().getAvoidsList())
...@@ -372,7 +372,7 @@ public class OrderServiceImpl implements OrderService { ...@@ -372,7 +372,7 @@ public class OrderServiceImpl implements OrderService {
372 .menuId(r.getMenuId()) 372 .menuId(r.getMenuId())
373 .pickupCode(r.getPickupCode()) 373 .pickupCode(r.getPickupCode())
374 .tableCode(r.getTableCode()) 374 .tableCode(r.getTableCode())
375 - .roomNo(r.getRoomNo()) 375 + .roomNo(r.getSyncRoomNo().isEmpty() ? r.getRoomNo() : r.getSyncRoomNo())
376 .status(r.getStatus()) 376 .status(r.getStatus())
377 .customerNoticeJson(CustomerNotice.builder() 377 .customerNoticeJson(CustomerNotice.builder()
378 .avoids(r.getCustomerNoticeJson().getAvoidsList()) 378 .avoids(r.getCustomerNoticeJson().getAvoidsList())
...@@ -448,7 +448,8 @@ public class OrderServiceImpl implements OrderService { ...@@ -448,7 +448,8 @@ public class OrderServiceImpl implements OrderService {
448 .menuId(r.getMenuId()) 448 .menuId(r.getMenuId())
449 .pickupCode(r.getPickupCode()) 449 .pickupCode(r.getPickupCode())
450 .tableCode(r.getTableCode()) 450 .tableCode(r.getTableCode())
451 - .roomNo(r.getRoomNo()) 451 + .roomNo(r.getSyncRoomNo().isEmpty() ? r.getRoomNo() : r.getSyncRoomNo())
452 + .adjustRoomNo(!r.getSyncRoomNo().isEmpty())
452 .status(r.getStatus()) 453 .status(r.getStatus())
453 .customerNoticeJson(CustomerNotice.builder() 454 .customerNoticeJson(CustomerNotice.builder()
454 .avoids(r.getCustomerNoticeJson().getAvoidsList()) 455 .avoids(r.getCustomerNoticeJson().getAvoidsList())
......
...@@ -138,6 +138,7 @@ message SingleClientCustomerOrderRpcResponse { ...@@ -138,6 +138,7 @@ message SingleClientCustomerOrderRpcResponse {
138 bool isRead = 33; 138 bool isRead = 33;
139 bool isConfirm = 34; 139 bool isConfirm = 34;
140 bool isAllocation = 35; 140 bool isAllocation = 35;
141 + string syncRoomNo = 36;
141 } 142 }
142 143
143 message GetClientCustomerOrderByIdRpcRequest { 144 message GetClientCustomerOrderByIdRpcRequest {
...@@ -243,6 +244,8 @@ message QueryClientCustomerOrdersByConditionRpcRequest { ...@@ -243,6 +244,8 @@ message QueryClientCustomerOrdersByConditionRpcRequest {
243 bool isConfirm = 45; 244 bool isConfirm = 45;
244 bool shouldFilterIsAllocation = 46; 245 bool shouldFilterIsAllocation = 46;
245 bool isAllocation = 47; 246 bool isAllocation = 47;
247 + bool shouldFilterStatues = 48;
248 + repeated OrderStatusEnum statues = 49;
246 } 249 }
247 250
248 message QueryClientCustomerOrdersByConditionRpcResponse { 251 message QueryClientCustomerOrdersByConditionRpcResponse {
...@@ -370,6 +373,8 @@ message ClientCustomerOrderModification { ...@@ -370,6 +373,8 @@ message ClientCustomerOrderModification {
370 bool isConfirm = 51; 373 bool isConfirm = 51;
371 bool shouldUpdateIsAllocation = 52; 374 bool shouldUpdateIsAllocation = 52;
372 bool isAllocation = 53; 375 bool isAllocation = 53;
376 + bool shouldUpdateSyncRoomNo = 54;
377 + string syncRoomNo = 55;
373 } 378 }
374 379
375 message UpdateClientCustomerOrderRpcRequest { 380 message UpdateClientCustomerOrderRpcRequest {
......
...@@ -40,6 +40,7 @@ service ClientCustomerServiceRpc { ...@@ -40,6 +40,7 @@ service ClientCustomerServiceRpc {
40 rpc GetClientCustomerHospitalRecordByCustomerId (GetClientCustomerHospitalRecordByCustomerIdRpcRequest) returns (GetClientCustomerHospitalRecordByCustomerIdRpcResponse) {} 40 rpc GetClientCustomerHospitalRecordByCustomerId (GetClientCustomerHospitalRecordByCustomerIdRpcRequest) returns (GetClientCustomerHospitalRecordByCustomerIdRpcResponse) {}
41 //根据客户IDS查询住院记录 41 //根据客户IDS查询住院记录
42 rpc GetClientCustomerHospitalRecordsByCustomerIds (GetClientCustomerHospitalRecordsByCustomerIdsRpcRequest) returns (GetClientCustomerHospitalRecordsByCustomerIdsRpcResponse) {} 42 rpc GetClientCustomerHospitalRecordsByCustomerIds (GetClientCustomerHospitalRecordsByCustomerIdsRpcRequest) returns (GetClientCustomerHospitalRecordsByCustomerIdsRpcResponse) {}
43 + rpc GetClientCustomerHospitalRecordsByHISCustomerIds (GetClientCustomerHospitalRecordsByHISCustomerIdsRpcRequest) returns (GetClientCustomerHospitalRecordsByHISCustomerIdsRpcResponse) {}
43 rpc QueryClientCustomerHospitalRecordsByCondition (QueryClientCustomerHospitalRecordsByConditionRpcRequest) returns (QueryClientCustomerHospitalRecordsByConditionRpcResponse) {} 44 rpc QueryClientCustomerHospitalRecordsByCondition (QueryClientCustomerHospitalRecordsByConditionRpcRequest) returns (QueryClientCustomerHospitalRecordsByConditionRpcResponse) {}
44 rpc CreateClientCustomerHospitalRecord (CreateClientCustomerHospitalRecordRpcRequest) returns (CreateClientCustomerHospitalRecordRpcResponse) {} 45 rpc CreateClientCustomerHospitalRecord (CreateClientCustomerHospitalRecordRpcRequest) returns (CreateClientCustomerHospitalRecordRpcResponse) {}
45 rpc BatchCreateClientCustomerHospitalRecords (BatchCreateClientCustomerHospitalRecordsRpcRequest) returns (BatchCreateClientCustomerHospitalRecordsRpcResponse) {} 46 rpc BatchCreateClientCustomerHospitalRecords (BatchCreateClientCustomerHospitalRecordsRpcRequest) returns (BatchCreateClientCustomerHospitalRecordsRpcResponse) {}
...@@ -385,6 +386,16 @@ message GetClientCustomerHospitalRecordsByCustomerIdsRpcResponse { ...@@ -385,6 +386,16 @@ message GetClientCustomerHospitalRecordsByCustomerIdsRpcResponse {
385 repeated SingleClientCustomerHospitalRecordRpcResponse responses = 1; 386 repeated SingleClientCustomerHospitalRecordRpcResponse responses = 1;
386 } 387 }
387 388
389 +message GetClientCustomerHospitalRecordsByHISCustomerIdsRpcRequest {
390 + repeated string HISCustomerIds = 1;
391 + int32 enterpriseId = 2;
392 + bool includeDeleted = 3;
393 +}
394 +
395 +message GetClientCustomerHospitalRecordsByHISCustomerIdsRpcResponse {
396 + repeated SingleClientCustomerHospitalRecordRpcResponse responses = 1;
397 +}
398 +
388 message QueryClientCustomerHospitalRecordsByConditionRpcRequest { 399 message QueryClientCustomerHospitalRecordsByConditionRpcRequest {
389 int32 enterpriseId = 1; 400 int32 enterpriseId = 1;
390 bool shouldFilterClientIds = 2; 401 bool shouldFilterClientIds = 2;
......
...@@ -58,7 +58,7 @@ grpc.meal-service.port=3017 ...@@ -58,7 +58,7 @@ grpc.meal-service.port=3017
58 grpc.delivery-service.url=47.101.193.136 58 grpc.delivery-service.url=47.101.193.136
59 grpc.delivery-service.port=3017 59 grpc.delivery-service.port=3017
60 60
61 -grpc.operator-service.url=47.101.193.136 61 +grpc.operator-service.url=115.190.92.112
62 grpc.operator-service.port=3031 62 grpc.operator-service.port=3031
63 63
64 grpc.woperator-service.url=47.101.193.136 64 grpc.woperator-service.url=47.101.193.136
...@@ -67,6 +67,9 @@ grpc.woperator-service.port=3028 ...@@ -67,6 +67,9 @@ grpc.woperator-service.port=3028
67 grpc.enterprise-resource-service.url=47.101.193.136 67 grpc.enterprise-resource-service.url=47.101.193.136
68 grpc.enterprise-resource-service.port=3026 68 grpc.enterprise-resource-service.port=3026
69 69
70 +grpc.client-resource-service.url=47.101.193.136
71 +grpc.client-resource-service.port=3019
72 +
70 grpc.meizhongyihe-service.url=47.101.193.136 73 grpc.meizhongyihe-service.url=47.101.193.136
71 grpc.meizhongyihe-service.port=3040 74 grpc.meizhongyihe-service.port=3040
72 75
......