|
|
@@ -23,6 +23,7 @@ import com.yunfeiyun.agmp.iotm.util.MyPageUtil;
|
|
|
import com.yunfeiyun.agmp.iotm.web.domain.reqvo.IotDeviceAddReqVo;
|
|
|
import com.yunfeiyun.agmp.iotm.web.domain.reqvo.IotDeviceEditReqVo;
|
|
|
import com.yunfeiyun.agmp.iotm.web.domain.reqvo.IotDeviceListReqVo;
|
|
|
+import com.yunfeiyun.agmp.iotm.web.domain.reqvo.IotDeviceModifyReqVo;
|
|
|
import com.yunfeiyun.agmp.iotm.web.domain.resvo.IotDeviceListResVo;
|
|
|
import com.yunfeiyun.agmp.iotm.web.mapper.IotDeviceMapper;
|
|
|
import com.yunfeiyun.agmp.iotm.web.service.IIotDeviceService;
|
|
|
@@ -199,6 +200,35 @@ public class IotDeviceServiceImpl implements IIotDeviceService
|
|
|
return updateIotDevice(updateIotDevice, oldIotDeviceconn, newIotDeviceconn);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public int modifyNameIotDevice(IotDeviceModifyReqVo reqVo) {
|
|
|
+ String devBid = reqVo.getDevBid();
|
|
|
+ String devName = reqVo.getDevName();
|
|
|
+ if(StringUtils.isEmpty(devName)){
|
|
|
+ throw new IotBizException(ErrorCode.INVALID_PARAMETER.getCode(),"参数不能为空");
|
|
|
+ }
|
|
|
+ IotDevice iotDevice = selectIotDeviceByDevBid(devBid);
|
|
|
+ if(iotDevice == null){
|
|
|
+ throw new IotBizException(ErrorCode.INVALID_PARAMETER.getCode(),"设备不存在");
|
|
|
+ }
|
|
|
+ IotDevice updateIotDevice = new IotDevice();
|
|
|
+ updateIotDevice.setDevBid(iotDevice.getDevBid());
|
|
|
+ updateIotDevice.setDevName(devName);
|
|
|
+ updateIotDevice.setDevModifier(SecurityUtils.getUserId());
|
|
|
+ updateIotDevice.setDevModifieddate(DateUtils.dateTimeNow());
|
|
|
+ // 修改设备名称 不用同步修改连接客户端,只需同步设备信息到TOS即可
|
|
|
+ return updateIotDevice(updateIotDevice, null, null);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int removeIotDevice(String devBid) {
|
|
|
+ IotDevice iotDevice = selectIotDeviceByDevBid(devBid);
|
|
|
+ if(iotDevice == null){
|
|
|
+ throw new IotBizException(ErrorCode.INVALID_PARAMETER.getCode(),"设备不存在");
|
|
|
+ }
|
|
|
+ return deleteIotDeviceByDevBid(iotDevice);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 查询设备基础
|
|
|
*
|
|
|
@@ -254,6 +284,7 @@ public class IotDeviceServiceImpl implements IIotDeviceService
|
|
|
int status = iotDeviceMapper.insertIotDeviceByBatch(iotDeviceList);
|
|
|
// TODO 发送消息
|
|
|
// 获取连接 订阅设备
|
|
|
+ // 同步新增设备到TOS
|
|
|
return status;
|
|
|
}
|
|
|
|
|
|
@@ -269,6 +300,7 @@ public class IotDeviceServiceImpl implements IIotDeviceService
|
|
|
// TODO 发送消息
|
|
|
// 解除旧连接订阅
|
|
|
// 订阅新连接
|
|
|
+ // 同步修改设备到TOS
|
|
|
sendToTosMsgService.sendIotDeviceUpdateMsg(iotDevice);
|
|
|
sendToIotsMsgService.sendIotDeviceUpdateMsg(iotDevice);
|
|
|
return result;
|
|
|
@@ -283,12 +315,12 @@ public class IotDeviceServiceImpl implements IIotDeviceService
|
|
|
* @return 结果
|
|
|
*/
|
|
|
@Override
|
|
|
- public int deleteIotDeviceByDevBid(String devBid) {
|
|
|
- IotDevice iotDevice = iotDeviceMapper.selectIotDeviceByDevBid(devBid);
|
|
|
- if(null == iotDevice){
|
|
|
- return 0;
|
|
|
- }
|
|
|
+ public int deleteIotDeviceByDevBid(IotDevice iotDevice) {
|
|
|
+ String devBid = iotDevice.getDevBid();
|
|
|
int result = iotDeviceMapper.deleteIotDeviceByDevBid(devBid);
|
|
|
+ // TODO
|
|
|
+ // 解除连接订阅
|
|
|
+ // 同步删除设备到TOS
|
|
|
sendToTosMsgService.sendIotDeviceDeleteMsg(iotDevice);
|
|
|
sendToIotsMsgService.sendIotDeviceDeleteMsg(iotDevice);
|
|
|
return result;
|