Browse Source

设备离线记录新增诊断字段,护栏碰撞过滤,只过滤应急车道事件

develop
wangsixiang 17 hours ago
parent
commit
31676ec395
  1. 64
      zc-business/src/main/java/com/zc/business/domain/DcDeviceOfflineRecord.java
  2. 16
      zc-business/src/main/java/com/zc/business/service/IDcDeviceOfflineRecordService.java
  3. 16
      zc-business/src/main/java/com/zc/business/service/impl/DcDeviceOfflineRecordServiceImpl.java
  4. 5
      zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java
  5. 15
      zc-business/src/main/resources/mapper/business/DcDeviceOfflineRecordMapper.xml

64
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 * 设备离线记录对象 dc_device_offline_record
* *
* @author ruoyi * @author ruoyi
* @date 2024-09-18 * @date 2024-09-18
*/ */
@ -122,22 +122,25 @@ public class DcDeviceOfflineRecord extends BaseEntity
private String startTime; private String startTime;
private String endTime; private String endTime;
/**诊断结果 */
@Excel(name = "诊断结果")
private String diagnostics;
public void setId(Long id) public void setId(Long id)
{ {
this.id = id; this.id = id;
} }
public Long getId() public Long getId()
{ {
return id; return id;
} }
public void setDeviceId(Long deviceId) public void setDeviceId(Long deviceId)
{ {
this.deviceId = deviceId; this.deviceId = deviceId;
} }
public Long getDeviceId() public Long getDeviceId()
{ {
return deviceId; return deviceId;
} }
@ -155,97 +158,97 @@ public class DcDeviceOfflineRecord extends BaseEntity
this.deviceName = deviceName; this.deviceName = deviceName;
} }
public String getDeviceName() public String getDeviceName()
{ {
return deviceName; return deviceName;
} }
public void setDeviceType(String deviceType) public void setDeviceType(String deviceType)
{ {
this.deviceType = deviceType; this.deviceType = deviceType;
} }
public String getDeviceType() public String getDeviceType()
{ {
return deviceType; return deviceType;
} }
public void setStakeMark(String stakeMark) public void setStakeMark(String stakeMark)
{ {
this.stakeMark = stakeMark; this.stakeMark = stakeMark;
} }
public String getStakeMark() public String getStakeMark()
{ {
return stakeMark; return stakeMark;
} }
public void setDirection(String direction) public void setDirection(String direction)
{ {
this.direction = direction; this.direction = direction;
} }
public String getDirection() public String getDirection()
{ {
return direction; return direction;
} }
public void setInstallationSite(String installationSite) public void setInstallationSite(String installationSite)
{ {
this.installationSite = installationSite; this.installationSite = installationSite;
} }
public String getInstallationSite() public String getInstallationSite()
{ {
return installationSite; return installationSite;
} }
public void setDeviceIp(String deviceIp) public void setDeviceIp(String deviceIp)
{ {
this.deviceIp = deviceIp; this.deviceIp = deviceIp;
} }
public String getDeviceIp() public String getDeviceIp()
{ {
return deviceIp; return deviceIp;
} }
public void setFacilitiesType(String facilitiesType) public void setFacilitiesType(String facilitiesType)
{ {
this.facilitiesType = facilitiesType; this.facilitiesType = facilitiesType;
} }
public String getFacilitiesType() public String getFacilitiesType()
{ {
return facilitiesType; return facilitiesType;
} }
public void setChildType(String childType) public void setChildType(String childType)
{ {
this.childType = childType; this.childType = childType;
} }
public String getChildType() public String getChildType()
{ {
return childType; return childType;
} }
public void setLongitude(String longitude) public void setLongitude(String longitude)
{ {
this.longitude = longitude; this.longitude = longitude;
} }
public String getLongitude() public String getLongitude()
{ {
return longitude; return longitude;
} }
public void setLatitude(String latitude) public void setLatitude(String latitude)
{ {
this.latitude = latitude; this.latitude = latitude;
} }
public String getLatitude() public String getLatitude()
{ {
return latitude; return latitude;
} }
public void setStatus(String status) public void setStatus(String status)
{ {
this.status = status; this.status = status;
} }
public String getStatus() public String getStatus()
{ {
return status; return status;
} }
@ -266,6 +269,14 @@ public class DcDeviceOfflineRecord extends BaseEntity
this.endTime = endTime; this.endTime = endTime;
} }
public String getDiagnostics() {
return diagnostics;
}
public void setDiagnostics(String diagnostics) {
this.diagnostics = diagnostics;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -286,6 +297,7 @@ public class DcDeviceOfflineRecord extends BaseEntity
.append("createTime", getCreateTime()) .append("createTime", getCreateTime())
.append("updateTime", getUpdateTime()) .append("updateTime", getUpdateTime())
.append("updateBy", getUpdateBy()) .append("updateBy", getUpdateBy())
.append("diagnostics", getDiagnostics())
.toString(); .toString();
} }
} }

16
zc-business/src/main/java/com/zc/business/service/IDcDeviceOfflineRecordService.java

@ -8,15 +8,15 @@ import com.zc.business.domain.DcDeviceOfflineRecord;
/** /**
* 设备离线记录Service接口 * 设备离线记录Service接口
* *
* @author ruoyi * @author ruoyi
* @date 2024-09-18 * @date 2024-09-18
*/ */
public interface IDcDeviceOfflineRecordService public interface IDcDeviceOfflineRecordService
{ {
/** /**
* 查询设备离线记录 * 查询设备离线记录
* *
* @param id 设备离线记录主键 * @param id 设备离线记录主键
* @return 设备离线记录 * @return 设备离线记录
*/ */
@ -24,7 +24,7 @@ public interface IDcDeviceOfflineRecordService
/** /**
* 查询设备离线记录列表 * 查询设备离线记录列表
* *
* @param dcDeviceOfflineRecord 设备离线记录 * @param dcDeviceOfflineRecord 设备离线记录
* @return 设备离线记录集合 * @return 设备离线记录集合
*/ */
@ -32,7 +32,7 @@ public interface IDcDeviceOfflineRecordService
/** /**
* 新增设备离线记录 * 新增设备离线记录
* *
* @param dcDeviceOfflineRecord 设备离线记录 * @param dcDeviceOfflineRecord 设备离线记录
* @return 结果 * @return 结果
*/ */
@ -40,7 +40,7 @@ public interface IDcDeviceOfflineRecordService
/** /**
* 修改设备离线记录 * 修改设备离线记录
* *
* @param dcDeviceOfflineRecord 设备离线记录 * @param dcDeviceOfflineRecord 设备离线记录
* @return 结果 * @return 结果
*/ */
@ -48,7 +48,7 @@ public interface IDcDeviceOfflineRecordService
/** /**
* 批量删除设备离线记录 * 批量删除设备离线记录
* *
* @param ids 需要删除的设备离线记录主键集合 * @param ids 需要删除的设备离线记录主键集合
* @return 结果 * @return 结果
*/ */
@ -56,7 +56,7 @@ public interface IDcDeviceOfflineRecordService
/** /**
* 删除设备离线记录信息 * 删除设备离线记录信息
* *
* @param id 设备离线记录主键 * @param id 设备离线记录主键
* @return 结果 * @return 结果
*/ */

16
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.ruoyi.common.utils.StringUtils;
import com.zc.business.constant.RedisKeyConstants; import com.zc.business.constant.RedisKeyConstants;
import com.zc.business.domain.DcDevice; 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.WebSocketService;
import com.zc.common.core.websocket.constant.WebSocketEvent; import com.zc.common.core.websocket.constant.WebSocketEvent;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -33,7 +34,8 @@ public class DcDeviceOfflineRecordServiceImpl implements IDcDeviceOfflineRecordS
private DcDeviceOfflineRecordMapper dcDeviceOfflineRecordMapper; private DcDeviceOfflineRecordMapper dcDeviceOfflineRecordMapper;
@Autowired @Autowired
private RedisCache redisCache; private RedisCache redisCache;
@Autowired
private DcSwitchService dcSwitchService;
/** /**
* 查询设备离线记录 * 查询设备离线记录
* *
@ -68,6 +70,18 @@ public class DcDeviceOfflineRecordServiceImpl implements IDcDeviceOfflineRecordS
public int insertDcDeviceOfflineRecord(DcDeviceOfflineRecord dcDeviceOfflineRecord) public int insertDcDeviceOfflineRecord(DcDeviceOfflineRecord dcDeviceOfflineRecord)
{ {
dcDeviceOfflineRecord.setCreateTime(DateUtils.getNowDate()); 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); int i = dcDeviceOfflineRecordMapper.insertDcDeviceOfflineRecord(dcDeviceOfflineRecord);
redisCache.setCacheMapValue(RedisKeyConstants.DC_DEVICE_OFFLINE_RECORD,dcDeviceOfflineRecord.getIotDeviceId(),dcDeviceOfflineRecord); redisCache.setCacheMapValue(RedisKeyConstants.DC_DEVICE_OFFLINE_RECORD,dcDeviceOfflineRecord.getIotDeviceId(),dcDeviceOfflineRecord);

5
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())) { StringUtils.isBlank(dcWarning.getWarningSubclass()) || StringUtils.isBlank(dcWarning.getDirection())) {
return UniversalEnum.ZERO.getNumber(); 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; return 1;
} }
String redisKye = dcWarning.getWarningSource().toString() + dcWarning.getWarningType().toString() + dcWarning.getWarningSubclass();//配置数据的key 事件源+事件类型+策略 String redisKye = dcWarning.getWarningSource().toString() + dcWarning.getWarningType().toString() + dcWarning.getWarningSubclass();//配置数据的key 事件源+事件类型+策略

15
zc-business/src/main/resources/mapper/business/DcDeviceOfflineRecordMapper.xml

@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zc.business.mapper.DcDeviceOfflineRecordMapper"> <mapper namespace="com.zc.business.mapper.DcDeviceOfflineRecordMapper">
<resultMap type="DcDeviceOfflineRecord" id="DcDeviceOfflineRecordResult"> <resultMap type="DcDeviceOfflineRecord" id="DcDeviceOfflineRecordResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="deviceId" column="device_id" /> <result property="deviceId" column="device_id" />
@ -22,15 +22,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by" />
<result property="diagnostics" column="diagnostics" />
</resultMap> </resultMap>
<sql id="selectDcDeviceOfflineRecordVo"> <sql id="selectDcDeviceOfflineRecordVo">
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
</sql> </sql>
<select id="selectDcDeviceOfflineRecordList" parameterType="DcDeviceOfflineRecord" resultMap="DcDeviceOfflineRecordResult"> <select id="selectDcDeviceOfflineRecordList" parameterType="DcDeviceOfflineRecord" resultMap="DcDeviceOfflineRecordResult">
<include refid="selectDcDeviceOfflineRecordVo"/> <include refid="selectDcDeviceOfflineRecordVo"/>
<where> <where>
<if test="deviceId != null "> and device_id = #{deviceId}</if> <if test="deviceId != null "> and device_id = #{deviceId}</if>
<if test="iotDeviceId != null "> and iot_device_id = #{iotDeviceId}</if> <if test="iotDeviceId != null "> and iot_device_id = #{iotDeviceId}</if>
<if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if> <if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
@ -51,7 +52,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where> </where>
order by id desc order by id desc
</select> </select>
<select id="selectDcDeviceOfflineRecordById" parameterType="Long" resultMap="DcDeviceOfflineRecordResult"> <select id="selectDcDeviceOfflineRecordById" parameterType="Long" resultMap="DcDeviceOfflineRecordResult">
<include refid="selectDcDeviceOfflineRecordVo"/> <include refid="selectDcDeviceOfflineRecordVo"/>
where id = #{id} where id = #{id}
@ -83,6 +84,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">create_time,</if> <if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if> <if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if> <if test="updateBy != null">update_by,</if>
<if test="diagnostics != null">`diagnostics`,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="deviceId != null">#{deviceId},</if> <if test="deviceId != null">#{deviceId},</if>
@ -101,6 +103,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if> <if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if> <if test="updateBy != null">#{updateBy},</if>
<if test="diagnostics != null">#{diagnostics},</if>
</trim> </trim>
</insert> </insert>
@ -132,9 +135,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete> </delete>
<delete id="deleteDcDeviceOfflineRecordByIds" parameterType="String"> <delete id="deleteDcDeviceOfflineRecordByIds" parameterType="String">
delete from dc_device_offline_record where id in delete from dc_device_offline_record where id in
<foreach item="id" collection="array" open="(" separator="," close=")"> <foreach item="id" collection="array" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
</delete> </delete>
</mapper> </mapper>

Loading…
Cancel
Save