Commit b04165ba authored by 高飞's avatar 高飞

解决推送总是少推送几条数据的问题

parent 0059040c
......@@ -10,12 +10,12 @@ import org.springframework.web.client.RestTemplate;
public class RestTemplateConfig {
@Bean
public RestTemplate restTemplate(ClientHttpRequestFactory factory){
public RestTemplate restTemplate(ClientHttpRequestFactory factory) {
return new RestTemplate(factory);
}
@Bean
public ClientHttpRequestFactory simpleClientHttpRequestFactory(){
public ClientHttpRequestFactory simpleClientHttpRequestFactory() {
SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
factory.setConnectTimeout(15000);
factory.setReadTimeout(5000);
......
......@@ -35,9 +35,9 @@ public class ScheduleTaskConfig {
Integer result = traffFlowService.statisVehiclesByDay();
//抽取前一天的事件统计到新表中
Integer resultrecord = traffalarmrecordService.statisTraffalarmrecordstatByDay();
//
// //删除当天的数据
// traffFlowService.deleteVehiclesByDay();
//删除当天的数据
traffFlowService.deleteVehiclesByDay();
}
......
......@@ -9,10 +9,7 @@ import com.hzjt.handler.WebSocket;
import com.hzjt.mapper.SbtdspsrMapper;
import com.hzjt.mapper.TraffAlarmRecordMapper;
import com.hzjt.redis.RedisDao;
import com.hzjt.service.EventWriteService;
import com.hzjt.service.FtpService;
import com.hzjt.service.ImportService;
import com.hzjt.service.TraffFlowService;
import com.hzjt.service.*;
import com.hzjt.util.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
......@@ -78,6 +75,9 @@ public class TraffController {
private String checkEnable;
@Autowired
FLVCacheService flvCacheService;
// @Autowired
// private SimpMessagingTemplate template;
......@@ -337,7 +337,12 @@ public void sendevent( Alarm trffClientMessage){
String rtsp= traffFlowService.selectSbtddspsrRtspByVideoid(videoid);
//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));
log.info("jsonArr" + jsonArr.size());
......
......@@ -36,10 +36,10 @@ public class MyApplicationStartingEventListener implements ApplicationListener<S
if (event instanceof ApplicationReadyEvent) {
try {
if (!flag) {
ThreadPoolUtil.getSchedulePool().scheduleWithFixedDelay(() -> {
CacheLoadService cacheLoadService = applicationContext.getBean(CacheLoadService.class);
cacheLoadService.loadFtpCache();
}, 200, 120, TimeUnit.SECONDS);
// ThreadPoolUtil.getSchedulePool().scheduleWithFixedDelay(() -> {
// CacheLoadService cacheLoadService = applicationContext.getBean(CacheLoadService.class);
// cacheLoadService.loadFtpCache();
// }, 200, 120, TimeUnit.SECONDS);
// //判断第三方登录是否有效
// ThreadPoolUtil.getSchedulePool().scheduleWithFixedDelay(() -> {
......@@ -48,10 +48,10 @@ public class MyApplicationStartingEventListener implements ApplicationListener<S
// }, 3, 120, TimeUnit.SECONDS);
//查询flv值
ThreadPoolUtil.getSchedulePool().scheduleWithFixedDelay(() -> {
FLVCacheService flvservice = applicationContext.getBean(FLVCacheService.class);
flvservice.getvalue();
}, 3, 1800, TimeUnit.SECONDS);
// ThreadPoolUtil.getSchedulePool().scheduleWithFixedDelay(() -> {
// FLVCacheService flvservice = applicationContext.getBean(FLVCacheService.class);
// flvservice.getvalue();
// }, 3, 1800, TimeUnit.SECONDS);
}
......
......@@ -21,42 +21,43 @@ public class TraffFlowService {
public void saveTraffFlow(Vehicles vehicles) {
traffFlowMapper.add(vehicles);
}
public int saveTraffFlowDetail(Vehicle vehiclesdetail ) {
return traffFlowMapper.insertlist(vehiclesdetail);
public int saveTraffFlowDetail(Vehicle vehiclesdetail) {
return traffFlowMapper.insertlist(vehiclesdetail);
}
public List<Map> selectFiveAndDayFlow(String videoid) {
return traffFlowMapper.selectFiveAndDayFlow(videoid);
return traffFlowMapper.selectFiveAndDayFlow(videoid);
}
public List<Map> selectFiveAndTypeDayFlow(String videoid) {
return traffFlowMapper.selectFiveAndTypeDayFlow(videoid);
return traffFlowMapper.selectFiveAndTypeDayFlow(videoid);
}
public Integer statisVehiclesByDay() {
return traffFlowMapper.statisVehiclesByDay();
return traffFlowMapper.statisVehiclesByDay();
}
@Transactional(rollbackFor = Exception.class)
public void deleteBeforeTwoMonthVehicles(String starttime) {
traffFlowMapper.deleteBeforeTwoMonthVehiclesDetails(starttime);
}
@Transactional(rollbackFor = Exception.class)
public void deleteVehiclesByDay() {
traffFlowMapper.deleteVehiclesByDay();
}
public Integer insertOrUpdatevehicleTodaystatistic() {
return traffFlowMapper.insertOrUpdatevehicleTodaystatistic();
return traffFlowMapper.insertOrUpdatevehicleTodaystatistic();
}
public String selectSbtddspsrRtspByVideoid(String videoid){
return traffFlowMapper.selectSbtddspsrRtspByVideoid(videoid);
public String selectSbtddspsrRtspByVideoid(String videoid) {
}
return traffFlowMapper.selectSbtddspsrRtspByVideoid(videoid);
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment