use of com.webank.wedatasphere.qualitis.entity.SystemConfig in project Qualitis by WeBankFinTech.
the class SystemConfigServiceImpl method findByKeyName.
@Override
public GeneralResponse<?> findByKeyName(String keyName) throws UnExpectedRequestException {
SystemConfig systemConfigInDb = systemConfigDao.findByKeyName(keyName);
if (null == systemConfigInDb) {
throw new UnExpectedRequestException("key name {&DOES_NOT_EXIST}");
}
LOGGER.info("{&SUCCEED_TO_FIND_SYSTEM_CONFIG}. key:{}, value: {}", systemConfigInDb.getKeyName(), systemConfigInDb.getValue());
return new GeneralResponse<>("200", "{&SUCCEED_TO_FIND_SYSTEM_CONFIG}", systemConfigInDb);
}
use of com.webank.wedatasphere.qualitis.entity.SystemConfig in project Qualitis by WeBankFinTech.
the class SystemConfigServiceImpl method modifySystemConfig.
@Override
@Transactional(rollbackFor = Exception.class)
public GeneralResponse<?> modifySystemConfig(ModifySystemConfigRequest request) throws UnExpectedRequestException {
// Check Argument
ModifySystemConfigRequest.checkRequest(request);
checkKeyName(request.getKeyName());
// Find System Config by key name
String keyName = request.getKeyName();
String value = request.getValue();
SystemConfig systemConfigInDb = systemConfigDao.findByKeyName(keyName);
if (null == systemConfigInDb) {
throw new UnExpectedRequestException("key name {&DOES_NOT_EXIST}");
}
LOGGER.info("{&SUCCEED_TO_FIND_SYSTEM_CONFIG}. key:{}, value: {}", systemConfigInDb.getKeyName(), systemConfigInDb.getValue());
// 修改url并保存
systemConfigInDb.setValue(value);
SystemConfig savedSystemConfig = systemConfigDao.saveSystemConfig(systemConfigInDb);
LOGGER.info("{&SUCCEED_TO_MODIFY_SYSTEM_CONFIG}. key: {}, value: {}", savedSystemConfig.getKeyName(), savedSystemConfig.getValue());
return new GeneralResponse<>("200", "{&SUCCEED_TO_MODIFY_SYSTEM_CONFIG}", null);
}
Aggregations