|  |  |  | 
|---|
|  |  |  | // TODO 检查是否已经存在,且注册成功, 如果注册成功,需要先注销之前再,修改并注册 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // ParentPlatform parentPlatformOld = storager.queryParentPlatById(parentPlatform.getDeviceGBId()); | 
|---|
|  |  |  | ParentPlatform parentPlatformOld = storager.queryParentPlatById(parentPlatform.getServerGBId()); | 
|---|
|  |  |  | ParentPlatform parentPlatformOld = storager.queryParentPlatByServerGBId(parentPlatform.getServerGBId()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | boolean updateResult = storager.updateParentPlatform(parentPlatform); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | } else if (parentPlatformOld != null && parentPlatformOld.isEnable() && !parentPlatform.isEnable()){ // 关闭启用时注销 | 
|---|
|  |  |  | commanderForPlatform.unregister(parentPlatform, null, null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return new ResponseEntity<>("success", HttpStatus.OK); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | return new ResponseEntity<>("fail", HttpStatus.OK); | 
|---|
|  |  |  | 
|---|
|  |  |  | ){ | 
|---|
|  |  |  | return new ResponseEntity<>("missing parameters", HttpStatus.BAD_REQUEST); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | ParentPlatform parentPlatform = storager.queryParentPlatById(serverGBId); | 
|---|
|  |  |  | ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(serverGBId); | 
|---|
|  |  |  | if (parentPlatform == null) return new ResponseEntity<>("fail", HttpStatus.OK); | 
|---|
|  |  |  | // 发送离线消息,无论是否成功都删除缓存 | 
|---|
|  |  |  | commanderForPlatform.unregister(parentPlatform, (event -> { | 
|---|
|  |  |  | 
|---|
|  |  |  | if (logger.isDebugEnabled()) { | 
|---|
|  |  |  | logger.debug("查询上级平台是否存在API调用:" + serverGBId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | ParentPlatform parentPlatform = storager.queryParentPlatById(serverGBId); | 
|---|
|  |  |  | ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(serverGBId); | 
|---|
|  |  |  | return new ResponseEntity<>(String.valueOf(parentPlatform != null), HttpStatus.OK); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|