feat:在线查询、注册消息缺少时间等修复

V0.5.x
xiwa 2024-03-03 12:41:54 +08:00
parent 720901e9eb
commit f0c4b175f7
11 changed files with 25 additions and 38 deletions

View File

@ -68,13 +68,13 @@ public interface IDeviceInfoData extends IOwnedData<DeviceInfo, String> {
* @param subUid id
* @param productKey key
* @param groupId
* @param state 线:online线,offline线
* @param online 线:true线,false线
* @param keyword
* @param page
* @param size
*/
Paging<DeviceInfo> findByConditions(String uid, String subUid, String productKey,
String groupId, String state, String keyword,
String groupId, Boolean online, String keyword,
int page, int size);
/**

View File

@ -148,7 +148,7 @@ public class DeviceInfoDataCache implements IDeviceInfoData, SmartInitializingSi
@Override
public Paging<DeviceInfo> findByConditions(String uid, String subUid, String productKey,
String groupId, String state, String keyword, int page, int size) {
String groupId, Boolean state, String keyword, int page, int size) {
return deviceInfoData.findByConditions(uid, subUid, productKey, groupId, state, keyword, page, size);
}

View File

@ -128,8 +128,8 @@ public class DeviceInfoPropertyDataCache implements IDeviceInfoData {
}
@Override
public Paging<DeviceInfo> findByConditions(String uid, String subUid, String productKey, String groupId, String state, String keyword, int page, int size) {
return deviceInfoData.findByConditions(uid, subUid, productKey, groupId, state, keyword, page, size);
public Paging<DeviceInfo> findByConditions(String uid, String subUid, String productKey, String groupId, Boolean online, String keyword, int page, int size) {
return deviceInfoData.findByConditions(uid, subUid, productKey, groupId, online, keyword, page, size);
}
@Override

View File

@ -207,7 +207,7 @@ public class DeviceInfoDataImpl implements IDeviceInfoData, IJPACommData<DeviceI
@Override
public Paging<DeviceInfo> findByConditions(String uid, String subUid,
String productKey, String groupId,
String state, String keyword,
Boolean online, String keyword,
int page, int size) {
JPAQuery<TbDeviceInfo> query = jpaQueryFactory.selectFrom(tbDeviceInfo);
@ -230,8 +230,8 @@ public class DeviceInfoDataImpl implements IDeviceInfoData, IJPACommData<DeviceI
query.where(tbDeviceInfo.productKey.eq(productKey));
}
if (StringUtils.isNotBlank(state)) {
query.where(tbDeviceInfo.state.eq(state));
if (online != null) {
query.where(tbDeviceInfo.state.eq(online ? "online" : "offline"));
}
if (StringUtils.isNotBlank(keyword)) {

View File

@ -23,7 +23,6 @@ import lombok.EqualsAndHashCode;
@ApiModel(value = "DeviceQueryBo")
@Data
@EqualsAndHashCode(callSuper = true)
@AutoMapper(target = DeviceInfo.class, reverseConvertGenerate = false)
public class DeviceQueryBo extends BaseDto {
@ -60,7 +59,7 @@ public class DeviceQueryBo extends BaseDto {
@Size(max = 255, message = "设备状态长度不正确")
@AutoMapping(ignore = true)
@ReverseAutoMapping(ignore = true)
private String state;
private Boolean online;
@ApiModelProperty(value="用户id")
@Size(max = 255, message = "用户id长度不正确")

View File

@ -93,10 +93,10 @@ public class DeviceManagerServiceImpl implements IDeviceManagerService {
//关键字查询
String keyword = query.getKeyword();
String group = query.getGroup();
String state = query.getState();
Boolean online = query.getOnline();
Paging<DeviceInfoVo> result = MapstructUtils.convert(deviceInfoData.findByConditions(uid, subUid, pk, group,
state, keyword, pageRequest.getPageNum(), pageRequest.getPageSize()), DeviceInfoVo.class);
online, keyword, pageRequest.getPageNum(), pageRequest.getPageSize()), DeviceInfoVo.class);
for (DeviceInfoVo row : result.getRows()) {
row.setProduct(productData.findByProductKey(row.getProductKey()));
}

View File

@ -222,6 +222,7 @@ public class ThingServiceImpl implements IThingService {
ThingModelMessage.builder()
.type(ThingModelMessage.TYPE_LIFETIME)
.identifier("register")
.time(System.currentTimeMillis())
.build()
);
return deviceInfo.getDeviceId();
@ -273,6 +274,7 @@ public class ThingServiceImpl implements IThingService {
ThingModelMessage.builder()
.type(ThingModelMessage.TYPE_STATE)
.identifier(action.getState().getState())
.time(System.currentTimeMillis())
.build()
);
}

View File

@ -42,7 +42,7 @@ public class RuleDeviceConsumer implements ConsumerHandler<ThingModelMessage>, A
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
Map<String, DeviceMessageHandler> handlerMap = applicationContext.getBeansOfType(DeviceMessageHandler.class);
messageHandlerPool = ThreadUtil.newScheduled(handlerMap.size(), "messageHandler");
messageHandlerPool = ThreadUtil.newScheduled(handlerMap.size() * 2, "messageHandler");
this.handlers.addAll(handlerMap.values());
}

View File

@ -16,7 +16,7 @@
<!-- 将assemblies/bin目录下的所有文件输出到打包后的bin目录中 -->
<fileSet>
<directory>${project.parent.basedir}/iot-starter/src/main/bin</directory>
<outputDirectory>/bin</outputDirectory>
<outputDirectory>${project.name}/bin</outputDirectory>
<includes>
<include>**/*.bat</include>
<include>**/*.sh</include>
@ -30,7 +30,7 @@
<!-- 将/iot-standalone/src/main/resources下配置文件打包到config目录 -->
<fileSet>
<directory>${project.parent.basedir}/iot-starter/src/main/resources</directory>
<outputDirectory>/config</outputDirectory>
<outputDirectory>${project.name}/config</outputDirectory>
<includes>
<include>**/*.xml</include>
<include>**/*.properties</include>
@ -42,7 +42,7 @@
<!-- 将项目启动jar打包到lib目录中 -->
<fileSet>
<directory>target</directory>
<outputDirectory>lib</outputDirectory>
<outputDirectory>${project.name}/lib</outputDirectory>
<includes>
<include>*.jar</include>
</includes>
@ -51,7 +51,7 @@
<!-- 将项目说明文档打包到docs目录中 -->
<fileSet>
<directory>${project.parent.basedir}</directory>
<outputDirectory>docs</outputDirectory>
<outputDirectory>${project.name}/docs</outputDirectory>
<includes>
<include>*.md</include>
</includes>
@ -59,23 +59,9 @@
</fileSet>
<!--将初始化数据打包到data目录-->
<fileSet>
<directory>${project.parent.basedir}/data/components</directory>
<outputDirectory>data/components</outputDirectory>
<includes>
<include>**/*</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.parent.basedir}/data/converters</directory>
<outputDirectory>data/converters</outputDirectory>
<includes>
<include>**/*</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.parent.basedir}/data/init</directory>
<outputDirectory>data/init</outputDirectory>
<outputDirectory>${project.name}/data/init</outputDirectory>
<includes>
<include>**/*</include>
</includes>

View File

@ -29,7 +29,7 @@
<properties>
<java.version>11</java.version>
<iot-iita-core.version>1.0.3</iot-iita-core.version>
<iot-iita-core.version>1.0.4</iot-iita-core.version>
<spring-boot.version>2.7.11</spring-boot.version>
<vertx.version>4.2.2</vertx.version>
<satoken.version>1.34.0</satoken.version>