diff --git a/riis-system/src/main/java/com/yfd/platform/modules/algorithm/controller/AlgorithmClassController.java b/riis-system/src/main/java/com/yfd/platform/modules/algorithm/controller/AlgorithmClassController.java index 4026ccf..1f34a10 100644 --- a/riis-system/src/main/java/com/yfd/platform/modules/algorithm/controller/AlgorithmClassController.java +++ b/riis-system/src/main/java/com/yfd/platform/modules/algorithm/controller/AlgorithmClassController.java @@ -76,6 +76,9 @@ public class AlgorithmClassController { @PostMapping("/deleteAlgorithmClass") @ApiOperation("删除算法分类") public ResponseResult deleteAlgorithmClass(String id) { + if (StrUtil.isBlank(id)) { + return ResponseResult.error("算法分类id为空"); + } boolean isOK = algorithmClassService.deleteAlgorithmClass(id); if (isOK) { return ResponseResult.success(); diff --git a/riis-system/src/main/java/com/yfd/platform/modules/algorithm/service/IAlgorithmClassService.java b/riis-system/src/main/java/com/yfd/platform/modules/algorithm/service/IAlgorithmClassService.java index 1c5bf82..313d566 100644 --- a/riis-system/src/main/java/com/yfd/platform/modules/algorithm/service/IAlgorithmClassService.java +++ b/riis-system/src/main/java/com/yfd/platform/modules/algorithm/service/IAlgorithmClassService.java @@ -30,7 +30,7 @@ public interface IAlgorithmClassService extends IService { boolean updateAlgorithmClass(AlgorithmClass algorithmClass); /********************************** - * 用途说明: 新增算法分类 + * 用途说明: 删除算法分类 * 参数说明 id 算法分类Id * 返回值说明: boolean 是否成功 ***********************************/ diff --git a/riis-system/src/main/java/com/yfd/platform/modules/algorithm/service/impl/AlgorithmClassServiceImpl.java b/riis-system/src/main/java/com/yfd/platform/modules/algorithm/service/impl/AlgorithmClassServiceImpl.java index 491f701..103f08f 100644 --- a/riis-system/src/main/java/com/yfd/platform/modules/algorithm/service/impl/AlgorithmClassServiceImpl.java +++ b/riis-system/src/main/java/com/yfd/platform/modules/algorithm/service/impl/AlgorithmClassServiceImpl.java @@ -3,6 +3,8 @@ package com.yfd.platform.modules.algorithm.service.impl; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.ObjUtil; import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.yfd.platform.modules.algorithm.domain.AlgorithmClass; import com.yfd.platform.modules.algorithm.domain.AlgorithmParams; import com.yfd.platform.modules.algorithm.domain.AlgorithmParamsRequest; @@ -55,13 +57,21 @@ public class AlgorithmClassServiceImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(AlgorithmParams::getAlgorithmId, id); + boolean remove = algorithmParamsService.remove(queryWrapper); + boolean b = this.removeById(id); + if (remove && b) { + return true; + } + throw new RuntimeException("删除错误"); } @Override diff --git a/riis-system/src/main/java/com/yfd/platform/modules/patroltask/controller/AnalyseCallController.java b/riis-system/src/main/java/com/yfd/platform/modules/patroltask/controller/AnalyseCallController.java index ba94697..33b5f7d 100644 --- a/riis-system/src/main/java/com/yfd/platform/modules/patroltask/controller/AnalyseCallController.java +++ b/riis-system/src/main/java/com/yfd/platform/modules/patroltask/controller/AnalyseCallController.java @@ -105,6 +105,7 @@ public class AnalyseCallController { result.put("code", SystemCode.REFUSE_STATUS_CODE.getCode()); } } catch (Exception e) { + e.printStackTrace(); log.error(e.getMessage());; result.put("code", "500"); } diff --git a/riis-system/src/main/java/com/yfd/platform/modules/patroltask/service/impl/AlarmLogServiceImpl.java b/riis-system/src/main/java/com/yfd/platform/modules/patroltask/service/impl/AlarmLogServiceImpl.java index 8ce59ea..ace8f1b 100644 --- a/riis-system/src/main/java/com/yfd/platform/modules/patroltask/service/impl/AlarmLogServiceImpl.java +++ b/riis-system/src/main/java/com/yfd/platform/modules/patroltask/service/impl/AlarmLogServiceImpl.java @@ -471,9 +471,6 @@ public class AlarmLogServiceImpl extends ServiceImpl i JSONObject jsonObject = jsonArray.getJSONObject(0); if (jsonObject.size() > 0) { posArray.addAll(jsonArray); - JSONArray areas = jsonObject.getJSONArray("areas"); - JSONObject jsonObject1 = areas.getJSONObject(0); - JSONObject jsonObject2 = areas.getJSONObject(1); } } @@ -573,8 +570,9 @@ public class AlarmLogServiceImpl extends ServiceImpl i // 只要存在异常就判定为异常 taskResult.setFlag("2"); taskResult.setValid("2"); + SubstationDevice device = deviceMapper.selectById(taskResult.getDeviceId()); // 根据巡视点位判断是否生成报警 - if ("1".equals(taskResult.getIsAlarm())) { + if ("1".equals(device.getIsAlarm())) { log.info("=========================生成报警记录===================="); //生成报警记录 createTaskAlarmLog(taskResult, map); @@ -1774,12 +1772,17 @@ public class AlarmLogServiceImpl extends ServiceImpl i //拷贝识别图到报警目录下 if (ObjUtil.isNotEmpty(taskResult.getDefectFilePath())) { - String fulldefectfilename = URLDecoder.decode(taskResult.getDefectFilePath(), "utf-8"); - String alarmfilename = StrUtil.replace(StrUtil.subAfter(fulldefectfilename, "/", true), "识别", "缺陷告警"); - String fullalarmfile = alarmfilepath + alarmfilename; - FileUtil.copy(Config.getSnapFilePath() + fulldefectfilename, Config.getAlarmFilePath() + fullalarmfile, - true); - alarmLog.setDefectFilePath(URLEncoder.encode(fullalarmfile, "utf-8"));//标注了识别框和信息 + if (!taskResult.getFilePath().equals(taskResult.getDefectFilePath())) { + String fulldefectfilename = URLDecoder.decode(taskResult.getDefectFilePath(), "utf-8"); + String alarmfilename = StrUtil.replace(StrUtil.subAfter(fulldefectfilename, "/", true), "识别", "缺陷告警"); + String fullalarmfile = alarmfilepath + alarmfilename; + FileUtil.copy(Config.getSnapFilePath() + fulldefectfilename, Config.getAlarmFilePath() + fullalarmfile, + true); + alarmLog.setDefectFilePath(URLEncoder.encode(fullalarmfile, "utf-8"));//标注了识别框和信息 + } else { + alarmLog.setDefectFilePath(alarmLog.getFilePath());//标注了识别框和信息 + } + } alarmLog.setValue(taskResult.getValue());//图形识别结果(值) alarmLog.setUnit(taskResult.getUnit()); @@ -1831,7 +1834,8 @@ public class AlarmLogServiceImpl extends ServiceImpl i unit, taskResult.getDesc()); } if ("sound".equals(taskResult.getValueType())) { - alarminfo = "声音检测异常,%s本次识别结果为[" + taskResult.getDesc() + "]"; + // alarminfo = "声音检测异常,本次识别结果为[" + taskResult.getDesc() + "]"; + alarminfo = String.format("声音检测异常,%s本次识别结果为[%s]", taskResult.getDeviceName(), taskResult.getDesc()); } String pictureAnalysisTypeList = device.getPictureAnalysisTypeList(); if (StrUtil.isNotBlank(pictureAnalysisTypeList)) { 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 3cddce5..4e47646 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 @@ -402,10 +402,10 @@ public class TodoTaskJob extends QuartzJobBean implements InterruptableJob { } try { String patroldeviceCode = map.get("patroldeviceCode").toString(); - voiceServerService.sendVoiceServerControl(patroldeviceCode, "ON", fullfilename); - FileUtil.copy("", config.getSnapFilePath() + fullfilename, true); +// 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); +// voiceServerService.sendVoiceServerControl(patroldeviceCode, "OFF", fullfilename); } catch (Exception e) { e.printStackTrace(); } @@ -416,8 +416,8 @@ public class TodoTaskJob extends QuartzJobBean implements InterruptableJob { fullfilename, "2"); System.out.println("customParams:" + JSONUtil.toJsonStr(customParams)); - callresult = httpUtil.callPicAnalyse(map.get("resultId").toString(), - map.get("deviceId").toString(), JSONUtil.toJsonStr(typelist), + callresult = httpUtil.callPicAnalyse(map.get("taskTodoId").toString(), + map.get("resultId").toString(), JSONUtil.toJsonStr(typelist), JSONUtil.toJsonStr(customParams), encodefilename, analysePort); } else { @@ -664,6 +664,7 @@ public class TodoTaskJob extends QuartzJobBean implements InterruptableJob { } catch (Exception e) { log.error(String.format("单条任务执行失败,任务名称:%s,时间:%s", jobName, DateUtil.now())); + e.printStackTrace(); log.error(e.getMessage());; try { // 解除摄像头的工作状态 diff --git a/riis-system/src/main/java/com/yfd/platform/utils/TestFileDir.java b/riis-system/src/main/java/com/yfd/platform/utils/TestFileDir.java index 069bee0..d1d8f9a 100644 --- a/riis-system/src/main/java/com/yfd/platform/utils/TestFileDir.java +++ b/riis-system/src/main/java/com/yfd/platform/utils/TestFileDir.java @@ -1,25 +1,14 @@ package com.yfd.platform.utils; -import java.util.regex.Matcher; -import java.util.regex.Pattern; +import cn.hutool.core.io.FileUtil; public class TestFileDir { public static void main(String[] args) throws Exception { - System.out.println("user.home = " + System.getProperty("user.home")); - // //获取告警触发条件 - String str = "20<=value<50"; - // 定义正则表达式 - String regex = "(\\d+)\\s*((?:==?|!=|<=?|>=?))\\s*value\\s*((?:==?|!=|<=?|>=?))\\s*(\\d+)"; - Pattern pattern = Pattern.compile(regex); - Matcher matcher = pattern.matcher(str); - - if (matcher.find()) { - String number1 = matcher.group(1); // 第一个数字 - String operator1 = matcher.group(2); // 第一个比较符 - String operator2 = matcher.group(3); // 第二个比较符 - String number2 = matcher.group(4); // 第二个数字 - System.out.printf("%s %s value %s %s%n", number1, operator1, operator2, number2); - } - System.out.println(""); + String filename = "d:\\riis\\alarm\\商丘市\\500Kv标准变电站管理区域\\500V变电站\\缺陷\\202505\\20250514_145108_500kV测试间隔_500kV" + + "测试主设备_声纹点位.wav"; + String filename1 = "d:\\riis\\alarm\\商丘市\\500Kv标准变电站管理区域\\510V变电站\\缺陷\\202505\\20250514_145108_500kV" + + "测试间隔_500kV" + + "测试主设备_声纹点位.wav"; + FileUtil.copy(filename, filename1,true); } }