Commit b04165ba authored by 高飞's avatar 高飞

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

parent 0059040c
...@@ -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);
......
...@@ -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();
} }
......
...@@ -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());
......
...@@ -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);
} }
......
...@@ -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
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