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-04-15 18:28:14 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c5665e07efe44bda8aa7e7f7d2611d4fa7a9ff71
c5665e07
1 parent
efb9ed0b
fix
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
4 deletions
src/main/java/com/infoloop/tianting/intercepter/LoginInterceptor.java
src/main/java/com/infoloop/tianting/service/client/MealOrderServiceRpcClient.java
src/main/java/com/infoloop/tianting/service/impl/LoginServiceImpl.java
src/main/java/com/infoloop/tianting/intercepter/LoginInterceptor.java
View file @
c5665e0
...
...
@@ -70,6 +70,7 @@ public class LoginInterceptor implements HandlerInterceptor {
StpUtil
.
checkLogin
();
final
var
enterpriseId
=
Convert
.
toInt
(
StpUtil
.
getExtra
(
CommonConstants
.
ENTERPRISE_ID
));
final
var
loginSource
=
Convert
.
toInt
(
StpUtil
.
getExtra
(
CommonConstants
.
LOGIN_SOURCE
));
final
var
userId
=
StpUtil
.
getExtra
(
CommonConstants
.
USER_ID
);
if
(
loginSource
.
equals
(
LoginSourceEnum
.
CUSTOMER
.
getValue
()))
{
final
var
openId
=
Convert
.
toStr
(
StpUtil
.
getExtra
(
CommonConstants
.
OPEN_ID
));
final
var
loginId
=
StpUtil
.
getLoginIdAsInt
();
...
...
@@ -115,8 +116,7 @@ public class LoginInterceptor implements HandlerInterceptor {
builder
.
id
(
loginId
).
enterpriseId
(
enterpriseId
).
name
(
operator
.
getName
()).
loginSource
(
LoginSourceEnum
.
KDS
);
return
true
;
}
else
{
final
var
loginId
=
StpUtil
.
getLoginIdAsString
();
builder
.
openId
(
loginId
).
enterpriseId
(
enterpriseId
).
loginSource
(
LoginSourceEnum
.
MINI_PROGRAM
);
builder
.
id
(
userId
==
null
?
null
:
Convert
.
toInt
(
userId
)).
openId
(
StpUtil
.
getLoginIdAsString
()).
enterpriseId
(
enterpriseId
).
loginSource
(
LoginSourceEnum
.
MINI_PROGRAM
);
return
true
;
}
}
...
...
src/main/java/com/infoloop/tianting/service/client/MealOrderServiceRpcClient.java
View file @
c5665e0
...
...
@@ -123,6 +123,9 @@ public class MealOrderServiceRpcClient {
}
public
List
<
SingleDinerRpcResponse
>
getDinersByIds
(
int
enterpriseId
,
List
<
Integer
>
dinerIds
)
{
if
(
CollectionUtils
.
isEmpty
(
dinerIds
))
{
return
Collections
.
emptyList
();
}
return
mealOrderServiceRpcBlockingStub
.
getDinersByIds
(
GetDinersByIdsRpcRequest
.
newBuilder
()
.
setEnterpriseId
(
enterpriseId
)
.
addAllIds
(
dinerIds
)
...
...
@@ -148,6 +151,9 @@ public class MealOrderServiceRpcClient {
}
public
List
<
SingleGradeClassRpcResponse
>
getGradeClassesByIds
(
int
enterpriseId
,
List
<
Integer
>
gradeClassIds
)
{
if
(
CollectionUtils
.
isEmpty
(
gradeClassIds
))
{
return
Collections
.
emptyList
();
}
return
mealOrderServiceRpcBlockingStub
.
getGradeClassesByIds
(
GetGradeClassesByIdsRpcRequest
.
newBuilder
()
.
setEnterpriseId
(
enterpriseId
)
.
addAllIds
(
gradeClassIds
)
...
...
@@ -167,6 +173,9 @@ public class MealOrderServiceRpcClient {
}
public
List
<
SingleMealOrderRpcResponse
>
queryReserveMealOrdersByDinerIds
(
int
enterpriseId
,
List
<
Integer
>
dinerIds
)
{
if
(
CollectionUtils
.
isEmpty
(
dinerIds
))
{
return
Collections
.
emptyList
();
}
return
mealOrderServiceRpcBlockingStub
.
queryReserveMealOrdersByDinerIds
(
QueryReserveMealOrdersByDinerIdsRpcRequest
.
newBuilder
()
.
setEnterpriseId
(
enterpriseId
)
.
addAllDinerIds
(
dinerIds
)
...
...
@@ -201,6 +210,9 @@ public class MealOrderServiceRpcClient {
}
public
boolean
deleteMpAccountDinerRefsByIds
(
int
enterpriseId
,
List
<
Integer
>
ids
)
{
if
(
CollectionUtils
.
isEmpty
(
ids
))
{
return
false
;
}
return
mealOrderServiceRpcBlockingStub
.
deleteMpAccountDinerRefsByIds
(
DeleteMpAccountDinerRefsByIdsRpcRequest
.
newBuilder
()
.
setEnterpriseId
(
enterpriseId
)
.
addAllIds
(
ids
)
...
...
@@ -215,6 +227,9 @@ public class MealOrderServiceRpcClient {
}
public
List
<
SingleMealMenuRecordRpcResponse
>
queryLatestMealMenuRecordsByClientIds
(
int
enterpriseId
,
List
<
Integer
>
ids
)
{
if
(
CollectionUtils
.
isEmpty
(
ids
))
{
return
Collections
.
emptyList
();
}
return
mealOrderServiceRpcBlockingStub
.
queryLatestMealMenuRecordsByClientIds
(
QueryLatestMealMenuRecordsByClientIdsRpcRequest
.
newBuilder
()
.
setEnterpriseId
(
enterpriseId
)
.
addAllClientId
(
ids
)
...
...
src/main/java/com/infoloop/tianting/service/impl/LoginServiceImpl.java
View file @
c5665e0
...
...
@@ -66,9 +66,10 @@ public class LoginServiceImpl implements LoginService {
}
else
{
mpAccountId
=
mpAccountByOpenId
.
getId
();
}
Assert
.
isTrue
(
mpAccountId
=
=
0
,
"创建小程序账号失败"
);
StpUtil
.
login
(
mpAccountId
,
SaLoginModel
.
create
()
Assert
.
isTrue
(
mpAccountId
!
=
0
,
"创建小程序账号失败"
);
StpUtil
.
login
(
loginDto
.
getOpenId
()
,
SaLoginModel
.
create
()
.
setExtra
(
CommonConstants
.
ENTERPRISE_ID
,
loginDto
.
getEnterpriseId
())
.
setExtra
(
CommonConstants
.
USER_ID
,
mpAccountId
)
.
setExtra
(
CommonConstants
.
LOGIN_SOURCE
,
loginDto
.
getLoginSourceEnum
().
getValue
())
.
build
());
return
StpUtil
.
getTokenInfo
();
...
...
Please
register
or
login
to post a comment