|
|
@@ -85,6 +85,9 @@ public class IotServiceImpl extends SuperService {
|
|
|
@Autowired
|
|
|
private IotDeviceDataService iotDeviceDataService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IotThing2DeviceService iotThing2DeviceService;
|
|
|
+
|
|
|
//----------------------------- 产品 start----------------------------
|
|
|
|
|
|
/**
|
|
|
@@ -414,10 +417,19 @@ public class IotServiceImpl extends SuperService {
|
|
|
if (iotThing == null) {
|
|
|
return ResultContent.buildFail(String.format("物模型不存在:%s", param.getIotThingId()));
|
|
|
}
|
|
|
+
|
|
|
aboutDataId = param.getIotThingId();
|
|
|
if (iotThing.getThingType() == ThingType.Auto) {
|
|
|
deviceInfo = deviceInfoDao.findTopByDeviceId(iotThing.getDeviceId());
|
|
|
} else if (iotThing.getThingType() == ThingType.Manual) {
|
|
|
+ //手动创建 找出一个设备
|
|
|
+ if (StringUtils.isEmpty(param.getDeviceId())) {
|
|
|
+ ResultContent<String> resultContent = iotThing2DeviceService.getIotFirstDevice(param.getIotThingId());
|
|
|
+ if (resultContent.isFailed()) {
|
|
|
+ return ResultContent.buildFail(resultContent.getMsg());
|
|
|
+ }
|
|
|
+ param.setDeviceId(resultContent.getContent());
|
|
|
+ }
|
|
|
if (StringUtils.isEmpty(param.getDeviceId())) {
|
|
|
return ResultContent.buildFail("手动创建的物模型deviceId不能为空");
|
|
|
}
|