| | |
| | | .data(Map.of(MapKeyConst.DEVICES, deviceOtaFirmwares)) |
| | | .build()); |
| | | if (serviceReply.getResult() != ResponseResult.CODE_SUCCESS) { |
| | | return ResponseResult.error(serviceReply.getResult(), "Firmware Error Code: " + serviceReply.getResult()); |
| | | String errorMsg = CommonErrorEnum.getMsgByCode(serviceReply.getResult()); |
| | | return ResponseResult.error(serviceReply.getResult(), errorMsg); |
| | | } |
| | | |
| | | // Record the device state that needs to be updated. |
| | | deviceOtaFirmwares.forEach(deviceOta -> RedisOpsUtils.setWithExpire( |
| | | RedisConst.FIRMWARE_UPGRADING_PREFIX + deviceOta.getSn(), |
| | | bid, |
| | | RedisConst.DEVICE_ALIVE_SECOND * RedisConst.DEVICE_ALIVE_SECOND)); |
| | | bid,RedisConst.DEVICE_ALIVE_SECOND * RedisConst.DEVICE_ALIVE_SECOND)); |
| | | return ResponseResult.success(); |
| | | } |
| | | |
| | |
| | | public void devicePropertySet(String dockSn, DeviceSetPropertyEnum propertyEnum, JsonNode param) { |
| | | boolean dockOnline = this.checkDeviceOnline(dockSn); |
| | | if (!dockOnline) { |
| | | throw new RuntimeException("Dock is offline."); |
| | | throw new RuntimeException(CommonErrorEnum.DEVICE_OFFLINE.getErrorMsg()); |
| | | } |
| | | DeviceDTO deviceDTO = (DeviceDTO) RedisOpsUtils.get(RedisConst.DEVICE_ONLINE_PREFIX + dockSn); |
| | | boolean deviceOnline = this.checkDeviceOnline(deviceDTO.getChildDeviceSn()); |