feat:在线查询、注册消息缺少时间等修复
parent
720901e9eb
commit
f0c4b175f7
|
@ -68,13 +68,13 @@ public interface IDeviceInfoData extends IOwnedData<DeviceInfo, String> {
|
||||||
* @param subUid 子账号id
|
* @param subUid 子账号id
|
||||||
* @param productKey 产品key
|
* @param productKey 产品key
|
||||||
* @param groupId 设备分组
|
* @param groupId 设备分组
|
||||||
* @param state 是否在线:online在线,offline离线
|
* @param online 是否在线:true在线,false离线
|
||||||
* @param keyword 关键字
|
* @param keyword 关键字
|
||||||
* @param page 页码
|
* @param page 页码
|
||||||
* @param size 分页大小
|
* @param size 分页大小
|
||||||
*/
|
*/
|
||||||
Paging<DeviceInfo> findByConditions(String uid, String subUid, String productKey,
|
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);
|
int page, int size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -148,7 +148,7 @@ public class DeviceInfoDataCache implements IDeviceInfoData, SmartInitializingSi
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Paging<DeviceInfo> findByConditions(String uid, String subUid, String productKey,
|
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);
|
return deviceInfoData.findByConditions(uid, subUid, productKey, groupId, state, keyword, page, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -128,8 +128,8 @@ public class DeviceInfoPropertyDataCache implements IDeviceInfoData {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Paging<DeviceInfo> findByConditions(String uid, String subUid, String productKey, String groupId, String state, String keyword, int page, int 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, state, keyword, page, size);
|
return deviceInfoData.findByConditions(uid, subUid, productKey, groupId, online, keyword, page, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -207,7 +207,7 @@ public class DeviceInfoDataImpl implements IDeviceInfoData, IJPACommData<DeviceI
|
||||||
@Override
|
@Override
|
||||||
public Paging<DeviceInfo> findByConditions(String uid, String subUid,
|
public Paging<DeviceInfo> findByConditions(String uid, String subUid,
|
||||||
String productKey, String groupId,
|
String productKey, String groupId,
|
||||||
String state, String keyword,
|
Boolean online, String keyword,
|
||||||
int page, int size) {
|
int page, int size) {
|
||||||
JPAQuery<TbDeviceInfo> query = jpaQueryFactory.selectFrom(tbDeviceInfo);
|
JPAQuery<TbDeviceInfo> query = jpaQueryFactory.selectFrom(tbDeviceInfo);
|
||||||
|
|
||||||
|
@ -230,8 +230,8 @@ public class DeviceInfoDataImpl implements IDeviceInfoData, IJPACommData<DeviceI
|
||||||
query.where(tbDeviceInfo.productKey.eq(productKey));
|
query.where(tbDeviceInfo.productKey.eq(productKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(state)) {
|
if (online != null) {
|
||||||
query.where(tbDeviceInfo.state.eq(state));
|
query.where(tbDeviceInfo.state.eq(online ? "online" : "offline"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(keyword)) {
|
if (StringUtils.isNotBlank(keyword)) {
|
||||||
|
@ -384,7 +384,7 @@ public class DeviceInfoDataImpl implements IDeviceInfoData, IJPACommData<DeviceI
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DeviceInfo> findByIds(Collection<String> ids) {
|
public List<DeviceInfo> findByIds(Collection<String> ids) {
|
||||||
return MapstructUtils.convert(deviceInfoRepository.findAllById(ids),DeviceInfo.class);
|
return MapstructUtils.convert(deviceInfoRepository.findAllById(ids), DeviceInfo.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -23,7 +23,6 @@ import lombok.EqualsAndHashCode;
|
||||||
@ApiModel(value = "DeviceQueryBo")
|
@ApiModel(value = "DeviceQueryBo")
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@AutoMapper(target = DeviceInfo.class, reverseConvertGenerate = false)
|
|
||||||
public class DeviceQueryBo extends BaseDto {
|
public class DeviceQueryBo extends BaseDto {
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,7 +59,7 @@ public class DeviceQueryBo extends BaseDto {
|
||||||
@Size(max = 255, message = "设备状态长度不正确")
|
@Size(max = 255, message = "设备状态长度不正确")
|
||||||
@AutoMapping(ignore = true)
|
@AutoMapping(ignore = true)
|
||||||
@ReverseAutoMapping(ignore = true)
|
@ReverseAutoMapping(ignore = true)
|
||||||
private String state;
|
private Boolean online;
|
||||||
|
|
||||||
@ApiModelProperty(value="用户id")
|
@ApiModelProperty(value="用户id")
|
||||||
@Size(max = 255, message = "用户id长度不正确")
|
@Size(max = 255, message = "用户id长度不正确")
|
||||||
|
|
|
@ -93,10 +93,10 @@ public class DeviceManagerServiceImpl implements IDeviceManagerService {
|
||||||
//关键字查询
|
//关键字查询
|
||||||
String keyword = query.getKeyword();
|
String keyword = query.getKeyword();
|
||||||
String group = query.getGroup();
|
String group = query.getGroup();
|
||||||
String state = query.getState();
|
Boolean online = query.getOnline();
|
||||||
|
|
||||||
Paging<DeviceInfoVo> result = MapstructUtils.convert(deviceInfoData.findByConditions(uid, subUid, pk, group,
|
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()) {
|
for (DeviceInfoVo row : result.getRows()) {
|
||||||
row.setProduct(productData.findByProductKey(row.getProductKey()));
|
row.setProduct(productData.findByProductKey(row.getProductKey()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -222,6 +222,7 @@ public class ThingServiceImpl implements IThingService {
|
||||||
ThingModelMessage.builder()
|
ThingModelMessage.builder()
|
||||||
.type(ThingModelMessage.TYPE_LIFETIME)
|
.type(ThingModelMessage.TYPE_LIFETIME)
|
||||||
.identifier("register")
|
.identifier("register")
|
||||||
|
.time(System.currentTimeMillis())
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
return deviceInfo.getDeviceId();
|
return deviceInfo.getDeviceId();
|
||||||
|
@ -273,6 +274,7 @@ public class ThingServiceImpl implements IThingService {
|
||||||
ThingModelMessage.builder()
|
ThingModelMessage.builder()
|
||||||
.type(ThingModelMessage.TYPE_STATE)
|
.type(ThingModelMessage.TYPE_STATE)
|
||||||
.identifier(action.getState().getState())
|
.identifier(action.getState().getState())
|
||||||
|
.time(System.currentTimeMillis())
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class RuleDeviceConsumer implements ConsumerHandler<ThingModelMessage>, A
|
||||||
@Override
|
@Override
|
||||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||||
Map<String, DeviceMessageHandler> handlerMap = applicationContext.getBeansOfType(DeviceMessageHandler.class);
|
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());
|
this.handlers.addAll(handlerMap.values());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,10 +40,10 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!--打开注释使用rocketmq消息总线-->
|
<!--打开注释使用rocketmq消息总线-->
|
||||||
<!-- <dependency>-->
|
<!-- <dependency>-->
|
||||||
<!-- <groupId>cc.iotkit</groupId>-->
|
<!-- <groupId>cc.iotkit</groupId>-->
|
||||||
<!-- <artifactId>iot-message-rocketmq</artifactId>-->
|
<!-- <artifactId>iot-message-rocketmq</artifactId>-->
|
||||||
<!-- </dependency>-->
|
<!-- </dependency>-->
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cc.iotkit</groupId>
|
<groupId>cc.iotkit</groupId>
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
<!-- 将assemblies/bin目录下的所有文件输出到打包后的bin目录中 -->
|
<!-- 将assemblies/bin目录下的所有文件输出到打包后的bin目录中 -->
|
||||||
<fileSet>
|
<fileSet>
|
||||||
<directory>${project.parent.basedir}/iot-starter/src/main/bin</directory>
|
<directory>${project.parent.basedir}/iot-starter/src/main/bin</directory>
|
||||||
<outputDirectory>/bin</outputDirectory>
|
<outputDirectory>${project.name}/bin</outputDirectory>
|
||||||
<includes>
|
<includes>
|
||||||
<include>**/*.bat</include>
|
<include>**/*.bat</include>
|
||||||
<include>**/*.sh</include>
|
<include>**/*.sh</include>
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
<!-- 将/iot-standalone/src/main/resources下配置文件打包到config目录 -->
|
<!-- 将/iot-standalone/src/main/resources下配置文件打包到config目录 -->
|
||||||
<fileSet>
|
<fileSet>
|
||||||
<directory>${project.parent.basedir}/iot-starter/src/main/resources</directory>
|
<directory>${project.parent.basedir}/iot-starter/src/main/resources</directory>
|
||||||
<outputDirectory>/config</outputDirectory>
|
<outputDirectory>${project.name}/config</outputDirectory>
|
||||||
<includes>
|
<includes>
|
||||||
<include>**/*.xml</include>
|
<include>**/*.xml</include>
|
||||||
<include>**/*.properties</include>
|
<include>**/*.properties</include>
|
||||||
|
@ -42,7 +42,7 @@
|
||||||
<!-- 将项目启动jar打包到lib目录中 -->
|
<!-- 将项目启动jar打包到lib目录中 -->
|
||||||
<fileSet>
|
<fileSet>
|
||||||
<directory>target</directory>
|
<directory>target</directory>
|
||||||
<outputDirectory>lib</outputDirectory>
|
<outputDirectory>${project.name}/lib</outputDirectory>
|
||||||
<includes>
|
<includes>
|
||||||
<include>*.jar</include>
|
<include>*.jar</include>
|
||||||
</includes>
|
</includes>
|
||||||
|
@ -51,7 +51,7 @@
|
||||||
<!-- 将项目说明文档打包到docs目录中 -->
|
<!-- 将项目说明文档打包到docs目录中 -->
|
||||||
<fileSet>
|
<fileSet>
|
||||||
<directory>${project.parent.basedir}</directory>
|
<directory>${project.parent.basedir}</directory>
|
||||||
<outputDirectory>docs</outputDirectory>
|
<outputDirectory>${project.name}/docs</outputDirectory>
|
||||||
<includes>
|
<includes>
|
||||||
<include>*.md</include>
|
<include>*.md</include>
|
||||||
</includes>
|
</includes>
|
||||||
|
@ -59,23 +59,9 @@
|
||||||
</fileSet>
|
</fileSet>
|
||||||
|
|
||||||
<!--将初始化数据打包到data目录-->
|
<!--将初始化数据打包到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>
|
<fileSet>
|
||||||
<directory>${project.parent.basedir}/data/init</directory>
|
<directory>${project.parent.basedir}/data/init</directory>
|
||||||
<outputDirectory>data/init</outputDirectory>
|
<outputDirectory>${project.name}/data/init</outputDirectory>
|
||||||
<includes>
|
<includes>
|
||||||
<include>**/*</include>
|
<include>**/*</include>
|
||||||
</includes>
|
</includes>
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>11</java.version>
|
<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>
|
<spring-boot.version>2.7.11</spring-boot.version>
|
||||||
<vertx.version>4.2.2</vertx.version>
|
<vertx.version>4.2.2</vertx.version>
|
||||||
<satoken.version>1.34.0</satoken.version>
|
<satoken.version>1.34.0</satoken.version>
|
||||||
|
|
Loading…
Reference in New Issue