Commit 182fe054 authored by xinglei's avatar xinglei

*)增加JSON空值显示

parent f867bae5
package com.yeejoin.amos.boot.biz.common.utils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.util.Map;
......@@ -13,7 +14,7 @@ import java.util.Map;
public class RuleUtils {
public static String instedParams(String content, Object msgObj) {
Map<String, Object> strengthMap = JSON.parseObject(JSON.toJSONString(msgObj), Map.class);
Map<String, Object> strengthMap = JSON.parseObject(JSON.toJSONString(msgObj, SerializerFeature.WriteMapNullValue), Map.class);
for (String key : strengthMap.keySet())
content = content.replaceAll("\\$\\{" + key + "}", String.valueOf(ValidationUtil.isEmpty(strengthMap.get(key)) ? "" : strengthMap.get(key)));
return content;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment