Toggle navigation
Toggle navigation
This project
Loading...
Sign in
jiujian
/
client-customer-order-api
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
zhuyifan
2025-03-04 11:23:35 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
79ef5f28d115ae2d7d7451f70afd9b88b5cba4c7
79ef5f28
1 parent
0eb3eb06
feat(customer): 添加通过 hisCustomerNo 查询客户信息接口
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
140 additions
and
8 deletions
src/main/java/com/infoloop/tianting/controller/ClientCustomerController.java
src/main/java/com/infoloop/tianting/model/dto/PermissionDTO.java
src/main/java/com/infoloop/tianting/service/ClientCustomerService.java
src/main/java/com/infoloop/tianting/service/client/ClientCustomerServiceRpcClient.java
src/main/java/com/infoloop/tianting/service/client/OrderServiceRpcClient.java
src/main/java/com/infoloop/tianting/service/impl/ClientCustomerServiceImpl.java
src/main/java/com/infoloop/tianting/service/impl/LoginServiceImpl.java
src/main/proto/ClientCustomerService.proto
src/main/java/com/infoloop/tianting/controller/ClientCustomerController.java
View file @
79ef5f2
...
...
@@ -37,6 +37,13 @@ public class ClientCustomerController {
return
clientCustomerService
.
getClientCustomerByHISCustomerId
(
hisCustomerId
);
}
@ApiOperation
(
value
=
"根据hisCustomerNo获取ClientCustomer"
)
@GetMapping
(
"/his/customer/{hisCustomerNo}"
)
@ResponseStatus
(
HttpStatus
.
OK
)
public
ClientCustomerDto
getClientCustomerByHISCustomerNo
(
@PathVariable
String
hisCustomerNo
)
{
return
clientCustomerService
.
getClientCustomerByHISCustomerNo
(
hisCustomerNo
);
}
@ApiOperation
(
value
=
"根据customerId获取ClientCustomer"
)
@GetMapping
(
"/customers/{customerId}"
)
@ResponseStatus
(
HttpStatus
.
OK
)
...
...
src/main/java/com/infoloop/tianting/model/dto/PermissionDTO.java
View file @
79ef5f2
...
...
@@ -3,7 +3,6 @@ package com.infoloop.tianting.model.dto;
import
com.infoloop.tianting.enums.LoginSourceEnum
;
import
io.swagger.annotations.ApiModel
;
import
lombok.Builder
;
import
lombok.Builder.Default
;
import
lombok.Data
;
@Data
...
...
@@ -16,9 +15,9 @@ public class PermissionDTO {
public
static
class
LoginDto
{
private
LoginSourceEnum
loginSourceEnum
;
@Builder
.
Default
private
boolean
shouldLoginWithHisCustomer
Id
=
false
;
private
boolean
shouldLoginWithHisCustomer
No
=
false
;
@Builder
.
Default
private
String
hisCustomer
Id
=
""
;
private
String
hisCustomer
No
=
""
;
@Builder
.
Default
private
boolean
shouldLoginWithOperatorPhone
=
false
;
@Builder
.
Default
...
...
src/main/java/com/infoloop/tianting/service/ClientCustomerService.java
View file @
79ef5f2
...
...
@@ -8,6 +8,7 @@ import com.infoloop.tianting.model.dto.ClientLabelDTO.BatchCreateCustomerLabelRe
import
com.infoloop.tianting.model.dto.ClientLabelDTO.BatchDeleteCustomerLabelRefRequestDto
;
import
com.infoloop.tianting.model.dto.ClientLabelDTO.BatchDeleteCustomerLabelRefResponseDto
;
import
com.infoloop.tianting.model.dto.ClientLabelDTO.CustomerLabelRefDetailDto
;
import
java.util.List
;
public
interface
ClientCustomerService
{
...
...
@@ -34,4 +35,5 @@ public interface ClientCustomerService {
TodayOrderDto
getTodayOrderStatisticForHis
(
String
token
);
ClientCustomerDto
getClientCustomerByHISCustomerNo
(
String
hisCustomerNo
);
}
...
...
src/main/java/com/infoloop/tianting/service/client/ClientCustomerServiceRpcClient.java
View file @
79ef5f2
...
...
@@ -10,6 +10,8 @@ import com.infoloop.tianting.clientcustomerservice.GetClientCustomerByContactNoR
import
com.infoloop.tianting.clientcustomerservice.GetClientCustomerByContactNoRpcResponse
;
import
com.infoloop.tianting.clientcustomerservice.GetClientCustomerByHISCustomerIdRpcRequest
;
import
com.infoloop.tianting.clientcustomerservice.GetClientCustomerByHISCustomerIdRpcResponse
;
import
com.infoloop.tianting.clientcustomerservice.GetClientCustomerByHISCustomerNoRpcRequest
;
import
com.infoloop.tianting.clientcustomerservice.GetClientCustomerByHISCustomerNoRpcResponse
;
import
com.infoloop.tianting.clientcustomerservice.GetClientCustomerByIdRpcRequest
;
import
com.infoloop.tianting.clientcustomerservice.GetClientCustomerByIdRpcResponse
;
import
com.infoloop.tianting.clientcustomerservice.GetClientCustomerByMobileRpcRequest
;
...
...
@@ -47,6 +49,15 @@ public class ClientCustomerServiceRpcClient {
return
clientCustomerServiceRpcBlockingStub
.
getClientCustomerByHISCustomerId
(
request
);
}
public
GetClientCustomerByHISCustomerNoRpcResponse
getClientCustomerByHISCustomerNo
(
String
hisCustomerNo
)
{
final
var
request
=
GetClientCustomerByHISCustomerNoRpcRequest
.
newBuilder
()
.
setHISCustomerNo
(
hisCustomerNo
)
.
build
();
return
clientCustomerServiceRpcBlockingStub
.
getClientCustomerByHISCustomerNo
(
request
);
}
public
GetClientCustomersByHISCustomerIdsRpcResponse
getClientCustomersByHISCustomerIds
(
List
<
String
>
hisCustomerIds
)
{
...
...
src/main/java/com/infoloop/tianting/service/client/OrderServiceRpcClient.java
View file @
79ef5f2
...
...
@@ -553,7 +553,7 @@ public class OrderServiceRpcClient {
.
setMenuId
(
createOrderDto
.
getMenuId
())
.
setTotalNum
(
createOrderDto
.
getTotalNum
())
.
setPayPrice
(
createOrderDto
.
getPayPrice
())
.
setMealTime
(
LocalDate
.
now
().
atStartOfDay
().
toInstant
(
ZoneOffset
.
UTC
).
toEpochMilli
())
.
setMealTime
(
createOrderDto
.
getMealTime
().
toLocalDate
().
atStartOfDay
().
toInstant
(
ZoneOffset
.
UTC
).
toEpochMilli
())
.
setShouldCreateTableCode
(
createOrderDto
.
getCloseTimeType
().
equals
(
CloseTimeType
.
IMMEDIATELY
))
.
setShouldCreatePickupCode
(
createOrderDto
.
getCloseTimeType
().
equals
(
CloseTimeType
.
IMMEDIATELY
))
.
setPickupCode
(
generatePickupCode
())
...
...
src/main/java/com/infoloop/tianting/service/impl/ClientCustomerServiceImpl.java
View file @
79ef5f2
...
...
@@ -547,4 +547,32 @@ public class ClientCustomerServiceImpl implements ClientCustomerService {
.
build
();
}
@Override
public
ClientCustomerDto
getClientCustomerByHISCustomerNo
(
String
hisCustomerNo
)
{
var
response
=
clientCustomerServiceRpcClient
.
getClientCustomerByHISCustomerNo
(
hisCustomerNo
).
getResponse
();
return
ClientCustomerDto
.
builder
()
.
id
(
response
.
getId
())
.
clientId
(
response
.
getClientId
())
.
enterpriseId
(
response
.
getEnterpriseId
())
.
age
(
response
.
getAge
())
.
height
(
response
.
getHeight
())
.
HISCustomerId
(
response
.
getHISCustomerId
())
.
identityCardNo
(
response
.
getIdentityCardNo
())
.
mobile
(
response
.
getMobile
())
.
name
(
response
.
getName
())
.
openId
(
response
.
getOpenId
())
.
sex
(
response
.
getSex
())
.
stallId
(
response
.
getStallId
())
.
weight
(
response
.
getWeight
())
.
isDeleted
(
response
.
getIsDeleted
())
.
birthday
(
DateUtil
.
formatDate
(
response
.
getBirthday
()))
.
createdAt
(
DateUtil
.
formatDate
(
response
.
getCreatedAt
()))
.
createdBy
(
response
.
getCreatedBy
())
.
creationSource
(
response
.
getCreationSource
())
.
updatedAt
(
DateUtil
.
formatDate
(
response
.
getUpdatedAt
()))
.
updateSource
(
response
.
getUpdateSource
())
.
updatedBy
(
response
.
getUpdatedBy
())
.
build
();
}
}
...
...
src/main/java/com/infoloop/tianting/service/impl/LoginServiceImpl.java
View file @
79ef5f2
...
...
@@ -40,11 +40,11 @@ public class LoginServiceImpl implements LoginService {
.
setExtra
(
CommonConstants
.
LOGIN_SOURCE
,
loginDto
.
getLoginSourceEnum
().
getValue
())
.
build
());
return
StpUtil
.
getTokenInfo
();
}
else
if
(
loginDto
.
isShouldLoginWithHisCustomer
Id
())
{
var
customer
=
clientCustomerServiceRpcClient
.
getClientCustomerByHISCustomer
Id
(
loginDto
.
getHisCustomerId
()).
getResponse
();
}
else
if
(
loginDto
.
isShouldLoginWithHisCustomer
No
())
{
var
customer
=
clientCustomerServiceRpcClient
.
getClientCustomerByHISCustomer
No
(
loginDto
.
getHisCustomerNo
()).
getResponse
();
if
(
customer
.
getId
()
==
0
)
{
// 根据hisCustomer
Id
拿不到用户的话再去根据合同号去his查一次,即认为是月子中心客户
customer
=
clientCustomerServiceRpcClient
.
getClientCustomerByContactNo
(
loginDto
.
getHisCustomer
Id
()).
getResponse
();
// 根据hisCustomer
No
拿不到用户的话再去根据合同号去his查一次,即认为是月子中心客户
customer
=
clientCustomerServiceRpcClient
.
getClientCustomerByContactNo
(
loginDto
.
getHisCustomer
No
()).
getResponse
();
if
(
customer
.
getId
()
==
0
)
{
throw
ClientEndExceptions
.
IncorrectRequestValue
.
build
(
ErrorCodeEnum
.
VALIDATE_FAILED
.
name
());
}
else
{
...
...
src/main/proto/ClientCustomerService.proto
View file @
79ef5f2
...
...
@@ -13,6 +13,8 @@ service ClientCustomerServiceRpc {
rpc
GetClientCustomerById
(
GetClientCustomerByIdRpcRequest
)
returns
(
GetClientCustomerByIdRpcResponse
)
{}
//HIS客户
rpc
GetClientCustomerByHISCustomerId
(
GetClientCustomerByHISCustomerIdRpcRequest
)
returns
(
GetClientCustomerByHISCustomerIdRpcResponse
)
{}
//腕带号获取客户
rpc
GetClientCustomerByHISCustomerNo
(
GetClientCustomerByHISCustomerNoRpcRequest
)
returns
(
GetClientCustomerByHISCustomerNoRpcResponse
)
{}
//HIS客户
rpc
GetClientCustomersByHISCustomerIds
(
GetClientCustomersByHISCustomerIdsRpcRequest
)
returns
(
GetClientCustomersByHISCustomerIdsRpcResponse
)
{}
//月子中心客户
...
...
@@ -52,6 +54,11 @@ service ClientCustomerServiceRpc {
rpc
BatchCreateClientCustomerLabelRefs
(
BatchCreateClientCustomerLabelRefsRpcRequest
)
returns
(
BatchCreateClientCustomerLabelRefsRpcResponse
)
{}
rpc
DeleteClientCustomerLabelRefsByIds
(
DeleteClientCustomerLabelRefsByIdsRpcRequest
)
returns
(
DeleteClientCustomerLabelRefsRpcResponse
)
{}
rpc
DeleteClientCustomerLabelRefsByLabelIds
(
DeleteClientCustomerLabelRefsByLabelIdsRpcRequest
)
returns
(
DeleteClientCustomerLabelRefsByLabelIdsRpcResponse
)
{}
//客户操作记录
rpc
QueryClientCustomerOperationRecordsByCondition
(
QueryClientCustomerOperationRecordsByConditionRpcRequest
)
returns
(
QueryClientCustomerOperationRecordsByConditionRpcResponse
)
{}
rpc
CreateClientCustomerOperationRecord
(
CreateClientCustomerOperationRecordRpcRequest
)
returns
(
CreateClientCustomerOperationRecordRpcResponse
)
{}
rpc
BatchCreateClientCustomerOperationRecords
(
BatchCreateClientCustomerOperationRecordsRpcRequest
)
returns
(
BatchCreateClientCustomerOperationRecordsRpcResponse
)
{}
}
enum
ClientCustomerSexEnum
{
...
...
@@ -82,6 +89,7 @@ message SingleClientCustomerRpcResponse {
bool
isDeleted
=
19
;
int32
stallId
=
20
;
string
openId
=
21
;
string
HISCustomerNo
=
22
;
}
message
GetClientCustomerByIdRpcRequest
{
...
...
@@ -102,6 +110,14 @@ message GetClientCustomerByHISCustomerIdRpcResponse {
SingleClientCustomerRpcResponse
response
=
1
;
}
message
GetClientCustomerByHISCustomerNoRpcRequest
{
string
HISCustomerNo
=
1
;
}
message
GetClientCustomerByHISCustomerNoRpcResponse
{
SingleClientCustomerRpcResponse
response
=
1
;
}
message
GetClientCustomersByHISCustomerIdsRpcRequest
{
repeated
string
HISCustomerIds
=
1
;
}
...
...
@@ -200,6 +216,8 @@ message ClientCustomerCreation{
int32
stallId
=
16
;
bool
shouldCreateOpenId
=
17
;
string
openId
=
18
;
bool
shouldCreateHISCustomerNo
=
19
;
string
HISCustomerNo
=
20
;
}
message
CreateClientCustomerRpcRequest
{
...
...
@@ -598,3 +616,70 @@ message DeleteClientCustomerLabelRefsByLabelIdsRpcRequest {
message
DeleteClientCustomerLabelRefsByLabelIdsRpcResponse
{
bool
isDeleted
=
1
;
}
enum
ClientCustomerOperationRecordTypeEnum
{
CLIENT_CUSTOMER_OPERATION_RECORD_TYPE_UNKNOWN
=
0
;
CLIENT_CUSTOMER_OPERATION_RECORD_TYPE_CREATE
=
1
;
CLIENT_CUSTOMER_OPERATION_RECORD_TYPE_UPDATE
=
2
;
CLIENT_CUSTOMER_OPERATION_RECORD_TYPE_BIND_MENUS
=
3
;
CLIENT_CUSTOMER_OPERATION_RECORD_TYPE_LEAVE_HOSPITAL
=
4
;
}
message
SingleClientCustomerOperationRecordRpcResponse
{
int32
id
=
1
;
int32
enterpriseId
=
2
;
int32
clientCustomerId
=
3
;
ClientCustomerOperationRecordTypeEnum
type
=
4
;
string
originalJson
=
5
;
string
adjustJson
=
6
;
string
operator
=
7
;
int32
createdBy
=
8
;
int64
createdAt
=
9
;
int32
creationSource
=
10
;
}
message
QueryClientCustomerOperationRecordsByConditionRpcRequest
{
int32
enterpriseId
=
1
;
bool
shouldFilterClientCustomerIds
=
2
;
repeated
int32
clientCustomerIds
=
3
;
bool
shouldFilterType
=
4
;
ClientCustomerOperationRecordTypeEnum
type
=
5
;
}
message
QueryClientCustomerOperationRecordsByConditionRpcResponse
{
repeated
SingleClientCustomerOperationRecordRpcResponse
responses
=
1
;
}
message
ClientCustomerOperationRecordCreation
{
int32
clientCustomerId
=
1
;
ClientCustomerOperationRecordTypeEnum
type
=
2
;
bool
shouldCreateOriginalJson
=
3
;
string
originalJson
=
4
;
bool
shouldCreateAdjustJson
=
5
;
string
adjustJson
=
6
;
string
operator
=
7
;
}
message
CreateClientCustomerOperationRecordRpcRequest
{
ClientCustomerOperationRecordCreation
creation
=
1
;
int32
enterpriseId
=
2
;
int32
createdBy
=
3
;
int32
creationSource
=
4
;
}
message
CreateClientCustomerOperationRecordRpcResponse
{
int32
id
=
1
;
bool
isCreated
=
2
;
}
message
BatchCreateClientCustomerOperationRecordsRpcRequest
{
repeated
ClientCustomerOperationRecordCreation
creations
=
1
;
int32
enterpriseId
=
2
;
int32
createdBy
=
3
;
int32
creationSource
=
4
;
}
message
BatchCreateClientCustomerOperationRecordsRpcResponse
{
repeated
int32
ids
=
1
;
bool
isCreated
=
2
;
}
...
...
Please
register
or
login
to post a comment