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
9f5d2724
Commit
9f5d2724
authored
Jul 27, 2020
by
徐康
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/1.9.31_外卖单时间校验'
parents
e3d343b4
41788fcb
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
6 deletions
+25
-6
order-application-service/src/main/java/cn/freemud/service/impl/CheckOrder.java
+25
-6
No files found.
order-application-service/src/main/java/cn/freemud/service/impl/CheckOrder.java
View file @
9f5d2724
...
...
@@ -183,12 +183,20 @@ public class CheckOrder {
}
// TODO: 2020/6/16 门店校验处理
String
takeMealFlag
=
createOrderVo
.
getTakeMealFlag
();
String
takeMealTimes
=
createOrderVo
.
getTakeMealTime
();
//立即送达
if
(
"0"
.
equals
(
takeMealFlag
)
||
(
StringUtils
.
isEmpty
(
createOrderVo
.
getExpectTime
())
&&
StringUtils
.
isEmpty
(
takeMealTimes
)))
{
//未营业无预约时间无法下单
if
(!
StoreConstant
.
BUSINESS
.
equals
(
storeResponseDto
.
getState
())
&&
StringUtils
.
isBlank
(
takeMealFlag
)
&&
"0"
.
equals
(
takeMealFlag
))
{
if
(!
StoreConstant
.
BUSINESS
.
equals
(
storeResponseDto
.
getState
()
))
{
throw
new
ServiceException
(
ResponseResult
.
STORE_ITEM_CHECK_CLOSE
);
}
// 外卖单选择立即送达的话,下单时间必须在店铺外卖时间内
if
(
createOrderVo
.
getOrderType
().
compareTo
(
CreateOrderType
.
TAKE_OUT
.
getCode
())
==
0
)
{
checkTakeOutTime
(
storeResponseDto
,
new
Date
(),
new
Date
(),
true
);
}
}
String
takeMealTimes
=
createOrderVo
.
getTakeMealTime
();
//有预约时间
if
(
StringUtils
.
isNotBlank
(
takeMealTimes
)
||
StringUtils
.
isNotBlank
(
createOrderVo
.
getExpectTime
())){
// 设置预约时间
...
...
@@ -310,6 +318,18 @@ public class CheckOrder {
}
if
(
CreateOrderType
.
TAKE_OUT
.
getCode
().
equals
(
createOrderVo
.
getOrderType
()))
{
checkTakeOutTime
(
storeResponseDto
,
date
,
takeMealDateTime
,
expectTimeInTodayBusinessTime
);
}
}
/**
* 检验订单是否在外卖时间内
* @param storeResponseDto 店铺信息
* @param now 当前时间
* @param takeMealDateTime 预约单送达时间/即时单下单时间
* @param expectTimeInTodayBusinessTime 是否在当日营业时间内
*/
private
void
checkTakeOutTime
(
StoreResponse
.
BizVO
storeResponseDto
,
Date
now
,
Date
takeMealDateTime
,
boolean
expectTimeInTodayBusinessTime
)
{
String
deliveryStr
=
storeResponseDto
.
getDeliveryHoursDay
().
replace
(
"-"
,
","
)
.
replace
(
"_"
,
","
);
String
[]
deliverys
=
deliveryStr
.
split
(
","
);
...
...
@@ -318,11 +338,11 @@ public class CheckOrder {
if
(
deliverys
.
length
==
2
)
{
SimpleDateFormat
hhmmss
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
SimpleDateFormat
yyyyMMdd
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
String
startDateTimeStr
=
yyyyMMdd
.
format
(
date
)
+
" "
+
deliverys
[
0
]
+
":00"
;
String
endDateTimeStr
=
yyyyMMdd
.
format
(
date
)
+
" "
+
deliverys
[
1
]
+
":00"
;
String
startDateTimeStr
=
yyyyMMdd
.
format
(
now
)
+
" "
+
deliverys
[
0
]
+
":00"
;
String
endDateTimeStr
=
yyyyMMdd
.
format
(
now
)
+
" "
+
deliverys
[
1
]
+
":00"
;
try
{
deliveryEndDate
=
hhmmss
.
parse
(
endDateTimeStr
);
deliveryStartDate
=
hhmmss
.
parse
(
startDateTimeStr
);
deliveryEndDate
=
hhmmss
.
parse
(
endDateTimeStr
);
}
catch
(
ParseException
e
)
{
LogUtil
.
error
(
"getStoreDeliveryInfo_error"
,
endDateTimeStr
,
e
.
getMessage
());
}
...
...
@@ -341,7 +361,6 @@ public class CheckOrder {
throw
new
ServiceException
(
ResponseResult
.
ORDER_CREATE_TIME_NOT_DELIVERY
);
}
}
}
public
Date
getOrderExpectTime
(
String
takeMealFlag
,
String
takeMealTimes
,
String
expectTime
,
CreateOrderType
createOrderType
,
Integer
serviceTime
,
StoreResponse
.
BizVO
storeResponseDto
){
...
...
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