import groovy.lang.Binding;
import groovy.lang.GroovyShell;
protected GroovyShell createGroovyShell(GenerateDTO dto){
Binding binding = new Binding();
GroovyShell shell = new GroovyShell(binding);
binding.setVariable("入参年", dto.getYear());
binding.setVariable("入参月", dto.getPeriod());
return shell;
}
createGroovyShell(dto).evaluate(your expression)