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
6d050e4b
Commit
6d050e4b
authored
Jun 22, 2019
by
jiaorz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改查询
parent
2ba0282e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
31 deletions
+31
-31
VehicleBiz.java
...c/main/java/com/xxfc/platform/vehicle/biz/VehicleBiz.java
+31
-31
No files found.
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleBiz.java
View file @
6d050e4b
...
...
@@ -63,8 +63,8 @@ import java.util.stream.Collectors;
@Slf4j
public
class
VehicleBiz
extends
BaseBiz
<
VehicleMapper
,
Vehicle
>
{
public
static
final
DateTimeFormatter
DEFAULT_DATE_TIME_FORMATTER
=
DateTimeFormat
.
forPattern
(
"yyyy-MM-dd
HH:mm:ss
"
);
public
static
final
DateTimeFormatter
DATE_TIME_FORMATTER
=
DateTimeFormat
.
forPattern
(
"yyyy-MM-dd"
);
public
static
final
DateTimeFormatter
DEFAULT_DATE_TIME_FORMATTER
=
DateTimeFormat
.
forPattern
(
"yyyy-MM-dd"
);
public
static
final
DateTimeFormatter
DATE_TIME_FORMATTER
=
DateTimeFormat
.
forPattern
(
"yyyy-MM-dd
HH:mm:ss
"
);
public
static
final
DateTimeFormatter
YEARMONTH_DATE_TIME_FORMATTER
=
DateTimeFormat
.
forPattern
(
"yyyy-MM"
);
/**
* 允许查询预定信息的最大月份数
...
...
@@ -322,16 +322,16 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
vehicleBookRecord
.
setLiftCompany
(
bookVehicleVo
.
getLiftCompany
());
vehicleBookRecordMapper
.
insertSelective
(
vehicleBookRecord
);
//添加预定时间记录
Map
<
String
,
Integer
>
map
=
vehicleBookHourInfoBiz
.
getPredictableHours
(
bookVehicleVo
.
getBookStartDate
(),
bookVehicleVo
.
getBookEndDate
());
for
(
Map
.
Entry
<
String
,
Integer
>
entry
:
map
.
entrySet
())
{
VehicleBookHourInfoDto
vehicleBookHourInfoDto
=
new
VehicleBookHourInfoDto
();
vehicleBookHourInfoDto
.
setVehicleId
(
bookVehicleVo
.
getVehicleId
());
vehicleBookHourInfoDto
.
setYearMonthDay
(
entry
.
getKey
());
vehicleBookHourInfoDto
.
setBookedHour
(
entry
.
getValue
());
vehicleBookHourInfoBiz
.
save
(
vehicleBookHourInfoDto
);
}
//
//添加预定时间记录
//
//
Map<String, Integer> map = vehicleBookHourInfoBiz.getPredictableHours(bookVehicleVo.getBookStartDate(), bookVehicleVo.getBookEndDate());
//
for(Map.Entry<String, Integer> entry : map.entrySet()) {
//
VehicleBookHourInfoDto vehicleBookHourInfoDto = new VehicleBookHourInfoDto();
//
vehicleBookHourInfoDto.setVehicleId(bookVehicleVo.getVehicleId());
//
vehicleBookHourInfoDto.setYearMonthDay(entry.getKey());
//
vehicleBookHourInfoDto.setBookedHour(entry.getValue());
//
vehicleBookHourInfoBiz.save(vehicleBookHourInfoDto);
//
}
//修改相关车辆预定记录
Boolean
hasSuc
=
bookedVehicle
(
bookVehicleVo
);
...
...
@@ -406,15 +406,15 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
// return RestResponse.code(ResCode.VEHICLE_BOOKED_INFO_ALREADY_CHANGED.getCode());
// }
// }
//如果拒绝预定,删除预定时间记录
if
(
VehicleBookRecordStatus
.
APPLY
.
getCode
().
equals
(
vehicleBookRecord
.
getStatus
()))
{
//删除预定时间记录
List
<
String
>
list
=
null
;
for
(
DateTime
curDate
=
new
DateTime
(
vehicleBookRecord
.
getBookStartDate
());
curDate
.
compareTo
(
new
DateTime
(
vehicleBookRecord
.
getBookEndDate
()))<=
0
;
curDate
=
curDate
.
plusDays
(
1
))
{
list
.
add
(
curDate
.
toString
(
DEFAULT_DATE_TIME_FORMATTER
));
}
vehicleBookHourInfoBiz
.
delete
(
vehicleBookRecord
.
getVehicleId
(),
list
);
}
//
//如果拒绝预定,删除预定时间记录
//
if(VehicleBookRecordStatus.APPLY.getCode().equals(vehicleBookRecord.getStatus())) {
//
//删除预定时间记录
//
List<String> list = null;
//
for( DateTime curDate = new DateTime(vehicleBookRecord.getBookStartDate());curDate.compareTo(new DateTime(vehicleBookRecord.getBookEndDate()))<=0;curDate=curDate.plusDays(1)) {
//
list.add(curDate.toString(DEFAULT_DATE_TIME_FORMATTER));
//
}
//
vehicleBookHourInfoBiz.delete(vehicleBookRecord.getVehicleId(),list);
//
}
//成功后修改预定记录状态
Map
<
String
,
Object
>
updateParam
=
Maps
.
newHashMap
();
updateParam
.
put
(
"id"
,
bookRecordId
);
...
...
@@ -470,16 +470,16 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
//手动回滚
return
RestResponse
.
code
(
ResCode
.
VEHICLE_BOOKED_RECORD_ALREADY_CHANGED
.
getCode
());
}
//删除预定时间记录
List
<
String
>
list
=
Lists
.
newArrayList
();
DateTime
startDay
=
DateTime
.
parse
(
bookVehicleVo
.
getUnbookStartDate
().
split
(
" "
)[
0
],
DATE_TIME_FORMATTER
);
DateTime
endDay
=
DateTime
.
parse
(
bookVehicleVo
.
getUnbookEndDate
().
split
(
" "
)[
0
],
DATE_TIME_FORMATTER
);
for
(
DateTime
curDate
=
startDay
;
curDate
.
compareTo
(
endDay
)
<=
0
;
curDate
=
curDate
.
plusDays
(
1
))
{
log
.
info
(
"当前日期:"
+
curDate
);
String
date
=
curDate
.
toString
(
DATE_TIME_FORMATTER
);
list
.
add
(
date
);
}
vehicleBookHourInfoBiz
.
delete
(
vehicleBookRecord
.
getVehicleId
(),
list
);
//
//删除预定时间记录
//
List<String> list = Lists.newArrayList();
// DateTime startDay = DateTime.parse(bookVehicleVo.getUnbookStartDate().split(" ")[0], DEFAULT_
DATE_TIME_FORMATTER);
// DateTime endDay = DateTime.parse(bookVehicleVo.getUnbookEndDate().split(" ")[0], DEFAULT_
DATE_TIME_FORMATTER);
//
for( DateTime curDate = startDay;curDate.compareTo(endDay) <= 0; curDate=curDate.plusDays(1)) {
//
log.info("当前日期:" + curDate);
//
String date = curDate.toString(DATE_TIME_FORMATTER);
//
list.add(date);
//
}
//
vehicleBookHourInfoBiz.delete(vehicleBookRecord.getVehicleId(), list);
return
RestResponse
.
suc
();
}
...
...
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