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
4c71a3da
Commit
4c71a3da
authored
Jan 25, 2021
by
高飞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
自动规则匹配
parent
a09b31b5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
12 deletions
+69
-12
src/main/java/com/hzjt/controller/TraffController.java
src/main/java/com/hzjt/controller/TraffController.java
+42
-12
src/main/java/com/hzjt/domain/AutoVehicles.java
src/main/java/com/hzjt/domain/AutoVehicles.java
+13
-0
src/main/java/com/hzjt/domain/AutoVehiclesdetail.java
src/main/java/com/hzjt/domain/AutoVehiclesdetail.java
+14
-0
No files found.
src/main/java/com/hzjt/controller/TraffController.java
View file @
4c71a3da
package
com
.
hzjt
.
controller
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.google.common.util.concurrent.RateLimiter
;
import
com.hzjt.domain.*
;
...
...
@@ -16,12 +15,7 @@ import org.apache.commons.lang3.StringUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.http.HttpEntity
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.HttpMethod
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.client.RestTemplate
;
import
java.io.IOException
;
import
java.io.InputStream
;
...
...
@@ -32,8 +26,6 @@ import java.util.concurrent.ConcurrentHashMap;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.ScheduledExecutorService
;
import
java.util.concurrent.TimeUnit
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
@RestController
...
...
@@ -85,7 +77,7 @@ public class TraffController {
@Value
(
"${alarmrecord.check.enable}"
)
private
String
checkEnable
;
Long
ldir
=
new
Long
(
180
);
@Autowired
FLVCacheService
flvCacheService
;
...
...
@@ -327,15 +319,12 @@ public class TraffController {
public
ResultObj
traffflow
(
@RequestBody
Vehicles
vehicles
)
{
if
(
"TRAFFIC_STATISTICS_VEHICLES"
.
equalsIgnoreCase
(
vehicles
.
getType
()))
{
// String time=DateUtils.formatDate(new Date(Long.valueOf(vehicles.getTs())));
// vehicles.setTs(time);
String
[]
sbAndTd
=
vehicles
.
getVideo_id
().
split
(
"_"
);
String
sbbh
=
sbAndTd
[
0
];
int
tdbh
=
Integer
.
valueOf
(
sbAndTd
[
1
])
+
1
;
//重置videoid
vehicles
.
setVideo_id
(
sbbh
+
"_"
+
tdbh
);
//直接放入表中
// traffFlowService.saveTraffFlow(vehicles);
List
<
Vehiclesdetail
>
vels
=
vehicles
.
getObjs
();
int
result
=
0
;
for
(
Vehiclesdetail
detail
:
vels
)
{
...
...
@@ -397,7 +386,48 @@ public class TraffController {
}
//自动车流量推送
@PostMapping
(
"/autotraffflow"
)
public
ResultObj
autotraffflow
(
@RequestBody
AutoVehicles
vehicles
)
{
log
.
info
(
"autotraffflow"
+
vehicles
.
toString
());
if
(
"TRAFFIC_STATISTICS_VEHICLES"
.
equalsIgnoreCase
(
vehicles
.
getType
()))
{
String
[]
sbAndTd
=
vehicles
.
getVideo_id
().
split
(
"_"
);
String
sbbh
=
sbAndTd
[
0
];
int
tdbh
=
Integer
.
valueOf
(
sbAndTd
[
1
])
+
1
;
//重置videoid
vehicles
.
setVideo_id
(
sbbh
+
"_"
+
tdbh
);
//直接放入表中
List
<
AutoVehiclesdetail
>
vels
=
vehicles
.
getObjs
();
int
result
=
0
;
for
(
AutoVehiclesdetail
detail
:
vels
)
{
Vehicle
v
=
new
Vehicle
();
v
.
setId
(
UUID
.
randomUUID
().
toString
());
v
.
setCreate_time
(
new
Date
(
Long
.
valueOf
(
vehicles
.
getTs
())));
v
.
setType
(
detail
.
getType
());
v
.
setDirection
(
detail
.
getDirection
());
v
.
setRuleTag
(
detail
.
getDirection
().
longValue
()<=
ldir
.
longValue
()?
"1"
:
"2"
);
v
.
setClassification_confidence
(
detail
.
getClassification_confidence
());
v
.
setVideo_id
(
vehicles
.
getVideo_id
());
result
=
traffFlowService
.
saveTraffFlowDetail
(
v
);
}
//查询近五分钟的车流量,当天车流量websocket 直接推送过去
//根据连接的name ,群发根据videoid 查询的结果
webSocket
.
GroupSendingByVideoid
(
vehicles
.
getVideo_id
());
}
return
ResultObj
.
ok
();
}
//车流量推送
@GetMapping
(
"/test"
)
@ResponseBody
public
String
test
()
{
Long
ldir2
=
new
Long
(
180
);
String
result
=
ldir2
.
longValue
()<=
ldir
.
longValue
()?
"2"
:
"1"
;
return
result
;
}
...
...
src/main/java/com/hzjt/domain/AutoVehicles.java
0 → 100644
View file @
4c71a3da
package
com
.
hzjt
.
domain
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
AutoVehicles
{
private
String
id
;
private
String
type
;
private
String
video_id
;
private
String
ts
;
List
<
AutoVehiclesdetail
>
objs
;
}
src/main/java/com/hzjt/domain/AutoVehiclesdetail.java
0 → 100644
View file @
4c71a3da
package
com
.
hzjt
.
domain
;
import
lombok.Data
;
@Data
public
class
AutoVehiclesdetail
{
private
String
obj_id
;
private
String
vehiclesid
;
private
String
type
;
private
Long
direction
;
private
Long
classification_confidence
;
}
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