|
|
@@ -7,6 +7,7 @@ import com.github.microservice.net.ResultContent;
|
|
|
import com.github.microservice.net.ResultMessage;
|
|
|
import com.github.microservice.types.deviceUse.ThingType;
|
|
|
import com.zhongshu.iot.server.core.dao.iot.IotThing2DeviceDao;
|
|
|
+import com.zhongshu.iot.server.core.dao.iot.IotThingDao;
|
|
|
import com.zhongshu.iot.server.core.dao.mqtt.DeviceInfoDao;
|
|
|
import com.zhongshu.iot.server.core.domain.iot.IotThing;
|
|
|
import com.zhongshu.iot.server.core.domain.iot.IotThing2Device;
|
|
|
@@ -50,6 +51,9 @@ public class IotThing2DeviceService extends SuperService {
|
|
|
@Autowired
|
|
|
private IotThingService iotThingService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IotThingDao iotThingDao;
|
|
|
+
|
|
|
/**
|
|
|
* 绑定物模型和设备
|
|
|
*
|
|
|
@@ -95,11 +99,10 @@ public class IotThing2DeviceService extends SuperService {
|
|
|
if (ObjectUtils.isEmpty(param.getDeviceIds())) {
|
|
|
return ResultContent.buildFail("deviceIds不能为空");
|
|
|
}
|
|
|
- IotThing2Device entity = iotThing2DeviceDao.findTopById(id);
|
|
|
- if (ObjectUtils.isNotEmpty(entity)) {
|
|
|
+ IotThing iotThing = iotThingDao.findTopById(param.getId());
|
|
|
+ if (ObjectUtils.isEmpty(iotThing)) {
|
|
|
return ResultContent.buildFail(String.format(ResultMessage.DATA_NOT_EXIST, id));
|
|
|
}
|
|
|
- IotThing iotThing = entity.getIotThing();
|
|
|
if (ObjectUtils.isNotEmpty(iotThing)) {
|
|
|
if (iotThing.getThingType() == ThingType.Auto) {
|
|
|
return ResultContent.buildFail("不能绑定设备");
|