提交系统逻辑
This commit is contained in:
parent
5302d8208b
commit
bc05013751
@ -1120,7 +1120,7 @@ public class NettyServerHandler extends SimpleChannelInboundHandler<MyMessagePro
|
||||
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");//
|
||||
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浓度检测',
|
||||
|
@ -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<AlgorithmClassComponentMapper,
|
||||
AlgorithmClassComponent> implements IAlgorithmClassComponentService {
|
||||
|
||||
@Resource
|
||||
private AlgorithmDeviceMapper algorithmDeviceMapper;
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 算法关联主设备部件
|
||||
* 参数说明 algorithmId 算法分类id
|
||||
@ -45,6 +51,16 @@ public class AlgorithmClassComponentServiceImpl extends ServiceImpl<AlgorithmCla
|
||||
***********************************/
|
||||
@Override
|
||||
public boolean deleteAlgorithmClassComponent(String id) {
|
||||
AlgorithmClassComponent algorithmClassComponent = this.getById(id);
|
||||
String algorithmId = algorithmClassComponent.getAlgorithmId();
|
||||
String componentId = algorithmClassComponent.getComponentId();
|
||||
if (StrUtil.isNotBlank(algorithmId) && StrUtil.isNotBlank(componentId)) {
|
||||
LambdaQueryWrapper<AlgorithmDevice> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(AlgorithmDevice::getAlgorithmId, algorithmId).eq(AlgorithmDevice::getComponentId,
|
||||
componentId);
|
||||
algorithmDeviceMapper.delete(queryWrapper);
|
||||
}
|
||||
|
||||
return this.removeById(id);
|
||||
}
|
||||
|
||||
|
@ -69,9 +69,12 @@ public class AlgorithmClassServiceImpl extends ServiceImpl<AlgorithmClassMapper,
|
||||
public boolean deleteAlgorithmClass(String id) {
|
||||
LambdaQueryWrapper<AlgorithmParams> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(AlgorithmParams::getAlgorithmId, id);
|
||||
boolean remove = algorithmParamsService.remove(queryWrapper);
|
||||
boolean removeDevice =
|
||||
algorithmDeviceService.remove(new LambdaQueryWrapper<AlgorithmDevice>().eq(AlgorithmDevice::getAlgorithmId, id));
|
||||
algorithmClassComponentMapper.delete(new LambdaQueryWrapper<AlgorithmClassComponent>().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("删除错误");
|
||||
|
@ -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<AlgorithmParamsMapper, AlgorithmParams> 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<AlgorithmParamsMappe
|
||||
return this.saveOrUpdateBatch(algorithmParamsList);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean deleteAlgorithmParams(String id) {
|
||||
LambdaQueryWrapper<AlgorithmDevice> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(AlgorithmDevice::getParamId, id);
|
||||
algorithmDeviceMapper.delete(queryWrapper);
|
||||
return this.removeById(id);
|
||||
}
|
||||
|
||||
|
@ -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<SubstationPatroldevice> 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);
|
||||
|
@ -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<SubstationMaind
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean deleteMainDevice(String id) {
|
||||
|
||||
Integer integer =
|
||||
substationComponentMapper.selectCount(new LambdaQueryWrapper<SubstationComponent>().eq(SubstationComponent::getMainDeviceId, id));
|
||||
if (integer > 0) {
|
||||
throw new RuntimeException("当前主设备已经绑定部件无法删除");
|
||||
}
|
||||
|
||||
SubstationMaindevice substationMaindevice = this.getById(id);
|
||||
// 如果是启用状态不允许删除
|
||||
if ("1".equals(substationMaindevice.getDatastatus())) {
|
||||
return false;
|
||||
}
|
||||
// LambdaQueryWrapper<SubstationComponent> queryWrapper = new LambdaQueryWrapper<>();
|
||||
// queryWrapper.eq(SubstationComponent::getMainDeviceId, id);
|
||||
// substationComponentMapper.delete(queryWrapper);
|
||||
boolean ok = this.removeById(id);
|
||||
String bayId = substationMaindevice.getBayId();
|
||||
List<SubstationMaindevice> list =
|
||||
@ -164,14 +175,6 @@ public class SubstationMaindeviceServiceImpl extends ServiceImpl<SubstationMaind
|
||||
substationMaindevice1.setCustom1(i + 1);
|
||||
this.updateById(substationMaindevice1);
|
||||
}
|
||||
if (ok) {
|
||||
List<SubstationComponent> substationComponents =
|
||||
substationComponentMapper.selectList(new LambdaQueryWrapper<SubstationComponent>().eq(SubstationComponent::getMainDeviceId, id));
|
||||
for (SubstationComponent substationComponent : substationComponents) {
|
||||
String componentId = substationComponent.getComponentId();
|
||||
substationComponentMapper.deleteById(componentId);
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
@ -591,6 +591,7 @@ public class SubstationPatroldeviceServiceImpl extends ServiceImpl<SubstationPat
|
||||
if (StrUtil.isNotBlank(manufacturer)) {
|
||||
queryWrapper.like(SubstationPatroldevice::getManufacturer, manufacturer);
|
||||
}
|
||||
queryWrapper.orderByAsc(SubstationPatroldevice::getPatroldeviceCode);
|
||||
List<SubstationPatroldevice> list = this.list(queryWrapper);
|
||||
List<Map<String, Object>> mapList = new ArrayList<>();
|
||||
Map<String, Object> patrolEquipmentType = sysDictionaryItemsService.getDeviceMapByType(
|
||||
|
@ -406,7 +406,13 @@ public class SubstationServiceImpl extends ServiceImpl<SubstationMapper, Substat
|
||||
@Override
|
||||
public boolean deleteSubstation(String stationId) {
|
||||
Substation substation = substationMapper.selectById(stationId);
|
||||
String stationCode = substation.getStationCode();
|
||||
Integer integer =
|
||||
substationAreaMapper.selectCount(new LambdaQueryWrapper<SubstationArea>().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<SubstationMapper, Substat
|
||||
substation1.setCustom1(i1 + 1);
|
||||
this.updateById(substation1);
|
||||
}
|
||||
List<SubstationArea> substationAreas =
|
||||
substationAreaMapper.selectList(new LambdaQueryWrapper<SubstationArea>().eq(SubstationArea::getStationCode,
|
||||
stationCode));
|
||||
for (SubstationArea substationArea : substationAreas) {
|
||||
String areaId = substationArea.getAreaId();
|
||||
this.deleteSubstationArea(areaId);
|
||||
}
|
||||
// String stationCode = substation.getStationCode();
|
||||
// List<SubstationArea> substationAreas =
|
||||
// substationAreaMapper.selectList(new LambdaQueryWrapper<SubstationArea>().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<SubstationMapper, Substat
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean deleteSubstationArea(String areaId) {
|
||||
|
||||
Integer integer =
|
||||
substationBayMapper.selectCount(new LambdaQueryWrapper<SubstationBay>().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<SubstationMapper, Substat
|
||||
substationArea.setCustom1(i1 + 1);
|
||||
substationAreaMapper.updateById(substationArea);
|
||||
}
|
||||
List<SubstationBay> substationBays =
|
||||
substationBayMapper.selectList(new LambdaQueryWrapper<SubstationBay>().eq(SubstationBay::getAreaId,
|
||||
areaId));
|
||||
for (SubstationBay substationBay : substationBays) {
|
||||
String bayId = substationBay.getBayId();
|
||||
this.deleteSubstationBay(bayId);
|
||||
}
|
||||
|
||||
// LambdaQueryWrapper<SubstationBay> queryWrapper = new LambdaQueryWrapper<>();
|
||||
// queryWrapper.eq(SubstationBay::getAreaId, areaId);
|
||||
// substationBayMapper.delete(queryWrapper);
|
||||
// List<SubstationBay> substationBays =
|
||||
// substationBayMapper.selectList(new LambdaQueryWrapper<SubstationBay>().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<SubstationMapper, Substat
|
||||
***********************************/
|
||||
@Override
|
||||
public boolean deleteSubstationBay(String bayId) {
|
||||
Integer integer =
|
||||
substationMaindeviceMapper.selectCount(new LambdaQueryWrapper<SubstationMaindevice>().eq(SubstationMaindevice::getBayId, bayId));
|
||||
if (integer > 0) {
|
||||
throw new RuntimeException("当前间隔已经绑定主设备无法删除");
|
||||
}
|
||||
int i = substationBayMapper.deleteById(bayId);
|
||||
List<SubstationBay> substationBays =
|
||||
substationBayMapper.selectList(new LambdaQueryWrapper<SubstationBay>().orderByAsc(SubstationBay::getCustom1));
|
||||
|
@ -154,7 +154,7 @@ public class AlarmLog implements Serializable {
|
||||
private String defectType;
|
||||
|
||||
/**
|
||||
* 1:预警;2:一般;3:严重;4;危急
|
||||
*1:一般;2:严重;3;危急
|
||||
*/
|
||||
private String alarmLevel;
|
||||
|
||||
|
@ -280,7 +280,7 @@ public class AlarmLogServiceImpl extends ServiceImpl<AlarmLogMapper, AlarmLog> i
|
||||
resImagePath = result.getStr("resImagePath");
|
||||
}
|
||||
Map<String, Object> 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<AlarmLogMapper, AlarmLog> 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<AlarmLogMapper, AlarmLog> i
|
||||
taskResult.setDefectFilePath(taskResult.getFilePath());
|
||||
}
|
||||
String valueType = taskResult.getValueType();
|
||||
Map<String, Object> judgeresult = judgeAbnormal(result.getStr("type"), result.getStr("value"),
|
||||
result.getStr("conf"), taskResult.getDeviceId(), taskResult.getResultId());
|
||||
Map<String, Object> 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<Map<String, Object>> pictureDefectAnalysisTypeList = sysDictionaryItemsService.getDeviceByType(
|
||||
"PictureDefectAnalysisType");
|
||||
@ -728,7 +733,7 @@ public class AlarmLogServiceImpl extends ServiceImpl<AlarmLogMapper, AlarmLog> 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<AlarmLogMapper, AlarmLog> i
|
||||
***********************************/
|
||||
@Override
|
||||
public Map<String, Object> getAlarmLogById(String id) {
|
||||
return alarmLogMapper.getAlarmLogById(id);
|
||||
Map<String, Object> alarmLog = alarmLogMapper.getAlarmLogById(id);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(alarmLog.get("deviceid"))) {
|
||||
Map<String, String> 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<AlarmLogMapper, AlarmLog> 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<AlarmLogMapper, AlarmLog> i
|
||||
return result;
|
||||
}
|
||||
}
|
||||
if (jsonArray.size() == 1) {
|
||||
// 非同源告警
|
||||
LambdaQueryWrapper<TaskResult> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(TaskResult::getDeviceId, deviceid).eq(TaskResult::getTaskTodoId,
|
||||
taskResult.getTaskTodoId()).eq(TaskResult::getFlag, "2").ne(TaskResult::getResultId,
|
||||
resultId);
|
||||
List<TaskResult> taskResultList = taskResultMapper.selectList(queryWrapper);
|
||||
// List<String> values = taskResultList.stream().filter(v->StrUtil.isNotBlank
|
||||
// (v.getValue())).map(TaskResult::getValue).collect(Collectors.toList());
|
||||
Optional<TaskResult> 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<TaskResult> queryWrapper = new LambdaQueryWrapper<>();
|
||||
// queryWrapper.eq(TaskResult::getDeviceId, deviceid).eq(TaskResult::getTaskTodoId,
|
||||
// taskResult.getTaskTodoId()).eq(TaskResult::getFlag, "2").ne(TaskResult::getResultId,
|
||||
// resultId);
|
||||
// List<TaskResult> taskResultList = taskResultMapper.selectList(queryWrapper);
|
||||
// // List<String> values = taskResultList.stream().filter(v->StrUtil.isNotBlank
|
||||
// // (v.getValue())).map(TaskResult::getValue).collect(Collectors.toList());
|
||||
// Optional<TaskResult> 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<AlarmLogMapper, AlarmLog> i
|
||||
}
|
||||
List<String> 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<Double> 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<String, String> phaseToValueMap = nonCoherentResult.stream()
|
||||
.collect(Collectors.toMap(
|
||||
TaskResult::getPhase,
|
||||
@ -1643,32 +1674,33 @@ public class AlarmLogServiceImpl extends ServiceImpl<AlarmLogMapper, AlarmLog> i
|
||||
result.put("alarmtype", alarmThreshold.getAlarmType());
|
||||
result.put("alarmlevel", "4");
|
||||
result.put("isSame", "1");
|
||||
}
|
||||
if (jsonArray.size() == 1) {
|
||||
// 非同源告警
|
||||
LambdaQueryWrapper<TaskResult> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(TaskResult::getDeviceId, deviceid).eq(TaskResult::getTaskTodoId,
|
||||
taskResult.getTaskTodoId()).eq(TaskResult::getFlag, "2").ne(TaskResult::getResultId,
|
||||
resultId);
|
||||
List<TaskResult> taskResultList = taskResultMapper.selectList(queryWrapper);
|
||||
Optional<TaskResult> 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<TaskResult> queryWrapper = new LambdaQueryWrapper<>();
|
||||
// queryWrapper.eq(TaskResult::getDeviceId, deviceid).eq(TaskResult::getTaskTodoId,
|
||||
// taskResult.getTaskTodoId()).eq(TaskResult::getFlag, "2").ne(TaskResult::getResultId,
|
||||
// resultId);
|
||||
// List<TaskResult> taskResultList = taskResultMapper.selectList(queryWrapper);
|
||||
// Optional<TaskResult> 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<TaskResult> 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<TaskResult> taskResultList = taskResultMapper.selectList(queryWrapper);
|
||||
@ -1751,7 +1783,7 @@ public class AlarmLogServiceImpl extends ServiceImpl<AlarmLogMapper, AlarmLog> 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<AlarmLogMapper, AlarmLog> i
|
||||
signalDate.get("signalName").toString());
|
||||
alarmLog.setContent(alarmMessage);
|
||||
//状态
|
||||
alarmLog.setAlarmLevel("4");
|
||||
alarmLog.setAlarmLevel("3");
|
||||
alarmLog.setAlarmClass("2");
|
||||
//2-设备报警
|
||||
alarmLog.setRegion(meterDevice.getRegion());
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//基准图
|
||||
|
@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -114,10 +114,12 @@
|
||||
fds.normal_range,
|
||||
fds.ykyt_type,
|
||||
fmd.device_model,
|
||||
fmd.device_code,
|
||||
fmd.place,
|
||||
fgd.ip_addr,
|
||||
fgd.Protocol,
|
||||
fgd.frequency,
|
||||
fgd.device_name,
|
||||
fmd.device_name,
|
||||
fgd.device_type
|
||||
FROM
|
||||
fk_device_signal fds
|
||||
|
@ -93,6 +93,7 @@
|
||||
<select id="getAlarmLogById" resultType="java.util.Map">
|
||||
SELECT
|
||||
al.*,
|
||||
al.device_id deviceid,
|
||||
tr.patroldevice_code deviceId,
|
||||
tr.patroldevice_channelcode channelId,
|
||||
tr.patroldevice_pos patroldevicePos
|
||||
|
Loading…
Reference in New Issue
Block a user