From bd0cbc17113d86ae4f7f8ac4c777143115e820e7 Mon Sep 17 00:00:00 2001 From: weitang Date: Tue, 20 May 2025 16:57:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=91=84=E5=83=8F=E6=9C=BA?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/VoiceServerServiceImpl.java | 9 ++- .../patroltask/service/impl/TodoTaskJob.java | 59 +++---------------- 2 files changed, 16 insertions(+), 52 deletions(-) diff --git a/riis-system/src/main/java/com/yfd/platform/component/voiceserver/impl/VoiceServerServiceImpl.java b/riis-system/src/main/java/com/yfd/platform/component/voiceserver/impl/VoiceServerServiceImpl.java index 0b2cdc0..445c504 100644 --- a/riis-system/src/main/java/com/yfd/platform/component/voiceserver/impl/VoiceServerServiceImpl.java +++ b/riis-system/src/main/java/com/yfd/platform/component/voiceserver/impl/VoiceServerServiceImpl.java @@ -66,8 +66,13 @@ public class VoiceServerServiceImpl implements VoiceServerService { e.printStackTrace(); } if ("OFF".equals(actionPower)) { - FileUtil.copy("D:\\riis\\video\\sound.wav", httpServerConfig.getSnapFilePath() + fileName, true); -// this.createAudioFile(fileName); + if ("3".equals(httpServerConfig.getFilefromtype())) { + FileUtil.copy("D:\\riis\\video\\sound.wav", httpServerConfig.getSnapFilePath() + fileName, true); + } + if ("1".equals(httpServerConfig.getFilefromtype())) { + this.createAudioFile(fileName); + } + } return true; } diff --git a/riis-system/src/main/java/com/yfd/platform/modules/patroltask/service/impl/TodoTaskJob.java b/riis-system/src/main/java/com/yfd/platform/modules/patroltask/service/impl/TodoTaskJob.java index b0921b9..73c43cc 100644 --- a/riis-system/src/main/java/com/yfd/platform/modules/patroltask/service/impl/TodoTaskJob.java +++ b/riis-system/src/main/java/com/yfd/platform/modules/patroltask/service/impl/TodoTaskJob.java @@ -100,7 +100,6 @@ public class TodoTaskJob extends QuartzJobBean implements InterruptableJob { SpringContextHolder.getBean(ISysDictionaryItemsService.class); TaskResultMapper taskResultMapper = SpringContextHolder.getBean(TaskResultMapper.class); VoiceServerService voiceServerService = SpringContextHolder.getBean(VoiceServerService.class); -// QuartzMultiTaskManage quartzMultiTaskManage = SpringContextHolder.getBean(QuartzMultiTaskManage.class); if ("false".equals(config.getDoTask())) { return; @@ -141,8 +140,7 @@ public class TodoTaskJob extends QuartzJobBean implements InterruptableJob { quartzJob.getTaskTodoId(), quartzJob.getPlanStartTime())); // 任务增加开始时间 LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); - String startTime1 = quartzJob.getStartTime(); - if (StrUtil.isBlank(startTime1)) { + if (StrUtil.isBlank(quartzJob.getStartTime())) { updateWrapper.eq(TaskTodo::getTaskTodoId, quartzJob.getTaskTodoId()).ne(TaskTodo::getTaskState, "1").set(TaskTodo::getTaskState, "2").set(TaskTodo::getStartTime, DateUtil.now()); todoTaskService.update(updateWrapper); 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) { throw new Exception("未设置识别方式,不能进行图形识别!"); } @@ -315,31 +306,13 @@ public class TodoTaskJob extends QuartzJobBean implements InterruptableJob { quartzJob.getTaskCode(), 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", map.get("deviceId").toString(), map.get("patroldeviceCode").toString(), DateUtil.format(DateUtil.date(), "yyyyMMddHHmmss") ); 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", map.get("deviceId").toString(), map.get("patroldeviceCode").toString(), @@ -372,8 +345,7 @@ public class TodoTaskJob extends QuartzJobBean implements InterruptableJob { } } } - List mapList = new ArrayList<>(); - JSONObject callresult = null; + JSONObject callresult; if ("sound".equals(typelist.get(0).toString())) { //声音检测 filename = String.format("%s_%s_%s_%s_%s.wav", @@ -403,7 +375,6 @@ public class TodoTaskJob extends QuartzJobBean implements InterruptableJob { try { String patroldeviceCode = map.get("patroldeviceCode").toString(); voiceServerService.sendVoiceServerControl(patroldeviceCode, "ON", fullfilename); -// FileUtil.copy("D:\\riis\\video\\sound.wav", config.getSnapFilePath() + fullfilename, true); Thread.sleep(duration * 1000); voiceServerService.sendVoiceServerControl(patroldeviceCode, "OFF", fullfilename); } catch (Exception e) { @@ -451,7 +422,6 @@ public class TodoTaskJob extends QuartzJobBean implements InterruptableJob { Thread.sleep(waitTime); log.info("开始调用视频并截图"); log.info("rtspurl" + rtspurl); - String type = null; httpUtil.getMonitorVideoSnap(config.getffmpegPath(), rtspurl, fullfilename); log.info("完成视频截图并保存到对应位置下!,文件名称:" + fullfilename); String identifyMaterialId = ObjectUtil.isNotEmpty(map.get( @@ -482,16 +452,12 @@ public class TodoTaskJob extends QuartzJobBean implements InterruptableJob { //更新当前记录状态,修改为 1:已巡视(图像已采集) //转码存储 String encodefilename = fullfilename; - fullfilename = URLEncoder.encode(fullfilename, "utf-8"); -// if (!"3".equals(config.getFilefromtype())) { - 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 (fullfilename != null) { + fullfilename = URLEncoder.encode(fullfilename, "utf-8"); + } + // if (!"3".equals(config.getFilefromtype())) { + todoTaskService.updateTaskResultStatus(quartzJob.getTaskTodoId(), + map.get("resultId").toString(), fullfilename, "1"); if (ObjectUtil.isNotEmpty(map.get("outsideAngle"))) { if (JSONUtil.isTypeJSONArray(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()); if ("infrared".equals(typelist.get(0).toString()) && !"3".equals(config.getFilefromtype())) { //红外测温