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
1f70b150
Commit
1f70b150
authored
Jan 03, 2023
by
zhangyanduan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add: 添加集成业务系统逻辑代码
parent
cc80fa48
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
79 additions
and
14 deletions
+79
-14
IDaHuaVideoService.java
...rcisoft/integration/video/Service/IDaHuaVideoService.java
+8
-0
DahuaVideoServiceImpl.java
...integration/video/Service/impl/DahuaVideoServiceImpl.java
+44
-2
CapturePicCallBack.java
.../rcisoft/integration/video/config/CapturePicCallBack.java
+17
-7
DoorDeviceInfo.java
...org/rcisoft/sys/doordeviceinfo/entity/DoorDeviceInfo.java
+8
-0
DoorReportData.java
...org/rcisoft/sys/doorreportdata/entity/DoorReportData.java
+0
-4
DoorDeviceInfoMapper.xml
src/main/resources/mapper/DoorDeviceInfoMapper.xml
+2
-1
No files found.
src/main/java/org/rcisoft/integration/video/Service/IDaHuaVideoService.java
View file @
1f70b150
package
org
.
rcisoft
.
integration
.
video
.
Service
;
import
org.rcisoft.sys.doorreportdata.entity.DoorReportData
;
import
org.springframework.stereotype.Service
;
/**
...
...
@@ -14,4 +15,11 @@ public interface IDaHuaVideoService {
*/
public
boolean
grabVideoDevicePicData
();
/**
* 抓取视频监控设备图像
* @param videoDeviceId
* @return
*/
public
boolean
grabVideoDevicePicData
(
Long
videoDeviceId
,
DoorReportData
reportData
)
}
src/main/java/org/rcisoft/integration/video/Service/impl/DahuaVideoServiceImpl.java
View file @
1f70b150
package
org
.
rcisoft
.
integration
.
video
.
Service
.
impl
;
import
com.sun.jna.Pointer
;
import
lombok.extern.slf4j.Slf4j
;
import
org.rcisoft.integration.video.Service.IDaHuaVideoService
;
import
org.rcisoft.integration.video.common.VideoDeviceHandel
;
...
...
@@ -8,7 +7,6 @@ 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.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -66,4 +64,48 @@ public class DahuaVideoServiceImpl implements IDaHuaVideoService {
boolean
picture
=
CapturePictureUtils
.
remoteCapturePicture
(
handel
.
getDeviceLoginHandle
(),
0
);
return
picture
;
}
@Override
public
boolean
grabVideoDevicePicData
(
Long
videoDeviceId
,
DoorReportData
reportData
)
{
/**
* 先判断是否已经初始化,
* 2、获取设备的配置信息
* 3、判断设备是否已经登录
* 4、未登录登录 一登录获取登录句柄
* 5、调用抓图工具类
* 6、回调写入数据
*/
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
);
if
(
login
){
handel
=
DaHuaVideoInitConfig
.
videoDeviceMap
.
get
(
videoDeviceId
);
}
}
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
(
login
){
handel
=
DaHuaVideoInitConfig
.
videoDeviceMap
.
get
(
videoDeviceId
);
}
}
}
if
(
handel
==
null
||!
handel
.
isLoginStatus
()){
return
false
;
}
String
basePath
=
"E:\\DAHUAPIC"
;
String
strFileName
=
basePath
+
"\\"
+
new
Date
().
getTime
()+
".jpg"
;
CapturePicCallBack
callBack
=
new
CapturePicCallBack
(
reportData
,
strFileName
);
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 @
1f70b150
...
...
@@ -15,19 +15,24 @@ import java.io.File;
import
java.io.IOException
;
import
java.util.Date
;
/**
* 抓拍数据回调方法
*/
@Slf4j
public
class
CapturePicCallBack
implements
NetSDKLib
.
fSnapRev
{
private
String
dataId
;
private
DoorReportData
reportData
;
private
String
savePath
;
private
DoorReportDataService
doorReportDataService
=
SpringBeanUtils
.
getBean
(
DoorReportDataService
.
class
);
public
CapturePicCallBack
(
String
dataId
,
String
savePath
)
{
this
.
dataId
=
dataId
;
public
CapturePicCallBack
(
DoorReportData
reportData
,
String
savePath
)
{
this
.
reportData
=
reportData
;
this
.
savePath
=
savePath
;
}
...
...
@@ -44,13 +49,8 @@ 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 basePath = "E:\\DAHUAPIC";
// String strFileName =basePath+"\\"+new Date().getTime()+".jpg";
String
strFileName
=
savePath
;
log
.
info
(
"回调函数中的dataId:"
+
dataId
);
DoorReportData
byId
=
doorReportDataService
.
findById
(
1
);
log
.
info
(
JSONObject
.
toJSONString
(
byId
));
System
.
out
.
println
(
"strFileName = "
+
strFileName
);
byte
[]
buf
=
pBuf
.
getByteArray
(
0
,
RevLen
);
ByteArrayInputStream
byteArrInput
=
new
ByteArrayInputStream
(
buf
);
...
...
@@ -60,6 +60,8 @@ public class CapturePicCallBack implements NetSDKLib.fSnapRev{
return
;
}
ImageIO
.
write
(
bufferedImage
,
"jpg"
,
new
File
(
strFileName
));
//开始保存数据到表中
}
catch
(
IOException
e
)
{
log
.
error
(
"抓图回调函数出现异常:"
+
e
.
getMessage
(),
e
);
}
...
...
@@ -81,4 +83,12 @@ public class CapturePicCallBack implements NetSDKLib.fSnapRev{
public
void
setSavePath
(
String
savePath
)
{
this
.
savePath
=
savePath
;
}
public
DoorReportData
getReportData
()
{
return
reportData
;
}
public
void
setReportData
(
DoorReportData
reportData
)
{
this
.
reportData
=
reportData
;
}
}
src/main/java/org/rcisoft/sys/doordeviceinfo/entity/DoorDeviceInfo.java
View file @
1f70b150
...
...
@@ -85,5 +85,13 @@ public class DoorDeviceInfo extends CyIdIncreEntity<DoorDeviceInfo> {
*/
private
String
devicePoint
;
/**
* @desc 关联视频监控设备ID
* @column link_video_id
* @default
*/
private
Long
linkVideoId
;
}
src/main/java/org/rcisoft/sys/doorreportdata/entity/DoorReportData.java
View file @
1f70b150
package
org
.
rcisoft
.
sys
.
doorreportdata
.
entity
;
import
cn.afterturn.easypoi.excel.annotation.Excel
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.*
;
import
org.rcisoft.core.entity.CyIdIncreEntity
;
import
java.math.BigInteger
;
import
java.util.Date
;
...
...
src/main/resources/mapper/DoorDeviceInfoMapper.xml
View file @
1f70b150
...
...
@@ -9,7 +9,8 @@
<result
column=
"device_address"
jdbcType=
"VARCHAR"
property=
"deviceAddress"
/>
<result
column=
"device_area"
jdbcType=
"VARCHAR"
property=
"deviceArea"
/>
<result
column=
"device_point"
jdbcType=
"VARCHAR"
property=
"devicePoint"
/>
<result
column=
"remark"
jdbcType=
"VARCHAR"
property=
"remark"
/>
<result
column=
"remark"
jdbcType=
"VARCHAR"
property=
"remarks"
/>
<result
column=
"link_video_id"
jdbcType=
"BIGINT"
property=
"linkVideoId"
/>
<result
column=
"del_flag"
jdbcType=
"CHAR"
property=
"delFlag"
/>
</resultMap>
...
...
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