diff --git a/riis-system/src/main/java/com/yfd/platform/component/nettyserver/NettyServerHandler.java b/riis-system/src/main/java/com/yfd/platform/component/nettyserver/NettyServerHandler.java index ebdc03f..389f4a8 100644 --- a/riis-system/src/main/java/com/yfd/platform/component/nettyserver/NettyServerHandler.java +++ b/riis-system/src/main/java/com/yfd/platform/component/nettyserver/NettyServerHandler.java @@ -1120,7 +1120,7 @@ public class NettyServerHandler extends SimpleChannelInboundHandler: = 超温报警<2>: = 温升报警<3>: = 三相温差报警<4>: = 三相对比报警<5>: = 声音异常<6>: = 外观异常<7>: = 仪表越限报警<8>: = 仪表超量程报警<9>: = // 仪表三相对比<10>: = 变位报警', - alarmLog.setAlarmLevel(ObjUtil.isNotEmpty(map.get("alarmlevel")) ? map.get("alarmlevel").toString() : "4");// + alarmLog.setAlarmLevel(ObjUtil.isNotEmpty(map.get("alarmlevel")) ? map.get("alarmlevel").toString() : "3");// // '1:预警;2:一般;3:严重;4;危急', 待判断细分 alarmLog.setRecognitionType(taskResult.getRecognitionType());//'1:表计读取;2:位置状态识别;3:设备外观查看;4:红外测温;5:声音检测;6 // :闪烁检测11:局放超声波检测12:局放地电压检测13:局放特高频检测101:环境温度检测102:环境湿度检测103:氧气浓度检测104SF6浓度检测', diff --git a/riis-system/src/main/java/com/yfd/platform/modules/algorithm/service/impl/AlgorithmClassComponentServiceImpl.java b/riis-system/src/main/java/com/yfd/platform/modules/algorithm/service/impl/AlgorithmClassComponentServiceImpl.java index 4ed561a..1a67612 100644 --- a/riis-system/src/main/java/com/yfd/platform/modules/algorithm/service/impl/AlgorithmClassComponentServiceImpl.java +++ b/riis-system/src/main/java/com/yfd/platform/modules/algorithm/service/impl/AlgorithmClassComponentServiceImpl.java @@ -1,14 +1,17 @@ package com.yfd.platform.modules.algorithm.service.impl; +import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.yfd.platform.modules.algorithm.domain.AlgorithmClassComponent; -import com.yfd.platform.modules.algorithm.mapper.AlgorithmClassComponentMapper; -import com.yfd.platform.modules.algorithm.service.IAlgorithmClassComponentService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.apache.bcel.generic.LADD; +import com.yfd.platform.modules.algorithm.domain.AlgorithmClassComponent; +import com.yfd.platform.modules.algorithm.domain.AlgorithmDevice; +import com.yfd.platform.modules.algorithm.mapper.AlgorithmClassComponentMapper; +import com.yfd.platform.modules.algorithm.mapper.AlgorithmDeviceMapper; +import com.yfd.platform.modules.algorithm.service.IAlgorithmClassComponentService; import org.springframework.stereotype.Service; +import javax.annotation.Resource; import java.util.List; /** @@ -23,6 +26,9 @@ import java.util.List; public class AlgorithmClassComponentServiceImpl extends ServiceImpl implements IAlgorithmClassComponentService { + @Resource + private AlgorithmDeviceMapper algorithmDeviceMapper; + /********************************** * 用途说明: 算法关联主设备部件 * 参数说明 algorithmId 算法分类id @@ -45,6 +51,16 @@ public class AlgorithmClassComponentServiceImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(AlgorithmDevice::getAlgorithmId, algorithmId).eq(AlgorithmDevice::getComponentId, + componentId); + algorithmDeviceMapper.delete(queryWrapper); + } + return this.removeById(id); } 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 2f0a66c..69a23b7 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 @@ -69,9 +69,12 @@ public class AlgorithmClassServiceImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(AlgorithmParams::getAlgorithmId, id); - boolean remove = algorithmParamsService.remove(queryWrapper); + boolean removeDevice = + algorithmDeviceService.remove(new LambdaQueryWrapper().eq(AlgorithmDevice::getAlgorithmId, id)); + algorithmClassComponentMapper.delete(new LambdaQueryWrapper().eq(AlgorithmClassComponent::getAlgorithmId, id)); + boolean removeParams = algorithmParamsService.remove(queryWrapper); boolean b = this.removeById(id); - if (remove && b) { + if (removeDevice && b && removeParams) { return true; } throw new RuntimeException("删除错误"); diff --git a/riis-system/src/main/java/com/yfd/platform/modules/algorithm/service/impl/AlgorithmParamsServiceImpl.java b/riis-system/src/main/java/com/yfd/platform/modules/algorithm/service/impl/AlgorithmParamsServiceImpl.java index 47b3692..fe7491e 100644 --- a/riis-system/src/main/java/com/yfd/platform/modules/algorithm/service/impl/AlgorithmParamsServiceImpl.java +++ b/riis-system/src/main/java/com/yfd/platform/modules/algorithm/service/impl/AlgorithmParamsServiceImpl.java @@ -1,14 +1,19 @@ package com.yfd.platform.modules.algorithm.service.impl; import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.yfd.platform.modules.algorithm.domain.AlgorithmClass; +import com.yfd.platform.modules.algorithm.domain.AlgorithmClassComponent; +import com.yfd.platform.modules.algorithm.domain.AlgorithmDevice; import com.yfd.platform.modules.algorithm.domain.AlgorithmParams; import com.yfd.platform.modules.algorithm.mapper.AlgorithmClassMapper; +import com.yfd.platform.modules.algorithm.mapper.AlgorithmDeviceMapper; import com.yfd.platform.modules.algorithm.mapper.AlgorithmParamsMapper; import com.yfd.platform.modules.algorithm.service.IAlgorithmParamsService; import com.yfd.platform.utils.HttpRESTfulUtils; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.HashMap; @@ -24,12 +29,16 @@ import java.util.Map; * @since 2025-05-13 */ @Service +@Transactional public class AlgorithmParamsServiceImpl extends ServiceImpl implements IAlgorithmParamsService { @Resource private AlgorithmParamsMapper algorithmParamsMapper; @Resource private AlgorithmClassMapper algorithmClassMapper; + + @Resource + private AlgorithmDeviceMapper algorithmDeviceMapper; @Resource private HttpRESTfulUtils httpRESTfulUtils; @@ -53,8 +62,12 @@ public class AlgorithmParamsServiceImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(AlgorithmDevice::getParamId, id); + algorithmDeviceMapper.delete(queryWrapper); return this.removeById(id); } diff --git a/riis-system/src/main/java/com/yfd/platform/modules/basedata/controller/SubstationPatroldeviceController.java b/riis-system/src/main/java/com/yfd/platform/modules/basedata/controller/SubstationPatroldeviceController.java index 960d8fd..e88e0c7 100644 --- a/riis-system/src/main/java/com/yfd/platform/modules/basedata/controller/SubstationPatroldeviceController.java +++ b/riis-system/src/main/java/com/yfd/platform/modules/basedata/controller/SubstationPatroldeviceController.java @@ -109,6 +109,7 @@ public class SubstationPatroldeviceController { String ids = jsonObject.getStr("ids"); String manufacturer = jsonObject.getStr("manufacturer"); String flag = jsonObject.getStr("flag"); + String online = jsonObject.getStr("online"); SysUser userInfo = userService.getUserInfo(); Integer usertype = userInfo.getUsertype(); LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); @@ -136,6 +137,9 @@ public class SubstationPatroldeviceController { if (StrUtil.isNotBlank(patrolDeviceName)) { queryWrapper.like(SubstationPatroldevice::getPatroldeviceName, patrolDeviceName); } + if (StrUtil.isNotBlank(online)) { + queryWrapper.eq(SubstationPatroldevice::getOnline, online); + } // 模糊查询(设备型号) if (StrUtil.isNotBlank(deviceModel)) { queryWrapper.like(SubstationPatroldevice::getDeviceModel, deviceModel); diff --git a/riis-system/src/main/java/com/yfd/platform/modules/basedata/service/impl/SubstationMaindeviceServiceImpl.java b/riis-system/src/main/java/com/yfd/platform/modules/basedata/service/impl/SubstationMaindeviceServiceImpl.java index a48fdd4..dd8a85a 100644 --- a/riis-system/src/main/java/com/yfd/platform/modules/basedata/service/impl/SubstationMaindeviceServiceImpl.java +++ b/riis-system/src/main/java/com/yfd/platform/modules/basedata/service/impl/SubstationMaindeviceServiceImpl.java @@ -2,6 +2,7 @@ package com.yfd.platform.modules.basedata.service.impl; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.yfd.platform.modules.auxcontrol.domain.DeviceSignal; import com.yfd.platform.modules.auxcontrol.service.IDeviceSignalService; @@ -150,11 +151,21 @@ public class SubstationMaindeviceServiceImpl extends ServiceImpl().eq(SubstationComponent::getMainDeviceId, id)); + if (integer > 0) { + throw new RuntimeException("当前主设备已经绑定部件无法删除"); + } + SubstationMaindevice substationMaindevice = this.getById(id); // 如果是启用状态不允许删除 if ("1".equals(substationMaindevice.getDatastatus())) { return false; } +// LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); +// queryWrapper.eq(SubstationComponent::getMainDeviceId, id); +// substationComponentMapper.delete(queryWrapper); boolean ok = this.removeById(id); String bayId = substationMaindevice.getBayId(); List list = @@ -164,14 +175,6 @@ public class SubstationMaindeviceServiceImpl extends ServiceImpl substationComponents = - substationComponentMapper.selectList(new LambdaQueryWrapper().eq(SubstationComponent::getMainDeviceId, id)); - for (SubstationComponent substationComponent : substationComponents) { - String componentId = substationComponent.getComponentId(); - substationComponentMapper.deleteById(componentId); - } - } return ok; } diff --git a/riis-system/src/main/java/com/yfd/platform/modules/basedata/service/impl/SubstationPatroldeviceServiceImpl.java b/riis-system/src/main/java/com/yfd/platform/modules/basedata/service/impl/SubstationPatroldeviceServiceImpl.java index 5a2089c..9a21b20 100644 --- a/riis-system/src/main/java/com/yfd/platform/modules/basedata/service/impl/SubstationPatroldeviceServiceImpl.java +++ b/riis-system/src/main/java/com/yfd/platform/modules/basedata/service/impl/SubstationPatroldeviceServiceImpl.java @@ -591,6 +591,7 @@ public class SubstationPatroldeviceServiceImpl extends ServiceImpl list = this.list(queryWrapper); List> mapList = new ArrayList<>(); Map patrolEquipmentType = sysDictionaryItemsService.getDeviceMapByType( diff --git a/riis-system/src/main/java/com/yfd/platform/modules/basedata/service/impl/SubstationServiceImpl.java b/riis-system/src/main/java/com/yfd/platform/modules/basedata/service/impl/SubstationServiceImpl.java index 842e7ed..3ba2627 100644 --- a/riis-system/src/main/java/com/yfd/platform/modules/basedata/service/impl/SubstationServiceImpl.java +++ b/riis-system/src/main/java/com/yfd/platform/modules/basedata/service/impl/SubstationServiceImpl.java @@ -406,7 +406,13 @@ public class SubstationServiceImpl extends ServiceImpl().eq(SubstationArea::getStationCode, substation.getStationCode())); + if (integer > 0) { + throw new RuntimeException("当前变电站已经绑定区域无法删除"); + } + + int i = substationMapper.deleteById(stationId); if (i <= 0) { return false; @@ -417,13 +423,14 @@ public class SubstationServiceImpl extends ServiceImpl substationAreas = - substationAreaMapper.selectList(new LambdaQueryWrapper().eq(SubstationArea::getStationCode, - stationCode)); - for (SubstationArea substationArea : substationAreas) { - String areaId = substationArea.getAreaId(); - this.deleteSubstationArea(areaId); - } +// String stationCode = substation.getStationCode(); +// List substationAreas = +// substationAreaMapper.selectList(new LambdaQueryWrapper().eq(SubstationArea::getStationCode, +// stationCode)); +// for (SubstationArea substationArea : substationAreas) { +// String areaId = substationArea.getAreaId(); +// this.deleteSubstationArea(areaId); +// } return true; } @@ -435,6 +442,12 @@ public class SubstationServiceImpl extends ServiceImpl().eq(SubstationBay::getAreaId, areaId)); + if (integer > 0) { + throw new RuntimeException("当前区域已经绑定间隔无法删除"); + } int i = substationAreaMapper.deleteById(areaId); if (i <= 0) { return false; @@ -446,13 +459,17 @@ public class SubstationServiceImpl extends ServiceImpl substationBays = - substationBayMapper.selectList(new LambdaQueryWrapper().eq(SubstationBay::getAreaId, - areaId)); - for (SubstationBay substationBay : substationBays) { - String bayId = substationBay.getBayId(); - this.deleteSubstationBay(bayId); - } + +// LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); +// queryWrapper.eq(SubstationBay::getAreaId, areaId); +// substationBayMapper.delete(queryWrapper); +// List substationBays = +// substationBayMapper.selectList(new LambdaQueryWrapper().orderByAsc(SubstationBay::getCustom1)); +// for (int i1 = 0; i1 < substationBays.size(); i1++) { +// SubstationBay substationBay = substationBays.get(i1); +// substationBay.setCustom1(i1 + 1); +// substationBayMapper.updateById(substationBay); +// } return true; } @@ -463,6 +480,11 @@ public class SubstationServiceImpl extends ServiceImpl().eq(SubstationMaindevice::getBayId, bayId)); + if (integer > 0) { + throw new RuntimeException("当前间隔已经绑定主设备无法删除"); + } int i = substationBayMapper.deleteById(bayId); List substationBays = substationBayMapper.selectList(new LambdaQueryWrapper().orderByAsc(SubstationBay::getCustom1)); diff --git a/riis-system/src/main/java/com/yfd/platform/modules/patroltask/domain/AlarmLog.java b/riis-system/src/main/java/com/yfd/platform/modules/patroltask/domain/AlarmLog.java index c659cde..ef7d9fd 100644 --- a/riis-system/src/main/java/com/yfd/platform/modules/patroltask/domain/AlarmLog.java +++ b/riis-system/src/main/java/com/yfd/platform/modules/patroltask/domain/AlarmLog.java @@ -154,7 +154,7 @@ public class AlarmLog implements Serializable { private String defectType; /** - * 1:预警;2:一般;3:严重;4;危急 + *1:一般;2:严重;3;危急 */ private String alarmLevel; 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 ace8f1b..4146c17 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 @@ -280,7 +280,7 @@ public class AlarmLogServiceImpl extends ServiceImpl i resImagePath = result.getStr("resImagePath"); } Map judgeresult = judgeAbnormal(result.getStr("type"), result.getStr("value"), - result.getStr("conf"), substationDevice.getDeviceId(), ""); + desc, substationDevice.getDeviceId(), ""); // || "yjsk".equals(result.getStr("type")) log.info("=======================发送结果=======================" + result.getStr("type")); if (!("meter".equals(type) || "infrared".equals(type) || "sound".equals(type) || StrUtil.isBlank(type) || "yjsk".equals(result.getStr("type")) || "isolator".equals(result.getStr("type")))) { @@ -454,6 +454,9 @@ public class AlarmLogServiceImpl extends ServiceImpl i typeList.add(type); taskResult.setValueType(result.getStr("type")); String value = result.getStr("value"); + if ("infrared".equals(type) && StrUtil.isNotBlank(value)) { + value = StrUtil.split(value, ",").get(0); + } String desc = result.getStr("desc"); String conf = result.getStr("conf"); if (ObjectUtil.isNotEmpty(conf)) { @@ -479,10 +482,12 @@ public class AlarmLogServiceImpl extends ServiceImpl i taskResult.setDefectFilePath(taskResult.getFilePath()); } String valueType = taskResult.getValueType(); - Map judgeresult = judgeAbnormal(result.getStr("type"), result.getStr("value"), - result.getStr("conf"), taskResult.getDeviceId(), taskResult.getResultId()); + Map judgeresult = judgeAbnormal(result.getStr("type"), value, + result.getStr("desc"), taskResult.getDeviceId(), taskResult.getResultId()); log.info("=======================发送结果=======================" + result.getStr("type")); - if (!("meter".equals(type) || "infrared".equals(type) || "sound".equals(type) || StrUtil.isBlank(type) || "yjsk".equals(result.getStr("type")) || "isolator".equals(result.getStr("type")))) { + if (!("meter".equals(type) || "fhz".equals(result.getStr("type")) || "infrared".equals(type) || + "sound".equals(type) || StrUtil.isBlank(type) || "yjsk".equals(result.getStr("type")) || + "isolator".equals(result.getStr("type")))) { // 图像缺陷分析类型 List> pictureDefectAnalysisTypeList = sysDictionaryItemsService.getDeviceByType( "PictureDefectAnalysisType"); @@ -728,7 +733,7 @@ public class AlarmLogServiceImpl extends ServiceImpl i alarmLog.setAlarmType(ObjUtil.isNotEmpty(map.get("alarmtype")) ? map.get("alarmtype") : ""); //'字典表<1>: = 超温报警<2>: = 温升报警<3>: = 三相温差报警<4>: = 三相对比报警<5>: = 声音异常<6>: = 外观异常<7>: = 仪表越限报警<8>: = 仪表超量程报警<9>: = // 仪表三相对比<10>: = 变位报警', - alarmLog.setAlarmLevel(ObjUtil.isNotEmpty(map.get("alarmlevel")) ? map.get("alarmlevel") : "4");// + alarmLog.setAlarmLevel(ObjUtil.isNotEmpty(map.get("alarmlevel")) ? map.get("alarmlevel") : "3");// // '1:预警;2:一般;3:严重;4;危急', 待判断细分 alarmLog.setRecognitionType(taskResult.getRecognitionType());//'1:表计读取;2:位置状态识别;3:设备外观查看;4:红外测温;5:声音检测;6 // :闪烁检测11:局放超声波检测12:局放地电压检测13:局放特高频检测101:环境温度检测102:环境湿度检测103:氧气浓度检测104SF6浓度检测', @@ -1164,7 +1169,15 @@ public class AlarmLogServiceImpl extends ServiceImpl i ***********************************/ @Override public Map getAlarmLogById(String id) { - return alarmLogMapper.getAlarmLogById(id); + Map alarmLog = alarmLogMapper.getAlarmLogById(id); + + if (ObjectUtil.isNotEmpty(alarmLog.get("deviceid"))) { + Map thresholdInterval = alarmThresholdService.getThresholdInterval(alarmLog.get("deviceId" + ).toString()); + alarmLog.putAll(thresholdInterval); + } + + return alarmLog; } private String getSlienceType(String type) { @@ -1450,7 +1463,7 @@ public class AlarmLogServiceImpl extends ServiceImpl i double resultvalue = Double.parseDouble(valueList.get(0)); // 判断是否是非同源 String patroldeviceJson = substationDevice.getPatroldeviceJson(); - if (JSONUtil.isTypeJSONArray(patroldeviceJson)) { + if (JSONUtil.isTypeJSONArray(patroldeviceJson) && !"3".equals(alarmThreshold.getAlarmType()) && !"9".equals(alarmThreshold.getAlarmType())) { JSONArray jsonArray = JSONUtil.parseArray(patroldeviceJson); if (jsonArray.size() > 1) { // 非同源告警 @@ -1472,27 +1485,27 @@ public class AlarmLogServiceImpl extends ServiceImpl i return result; } } - if (jsonArray.size() == 1) { - // 非同源告警 - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(TaskResult::getDeviceId, deviceid).eq(TaskResult::getTaskTodoId, - taskResult.getTaskTodoId()).eq(TaskResult::getFlag, "2").ne(TaskResult::getResultId, - resultId); - List taskResultList = taskResultMapper.selectList(queryWrapper); - // List values = taskResultList.stream().filter(v->StrUtil.isNotBlank - // (v.getValue())).map(TaskResult::getValue).collect(Collectors.toList()); - Optional maxDifferenceTaskResult = - taskResultList.stream().filter(t -> StrUtil.isNotBlank(t.getValue())).max(Comparator.comparingDouble(t -> Math.abs(NumberUtil.parseDouble(t.getValue()) - NumberUtil.parseDouble(value)))); - if (maxDifferenceTaskResult.isPresent()) { - TaskResult oldResult = maxDifferenceTaskResult.get(); - resultvalue = Math.abs(resultvalue - NumberUtil.parseDouble(oldResult.getValue())); - result.put("isSame", "1"); - result.put("oldContent", - oldResult.getPatroldeviceName() + "设备识别结果为" + oldResult.getValue() + ","); - } else { - return result; - } - } +// if (jsonArray.size() == 1) { +// // 非同源告警 +// LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); +// queryWrapper.eq(TaskResult::getDeviceId, deviceid).eq(TaskResult::getTaskTodoId, +// taskResult.getTaskTodoId()).eq(TaskResult::getFlag, "2").ne(TaskResult::getResultId, +// resultId); +// List taskResultList = taskResultMapper.selectList(queryWrapper); +// // List values = taskResultList.stream().filter(v->StrUtil.isNotBlank +// // (v.getValue())).map(TaskResult::getValue).collect(Collectors.toList()); +// Optional maxDifferenceTaskResult = +// taskResultList.stream().filter(t -> StrUtil.isNotBlank(t.getValue())).max(Comparator.comparingDouble(t -> Math.abs(NumberUtil.parseDouble(t.getValue()) - NumberUtil.parseDouble(value)))); +// if (maxDifferenceTaskResult.isPresent()) { +// TaskResult oldResult = maxDifferenceTaskResult.get(); +// resultvalue = Math.abs(resultvalue - NumberUtil.parseDouble(oldResult.getValue())); +// result.put("isSame", "1"); +// result.put("oldContent", +// oldResult.getPatroldeviceName() + "设备识别结果为" + oldResult.getValue() + ","); +// } else { +// return result; +// } +// } } // 三相温差告警、仪表三项对比 if ("3".equals(alarmThreshold.getAlarmType()) || "9".equals(alarmThreshold.getAlarmType())) { @@ -1509,10 +1522,28 @@ public class AlarmLogServiceImpl extends ServiceImpl i } List values = nonCoherentResult.stream().filter(n -> ObjectUtil.isNotEmpty(n.getValue())).map(TaskResult::getValue).collect(Collectors.toList()); - String max = CollectionUtil.max(values); - String min = CollectionUtil.min(values); + // 将字符串转换为Double并过滤无效数值 + List numericValues = values.stream() + .map(str -> { + try { + return Double.parseDouble(str); + } catch (NumberFormatException e) { + return null; // 或记录日志并跳过无效值 + } + }) + .filter(Objects::nonNull) + .collect(Collectors.toList()); + + if (numericValues.isEmpty()) { + // 处理空值情况(根据业务需求选择返回0/抛出异常等) + resultvalue = 0.0; + } + + // 使用数值列表计算最大最小值 + double max = Collections.max(numericValues); + double min = Collections.min(numericValues); // 最大值减去最小值 - resultvalue = NumberUtil.sub(Double.parseDouble(max), Double.parseDouble(min)); + resultvalue = NumberUtil.sub(max, min); Map phaseToValueMap = nonCoherentResult.stream() .collect(Collectors.toMap( TaskResult::getPhase, @@ -1643,32 +1674,33 @@ public class AlarmLogServiceImpl extends ServiceImpl i result.put("alarmtype", alarmThreshold.getAlarmType()); result.put("alarmlevel", "4"); result.put("isSame", "1"); + return result; } - if (jsonArray.size() == 1) { - // 非同源告警 - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(TaskResult::getDeviceId, deviceid).eq(TaskResult::getTaskTodoId, - taskResult.getTaskTodoId()).eq(TaskResult::getFlag, "2").ne(TaskResult::getResultId, - resultId); - List taskResultList = taskResultMapper.selectList(queryWrapper); - Optional first = - taskResultList.stream().filter(f -> StrUtil.isNotBlank(f.getValue()) && !value.equals(f.getValue())).findFirst(); - if (!first.isPresent()) { - return result; - } - TaskResult oldResult = first.get(); - result.put("oldContent", - oldResult.getPatroldeviceName() + "设备识别结果为" + oldResult.getDesc() + ","); - result.put("isNormal", "0"); - result.put("alarmtype", alarmThreshold.getAlarmType()); - result.put("alarmlevel", "4"); - result.put("isSame", "1"); - } - return result; +// if (jsonArray.size() == 1) { +// // 非同源告警 +// LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); +// queryWrapper.eq(TaskResult::getDeviceId, deviceid).eq(TaskResult::getTaskTodoId, +// taskResult.getTaskTodoId()).eq(TaskResult::getFlag, "2").ne(TaskResult::getResultId, +// resultId); +// List taskResultList = taskResultMapper.selectList(queryWrapper); +// Optional first = +// taskResultList.stream().filter(f -> StrUtil.isNotBlank(f.getValue()) && !value.equals(f.getValue())).findFirst(); +// if (!first.isPresent()) { +// return result; +// } +// TaskResult oldResult = first.get(); +// result.put("oldContent", +// oldResult.getPatroldeviceName() + "设备识别结果为" + oldResult.getDesc() + ","); +// result.put("isNormal", "0"); +// result.put("alarmtype", alarmThreshold.getAlarmType()); +// result.put("alarmlevel", "4"); +// result.put("isSame", "1"); +// } + } if ("1".equals(alarmThreshold.getIsLastContrast())) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(TaskResult::getDeviceId, deviceid).isNotNull(TaskResult::getPatroldeviceDate).lt(TaskResult::getPatroldeviceDate, + queryWrapper.ne(TaskResult::getResultId,resultId).eq(TaskResult::getDeviceId, deviceid).isNotNull(TaskResult::getPatroldeviceDate).lt(TaskResult::getPatroldeviceDate, taskResult.getPatroldeviceDate()).orderByDesc(TaskResult::getPatroldeviceDate).last("limit 0," + "1"); List taskResultList = taskResultMapper.selectList(queryWrapper); @@ -1751,7 +1783,7 @@ public class AlarmLogServiceImpl extends ServiceImpl i alarmLog.setTaskAlarmType("1"); //'1:巡视任务告警;2:静默任务告警,3:巡视设备告警', //alarmLog.setMonitorType("");//非静默监视不填 alarmLog.setAlarmType(ObjUtil.isNotEmpty(map.get("alarmtype")) ? map.get("alarmtype").toString() : "");//'字典表<1>: = 超温报警<2>: = 温升报警<3>: = 三相温差报警<4>: = 三相对比报警<5>: = 声音异常<6>: = 外观异常<7>: = 仪表越限报警<8>: = 仪表超量程报警<9>: = 仪表三相对比<10>: = 变位报警', - alarmLog.setAlarmLevel(ObjUtil.isNotEmpty(map.get("alarmlevel")) ? map.get("alarmlevel").toString() : "4");// '1:预警;2:一般;3:严重;4;危急', 待判断细分 + alarmLog.setAlarmLevel(ObjUtil.isNotEmpty(map.get("alarmlevel")) ? map.get("alarmlevel").toString() : "3");// '1:预警;2:一般;3:严重;4;危急', 待判断细分 alarmLog.setRecognitionType(taskResult.getRecognitionType());//'1:表计读取;2:位置状态识别;3:设备外观查看;4:红外测温;5:声音检测;6:闪烁检测11:局放超声波检测12:局放地电压检测13:局放特高频检测101:环境温度检测102:环境湿度检测103:氧气浓度检测104SF6浓度检测', alarmLog.setFileType(taskResult.getFileType());//'1:红外图谱;2:可见光照片;3:音频4:视频5:识别图片,存在多个文件,文件类型用逗号分隔', //告警文件目录规范:地市名/区域名/变电站名/分类/年月 @@ -2298,7 +2330,7 @@ public class AlarmLogServiceImpl extends ServiceImpl i signalDate.get("signalName").toString()); alarmLog.setContent(alarmMessage); //状态 - alarmLog.setAlarmLevel("4"); + alarmLog.setAlarmLevel("3"); alarmLog.setAlarmClass("2"); //2-设备报警 alarmLog.setRegion(meterDevice.getRegion()); 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 b749888..b0921b9 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 @@ -498,6 +498,11 @@ public class TodoTaskJob extends QuartzJobBean implements InterruptableJob { customParams.put("TempAngleList", jsonArray); } + if (JSONUtil.isTypeJSONObject(map.get("outsideAngle").toString())) { + cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(map.get("outsideAngle").toString()); + customParams.put("TempAngle", jsonObject); + } + } //基准图 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 d1d8f9a..ab62eea 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,14 +1,11 @@ package com.yfd.platform.utils; -import cn.hutool.core.io.FileUtil; - public class TestFileDir { public static void main(String[] args) throws Exception { - 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); + double resultvalue = 50; + double baseValue = 100; + double abs = Math.abs((resultvalue - baseValue) / baseValue * 100); + System.out.println(abs); + } } diff --git a/riis-system/src/main/resources/mapper/auxcontrol/DeviceSignalMapper.xml b/riis-system/src/main/resources/mapper/auxcontrol/DeviceSignalMapper.xml index 0fa42a7..ec70b49 100644 --- a/riis-system/src/main/resources/mapper/auxcontrol/DeviceSignalMapper.xml +++ b/riis-system/src/main/resources/mapper/auxcontrol/DeviceSignalMapper.xml @@ -105,26 +105,28 @@ AND b.ip_addr = #{ip} diff --git a/riis-system/src/main/resources/mapper/patroltask/AlarmLogMapper.xml b/riis-system/src/main/resources/mapper/patroltask/AlarmLogMapper.xml index 879bf30..b6e3a58 100644 --- a/riis-system/src/main/resources/mapper/patroltask/AlarmLogMapper.xml +++ b/riis-system/src/main/resources/mapper/patroltask/AlarmLogMapper.xml @@ -93,6 +93,7 @@