From f0c4b175f7f1b886ab2c16728ec196d96257e5d1 Mon Sep 17 00:00:00 2001 From: xiwa Date: Sun, 3 Mar 2024 12:41:54 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=9C=A8=E7=BA=BF=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E3=80=81=E6=B3=A8=E5=86=8C=E6=B6=88=E6=81=AF=E7=BC=BA=E5=B0=91?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E7=AD=89=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iotkit/data/manager/IDeviceInfoData.java | 4 ++-- .../data/service/DeviceInfoDataCache.java | 2 +- .../service/DeviceInfoPropertyDataCache.java | 4 ++-- .../data/service/DeviceInfoDataImpl.java | 8 +++---- .../manager/dto/bo/device/DeviceQueryBo.java | 3 +-- .../impl/DeviceManagerServiceImpl.java | 4 ++-- .../iotkit/plugin/main/ThingServiceImpl.java | 2 ++ .../handler/RuleDeviceConsumer.java | 2 +- iot-starter/pom.xml | 8 +++---- .../assemblies/standalone-package.xml | 24 ++++--------------- pom.xml | 2 +- 11 files changed, 25 insertions(+), 38 deletions(-) diff --git a/iot-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IDeviceInfoData.java b/iot-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IDeviceInfoData.java index 6d8ca302..0f68f07d 100644 --- a/iot-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IDeviceInfoData.java +++ b/iot-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IDeviceInfoData.java @@ -68,13 +68,13 @@ public interface IDeviceInfoData extends IOwnedData { * @param subUid 子账号id * @param productKey 产品key * @param groupId 设备分组 - * @param state 是否在线:online在线,offline离线 + * @param online 是否在线:true在线,false离线 * @param keyword 关键字 * @param page 页码 * @param size 分页大小 */ Paging findByConditions(String uid, String subUid, String productKey, - String groupId, String state, String keyword, + String groupId, Boolean online, String keyword, int page, int size); /** diff --git a/iot-dao/iot-data-serviceImpl-cache/src/main/java/cc/iotkit/data/service/DeviceInfoDataCache.java b/iot-dao/iot-data-serviceImpl-cache/src/main/java/cc/iotkit/data/service/DeviceInfoDataCache.java index d86644f3..1a0c0160 100644 --- a/iot-dao/iot-data-serviceImpl-cache/src/main/java/cc/iotkit/data/service/DeviceInfoDataCache.java +++ b/iot-dao/iot-data-serviceImpl-cache/src/main/java/cc/iotkit/data/service/DeviceInfoDataCache.java @@ -148,7 +148,7 @@ public class DeviceInfoDataCache implements IDeviceInfoData, SmartInitializingSi @Override public Paging 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); } diff --git a/iot-dao/iot-data-serviceImpl-cache/src/main/java/cc/iotkit/data/service/DeviceInfoPropertyDataCache.java b/iot-dao/iot-data-serviceImpl-cache/src/main/java/cc/iotkit/data/service/DeviceInfoPropertyDataCache.java index 86e0a6a9..68cdd2f3 100644 --- a/iot-dao/iot-data-serviceImpl-cache/src/main/java/cc/iotkit/data/service/DeviceInfoPropertyDataCache.java +++ b/iot-dao/iot-data-serviceImpl-cache/src/main/java/cc/iotkit/data/service/DeviceInfoPropertyDataCache.java @@ -128,8 +128,8 @@ public class DeviceInfoPropertyDataCache implements IDeviceInfoData { } @Override - public Paging 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 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 diff --git a/iot-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/service/DeviceInfoDataImpl.java b/iot-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/service/DeviceInfoDataImpl.java index 344395fe..1e7368dc 100644 --- a/iot-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/service/DeviceInfoDataImpl.java +++ b/iot-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/service/DeviceInfoDataImpl.java @@ -207,7 +207,7 @@ public class DeviceInfoDataImpl implements IDeviceInfoData, IJPACommData findByConditions(String uid, String subUid, String productKey, String groupId, - String state, String keyword, + Boolean online, String keyword, int page, int size) { JPAQuery query = jpaQueryFactory.selectFrom(tbDeviceInfo); @@ -230,8 +230,8 @@ public class DeviceInfoDataImpl implements IDeviceInfoData, IJPACommData findByIds(Collection ids) { - return MapstructUtils.convert(deviceInfoRepository.findAllById(ids),DeviceInfo.class); + return MapstructUtils.convert(deviceInfoRepository.findAllById(ids), DeviceInfo.class); } @Override diff --git a/iot-module/iot-manager/src/main/java/cc/iotkit/manager/dto/bo/device/DeviceQueryBo.java b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/dto/bo/device/DeviceQueryBo.java index 8c7d841b..570e74d6 100644 --- a/iot-module/iot-manager/src/main/java/cc/iotkit/manager/dto/bo/device/DeviceQueryBo.java +++ b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/dto/bo/device/DeviceQueryBo.java @@ -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长度不正确") diff --git a/iot-module/iot-manager/src/main/java/cc/iotkit/manager/service/impl/DeviceManagerServiceImpl.java b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/service/impl/DeviceManagerServiceImpl.java index f936229a..7d615f5d 100644 --- a/iot-module/iot-manager/src/main/java/cc/iotkit/manager/service/impl/DeviceManagerServiceImpl.java +++ b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/service/impl/DeviceManagerServiceImpl.java @@ -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 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())); } diff --git a/iot-module/iot-plugin/iot-plugin-main/src/main/java/cc/iotkit/plugin/main/ThingServiceImpl.java b/iot-module/iot-plugin/iot-plugin-main/src/main/java/cc/iotkit/plugin/main/ThingServiceImpl.java index 0152cfc6..17200397 100644 --- a/iot-module/iot-plugin/iot-plugin-main/src/main/java/cc/iotkit/plugin/main/ThingServiceImpl.java +++ b/iot-module/iot-plugin/iot-plugin-main/src/main/java/cc/iotkit/plugin/main/ThingServiceImpl.java @@ -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() ); } diff --git a/iot-module/iot-rule-engine/src/main/java/cc/iotkit/ruleengine/handler/RuleDeviceConsumer.java b/iot-module/iot-rule-engine/src/main/java/cc/iotkit/ruleengine/handler/RuleDeviceConsumer.java index 1b3539eb..bc5c52bc 100644 --- a/iot-module/iot-rule-engine/src/main/java/cc/iotkit/ruleengine/handler/RuleDeviceConsumer.java +++ b/iot-module/iot-rule-engine/src/main/java/cc/iotkit/ruleengine/handler/RuleDeviceConsumer.java @@ -42,7 +42,7 @@ public class RuleDeviceConsumer implements ConsumerHandler, A @Override public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { Map handlerMap = applicationContext.getBeansOfType(DeviceMessageHandler.class); - messageHandlerPool = ThreadUtil.newScheduled(handlerMap.size(), "messageHandler"); + messageHandlerPool = ThreadUtil.newScheduled(handlerMap.size() * 2, "messageHandler"); this.handlers.addAll(handlerMap.values()); } diff --git a/iot-starter/pom.xml b/iot-starter/pom.xml index 9d72defb..36baa00a 100644 --- a/iot-starter/pom.xml +++ b/iot-starter/pom.xml @@ -40,10 +40,10 @@ - - - - + + + + cc.iotkit diff --git a/iot-starter/src/main/resources/assemblies/standalone-package.xml b/iot-starter/src/main/resources/assemblies/standalone-package.xml index baf05812..4e0e585d 100644 --- a/iot-starter/src/main/resources/assemblies/standalone-package.xml +++ b/iot-starter/src/main/resources/assemblies/standalone-package.xml @@ -16,7 +16,7 @@ ${project.parent.basedir}/iot-starter/src/main/bin - /bin + ${project.name}/bin **/*.bat **/*.sh @@ -30,7 +30,7 @@ ${project.parent.basedir}/iot-starter/src/main/resources - /config + ${project.name}/config **/*.xml **/*.properties @@ -42,7 +42,7 @@ target - lib + ${project.name}/lib *.jar @@ -51,7 +51,7 @@ ${project.parent.basedir} - docs + ${project.name}/docs *.md @@ -59,23 +59,9 @@ - - ${project.parent.basedir}/data/components - data/components - - **/* - - - - ${project.parent.basedir}/data/converters - data/converters - - **/* - - ${project.parent.basedir}/data/init - data/init + ${project.name}/data/init **/* diff --git a/pom.xml b/pom.xml index cdb032fe..89edc5d2 100755 --- a/pom.xml +++ b/pom.xml @@ -29,7 +29,7 @@ 11 - 1.0.3 + 1.0.4 2.7.11 4.2.2 1.34.0