Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
order-group
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
order-group-application
order-group
Commits
2b2e8d88
Commit
2b2e8d88
authored
Aug 20, 2020
by
徐康
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
创建订单时间check修改
parent
3762e3c7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
4 deletions
+29
-4
order-application-service/src/main/java/cn/freemud/service/impl/CheckMCCafeOrder.java
+29
-4
No files found.
order-application-service/src/main/java/cn/freemud/service/impl/CheckMCCafeOrder.java
View file @
2b2e8d88
...
...
@@ -68,6 +68,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Component
;
import
java.awt.geom.Point2D
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.stream.Collectors
;
...
...
@@ -218,6 +220,9 @@ public class CheckMCCafeOrder {
String
takeMealFlag
=
createOrderVo
.
getTakeMealFlag
();
String
takeMealTime
=
createOrderVo
.
getTakeMealTime
();
String
expectTime
=
createOrderVo
.
getExpectTime
();
Date
now
=
new
Date
();
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
sdf
.
setLenient
(
false
);
//立即送达
if
(
"0"
.
equals
(
takeMealFlag
))
{
...
...
@@ -226,10 +231,10 @@ public class CheckMCCafeOrder {
throw
new
ServiceException
(
ResponseResult
.
STORE_ITEM_CHECK_CLOSE
);
}
// 校验下单时间是否在营业时间内
checkOrderExpectTime
(
storeResponseDto
,
n
ew
Date
()
);
checkOrderExpectTime
(
storeResponseDto
,
n
ow
);
// 外卖单选择立即送达的话,下单时间必须在店铺外卖时间内
if
(
createOrderVo
.
getOrderType
().
compareTo
(
CreateOrderType
.
TAKE_OUT
.
getCode
())
==
0
)
{
checkTakeOutTime
(
storeResponseDto
,
n
ew
Date
()
);
checkTakeOutTime
(
storeResponseDto
,
n
ow
);
}
}
//有预约时间的自提单
...
...
@@ -246,10 +251,15 @@ public class CheckMCCafeOrder {
}
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTime
(
n
ew
Date
()
);
calendar
.
setTime
(
n
ow
);
calendar
.
add
(
Calendar
.
MINUTE
,
minute
);
Date
takeMealDateTime
=
calendar
.
getTime
();
//当顾客指定送达时间小于当前时间,订单记录类型为即时单
if
(
takeMealDateTime
!=
null
&&
takeMealDateTime
.
before
(
now
))
{
takeMealDateTime
=
null
;
}
if
(
takeMealDateTime
!=
null
){
//校验营业时间
checkOrderExpectTime
(
storeResponseDto
,
takeMealDateTime
);
...
...
@@ -261,7 +271,22 @@ public class CheckMCCafeOrder {
}
//有预约时间的外卖单
else
if
(
CreateOrderType
.
TAKE_OUT
.
getCode
().
equals
(
createOrderVo
.
getOrderType
())
&&
StringUtils
.
isNotBlank
(
expectTime
))
{
Date
takeOutDateTime
=
DateUtil
.
convert2Date
(
createOrderVo
.
getExpectTime
(),
"yyyy-MM-dd HH:mm:ss"
);
Date
takeOutDateTime
=
null
;
try
{
takeOutDateTime
=
sdf
.
parse
(
createOrderVo
.
getExpectTime
());
}
catch
(
ParseException
e
)
{
throw
new
ServiceException
(
ResponseResult
.
ORDER_TAKE_OUT_TIME_ERROR
);
}
//当顾客指定送达时间小于当前时间,订单记录类型为即时单
if
(
takeOutDateTime
!=
null
&&
takeOutDateTime
.
before
(
now
))
{
takeOutDateTime
=
null
;
}
//当顾客指定送达时间小于当前时间+提前预约时间时,订单记录类型为即时单
if
(
takeOutDateTime
!=
null
&&
storeResponseDto
.
getServiceTime
()
!=
null
&&
takeOutDateTime
.
before
(
DateUtil
.
addMinutes
(
now
,
storeResponseDto
.
getServiceTime
())))
{
takeOutDateTime
=
null
;
}
if
(
takeOutDateTime
!=
null
)
{
//校验营业时间
checkOrderExpectTime
(
storeResponseDto
,
takeOutDateTime
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment