胸科医院代码上传
parent
0836261a05
commit
ee84e559e6
|
@ -1,5 +1,6 @@
|
||||||
package aiyh.utils;
|
package aiyh.utils;
|
||||||
|
|
||||||
|
import aiyh.utils.interfaces.script_util.CusScriptFunInterface;
|
||||||
import aiyh.utils.tool.org.apache.commons.jexl3.*;
|
import aiyh.utils.tool.org.apache.commons.jexl3.*;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -13,9 +14,16 @@ import java.util.Map;
|
||||||
*/
|
*/
|
||||||
public class ScriptUtil {
|
public class ScriptUtil {
|
||||||
private static final JexlEngine JEXL = new JexlBuilder().create();
|
private static final JexlEngine JEXL = new JexlBuilder().create();
|
||||||
|
|
||||||
public static Object invokeScript(String script, Map<String, Object> params) {
|
public static Object invokeScript(String script, Map<String, Object> params) {
|
||||||
|
return invokeScript(script, params, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Object invokeScript(String script, Map<String, Object> params, CusScriptFunInterface scriptFunInterface) {
|
||||||
JexlContext jc = new MapContext();
|
JexlContext jc = new MapContext();
|
||||||
|
if(null != scriptFunInterface){
|
||||||
|
jc.set(scriptFunInterface.getClass().getSimpleName(), scriptFunInterface);
|
||||||
|
}
|
||||||
for (Map.Entry<String, Object> entry : params.entrySet()) {
|
for (Map.Entry<String, Object> entry : params.entrySet()) {
|
||||||
jc.set(entry.getKey(), entry.getValue());
|
jc.set(entry.getKey(), entry.getValue());
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,4 +117,12 @@ public class XkHospitalTest extends BaseTest {
|
||||||
Util.null2DefaultStr(null,"");
|
Util.null2DefaultStr(null,"");
|
||||||
service.async("4bce0693734d","common", map);
|
service.async("4bce0693734d","common", map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testD(){
|
||||||
|
String json = "{\"data\":[{\"ID\":\"2\",\"GroupID\":\"test_yl_01\",\"Wards\":[]},{\"ID\":\"1\",\"GroupID\":\"test_yl_01\",\"Wards\":[{\"ID\":\"1\",\"WardCode\":\"bq_01\",\"WardName\":\"病区名称01_1\"},{\"ID\":\"2\",\"WardCode\":\"bq_02\",\"WardName\":\"病区名称01_2\"},{\"ID\":\"3\",\"WardCode\":\"bq_03\",\"WardName\":\"病区名称0_2_3\"},{\"ID\":\"4\",\"WardCode\":\"bq_04\",\"WardName\":\"病区名称02_1_3\"}]}]}\n";
|
||||||
|
System.out.println(json);
|
||||||
|
Map map = JSONObject.parseObject(json, Map.class);
|
||||||
|
service.async("testarr","common", map);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue