@Override public Integer setDeviceConfig(String deviceCode, Integer configType, ConfigItem configItem) { LOGGER.info("begin to execute setDeviceConfig method"); int CONFIG_DEVICE_CFG = 1; if (CONFIG_DEVICE_CFG == configType && null != configItem.getDeviceConfig()) { DeviceConfig config = configItem.getDeviceConfig(); if (null != config) { if (!StringUtils.isNullOrEmpty(config.getDevicePassword())) { try { // 加密方式向下兼容 String devicePwd = Encrypt.getEncryptPwd(config.getDevicePassword()); if (StringUtils.isNullOrEmpty(devicePwd)) { return PlatformNativeConstant.SDK_TP_PASSWORD_ENCODE_ERRORCODE; } config.setDevicePassword(devicePwd); } catch (Exception e) { LOGGER.debug("encode password error"); return PlatformNativeConstant.SDK_TP_PASSWORD_ENCODE_ERRORCODE; } } if (!StringUtils.isNullOrEmpty(config.getDeviceRegPassword())) { try { // 加密方式向下兼容 String deviceRegPwd = Encrypt.getEncryptPwd(config.getDeviceRegPassword()); if (StringUtils.isNullOrEmpty(deviceRegPwd)) { return PlatformNativeConstant.SDK_TP_PASSWORD_ENCODE_ERRORCODE; } config.setDeviceRegPassword(deviceRegPwd); } catch (Exception e) { LOGGER.debug("encode password error"); return PlatformNativeConstant.SDK_TP_PASSWORD_ENCODE_ERRORCODE; } } } } try { Integer errorCode = ivsProfessionalDeviceManager.setDeviceConfig(deviceCode, configType, configItem); LOGGER.info("execute setDeviceConfig method completed"); return errorCode; } catch (Exception e) { LOGGER.error("setDeviceConfig method exception happened", e); return ExceptionUtils.processSoapException(e); } }
@Override public IVSSDKResponse<ConfigItem> getDeviceConfig(String deviceCode, Integer configType) { LOGGER.info("begin to execute getDeviceConfig method"); IVSSDKResponse<ConfigItem> result = new IVSSDKResponse<ConfigItem>(); Holder<Integer> resultCode = new Holder<Integer>(); Holder<ConfigItem> configItem = new Holder<ConfigItem>(); try { ivsProfessionalDeviceManager.getDeviceConfig(deviceCode, configType, resultCode, configItem); } catch (Exception e) { LOGGER.error("getDeviceConfig method exception happened", e); result.setResultCode(ExceptionUtils.processSoapException(e)); return result; } result.setResultCode(resultCode.value); ConfigItem configItemValue = configItem.value; if (null != configItemValue && null != configItemValue.getDeviceConfig()) { DeviceConfig deviceConfig = configItemValue.getDeviceConfig(); String psw = deviceConfig.getDevicePassword(); if (!StringUtils.isNullOrEmpty(psw)) { try { deviceConfig.setDevicePassword(AES128Utils.decodeFromBase64(psw)); } catch (Exception e) { LOGGER.error("devicePassword decode error", e); } } else { deviceConfig.setDevicePassword(""); } String rpsw = deviceConfig.getDeviceRegPassword(); if (!StringUtils.isNullOrEmpty(rpsw)) { try { deviceConfig.setDeviceRegPassword(AES128Utils.decodeFromBase64(rpsw)); } catch (Exception e) { LOGGER.error("devicePassword decode error", e); } } else { deviceConfig.setDeviceRegPassword(""); } } result.setResult(configItemValue); LOGGER.info("execute getDeviceConfig method completed"); return result; }