fix:插件上传、下行日志bug修复
parent
1fcf5035dc
commit
6361bb399c
|
@ -79,7 +79,7 @@
|
|||
<dependency>
|
||||
<groupId>org.jooq</groupId>
|
||||
<artifactId>jooq</artifactId>
|
||||
<version>3.14.15</version>Fv
|
||||
<version>3.14.15</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
|
@ -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不匹配");
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue