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
b04165ba
Commit
b04165ba
authored
Dec 24, 2020
by
高飞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
解决推送总是少推送几条数据的问题
parent
0059040c
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
32 deletions
+38
-32
src/main/java/com/hzjt/config/RestTemplateConfig.java
src/main/java/com/hzjt/config/RestTemplateConfig.java
+2
-2
src/main/java/com/hzjt/config/ScheduleTaskConfig.java
src/main/java/com/hzjt/config/ScheduleTaskConfig.java
+3
-3
src/main/java/com/hzjt/controller/TraffController.java
src/main/java/com/hzjt/controller/TraffController.java
+10
-5
src/main/java/com/hzjt/listener/MyApplicationStartingEventListener.java
...com/hzjt/listener/MyApplicationStartingEventListener.java
+8
-8
src/main/java/com/hzjt/service/TraffFlowService.java
src/main/java/com/hzjt/service/TraffFlowService.java
+15
-14
No files found.
src/main/java/com/hzjt/config/RestTemplateConfig.java
View file @
b04165ba
...
@@ -10,12 +10,12 @@ import org.springframework.web.client.RestTemplate;
...
@@ -10,12 +10,12 @@ import org.springframework.web.client.RestTemplate;
public
class
RestTemplateConfig
{
public
class
RestTemplateConfig
{
@Bean
@Bean
public
RestTemplate
restTemplate
(
ClientHttpRequestFactory
factory
){
public
RestTemplate
restTemplate
(
ClientHttpRequestFactory
factory
)
{
return
new
RestTemplate
(
factory
);
return
new
RestTemplate
(
factory
);
}
}
@Bean
@Bean
public
ClientHttpRequestFactory
simpleClientHttpRequestFactory
(){
public
ClientHttpRequestFactory
simpleClientHttpRequestFactory
()
{
SimpleClientHttpRequestFactory
factory
=
new
SimpleClientHttpRequestFactory
();
SimpleClientHttpRequestFactory
factory
=
new
SimpleClientHttpRequestFactory
();
factory
.
setConnectTimeout
(
15000
);
factory
.
setConnectTimeout
(
15000
);
factory
.
setReadTimeout
(
5000
);
factory
.
setReadTimeout
(
5000
);
...
...
src/main/java/com/hzjt/config/ScheduleTaskConfig.java
View file @
b04165ba
...
@@ -35,9 +35,9 @@ public class ScheduleTaskConfig {
...
@@ -35,9 +35,9 @@ public class ScheduleTaskConfig {
Integer
result
=
traffFlowService
.
statisVehiclesByDay
();
Integer
result
=
traffFlowService
.
statisVehiclesByDay
();
//抽取前一天的事件统计到新表中
//抽取前一天的事件统计到新表中
Integer
resultrecord
=
traffalarmrecordService
.
statisTraffalarmrecordstatByDay
();
Integer
resultrecord
=
traffalarmrecordService
.
statisTraffalarmrecordstatByDay
();
//
//
//删除当天的数据
//删除当天的数据
//
traffFlowService.deleteVehiclesByDay();
traffFlowService
.
deleteVehiclesByDay
();
}
}
...
...
src/main/java/com/hzjt/controller/TraffController.java
View file @
b04165ba
...
@@ -9,10 +9,7 @@ import com.hzjt.handler.WebSocket;
...
@@ -9,10 +9,7 @@ import com.hzjt.handler.WebSocket;
import
com.hzjt.mapper.SbtdspsrMapper
;
import
com.hzjt.mapper.SbtdspsrMapper
;
import
com.hzjt.mapper.TraffAlarmRecordMapper
;
import
com.hzjt.mapper.TraffAlarmRecordMapper
;
import
com.hzjt.redis.RedisDao
;
import
com.hzjt.redis.RedisDao
;
import
com.hzjt.service.EventWriteService
;
import
com.hzjt.service.*
;
import
com.hzjt.service.FtpService
;
import
com.hzjt.service.ImportService
;
import
com.hzjt.service.TraffFlowService
;
import
com.hzjt.util.*
;
import
com.hzjt.util.*
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
@@ -78,6 +75,9 @@ public class TraffController {
...
@@ -78,6 +75,9 @@ public class TraffController {
private
String
checkEnable
;
private
String
checkEnable
;
@Autowired
FLVCacheService
flvCacheService
;
// @Autowired
// @Autowired
// private SimpMessagingTemplate template;
// private SimpMessagingTemplate template;
...
@@ -337,7 +337,12 @@ public void sendevent( Alarm trffClientMessage){
...
@@ -337,7 +337,12 @@ public void sendevent( Alarm trffClientMessage){
String
rtsp
=
traffFlowService
.
selectSbtddspsrRtspByVideoid
(
videoid
);
String
rtsp
=
traffFlowService
.
selectSbtddspsrRtspByVideoid
(
videoid
);
//huode resid 中值、
//huode resid 中值、
if
(
null
!=
rtsp
&&
null
!=
stringRedisTemplate
.
opsForValue
().
get
(
resisvalue
))
{
if
(
null
!=
rtsp
)
{
if
(
null
==
stringRedisTemplate
.
opsForValue
().
get
(
resisvalue
))
{
log
.
info
(
"flv-----"
);
flvCacheService
.
getvalue
();
}
JSONArray
jsonArr
=
JSONObject
.
parseArray
(
stringRedisTemplate
.
opsForValue
().
get
(
resisvalue
));
JSONArray
jsonArr
=
JSONObject
.
parseArray
(
stringRedisTemplate
.
opsForValue
().
get
(
resisvalue
));
log
.
info
(
"jsonArr"
+
jsonArr
.
size
());
log
.
info
(
"jsonArr"
+
jsonArr
.
size
());
...
...
src/main/java/com/hzjt/listener/MyApplicationStartingEventListener.java
View file @
b04165ba
...
@@ -36,10 +36,10 @@ public class MyApplicationStartingEventListener implements ApplicationListener<S
...
@@ -36,10 +36,10 @@ public class MyApplicationStartingEventListener implements ApplicationListener<S
if
(
event
instanceof
ApplicationReadyEvent
)
{
if
(
event
instanceof
ApplicationReadyEvent
)
{
try
{
try
{
if
(!
flag
)
{
if
(!
flag
)
{
ThreadPoolUtil
.
getSchedulePool
().
scheduleWithFixedDelay
(()
->
{
//
ThreadPoolUtil.getSchedulePool().scheduleWithFixedDelay(() -> {
CacheLoadService
cacheLoadService
=
applicationContext
.
getBean
(
CacheLoadService
.
class
);
//
CacheLoadService cacheLoadService = applicationContext.getBean(CacheLoadService.class);
cacheLoadService
.
loadFtpCache
();
//
cacheLoadService.loadFtpCache();
},
200
,
120
,
TimeUnit
.
SECONDS
);
//
}, 200, 120, TimeUnit.SECONDS);
// //判断第三方登录是否有效
// //判断第三方登录是否有效
// ThreadPoolUtil.getSchedulePool().scheduleWithFixedDelay(() -> {
// ThreadPoolUtil.getSchedulePool().scheduleWithFixedDelay(() -> {
...
@@ -48,10 +48,10 @@ public class MyApplicationStartingEventListener implements ApplicationListener<S
...
@@ -48,10 +48,10 @@ public class MyApplicationStartingEventListener implements ApplicationListener<S
// }, 3, 120, TimeUnit.SECONDS);
// }, 3, 120, TimeUnit.SECONDS);
//查询flv值
//查询flv值
ThreadPoolUtil
.
getSchedulePool
().
scheduleWithFixedDelay
(()
->
{
//
ThreadPoolUtil.getSchedulePool().scheduleWithFixedDelay(() -> {
FLVCacheService
flvservice
=
applicationContext
.
getBean
(
FLVCacheService
.
class
);
//
FLVCacheService flvservice = applicationContext.getBean(FLVCacheService.class);
flvservice
.
getvalue
();
//
flvservice.getvalue();
},
3
,
1800
,
TimeUnit
.
SECONDS
);
//
}, 3, 1800, TimeUnit.SECONDS);
}
}
...
...
src/main/java/com/hzjt/service/TraffFlowService.java
View file @
b04165ba
...
@@ -21,13 +21,15 @@ public class TraffFlowService {
...
@@ -21,13 +21,15 @@ public class TraffFlowService {
public
void
saveTraffFlow
(
Vehicles
vehicles
)
{
public
void
saveTraffFlow
(
Vehicles
vehicles
)
{
traffFlowMapper
.
add
(
vehicles
);
traffFlowMapper
.
add
(
vehicles
);
}
}
public
int
saveTraffFlowDetail
(
Vehicle
vehiclesdetail
)
{
public
int
saveTraffFlowDetail
(
Vehicle
vehiclesdetail
)
{
return
traffFlowMapper
.
insertlist
(
vehiclesdetail
);
return
traffFlowMapper
.
insertlist
(
vehiclesdetail
);
}
}
public
List
<
Map
>
selectFiveAndDayFlow
(
String
videoid
)
{
public
List
<
Map
>
selectFiveAndDayFlow
(
String
videoid
)
{
return
traffFlowMapper
.
selectFiveAndDayFlow
(
videoid
);
return
traffFlowMapper
.
selectFiveAndDayFlow
(
videoid
);
}
}
public
List
<
Map
>
selectFiveAndTypeDayFlow
(
String
videoid
)
{
public
List
<
Map
>
selectFiveAndTypeDayFlow
(
String
videoid
)
{
return
traffFlowMapper
.
selectFiveAndTypeDayFlow
(
videoid
);
return
traffFlowMapper
.
selectFiveAndTypeDayFlow
(
videoid
);
}
}
...
@@ -35,11 +37,13 @@ public class TraffFlowService {
...
@@ -35,11 +37,13 @@ public class TraffFlowService {
public
Integer
statisVehiclesByDay
()
{
public
Integer
statisVehiclesByDay
()
{
return
traffFlowMapper
.
statisVehiclesByDay
();
return
traffFlowMapper
.
statisVehiclesByDay
();
}
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
deleteBeforeTwoMonthVehicles
(
String
starttime
)
{
public
void
deleteBeforeTwoMonthVehicles
(
String
starttime
)
{
traffFlowMapper
.
deleteBeforeTwoMonthVehiclesDetails
(
starttime
);
traffFlowMapper
.
deleteBeforeTwoMonthVehiclesDetails
(
starttime
);
}
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
deleteVehiclesByDay
()
{
public
void
deleteVehiclesByDay
()
{
traffFlowMapper
.
deleteVehiclesByDay
();
traffFlowMapper
.
deleteVehiclesByDay
();
}
}
...
@@ -48,15 +52,12 @@ public class TraffFlowService {
...
@@ -48,15 +52,12 @@ public class TraffFlowService {
return
traffFlowMapper
.
insertOrUpdatevehicleTodaystatistic
();
return
traffFlowMapper
.
insertOrUpdatevehicleTodaystatistic
();
}
}
public
String
selectSbtddspsrRtspByVideoid
(
String
videoid
)
{
public
String
selectSbtddspsrRtspByVideoid
(
String
videoid
)
{
return
traffFlowMapper
.
selectSbtddspsrRtspByVideoid
(
videoid
);
return
traffFlowMapper
.
selectSbtddspsrRtspByVideoid
(
videoid
);
}
}
}
}
\ 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