|
|
@@ -97,6 +97,7 @@ public class GateWayInfoService extends SuperService {
|
|
|
ProjectInfo projectInfo = projectInfoDao.findTopByCode(param.getProjectInfoCode());
|
|
|
gateWayInfo.setProjectInfo(projectInfo);
|
|
|
}
|
|
|
+ log.info("网关注册成功");
|
|
|
// 通知同步
|
|
|
deviceSyncFullCardService.noticeSyncGateWay(gateWayInfo);
|
|
|
return ResultContent.buildSuccess();
|
|
|
@@ -109,6 +110,10 @@ public class GateWayInfoService extends SuperService {
|
|
|
* @return
|
|
|
*/
|
|
|
public ResultContent registerGateWay(GateWayInfoAddParam param) {
|
|
|
+ ProjectInfo projectInfo = projectInfoDao.findTopByCode(param.getProjectInfoCode());
|
|
|
+ if (ObjectUtils.isEmpty(projectInfo)) {
|
|
|
+ return ResultContent.buildFail(String.format("分组不存在:%s", param.getProjectInfoCode()));
|
|
|
+ }
|
|
|
addGateWayInfo(param);
|
|
|
return ResultContent.buildSuccess();
|
|
|
}
|
|
|
@@ -125,6 +130,13 @@ public class GateWayInfoService extends SuperService {
|
|
|
if (ObjectUtils.isEmpty(gateWayInfo)) {
|
|
|
return ResultContent.buildFail(String.format("网关未注册:%s", param.getGateWayId()));
|
|
|
}
|
|
|
+
|
|
|
+ String projectInfoCode = param.getProjectInfoCode();
|
|
|
+ ProjectInfo projectInfo = projectInfoDao.findTopByCode(projectInfoCode);
|
|
|
+ if (ObjectUtils.isEmpty(projectInfo)) {
|
|
|
+ return ResultContent.buildFail(String.format("分组不存在:%s", projectInfoCode));
|
|
|
+ }
|
|
|
+
|
|
|
List<DeviceInfoAddParam> devices = param.getDevices();
|
|
|
if (ObjectUtils.isNotEmpty(devices)) {
|
|
|
// 检查设备数据合法性
|
|
|
@@ -153,8 +165,6 @@ public class GateWayInfoService extends SuperService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- String projectInfoCode = param.getProjectInfoCode();
|
|
|
-
|
|
|
// 设备列表
|
|
|
List<DeviceInfo> deviceInfos = new ArrayList<>();
|
|
|
if (ObjectUtils.isNotEmpty(devices)) {
|
|
|
@@ -194,6 +204,7 @@ public class GateWayInfoService extends SuperService {
|
|
|
// 绑定用户设备权限
|
|
|
bindUserDevicesPermissions(MqttTopicUtils.getUserRoleName(gateWayUserInfo), deviceInfos);
|
|
|
|
|
|
+ log.info("设备注册成功:{}", deviceInfos.size());
|
|
|
// 同步设备
|
|
|
deviceSyncFullCardService.noticeSyncDevice(deviceInfos);
|
|
|
|