From 6361bb399ca04a3567408f13ecff4af7c7c0412f Mon Sep 17 00:00:00 2001 From: xiwa Date: Wed, 14 Feb 2024 15:19:09 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E6=8F=92=E4=BB=B6=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E3=80=81=E4=B8=8B=E8=A1=8C=E6=97=A5=E5=BF=97bug=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- iot-dao/iot-temporal-serviceImpl-ts/pom.xml | 2 +- .../manager/service/impl/PluginServiceImpl.java | 2 +- .../java/cc/iotkit/plugin/main/PluginMainImpl.java | 13 +++++++++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/iot-dao/iot-temporal-serviceImpl-ts/pom.xml b/iot-dao/iot-temporal-serviceImpl-ts/pom.xml index d50b97d1..48930d9a 100644 --- a/iot-dao/iot-temporal-serviceImpl-ts/pom.xml +++ b/iot-dao/iot-temporal-serviceImpl-ts/pom.xml @@ -79,7 +79,7 @@ org.jooq jooq - 3.14.15Fv + 3.14.15 diff --git a/iot-module/iot-manager/src/main/java/cc/iotkit/manager/service/impl/PluginServiceImpl.java b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/service/impl/PluginServiceImpl.java index b95ebaf1..5e8b68c9 100644 --- a/iot-module/iot-manager/src/main/java/cc/iotkit/manager/service/impl/PluginServiceImpl.java +++ b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/service/impl/PluginServiceImpl.java @@ -54,7 +54,7 @@ public class PluginServiceImpl implements IPluginService { } String pluginId = plugin.getPluginId(); - if (!file.getName().contains(pluginId)) { + if (pluginId!=null && !file.getOriginalFilename().contains(pluginId)) { throw new BizException(ErrCode.PLUGIN_INSTALL_FAILED, "文件名与原插件id不匹配"); } diff --git a/iot-module/iot-plugin/iot-plugin-main/src/main/java/cc/iotkit/plugin/main/PluginMainImpl.java b/iot-module/iot-plugin/iot-plugin-main/src/main/java/cc/iotkit/plugin/main/PluginMainImpl.java index cdd58a7a..2f488c93 100644 --- a/iot-module/iot-plugin/iot-plugin-main/src/main/java/cc/iotkit/plugin/main/PluginMainImpl.java +++ b/iot-module/iot-plugin/iot-plugin-main/src/main/java/cc/iotkit/plugin/main/PluginMainImpl.java @@ -32,6 +32,7 @@ import org.springframework.web.bind.annotation.RequestBody; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.UUID; /** * 插件主程序接口服务 @@ -123,7 +124,7 @@ public class PluginMainImpl implements IPluginMain, DeviceService { .build(); //调用插件设备服务接口 result = deviceService.serviceInvoke(action); - publish(service, result.getCode()); + publish(service, deviceInfo.getDeviceId(), result.getCode()); } else if (ThingService.TYPE_PROPERTY.equals(type)) { if ("set".equals(identifier)) { if (!(service.getParams() instanceof Map)) { @@ -139,7 +140,7 @@ public class PluginMainImpl implements IPluginMain, DeviceService { .build(); //调用插件设备服务接口 result = deviceService.propertySet(action); - publish(service, result.getCode()); + publish(service, deviceInfo.getDeviceId(), result.getCode()); } else if ("get".equals(identifier)) { //属性获取 PropertyGet action = PropertyGet.builder() @@ -150,7 +151,7 @@ public class PluginMainImpl implements IPluginMain, DeviceService { .build(); //调用插件设备服务接口 result = deviceService.propertyGet(action); - publish(service, result.getCode()); + publish(service, deviceInfo.getDeviceId(), result.getCode()); } } @@ -159,9 +160,11 @@ public class PluginMainImpl implements IPluginMain, DeviceService { } } - private void publish(ThingService service, int code) { + private void publish(ThingService service, String deviceId, int code) { //产生下发消息作为下行日志保存 ThingModelMessage message = ThingModelMessage.builder() + .id(UUID.randomUUID().toString()) + .deviceId(deviceId) .mid(service.getMid()) .productKey(service.getProductKey()) .deviceName(service.getDeviceName()) @@ -169,6 +172,8 @@ public class PluginMainImpl implements IPluginMain, DeviceService { .type(service.getType()) .data(service.getParams()) .code(code) + .occurred(System.currentTimeMillis()) + .time(System.currentTimeMillis()) .build(); producer.publish(Constants.THING_MODEL_MESSAGE_TOPIC, message);