@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<DeviceOperResultInfos> addDevice( String domainCode, Integer deviceNum, DeviceOperInfoList deviceOperInfo) { LOGGER.info("begin to execute addDevice method"); IVSSDKResponse<DeviceOperResultInfos> result = new IVSSDKResponse<DeviceOperResultInfos>(); Holder<Integer> resultCode = new Holder<Integer>(); Holder<DeviceOperResultInfos> deviceOperResultList = new Holder<DeviceOperResultInfos>(); List<DeviceOperInfo> operInfo = deviceOperInfo.getDeviceOperInfo(); if (null != operInfo) { for (DeviceOperInfo info : operInfo) { DeviceConfig config = info.getDeviceConfig(); if (null != config) { if (!StringUtils.isNullOrEmpty(config.getDevicePassword())) { try { // 加密方式向下兼容 String devicePwd = Encrypt.getEncryptPwd(config.getDevicePassword()); if (StringUtils.isNullOrEmpty(devicePwd)) { LOGGER.debug("encode password error"); result.setResultCode(PlatformNativeConstant.SDK_TP_PASSWORD_ENCODE_ERRORCODE); return result; } config.setDevicePassword(devicePwd); } catch (Exception e) { LOGGER.debug("encode password error"); result.setResultCode(PlatformNativeConstant.SDK_TP_PASSWORD_ENCODE_ERRORCODE); return result; } } if (!StringUtils.isNullOrEmpty(config.getDeviceRegPassword())) { try { // 加密方式向下兼容 String deviceRegPwd = Encrypt.getEncryptPwd(config.getDeviceRegPassword()); if (StringUtils.isNullOrEmpty(deviceRegPwd)) { LOGGER.debug("encode password error"); result.setResultCode(PlatformNativeConstant.SDK_TP_PASSWORD_ENCODE_ERRORCODE); return result; } config.setDeviceRegPassword(deviceRegPwd); } catch (Exception e) { LOGGER.debug("encode password error"); result.setResultCode(PlatformNativeConstant.SDK_TP_PASSWORD_ENCODE_ERRORCODE); return result; } } } } } try { ivsProfessionalDeviceManager.addDevice( domainCode, deviceNum, deviceOperInfo, resultCode, deviceOperResultList); } catch (Exception e) { LOGGER.error("addDevice method exception happened", e); result.setResultCode(ExceptionUtils.processSoapException(e)); return result; } result.setResultCode(resultCode.value); result.setResult(deviceOperResultList.value); LOGGER.info("execute addDevice method completed"); return result; }