From 31676ec3955d9c8d194bd283b84e600352118395 Mon Sep 17 00:00:00 2001 From: wangsixiang <2970484253@qq.com> Date: Mon, 25 Nov 2024 10:50:02 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E7=A6=BB=E7=BA=BF=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E6=96=B0=E5=A2=9E=E8=AF=8A=E6=96=AD=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=EF=BC=8C=E6=8A=A4=E6=A0=8F=E7=A2=B0=E6=92=9E=E8=BF=87=E6=BB=A4?= =?UTF-8?q?=EF=BC=8C=E5=8F=AA=E8=BF=87=E6=BB=A4=E5=BA=94=E6=80=A5=E8=BD=A6?= =?UTF-8?q?=E9=81=93=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/DcDeviceOfflineRecord.java | 64 +++++++++++-------- .../IDcDeviceOfflineRecordService.java | 16 ++--- .../DcDeviceOfflineRecordServiceImpl.java | 16 ++++- .../service/impl/DcWarningServiceImpl.java | 5 +- .../business/DcDeviceOfflineRecordMapper.xml | 15 +++-- 5 files changed, 73 insertions(+), 43 deletions(-) diff --git a/zc-business/src/main/java/com/zc/business/domain/DcDeviceOfflineRecord.java b/zc-business/src/main/java/com/zc/business/domain/DcDeviceOfflineRecord.java index 73ad8500..ae0528ec 100644 --- a/zc-business/src/main/java/com/zc/business/domain/DcDeviceOfflineRecord.java +++ b/zc-business/src/main/java/com/zc/business/domain/DcDeviceOfflineRecord.java @@ -9,7 +9,7 @@ import com.ruoyi.common.core.domain.BaseEntity; /** * 设备离线记录对象 dc_device_offline_record - * + * * @author ruoyi * @date 2024-09-18 */ @@ -122,22 +122,25 @@ public class DcDeviceOfflineRecord extends BaseEntity private String startTime; private String endTime; + /**诊断结果 */ + @Excel(name = "诊断结果") + private String diagnostics; - public void setId(Long id) + public void setId(Long id) { this.id = id; } - public Long getId() + public Long getId() { return id; } - public void setDeviceId(Long deviceId) + public void setDeviceId(Long deviceId) { this.deviceId = deviceId; } - public Long getDeviceId() + public Long getDeviceId() { return deviceId; } @@ -155,97 +158,97 @@ public class DcDeviceOfflineRecord extends BaseEntity this.deviceName = deviceName; } - public String getDeviceName() + public String getDeviceName() { return deviceName; } - public void setDeviceType(String deviceType) + public void setDeviceType(String deviceType) { this.deviceType = deviceType; } - public String getDeviceType() + public String getDeviceType() { return deviceType; } - public void setStakeMark(String stakeMark) + public void setStakeMark(String stakeMark) { this.stakeMark = stakeMark; } - public String getStakeMark() + public String getStakeMark() { return stakeMark; } - public void setDirection(String direction) + public void setDirection(String direction) { this.direction = direction; } - public String getDirection() + public String getDirection() { return direction; } - public void setInstallationSite(String installationSite) + public void setInstallationSite(String installationSite) { this.installationSite = installationSite; } - public String getInstallationSite() + public String getInstallationSite() { return installationSite; } - public void setDeviceIp(String deviceIp) + public void setDeviceIp(String deviceIp) { this.deviceIp = deviceIp; } - public String getDeviceIp() + public String getDeviceIp() { return deviceIp; } - public void setFacilitiesType(String facilitiesType) + public void setFacilitiesType(String facilitiesType) { this.facilitiesType = facilitiesType; } - public String getFacilitiesType() + public String getFacilitiesType() { return facilitiesType; } - public void setChildType(String childType) + public void setChildType(String childType) { this.childType = childType; } - public String getChildType() + public String getChildType() { return childType; } - public void setLongitude(String longitude) + public void setLongitude(String longitude) { this.longitude = longitude; } - public String getLongitude() + public String getLongitude() { return longitude; } - public void setLatitude(String latitude) + public void setLatitude(String latitude) { this.latitude = latitude; } - public String getLatitude() + public String getLatitude() { return latitude; } - public void setStatus(String status) + public void setStatus(String status) { this.status = status; } - public String getStatus() + public String getStatus() { return status; } @@ -266,6 +269,14 @@ public class DcDeviceOfflineRecord extends BaseEntity this.endTime = endTime; } + public String getDiagnostics() { + return diagnostics; + } + + public void setDiagnostics(String diagnostics) { + this.diagnostics = diagnostics; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) @@ -286,6 +297,7 @@ public class DcDeviceOfflineRecord extends BaseEntity .append("createTime", getCreateTime()) .append("updateTime", getUpdateTime()) .append("updateBy", getUpdateBy()) + .append("diagnostics", getDiagnostics()) .toString(); } } diff --git a/zc-business/src/main/java/com/zc/business/service/IDcDeviceOfflineRecordService.java b/zc-business/src/main/java/com/zc/business/service/IDcDeviceOfflineRecordService.java index f2c2e110..a1b03caf 100644 --- a/zc-business/src/main/java/com/zc/business/service/IDcDeviceOfflineRecordService.java +++ b/zc-business/src/main/java/com/zc/business/service/IDcDeviceOfflineRecordService.java @@ -8,15 +8,15 @@ import com.zc.business.domain.DcDeviceOfflineRecord; /** * 设备离线记录Service接口 - * + * * @author ruoyi * @date 2024-09-18 */ -public interface IDcDeviceOfflineRecordService +public interface IDcDeviceOfflineRecordService { /** * 查询设备离线记录 - * + * * @param id 设备离线记录主键 * @return 设备离线记录 */ @@ -24,7 +24,7 @@ public interface IDcDeviceOfflineRecordService /** * 查询设备离线记录列表 - * + * * @param dcDeviceOfflineRecord 设备离线记录 * @return 设备离线记录集合 */ @@ -32,7 +32,7 @@ public interface IDcDeviceOfflineRecordService /** * 新增设备离线记录 - * + * * @param dcDeviceOfflineRecord 设备离线记录 * @return 结果 */ @@ -40,7 +40,7 @@ public interface IDcDeviceOfflineRecordService /** * 修改设备离线记录 - * + * * @param dcDeviceOfflineRecord 设备离线记录 * @return 结果 */ @@ -48,7 +48,7 @@ public interface IDcDeviceOfflineRecordService /** * 批量删除设备离线记录 - * + * * @param ids 需要删除的设备离线记录主键集合 * @return 结果 */ @@ -56,7 +56,7 @@ public interface IDcDeviceOfflineRecordService /** * 删除设备离线记录信息 - * + * * @param id 设备离线记录主键 * @return 结果 */ diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcDeviceOfflineRecordServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcDeviceOfflineRecordServiceImpl.java index fd06f586..492052ef 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcDeviceOfflineRecordServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcDeviceOfflineRecordServiceImpl.java @@ -10,6 +10,7 @@ import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.StringUtils; import com.zc.business.constant.RedisKeyConstants; import com.zc.business.domain.DcDevice; +import com.zc.business.service.DcSwitchService; import com.zc.common.core.websocket.WebSocketService; import com.zc.common.core.websocket.constant.WebSocketEvent; import org.springframework.beans.factory.annotation.Autowired; @@ -33,7 +34,8 @@ public class DcDeviceOfflineRecordServiceImpl implements IDcDeviceOfflineRecordS private DcDeviceOfflineRecordMapper dcDeviceOfflineRecordMapper; @Autowired private RedisCache redisCache; - + @Autowired + private DcSwitchService dcSwitchService; /** * 查询设备离线记录 * @@ -68,6 +70,18 @@ public class DcDeviceOfflineRecordServiceImpl implements IDcDeviceOfflineRecordS public int insertDcDeviceOfflineRecord(DcDeviceOfflineRecord dcDeviceOfflineRecord) { dcDeviceOfflineRecord.setCreateTime(DateUtils.getNowDate()); + String deviceIp = dcDeviceOfflineRecord.getDeviceIp();//设备ip + String deviceType = dcDeviceOfflineRecord.getDeviceType();//设备类型 + if (org.apache.commons.lang3.StringUtils.isNotBlank(deviceIp)&&org.apache.commons.lang3.StringUtils.isNotBlank(deviceType)){ + try { + AjaxResult ajaxResult = dcSwitchService.deviceDiagnostics(dcDeviceOfflineRecord); + if (ajaxResult.get("code").toString().equals("200")){ + dcDeviceOfflineRecord.setDiagnostics(ajaxResult.get("msg").toString()); + } + } catch (Exception e) { + throw new RuntimeException("Failed to perform device diagnostics", e); + } + } int i = dcDeviceOfflineRecordMapper.insertDcDeviceOfflineRecord(dcDeviceOfflineRecord); redisCache.setCacheMapValue(RedisKeyConstants.DC_DEVICE_OFFLINE_RECORD,dcDeviceOfflineRecord.getIotDeviceId(),dcDeviceOfflineRecord); diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java index 56ba8e75..db385398 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java @@ -169,8 +169,9 @@ public class DcWarningServiceImpl implements IDcWarningService { StringUtils.isBlank(dcWarning.getWarningSubclass()) || StringUtils.isBlank(dcWarning.getDirection())) { return UniversalEnum.ZERO.getNumber(); } - //目前护栏碰撞触发的事件先进行过滤掉,后续可能会放开 - if ("4".equals(dcWarning.getWarningSource().toString())){ + //目前护栏碰撞触发的事件,有关应急车道的先进行过滤掉,后续可能会放开 + if ("4".equals(dcWarning.getWarningSource().toString())&&("4-7".equals(dcWarning.getWarningSubclass())|| + "4-8".equals(dcWarning.getWarningSubclass()))){ return 1; } String redisKye = dcWarning.getWarningSource().toString() + dcWarning.getWarningType().toString() + dcWarning.getWarningSubclass();//配置数据的key 事件源+事件类型+策略 diff --git a/zc-business/src/main/resources/mapper/business/DcDeviceOfflineRecordMapper.xml b/zc-business/src/main/resources/mapper/business/DcDeviceOfflineRecordMapper.xml index a10a57c1..93655567 100644 --- a/zc-business/src/main/resources/mapper/business/DcDeviceOfflineRecordMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcDeviceOfflineRecordMapper.xml @@ -3,7 +3,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + @@ -22,15 +22,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + - select id, device_id,iot_device_id, device_name, device_type, stake_mark, direction, installation_site, device_ip, facilities_type, child_type, longitude, latitude, status, create_time, update_time, update_by from dc_device_offline_record + select id, device_id,iot_device_id, device_name, device_type, stake_mark, direction, installation_site, device_ip, facilities_type, child_type, longitude, latitude, status, create_time, update_time, update_by,diagnostics from dc_device_offline_record - +