| | |
| | | mapper.convertValue(Objects.nonNull(param) ? param : new Object(), controlMethodEnum.getClazz()) |
| | | : new RemoteDebugHandler(); |
| | | if (!handler.canPublish(sn)) { |
| | | throw new RuntimeException("The current state of the dock does not support this function."); |
| | | throw new RuntimeException("当前的机场状态不支持此功能。"); |
| | | } |
| | | if (Objects.nonNull(param) && !handler.valid()) { |
| | | throw new RuntimeException(CommonErrorEnum.ILLEGAL_ARGUMENT.getErrorMsg()); |
| | |
| | | public ResponseResult controlDockDebug(String sn, String serviceIdentifier, RemoteDebugParam param) { |
| | | RemoteDebugMethodEnum controlMethodEnum = RemoteDebugMethodEnum.find(serviceIdentifier); |
| | | if (RemoteDebugMethodEnum.UNKNOWN == controlMethodEnum) { |
| | | return ResponseResult.error("The " + serviceIdentifier + " method does not exist."); |
| | | return ResponseResult.error(" 没有找到" + serviceIdentifier + " 这个指令。"); |
| | | } |
| | | |
| | | RemoteDebugHandler data = checkDebugCondition(sn, param, controlMethodEnum); |
| | | |
| | | boolean isExist = deviceRedisService.checkDeviceOnline(sn); |
| | | if (!isExist) { |
| | | return ResponseResult.error("The dock is offline."); |
| | | return ResponseResult.error("设备离线"); |
| | | } |
| | | String bid = UUID.randomUUID().toString(); |
| | | ServiceReply serviceReply = messageSenderService.publishServicesTopic(sn, serviceIdentifier, data, bid); |
| | |
| | | : ResponseResult.success(); |
| | | } |
| | | |
| | | @Override |
| | | public ResponseResult requestsConfig(String sn,String method, RequestsParam param) { |
| | | ServiceReply serviceReply = messageSenderService.publishRequestsTopic(sn, method, param); |
| | | return ResponseResult.CODE_SUCCESS != serviceReply.getResult() ? |
| | | ResponseResult.error(serviceReply.getResult(), " Error Code:" + serviceReply.getResult()) |
| | | : ResponseResult.success(); |
| | | } |
| | | |
| | | } |