fix: 调整最后心跳更新业务逻辑

dev
huangfeng 2 weeks ago
parent 7980c740e4
commit 21f231de89

@ -16,6 +16,8 @@ public class TerminalStatus implements Serializable {
private Integer lastHeartbeatPort;
private BigInteger lastBbDevTime;
private Integer lastFrameNo;
private Float batteryVoltage;

@ -6,6 +6,7 @@
<result column="last_heartbeat" jdbcType="BIGINT" property="lastHeartbeat" />
<result column="last_heartbeat_ip" jdbcType="VARCHAR" property="lastHeartbeatIp" />
<result column="last_heartbeat_port" jdbcType="SMALLINT" property="lastHeartbeatPort" />
<result column="last_hb_dev_time" jdbcType="BIGINT" property="lastBbDevTime" />
<result column="last_frame_no" jdbcType="SMALLINT" property="lastFrameNo" />
<result column="battery_voltage" jdbcType="REAL" property="batteryVoltage" />
<result column="op_temperature" jdbcType="REAL" property="opTemperature" />
@ -461,6 +462,7 @@
set last_heartbeat = #{lastHeartbeat,jdbcType=BIGINT},
last_heartbeat_ip = #{lastHeartbeatIp,jdbcType=VARCHAR},
last_heartbeat_port = #{lastHeartbeatPort,jdbcType=SMALLINT},
last_hb_dev_time = #{lastBbDevTime,jdbcType=BIGINT},
last_frame_no = #{lastFrameNo,jdbcType=SMALLINT},
battery_voltage = #{batteryVoltage,jdbcType=REAL},
op_temperature = #{opTemperature,jdbcType=REAL},

@ -33,8 +33,9 @@ public class HeartbeatHandler {
Date beatTime = DateUtil.parse(time, "yyyyMMddHHmmss");
TerminalStatus record = terminalStatusDao.selectByPrimaryKey(term.getId());
if (record != null) {
record.setLastHeartbeat(BigInteger.valueOf(beatTime.getTime() / 1000));
terminalStatusDao.updateByPrimaryKeySelective(record);
record.setLastBbDevTime(BigInteger.valueOf(beatTime.getTime() / 1000));
record.setLastHeartbeat(BigInteger.valueOf(System.currentTimeMillis() / 1000));
terminalStatusDao.updateByPrimaryKey(record);
}
}
}

Loading…
Cancel
Save