| | |
| | | import com.xcong.farmer.cms.core.tag.TagsEnum; |
| | | import com.xcong.farmer.cms.core.template.Configuration; |
| | | import com.xcong.farmer.cms.core.template.TemplateConfiguration; |
| | | import com.xcong.farmer.cms.utils.GroovySingleton; |
| | | import groovy.lang.Binding; |
| | | import groovy.lang.GroovyShell; |
| | | import org.apache.commons.text.StringSubstitutor; |
| | |
| | | // } |
| | | // } |
| | | |
| | | Binding binding = new Binding(); |
| | | GroovyShell groovyShell = GroovySingleton.getSingleton(); |
| | | Binding binding = groovyShell.getContext(); |
| | | for (Map.Entry<String, Object> entry : this.parserData.entrySet()) { |
| | | String fieldKey = entry.getKey(); |
| | | Map<String, Object> data = (Map<String, Object>) entry.getValue(); |
| | |
| | | binding.setProperty("system", systemData); |
| | | } |
| | | |
| | | GroovyShell shell = new GroovyShell(binding); |
| | | Object evaluate = shell.evaluate(group); |
| | | // GroovyShell shell = new GroovyShell(binding); |
| | | Object evaluate = groovyShell.evaluate(group); |
| | | if (evaluate == null) { |
| | | targetData.put(group, ""); |
| | | } else { |
| | | targetData.put(group, evaluate.toString()); |
| | | } |
| | | groovyShell.getClassLoader().clearCache(); |
| | | } |
| | | |
| | | StringSubstitutor str = new StringSubstitutor(targetData); |