设备控制完善日志
parent
d4be7bbd5d
commit
29ba2bd5bb
|
|
@ -162,7 +162,7 @@ public class DeviceStatusHandler {
|
||||||
log.warn("【设备回执】prop包含多个功能码,仅处理第一个:{}", propObj.keySet());
|
log.warn("【设备回执】prop包含多个功能码,仅处理第一个:{}", propObj.keySet());
|
||||||
}
|
}
|
||||||
log.info("【设备回执】设备{}的{}功能执行完成,已释放锁:{},{}", deviceId, funcType, lockKey, delete);
|
log.info("【设备回执】设备{}的{}功能执行完成,已释放锁:{},{}", deviceId, funcType, lockKey, delete);
|
||||||
|
int runTime = 0;
|
||||||
// 回执成功且值=1时启动自动关闭任务(保留原有逻辑)
|
// 回执成功且值=1时启动自动关闭任务(保留原有逻辑)
|
||||||
boolean suc = payloadObj.getBooleanValue("suc");
|
boolean suc = payloadObj.getBooleanValue("suc");
|
||||||
if (suc && StringUtils.hasText(funcType) && funcValue != null && funcValue == 1) {
|
if (suc && StringUtils.hasText(funcType) && funcValue != null && funcValue == 1) {
|
||||||
|
|
@ -173,34 +173,32 @@ public class DeviceStatusHandler {
|
||||||
if (agriLimit != null) {
|
if (agriLimit != null) {
|
||||||
autoOffSeconds = LIMIT_MAP.getOrDefault(funcType, k -> 0).apply(agriLimit);
|
autoOffSeconds = LIMIT_MAP.getOrDefault(funcType, k -> 0).apply(agriLimit);
|
||||||
}
|
}
|
||||||
|
runTime = autoOffSeconds;
|
||||||
// 新增:判断是否真的需要执行自动关任务(延迟秒数>0才是有效任务)
|
// 新增:判断是否真的需要执行自动关任务(延迟秒数>0才是有效任务)
|
||||||
if (autoOffSeconds > 0) {
|
if (autoOffSeconds > 0) {
|
||||||
mqttAutoOffManager.scheduleAutoOff(deviceId, funcType, autoOffSeconds);
|
mqttAutoOffManager.scheduleAutoOff(deviceId, funcType, autoOffSeconds);
|
||||||
log.debug("【自动关任务】标记需要执行,deviceId={}, funcType={}, delay={}s", deviceId, funcType, autoOffSeconds);
|
log.debug("【自动关任务】标记需要执行,deviceId={}, funcType={}, delay={}s", deviceId, funcType, autoOffSeconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
sysDevOperLogService.lambdaUpdate()
|
|
||||||
.eq(SysDevOperLog::getImei, deviceId)
|
|
||||||
.eq(SysDevOperLog::getFuncCode, funcType)
|
|
||||||
.eq(SysDevOperLog::getOpType, funcValue)
|
|
||||||
.eq(SysDevOperLog::getLockAcquired,1)
|
|
||||||
.orderByDesc(SysDevOperLog::getCreateTime)
|
|
||||||
.last("LIMIT 1")
|
|
||||||
.set(SysDevOperLog::getExecResult,1)
|
|
||||||
.set(SysDevOperLog::getAckReceived,1)
|
|
||||||
.set(SysDevOperLog::getIsLockSuc,1)
|
|
||||||
.set(SysDevOperLog::getAckSuc, 1)
|
|
||||||
.set(SysDevOperLog::getUpdateBy,"设备回执")
|
|
||||||
.set(SysDevOperLog::getIsTask,autoOffSeconds > 0?1:0)
|
|
||||||
.set(SysDevOperLog::getNoTaskReason,autoOffSeconds > 0?null:"【自动关任务】标记不符合执行运行时间未配置,当前运行时间:【"+autoOffSeconds+"】")
|
|
||||||
.set(SysDevOperLog::getAck, payload)
|
|
||||||
.set(SysDevOperLog::getExecResult, 1)
|
|
||||||
.update();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (suc && StringUtils.hasText(funcType) && funcValue != null && funcValue == 0) {
|
if (suc && StringUtils.hasText(funcType) && funcValue != null && funcValue == 0) {
|
||||||
mqttAutoOffManager.cancelAutoOff(deviceId, funcType);
|
mqttAutoOffManager.cancelAutoOff(deviceId, funcType);
|
||||||
}
|
}
|
||||||
|
sysDevOperLogService.lambdaUpdate()
|
||||||
|
.eq(SysDevOperLog::getImei, deviceId)
|
||||||
|
.eq(SysDevOperLog::getFuncCode, funcType)
|
||||||
|
.eq(SysDevOperLog::getOpType, funcValue)
|
||||||
|
.eq(SysDevOperLog::getLockAcquired,1)
|
||||||
|
.orderByDesc(SysDevOperLog::getCreateTime)
|
||||||
|
.last("LIMIT 1")
|
||||||
|
.set(SysDevOperLog::getAckReceived,1)
|
||||||
|
.set(SysDevOperLog::getAckSuc, suc?1:0)
|
||||||
|
.set(SysDevOperLog::getIsLockSuc,delete?1:0)
|
||||||
|
.set(SysDevOperLog::getIsTask,runTime > 0?1:0)
|
||||||
|
.set(SysDevOperLog::getRunTime, runTime)
|
||||||
|
.set(SysDevOperLog::getNoTaskReason,runTime > 0?null:"【自动关任务】标记不符合执行运行时间未配置,当前运行时间:【"+runTime+" s】")
|
||||||
|
.set(SysDevOperLog::getUpdateBy,"设备回执")
|
||||||
|
.set(SysDevOperLog::getAck, payload)
|
||||||
|
.update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue