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
e6994a9b
Commit
e6994a9b
authored
Nov 09, 2020
by
hezhen
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev-chw' of
http://113.105.137.151:22280/youjj/cloud-platform
into dev-chw
parents
63e629b9
891ba3ff
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
252 additions
and
150 deletions
+252
-150
VehicleHolidayPriceInfoBiz.java
...xxfc/platform/vehicle/biz/VehicleHolidayPriceInfoBiz.java
+144
-42
RentVehicleController.java
...com/xxfc/platform/vehicle/rest/RentVehicleController.java
+108
-108
No files found.
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleHolidayPriceInfoBiz.java
View file @
e6994a9b
...
...
@@ -25,6 +25,8 @@ import tk.mybatis.mapper.entity.Example;
import
java.math.BigDecimal
;
import
java.util.*
;
import
static
cn
.
hutool
.
core
.
date
.
DateField
.
HOUR_OF_DAY
;
/**
* 车辆节假日价格信息表
*
...
...
@@ -152,61 +154,70 @@ public class VehicleHolidayPriceInfoBiz extends BaseBiz<VehicleHolidayPriceInfoM
return
mapper
.
selectByExample
(
example
);
}
public
List
<
VehicleModelCalendarPriceDTO
>
getSynthesizePrice
(
String
vehicleId
,
String
startDate
,
String
endDate
,
Integer
userId
,
Integer
company
Id
)
{
public
List
<
VehicleModelCalendarPriceDTO
>
getSynthesizePrice
(
String
vehicleId
,
Long
startDateTemp
,
Long
endDateTemp
,
Integer
user
Id
)
{
List
<
VehicleModelCalendarPriceDTO
>
priceDTOS
=
CollUtil
.
newArrayList
();
String
startDate
=
DateUtil
.
date
(
startDateTemp
).
toString
();
String
endDate
=
DateUtil
.
date
(
endDateTemp
).
toString
();
cn
.
hutool
.
core
.
date
.
DateTime
beginOfStartDate
=
DateUtil
.
beginOfDay
(
DateUtil
.
parse
(
startDate
));
cn
.
hutool
.
core
.
date
.
DateTime
endOfStartDate
=
DateUtil
.
endOfDay
(
DateUtil
.
parse
(
endDate
));
//获取基本和周末价格
VehicleCommonPriceInfo
vehicleCommonPriceInfo
=
vehicleCommonPriceInfoBiz
.
selectOne
(
new
VehicleCommonPriceInfo
(){{
setCompanyId
(
companyId
);
setVehicleId
(
vehicleId
);
cn
.
hutool
.
core
.
date
.
DateTime
endOfEndDate
=
DateUtil
.
endOfDay
(
DateUtil
.
parse
(
endDate
));
//获取基本和周末价格company_info
Vehicle
vehicle
=
vehicleBiz
.
selectOne
(
new
Vehicle
(){{
setId
(
vehicleId
);
}});
if
(
null
==
vehicle
CommonPriceInfo
)
{
if
(
null
==
vehicle
)
{
return
CollUtil
.
newArrayList
();
}
//Date currentDate = DateUtil.beginOfDay(DateUtil.parse(startDate));
for
(
cn
.
hutool
.
core
.
date
.
DateTime
currentDate
=
DateUtil
.
beginOfDay
(
DateUtil
.
parse
(
startDate
));
(
currentDate
.
isAfterOrEquals
(
beginOfStartDate
)
&&
currentDate
.
isBeforeOrEquals
(
endOfStartDate
));
currentDate
=
DateUtil
.
offsetDay
(
currentDate
,
1
))
{
cn
.
hutool
.
core
.
date
.
DateTime
finalCurrentDate
=
currentDate
;
VehicleModelCalendarPriceDTO
dto
=
new
VehicleModelCalendarPriceDTO
(){{
setDate
(
DateUtil
.
beginOfDay
(
finalCurrentDate
));
}};
if
(
currentDate
.
isWeekend
())
{
dto
.
setNo_discount_price
(
vehicleCommonPriceInfo
.
getRentWeekendPrice
());
dto
.
setPrice
(
vehicleCommonPriceInfo
.
getRentWeekendPrice
());
dto
.
setFreeDays
(
vehicleCommonPriceInfo
.
getRentWeekendDay
());
}
else
{
dto
.
setNo_discount_price
(
vehicleCommonPriceInfo
.
getRentPrice
());
dto
.
setPrice
(
vehicleCommonPriceInfo
.
getRentPrice
());
dto
.
setFreeDays
(
vehicleCommonPriceInfo
.
getRentFreeDay
());
}
if
(
Vehicle
.
PRICE_TYPE_HOUR
==
vehicle
.
getPriceType
())
{
//Date currentDate = DateUtil.beginOfDay(DateUtil.parse(startDate));
for
(
cn
.
hutool
.
core
.
date
.
DateTime
currentDate
=
DateUtil
.
truncate
(
DateUtil
.
parse
(
startDate
),
HOUR_OF_DAY
);
(
currentDate
.
isAfterOrEquals
(
beginOfStartDate
)
&&
currentDate
.
isBeforeOrEquals
(
endOfEndDate
));
currentDate
=
DateUtil
.
offsetHour
(
currentDate
,
1
))
{
cn
.
hutool
.
core
.
date
.
DateTime
finalCurrentDate
=
currentDate
;
VehicleModelCalendarPriceDTO
dto
=
new
VehicleModelCalendarPriceDTO
(){{
setDate
(
finalCurrentDate
);
}};
if
(
currentDate
.
isWeekend
())
{
dto
.
setNo_discount_price
(
vehicle
.
getHolidayPrice
());
dto
.
setPrice
(
vehicle
.
getHolidayPrice
());
dto
.
setFreeDays
(
1
);
}
else
{
dto
.
setNo_discount_price
(
vehicle
.
getPrice
());
dto
.
setPrice
(
vehicle
.
getPrice
());
dto
.
setFreeDays
(
1
);
}
priceDTOS
.
add
(
dto
);
}
priceDTOS
.
add
(
dto
);
}
}
else
{
//Date currentDate = DateUtil.beginOfDay(DateUtil.parse(startDate));
for
(
cn
.
hutool
.
core
.
date
.
DateTime
currentDate
=
DateUtil
.
beginOfDay
(
DateUtil
.
parse
(
startDate
));
(
currentDate
.
isAfterOrEquals
(
beginOfStartDate
)
&&
currentDate
.
isBeforeOrEquals
(
endOfEndDate
));
currentDate
=
DateUtil
.
offsetDay
(
currentDate
,
1
))
{
cn
.
hutool
.
core
.
date
.
DateTime
finalCurrentDate
=
currentDate
;
VehicleModelCalendarPriceDTO
dto
=
new
VehicleModelCalendarPriceDTO
(){{
setDate
(
DateUtil
.
beginOfDay
(
finalCurrentDate
));
}};
if
(
currentDate
.
isWeekend
())
{
dto
.
setNo_discount_price
(
vehicle
.
getHolidayPrice
());
dto
.
setPrice
(
vehicle
.
getHolidayPrice
());
dto
.
setFreeDays
(
1
);
}
else
{
dto
.
setNo_discount_price
(
vehicle
.
getPrice
());
dto
.
setPrice
(
vehicle
.
getPrice
());
dto
.
setFreeDays
(
1
);
}
//获取节假日价格
List
<
VehicleHolidayPriceInfo
>
vehicleHolidayPriceInfoList
=
getByVehicleIdAndDate
(
vehicleId
,
startDate
,
endDate
);
priceDTOS
.
add
(
dto
);
}
if
(
CollUtil
.
isNotEmpty
(
vehicleHolidayPriceInfoList
))
{
vehicleHolidayPriceInfoList
.
forEach
(
info
->
{
priceDTOS
.
forEach
(
tmpDto
->
{
if
(
DateUtil
.
isSameDay
(
info
.
getFestivalDate
(),
tmpDto
.
getDate
()))
{
tmpDto
.
setNo_discount_price
(
info
.
getRentPrice
());
tmpDto
.
setPrice
(
info
.
getRentPrice
());
tmpDto
.
setFreeDays
(
info
.
getRentFreeDay
());
}
});
});
}
//获取会员折扣
//查询车辆信息
Vehicle
vehicle
=
vehicleBiz
.
selectById
(
vehicleId
);
//查询会员信息
//查询车辆信息
//
Vehicle vehicle = vehicleBiz.selectById(vehicleId);
//查询会员信息
//默认折扣
Integer
discount
=
DEFAULT_DISCOUNT
;
//会员默认等级
...
...
@@ -237,6 +248,97 @@ public class VehicleHolidayPriceInfoBiz extends BaseBiz<VehicleHolidayPriceInfoM
return
priceDTOS
;
}
public
List
<
VehicleModelCalendarPriceDTO
>
getSynthesizePrice
(
String
vehicleId
,
String
startDate
,
String
endDate
,
Integer
userId
,
Integer
companyId
){
Long
startDateTemp
=
DateUtil
.
parse
(
startDate
).
getTime
();
Long
endDateTemp
=
DateUtil
.
parse
(
endDate
).
getTime
();
return
getSynthesizePrice
(
vehicleId
,
startDateTemp
,
endDateTemp
,
userId
);
}
// public List<VehicleModelCalendarPriceDTO> getSynthesizePrice (String vehicleId, String startDate, String endDate, Integer userId, Integer companyId) {
// List<VehicleModelCalendarPriceDTO> priceDTOS = CollUtil.newArrayList();
// cn.hutool.core.date.DateTime beginOfStartDate = DateUtil.beginOfDay(DateUtil.parse(startDate));
// cn.hutool.core.date.DateTime endOfStartDate = DateUtil.endOfDay(DateUtil.parse(endDate));
// //获取基本和周末价格
// VehicleCommonPriceInfo vehicleCommonPriceInfo = vehicleCommonPriceInfoBiz.selectOne(new VehicleCommonPriceInfo(){{
// setCompanyId(companyId);
// setVehicleId(vehicleId);
// }});
//
// if(null == vehicleCommonPriceInfo) {
// return CollUtil.newArrayList();
// }
//
// //Date currentDate = DateUtil.beginOfDay(DateUtil.parse(startDate));
// for(cn.hutool.core.date.DateTime currentDate = DateUtil.beginOfDay(DateUtil.parse(startDate));
// (currentDate.isAfterOrEquals(beginOfStartDate) && currentDate.isBeforeOrEquals(endOfStartDate));
// currentDate = DateUtil.offsetDay(currentDate, 1)) {
// cn.hutool.core.date.DateTime finalCurrentDate = currentDate;
// VehicleModelCalendarPriceDTO dto = new VehicleModelCalendarPriceDTO(){{
// setDate(DateUtil.beginOfDay(finalCurrentDate));
// }};
// if(currentDate.isWeekend()) {
// dto.setNo_discount_price(vehicleCommonPriceInfo.getRentWeekendPrice());
// dto.setPrice(vehicleCommonPriceInfo.getRentWeekendPrice());
// dto.setFreeDays(vehicleCommonPriceInfo.getRentWeekendDay());
// }else {
// dto.setNo_discount_price(vehicleCommonPriceInfo.getRentPrice());
// dto.setPrice(vehicleCommonPriceInfo.getRentPrice());
// dto.setFreeDays(vehicleCommonPriceInfo.getRentFreeDay());
// }
//
// priceDTOS.add(dto);
// }
//
// //获取节假日价格
// List<VehicleHolidayPriceInfo> vehicleHolidayPriceInfoList = getByVehicleIdAndDate(vehicleId, startDate, endDate);
//
// if(CollUtil.isNotEmpty(vehicleHolidayPriceInfoList)) {
// vehicleHolidayPriceInfoList.forEach(info -> {
// priceDTOS.forEach(tmpDto -> {
// if(DateUtil.isSameDay(info.getFestivalDate(), tmpDto.getDate())) {
// tmpDto.setNo_discount_price(info.getRentPrice());
// tmpDto.setPrice(info.getRentPrice());
// tmpDto.setFreeDays(info.getRentFreeDay());
// }
// });
// });
// }
//
//
// //获取会员折扣
// //查询车辆信息
// Vehicle vehicle = vehicleBiz.selectById(vehicleId);
// //查询会员信息
// //默认折扣
// Integer discount = DEFAULT_DISCOUNT;
// //会员默认等级
// Integer memberLevel = DEFAULT_MEMBER_LEVEL;
// Integer memberType = DEFAULT_MEMBER_TYPE;
// if (Objects.nonNull(userId)) {
// BaseUserMember baseUserMember = userFeign.findBaseUserMemberByUserId(userId.intValue());
// log.info("用户会员信息:【{}】",baseUserMember);
// discount = baseUserMember == null ? discount : baseUserMember.getDiscount();
// memberLevel = baseUserMember == null ? memberLevel : baseUserMember.getMemberLevel();
// memberType = baseUserMember == null ? memberType : baseUserMember.getMemberType();
// }
//
// //非会员禁用 非无会员
// if(vehicle.getMemberUse() != MEMBER_TYPE_FORBID && DEFAULT_MEMBER_TYPE != memberType) {
// //判断 允许所有会员,或者 memberType 和 车辆memberUse 相等
// if(vehicle.getMemberUse().equals(MEMBER_TYPE_ALL) || (vehicle.getMemberUse().equals(memberType))) {
// //设置会员价格
// Integer finalDiscount = discount;
// priceDTOS.forEach(dto -> {
// dto.setPrice(dto.getNo_discount_price()
// .multiply(new BigDecimal(""+ finalDiscount)
// .divide(new BigDecimal("100"))));
// });
// }
// }
//
// return priceDTOS;
// }
//获取当前车辆所有的节日价格
public
ObjectRestResponse
<
List
<
VehicleHolidayPriceInfo
>>
getByVehicleId
(
String
vehicleId
)
{
...
...
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/rest/RentVehicleController.java
View file @
e6994a9b
This diff is collapsed.
Click to expand it.
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