|
|
@@ -3,6 +3,7 @@ package com.zhongshu.iot.server.core.service.iot;
|
|
|
import com.github.microservice.busInfoModel.device.IotTemplateSimpleModel;
|
|
|
import com.github.microservice.models.baseParam.NameModel;
|
|
|
import com.github.microservice.net.ResultContent;
|
|
|
+import com.github.microservice.net.ResultMessage;
|
|
|
import com.github.microservice.types.FunctionType;
|
|
|
import com.github.microservice.types.deviceUse.DeviceCategory;
|
|
|
import com.github.microservice.types.deviceUse.DeviceSpecType;
|
|
|
@@ -16,7 +17,6 @@ import com.zhongshu.iot.server.core.dao.iot.IotThingDao;
|
|
|
import com.zhongshu.iot.server.core.dao.iot.IotTopicDao;
|
|
|
import com.zhongshu.iot.server.core.dao.mqtt.DeviceInfoDao;
|
|
|
import com.zhongshu.iot.server.core.dao.mqtt.GateWay2DeviceDao;
|
|
|
-import com.zhongshu.iot.server.core.dataConfig.ResultMessage;
|
|
|
import com.zhongshu.iot.server.core.domain.iot.IotMain;
|
|
|
import com.zhongshu.iot.server.core.domain.iot.IotTemplate;
|
|
|
import com.zhongshu.iot.server.core.domain.iot.IotThing;
|
|
|
@@ -109,7 +109,7 @@ public class IotServiceImpl extends SuperService {
|
|
|
return ResultContent.buildFail(String.format(ResultMessage.DATA_NOT_EXIST, param.getId()));
|
|
|
}
|
|
|
if (ObjectUtils.isNotEmpty(nameTemp) && !nameTemp.getId().equals(template.getId())) {
|
|
|
- return ResultContent.buildFail(String.format(ResultMessage.NAME_EXIT, param.getName()));
|
|
|
+ return ResultContent.buildFail(String.format(ResultMessage.NAME_EXIST, param.getName()));
|
|
|
}
|
|
|
template.setName(param.getName());
|
|
|
template.setRemark(param.getRemark());
|
|
|
@@ -140,7 +140,7 @@ public class IotServiceImpl extends SuperService {
|
|
|
// 新增加
|
|
|
template = new IotTemplate();
|
|
|
if (ObjectUtils.isNotEmpty(nameTemp)) {
|
|
|
- return ResultContent.buildFail(String.format(ResultMessage.NAME_EXIT, param.getName()));
|
|
|
+ return ResultContent.buildFail(String.format(ResultMessage.NAME_EXIST, param.getName()));
|
|
|
}
|
|
|
template.setIotDataType(IotDataType.IotTemplate);
|
|
|
BeanUtils.copyProperties(param, template);
|
|
|
@@ -168,7 +168,7 @@ public class IotServiceImpl extends SuperService {
|
|
|
return ResultContent.buildFail(String.format(ResultMessage.DATA_NOT_EXIST, param.getId()));
|
|
|
}
|
|
|
if (ObjectUtils.isNotEmpty(temp) && !temp.getId().equals(param.getId())) {
|
|
|
- return ResultContent.buildFail(String.format(ResultMessage.NAME_EXIT, param.getName()));
|
|
|
+ return ResultContent.buildFail(String.format(ResultMessage.NAME_EXIST, param.getName()));
|
|
|
}
|
|
|
template.setName(param.getName());
|
|
|
template.setRemark(param.getRemark());
|
|
|
@@ -263,13 +263,13 @@ public class IotServiceImpl extends SuperService {
|
|
|
// 产品
|
|
|
IotTemplate temp = iotTemplateDao.findTopByNameAndIotDataType(param.getName(), IotDataType.IotTemplate);
|
|
|
if (ObjectUtils.isNotEmpty(temp) && !temp.getId().equals(template.getId())) {
|
|
|
- return ResultContent.buildFail(String.format(ResultMessage.NAME_EXIT, param.getName()));
|
|
|
+ return ResultContent.buildFail(String.format(ResultMessage.NAME_EXIST, param.getName()));
|
|
|
}
|
|
|
} else if (template.getIotDataType() == IotDataType.Device) {
|
|
|
// 物模型
|
|
|
IotTemplate temp = iotTemplateDao.findTopByNameAndDeviceIdAndIotDataType(param.getName(), template.getDeviceId(), IotDataType.Device);
|
|
|
if (ObjectUtils.isNotEmpty(temp) && !temp.getId().equals(template.getId())) {
|
|
|
- return ResultContent.buildFail(String.format(ResultMessage.NAME_EXIT, param.getName()));
|
|
|
+ return ResultContent.buildFail(String.format(ResultMessage.NAME_EXIST, param.getName()));
|
|
|
}
|
|
|
}
|
|
|
BeanUtils.copyProperties(param, template);
|
|
|
@@ -442,7 +442,7 @@ public class IotServiceImpl extends SuperService {
|
|
|
}
|
|
|
|
|
|
if (ObjectUtils.isNotEmpty(nameTemp) && !nameTemp.getId().equals(param.getId())) {
|
|
|
- return ResultContent.buildFail(String.format(ResultMessage.NAME_EXIT, param.getName()));
|
|
|
+ return ResultContent.buildFail(String.format(ResultMessage.NAME_EXIST, param.getName()));
|
|
|
}
|
|
|
if (ObjectUtils.isNotEmpty(topicTemp) && !topicTemp.getId().equals(param.getId())) {
|
|
|
return ResultContent.buildFail(String.format("iotTopic已存在:%s", param.getIotTopic()));
|
|
|
@@ -455,7 +455,7 @@ public class IotServiceImpl extends SuperService {
|
|
|
entity = new IotMain();
|
|
|
initEntity(entity);
|
|
|
if (ObjectUtils.isNotEmpty(nameTemp)) {
|
|
|
- return ResultContent.buildFail(String.format(ResultMessage.NAME_EXIT, param.getName()));
|
|
|
+ return ResultContent.buildFail(String.format(ResultMessage.NAME_EXIST, param.getName()));
|
|
|
}
|
|
|
if (ObjectUtils.isNotEmpty(topicTemp)) {
|
|
|
return ResultContent.buildFail(String.format("iotTopic已存在:%s", param.getIotTopic()));
|