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-08-18 16:19:49 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
070def228d374c47a8308dd46b3b9323e25d4d0a
070def22
1 parent
7a4d6038
feat: 校验订餐日期是否在停餐区间
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
src/main/java/com/infoloop/tianting/service/impl/MealOrderServiceImpl.java
src/main/java/com/infoloop/tianting/service/impl/MealOrderServiceImpl.java
View file @
070def2
...
...
@@ -108,7 +108,6 @@ public class MealOrderServiceImpl implements MealOrderService {
}
// 5. 校验停餐记录(学校/班级/学生三个维度最新记录的多段并集区间)
final
long
nowMs
=
System
.
currentTimeMillis
();
final
var
intervals
=
suspensionService
.
getSuspensionIntervalsForDiner
(
loginInfo
.
getEnterpriseId
(),
dinerById
.
getClientId
(),
...
...
@@ -116,10 +115,14 @@ public class MealOrderServiceImpl implements MealOrderService {
dinerById
.
getId
()
);
if
(
intervals
!=
null
&&
!
intervals
.
isEmpty
())
{
final
boolean
inSuspension
=
intervals
.
stream
()
.
anyMatch
(
i
->
nowMs
>=
i
.
startAt
&&
nowMs
<=
i
.
endAt
);
if
(
inSuspension
)
{
throw
ClientEndExceptions
.
IncorrectRequestValue
.
build
(
ErrorCodeEnum
.
DINER_MEAL_SUSPENDED
);
// 校验每个订餐日期是否在停餐时间段内
for
(
var
meal
:
createMealOrderDTO
.
getMeals
())
{
final
long
mealDateMs
=
DateUtil
.
parseDate
(
meal
.
getDate
()).
getTime
();
final
boolean
inSuspension
=
intervals
.
stream
()
.
anyMatch
(
i
->
mealDateMs
>=
i
.
startAt
&&
mealDateMs
<=
i
.
endAt
);
if
(
inSuspension
)
{
throw
ClientEndExceptions
.
IncorrectRequestValue
.
build
(
ErrorCodeEnum
.
DINER_MEAL_SUSPENDED
);
}
}
}
...
...
Please
register
or
login
to post a comment