Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hzjtpushdateService
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
建金
hzjtpushdateService
Commits
0fb389f1
Commit
0fb389f1
authored
Mar 15, 2021
by
高飞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加手动筛选功能
parent
3fe59c5a
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
188 additions
and
23 deletions
+188
-23
src/main/java/com/hzjt/controller/TraffController.java
src/main/java/com/hzjt/controller/TraffController.java
+148
-9
src/main/java/com/hzjt/handler/WebSocket.java
src/main/java/com/hzjt/handler/WebSocket.java
+1
-0
src/main/java/com/hzjt/mapper/TraffAlarmRecordMapper.java
src/main/java/com/hzjt/mapper/TraffAlarmRecordMapper.java
+2
-0
src/main/java/com/hzjt/service/EventWriteService.java
src/main/java/com/hzjt/service/EventWriteService.java
+28
-7
src/main/resources/application.properties
src/main/resources/application.properties
+6
-6
src/main/resources/mapper/Traffalarmrecord.xml
src/main/resources/mapper/Traffalarmrecord.xml
+3
-1
No files found.
src/main/java/com/hzjt/controller/TraffController.java
View file @
0fb389f1
package
com
.
hzjt
.
controller
;
import
cn.hutool.core.codec.Base64Encoder
;
import
com.alibaba.fastjson.JSONObject
;
import
com.google.common.util.concurrent.RateLimiter
;
import
com.hzjt.domain.*
;
...
...
@@ -17,6 +18,7 @@ import org.springframework.beans.factory.annotation.Value;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.web.bind.annotation.*
;
import
javax.websocket.server.PathParam
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.net.HttpURLConnection
;
...
...
@@ -218,10 +220,20 @@ public class TraffController {
traffAlarmRecord
.
setRecordid
((
long
)
(
recordid
));
//发送给前端
Map
map
=
new
HashMap
();
//判断是否需要手动筛选
String
manualStatus
=
traffAlarmRecordMapper
.
seletManualStatus
();
if
(
manualStatus
.
equalsIgnoreCase
(
"1"
))
{
map
.
put
(
"type"
,
"recordalarm"
);
}
else
{
map
.
put
(
"type"
,
"alarm"
);
}
map
.
put
(
"data"
,
trffClientMessage
);
map
.
put
(
"recordid"
,
recordid
);
WebSocket
.
GroupSending
(
JsonUtil
.
beanToString
(
map
));
traffAlarmRecord
.
setProcessstatus
(
"0"
);
traffAlarmRecordMapper
.
inserTraffAlarmRecord
(
traffAlarmRecord
);
...
...
@@ -268,9 +280,11 @@ public class TraffController {
traffAlarmRecordMapper
.
updateTraffAlarmRecordUrl
(
traffAlarmRecord
);
//推送给第三方
if
(!
manualStatus
.
equalsIgnoreCase
(
"1"
))
{
ResultObj
obj
=
eventWriteService
.
updateAndAutoSendEvent
(
traffAlarmRecord
);
// log.info("send to guangda:HTTP_OK" + obj.toString());
}
}
}
else
{
ResultObj
obj
=
eventWriteService
.
updateAndAutoSendEvent
(
traffAlarmRecord
);
// log.info("send to guangda HttpURLConnection.HTTP_Fail--->response message:" + obj.toString());
...
...
@@ -288,9 +302,11 @@ public class TraffController {
}
else
{
//推送给第三方
//需要先过滤,过滤结束后推送给第三方
if
(!
manualStatus
.
equalsIgnoreCase
(
"1"
))
{
ResultObj
obj
=
eventWriteService
.
updateAndAutoSendEvent
(
traffAlarmRecord
);
// log.info("send to guangda novideopath --->response message" + obj.toString());
log
.
info
(
"send to guangda novideopath --->response message"
+
obj
.
toString
());
}
}
...
...
@@ -419,16 +435,139 @@ public class TraffController {
return
ResultObj
.
ok
();
}
//车流量推送
@GetMapping
(
"/sendtouser/{recordid}"
)
@ResponseBody
public
Integer
sendtouser
(
@PathVariable
(
"recordid"
)
String
recordid
)
{
//查询该信息
Traffalarmrecord
traffalarmrecord
=
traffAlarmRecordMapper
.
selectByPrimaryKey
(
recordid
);
if
(
traffalarmrecord
==
null
)
return
0
;
Alarm
alarm
=
new
Alarm
();
Base64Encoder
base64Encoder
=
new
Base64Encoder
();
alarm
.
setTs
(
Long
.
toString
(
traffalarmrecord
.
getRecordtime
()==
null
?
new
Date
().
getTime
():
traffalarmrecord
.
getRecordtime
().
getTime
()));
alarm
.
setDept
(
traffalarmrecord
.
getAreaid
()==
null
?
null
:
Long
.
toString
(
traffalarmrecord
.
getAreaid
()));
alarm
.
setVideo_id
(
traffalarmrecord
.
getFdid
()+
"_"
+
traffalarmrecord
.
getChannelid
());
alarm
.
setIncident_type
(
traffalarmrecord
.
getRecordtype
());
List
<
String
>
strImgs
=
new
ArrayList
<>();
if
(
traffalarmrecord
.
getImg1path
()
!=
null
){
byte
[]
Img
=
FTPUtil
.
getFtpPicBytes
(
traffalarmrecord
.
getImg1path
());
strImgs
.
add
(
Img
!=
null
?
base64Encoder
.
encode
(
Img
)
:
null
);
}
if
(
traffalarmrecord
.
getImg2path
()
!=
null
){
byte
[]
Img
=
FTPUtil
.
getFtpPicBytes
(
traffalarmrecord
.
getImg2path
());
strImgs
.
add
(
Img
!=
null
?
base64Encoder
.
encode
(
Img
)
:
null
);
}
if
(
traffalarmrecord
.
getImg3path
()
!=
null
)
{
byte
[]
Img
=
FTPUtil
.
getFtpPicBytes
(
traffalarmrecord
.
getImg3path
());
strImgs
.
add
(
Img
!=
null
?
base64Encoder
.
encode
(
Img
)
:
null
);
}
if
(
traffalarmrecord
.
getImg4path
()
!=
null
)
{
byte
[]
Img
=
FTPUtil
.
getFtpPicBytes
(
traffalarmrecord
.
getImg4path
());
strImgs
.
add
(
Img
!=
null
?
base64Encoder
.
encode
(
Img
)
:
null
);
}
if
(
traffalarmrecord
.
getImg5path
()
!=
null
)
{
byte
[]
Img
=
FTPUtil
.
getFtpPicBytes
(
traffalarmrecord
.
getImg5path
());
strImgs
.
add
(
Img
!=
null
?
base64Encoder
.
encode
(
Img
)
:
null
);
}
alarm
.
setImg_base64
(
strImgs
);
Map
map
=
new
HashMap
();
//websocket 推送给客户
map
.
put
(
"type"
,
"alarm"
);
map
.
put
(
"data"
,
alarm
);
map
.
put
(
"recordid"
,
recordid
);
WebSocket
.
GroupSending
(
JsonUtil
.
beanToString
(
map
));
try
{
//推送给第三方
ResultObj
obj
=
eventWriteService
.
updateAndAutoSendEvent
(
traffalarmrecord
);
log
.
info
(
"send to guangda novideopath --->response message"
+
obj
.
toString
());
if
(
obj
.
getStatus
()
==
200
)
{
return
1
;
}
else
{
return
0
;
}
}
catch
(
Exception
ex
){
log
.
info
(
"send to guangda novideopath --->response error"
+
ex
.
toString
());
return
1
;
}
}
//车流量推送
@GetMapping
(
"/test"
)
@ResponseBody
public
String
test
()
{
public
void
test
()
{
Alarm
alarm
=
new
Alarm
();
alarm
.
setVideo_id
(
"20200305112042989_0"
);
alarm
.
setIncident_type
(
"vehicle_ban"
);
alarm
.
setTs
(
"1345677777"
);
alarm
.
setType
(
"TRAFFIC_INCIDENT_ALARM"
);
Map
map
=
new
HashMap
();
map
.
put
(
"type"
,
"recordalarm"
);
map
.
put
(
"data"
,
alarm
);
map
.
put
(
"recordid"
,
"33448"
);
WebSocket
.
GroupSending
(
JsonUtil
.
beanToString
(
map
));
Traffalarmrecord
traffAlarmRecord
=
new
Traffalarmrecord
();
traffAlarmRecord
.
setRecordid
(
Long
.
parseLong
(
"33448"
));
traffAlarmRecord
.
setChannelid
(
new
Integer
(
1
));
traffAlarmRecord
.
setFdid
(
"20200305112042989"
);
traffAlarmRecord
.
setRecordtype
(
"vehicle_ban"
);
Long
ldir2
=
new
Long
(
180
);
String
result
=
ldir2
.
longValue
()<=
ldir
.
longValue
()?
"2"
:
"1"
;
return
result
;
// traffAlarmRecordMapper.inserTraffAlarmRecord(traffAlarmRecord);
map
.
put
(
"recordid"
,
"33449"
);
WebSocket
.
GroupSending
(
JsonUtil
.
beanToString
(
map
));
Traffalarmrecord
traffAlarmRecord2
=
new
Traffalarmrecord
();
traffAlarmRecord2
.
setRecordid
(
Long
.
parseLong
(
"33449"
));
traffAlarmRecord2
.
setChannelid
(
new
Integer
(
1
));
traffAlarmRecord2
.
setFdid
(
"20200305112042989"
);
traffAlarmRecord2
.
setRecordtype
(
"vehicle_ban"
);
// traffAlarmRecordMapper.inserTraffAlarmRecord(traffAlarmRecord2);
}
//车流量推送
@GetMapping
(
"/test2"
)
@ResponseBody
public
void
test2
()
{
Alarm
alarm
=
new
Alarm
();
alarm
.
setVideo_id
(
"20200305112042989_0"
);
alarm
.
setIncident_type
(
"vehicle_ban"
);
alarm
.
setType
(
"TRAFFIC_INCIDENT_ALARM"
);
Map
map
=
new
HashMap
();
map
.
put
(
"type"
,
"recordalarm"
);
map
.
put
(
"data"
,
alarm
);
map
.
put
(
"recordid"
,
"33446"
);
WebSocket
.
GroupSending
(
JsonUtil
.
beanToString
(
map
));
Traffalarmrecord
traffAlarmRecord
=
new
Traffalarmrecord
();
traffAlarmRecord
.
setRecordid
(
Long
.
parseLong
(
"33446"
));
traffAlarmRecord
.
setChannelid
(
new
Integer
(
1
));
traffAlarmRecord
.
setFdid
(
"20200305112042989"
);
traffAlarmRecord
.
setRecordtype
(
"vehicle_ban"
);
traffAlarmRecordMapper
.
inserTraffAlarmRecord
(
traffAlarmRecord
);
map
.
put
(
"recordid"
,
"33447"
);
WebSocket
.
GroupSending
(
JsonUtil
.
beanToString
(
map
));
Traffalarmrecord
traffAlarmRecord2
=
new
Traffalarmrecord
();
traffAlarmRecord2
.
setRecordid
(
Long
.
parseLong
(
"33447"
));
traffAlarmRecord2
.
setChannelid
(
new
Integer
(
1
));
traffAlarmRecord2
.
setFdid
(
"20200305112042989"
);
traffAlarmRecord2
.
setRecordtype
(
"vehicle_ban"
);
traffAlarmRecordMapper
.
inserTraffAlarmRecord
(
traffAlarmRecord2
);
}
}
src/main/java/com/hzjt/handler/WebSocket.java
View file @
0fb389f1
...
...
@@ -2,6 +2,7 @@ package com.hzjt.handler;
import
cn.hutool.json.JSONUtil
;
import
com.hzjt.service.TraffFlowService
;
import
com.hzjt.util.JsonUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Component
;
...
...
src/main/java/com/hzjt/mapper/TraffAlarmRecordMapper.java
View file @
0fb389f1
...
...
@@ -31,4 +31,6 @@ public interface TraffAlarmRecordMapper extends BaseMapper<Traffalarmrecord>, Co
Integer
updateInworkRectifytimeTraffAlarm
(
Traffalarmrecord
traffalarmrecord
);
String
seletManualStatus
();
}
\ No newline at end of file
src/main/java/com/hzjt/service/EventWriteService.java
View file @
0fb389f1
...
...
@@ -140,14 +140,35 @@ public class EventWriteService {
eventWriteParam
.
setEventDeviceID
(
sbtdspsr
.
get
(
0
).
getWbbh
());
eventWriteParam
.
setEventSupplier
(
EVENT_SUPPLIER
);
BASE64Encoder
base64Encoder
=
new
BASE64Encoder
();
if
(
traffalarmrecord
.
getImg1path
()
!=
null
){
byte
[]
Img
=
FTPUtil
.
getFtpPicBytes
(
traffalarmrecord
.
getImg1path
());
eventWriteParam
.
setEventProof1
(
Img
!=
null
?
base64Encoder
.
encode
(
Img
)
:
null
);
}
if
(
traffalarmrecord
.
getImg2path
()
!=
null
){
byte
[]
Img
=
FTPUtil
.
getFtpPicBytes
(
traffalarmrecord
.
getImg2path
());
eventWriteParam
.
setEventProof2
(
Img
!=
null
?
base64Encoder
.
encode
(
Img
)
:
null
);
}
if
(
traffalarmrecord
.
getImg3path
()
!=
null
)
{
byte
[]
Img
=
FTPUtil
.
getFtpPicBytes
(
traffalarmrecord
.
getImg3path
());
eventWriteParam
.
setEventProof3
(
Img
!=
null
?
base64Encoder
.
encode
(
Img
)
:
null
);
eventWriteParam
.
setEventProof1
(
traffalarmrecord
.
getImg1path
()!=
null
?
base64Encoder
.
encode
(
FTPUtil
.
getFtpPicBytes
(
traffalarmrecord
.
getImg1path
())):
null
);
eventWriteParam
.
setEventProof2
(
traffalarmrecord
.
getImg2path
()!=
null
?
base64Encoder
.
encode
(
FTPUtil
.
getFtpPicBytes
(
traffalarmrecord
.
getImg2path
())):
null
);
eventWriteParam
.
setEventProof3
(
traffalarmrecord
.
getImg3path
()!=
null
?
base64Encoder
.
encode
(
FTPUtil
.
getFtpPicBytes
(
traffalarmrecord
.
getImg3path
())):
null
);
eventWriteParam
.
setEventProof4
(
traffalarmrecord
.
getImg4path
()!=
null
?
base64Encoder
.
encode
(
FTPUtil
.
getFtpPicBytes
(
traffalarmrecord
.
getImg4path
())):
null
);
eventWriteParam
.
setEventProof5
(
traffalarmrecord
.
getImg5path
()!=
null
?
base64Encoder
.
encode
(
FTPUtil
.
getFtpPicBytes
(
traffalarmrecord
.
getImg5path
())):
null
);
eventWriteParam
.
setEventvideo1
(
traffalarmrecord
.
getVideopath
()!=
null
?
base64Encoder
.
encode
(
FTPUtil
.
getFtpPicBytes
(
traffalarmrecord
.
getVideopath
())):
null
);
}
if
(
traffalarmrecord
.
getImg4path
()
!=
null
)
{
byte
[]
Img
=
FTPUtil
.
getFtpPicBytes
(
traffalarmrecord
.
getImg4path
());
eventWriteParam
.
setEventProof4
(
Img
!=
null
?
base64Encoder
.
encode
(
Img
)
:
null
);
}
if
(
traffalarmrecord
.
getImg5path
()
!=
null
)
{
byte
[]
Img
=
FTPUtil
.
getFtpPicBytes
(
traffalarmrecord
.
getImg5path
());
eventWriteParam
.
setEventProof5
(
Img
!=
null
?
base64Encoder
.
encode
(
Img
)
:
null
);
}
if
(
traffalarmrecord
.
getVideopath
()
!=
null
)
{
byte
[]
video
=
FTPUtil
.
getFtpPicBytes
(
traffalarmrecord
.
getVideopath
());
eventWriteParam
.
setEventvideo1
(
video
!=
null
?
base64Encoder
.
encode
(
video
)
:
null
);
}
//String strBase64 = new BASE64Encoder().encode(FTPUtil.getFtpPicBytes(strings.get(i).get("PICPATH1").toString()));
WriteResultObj
writeResultObj
;
Long
endtime
=
System
.
currentTimeMillis
();
try
{
...
...
src/main/resources/application.properties
View file @
0fb389f1
...
...
@@ -29,12 +29,12 @@ mybatis.configuration.default-statement-timeout=3000
#spring.datasource.dbcp2.connection-properties=characterEncoding=utf8
# Mysql���ݿ�-����Դ����
#
spring.datasource.username=test
#
spring.datasource.password=test
#
spring.datasource.url=jdbc:oracle:thin:@192.168.168.212:1523:helowin
spring.datasource.username
=
hzjt
spring.datasource.password
=
hzjt
spring.datasource.url
=
jdbc:oracle:thin:@33.50.1.22:1521:orcl
spring.datasource.username
=
test
spring.datasource.password
=
test
spring.datasource.url
=
jdbc:oracle:thin:@192.168.168.212:1523:helowin
#
spring.datasource.username=hzjt
#
spring.datasource.password=hzjt
#
spring.datasource.url=jdbc:oracle:thin:@33.50.1.22:1521:orcl
spring.datasource.driverClassName
=
oracle.jdbc.OracleDriver
# druid
spring.datasource.type
=
com.alibaba.druid.pool.DruidDataSource
...
...
src/main/resources/mapper/Traffalarmrecord.xml
View file @
0fb389f1
...
...
@@ -174,5 +174,7 @@
and recordtype in ('illegal_parking','no_motor_ban')
</update>
<select
id=
"seletManualStatus"
>
select name from t_code where type=4
</select>
</mapper>
\ No newline at end of file
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