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
2b67c931
Commit
2b67c931
authored
Aug 27, 2019
by
jiaorz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
预订时间处理bug
parent
72f75b73
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
20 deletions
+11
-20
VehicleBiz.java
...c/main/java/com/xxfc/platform/vehicle/biz/VehicleBiz.java
+11
-20
No files found.
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleBiz.java
View file @
2b67c931
...
...
@@ -439,12 +439,14 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
if
(
yearMonthAndDate
.
size
()>
3
){
//连续的日期最多夸3个月
throw
new
BaseException
(
ResultCode
.
ONLY_BOOK_TWO_MONTH
);
}
//检验时间是否可以预定
Map
<
String
,
Integer
>
map
=
new
HashMap
<>();
//加入预定申请记录
VehicleBookRecord
vehicleBookRecord
=
null
;
if
(
bookVehicleVo
.
getVehicleBookRecordId
()
==
null
)
{
//检验时间是否可以预定
map
=
vehicleBookHourInfoBiz
.
getPredictableHours
(
bookVehicleVo
.
getBookStartDate
(),
bookVehicleVo
.
getBookEndDate
(),
bookVehicleVo
.
getNotCheckTimeLegal
());
vehicleBookRecord
=
new
VehicleBookRecord
();
BeanUtil
.
copyProperties
(
bookVehicleVo
,
vehicleBookRecord
,
CopyOptions
.
create
().
setIgnoreNullValue
(
true
).
setIgnoreError
(
true
));
vehicleBookRecord
.
setBookStartDate
(
startDay
.
toDate
());
...
...
@@ -464,19 +466,19 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
bookVehicleVo
.
setUnbookStartDate
(
new
DateTime
(
vehicleBookRecord
.
getBookStartDate
()).
toString
(
DATE_TIME_FORMATTER
));
bookVehicleVo
.
setUnbookEndDate
(
new
DateTime
(
vehicleBookRecord
.
getBookEndDate
()).
toString
(
DATE_TIME_FORMATTER
));
unbookVehicle
(
bookVehicleVo
);
map
=
vehicleBookHourInfoBiz
.
getPredictableHours
(
startDay
.
toString
(
DATE_TIME_FORMATTER
),
endDay
.
toString
(
DATE_TIME_FORMATTER
),
bookVehicleVo
.
getNotCheckTimeLegal
());
for
(
Map
.
Entry
<
String
,
List
<
String
>>
entry
:
yearMonthAndDate
.
entrySet
())
{
Boolean
rsEach
=
applyVehicle4EmployeePerMonth
(
bookVehicleVo
.
getVehicleId
(),
entry
.
getValue
(),
entry
.
getKey
(),
map
);
if
(
Boolean
.
FALSE
.
equals
(
rsEach
)){
throw
new
BaseException
(
ResultCode
.
VEHICLE_IS_BOOKED
);
}
}
//检验时间是否可以预定
map
=
vehicleBookHourInfoBiz
.
getPredictableHours
(
bookVehicleVo
.
getBookStartDate
(),
bookVehicleVo
.
getBookEndDate
(),
bookVehicleVo
.
getNotCheckTimeLegal
());
vehicleBookRecord
.
setBookStartDate
(
startDay
.
toDate
());
vehicleBookRecord
.
setBookEndDate
(
endDay
.
toDate
());
vehicleBookRecordBiz
.
updateSelectiveByIdRe
(
vehicleBookRecord
);
}
}
for
(
Map
.
Entry
<
String
,
List
<
String
>>
entry
:
yearMonthAndDate
.
entrySet
())
{
Boolean
rsEach
=
applyVehicle4EmployeePerMonth
(
bookVehicleVo
.
getVehicleId
(),
entry
.
getValue
(),
entry
.
getKey
(),
map
);
if
(
Boolean
.
FALSE
.
equals
(
rsEach
)){
throw
new
BaseException
(
ResultCode
.
VEHICLE_IS_BOOKED
);
}
}
//添加预定日期记录
Boolean
hasSuc
=
bookedVehicle
(
bookVehicleVo
);
if
(!
hasSuc
){
...
...
@@ -956,17 +958,6 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
return
Boolean
.
TRUE
;
}
public
Map
<
String
,
Integer
>
getDateInfo
(
String
yearMonthDay
)
{
Map
<
String
,
Integer
>
map
=
new
HashMap
<>();
if
(
StringUtils
.
isNotBlank
(
yearMonthDay
))
{
DateTime
dateTime
=
DateTime
.
parse
(
yearMonthDay
,
YEARMONTH_DATE_TIME_FORMATTER
);
Integer
andOperationFactor
=
0
;
andOperationFactor
|=
1
<<(
dateTime
.
dayOfMonth
().
get
()-
1
);
map
.
put
(
dateTime
.
toString
(
YEARMONTH_DATE_TIME_FORMATTER
),
andOperationFactor
);
}
return
map
;
}
/**
* 获取某月份相应预定日期查询条件
* @param yearMonthAndDate 年月 - 预定日期条件字符串(yyyy-MM-dd)
...
...
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