zhuyifan

feat(customer): 添加通过 hisCustomerNo 查询客户信息接口

...@@ -37,6 +37,13 @@ public class ClientCustomerController { ...@@ -37,6 +37,13 @@ public class ClientCustomerController {
37 return clientCustomerService.getClientCustomerByHISCustomerId(hisCustomerId); 37 return clientCustomerService.getClientCustomerByHISCustomerId(hisCustomerId);
38 } 38 }
39 39
40 + @ApiOperation(value = "根据hisCustomerNo获取ClientCustomer")
41 + @GetMapping("/his/customer/{hisCustomerNo}")
42 + @ResponseStatus(HttpStatus.OK)
43 + public ClientCustomerDto getClientCustomerByHISCustomerNo(@PathVariable String hisCustomerNo) {
44 + return clientCustomerService.getClientCustomerByHISCustomerNo(hisCustomerNo);
45 + }
46 +
40 @ApiOperation(value = "根据customerId获取ClientCustomer") 47 @ApiOperation(value = "根据customerId获取ClientCustomer")
41 @GetMapping("/customers/{customerId}") 48 @GetMapping("/customers/{customerId}")
42 @ResponseStatus(HttpStatus.OK) 49 @ResponseStatus(HttpStatus.OK)
......
...@@ -3,7 +3,6 @@ package com.infoloop.tianting.model.dto; ...@@ -3,7 +3,6 @@ package com.infoloop.tianting.model.dto;
3 import com.infoloop.tianting.enums.LoginSourceEnum; 3 import com.infoloop.tianting.enums.LoginSourceEnum;
4 import io.swagger.annotations.ApiModel; 4 import io.swagger.annotations.ApiModel;
5 import lombok.Builder; 5 import lombok.Builder;
6 -import lombok.Builder.Default;
7 import lombok.Data; 6 import lombok.Data;
8 7
9 @Data 8 @Data
...@@ -16,9 +15,9 @@ public class PermissionDTO { ...@@ -16,9 +15,9 @@ public class PermissionDTO {
16 public static class LoginDto { 15 public static class LoginDto {
17 private LoginSourceEnum loginSourceEnum; 16 private LoginSourceEnum loginSourceEnum;
18 @Builder.Default 17 @Builder.Default
19 - private boolean shouldLoginWithHisCustomerId = false; 18 + private boolean shouldLoginWithHisCustomerNo = false;
20 @Builder.Default 19 @Builder.Default
21 - private String hisCustomerId = ""; 20 + private String hisCustomerNo = "";
22 @Builder.Default 21 @Builder.Default
23 private boolean shouldLoginWithOperatorPhone = false; 22 private boolean shouldLoginWithOperatorPhone = false;
24 @Builder.Default 23 @Builder.Default
......
...@@ -8,6 +8,7 @@ import com.infoloop.tianting.model.dto.ClientLabelDTO.BatchCreateCustomerLabelRe ...@@ -8,6 +8,7 @@ import com.infoloop.tianting.model.dto.ClientLabelDTO.BatchCreateCustomerLabelRe
8 import com.infoloop.tianting.model.dto.ClientLabelDTO.BatchDeleteCustomerLabelRefRequestDto; 8 import com.infoloop.tianting.model.dto.ClientLabelDTO.BatchDeleteCustomerLabelRefRequestDto;
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 import java.util.List; 12 import java.util.List;
12 13
13 public interface ClientCustomerService { 14 public interface ClientCustomerService {
...@@ -34,4 +35,5 @@ public interface ClientCustomerService { ...@@ -34,4 +35,5 @@ public interface ClientCustomerService {
34 35
35 TodayOrderDto getTodayOrderStatisticForHis(String token); 36 TodayOrderDto getTodayOrderStatisticForHis(String token);
36 37
38 + ClientCustomerDto getClientCustomerByHISCustomerNo(String hisCustomerNo);
37 } 39 }
......
...@@ -10,6 +10,8 @@ import com.infoloop.tianting.clientcustomerservice.GetClientCustomerByContactNoR ...@@ -10,6 +10,8 @@ import com.infoloop.tianting.clientcustomerservice.GetClientCustomerByContactNoR
10 import com.infoloop.tianting.clientcustomerservice.GetClientCustomerByContactNoRpcResponse; 10 import com.infoloop.tianting.clientcustomerservice.GetClientCustomerByContactNoRpcResponse;
11 import com.infoloop.tianting.clientcustomerservice.GetClientCustomerByHISCustomerIdRpcRequest; 11 import com.infoloop.tianting.clientcustomerservice.GetClientCustomerByHISCustomerIdRpcRequest;
12 import com.infoloop.tianting.clientcustomerservice.GetClientCustomerByHISCustomerIdRpcResponse; 12 import com.infoloop.tianting.clientcustomerservice.GetClientCustomerByHISCustomerIdRpcResponse;
13 +import com.infoloop.tianting.clientcustomerservice.GetClientCustomerByHISCustomerNoRpcRequest;
14 +import com.infoloop.tianting.clientcustomerservice.GetClientCustomerByHISCustomerNoRpcResponse;
13 import com.infoloop.tianting.clientcustomerservice.GetClientCustomerByIdRpcRequest; 15 import com.infoloop.tianting.clientcustomerservice.GetClientCustomerByIdRpcRequest;
14 import com.infoloop.tianting.clientcustomerservice.GetClientCustomerByIdRpcResponse; 16 import com.infoloop.tianting.clientcustomerservice.GetClientCustomerByIdRpcResponse;
15 import com.infoloop.tianting.clientcustomerservice.GetClientCustomerByMobileRpcRequest; 17 import com.infoloop.tianting.clientcustomerservice.GetClientCustomerByMobileRpcRequest;
...@@ -47,6 +49,15 @@ public class ClientCustomerServiceRpcClient { ...@@ -47,6 +49,15 @@ public class ClientCustomerServiceRpcClient {
47 return clientCustomerServiceRpcBlockingStub.getClientCustomerByHISCustomerId(request); 49 return clientCustomerServiceRpcBlockingStub.getClientCustomerByHISCustomerId(request);
48 } 50 }
49 51
52 + public GetClientCustomerByHISCustomerNoRpcResponse getClientCustomerByHISCustomerNo(
53 + String hisCustomerNo
54 + ) {
55 + final var request = GetClientCustomerByHISCustomerNoRpcRequest.newBuilder()
56 + .setHISCustomerNo(hisCustomerNo)
57 + .build();
58 + return clientCustomerServiceRpcBlockingStub.getClientCustomerByHISCustomerNo(request);
59 + }
60 +
50 public GetClientCustomersByHISCustomerIdsRpcResponse getClientCustomersByHISCustomerIds( 61 public GetClientCustomersByHISCustomerIdsRpcResponse getClientCustomersByHISCustomerIds(
51 List<String> hisCustomerIds 62 List<String> hisCustomerIds
52 ) { 63 ) {
......
...@@ -553,7 +553,7 @@ public class OrderServiceRpcClient { ...@@ -553,7 +553,7 @@ public class OrderServiceRpcClient {
553 .setMenuId(createOrderDto.getMenuId()) 553 .setMenuId(createOrderDto.getMenuId())
554 .setTotalNum(createOrderDto.getTotalNum()) 554 .setTotalNum(createOrderDto.getTotalNum())
555 .setPayPrice(createOrderDto.getPayPrice()) 555 .setPayPrice(createOrderDto.getPayPrice())
556 - .setMealTime(LocalDate.now().atStartOfDay().toInstant(ZoneOffset.UTC).toEpochMilli()) 556 + .setMealTime(createOrderDto.getMealTime().toLocalDate().atStartOfDay().toInstant(ZoneOffset.UTC).toEpochMilli())
557 .setShouldCreateTableCode(createOrderDto.getCloseTimeType().equals(CloseTimeType.IMMEDIATELY)) 557 .setShouldCreateTableCode(createOrderDto.getCloseTimeType().equals(CloseTimeType.IMMEDIATELY))
558 .setShouldCreatePickupCode(createOrderDto.getCloseTimeType().equals(CloseTimeType.IMMEDIATELY)) 558 .setShouldCreatePickupCode(createOrderDto.getCloseTimeType().equals(CloseTimeType.IMMEDIATELY))
559 .setPickupCode(generatePickupCode()) 559 .setPickupCode(generatePickupCode())
......
...@@ -547,4 +547,32 @@ public class ClientCustomerServiceImpl implements ClientCustomerService { ...@@ -547,4 +547,32 @@ public class ClientCustomerServiceImpl implements ClientCustomerService {
547 .build(); 547 .build();
548 } 548 }
549 549
550 + @Override
551 + public ClientCustomerDto getClientCustomerByHISCustomerNo(String hisCustomerNo) {
552 + var response = clientCustomerServiceRpcClient.getClientCustomerByHISCustomerNo(hisCustomerNo).getResponse();
553 + return ClientCustomerDto.builder()
554 + .id(response.getId())
555 + .clientId(response.getClientId())
556 + .enterpriseId(response.getEnterpriseId())
557 + .age(response.getAge())
558 + .height(response.getHeight())
559 + .HISCustomerId(response.getHISCustomerId())
560 + .identityCardNo(response.getIdentityCardNo())
561 + .mobile(response.getMobile())
562 + .name(response.getName())
563 + .openId(response.getOpenId())
564 + .sex(response.getSex())
565 + .stallId(response.getStallId())
566 + .weight(response.getWeight())
567 + .isDeleted(response.getIsDeleted())
568 + .birthday(DateUtil.formatDate(response.getBirthday()))
569 + .createdAt(DateUtil.formatDate(response.getCreatedAt()))
570 + .createdBy(response.getCreatedBy())
571 + .creationSource(response.getCreationSource())
572 + .updatedAt(DateUtil.formatDate(response.getUpdatedAt()))
573 + .updateSource(response.getUpdateSource())
574 + .updatedBy(response.getUpdatedBy())
575 + .build();
576 + }
577 +
550 } 578 }
......
...@@ -40,11 +40,11 @@ public class LoginServiceImpl implements LoginService { ...@@ -40,11 +40,11 @@ public class LoginServiceImpl implements LoginService {
40 .setExtra(CommonConstants.LOGIN_SOURCE, loginDto.getLoginSourceEnum().getValue()) 40 .setExtra(CommonConstants.LOGIN_SOURCE, loginDto.getLoginSourceEnum().getValue())
41 .build()); 41 .build());
42 return StpUtil.getTokenInfo(); 42 return StpUtil.getTokenInfo();
43 - } else if (loginDto.isShouldLoginWithHisCustomerId()) { 43 + } else if (loginDto.isShouldLoginWithHisCustomerNo()) {
44 - var customer = clientCustomerServiceRpcClient.getClientCustomerByHISCustomerId(loginDto.getHisCustomerId()).getResponse(); 44 + var customer = clientCustomerServiceRpcClient.getClientCustomerByHISCustomerNo(loginDto.getHisCustomerNo()).getResponse();
45 if (customer.getId() == 0) { 45 if (customer.getId() == 0) {
46 - // 根据hisCustomerId拿不到用户的话再去根据合同号去his查一次,即认为是月子中心客户 46 + // 根据hisCustomerNo拿不到用户的话再去根据合同号去his查一次,即认为是月子中心客户
47 - customer = clientCustomerServiceRpcClient.getClientCustomerByContactNo(loginDto.getHisCustomerId()).getResponse(); 47 + customer = clientCustomerServiceRpcClient.getClientCustomerByContactNo(loginDto.getHisCustomerNo()).getResponse();
48 if (customer.getId() == 0) { 48 if (customer.getId() == 0) {
49 throw ClientEndExceptions.IncorrectRequestValue.build(ErrorCodeEnum.VALIDATE_FAILED.name()); 49 throw ClientEndExceptions.IncorrectRequestValue.build(ErrorCodeEnum.VALIDATE_FAILED.name());
50 } else { 50 } else {
......
...@@ -13,6 +13,8 @@ service ClientCustomerServiceRpc { ...@@ -13,6 +13,8 @@ service ClientCustomerServiceRpc {
13 rpc GetClientCustomerById (GetClientCustomerByIdRpcRequest) returns (GetClientCustomerByIdRpcResponse) {} 13 rpc GetClientCustomerById (GetClientCustomerByIdRpcRequest) returns (GetClientCustomerByIdRpcResponse) {}
14 //HIS客户 14 //HIS客户
15 rpc GetClientCustomerByHISCustomerId (GetClientCustomerByHISCustomerIdRpcRequest) returns (GetClientCustomerByHISCustomerIdRpcResponse) {} 15 rpc GetClientCustomerByHISCustomerId (GetClientCustomerByHISCustomerIdRpcRequest) returns (GetClientCustomerByHISCustomerIdRpcResponse) {}
16 + //腕带号获取客户
17 + rpc GetClientCustomerByHISCustomerNo (GetClientCustomerByHISCustomerNoRpcRequest) returns (GetClientCustomerByHISCustomerNoRpcResponse) {}
16 //HIS客户 18 //HIS客户
17 rpc GetClientCustomersByHISCustomerIds (GetClientCustomersByHISCustomerIdsRpcRequest) returns (GetClientCustomersByHISCustomerIdsRpcResponse) {} 19 rpc GetClientCustomersByHISCustomerIds (GetClientCustomersByHISCustomerIdsRpcRequest) returns (GetClientCustomersByHISCustomerIdsRpcResponse) {}
18 //月子中心客户 20 //月子中心客户
...@@ -52,6 +54,11 @@ service ClientCustomerServiceRpc { ...@@ -52,6 +54,11 @@ service ClientCustomerServiceRpc {
52 rpc BatchCreateClientCustomerLabelRefs (BatchCreateClientCustomerLabelRefsRpcRequest) returns (BatchCreateClientCustomerLabelRefsRpcResponse) {} 54 rpc BatchCreateClientCustomerLabelRefs (BatchCreateClientCustomerLabelRefsRpcRequest) returns (BatchCreateClientCustomerLabelRefsRpcResponse) {}
53 rpc DeleteClientCustomerLabelRefsByIds (DeleteClientCustomerLabelRefsByIdsRpcRequest) returns (DeleteClientCustomerLabelRefsRpcResponse) {} 55 rpc DeleteClientCustomerLabelRefsByIds (DeleteClientCustomerLabelRefsByIdsRpcRequest) returns (DeleteClientCustomerLabelRefsRpcResponse) {}
54 rpc DeleteClientCustomerLabelRefsByLabelIds (DeleteClientCustomerLabelRefsByLabelIdsRpcRequest) returns (DeleteClientCustomerLabelRefsByLabelIdsRpcResponse) {} 56 rpc DeleteClientCustomerLabelRefsByLabelIds (DeleteClientCustomerLabelRefsByLabelIdsRpcRequest) returns (DeleteClientCustomerLabelRefsByLabelIdsRpcResponse) {}
57 +
58 + //客户操作记录
59 + rpc QueryClientCustomerOperationRecordsByCondition (QueryClientCustomerOperationRecordsByConditionRpcRequest) returns (QueryClientCustomerOperationRecordsByConditionRpcResponse) {}
60 + rpc CreateClientCustomerOperationRecord (CreateClientCustomerOperationRecordRpcRequest) returns (CreateClientCustomerOperationRecordRpcResponse) {}
61 + rpc BatchCreateClientCustomerOperationRecords (BatchCreateClientCustomerOperationRecordsRpcRequest) returns (BatchCreateClientCustomerOperationRecordsRpcResponse) {}
55 } 62 }
56 63
57 enum ClientCustomerSexEnum { 64 enum ClientCustomerSexEnum {
...@@ -82,6 +89,7 @@ message SingleClientCustomerRpcResponse { ...@@ -82,6 +89,7 @@ message SingleClientCustomerRpcResponse {
82 bool isDeleted = 19; 89 bool isDeleted = 19;
83 int32 stallId = 20; 90 int32 stallId = 20;
84 string openId = 21; 91 string openId = 21;
92 + string HISCustomerNo = 22;
85 } 93 }
86 94
87 message GetClientCustomerByIdRpcRequest { 95 message GetClientCustomerByIdRpcRequest {
...@@ -102,6 +110,14 @@ message GetClientCustomerByHISCustomerIdRpcResponse { ...@@ -102,6 +110,14 @@ message GetClientCustomerByHISCustomerIdRpcResponse {
102 SingleClientCustomerRpcResponse response = 1; 110 SingleClientCustomerRpcResponse response = 1;
103 } 111 }
104 112
113 +message GetClientCustomerByHISCustomerNoRpcRequest {
114 + string HISCustomerNo = 1;
115 +}
116 +
117 +message GetClientCustomerByHISCustomerNoRpcResponse {
118 + SingleClientCustomerRpcResponse response = 1;
119 +}
120 +
105 message GetClientCustomersByHISCustomerIdsRpcRequest { 121 message GetClientCustomersByHISCustomerIdsRpcRequest {
106 repeated string HISCustomerIds = 1; 122 repeated string HISCustomerIds = 1;
107 } 123 }
...@@ -200,6 +216,8 @@ message ClientCustomerCreation{ ...@@ -200,6 +216,8 @@ message ClientCustomerCreation{
200 int32 stallId = 16; 216 int32 stallId = 16;
201 bool shouldCreateOpenId = 17; 217 bool shouldCreateOpenId = 17;
202 string openId = 18; 218 string openId = 18;
219 + bool shouldCreateHISCustomerNo = 19;
220 + string HISCustomerNo = 20;
203 } 221 }
204 222
205 message CreateClientCustomerRpcRequest { 223 message CreateClientCustomerRpcRequest {
...@@ -598,3 +616,70 @@ message DeleteClientCustomerLabelRefsByLabelIdsRpcRequest { ...@@ -598,3 +616,70 @@ message DeleteClientCustomerLabelRefsByLabelIdsRpcRequest {
598 message DeleteClientCustomerLabelRefsByLabelIdsRpcResponse { 616 message DeleteClientCustomerLabelRefsByLabelIdsRpcResponse {
599 bool isDeleted = 1; 617 bool isDeleted = 1;
600 } 618 }
619 +
620 +enum ClientCustomerOperationRecordTypeEnum {
621 + CLIENT_CUSTOMER_OPERATION_RECORD_TYPE_UNKNOWN = 0;
622 + CLIENT_CUSTOMER_OPERATION_RECORD_TYPE_CREATE = 1;
623 + CLIENT_CUSTOMER_OPERATION_RECORD_TYPE_UPDATE = 2;
624 + CLIENT_CUSTOMER_OPERATION_RECORD_TYPE_BIND_MENUS = 3;
625 + CLIENT_CUSTOMER_OPERATION_RECORD_TYPE_LEAVE_HOSPITAL = 4;
626 +}
627 +
628 +message SingleClientCustomerOperationRecordRpcResponse {
629 + int32 id = 1;
630 + int32 enterpriseId = 2;
631 + int32 clientCustomerId = 3;
632 + ClientCustomerOperationRecordTypeEnum type = 4;
633 + string originalJson = 5;
634 + string adjustJson = 6;
635 + string operator = 7;
636 + int32 createdBy = 8;
637 + int64 createdAt = 9;
638 + int32 creationSource = 10;
639 +}
640 +
641 +message QueryClientCustomerOperationRecordsByConditionRpcRequest {
642 + int32 enterpriseId = 1;
643 + bool shouldFilterClientCustomerIds = 2;
644 + repeated int32 clientCustomerIds = 3;
645 + bool shouldFilterType = 4;
646 + ClientCustomerOperationRecordTypeEnum type = 5;
647 +}
648 +
649 +message QueryClientCustomerOperationRecordsByConditionRpcResponse {
650 + repeated SingleClientCustomerOperationRecordRpcResponse responses = 1;
651 +}
652 +
653 +message ClientCustomerOperationRecordCreation{
654 + int32 clientCustomerId = 1;
655 + ClientCustomerOperationRecordTypeEnum type = 2;
656 + bool shouldCreateOriginalJson = 3;
657 + string originalJson = 4;
658 + bool shouldCreateAdjustJson = 5;
659 + string adjustJson = 6;
660 + string operator = 7;
661 +}
662 +
663 +message CreateClientCustomerOperationRecordRpcRequest {
664 + ClientCustomerOperationRecordCreation creation = 1;
665 + int32 enterpriseId = 2;
666 + int32 createdBy = 3;
667 + int32 creationSource = 4;
668 +}
669 +
670 +message CreateClientCustomerOperationRecordRpcResponse {
671 + int32 id = 1;
672 + bool isCreated = 2;
673 +}
674 +
675 +message BatchCreateClientCustomerOperationRecordsRpcRequest {
676 + repeated ClientCustomerOperationRecordCreation creations = 1;
677 + int32 enterpriseId = 2;
678 + int32 createdBy = 3;
679 + int32 creationSource = 4;
680 +}
681 +
682 +message BatchCreateClientCustomerOperationRecordsRpcResponse {
683 + repeated int32 ids = 1;
684 + bool isCreated = 2;
685 +}
......