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
09238cef
Commit
09238cef
authored
Nov 06, 2019
by
周健威
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/holiday-price' into holiday-price
parents
037cfaf4
954a17b7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
38 deletions
+40
-38
VehicleModelCalendarPriceBiz.java
...fc/platform/vehicle/biz/VehicleModelCalendarPriceBiz.java
+38
-34
VehicleModelCalendarPriceController.java
...orm/vehicle/rest/VehicleModelCalendarPriceController.java
+2
-4
No files found.
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleModelCalendarPriceBiz.java
View file @
09238cef
...
@@ -196,9 +196,13 @@ public class VehicleModelCalendarPriceBiz extends BaseBiz<VehicleModelCalendarPr
...
@@ -196,9 +196,13 @@ public class VehicleModelCalendarPriceBiz extends BaseBiz<VehicleModelCalendarPr
* @return
* @return
*/
*/
public
List
<
VehicleModelCalendarPriceDTO
>
findVehicleModelCalendarPriceByDateAndVehilceIdAndUserId
(
Date
startDate
,
Date
endDate
,
Integer
vehicleModelId
,
Integer
userId
)
{
public
List
<
VehicleModelCalendarPriceDTO
>
findVehicleModelCalendarPriceByDateAndVehilceIdAndUserId
(
Date
startDate
,
Date
endDate
,
Integer
vehicleModelId
,
Integer
userId
)
{
return
findVehicleModelCalendarPrice
(
startDate
,
endDate
,
vehicleModelId
,
userId
);
List
<
VehicleModelCalendarPriceDTO
>
vehicleModelCalendarPrice
=
findVehicleModelCalendarPrice
(
startDate
,
endDate
,
vehicleModelId
,
userId
);
vehicleModelCalendarPrice
=
wrapVehicleModelCalendarPrice
(
startDate
,
endDate
,
vehicleModelCalendarPrice
);
return
vehicleModelCalendarPrice
.
stream
().
filter
(
x
->
Objects
.
nonNull
(
x
.
getIsSelect
())).
collect
(
Collectors
.
toList
());
}
}
/**
/**
* 日历展示车型价格
* 日历展示车型价格
*
*
...
@@ -209,30 +213,14 @@ public class VehicleModelCalendarPriceBiz extends BaseBiz<VehicleModelCalendarPr
...
@@ -209,30 +213,14 @@ public class VehicleModelCalendarPriceBiz extends BaseBiz<VehicleModelCalendarPr
* @return
* @return
*/
*/
public
List
<
VehicleModelCalendarPriceDTO
>
listVehicleModelCalendarPriceByDateAndVehicleModelIdAndUserId
(
Date
startDate
,
Date
endDate
,
Integer
vehicleModelId
,
Integer
userId
)
{
public
List
<
VehicleModelCalendarPriceDTO
>
listVehicleModelCalendarPriceByDateAndVehicleModelIdAndUserId
(
Date
startDate
,
Date
endDate
,
Integer
vehicleModelId
,
Integer
userId
)
{
LocalDate
startLocalDate
=
DateUtils
.
dateToLocalDate
(
startDate
);
LocalDate
endLocalDate
=
DateUtils
.
dateToLocalDate
(
endDate
);
boolean
isSelect
=
false
;
//处理后延伸的开始时间
//处理后延伸的开始时间
AtomicReference
<
Date
>
startReference
=
new
AtomicReference
<>(
startDate
);
AtomicReference
<
Date
>
startReference
=
new
AtomicReference
<>(
startDate
);
//处理后延伸的结束时间
//处理后延伸的结束时间
AtomicReference
<
Date
>
endReference
=
new
AtomicReference
<>(
endDate
);
AtomicReference
<
Date
>
endReference
=
new
AtomicReference
<>(
endDate
);
transformStartDateAndEndDate
(
startReference
,
endReference
);
transformStartDateAndEndDate
(
startReference
,
endReference
);
List
<
VehicleModelCalendarPriceDTO
>
vehicleModelCalendarPrice
=
findVehicleModelCalendarPrice
(
startReference
.
get
(),
endReference
.
get
(),
vehicleModelId
,
userId
);
Integer
days
=
getIncludeDays
(
startDate
.
getTime
(),
endDate
.
getTime
());
for
(
int
i
=
0
,
y
=
0
;
i
<
vehicleModelCalendarPrice
.
size
();
i
++)
{
List
<
VehicleModelCalendarPriceDTO
>
vehicleModelCalendarPrice
=
findVehicleModelCalendarPrice
(
startReference
.
get
(),
endReference
.
get
(),
vehicleModelId
,
userId
);
VehicleModelCalendarPriceDTO
vehicleModelCalendarPriceDTO
=
vehicleModelCalendarPrice
.
get
(
i
);
vehicleModelCalendarPrice
=
wrapVehicleModelCalendarPrice
(
startDate
,
endDate
,
vehicleModelCalendarPrice
);
LocalDate
current_date
=
DateUtils
.
dateToLocalDate
(
vehicleModelCalendarPriceDTO
.
getDate
());
if
(
y
==
0
)
{
isSelect
=
(
current_date
.
isAfter
(
startLocalDate
)
&&
current_date
.
isBefore
(
endLocalDate
))
||
current_date
.
isEqual
(
startLocalDate
)
||
current_date
.
isEqual
(
endLocalDate
);
}
if
(
isSelect
)
{
if
(
y
<
days
)
{
vehicleModelCalendarPriceDTO
.
setIsSelect
(
isSelect
?
true
:
false
);
y
++;
}
}
}
return
vehicleModelCalendarPrice
;
return
vehicleModelCalendarPrice
;
}
}
...
@@ -243,7 +231,7 @@ public class VehicleModelCalendarPriceBiz extends BaseBiz<VehicleModelCalendarPr
...
@@ -243,7 +231,7 @@ public class VehicleModelCalendarPriceBiz extends BaseBiz<VehicleModelCalendarPr
* @param endLong
* @param endLong
* @return
* @return
*/
*/
p
ublic
Integer
getIncludeDays
(
Long
startLong
,
Long
endLong
)
{
p
rivate
Integer
getIncludeDays
(
Long
startLong
,
Long
endLong
)
{
Map
<
String
,
Dictionary
>
dictionaryMap
=
thirdFeign
.
dictionaryGetAll4Map
().
getData
();
Map
<
String
,
Dictionary
>
dictionaryMap
=
thirdFeign
.
dictionaryGetAll4Map
().
getData
();
Long
hourLong
=
(
60L
*
60L
*
1000L
);
Long
hourLong
=
(
60L
*
60L
*
1000L
);
Long
dayLong
=
hourLong
*
24
;
Long
dayLong
=
hourLong
*
24
;
...
@@ -265,6 +253,33 @@ public class VehicleModelCalendarPriceBiz extends BaseBiz<VehicleModelCalendarPr
...
@@ -265,6 +253,33 @@ public class VehicleModelCalendarPriceBiz extends BaseBiz<VehicleModelCalendarPr
return
bookDays
;
return
bookDays
;
}
}
/**
* 价格24小时处理
* @param startDate
* @param endDate
* @param vehicleModelCalendarPrice
* @return
*/
private
List
<
VehicleModelCalendarPriceDTO
>
wrapVehicleModelCalendarPrice
(
Date
startDate
,
Date
endDate
,
List
<
VehicleModelCalendarPriceDTO
>
vehicleModelCalendarPrice
)
{
LocalDate
startLocalDate
=
DateUtils
.
dateToLocalDate
(
startDate
);
LocalDate
endLocalDate
=
DateUtils
.
dateToLocalDate
(
endDate
);
Integer
days
=
getIncludeDays
(
startDate
.
getTime
(),
endDate
.
getTime
());
boolean
isSelect
=
false
;
for
(
int
i
=
0
,
y
=
0
;
i
<
vehicleModelCalendarPrice
.
size
();
i
++)
{
VehicleModelCalendarPriceDTO
vehicleModelCalendarPriceDTO
=
vehicleModelCalendarPrice
.
get
(
i
);
LocalDate
current_date
=
DateUtils
.
dateToLocalDate
(
vehicleModelCalendarPriceDTO
.
getDate
());
if
(
y
==
0
)
{
isSelect
=
(
current_date
.
isAfter
(
startLocalDate
)
&&
current_date
.
isBefore
(
endLocalDate
))
||
current_date
.
isEqual
(
startLocalDate
)
||
current_date
.
isEqual
(
endLocalDate
);
}
if
(
isSelect
)
{
if
(
y
<
days
)
{
vehicleModelCalendarPriceDTO
.
setIsSelect
(
true
);
y
++;
}
}
}
return
vehicleModelCalendarPrice
;
}
/**
/**
* 日历价格查询
* 日历价格查询
...
@@ -292,10 +307,10 @@ public class VehicleModelCalendarPriceBiz extends BaseBiz<VehicleModelCalendarPr
...
@@ -292,10 +307,10 @@ public class VehicleModelCalendarPriceBiz extends BaseBiz<VehicleModelCalendarPr
BigDecimal
vehicle_base_price
=
new
BigDecimal
(
0
);
BigDecimal
vehicle_base_price
=
new
BigDecimal
(
0
);
BigDecimal
vehicle_price
=
vehicleModelBiz
.
findVehicleModelPriceByVehicleModelId
(
vehicleModelId
);
BigDecimal
vehicle_price
=
vehicleModelBiz
.
findVehicleModelPriceByVehicleModelId
(
vehicleModelId
);
vehicle_base_price
=
vehicle_base_price
.
add
(
vehicle_price
);
vehicle_base_price
=
vehicle_base_price
.
add
(
vehicle_price
);
log
.
info
(
"用户id【{}】"
,
userId
);
log
.
info
(
"用户id【{}】"
,
userId
);
if
(
Objects
.
nonNull
(
userId
))
{
if
(
Objects
.
nonNull
(
userId
))
{
BaseUserMember
baseUserMember
=
userFeign
.
findBaseUserMemberByUserId
(
userId
);
BaseUserMember
baseUserMember
=
userFeign
.
findBaseUserMemberByUserId
(
userId
);
log
.
info
(
"用户会员信息:【{}】"
,
baseUserMember
);
log
.
info
(
"用户会员信息:【{}】"
,
baseUserMember
);
discount
=
baseUserMember
==
null
?
discount
:
baseUserMember
.
getDiscount
();
discount
=
baseUserMember
==
null
?
discount
:
baseUserMember
.
getDiscount
();
memberLevel
=
baseUserMember
==
null
?
memberLevel
:
baseUserMember
.
getMemberLevel
();
memberLevel
=
baseUserMember
==
null
?
memberLevel
:
baseUserMember
.
getMemberLevel
();
}
}
...
@@ -364,7 +379,7 @@ public class VehicleModelCalendarPriceBiz extends BaseBiz<VehicleModelCalendarPr
...
@@ -364,7 +379,7 @@ public class VehicleModelCalendarPriceBiz extends BaseBiz<VehicleModelCalendarPr
* @param discount
* @param discount
* @return
* @return
*/
*/
p
ublic
Map
<
String
,
Object
>
transfromPriceAndFreeDaysByDate
(
Map
<
Date
,
VehicleModelHolidayPriceDTO
>
festivalDayMap
,
Date
current_date
,
BigDecimal
vehicle_price
,
Integer
discount
)
{
p
rivate
Map
<
String
,
Object
>
transfromPriceAndFreeDaysByDate
(
Map
<
Date
,
VehicleModelHolidayPriceDTO
>
festivalDayMap
,
Date
current_date
,
BigDecimal
vehicle_price
,
Integer
discount
)
{
log
.
info
(
"参数:【{}==当前时间:{}==价格:{}==折扣:{}】"
,
festivalDayMap
,
current_date
,
vehicle_price
,
discount
);
log
.
info
(
"参数:【{}==当前时间:{}==价格:{}==折扣:{}】"
,
festivalDayMap
,
current_date
,
vehicle_price
,
discount
);
Map
<
String
,
Object
>
vehicle_price_days_map
=
new
HashMap
<>(
3
);
Map
<
String
,
Object
>
vehicle_price_days_map
=
new
HashMap
<>(
3
);
Integer
free_days
=
DEFAULT_FREE_DAYS
;
Integer
free_days
=
DEFAULT_FREE_DAYS
;
...
@@ -457,17 +472,6 @@ public class VehicleModelCalendarPriceBiz extends BaseBiz<VehicleModelCalendarPr
...
@@ -457,17 +472,6 @@ public class VehicleModelCalendarPriceBiz extends BaseBiz<VehicleModelCalendarPr
startDatee
.
set
(
startDate
);
startDatee
.
set
(
startDate
);
endDatee
.
set
(
endDate
);
endDatee
.
set
(
endDate
);
}
}
public
static
void
main
(
String
[]
args
)
{
AtomicReference
<
Date
>
start
=
new
AtomicReference
<>(
Date
.
from
(
LocalDate
.
parse
(
"2019-10-03"
).
atStartOfDay
(
ZoneId
.
systemDefault
()).
toInstant
()));
AtomicReference
<
Date
>
end
=
new
AtomicReference
<>(
Date
.
from
(
LocalDate
.
parse
(
"2019-10-29"
).
atStartOfDay
(
ZoneId
.
systemDefault
()).
toInstant
()));
transformStartDateAndEndDate
(
start
,
end
);
System
.
out
.
println
(
start
.
get
());
System
.
out
.
println
(
end
.
get
());
}
/**
/**
* 车型日历价格设置类型
* 车型日历价格设置类型
*/
*/
...
...
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/rest/VehicleModelCalendarPriceController.java
View file @
09238cef
...
@@ -61,9 +61,7 @@ public class VehicleModelCalendarPriceController {
...
@@ -61,9 +61,7 @@ public class VehicleModelCalendarPriceController {
@RequestParam
(
value
=
"userId"
)
Integer
userId
)
{
@RequestParam
(
value
=
"userId"
)
Integer
userId
)
{
Date
startDateDay
=
DateUtil
.
beginOfDay
(
DateUtil
.
date
(
startDate
));
Date
startDateDay
=
DateUtil
.
beginOfDay
(
DateUtil
.
date
(
startDate
));
//Date.from(startDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate().atStartOfDay(ZoneId.systemDefault()).toInstant());
Date
endDateDay
=
DateUtil
.
beginOfDay
(
DateUtil
.
date
(
endDate
));
Date
endDateDay
=
DateUtil
.
beginOfDay
(
DateUtil
.
date
(
endDate
));
//Date.from(endDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate().atStartOfDay(ZoneId.systemDefault()).toInstant());
return
ObjectRestResponse
.
succ
(
vehicleModelCalendarPriceBiz
.
findVehicleModelCalendarPriceByDateAndVehilceIdAndUserId
(
startDateDay
,
endDateDay
,
vehicleModelId
,
userId
));
return
ObjectRestResponse
.
succ
(
vehicleModelCalendarPriceBiz
.
findVehicleModelCalendarPriceByDateAndVehilceIdAndUserId
(
startDateDay
,
endDateDay
,
vehicleModelId
,
userId
));
}
}
...
@@ -73,8 +71,8 @@ public class VehicleModelCalendarPriceController {
...
@@ -73,8 +71,8 @@ public class VehicleModelCalendarPriceController {
@RequestParam
(
value
=
"vehicleModelId"
)
Integer
vehicleModelId
,
@RequestParam
(
value
=
"vehicleModelId"
)
Integer
vehicleModelId
,
AppUserDTO
appUserDTO
)
{
AppUserDTO
appUserDTO
)
{
Date
startDateDay
=
DateUtil
.
beginOfDay
(
DateUtil
.
date
(
startDate
)
);
Date
startDateDay
=
new
Date
(
startDate
);
Date
endDateDay
=
DateUtil
.
beginOfDay
(
DateUtil
.
date
(
endDate
)
);
Date
endDateDay
=
new
Date
(
endDate
);
return
ObjectRestResponse
.
succ
(
vehicleModelCalendarPriceBiz
.
findVehicleModelCalendarPriceByDateAndVehilceIdAndUserId
(
startDateDay
,
endDateDay
,
vehicleModelId
,
appUserDTO
.
getUserid
()));
return
ObjectRestResponse
.
succ
(
vehicleModelCalendarPriceBiz
.
findVehicleModelCalendarPriceByDateAndVehilceIdAndUserId
(
startDateDay
,
endDateDay
,
vehicleModelId
,
appUserDTO
.
getUserid
()));
}
}
...
...
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