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
7e50dd22
Commit
7e50dd22
authored
Jul 31, 2019
by
周健威
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/base-modify' into base-modify
parents
432b8688
45422b71
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
118 additions
and
3 deletions
+118
-3
VehicleBiz.java
...c/main/java/com/xxfc/platform/vehicle/biz/VehicleBiz.java
+102
-2
VehicleController.java
...ava/com/xxfc/platform/vehicle/rest/VehicleController.java
+16
-1
No files found.
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleBiz.java
View file @
7e50dd22
...
@@ -382,6 +382,107 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
...
@@ -382,6 +382,107 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
return
vehicleBookRecord
;
return
vehicleBookRecord
;
}
}
/**
* 需要审核
* @param userId
* @param bookVehicleVo
* @param userName
* @return
* @throws Exception
*/
@Transactional
public
VehicleBookRecord
applyForVehicle
(
Integer
userId
,
BookVehicleVO
bookVehicleVo
,
String
userName
)
throws
Exception
{
log
.
info
(
"预定车辆参数:userId = {}, bookVehicleVo = {},username = {}"
,
userId
,
bookVehicleVo
,
userName
);
//检查车辆信息是否合法
checkIfVehicleExists
(
bookVehicleVo
.
getVehicleId
());
//提取日期和相应的预定目标日期
Map
<
String
,
List
<
String
>>
yearMonthAndDate
=
Maps
.
newHashMap
();
DateTime
startDay
=
DateTime
.
parse
(
bookVehicleVo
.
getBookStartDate
(),
DATE_TIME_FORMATTER
);
DateTime
endDay
=
DateTime
.
parse
(
bookVehicleVo
.
getBookEndDate
(),
DATE_TIME_FORMATTER
);
//转换日期范围为列表,并检查是否合法
fillDateList4DatePeriod
(
yearMonthAndDate
,
startDay
,
endDay
);
if
(
yearMonthAndDate
.
size
()>
3
){
//连续的日期最多夸3个月
throw
new
CustomIllegalParamException
(
" you can only within 2 month"
);
}
//检查车辆是否可以预定
for
(
Map
.
Entry
<
String
,
List
<
String
>>
entry:
yearMonthAndDate
.
entrySet
()){
Boolean
rsEach
=
applyVehicle4EmployeePerMonth
(
bookVehicleVo
.
getVehicleId
(),
entry
.
getValue
(),
entry
.
getKey
());
if
(
Boolean
.
FALSE
.
equals
(
rsEach
)){
throw
new
BaseException
(
ResultCode
.
FAILED_CODE
);
}
}
//加入预定申请记录
VehicleBookRecord
vehicleBookRecord
=
null
;
if
(
bookVehicleVo
.
getVehicleBookRecordId
()
==
null
)
{
vehicleBookRecord
=
new
VehicleBookRecord
();
vehicleBookRecord
.
setVehicleId
(
bookVehicleVo
.
getVehicleId
());
vehicleBookRecord
.
setBookType
(
bookVehicleVo
.
getBookType
());
vehicleBookRecord
.
setStatus
(
VehicleBookRecordStatus
.
APPLY
.
getCode
());
vehicleBookRecord
.
setBookUser
(
userId
);
vehicleBookRecord
.
setBookUserName
(
userName
);
vehicleBookRecord
.
setBookStartDate
(
startDay
.
toDate
());
vehicleBookRecord
.
setBookEndDate
(
endDay
.
toDate
());
vehicleBookRecord
.
setLiftAddr
(
bookVehicleVo
.
getLiftAddr
());
vehicleBookRecord
.
setRemark
(
bookVehicleVo
.
getRemark
());
vehicleBookRecord
.
setDestination
(
bookVehicleVo
.
getDestination
());
vehicleBookRecord
.
setLiftCompany
(
bookVehicleVo
.
getLiftCompany
());
vehicleBookRecord
.
setRetCompany
(
bookVehicleVo
.
getRetCompany
());
vehicleBookRecord
.
setVehicleUsername
(
bookVehicleVo
.
getVehicleUsername
());
vehicleBookRecord
.
setVehicleUserPhone
(
bookVehicleVo
.
getVehicleUserPhone
());
vehicleBookRecord
.
setUpkeepIds
(
bookVehicleVo
.
getUpkeepIds
());
vehicleBookRecordBiz
.
save
(
vehicleBookRecord
);
}
else
{
vehicleBookRecord
=
vehicleBookRecordBiz
.
selectById
(
bookVehicleVo
.
getVehicleBookRecordId
());
vehicleBookRecord
.
setBookStartDate
(
startDay
.
toDate
());
vehicleBookRecord
.
setBookEndDate
(
endDay
.
toDate
());
vehicleBookRecordBiz
.
updateSelectiveByIdRe
(
vehicleBookRecord
);
}
// //添加预定时间记录
VehicleBookRecord
newValue
=
vehicleBookRecordBiz
.
selectOne
(
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
());
vehicleBookHourInfoDto
.
setBookRecordId
(
newValue
.
getId
());
vehicleBookHourInfoBiz
.
save
(
vehicleBookHourInfoDto
);
}
//修改相关车辆预定记录
Boolean
hasSuc
=
bookedVehicle
(
bookVehicleVo
);
if
(!
hasSuc
){
throw
new
BaseException
(
ResultCode
.
FAILED_CODE
);
}
//添加随车物品
List
<
Map
<
String
,
Object
>>
params
=
Lists
.
newArrayList
();
if
(
MapUtils
.
isNotEmpty
(
bookVehicleVo
.
getSelectedAccItem
())){
for
(
Map
.
Entry
<
Integer
,
Integer
>
idAndAmount
:
bookVehicleVo
.
getSelectedAccItem
().
entrySet
()){
Map
<
String
,
Object
>
row
=
Maps
.
newHashMap
();
row
.
put
(
"id"
,
idAndAmount
.
getKey
());
row
.
put
(
"amount"
,
idAndAmount
.
getValue
());
row
.
put
(
"bookRecordId"
,
vehicleBookRecord
.
getId
());
params
.
add
(
row
);
}
bookRecordAccItemMapper
.
batchAdd
(
params
);
}
return
vehicleBookRecord
;
}
/**
* 不需要审核
* @param userId
* @param bookVehicleVo
* @param userName
* @return
* @throws Exception
*/
@Transactional
@Transactional
public
VehicleBookRecord
applyVehicle
(
Integer
userId
,
BookVehicleVO
bookVehicleVo
,
String
userName
)
throws
Exception
{
public
VehicleBookRecord
applyVehicle
(
Integer
userId
,
BookVehicleVO
bookVehicleVo
,
String
userName
)
throws
Exception
{
log
.
info
(
"预定车辆参数:userId = {}, bookVehicleVo = {},username = {}"
,
userId
,
bookVehicleVo
,
userName
);
log
.
info
(
"预定车辆参数:userId = {}, bookVehicleVo = {},username = {}"
,
userId
,
bookVehicleVo
,
userName
);
...
@@ -468,7 +569,6 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
...
@@ -468,7 +569,6 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
}
}
@Transactional
@Transactional
public
Boolean
applyVehicle4EmployeePerMonth
(
String
vehicleId
,
List
<
String
>
bookedDates
,
String
yearMonth
){
public
Boolean
applyVehicle4EmployeePerMonth
(
String
vehicleId
,
List
<
String
>
bookedDates
,
String
yearMonth
){
//检查车辆是否有空档
//检查车辆是否有空档
...
...
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/rest/VehicleController.java
View file @
7e50dd22
...
@@ -199,7 +199,7 @@ public class VehicleController extends BaseController<VehicleBiz> {
...
@@ -199,7 +199,7 @@ public class VehicleController extends BaseController<VehicleBiz> {
}
}
/**
/**
* 申请预定车辆
* 申请预定车辆
不需要审核
*
*
* @param bookVehicleVo
* @param bookVehicleVo
* @return
* @return
...
@@ -213,6 +213,21 @@ public class VehicleController extends BaseController<VehicleBiz> {
...
@@ -213,6 +213,21 @@ public class VehicleController extends BaseController<VehicleBiz> {
return
RestResponse
.
suc
();
return
RestResponse
.
suc
();
}
}
/**
* 申请预定车辆 需要审核
*
* @param bookVehicleVo
* @return
*/
@RequestMapping
(
value
=
"/apply/book/vehicle"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
value
=
"申请预定车辆信息"
)
public
RestResponse
<
Integer
>
applyForVehicle
(
@RequestBody
BookVehicleVO
bookVehicleVo
)
throws
Exception
{
Integer
operatorId
=
Integer
.
parseInt
(
BaseContextHandler
.
getUserID
());
String
userName
=
BaseContextHandler
.
getName
();
baseBiz
.
applyForVehicle
(
operatorId
,
bookVehicleVo
,
userName
);
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