[Fix-4776][Alert] Alert instance edit page partial parameter values are not displayed (#4782)
* generate warning instance plugin params. * update PluginParamsTransfer.generatePluginParams method. * update code style in the AlertPluginInstanceServiceImpl class. * JSONUtils rollback. * rerun e2e test. * update alert channel generate params. * update email alert channel test class. * update json utils parse object method. * update the data structure of the alarm script plug-in script type parameter to String.
This commit is contained in:
parent
15a5b05883
commit
68de43ad27
|
|
@ -17,6 +17,11 @@
|
|||
|
||||
package org.apache.dolphinscheduler.plugin.alert.dingtalk;
|
||||
|
||||
import static org.apache.dolphinscheduler.spi.utils.Constants.STRING_FALSE;
|
||||
import static org.apache.dolphinscheduler.spi.utils.Constants.STRING_NO;
|
||||
import static org.apache.dolphinscheduler.spi.utils.Constants.STRING_TRUE;
|
||||
import static org.apache.dolphinscheduler.spi.utils.Constants.STRING_YES;
|
||||
|
||||
import org.apache.dolphinscheduler.spi.alert.AlertChannel;
|
||||
import org.apache.dolphinscheduler.spi.alert.AlertChannelFactory;
|
||||
import org.apache.dolphinscheduler.spi.params.InputParam;
|
||||
|
|
@ -52,9 +57,9 @@ public class DingTalkAlertChannelFactory implements AlertChannelFactory {
|
|||
.build();
|
||||
RadioParam isEnableProxy =
|
||||
RadioParam.newBuilder(DingTalkParamsConstants.NAME_DING_TALK_PROXY_ENABLE, DingTalkParamsConstants.NAME_DING_TALK_PROXY_ENABLE)
|
||||
.addParamsOptions(new ParamsOptions("YES", true, false))
|
||||
.addParamsOptions(new ParamsOptions("NO", false, false))
|
||||
.setValue(true)
|
||||
.addParamsOptions(new ParamsOptions(STRING_YES, STRING_TRUE, false))
|
||||
.addParamsOptions(new ParamsOptions(STRING_NO, STRING_FALSE, false))
|
||||
.setValue(STRING_TRUE)
|
||||
.addValidate(Validate.newBuilder()
|
||||
.setRequired(false)
|
||||
.build())
|
||||
|
|
|
|||
|
|
@ -17,6 +17,11 @@
|
|||
|
||||
package org.apache.dolphinscheduler.plugin.alert.email;
|
||||
|
||||
import static org.apache.dolphinscheduler.spi.utils.Constants.STRING_FALSE;
|
||||
import static org.apache.dolphinscheduler.spi.utils.Constants.STRING_NO;
|
||||
import static org.apache.dolphinscheduler.spi.utils.Constants.STRING_TRUE;
|
||||
import static org.apache.dolphinscheduler.spi.utils.Constants.STRING_YES;
|
||||
|
||||
import org.apache.dolphinscheduler.spi.alert.AlertChannel;
|
||||
import org.apache.dolphinscheduler.spi.alert.AlertChannelFactory;
|
||||
import org.apache.dolphinscheduler.spi.alert.AlertConstants;
|
||||
|
|
@ -72,9 +77,9 @@ public class EmailAlertChannelFactory implements AlertChannelFactory {
|
|||
.build();
|
||||
|
||||
RadioParam enableSmtpAuth = RadioParam.newBuilder(MailParamsConstants.NAME_MAIL_SMTP_AUTH, MailParamsConstants.MAIL_SMTP_AUTH)
|
||||
.addParamsOptions(new ParamsOptions("YES", true, false))
|
||||
.addParamsOptions(new ParamsOptions("NO", false, false))
|
||||
.setValue(true)
|
||||
.addParamsOptions(new ParamsOptions(STRING_YES, STRING_TRUE, false))
|
||||
.addParamsOptions(new ParamsOptions(STRING_NO, STRING_FALSE, false))
|
||||
.setValue(STRING_TRUE)
|
||||
.addValidate(Validate.newBuilder().setRequired(true).build())
|
||||
.build();
|
||||
|
||||
|
|
@ -87,16 +92,16 @@ public class EmailAlertChannelFactory implements AlertChannelFactory {
|
|||
.build();
|
||||
|
||||
RadioParam enableTls = RadioParam.newBuilder(MailParamsConstants.NAME_MAIL_SMTP_STARTTLS_ENABLE, MailParamsConstants.MAIL_SMTP_STARTTLS_ENABLE)
|
||||
.addParamsOptions(new ParamsOptions("YES", true, false))
|
||||
.addParamsOptions(new ParamsOptions("NO", false, false))
|
||||
.setValue(false)
|
||||
.addParamsOptions(new ParamsOptions(STRING_YES, STRING_TRUE, false))
|
||||
.addParamsOptions(new ParamsOptions(STRING_NO, STRING_FALSE, false))
|
||||
.setValue(STRING_FALSE)
|
||||
.addValidate(Validate.newBuilder().setRequired(true).build())
|
||||
.build();
|
||||
|
||||
RadioParam enableSsl = RadioParam.newBuilder(MailParamsConstants.NAME_MAIL_SMTP_SSL_ENABLE, MailParamsConstants.MAIL_SMTP_SSL_ENABLE)
|
||||
.addParamsOptions(new ParamsOptions("YES", true, false))
|
||||
.addParamsOptions(new ParamsOptions("NO", false, false))
|
||||
.setValue(false)
|
||||
.addParamsOptions(new ParamsOptions(STRING_YES, STRING_TRUE, false))
|
||||
.addParamsOptions(new ParamsOptions(STRING_NO, STRING_FALSE, false))
|
||||
.setValue(STRING_FALSE)
|
||||
.addValidate(Validate.newBuilder().setRequired(true).build())
|
||||
.build();
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,11 @@
|
|||
|
||||
package org.apache.dolphinscheduler.plugin.alert.feishu;
|
||||
|
||||
import static org.apache.dolphinscheduler.spi.utils.Constants.STRING_FALSE;
|
||||
import static org.apache.dolphinscheduler.spi.utils.Constants.STRING_NO;
|
||||
import static org.apache.dolphinscheduler.spi.utils.Constants.STRING_TRUE;
|
||||
import static org.apache.dolphinscheduler.spi.utils.Constants.STRING_YES;
|
||||
|
||||
import org.apache.dolphinscheduler.spi.alert.AlertChannel;
|
||||
import org.apache.dolphinscheduler.spi.alert.AlertChannelFactory;
|
||||
import org.apache.dolphinscheduler.spi.params.InputParam;
|
||||
|
|
@ -44,9 +49,9 @@ public class FeiShuAlertChannelFactory implements AlertChannelFactory {
|
|||
.build();
|
||||
RadioParam isEnableProxy =
|
||||
RadioParam.newBuilder(FeiShuParamsConstants.NAME_FEI_SHU_PROXY_ENABLE, FeiShuParamsConstants.NAME_FEI_SHU_PROXY_ENABLE)
|
||||
.addParamsOptions(new ParamsOptions("YES", true, false))
|
||||
.addParamsOptions(new ParamsOptions("NO", false, false))
|
||||
.setValue(true)
|
||||
.addParamsOptions(new ParamsOptions(STRING_YES, STRING_TRUE, false))
|
||||
.addParamsOptions(new ParamsOptions(STRING_NO, STRING_FALSE, false))
|
||||
.setValue(STRING_TRUE)
|
||||
.addValidate(Validate.newBuilder()
|
||||
.setRequired(false)
|
||||
.build())
|
||||
|
|
|
|||
|
|
@ -56,8 +56,8 @@ public class ScriptAlertChannelFactory implements AlertChannelFactory {
|
|||
.build();
|
||||
|
||||
RadioParam scriptTypeParams = RadioParam.newBuilder(ScriptParamsConstants.NAME_SCRIPT_TYPE, ScriptParamsConstants.SCRIPT_TYPE)
|
||||
.addParamsOptions(new ParamsOptions(ScriptType.SHELL.getDescp(), ScriptType.SHELL.getCode(), false))
|
||||
.setValue(ScriptType.SHELL.getCode())
|
||||
.addParamsOptions(new ParamsOptions(ScriptType.SHELL.getDescp(), ScriptType.SHELL.getDescp(), false))
|
||||
.setValue(ScriptType.SHELL.getDescp())
|
||||
.addValidate(Validate.newBuilder().setRequired(true).build())
|
||||
.build();
|
||||
|
||||
|
|
|
|||
|
|
@ -33,19 +33,19 @@ public class ScriptSender {
|
|||
|
||||
private String scriptPath;
|
||||
|
||||
private Integer scriptType;
|
||||
private String scriptType;
|
||||
|
||||
private String userParams;
|
||||
|
||||
ScriptSender(Map<String, String> config) {
|
||||
scriptPath = config.get(ScriptParamsConstants.NAME_SCRIPT_PATH);
|
||||
scriptType = Integer.parseInt(config.get(ScriptParamsConstants.NAME_SCRIPT_TYPE));
|
||||
scriptType = config.get(ScriptParamsConstants.NAME_SCRIPT_TYPE);
|
||||
userParams = config.get(ScriptParamsConstants.NAME_SCRIPT_USER_PARAMS);
|
||||
}
|
||||
|
||||
AlertResult sendScriptAlert(String msg) {
|
||||
AlertResult alertResult = new AlertResult();
|
||||
if (ScriptType.of(scriptType).equals(ScriptType.SHELL)) {
|
||||
if (ScriptType.SHELL.getDescp().equals(scriptType)) {
|
||||
return executeShellScript(msg);
|
||||
}
|
||||
return alertResult;
|
||||
|
|
|
|||
|
|
@ -45,18 +45,4 @@ public enum ScriptType {
|
|||
return descp;
|
||||
}
|
||||
|
||||
private static final Map<Integer, ScriptType> SCRIPT_TYPE_MAP = new HashMap<>();
|
||||
|
||||
static {
|
||||
for (ScriptType scriptType : ScriptType.values()) {
|
||||
SCRIPT_TYPE_MAP.put(scriptType.code, scriptType);
|
||||
}
|
||||
}
|
||||
|
||||
public static ScriptType of(Integer code) {
|
||||
if (SCRIPT_TYPE_MAP.containsKey(code)) {
|
||||
return SCRIPT_TYPE_MAP.get(code);
|
||||
}
|
||||
throw new IllegalArgumentException("invalid code : " + code);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ public class ScriptSenderTest {
|
|||
@Before
|
||||
public void initScriptConfig() {
|
||||
|
||||
scriptConfig.put(ScriptParamsConstants.NAME_SCRIPT_TYPE, String.valueOf(ScriptType.SHELL.getCode()));
|
||||
scriptConfig.put(ScriptParamsConstants.NAME_SCRIPT_TYPE, String.valueOf(ScriptType.SHELL.getDescp()));
|
||||
scriptConfig.put(ScriptParamsConstants.NAME_SCRIPT_USER_PARAMS, "userParams");
|
||||
scriptConfig.put(ScriptParamsConstants.NAME_SCRIPT_PATH, shellFilPath);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,9 +32,6 @@ import org.apache.dolphinscheduler.dao.mapper.AlertGroupMapper;
|
|||
import org.apache.dolphinscheduler.dao.mapper.AlertPluginInstanceMapper;
|
||||
import org.apache.dolphinscheduler.dao.mapper.PluginDefineMapper;
|
||||
import org.apache.dolphinscheduler.spi.params.PluginParamsTransfer;
|
||||
import org.apache.dolphinscheduler.spi.params.base.PluginParams;
|
||||
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
|
@ -250,26 +247,15 @@ public class AlertPluginInstanceServiceImpl extends BaseService implements Alert
|
|||
}
|
||||
|
||||
/**
|
||||
* parseToPluginUiParams
|
||||
* parse To Plugin Ui Params
|
||||
*
|
||||
* @param pluginParamsMapString k-v data
|
||||
* @param pluginUiParams Complete parameters(include ui)
|
||||
* @return Complete parameters list(include ui)
|
||||
*/
|
||||
private String parseToPluginUiParams(String pluginParamsMapString, String pluginUiParams) {
|
||||
Map<String, String> paramsMap = JSONUtils.toMap(pluginParamsMapString);
|
||||
if (MapUtils.isEmpty(paramsMap)) {
|
||||
return null;
|
||||
}
|
||||
List<PluginParams> pluginParamsList = JSONUtils.toList(pluginUiParams, PluginParams.class);
|
||||
List<PluginParams> newPluginParamsList = new ArrayList<>(pluginParamsList.size());
|
||||
pluginParamsList.forEach(pluginParams -> {
|
||||
pluginParams.setValue(paramsMap.get(pluginParams.getName()));
|
||||
newPluginParamsList.add(pluginParams);
|
||||
|
||||
});
|
||||
|
||||
return JSONUtils.toJsonString(newPluginParamsList);
|
||||
List<Map<String, Object>> pluginParamsList = PluginParamsTransfer.generatePluginParams(pluginParamsMapString, pluginUiParams);
|
||||
return JSONUtils.toJsonString(pluginParamsList);
|
||||
}
|
||||
|
||||
private boolean checkHasAssociatedAlertGroup(String id) {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ public class AlertInfo {
|
|||
/**
|
||||
* all params this plugin need is in alertProps
|
||||
*/
|
||||
private Map<String,String> alertParams;
|
||||
private Map<String, String> alertParams;
|
||||
|
||||
/**
|
||||
* the alert content
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@
|
|||
|
||||
package org.apache.dolphinscheduler.spi.params;
|
||||
|
||||
import static org.apache.dolphinscheduler.spi.utils.Constants.STRING_PLUGIN_PARAM_FIELD;
|
||||
import static org.apache.dolphinscheduler.spi.utils.Constants.STRING_PLUGIN_PARAM_VALUE;
|
||||
|
||||
import org.apache.dolphinscheduler.spi.params.base.PluginParams;
|
||||
import org.apache.dolphinscheduler.spi.utils.JSONUtils;
|
||||
|
||||
|
|
@ -24,6 +27,8 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
|
||||
/**
|
||||
* plugin params pojo and json transfer tool
|
||||
*/
|
||||
|
|
@ -44,8 +49,36 @@ public class PluginParamsTransfer {
|
|||
List<PluginParams> pluginParams = transferJsonToParamsList(paramsJsonStr);
|
||||
Map<String, String> paramsMap = new HashMap<>();
|
||||
for (PluginParams param : pluginParams) {
|
||||
paramsMap.put(param.getName(), null != param.getValue() ? param.getValue().toString() : null);
|
||||
paramsMap.put(param.getName(), param.getValue() == null ? null : param.getValue().toString());
|
||||
}
|
||||
return paramsMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* generate Plugin Params
|
||||
*
|
||||
* @param paramsJsonStr paramsJsonStr value
|
||||
* @param pluginParamsTemplate pluginParamsTemplate
|
||||
* @return return plugin params value
|
||||
*/
|
||||
public static List<Map<String, Object>> generatePluginParams(String paramsJsonStr, String pluginParamsTemplate) {
|
||||
Map<String, Object> paramsMap = JSONUtils.toMap(paramsJsonStr);
|
||||
return generatePluginParams(paramsMap, pluginParamsTemplate);
|
||||
}
|
||||
|
||||
/**
|
||||
* generate Plugin Params
|
||||
*
|
||||
* @param paramsMap paramsMap
|
||||
* @param pluginParamsTemplate pluginParamsTemplate
|
||||
* @return return plugin params value
|
||||
*/
|
||||
public static List<Map<String, Object>> generatePluginParams(Map<String, Object> paramsMap, String pluginParamsTemplate) {
|
||||
if (paramsMap == null || paramsMap.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
List<Map<String, Object>> pluginParamsList = JSONUtils.parseObject(pluginParamsTemplate, new TypeReference<List<Map<String, Object>>>() {});
|
||||
pluginParamsList.forEach(pluginParams -> pluginParams.put(STRING_PLUGIN_PARAM_VALUE, paramsMap.get(pluginParams.get(STRING_PLUGIN_PARAM_FIELD))));
|
||||
return pluginParamsList;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
package org.apache.dolphinscheduler.spi.params;
|
||||
|
||||
import static org.apache.dolphinscheduler.spi.utils.Constants.STRING_PLUGIN_PARAM_OPTIONS;
|
||||
|
||||
import org.apache.dolphinscheduler.spi.params.base.FormType;
|
||||
import org.apache.dolphinscheduler.spi.params.base.ParamsOptions;
|
||||
import org.apache.dolphinscheduler.spi.params.base.PluginParams;
|
||||
|
|
@ -32,7 +34,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||
*/
|
||||
public class RadioParam extends PluginParams {
|
||||
|
||||
@JsonProperty("options")
|
||||
@JsonProperty(STRING_PLUGIN_PARAM_OPTIONS)
|
||||
private List<ParamsOptions> paramsOptionsList;
|
||||
|
||||
private RadioParam(Builder builder) {
|
||||
|
|
|
|||
|
|
@ -17,6 +17,14 @@
|
|||
|
||||
package org.apache.dolphinscheduler.spi.params.base;
|
||||
|
||||
import static org.apache.dolphinscheduler.spi.utils.Constants.STRING_PLUGIN_PARAM_FIELD;
|
||||
import static org.apache.dolphinscheduler.spi.utils.Constants.STRING_PLUGIN_PARAM_NAME;
|
||||
import static org.apache.dolphinscheduler.spi.utils.Constants.STRING_PLUGIN_PARAM_PROPS;
|
||||
import static org.apache.dolphinscheduler.spi.utils.Constants.STRING_PLUGIN_PARAM_TITLE;
|
||||
import static org.apache.dolphinscheduler.spi.utils.Constants.STRING_PLUGIN_PARAM_TYPE;
|
||||
import static org.apache.dolphinscheduler.spi.utils.Constants.STRING_PLUGIN_PARAM_VALIDATE;
|
||||
import static org.apache.dolphinscheduler.spi.utils.Constants.STRING_PLUGIN_PARAM_VALUE;
|
||||
|
||||
import static java.util.Objects.requireNonNull;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -35,34 +43,34 @@ public class PluginParams {
|
|||
/**
|
||||
* param name
|
||||
*/
|
||||
@JsonProperty("field")
|
||||
@JsonProperty(STRING_PLUGIN_PARAM_FIELD)
|
||||
protected String name;
|
||||
|
||||
/**
|
||||
* param name
|
||||
*/
|
||||
@JsonProperty("name")
|
||||
@JsonProperty(STRING_PLUGIN_PARAM_NAME)
|
||||
protected String fieldName;
|
||||
|
||||
@JsonProperty("props")
|
||||
@JsonProperty(STRING_PLUGIN_PARAM_PROPS)
|
||||
protected ParamsProps props;
|
||||
|
||||
@JsonProperty("type")
|
||||
@JsonProperty(STRING_PLUGIN_PARAM_TYPE)
|
||||
protected String formType;
|
||||
|
||||
/**
|
||||
* Name displayed on the page
|
||||
*/
|
||||
@JsonProperty("title")
|
||||
@JsonProperty(STRING_PLUGIN_PARAM_TITLE)
|
||||
protected String title;
|
||||
|
||||
/**
|
||||
* default value or value input by user in the page
|
||||
*/
|
||||
@JsonProperty("value")
|
||||
@JsonProperty(STRING_PLUGIN_PARAM_VALUE)
|
||||
protected Object value;
|
||||
|
||||
@JsonProperty("validate")
|
||||
@JsonProperty(STRING_PLUGIN_PARAM_VALIDATE)
|
||||
protected List<Validate> validateList;
|
||||
|
||||
protected PluginParams(Builder builder) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.spi.utils;
|
||||
|
||||
/**
|
||||
* constants
|
||||
*/
|
||||
public class Constants {
|
||||
private Constants() {
|
||||
throw new IllegalStateException("Constants class");
|
||||
}
|
||||
|
||||
/** alert plugin param field string **/
|
||||
public static final String STRING_PLUGIN_PARAM_FIELD = "field";
|
||||
/** alert plugin param name string **/
|
||||
public static final String STRING_PLUGIN_PARAM_NAME = "name";
|
||||
/** alert plugin param props string **/
|
||||
public static final String STRING_PLUGIN_PARAM_PROPS = "props";
|
||||
/** alert plugin param type string **/
|
||||
public static final String STRING_PLUGIN_PARAM_TYPE = "type";
|
||||
/** alert plugin param title string **/
|
||||
public static final String STRING_PLUGIN_PARAM_TITLE = "title";
|
||||
/** alert plugin param value string **/
|
||||
public static final String STRING_PLUGIN_PARAM_VALUE = "value";
|
||||
/** alert plugin param validate string **/
|
||||
public static final String STRING_PLUGIN_PARAM_VALIDATE = "validate";
|
||||
/** alert plugin param options string **/
|
||||
public static final String STRING_PLUGIN_PARAM_OPTIONS = "options";
|
||||
|
||||
|
||||
/** string true */
|
||||
public static final String STRING_TRUE = "true";
|
||||
/** string false */
|
||||
public static final String STRING_FALSE = "false";
|
||||
/** string yes */
|
||||
public static final String STRING_YES = "YES";
|
||||
/** string no */
|
||||
public static final String STRING_NO = "NO";
|
||||
|
||||
}
|
||||
|
|
@ -24,11 +24,13 @@ import static com.fasterxml.jackson.databind.DeserializationFeature.READ_UNKNOWN
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.ObjectWriter;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
|
|
@ -124,6 +126,38 @@ public class JSONUtils {
|
|||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
/**
|
||||
* json to map
|
||||
*
|
||||
* @param json json
|
||||
* @return json to map
|
||||
*/
|
||||
public static <K, V> Map<K, V> toMap(String json) {
|
||||
return parseObject(json, new TypeReference<Map<K, V>>() {});
|
||||
}
|
||||
|
||||
/**
|
||||
* json to object
|
||||
*
|
||||
* @param json json string
|
||||
* @param type type reference
|
||||
* @param <T>
|
||||
* @return return parse object
|
||||
*/
|
||||
public static <T> T parseObject(String json, TypeReference<T> type) {
|
||||
if (StringUtils.isEmpty(json)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
return objectMapper.readValue(json, type);
|
||||
} catch (Exception e) {
|
||||
logger.error("json to map exception!", e);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* object to json string
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue