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
bd8f4c2f
Commit
bd8f4c2f
authored
Aug 16, 2019
by
周健威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改取消预约的时间检测问题
parent
95c1d03b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
11 deletions
+20
-11
BookVehicleVO.java
...in/java/com/xxfc/platform/vehicle/pojo/BookVehicleVO.java
+5
-0
VehicleBiz.java
...c/main/java/com/xxfc/platform/vehicle/biz/VehicleBiz.java
+4
-3
VehicleBookHourInfoBiz.java
...com/xxfc/platform/vehicle/biz/VehicleBookHourInfoBiz.java
+9
-6
RentVehicleController.java
...com/xxfc/platform/vehicle/rest/RentVehicleController.java
+1
-1
VehicleController.java
...ava/com/xxfc/platform/vehicle/rest/VehicleController.java
+1
-1
No files found.
xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/pojo/BookVehicleVO.java
View file @
bd8f4c2f
...
...
@@ -113,4 +113,9 @@ public class BookVehicleVO {
* 驳回理由
*/
private
String
rejectRemark
;
/**
* 不检查参数合法
*/
private
Boolean
notCheckTimeLegal
;
}
\ No newline at end of file
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleBiz.java
View file @
bd8f4c2f
...
...
@@ -422,7 +422,7 @@ 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
=
vehicleBookHourInfoBiz
.
getPredictableHours
(
bookVehicleVo
.
getBookStartDate
(),
bookVehicleVo
.
getBookEndDate
());
Map
<
String
,
Integer
>
map
=
vehicleBookHourInfoBiz
.
getPredictableHours
(
bookVehicleVo
.
getBookStartDate
(),
bookVehicleVo
.
getBookEndDate
()
,
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
)){
...
...
@@ -578,7 +578,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
* @return
*/
@Transactional
public
RestResponse
unbookVehicle4Employee
(
Integer
operatorId
,
Long
bookRecordId
,
String
userName
,
String
rejectRemark
)
throws
Exception
{
public
RestResponse
unbookVehicle4Employee
(
Integer
operatorId
,
Long
bookRecordId
,
String
userName
,
String
rejectRemark
,
Boolean
notCheckTimeLegal
)
throws
Exception
{
//获取相关申请记录
VehicleBookRecord
vehicleBookRecord
=
vehicleBookRecordBiz
.
selectById
(
bookRecordId
);
//申请记录验证
...
...
@@ -592,6 +592,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
//转换为相应取消预定参数
BookVehicleVO
bookVehicleVo
=
new
BookVehicleVO
();
BeanUtils
.
copyProperties
(
bookVehicleVo
,
vehicleBookRecord
);
bookVehicleVo
.
setNotCheckTimeLegal
(
notCheckTimeLegal
);
bookVehicleVo
.
setBookStartDate
(
null
);
bookVehicleVo
.
setBookEndDate
(
null
);
bookVehicleVo
.
setUnbookStartDate
(
new
DateTime
(
vehicleBookRecord
.
getBookStartDate
()).
toString
(
DATE_TIME_FORMATTER
));
...
...
@@ -806,7 +807,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
DateTime
endDay
=
DateTime
.
parse
(
bookVehicleVo
.
getUnbookEndDate
(),
DATE_TIME_FORMATTER
);
//转换日期范围为列表,并检查是否合法
uinbookDateList4DatePeriod
(
yearMonthAndDate
,
startDay
,
endDay
);
Map
<
String
,
Integer
>
map
=
vehicleBookHourInfoBiz
.
getPredictableHours
(
bookVehicleVo
.
getUnbookStartDate
(),
bookVehicleVo
.
getUnbookEndDate
());
Map
<
String
,
Integer
>
map
=
vehicleBookHourInfoBiz
.
getPredictableHours
(
bookVehicleVo
.
getUnbookStartDate
(),
bookVehicleVo
.
getUnbookEndDate
()
,
bookVehicleVo
.
getNotCheckTimeLegal
()
);
if
(
yearMonthAndDate
.
size
()>
3
){
//连续的日期最多夸3个月
throw
new
BaseException
(
ResultCode
.
ONLY_UNBOOK_TWO_MONTH
);
}
...
...
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleBookHourInfoBiz.java
View file @
bd8f4c2f
...
...
@@ -31,7 +31,7 @@ public class VehicleBookHourInfoBiz extends BaseBiz<VehicleBookHourInfoMapper, V
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
Map
<
String
,
Integer
>
getPredictableHours
(
String
bookStartDate
,
String
bookEndDate
)
{
public
Map
<
String
,
Integer
>
getPredictableHours
(
String
bookStartDate
,
String
bookEndDate
,
Boolean
notCheckTimeLegal
)
{
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
Date
startDate
=
null
;
Date
endDate
=
null
;
...
...
@@ -43,12 +43,15 @@ public class VehicleBookHourInfoBiz extends BaseBiz<VehicleBookHourInfoMapper, V
}
//判定时间是否合法
if
(
bookStartDate
.
compareTo
(
DateTime
.
now
().
toString
(
DEFAULT_DATE_TIME_FORMATTER
))
<
0
)
{
throw
new
BaseException
(
ResultCode
.
ONLY_BOOK_FROM_TODAY
);
}
if
(
bookStartDate
.
compareTo
(
bookEndDate
)
>
0
)
{
throw
new
BaseException
(
ResultCode
.
ONLY_BOOK_FROM_TODAY
);
if
(!
Boolean
.
TRUE
.
equals
(
notCheckTimeLegal
))
{
if
(
bookStartDate
.
compareTo
(
DateTime
.
now
().
toString
(
DEFAULT_DATE_TIME_FORMATTER
))
<
0
)
{
throw
new
BaseException
(
ResultCode
.
ONLY_BOOK_FROM_TODAY
);
}
if
(
bookStartDate
.
compareTo
(
bookEndDate
)
>
0
)
{
throw
new
BaseException
(
ResultCode
.
ONLY_BOOK_FROM_TODAY
);
}
}
Map
<
String
,
Integer
>
predictableHours
=
Maps
.
newHashMap
();
//预定开始小时
int
hour
=
new
DateTime
(
startDate
).
hourOfDay
().
get
();
...
...
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/rest/RentVehicleController.java
View file @
bd8f4c2f
...
...
@@ -86,7 +86,7 @@ public class RentVehicleController extends BaseController<VehicleBiz> implements
//默认USER_APP 预约
Integer
operatorId
=
USER_APP
;
String
userName
=
USER_APP_NAME
;
return
baseBiz
.
unbookVehicle4Employee
(
operatorId
,
bookRecordId
,
userName
,
null
);
return
baseBiz
.
unbookVehicle4Employee
(
operatorId
,
bookRecordId
,
userName
,
null
,
Boolean
.
TRUE
);
}
/**
...
...
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/rest/VehicleController.java
View file @
bd8f4c2f
...
...
@@ -282,7 +282,7 @@ public class VehicleController extends BaseController<VehicleBiz> implements Use
public
RestResponse
<
Integer
>
unbookVehicle
(
Long
bookRecordId
,
String
rejectRemark
)
throws
Exception
{
Integer
operatorId
=
Integer
.
parseInt
(
BaseContextHandler
.
getUserID
());
String
userName
=
BaseContextHandler
.
getName
();
return
baseBiz
.
unbookVehicle4Employee
(
operatorId
,
bookRecordId
,
userName
,
rejectRemark
);
return
baseBiz
.
unbookVehicle4Employee
(
operatorId
,
bookRecordId
,
userName
,
rejectRemark
,
Boolean
.
FALSE
);
}
@RequestMapping
(
value
=
"/bookedRecord/{bookEndDate}/{id}"
,
method
=
RequestMethod
.
GET
)
...
...
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