Commit 623f8997 authored by 高东东's avatar 高东东

*)修改规则动作bug

parent 5b8f9a9f
......@@ -13,7 +13,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -31,6 +32,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.yeejoin.amos.component.rule.MethodParam;
import com.yeejoin.amos.component.rule.RuleActionBean;
import com.yeejoin.amos.component.rule.RuleMethod;
import com.yeejoin.amos.fas.business.action.el.ELEvaluationContext;
import com.yeejoin.amos.fas.business.action.model.ContingencyEvent;
import com.yeejoin.amos.fas.business.action.model.ContingencyRo;
import com.yeejoin.amos.fas.business.action.model.DeviceRo;
......@@ -385,14 +387,31 @@ public class ContingencyAction implements CustomerAction {
content = content.replaceAll("\\$\\{" + field.getName() + "}", value);
}
content = content.replaceAll("\\$\\{", "");
content = content.replaceAll("}", "");
content = getNative(content);
// content = content.replaceAll("\\$\\{", "");
// content = content.replaceAll("}", "");
} catch (Exception e) {
e.printStackTrace();
}
return content;
}
public String getNative(String str)
{
Pattern p = Pattern.compile("\\$\\{(.*?)\\}");
Matcher m = p.matcher(str);
while (m.find())
{
String parameter = m.group();
Object parametervalue = ELEvaluationContext
.getValue(parameter.substring(1, parameter.length() - 1));
if(parametervalue != null)
str = str.replace(parameter,
parametervalue != null ? parametervalue.toString() : null);
}
return str;
}
/**
* 交互动作
......
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