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
Jiaqi Xia
2025-06-09 23:01:29 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
5297a563763b812cc377a60d50f6d2f23921203a
5297a563
1 parent
69fd05a2
feat: add class-level meal suspension check and fix school level chcek
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
1 deletions
src/main/java/com/infoloop/tianting/service/impl/MealOrderServiceImpl.java
src/main/java/com/infoloop/tianting/service/impl/MealOrderServiceImpl.java
View file @
5297a56
...
...
@@ -115,6 +115,13 @@ public class MealOrderServiceImpl implements MealOrderService {
null
);
// 直接过滤出学校级别的停餐记录
if
(
schoolSuspensionRecords
!=
null
)
{
schoolSuspensionRecords
=
schoolSuspensionRecords
.
stream
()
.
filter
(
r
->
r
.
getClassId
()
==
0
&&
r
.
getDinerId
()
==
0
)
.
toList
();
}
if
(
schoolSuspensionRecords
!=
null
&&
!
schoolSuspensionRecords
.
isEmpty
())
{
var
latestSchoolSuspension
=
schoolSuspensionRecords
.
stream
()
.
max
((
a
,
b
)
->
Long
.
compare
(
a
.
getCreatedAt
(),
b
.
getCreatedAt
()))
...
...
@@ -127,7 +134,34 @@ public class MealOrderServiceImpl implements MealOrderService {
}
}
// 5.2 再查询学生级别的停餐信息
// 5.2 再查询班级级别的停餐信息
var
classSuspensionRecords
=
mealOrderServiceRpcClient
.
queryDinerMealSuspensionRecordsByCondition
(
loginInfo
.
getEnterpriseId
(),
List
.
of
(
dinerById
.
getClientId
()),
List
.
of
(
dinerById
.
getClassId
()),
null
);
// 直接过滤出班级级别的停餐记录
if
(
classSuspensionRecords
!=
null
)
{
classSuspensionRecords
=
classSuspensionRecords
.
stream
()
.
filter
(
r
->
r
.
getDinerId
()
==
0
)
.
toList
();
}
if
(
classSuspensionRecords
!=
null
&&
!
classSuspensionRecords
.
isEmpty
())
{
var
latestClassSuspension
=
classSuspensionRecords
.
stream
()
.
max
((
a
,
b
)
->
Long
.
compare
(
a
.
getCreatedAt
(),
b
.
getCreatedAt
()))
.
orElse
(
null
);
if
(
latestClassSuspension
!=
null
&&
currentTime
>=
latestClassSuspension
.
getStartAt
()
&&
currentTime
<=
latestClassSuspension
.
getEndAt
())
{
throw
ClientEndExceptions
.
IncorrectRequestValue
.
build
(
ErrorCodeEnum
.
DINER_MEAL_SUSPENDED
);
}
}
// 5.3 再查询学生级别的停餐信息
var
studentSuspensionRecords
=
mealOrderServiceRpcClient
.
queryDinerMealSuspensionRecordsByCondition
(
loginInfo
.
getEnterpriseId
(),
List
.
of
(
dinerById
.
getClientId
()),
...
...
Please
register
or
login
to post a comment