1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
| package com.changhong.epc.count.service.system.func.set.norm;
|
| import com.changhong.epc.bean.count.MeInfo;
| import com.changhong.epc.bean.tenant.master.AutoMasterVal;
| import com.changhong.epc.constter.system.SystemClients;
| import com.changhong.epc.count.service.exception.IEMRuntimeMasterException;
| import com.changhong.epc.count.service.system.func.set.AbsFuncSupper;
| import com.changhong.epc.rely.api.epc.system.ErrSystemApi;
| import com.changhong.epc.rely.api.epc.tenant.MasterApi;
| import com.googlecode.aviator.runtime.type.AviatorObject;
| import com.googlecode.aviator.runtime.type.AviatorString;
| import com.iemsoft.framework.cloud.core.tools.JSONTool;
| import com.iemsoft.framework.cloud.core.tools.ObjectUtil;
| import com.iemsoft.framework.cloud.core.tools.SpringUtil;
| import lombok.extern.slf4j.Slf4j;
| import org.apache.commons.lang3.StringUtils;
|
| import java.util.ArrayList;
| import java.util.Arrays;
| import java.util.List;
| import java.util.Map;
|
| /**
| * 根据条件获得主数据值 如匹配多条则返回首条
| *
| * @author wangZX
| *
| */
| @Slf4j
| public class GetValString extends AbsFuncSupper implements SystemClients {
|
| @Override
| public String getName() {
| return FUNC_GET_VAL_STRING;
| }
|
| public String exeFunc(List<AviatorObject> parms,Map<String, Object> env){
| // log.debug("上下文参数:{}", JSONTool.toJson(env));
| List<MeInfo> meInfoList = toMeInfoList(env, parms);
| log.debug("获得参数列表:{}", JSONTool.toJson(meInfoList));
| MeInfo resultInfo = meInfoList.get(0);
| meInfoList.remove(0);
| List<MeInfo> params = meInfoList;
| if(params.stream().filter(m->ObjectUtil.empty(m.getMeValue())).count() > 1){
| return "";
| }
| String str = SpringUtil.getBean(MasterApi.class).getMasterVal(
| AutoMasterVal.of(resultInfo.getMdCode(), resultInfo.getMeCode(), params));
|
| // 主數據缺失
| if (StringUtils.isBlank(str) && isNotEmpty(params)) {
| throw new IEMRuntimeMasterException(
| SpringUtil.getBean(ErrSystemApi.class).insertMasterErrMsg(resultInfo.getMdCode(), resultInfo.getMdName(), params));
| }
| return str;
| }
|
| private List<MeInfo> toMeInfoList(Map<String, Object> env,List<AviatorObject> parms){
| List<MeInfo> meInfos = new ArrayList<>();
| parms.forEach(o->meInfos.add(toMeInfo(env,o)));
| return meInfos;
| }
|
| private MeInfo toMeInfo(Map<String, Object> env, AviatorObject arg){
| return (MeInfo)getParameter(env,arg);
| }
|
| public AviatorObject allParam(Map<String, Object> env, AviatorObject... args){
| return new AviatorString(exeFunc(Arrays.asList(args),env));
| }
|
| @Override
| public AviatorObject call(Map<String, Object> env, AviatorObject arg1){ return allParam(env, arg1);}
| @Override
| public AviatorObject call(Map<String, Object> env, AviatorObject arg1, AviatorObject arg2){ return allParam(env, arg1, arg2);}
| @Override
| public AviatorObject call(Map<String, Object> env, AviatorObject arg1, AviatorObject arg2, AviatorObject arg3){ return allParam(env, arg1, arg2, arg3);}
| @Override
| public AviatorObject call(Map<String, Object> env, AviatorObject arg1, AviatorObject arg2, AviatorObject arg3, AviatorObject arg4){ return allParam(env, arg1, arg2, arg3, arg4);}
| @Override
| public AviatorObject call(Map<String, Object> env, AviatorObject arg1, AviatorObject arg2, AviatorObject arg3, AviatorObject arg4, AviatorObject arg5){ return allParam(env, arg1, arg2, arg3, arg4, arg5);}
| @Override
| public AviatorObject call(Map<String, Object> env, AviatorObject arg1, AviatorObject arg2, AviatorObject arg3, AviatorObject arg4, AviatorObject arg5, AviatorObject arg6){ return allParam(env, arg1, arg2, arg3, arg4, arg5, arg6);}
| @Override
| public AviatorObject call(Map<String, Object> env, AviatorObject arg1, AviatorObject arg2, AviatorObject arg3, AviatorObject arg4, AviatorObject arg5, AviatorObject arg6, AviatorObject arg7){ return allParam(env, arg1, arg2, arg3, arg4, arg5, arg6, arg7);}
| @Override
| public AviatorObject call(Map<String, Object> env, AviatorObject arg1, AviatorObject arg2, AviatorObject arg3, AviatorObject arg4, AviatorObject arg5, AviatorObject arg6, AviatorObject arg7, AviatorObject arg8){ return allParam(env, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);}
| @Override
| public AviatorObject call(Map<String, Object> env, AviatorObject arg1, AviatorObject arg2, AviatorObject arg3, AviatorObject arg4, AviatorObject arg5, AviatorObject arg6, AviatorObject arg7, AviatorObject arg8, AviatorObject arg9){ return allParam(env, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);}
| @Override
| public AviatorObject call(Map<String, Object> env, AviatorObject arg1, AviatorObject arg2, AviatorObject arg3, AviatorObject arg4, AviatorObject arg5, AviatorObject arg6, AviatorObject arg7, AviatorObject arg8, AviatorObject arg9, AviatorObject arg10){ return allParam(env, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10);}
| @Override
| public AviatorObject call(Map<String, Object> env, AviatorObject arg1, AviatorObject arg2, AviatorObject arg3, AviatorObject arg4, AviatorObject arg5, AviatorObject arg6, AviatorObject arg7, AviatorObject arg8, AviatorObject arg9, AviatorObject arg10, AviatorObject arg11){ return allParam(env, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11);}
| @Override
| public AviatorObject call(Map<String, Object> env, AviatorObject arg1, AviatorObject arg2, AviatorObject arg3, AviatorObject arg4, AviatorObject arg5, AviatorObject arg6, AviatorObject arg7, AviatorObject arg8, AviatorObject arg9, AviatorObject arg10, AviatorObject arg11, AviatorObject arg12){ return allParam(env, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12);}
| @Override
| public AviatorObject call(Map<String, Object> env, AviatorObject arg1, AviatorObject arg2, AviatorObject arg3, AviatorObject arg4, AviatorObject arg5, AviatorObject arg6, AviatorObject arg7, AviatorObject arg8, AviatorObject arg9, AviatorObject arg10, AviatorObject arg11, AviatorObject arg12, AviatorObject arg13){ return allParam(env, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13);}
| @Override
| public AviatorObject call(Map<String, Object> env, AviatorObject arg1, AviatorObject arg2, AviatorObject arg3, AviatorObject arg4, AviatorObject arg5, AviatorObject arg6, AviatorObject arg7, AviatorObject arg8, AviatorObject arg9, AviatorObject arg10, AviatorObject arg11, AviatorObject arg12, AviatorObject arg13, AviatorObject arg14){ return allParam(env, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14);}
| @Override
| public AviatorObject call(Map<String, Object> env, AviatorObject arg1, AviatorObject arg2, AviatorObject arg3, AviatorObject arg4, AviatorObject arg5, AviatorObject arg6, AviatorObject arg7, AviatorObject arg8, AviatorObject arg9, AviatorObject arg10, AviatorObject arg11, AviatorObject arg12, AviatorObject arg13, AviatorObject arg14, AviatorObject arg15){ return allParam(env, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15);}
| @Override
| public AviatorObject call(Map<String, Object> env, AviatorObject arg1, AviatorObject arg2, AviatorObject arg3, AviatorObject arg4, AviatorObject arg5, AviatorObject arg6, AviatorObject arg7, AviatorObject arg8, AviatorObject arg9, AviatorObject arg10, AviatorObject arg11, AviatorObject arg12, AviatorObject arg13, AviatorObject arg14, AviatorObject arg15, AviatorObject arg16){ return allParam(env, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16);}
| @Override
| public AviatorObject call(Map<String, Object> env, AviatorObject arg1, AviatorObject arg2, AviatorObject arg3, AviatorObject arg4, AviatorObject arg5, AviatorObject arg6, AviatorObject arg7, AviatorObject arg8, AviatorObject arg9, AviatorObject arg10, AviatorObject arg11, AviatorObject arg12, AviatorObject arg13, AviatorObject arg14, AviatorObject arg15, AviatorObject arg16, AviatorObject arg17){ return allParam(env, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17);}
| @Override
| public AviatorObject call(Map<String, Object> env, AviatorObject arg1, AviatorObject arg2, AviatorObject arg3, AviatorObject arg4, AviatorObject arg5, AviatorObject arg6, AviatorObject arg7, AviatorObject arg8, AviatorObject arg9, AviatorObject arg10, AviatorObject arg11, AviatorObject arg12, AviatorObject arg13, AviatorObject arg14, AviatorObject arg15, AviatorObject arg16, AviatorObject arg17, AviatorObject arg18){ return allParam(env, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18);}
| @Override
| public AviatorObject call(Map<String, Object> env, AviatorObject arg1, AviatorObject arg2, AviatorObject arg3, AviatorObject arg4, AviatorObject arg5, AviatorObject arg6, AviatorObject arg7, AviatorObject arg8, AviatorObject arg9, AviatorObject arg10, AviatorObject arg11, AviatorObject arg12, AviatorObject arg13, AviatorObject arg14, AviatorObject arg15, AviatorObject arg16, AviatorObject arg17, AviatorObject arg18, AviatorObject arg19){ return allParam(env, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19);}
| @Override
| public AviatorObject call(Map<String, Object> env, AviatorObject arg1, AviatorObject arg2, AviatorObject arg3, AviatorObject arg4, AviatorObject arg5, AviatorObject arg6, AviatorObject arg7, AviatorObject arg8, AviatorObject arg9, AviatorObject arg10, AviatorObject arg11, AviatorObject arg12, AviatorObject arg13, AviatorObject arg14, AviatorObject arg15, AviatorObject arg16, AviatorObject arg17, AviatorObject arg18, AviatorObject arg19, AviatorObject arg20){ return allParam(env, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20);}
|
| }
|
|