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
b73ddf1e
Commit
b73ddf1e
authored
Aug 19, 2019
by
libin
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
parents
fd4b94a0
979d4542
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
6 deletions
+46
-6
VehicleBiz.java
...c/main/java/com/xxfc/platform/vehicle/biz/VehicleBiz.java
+45
-5
VehicleBookRecordMapper.xml
...ver/src/main/resources/mapper/VehicleBookRecordMapper.xml
+1
-1
No files found.
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleBiz.java
View file @
b73ddf1e
...
@@ -412,7 +412,14 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
...
@@ -412,7 +412,14 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
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
);
//检查车辆信息是否合法
//检查车辆信息是否合法
checkIfVehicleExists
(
bookVehicleVo
.
getVehicleId
());
Vehicle
vehicle
=
mapper
.
selectByPrimaryKey
(
bookVehicleVo
.
getVehicleId
());
if
(
vehicle
==
null
)
{
throw
new
BaseException
(
ResCode
.
VEHICLE_DEPARTURE_VEHICLE_UNEXIST
.
getDesc
(),
ResCode
.
VEHICLE_DEPARTURE_VEHICLE_UNEXIST
.
getCode
());
}
if
(!
vehicle
.
getStatus
().
equals
(
VehicleStatus
.
NORMAL
.
getCode
()))
{
throw
new
BaseException
(
ResCode
.
VEHICLE_DEPARTURE_VEHICLE_DISABLE
.
getDesc
()
+
", 车辆状态是:"
+
getVehicleStatus
(
vehicle
.
getStatus
(),
vehicle
.
getId
()),
ResCode
.
VEHICLE_DEPARTURE_VEHICLE_DISABLE
.
getCode
());
}
if
(
StringUtils
.
isBlank
(
bookVehicleVo
.
getBookStartDate
())
||
StringUtils
.
isBlank
(
bookVehicleVo
.
getBookEndDate
()))
{
if
(
StringUtils
.
isBlank
(
bookVehicleVo
.
getBookStartDate
())
||
StringUtils
.
isBlank
(
bookVehicleVo
.
getBookEndDate
()))
{
throw
new
BaseException
(
ResultCode
.
DATE_TIME_IS_NULL
);
throw
new
BaseException
(
ResultCode
.
DATE_TIME_IS_NULL
);
}
}
...
@@ -443,6 +450,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
...
@@ -443,6 +450,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
vehicleBookRecord
.
setStatus
(
bookVehicleVo
.
getStatus
());
vehicleBookRecord
.
setStatus
(
bookVehicleVo
.
getStatus
());
vehicleBookRecord
.
setBookUser
(
userId
);
vehicleBookRecord
.
setBookUser
(
userId
);
vehicleBookRecord
.
setBookUserName
(
userName
);
vehicleBookRecord
.
setBookUserName
(
userName
);
vehicleBookRecord
.
setLiftCompany
(
vehicle
.
getParkBranchCompanyId
());
vehicleBookRecordBiz
.
save
(
vehicleBookRecord
);
vehicleBookRecordBiz
.
save
(
vehicleBookRecord
);
}
else
{
}
else
{
vehicleBookRecord
=
vehicleBookRecordBiz
.
selectById
(
bookVehicleVo
.
getVehicleBookRecordId
());
vehicleBookRecord
=
vehicleBookRecordBiz
.
selectById
(
bookVehicleVo
.
getVehicleBookRecordId
());
...
@@ -744,15 +752,47 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
...
@@ -744,15 +752,47 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
* @param id
* @param id
*/
*/
public
boolean
checkIfVehicleExists
(
String
id
){
public
boolean
checkIfVehicleExists
(
String
id
){
Integer
count
=
mapper
.
selectCount
(
new
Vehicle
(){{
setId
(
id
);
Vehicle
vehicle
=
mapper
.
selectByPrimaryKey
(
id
);
}});
if
(
vehicle
==
null
)
{
if
(
count
<=
0
){
return
false
;
return
false
;
}
}
if
(!
vehicle
.
getStatus
().
equals
(
VehicleStatus
.
NORMAL
.
getCode
()))
{
throw
new
BaseException
(
ResCode
.
VEHICLE_DEPARTURE_VEHICLE_DISABLE
.
getDesc
()
+
", 车辆状态是:"
+
getVehicleStatus
(
vehicle
.
getStatus
(),
vehicle
.
getId
()),
ResCode
.
VEHICLE_DEPARTURE_VEHICLE_DISABLE
.
getCode
());
}
return
true
;
return
true
;
}
}
public
String
getVehicleStatus
(
Integer
status
,
String
vehicleId
)
{
StringBuilder
stringBuilder
=
new
StringBuilder
();
switch
(
status
)
{
case
1
:
stringBuilder
.
append
(
"正常运行"
);
break
;
case
2
:
stringBuilder
.
append
(
"维修"
);
break
;
case
3
:
stringBuilder
.
append
(
"报废"
);
break
;
case
4
:
stringBuilder
.
append
(
"出车"
);
break
;
case
5
:
stringBuilder
.
append
(
"保养"
);
break
;
}
List
<
VehicleBookRecordVo
>
vehicleBookRecordVos
=
vehicleBookRecordBiz
.
selectByVehicleId
(
vehicleId
);
if
(
vehicleBookRecordVos
!=
null
&&
vehicleBookRecordVos
.
size
()
>
0
)
{
stringBuilder
.
append
(
"中,使用人:"
);
stringBuilder
.
append
(
vehicleBookRecordVos
.
get
(
0
).
getVehicleUsername
());
stringBuilder
.
append
(
" 使用人电话:"
);
stringBuilder
.
append
(
vehicleBookRecordVos
.
get
(
0
).
getVehicleUserPhone
());
}
return
stringBuilder
.
toString
();
}
/**
/**
* 把日期范围转换为列表,并检查操作范围是否合法
* 把日期范围转换为列表,并检查操作范围是否合法
* @param yearMonthAndDate
* @param yearMonthAndDate
...
...
xx-vehicle/xx-vehicle-server/src/main/resources/mapper/VehicleBookRecordMapper.xml
View file @
b73ddf1e
...
@@ -485,7 +485,7 @@
...
@@ -485,7 +485,7 @@
and v1.book_user != -2
and v1.book_user != -2
</where>
</where>
group by v1.id
group by v1.id
order by
create_tim
e DESC
order by
book_start_dat
e DESC
</select>
</select>
...
...
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