优化摄像机任务逻辑
This commit is contained in:
parent
778e365e18
commit
bd0cbc1711
@ -66,8 +66,13 @@ public class VoiceServerServiceImpl implements VoiceServerService {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
if ("OFF".equals(actionPower)) {
|
if ("OFF".equals(actionPower)) {
|
||||||
|
if ("3".equals(httpServerConfig.getFilefromtype())) {
|
||||||
FileUtil.copy("D:\\riis\\video\\sound.wav", httpServerConfig.getSnapFilePath() + fileName, true);
|
FileUtil.copy("D:\\riis\\video\\sound.wav", httpServerConfig.getSnapFilePath() + fileName, true);
|
||||||
// this.createAudioFile(fileName);
|
}
|
||||||
|
if ("1".equals(httpServerConfig.getFilefromtype())) {
|
||||||
|
this.createAudioFile(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,6 @@ public class TodoTaskJob extends QuartzJobBean implements InterruptableJob {
|
|||||||
SpringContextHolder.getBean(ISysDictionaryItemsService.class);
|
SpringContextHolder.getBean(ISysDictionaryItemsService.class);
|
||||||
TaskResultMapper taskResultMapper = SpringContextHolder.getBean(TaskResultMapper.class);
|
TaskResultMapper taskResultMapper = SpringContextHolder.getBean(TaskResultMapper.class);
|
||||||
VoiceServerService voiceServerService = SpringContextHolder.getBean(VoiceServerService.class);
|
VoiceServerService voiceServerService = SpringContextHolder.getBean(VoiceServerService.class);
|
||||||
// QuartzMultiTaskManage quartzMultiTaskManage = SpringContextHolder.getBean(QuartzMultiTaskManage.class);
|
|
||||||
|
|
||||||
if ("false".equals(config.getDoTask())) {
|
if ("false".equals(config.getDoTask())) {
|
||||||
return;
|
return;
|
||||||
@ -141,8 +140,7 @@ public class TodoTaskJob extends QuartzJobBean implements InterruptableJob {
|
|||||||
quartzJob.getTaskTodoId(), quartzJob.getPlanStartTime()));
|
quartzJob.getTaskTodoId(), quartzJob.getPlanStartTime()));
|
||||||
// 任务增加开始时间
|
// 任务增加开始时间
|
||||||
LambdaUpdateWrapper<TaskTodo> updateWrapper = new LambdaUpdateWrapper<>();
|
LambdaUpdateWrapper<TaskTodo> updateWrapper = new LambdaUpdateWrapper<>();
|
||||||
String startTime1 = quartzJob.getStartTime();
|
if (StrUtil.isBlank(quartzJob.getStartTime())) {
|
||||||
if (StrUtil.isBlank(startTime1)) {
|
|
||||||
updateWrapper.eq(TaskTodo::getTaskTodoId, quartzJob.getTaskTodoId()).ne(TaskTodo::getTaskState, "1").set(TaskTodo::getTaskState, "2").set(TaskTodo::getStartTime, DateUtil.now());
|
updateWrapper.eq(TaskTodo::getTaskTodoId, quartzJob.getTaskTodoId()).ne(TaskTodo::getTaskState, "1").set(TaskTodo::getTaskState, "2").set(TaskTodo::getStartTime, DateUtil.now());
|
||||||
todoTaskService.update(updateWrapper);
|
todoTaskService.update(updateWrapper);
|
||||||
if (StrUtil.isBlank(quartzJob.getControlNum())) {
|
if (StrUtil.isBlank(quartzJob.getControlNum())) {
|
||||||
@ -276,13 +274,6 @@ public class TodoTaskJob extends QuartzJobBean implements InterruptableJob {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//缺陷识别结果类型
|
|
||||||
// if (ObjUtil.isNotEmpty(map.get("defectresulttypes"))) {
|
|
||||||
// JSONArray jsonArray = JSONUtil.parseArray(map.get
|
|
||||||
// ("defectresulttypes").toString());
|
|
||||||
// customParams.put("defectresulttypes", jsonArray);
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (typelist.size() == 0) {
|
if (typelist.size() == 0) {
|
||||||
throw new Exception("未设置识别方式,不能进行图形识别!");
|
throw new Exception("未设置识别方式,不能进行图形识别!");
|
||||||
}
|
}
|
||||||
@ -315,31 +306,13 @@ public class TodoTaskJob extends QuartzJobBean implements InterruptableJob {
|
|||||||
quartzJob.getTaskCode(),
|
quartzJob.getTaskCode(),
|
||||||
filetype
|
filetype
|
||||||
);
|
);
|
||||||
//文件命名格式为:日期_时间_间隔名_设备名_点位名_类型.jpg
|
|
||||||
// String filename = String.format("%s_%s_%s_%s_%s_%s.jpg",
|
|
||||||
// DateUtil.format(DateUtil.date(), "yyyyMMdd"),
|
|
||||||
// DateUtil.format(DateUtil.date(), "HHmmss"),
|
|
||||||
// map.get("bayName").toString(),
|
|
||||||
// map.get("mainDeviceName").toString(),
|
|
||||||
// map.get("deviceName").toString(),
|
|
||||||
// "原图"
|
|
||||||
// );
|
|
||||||
// device_id patroldevice_code
|
|
||||||
String filename = String.format("%s_%s_%s.jpg",
|
String filename = String.format("%s_%s_%s.jpg",
|
||||||
map.get("deviceId").toString(),
|
map.get("deviceId").toString(),
|
||||||
map.get("patroldeviceCode").toString(),
|
map.get("patroldeviceCode").toString(),
|
||||||
DateUtil.format(DateUtil.date(), "yyyyMMddHHmmss")
|
DateUtil.format(DateUtil.date(), "yyyyMMddHHmmss")
|
||||||
);
|
);
|
||||||
if ("1".equals(finalLinkageType)) {
|
if ("1".equals(finalLinkageType)) {
|
||||||
//文件命名格式为:日期_时间_间隔名_设备名_点位名_类型.jpg
|
|
||||||
// filename = String.format("%s_%s_%s_%s_%s_%s.mp4",
|
|
||||||
// DateUtil.format(DateUtil.date(), "yyyyMMdd"),
|
|
||||||
// DateUtil.format(DateUtil.date(), "HHmmss"),
|
|
||||||
// map.get("bayName").toString(),
|
|
||||||
// map.get("mainDeviceName").toString(),
|
|
||||||
// map.get("deviceName").toString(),
|
|
||||||
// "视频"
|
|
||||||
// );
|
|
||||||
filename = String.format("%s_%s_%s.mp4",
|
filename = String.format("%s_%s_%s.mp4",
|
||||||
map.get("deviceId").toString(),
|
map.get("deviceId").toString(),
|
||||||
map.get("patroldeviceCode").toString(),
|
map.get("patroldeviceCode").toString(),
|
||||||
@ -372,8 +345,7 @@ public class TodoTaskJob extends QuartzJobBean implements InterruptableJob {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<TaskResult> mapList = new ArrayList<>();
|
JSONObject callresult;
|
||||||
JSONObject callresult = null;
|
|
||||||
if ("sound".equals(typelist.get(0).toString())) {
|
if ("sound".equals(typelist.get(0).toString())) {
|
||||||
//声音检测
|
//声音检测
|
||||||
filename = String.format("%s_%s_%s_%s_%s.wav",
|
filename = String.format("%s_%s_%s_%s_%s.wav",
|
||||||
@ -403,7 +375,6 @@ public class TodoTaskJob extends QuartzJobBean implements InterruptableJob {
|
|||||||
try {
|
try {
|
||||||
String patroldeviceCode = map.get("patroldeviceCode").toString();
|
String patroldeviceCode = map.get("patroldeviceCode").toString();
|
||||||
voiceServerService.sendVoiceServerControl(patroldeviceCode, "ON", fullfilename);
|
voiceServerService.sendVoiceServerControl(patroldeviceCode, "ON", fullfilename);
|
||||||
// FileUtil.copy("D:\\riis\\video\\sound.wav", config.getSnapFilePath() + fullfilename, true);
|
|
||||||
Thread.sleep(duration * 1000);
|
Thread.sleep(duration * 1000);
|
||||||
voiceServerService.sendVoiceServerControl(patroldeviceCode, "OFF", fullfilename);
|
voiceServerService.sendVoiceServerControl(patroldeviceCode, "OFF", fullfilename);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -451,7 +422,6 @@ public class TodoTaskJob extends QuartzJobBean implements InterruptableJob {
|
|||||||
Thread.sleep(waitTime);
|
Thread.sleep(waitTime);
|
||||||
log.info("开始调用视频并截图");
|
log.info("开始调用视频并截图");
|
||||||
log.info("rtspurl" + rtspurl);
|
log.info("rtspurl" + rtspurl);
|
||||||
String type = null;
|
|
||||||
httpUtil.getMonitorVideoSnap(config.getffmpegPath(), rtspurl, fullfilename);
|
httpUtil.getMonitorVideoSnap(config.getffmpegPath(), rtspurl, fullfilename);
|
||||||
log.info("完成视频截图并保存到对应位置下!,文件名称:" + fullfilename);
|
log.info("完成视频截图并保存到对应位置下!,文件名称:" + fullfilename);
|
||||||
String identifyMaterialId = ObjectUtil.isNotEmpty(map.get(
|
String identifyMaterialId = ObjectUtil.isNotEmpty(map.get(
|
||||||
@ -482,16 +452,12 @@ public class TodoTaskJob extends QuartzJobBean implements InterruptableJob {
|
|||||||
//更新当前记录状态,修改为 1:已巡视(图像已采集)
|
//更新当前记录状态,修改为 1:已巡视(图像已采集)
|
||||||
//转码存储
|
//转码存储
|
||||||
String encodefilename = fullfilename;
|
String encodefilename = fullfilename;
|
||||||
|
if (fullfilename != null) {
|
||||||
fullfilename = URLEncoder.encode(fullfilename, "utf-8");
|
fullfilename = URLEncoder.encode(fullfilename, "utf-8");
|
||||||
|
}
|
||||||
// if (!"3".equals(config.getFilefromtype())) {
|
// if (!"3".equals(config.getFilefromtype())) {
|
||||||
todoTaskService.updateTaskResultStatus(quartzJob.getTaskTodoId(), map.get("resultId").toString(), fullfilename, "1");
|
todoTaskService.updateTaskResultStatus(quartzJob.getTaskTodoId(),
|
||||||
// }
|
map.get("resultId").toString(), fullfilename, "1");
|
||||||
// 3、 调用图片识别算法,进行图形识别
|
|
||||||
//表计类型
|
|
||||||
// if (ObjectUtil.isNotEmpty(map.get("meterType"))) {
|
|
||||||
// customParams.put("meterType", map.get
|
|
||||||
// ("meterType").toString());
|
|
||||||
// }
|
|
||||||
if (ObjectUtil.isNotEmpty(map.get("outsideAngle"))) {
|
if (ObjectUtil.isNotEmpty(map.get("outsideAngle"))) {
|
||||||
if (JSONUtil.isTypeJSONArray(map.get("outsideAngle").toString())) {
|
if (JSONUtil.isTypeJSONArray(map.get("outsideAngle").toString())) {
|
||||||
JSONArray jsonArray = JSONUtil.parseArray(map.get("outsideAngle").toString());
|
JSONArray jsonArray = JSONUtil.parseArray(map.get("outsideAngle").toString());
|
||||||
@ -531,13 +497,6 @@ public class TodoTaskJob extends QuartzJobBean implements InterruptableJob {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//有效识别区域
|
|
||||||
// if (ObjUtil.isNotEmpty(map.get
|
|
||||||
// ("patroldeviceEffectiveregion"))) {
|
|
||||||
// customParams.put("effectiveregion", map.get
|
|
||||||
// ("patroldeviceEffectiveregion").toString());
|
|
||||||
// }
|
|
||||||
log.info("==============================typelist=======================" + typelist.toString());
|
log.info("==============================typelist=======================" + typelist.toString());
|
||||||
if ("infrared".equals(typelist.get(0).toString()) && !"3".equals(config.getFilefromtype())) {
|
if ("infrared".equals(typelist.get(0).toString()) && !"3".equals(config.getFilefromtype())) {
|
||||||
//红外测温
|
//红外测温
|
||||||
|
Loading…
Reference in New Issue
Block a user