增加定时更新设备状态任务

This commit is contained in:
kerwincui
2025-03-26 17:50:29 +08:00
parent 38e236a8ff
commit 18568aa663
8 changed files with 129 additions and 8 deletions

View File

@@ -2,15 +2,8 @@ package com.fastbee.iot.mapper;
import com.fastbee.common.core.thingsModel.ThingsModelValuesInput;
import com.fastbee.iot.domain.Device;
import com.fastbee.iot.model.AuthenticateInputModel;
import com.fastbee.iot.model.DeviceAllShortOutput;
import com.fastbee.iot.model.DeviceMqttVO;
import com.fastbee.iot.model.DeviceRelateAlertLogVO;
import com.fastbee.iot.model.DeviceShortOutput;
import com.fastbee.iot.model.DeviceStatistic;
import com.fastbee.iot.model.ProductAuthenticateModel;
import com.fastbee.iot.model.*;
import com.fastbee.iot.model.ThingsModels.ThingsModelValuesOutput;
import com.fastbee.iot.model.UserIdDeviceIdModel;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
@@ -249,6 +242,12 @@ public interface DeviceMapper
*/
public List<Device> selectDevicesByProductId(@Param("productId") Long productId,@Param("hasSub") Integer hasSub);
/**
* 获取所有已经激活并不是禁用的设备
* @return
*/
List<DeviceStatusVO> selectDeviceActive();
/**
* 查询子设备总数
* @param gwDevCode 网关编号

View File

@@ -0,0 +1,26 @@
package com.fastbee.iot.model;
import lombok.Data;
/**
* 设备状态
* @author gsb
* @date 2024/4/11 10:39
*/
@Data
public class DeviceStatusVO {
private String serialNumber;
private Integer status;
private String transport;
private Long productId;
private Integer deviceType;
private Integer rssi;
private Integer isShadow;
}

View File

@@ -227,6 +227,12 @@ public interface IDeviceService
*/
public List<Device> selectDevicesByProductId(Long productId,Integer hasSub);
/**
* 获取所有已经激活并不是禁用的设备
* @return
*/
List<DeviceStatusVO> selectDeviceActive();
/**
* 查询子设备总数
* @param gwDevCode 网关编号

View File

@@ -1082,6 +1082,16 @@ public class DeviceServiceImpl implements IDeviceService {
return deviceMapper.selectDevicesByProductId(productId, hasSub);
}
/**
* 获取所有已经激活并不是禁用的设备
*
* @return
*/
@Override
public List<DeviceStatusVO> selectDeviceActive() {
return deviceMapper.selectDeviceActive();
}
/**
* 查询子设备总数
*

View File

@@ -565,6 +565,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectDeviceActive" resultType="com.fastbee.iot.model.DeviceStatusVO">
select d.status , d.serial_number as serialNumber, d.rssi,d.is_shadow, d.product_id
from iot_device d inner join iot_product p on d.product_id = p.product_id
where d.status in (3,4) and p.transport not in ('GB28181')
and d.del_flag = '0' and p.del_flag = '0'
</select>
<select id="getSubDeviceCount" resultType="java.lang.Integer">
select count(*) from iot_device d where d.gw_dev_code = #{gwDevCode,jdbcType=VARCHAR}
</select>