Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
Project
Project
Details
Activity
Releases
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
youjj
cloud-platform
Commits
1df770f4
Commit
1df770f4
authored
Oct 29, 2019
by
周健威
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/feature-24hour' into feature-24hour
parents
983f5ed1
7d9d3890
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
18 deletions
+19
-18
BaseOrderBiz.java
...c/main/java/com/xxfc/platform/order/biz/BaseOrderBiz.java
+19
-18
No files found.
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/BaseOrderBiz.java
View file @
1df770f4
...
...
@@ -121,7 +121,7 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements
@Autowired
OrderCalculateBiz
orderCalculateBiz
;
public
static
final
DateTimeFormatter
DEFAULT_DATE_TIME_FORMATTER
=
DateTimeFormat
.
forPattern
(
"yyyy-MM-dd"
);
public
static
final
DateTimeFormatter
DEFAULT_DATE_TIME_FORMATTER
=
DateTimeFormat
.
forPattern
(
"yyyy-MM-dd
HH:mm:ss
"
);
public
List
<
OrderPageVO
>
pageByParm
(
Map
<
String
,
Object
>
paramMap
)
{
...
...
@@ -226,34 +226,35 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements
//获取两个日期之间的天数(包含头尾)
public
int
getDaysBetweenDateTimeHasStartEnd
(
DateTime
startDay
,
DateTime
endDay
)
{
int
a
=
0
;
for
(
DateTime
curDate
=
startDay
;
curDate
.
compareTo
(
endDay
)
<=
0
;
curDate
=
curDate
.
plus
Day
s
(
1
))
{
for
(
DateTime
curDate
=
startDay
;
curDate
.
compareTo
(
endDay
)
<=
0
;
curDate
=
curDate
.
plus
Hour
s
(
1
))
{
a
++;
}
return
a
;
}
public
static
void
main
(
String
[]
args
)
{
DateTime
dateTime
=
DateTime
.
parse
(
"2019-09-20"
,
DEFAULT_DATE_TIME_FORMATTER
);
DateTime
dateTime1
=
DateTime
.
parse
(
"2019-09-22"
,
DEFAULT_DATE_TIME_FORMATTER
);
BaseOrderBiz
baseOrderBiz
=
new
BaseOrderBiz
();
int
a
=
baseOrderBiz
.
getDaysBetweenDateTimeHasStartEnd
(
dateTime
,
dateTime1
)
-
1
;
System
.
out
.
println
(
a
);
}
// public static void main(String[] args) {
// DateTime dateTime = DateTime.parse("2019-09-20 12:00:00", DEFAULT_DATE_TIME_FORMATTER);
// DateTime dateTime1 = DateTime.parse("2019-09-22 12:00:00", DEFAULT_DATE_TIME_FORMATTER);
// BaseOrderBiz baseOrderBiz = new BaseOrderBiz();
// OrderCalculateBiz orderCalculateBiz = new OrderCalculateBiz();
// int a = orderCalculateBiz.getIncludeDays(1572246524350l,1572332924000l);
// System.out.println(a);
// }
public
void
updateCrossRefund
(
OrderPageVO
orderPageVO
)
{
//计算延期费用
DedDetailDTO
dedDetailDTO
=
new
DedDetailDTO
();
//提前还车,结束时间大于当前时间
DateTime
nowTime
=
DateTime
.
parse
(
DateTime
.
now
().
toString
(
DEFAULT_DATE_TIME_FORMATTER
),
DEFAULT_DATE_TIME_FORMATTER
);
DateTime
endTime
=
DateTime
.
parse
(
new
DateTime
(
orderPageVO
.
getOrderRentVehicleDetail
().
getEndTime
()).
toString
(
DEFAULT_DATE_TIME_FORMATTER
),
DEFAULT_DATE_TIME_FORMATTER
);
DateTime
startTime
=
DateTime
.
parse
(
new
DateTime
(
orderPageVO
.
getOrderRentVehicleDetail
().
getStartTime
()).
toString
(
DEFAULT_DATE_TIME_FORMATTER
),
DEFAULT_DATE_TIME_FORMATTER
);
Long
nowTime
=
System
.
currentTimeMillis
(
);
Long
endTime
=
orderPageVO
.
getOrderRentVehicleDetail
().
getEndTime
(
);
Long
startTime
=
orderPageVO
.
getOrderRentVehicleDetail
().
getStartTime
(
);
//设置使用天数
int
userUsedDay
=
getDaysBetweenDateTimeHasStartEnd
(
startTime
,
nowTime
);
int
userUsedDay
=
orderCalculateBiz
.
getIncludeDays
(
startTime
,
nowTime
);
orderPageVO
.
getOrderRentVehicleDetail
().
setUsedDay
(
userUsedDay
);
orderRentVehicleBiz
.
updateSelectiveById
(
orderPageVO
.
getOrderRentVehicleDetail
());
//实际预定的天数
int
actualDay
=
getDaysBetweenDateTimeHasStartEnd
(
startTime
,
endTime
);
int
actualDay
=
orderCalculateBiz
.
getIncludeDays
(
startTime
,
endTime
);
Integer
orderId
=
orderPageVO
.
getId
();
List
<
OrderItem
>
items
=
orderItemBiz
.
selectList
(
new
OrderItem
()
{{
setOrderId
(
orderId
);
...
...
@@ -272,10 +273,10 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements
/**
* 提前还车
*/
if
(
getDaysBetweenDateTimeHasStartEnd
(
endTime
,
nowTime
)
<
1
)
{
if
(
orderCalculateBiz
.
getIncludeDays
(
endTime
,
nowTime
)
<
1
)
{
StringBuilder
stringBuilder
=
new
StringBuilder
();
//提前的天数, 当天就算使用一天
int
noUsedDay
=
getDaysBetweenDateTimeHasStartEnd
(
nowTime
,
endTime
)
-
1
;
int
noUsedDay
=
orderCalculateBiz
.
getIncludeDays
(
nowTime
,
endTime
)
;
//退还未使用的天数,或者金额,扣除违约金,实际未使用天数的金额,最多3000元
// InProgressVO inProgressVO = new InProgressVO();
// inProgressVO.setViolateAmount(new BigDecimal(200));
...
...
@@ -297,11 +298,11 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements
/**
* 延期还车
*/
}
else
if
(
getDaysBetweenDateTimeHasStartEnd
(
endTime
,
nowTime
)
>
1
)
{
}
else
if
(
orderCalculateBiz
.
getIncludeDays
(
endTime
,
nowTime
)
>
1
)
{
StringBuilder
stringBuilder
=
new
StringBuilder
();
stringBuilder
.
append
(
"违约金( ¥"
);
//延期的天数, 延期违约金是延期天数*200%
int
extraUsedDay
=
getDaysBetweenDateTimeHasStartEnd
(
endTime
,
nowTime
)
-
1
;
int
extraUsedDay
=
orderCalculateBiz
.
getIncludeDays
(
endTime
,
nowTime
)
;
if
(
extraUsedDay
>
0
)
{
stringBuilder
.
append
(
amount
);
stringBuilder
.
append
(
" x "
);
...
...
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