Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
ne-shield-trialdrive-admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 74b67ff6
authored
Apr 16, 2022
by
levphon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
车辆管理-车辆编辑的时候验证设备占用情况
1 parent
206a413b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
4 deletions
src/main/java/cn/com/glsx/admin/modules/controller/VehicleController.java
src/main/java/cn/com/glsx/admin/modules/service/DeviceService.java
src/main/java/cn/com/glsx/admin/modules/controller/VehicleController.java
View file @
74b67ff
...
@@ -337,10 +337,17 @@ public class VehicleController {
...
@@ -337,10 +337,17 @@ public class VehicleController {
FileIOUtil
.
download
(
inputStream
,
FileIOUtil
.
MimeType
.
EXCEL2007
,
fileName
,
response
);
FileIOUtil
.
download
(
inputStream
,
FileIOUtil
.
MimeType
.
EXCEL2007
,
fileName
,
response
);
}
}
/**
* 验证试驾设备
*
* @param sn 校验设备号
* @param vehicleId 编辑车辆的车辆id
* @return
*/
@ApiOperation
(
value
=
"验证试驾设备"
)
@ApiOperation
(
value
=
"验证试驾设备"
)
@SysLog
(
module
=
"车辆管理"
,
value
=
"验证试驾设备"
,
action
=
OperateType
.
QUERY
,
saveLog
=
false
)
@SysLog
(
module
=
"车辆管理"
,
value
=
"验证试驾设备"
,
action
=
OperateType
.
QUERY
,
saveLog
=
false
)
@GetMapping
(
"/vehicleinfo/verifydevice"
)
@GetMapping
(
"/vehicleinfo/verifydevice"
)
public
R
verifydevice
(
@RequestParam
String
sn
)
{
public
R
verifydevice
(
@RequestParam
(
"sn"
)
String
sn
,
Long
vehicleId
)
{
// 校验设备号是否存在
// 校验设备号是否存在
boolean
snExist
=
deviceService
.
checkSnLocalAndRemote
(
sn
);
boolean
snExist
=
deviceService
.
checkSnLocalAndRemote
(
sn
);
if
(!
snExist
)
{
if
(!
snExist
)
{
...
@@ -348,7 +355,7 @@ public class VehicleController {
...
@@ -348,7 +355,7 @@ public class VehicleController {
}
}
// 校验设备号是否已经绑定
// 校验设备号是否已经绑定
boolean
bindSn
=
deviceService
.
checkBindStatusBySn
(
sn
);
boolean
bindSn
=
deviceService
.
checkBindStatusBySn
(
sn
,
vehicleId
);
if
(!
bindSn
)
{
if
(!
bindSn
)
{
return
R
.
error
(
1001
,
sn
+
"设备已经绑定"
).
data
(
false
);
return
R
.
error
(
1001
,
sn
+
"设备已经绑定"
).
data
(
false
);
}
}
...
@@ -378,7 +385,7 @@ public class VehicleController {
...
@@ -378,7 +385,7 @@ public class VehicleController {
noExistSnList
.
add
(
deviceInfoDto
.
getSn
());
noExistSnList
.
add
(
deviceInfoDto
.
getSn
());
}
}
// 校验设备号是否已经绑定
// 校验设备号是否已经绑定
boolean
bindSn
=
deviceService
.
checkBindStatusBySn
(
deviceInfoDto
.
getSn
());
boolean
bindSn
=
deviceService
.
checkBindStatusBySn
(
deviceInfoDto
.
getSn
()
,
null
);
if
(!
bindSn
)
{
if
(!
bindSn
)
{
bindSnList
.
add
(
deviceInfoDto
.
getSn
());
bindSnList
.
add
(
deviceInfoDto
.
getSn
());
}
}
...
...
src/main/java/cn/com/glsx/admin/modules/service/DeviceService.java
View file @
74b67ff
...
@@ -184,13 +184,18 @@ public class DeviceService {
...
@@ -184,13 +184,18 @@ public class DeviceService {
*
*
* @param sn 设备号
* @param sn 设备号
*/
*/
public
boolean
checkBindStatusBySn
(
String
sn
)
{
public
boolean
checkBindStatusBySn
(
String
sn
,
Long
vehicleId
)
{
if
(
StringUtils
.
isEmpty
(
sn
))
{
if
(
StringUtils
.
isEmpty
(
sn
))
{
return
false
;
return
false
;
}
}
VehicleDevice
vehicleDevice
=
vehicleDeviceMapper
.
selectBindDeviceBySn
(
sn
);
VehicleDevice
vehicleDevice
=
vehicleDeviceMapper
.
selectBindDeviceBySn
(
sn
);
if
(
vehicleDevice
==
null
)
{
if
(
vehicleDevice
==
null
)
{
return
true
;
return
true
;
}
else
{
if
(
vehicleDevice
.
getVehicleId
().
equals
(
vehicleId
))
{
return
true
;
}
}
}
return
false
;
return
false
;
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment