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
c67d633f
Commit
c67d633f
authored
Dec 10, 2021
by
周晓航
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature_夜间配送ID1040499_zxh20211208' into qa
parents
8112b0f1
f70fb10b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
24 deletions
+19
-24
shopping-cart-application-service/src/main/java/cn/freemud/entities/dto/console/DeliveryInfoDTO.java
+1
-1
shopping-cart-application-service/src/main/java/cn/freemud/service/delivery/DeliveryService.java
+18
-23
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/entities/dto/console/DeliveryInfoDTO.java
View file @
c67d633f
...
...
@@ -81,7 +81,7 @@ public class DeliveryInfoDTO {
* 额外拓展属性 json
* @see cn.freemud.entities.dto.console.DeliveryInfoExpandFieldDTO
*/
private
String
expandFields
;
private
DeliveryInfoExpandFieldDTO
expandFields
;
}
shopping-cart-application-service/src/main/java/cn/freemud/service/delivery/DeliveryService.java
View file @
c67d633f
...
...
@@ -19,9 +19,7 @@ import cn.freemud.entities.dto.console.DeliveryInfoExpandFieldDTO;
import
cn.freemud.entities.dto.console.NightDeliveryuInfo
;
import
cn.freemud.entities.vo.ShoppingCartGoodsResponseVo
;
import
cn.freemud.utils.DateTimeUtil
;
import
com.alibaba.fastjson.JSON
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang.StringUtils
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
...
...
@@ -51,34 +49,31 @@ public interface DeliveryService {
* @param amount 原始配送费价格
* @param expandFields 门店反馈的额外配送费配置
*/
default
List
<
ExtraDeliveryDto
>
nightDeliveryAmountHandle
(
long
amount
,
String
expandFields
)
{
default
List
<
ExtraDeliveryDto
>
nightDeliveryAmountHandle
(
long
amount
,
DeliveryInfoExpandFieldDTO
expandFields
)
{
List
<
ExtraDeliveryDto
>
list
=
new
ArrayList
<>();
if
(
amount
>
0
)
{
ExtraDeliveryDto
defaultAmount
=
new
ExtraDeliveryDto
(
ExtraDeliveryDto
.
TYPE_DEFAULT
,
amount
);
list
.
add
(
defaultAmount
);
}
if
(
StringUtils
.
isNotBlank
(
expandFields
))
{
DeliveryInfoExpandFieldDTO
expandField
=
JSON
.
parseObject
(
expandFields
,
DeliveryInfoExpandFieldDTO
.
class
);
if
(
Objects
.
nonNull
(
expandField
)
&&
CollectionUtils
.
isNotEmpty
(
expandField
.
getNightDeliveryInfo
()))
{
for
(
NightDeliveryuInfo
info
:
expandField
.
getNightDeliveryInfo
())
{
if
(
info
.
getStatus
()
==
NightDeliveryuInfo
.
COMMON_STATUS_OPEN
)
{
// 当前时间在区间内
try
{
Date
nowTime
=
new
SimpleDateFormat
(
DateUtil
.
FORMAT_time
).
parse
(
DateTimeUtil
.
getCurrentTimeStr
());
Date
startTime
=
new
SimpleDateFormat
(
DateUtil
.
FORMAT_time
).
parse
(
info
.
getStartTime
());
Date
endTime
=
new
SimpleDateFormat
(
DateUtil
.
FORMAT_time
).
parse
(
info
.
getEndTime
());
if
(
DateTimeUtil
.
isEffectiveDate
(
nowTime
,
startTime
,
endTime
))
{
ExtraDeliveryDto
extraDeliveryDto
=
new
ExtraDeliveryDto
(
info
.
getType
(),
amount
);
list
.
add
(
extraDeliveryDto
);
// 金额 增加
amount
+=
info
.
getPrice
();
}
}
catch
(
ParseException
e
)
{
// 报错表示 时间格式设置错误, 默认当做不计算
e
.
printStackTrace
();
if
(
Objects
.
nonNull
(
expandFields
)
&&
CollectionUtils
.
isNotEmpty
(
expandFields
.
getNightDeliveryInfo
()))
{
for
(
NightDeliveryuInfo
info
:
expandFields
.
getNightDeliveryInfo
())
{
if
(
info
.
getStatus
()
==
NightDeliveryuInfo
.
COMMON_STATUS_OPEN
)
{
// 当前时间在区间内
try
{
Date
nowTime
=
new
SimpleDateFormat
(
DateUtil
.
FORMAT_time
).
parse
(
DateTimeUtil
.
getCurrentTimeStr
());
Date
startTime
=
new
SimpleDateFormat
(
DateUtil
.
FORMAT_time
).
parse
(
info
.
getStartTime
());
Date
endTime
=
new
SimpleDateFormat
(
DateUtil
.
FORMAT_time
).
parse
(
info
.
getEndTime
());
if
(
DateTimeUtil
.
isEffectiveDate
(
nowTime
,
startTime
,
endTime
))
{
ExtraDeliveryDto
extraDeliveryDto
=
new
ExtraDeliveryDto
(
info
.
getType
(),
amount
);
list
.
add
(
extraDeliveryDto
);
// 金额 增加
amount
+=
info
.
getPrice
();
}
}
catch
(
ParseException
e
)
{
// 报错表示 时间格式设置错误, 默认当做不计算
e
.
printStackTrace
();
}
}
}
}
...
...
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