Browse Source

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

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

12
zc-business/src/main/java/com/zc/business/domain/DcDeviceOfflineRecord.java

@ -122,6 +122,9 @@ 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)
{ {
@ -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/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 事件源+事件类型+策略

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

@ -22,10 +22,11 @@ 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">
@ -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>

Loading…
Cancel
Save