Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
entrance_api
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
王琮
entrance_api
Commits
50a88741
Commit
50a88741
authored
Jan 03, 2023
by
zhangyanduan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add:添加门磁联动大华视频监控设备抓拍图像功能开发
parent
c5aff7d4
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
191 additions
and
64 deletions
+191
-64
AepPushController.java
...rcisoft/integration/aep/Controller/AepPushController.java
+55
-6
AepPushServiceImpl.java
...soft/integration/aep/service/impl/AepPushServiceImpl.java
+8
-0
IDaHuaVideoService.java
...rcisoft/integration/video/Service/IDaHuaVideoService.java
+2
-2
DahuaVideoServiceImpl.java
...integration/video/Service/impl/DahuaVideoServiceImpl.java
+46
-20
CapturePicCallBack.java
.../rcisoft/integration/video/config/CapturePicCallBack.java
+27
-17
DaHuaVideoInitConfig.java
...cisoft/integration/video/config/DaHuaVideoInitConfig.java
+1
-1
DoorReportDataController.java
...s/doorreportdata/controller/DoorReportDataController.java
+2
-1
DoorReportDataService.java
...oft/sys/doorreportdata/service/DoorReportDataService.java
+3
-1
DoorReportDataServiceImpl.java
...oorreportdata/service/impl/DoorReportDataServiceImpl.java
+1
-1
DoorVideoDevice.java
...g/rcisoft/sys/doorvideodevice/entity/DoorVideoDevice.java
+1
-15
DoorVideoDeviceService.java
...t/sys/doorvideodevice/service/DoorVideoDeviceService.java
+16
-0
DoorVideoDeviceServiceImpl.java
...rvideodevice/service/impl/DoorVideoDeviceServiceImpl.java
+29
-0
No files found.
src/main/java/org/rcisoft/integration/aep/Controller/AepPushController.java
View file @
50a88741
...
...
@@ -3,11 +3,16 @@ package org.rcisoft.integration.aep.Controller;
import
com.alibaba.fastjson.JSONObject
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.rcisoft.core.anno.CyOpeLogAnno
;
import
org.rcisoft.core.operlog.enums.CyLogTypeEnum
;
import
org.rcisoft.integration.aep.service.IAepPushService
;
import
org.rcisoft.integration.jieLink.dto.JieLinkResultDto
;
import
org.rcisoft.integration.video.Service.IDaHuaVideoService
;
import
org.rcisoft.sys.doorreportdata.entity.DoorReportData
;
import
org.rcisoft.sys.doorreportdata.service.DoorReportDataService
;
import
org.rcisoft.sys.doorvideodevice.entity.DoorVideoDevice
;
import
org.rcisoft.sys.doorvideodevice.service.DoorVideoDeviceService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -23,6 +28,12 @@ public class AepPushController {
@Autowired
private
IDaHuaVideoService
daHuaVideoService
;
@Autowired
private
DoorVideoDeviceService
doorVideoDeviceService
;
@Autowired
private
DoorReportDataService
doorReportDataService
;
/**
* 门磁推送数据接口
* @param data
...
...
@@ -80,16 +91,49 @@ public class AepPushController {
}
/**
*
门磁推送数据接口
* @param data
*
视频监控设备抓图①
* @param data
Id
* @return
*/
@ApiOperation
(
value
=
"大华视频监控设备抓图"
,
notes
=
"大华视频监控设备抓图"
)
@ApiOperation
(
value
=
"大华视频监控设备抓图
①
"
,
notes
=
"大华视频监控设备抓图"
)
@GetMapping
(
value
=
"/grabVideoPic"
)
public
JieLinkResultDto
grabVideoPic
()
{
public
JieLinkResultDto
grabVideoPic
(
String
dataId
)
{
JieLinkResultDto
result
=
new
JieLinkResultDto
();
boolean
grabFlag
=
daHuaVideoService
.
grabVideoDevicePicData
(
dataId
);
if
(
grabFlag
){
result
.
setCode
(
"200"
);
result
.
setMsg
(
"抓取成功"
);
}
else
{
result
.
setCode
(
"-1"
);
result
.
setMsg
(
"抓取失败"
);
}
return
result
;
}
boolean
grabFlag
=
daHuaVideoService
.
grabVideoDevicePicData
();
/**
* 视频监控设备抓图②
* @param dataId
* @return
*/
@ApiOperation
(
value
=
"大华视频监控设备抓图②"
,
notes
=
"大华视频监控设备抓图"
)
@GetMapping
(
value
=
"/grabVideoPicByDataId"
)
public
JieLinkResultDto
grabVideoPicByDataId
(
String
videoDeviceId
,
String
dataId
)
{
JieLinkResultDto
result
=
new
JieLinkResultDto
();
if
(
StringUtils
.
isNotBlank
(
videoDeviceId
)
&&
StringUtils
.
isNotBlank
(
dataId
)){
DoorVideoDevice
videoDevice
=
doorVideoDeviceService
.
getDeviceInfoById
(
Long
.
parseLong
(
videoDeviceId
));
if
(
videoDevice
==
null
){
result
.
setCode
(
"-1"
);
result
.
setMsg
(
"设备不存在"
);
return
result
;
}
DoorReportData
reportData
=
doorReportDataService
.
findById
(
Long
.
parseLong
(
dataId
));
if
(
reportData
==
null
){
result
.
setCode
(
"-1"
);
result
.
setMsg
(
"对应数据不存在"
);
return
result
;
}
boolean
grabFlag
=
daHuaVideoService
.
grabVideoDevicePicData
(
videoDevice
.
getBusinessId
().
longValue
(),
reportData
);
if
(
grabFlag
){
result
.
setCode
(
"200"
);
result
.
setMsg
(
"抓取成功"
);
...
...
@@ -97,6 +141,11 @@ public class AepPushController {
result
.
setCode
(
"-1"
);
result
.
setMsg
(
"抓取失败"
);
}
}
else
{
result
.
setCode
(
"-1"
);
result
.
setMsg
(
"参数缺失"
);
}
return
result
;
}
...
...
src/main/java/org/rcisoft/integration/aep/service/impl/AepPushServiceImpl.java
View file @
50a88741
...
...
@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.rcisoft.integration.aep.service.IAepPushService
;
import
org.rcisoft.integration.video.Service.IDaHuaVideoService
;
import
org.rcisoft.sys.doordeviceinfo.entity.DoorDeviceInfo
;
import
org.rcisoft.sys.doordeviceinfo.service.DoorDeviceInfoService
;
import
org.rcisoft.sys.doorreportdata.entity.DoorReportData
;
...
...
@@ -32,6 +33,10 @@ public class AepPushServiceImpl implements IAepPushService {
@Autowired
private
DoorReportDataService
doorReportDataService
;
@Autowired
private
IDaHuaVideoService
daHuaVideoService
;
private
boolean
videoStatus
=
false
;
/**
* 门磁数据上报处理
...
...
@@ -85,6 +90,9 @@ public class AepPushServiceImpl implements IAepPushService {
reportData
.
setDelFlag
(
"0"
);
//保存数据操作
doorReportDataService
.
persist
(
reportData
);
if
(
videoStatus
&&
deviceInfo
.
getLinkVideoId
()!=
null
&&
StringUtils
.
equals
(
"OPEN"
,
reportData
.
getDataType
())){
daHuaVideoService
.
grabVideoDevicePicData
(
deviceInfo
.
getLinkVideoId
(),
reportData
);
}
}
}
else
{
//异常信息,获取负载信息失败了
...
...
src/main/java/org/rcisoft/integration/video/Service/IDaHuaVideoService.java
View file @
50a88741
...
...
@@ -13,13 +13,13 @@ public interface IDaHuaVideoService {
* 抓取视频监控设备图像
* @return
*/
public
boolean
grabVideoDevicePicData
();
public
boolean
grabVideoDevicePicData
(
String
dataId
);
/**
* 抓取视频监控设备图像
* @param videoDeviceId
* @return
*/
public
boolean
grabVideoDevicePicData
(
Long
videoDeviceId
,
DoorReportData
reportData
)
public
boolean
grabVideoDevicePicData
(
Long
videoDeviceId
,
DoorReportData
reportData
)
;
}
src/main/java/org/rcisoft/integration/video/Service/impl/DahuaVideoServiceImpl.java
View file @
50a88741
package
org
.
rcisoft
.
integration
.
video
.
Service
.
impl
;
import
lombok.extern.slf4j.Slf4j
;
import
org.rcisoft.core.util.CyDateUtil
;
import
org.rcisoft.integration.video.Service.IDaHuaVideoService
;
import
org.rcisoft.integration.video.common.VideoDeviceHandel
;
import
org.rcisoft.integration.video.config.CapturePicCallBack
;
import
org.rcisoft.integration.video.config.DaHuaVideoInitConfig
;
import
org.rcisoft.integration.video.utils.CapturePictureUtils
;
import
org.rcisoft.sys.doorreportdata.entity.DoorReportData
;
import
org.rcisoft.sys.doorvideodevice.entity.DoorVideoDevice
;
import
org.rcisoft.sys.doorvideodevice.service.DoorVideoDeviceService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.io.File
;
import
java.util.Date
;
/**
...
...
@@ -21,8 +27,16 @@ import java.util.Date;
@Transactional
(
readOnly
=
true
,
propagation
=
Propagation
.
NOT_SUPPORTED
)
public
class
DahuaVideoServiceImpl
implements
IDaHuaVideoService
{
@Value
(
"${global.path.base_upload_location}"
)
private
String
baseUploadLocation
;
@Autowired
private
DoorVideoDeviceService
doorVideoDeviceService
;
@Override
public
boolean
grabVideoDevicePicData
()
{
public
boolean
grabVideoDevicePicData
(
String
dataId
)
{
/**
* 先判断是否已经初始化,
* 2、获取设备的配置信息
...
...
@@ -32,6 +46,7 @@ public class DahuaVideoServiceImpl implements IDaHuaVideoService {
* 6、回调写入数据
*/
VideoDeviceHandel
handel
=
null
;
if
(!
DaHuaVideoInitConfig
.
videoDeviceMap
.
containsKey
(
0L
)){
String
deviceIp
=
"192.168.1.199"
;
int
devicePort
=
37777
;
...
...
@@ -57,9 +72,11 @@ public class DahuaVideoServiceImpl implements IDaHuaVideoService {
if
(
handel
==
null
||!
handel
.
isLoginStatus
()){
return
false
;
}
String
basePath
=
"E:\\DAHUAPIC"
;
String
strFileName
=
basePath
+
"\\"
+
new
Date
().
getTime
()+
".jpg"
;
CapturePicCallBack
callBack
=
new
CapturePicCallBack
(
"11111111"
,
strFileName
);
String
basePath
=
baseUploadLocation
;
String
savePicPath
=
"VIDEOPIC"
+
File
.
separator
+
CyDateUtil
.
getSimpleDate
(
"yyyyMMdd"
,
new
Date
());
DoorReportData
data
=
new
DoorReportData
();
data
.
setReportTime
(
new
Date
());
CapturePicCallBack
callBack
=
new
CapturePicCallBack
(
basePath
,
savePicPath
,
data
);
CapturePictureUtils
.
setSnapRevCallBack
(
callBack
,
null
);
boolean
picture
=
CapturePictureUtils
.
remoteCapturePicture
(
handel
.
getDeviceLoginHandle
(),
0
);
return
picture
;
...
...
@@ -77,33 +94,42 @@ public class DahuaVideoServiceImpl implements IDaHuaVideoService {
*/
VideoDeviceHandel
handel
=
null
;
if
(!
DaHuaVideoInitConfig
.
videoDeviceMap
.
containsKey
(
videoDeviceId
)){
String
deviceIp
=
"192.168.1.199"
;
int
devicePort
=
37777
;
String
deviceAccount
=
"admin"
;
String
deviceSign
=
"admin123"
;
boolean
login
=
DaHuaVideoInitConfig
.
login
(
deviceIp
,
devicePort
,
deviceAccount
,
deviceSign
);
DoorVideoDevice
videoDevice
=
doorVideoDeviceService
.
getDeviceInfoById
(
videoDeviceId
);
if
(
videoDevice
!=
null
){
String
deviceIp
=
videoDevice
.
getDeviceIp
();
int
devicePort
=
Integer
.
parseInt
(
videoDevice
.
getDevicePort
());
String
deviceAccount
=
videoDevice
.
getDeviceAccount
();
String
deviceSign
=
videoDevice
.
getDeviceSign
();
boolean
login
=
DaHuaVideoInitConfig
.
login
(
videoDeviceId
,
deviceIp
,
devicePort
,
deviceAccount
,
deviceSign
);
if
(
login
){
handel
=
DaHuaVideoInitConfig
.
videoDeviceMap
.
get
(
videoDeviceId
);
}
}
else
{
//设备未找到
log
.
error
(
"设备【"
+
videoDeviceId
+
"】 未找到"
);
return
false
;
}
}
else
{
handel
=
DaHuaVideoInitConfig
.
videoDeviceMap
.
get
(
videoDeviceId
);
if
(
handel
.
isLoginStatus
()){
String
deviceIp
=
"192.168.1.199"
;
int
devicePort
=
37777
;
String
deviceAccount
=
"admin"
;
String
deviceSign
=
"admin123"
;
boolean
login
=
DaHuaVideoInitConfig
.
login
(
deviceIp
,
devicePort
,
deviceAccount
,
deviceSign
);
if
(!
handel
.
isLoginStatus
()){
DoorVideoDevice
videoDevice
=
doorVideoDeviceService
.
getDeviceInfoById
(
videoDeviceId
);
String
deviceIp
=
videoDevice
.
getDeviceIp
();
int
devicePort
=
Integer
.
parseInt
(
videoDevice
.
getDevicePort
());
String
deviceAccount
=
videoDevice
.
getDeviceAccount
();
String
deviceSign
=
videoDevice
.
getDeviceSign
();
boolean
login
=
DaHuaVideoInitConfig
.
login
(
videoDeviceId
,
deviceIp
,
devicePort
,
deviceAccount
,
deviceSign
);
if
(
login
){
handel
=
DaHuaVideoInitConfig
.
videoDeviceMap
.
get
(
videoDeviceId
);
}
}
}
if
(
handel
==
null
||!
handel
.
isLoginStatus
()){
log
.
error
(
"设备【"
+
videoDeviceId
+
"】 未能注册成功或已掉线"
);
return
false
;
}
String
basePath
=
"E:\\DAHUAPIC"
;
String
strFileName
=
basePath
+
"\\"
+
new
Date
().
getTime
()+
".jpg"
;
CapturePicCallBack
callBack
=
new
CapturePicCallBack
(
reportData
,
strFileName
);
String
basePath
=
baseUploadLocation
;
String
picSavePath
=
"VIDEOPIC"
+
File
.
separator
+
CyDateUtil
.
getSimpleDate
(
"yyyyMMdd"
,
new
Date
())
;
CapturePicCallBack
callBack
=
new
CapturePicCallBack
(
basePath
,
picSavePath
,
reportData
);
CapturePictureUtils
.
setSnapRevCallBack
(
callBack
,
null
);
boolean
picture
=
CapturePictureUtils
.
remoteCapturePicture
(
handel
.
getDeviceLoginHandle
(),
0
);
return
picture
;
...
...
src/main/java/org/rcisoft/integration/video/config/CapturePicCallBack.java
View file @
50a88741
package
org
.
rcisoft
.
integration
.
video
.
config
;
import
cn.hutool.core.io.FileUtil
;
import
cn.hutool.core.util.IdUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.sun.jna.Pointer
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -13,7 +15,6 @@ import java.awt.image.BufferedImage;
import
java.io.ByteArrayInputStream
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.Date
;
/**
* 抓拍数据回调方法
...
...
@@ -21,19 +22,29 @@ import java.util.Date;
@Slf4j
public
class
CapturePicCallBack
implements
NetSDKLib
.
fSnapRev
{
/**
* 服务器内存储的根路径
*/
private
String
basePath
;
private
String
dataId
;
/**
* 文件存储的路径
*/
private
String
savePath
;
/**
* 需要操作的数据
*/
private
DoorReportData
reportData
;
private
String
savePath
;
private
DoorReportDataService
doorReportDataService
=
SpringBeanUtils
.
getBean
(
DoorReportDataService
.
class
);
public
CapturePicCallBack
(
DoorReportData
reportData
,
String
savePath
)
{
this
.
reportData
=
reportData
;
public
CapturePicCallBack
(
String
basePath
,
String
savePath
,
DoorReportData
reportData
)
{
this
.
basePath
=
basePath
;
this
.
savePath
=
savePath
;
this
.
reportData
=
reportData
;
}
/**
...
...
@@ -49,9 +60,12 @@ public class CapturePicCallBack implements NetSDKLib.fSnapRev{
public
void
invoke
(
NetSDKLib
.
LLong
lLoginID
,
Pointer
pBuf
,
int
RevLen
,
int
EncodeType
,
int
CmdSerial
,
Pointer
dwUser
)
{
BufferedImage
bufferedImage
=
null
;
if
(
pBuf
!=
null
&&
RevLen
>
0
)
{
String
strFileName
=
savePath
;
log
.
info
(
"回调函数中的dataId:"
+
dataId
);
String
savePicPath
=
basePath
+
File
.
separator
+
savePath
;
String
picFileName
=
IdUtil
.
simpleUUID
()+
".JPG"
;
if
(!
FileUtil
.
exist
(
savePicPath
)){
FileUtil
.
mkdir
(
savePicPath
);
}
String
strFileName
=
savePicPath
+
File
.
separator
+
picFileName
;
byte
[]
buf
=
pBuf
.
getByteArray
(
0
,
RevLen
);
ByteArrayInputStream
byteArrInput
=
new
ByteArrayInputStream
(
buf
);
try
{
...
...
@@ -61,21 +75,17 @@ public class CapturePicCallBack implements NetSDKLib.fSnapRev{
}
ImageIO
.
write
(
bufferedImage
,
"jpg"
,
new
File
(
strFileName
));
//开始保存数据到表中
String
picRelativePath
=
savePath
+
File
.
separator
+
picFileName
;
picRelativePath
=
picRelativePath
.
replaceAll
(
"\\\\"
,
"/"
);
//转换文件的路径,从存储路径转换到访问路径
reportData
.
setCapturePic
(
picRelativePath
);
doorReportDataService
.
merge
(
reportData
);
}
catch
(
IOException
e
)
{
log
.
error
(
"抓图回调函数出现异常:"
+
e
.
getMessage
(),
e
);
}
}
}
public
String
getDataId
()
{
return
dataId
;
}
public
void
setDataId
(
String
dataId
)
{
this
.
dataId
=
dataId
;
}
public
String
getSavePath
()
{
return
savePath
;
}
...
...
src/main/java/org/rcisoft/integration/video/config/DaHuaVideoInitConfig.java
View file @
50a88741
...
...
@@ -153,7 +153,7 @@ public class DaHuaVideoInitConfig {
VideoDeviceHandel
handel
=
new
VideoDeviceHandel
();
handel
.
setDeviceLoginHandle
(
m_hLoginHandle
);
handel
.
setLoginStatus
(
true
);
videoDeviceMap
.
put
(
0L
,
handel
);
videoDeviceMap
.
put
(
deviceId
,
handel
);
}
return
loginStatus
;
}
...
...
src/main/java/org/rcisoft/sys/doorreportdata/controller/DoorReportDataController.java
View file @
50a88741
...
...
@@ -85,10 +85,11 @@ public class DoorReportDataController extends CyPaginationController<DoorReportD
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"businessId"
,
value
=
"businessId"
,
required
=
true
,
dataType
=
"varchar"
)})
@GetMapping
(
"/detail/{businessId:\\w+}"
)
public
CyResult
detail
(
@PathVariable
int
businessId
)
{
long
dataId
=
businessId
;
return
CyResultGenUtil
.
builder
(
new
CyPersistModel
(
1
),
CyMessCons
.
MESSAGE_ALERT_SUCCESS
,
CyMessCons
.
MESSAGE_ALERT_ERROR
,
doorReportDataServiceImpl
.
findById
(
business
Id
));
doorReportDataServiceImpl
.
findById
(
data
Id
));
}
//@PreAuthorize("@cyPerm.hasPerm('sys:rReportData:list')")
...
...
src/main/java/org/rcisoft/sys/doorreportdata/service/DoorReportDataService.java
View file @
50a88741
...
...
@@ -39,7 +39,7 @@ public interface DoorReportDataService {
* @param id
* @return
*/
DoorReportData
findById
(
int
id
);
DoorReportData
findById
(
Long
id
);
/**
* 分页查询 门磁设备数据记录表
...
...
@@ -64,4 +64,6 @@ public interface DoorReportDataService {
*/
List
<
DoorReportData
>
export
(
DoorReportData
doorReportData
);
}
src/main/java/org/rcisoft/sys/doorreportdata/service/impl/DoorReportDataServiceImpl.java
View file @
50a88741
...
...
@@ -80,7 +80,7 @@ public class DoorReportDataServiceImpl extends ServiceImpl<DoorReportDataReposit
* @return
*/
@Override
public
DoorReportData
findById
(
int
id
){
public
DoorReportData
findById
(
Long
id
){
return
baseMapper
.
selectById
(
id
);
}
...
...
src/main/java/org/rcisoft/sys/doorvideodevice/entity/DoorVideoDevice.java
View file @
50a88741
...
...
@@ -15,61 +15,47 @@ import java.math.BigInteger;
@TableName
(
"door_video_device"
)
public
class
DoorVideoDevice
extends
CyIdIncreEntity
<
DoorVideoDevice
>
{
/**
* @desc 主键
* @column id
* @default
*/
@Excel
(
name
=
"主键"
,
orderNum
=
"0"
,
width
=
20
)
private
Long
id
;
/**
* @desc 视频监控设备名称
* @column device_name
* @default
*/
@Excel
(
name
=
"视频监控设备名称"
,
orderNum
=
"1"
,
width
=
20
)
private
String
deviceName
;
/**
* @desc 设备ip
* @column device_ip
* @default
*/
@Excel
(
name
=
"设备ip"
,
orderNum
=
"2"
,
width
=
20
)
private
String
deviceIp
;
/**
* @desc 设备端口号
* @column device_port
* @default
*/
@Excel
(
name
=
"设备端口号"
,
orderNum
=
"3"
,
width
=
20
)
private
String
devicePort
;
/**
* @desc 设备账号
* @column device_account
* @default
*/
@Excel
(
name
=
"设备账号"
,
orderNum
=
"4"
,
width
=
20
)
private
String
deviceAccount
;
/**
* @desc 设备密码
* @column device_sign
* @default
*/
@Excel
(
name
=
"设备密码"
,
orderNum
=
"5"
,
width
=
20
)
private
String
deviceSign
;
/**
* @desc 关联门磁设备id
* @column link_door_device_id
* @default
*/
@Excel
(
name
=
"关联门磁设备id"
,
orderNum
=
"6"
,
width
=
20
)
private
BigInteger
linkDoorDeviceId
;
private
Long
linkDoorDeviceId
;
/**
* @desc 关联门磁设备imei
* @column link_door_device_imei
* @default
*/
@Excel
(
name
=
"关联门磁设备imei"
,
orderNum
=
"7"
,
width
=
20
)
private
String
linkDoorDeviceImei
;
...
...
src/main/java/org/rcisoft/sys/doorvideodevice/service/DoorVideoDeviceService.java
View file @
50a88741
...
...
@@ -64,4 +64,20 @@ public interface DoorVideoDeviceService {
*/
List
<
DoorVideoDevice
>
export
(
DoorVideoDevice
doorVideoDevice
);
/**
* 根据设备ID获取设备信息
* @param deviceId
* @return
*/
DoorVideoDevice
getDeviceInfoById
(
Long
deviceId
);
/**
* 根据关联的门磁设备信息获取视频监控设备信息
* @param deviceImei
* @param linkId
* @return
*/
DoorVideoDevice
getDeviceInfoByLinkId
(
String
deviceImei
,
Long
linkId
);
}
src/main/java/org/rcisoft/sys/doorvideodevice/service/impl/DoorVideoDeviceServiceImpl.java
View file @
50a88741
...
...
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.apache.commons.lang3.StringUtils
;
import
org.rcisoft.core.util.CyUserUtil
;
import
org.rcisoft.core.aop.CyPageUtilAsp
;
import
org.rcisoft.core.model.CyPersistModel
;
...
...
@@ -116,4 +117,32 @@ public class DoorVideoDeviceServiceImpl extends ServiceImpl<DoorVideoDeviceRepos
return
doorVideoDeviceList
;
}
/**
* 根据设备ID获取设备信息
* @param deviceId
* @return
*/
@Override
public
DoorVideoDevice
getDeviceInfoById
(
Long
deviceId
)
{
DoorVideoDevice
doorVideoDevice
=
this
.
baseMapper
.
selectById
(
deviceId
);
return
doorVideoDevice
;
}
@Override
public
DoorVideoDevice
getDeviceInfoByLinkId
(
String
deviceImei
,
Long
linkId
)
{
QueryWrapper
<
DoorVideoDevice
>
queryWrapper
=
new
QueryWrapper
<>();
if
(
StringUtils
.
isNotBlank
(
deviceImei
)){
queryWrapper
.
eq
(
"link_door_device_imei"
,
deviceImei
);
}
if
(
linkId
!=
null
&&
linkId
!=
0
l
){
queryWrapper
.
eq
(
"link_door_device_id"
,
linkId
);
}
List
<
DoorVideoDevice
>
doorVideoDevices
=
this
.
baseMapper
.
selectList
(
queryWrapper
);
if
(
doorVideoDevices
!=
null
&&
!
doorVideoDevices
.
isEmpty
()){
return
doorVideoDevices
.
get
(
0
);
}
else
{
return
null
;
}
}
}
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