diff --git a/src/main/java/com/ssf/mysqloracletest/Controller/DevopsVideoInfoController.java b/src/main/java/com/ssf/mysqloracletest/Controller/DevopsVideoInfoController.java index 9d32821..d7b8a93 100644 --- a/src/main/java/com/ssf/mysqloracletest/Controller/DevopsVideoInfoController.java +++ b/src/main/java/com/ssf/mysqloracletest/Controller/DevopsVideoInfoController.java @@ -55,4 +55,26 @@ public class DevopsVideoInfoController { } } + + + @Scheduled(initialDelay = 100, fixedDelay = 3000) + public void drzfjly(){ + + if (!"true".equals(ConfigParam.ZfjlyVideoInfoSwitch)) { + return; + } + DevopsVideoInfoDto villageDeviceInfo = new DevopsVideoInfoDto(); + String res = "error"; + try { + res = devopsVideoInfoService.drzfjly(villageDeviceInfo); + if (res.contains("success")) { + logger.info("导入成功"); + } else { + logger.info("导入失败"); + } + } catch (Exception e) { + logger.error(StringKit.getTrace(e) + "导入出现错误"); + } + } + } diff --git a/src/main/java/com/ssf/mysqloracletest/service/DevopsVideoInfoService0.java b/src/main/java/com/ssf/mysqloracletest/service/DevopsVideoInfoService0.java index 4e6bdd0..8e4aac0 100644 --- a/src/main/java/com/ssf/mysqloracletest/service/DevopsVideoInfoService0.java +++ b/src/main/java/com/ssf/mysqloracletest/service/DevopsVideoInfoService0.java @@ -36,4 +36,6 @@ public interface DevopsVideoInfoService0 extends IService { public String yjdr(DevopsVideoInfoDto bean); public List listPoliceVehicle(DevopsVideoInfo0 bean); + + public String drzfjly(DevopsVideoInfoDto bean); } diff --git a/src/main/java/com/ssf/mysqloracletest/service/impl/DevopsVideoInfoServiceImpl.java b/src/main/java/com/ssf/mysqloracletest/service/impl/DevopsVideoInfoServiceImpl.java index 69d7edd..a046c6c 100644 --- a/src/main/java/com/ssf/mysqloracletest/service/impl/DevopsVideoInfoServiceImpl.java +++ b/src/main/java/com/ssf/mysqloracletest/service/impl/DevopsVideoInfoServiceImpl.java @@ -255,4 +255,65 @@ public class DevopsVideoInfoServiceImpl extends ServiceImpl list = videoStatusService.lambdaQuery().like(DevopsVideoStatus::getDeviceName, "执法记录仪").list(); + logger.info("执法记录仪数量:"+list.size()); + for (DevopsVideoStatus devopsVideoStatus : list){ + String channellistUrl = "http://" + gbsip + ":" + gbsport + "/api/v1/stream/start?token=" + urlToken + "&serial=32092400002005063063&code="+devopsVideoStatus.getGbsChannelNo(); + logger.info("channellistUrl:"+ channellistUrl); + String channellistRes = JsoupUtils.getJsoupDocGet(channellistUrl); + if ("".equals(StringKit.toString(channellistRes)) || (StringKit.toString(channellistRes)).contains("error")) { + logger.info("视频流读取失败"); + devopsVideoStatus.setIsOnline(2); + QueryWrapper devopsVideoStatusQueryWrapper = new QueryWrapper<>(); + devopsVideoStatusQueryWrapper.eq("gbs_channel_no",StringKit.toString(devopsVideoStatus.getGbsChannelNo())); + videoStatusService.update(devopsVideoStatus,devopsVideoStatusQueryWrapper); + logger.info("修改成功:" + devopsVideoStatus.getGbsChannelNo()); + continue; + } + logger.info("视频流读取成功" + devopsVideoStatus.getGbsChannelNo()); + if (channellistRes != null && channellistRes.contains("ChannelName")) { + String channelUrl = "http://" + gbsip + ":" + gbsport + "/api/v1/stream/stop?token=" + urlToken + "&serial=32092400002005063063&code="+devopsVideoStatus.getGbsChannelNo(); + logger.info("channelUrl:"+ channelUrl); + String channelRes = JsoupUtils.getJsoupDocGet(channellistUrl); + if ("OK".equals(channelRes)){ + logger.info("视频流关闭"); + } + devopsVideoStatus.setIsOnline(1); + QueryWrapper devopsVideoStatusQueryWrapper = new QueryWrapper<>(); + devopsVideoStatusQueryWrapper.eq("gbs_channel_no",StringKit.toString(devopsVideoStatus.getGbsChannelNo())); + videoStatusService.update(devopsVideoStatus,devopsVideoStatusQueryWrapper); + logger.info("修改成功:" + devopsVideoStatus.getGbsChannelNo()); + } else { + return "结果集为空,请检查gbs是否配置。"; + } + } + return "success-" + count; + } else { + return "error-类型不正确"; + } + } }