ValiDataUtil.java
1.48 KB
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
package com.xly.util;
import cn.hutool.core.util.ObjectUtil;
import com.xly.entity.ParamRule;
import lombok.extern.slf4j.Slf4j;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Slf4j
public class ValiDataUtil {
private static final ValiDataUtil me = new ValiDataUtil();
public static ValiDataUtil me()
{
return me;
}
/**
* 判断输入是否为纯数字(用于识别客户的序号选择)
*/
public boolean isPureNumber(String str) {
if (str == null || str.trim().isEmpty()) {
return false;
}
return str.trim().matches("^[0-9]+$");
}
public static Map<String, Object> getArgs(Map<String, Object> argsNew, List<ParamRule> paramDefs){
Map<String, Object> rMap = new HashMap<>();
try{
if(ObjectUtil.isNotEmpty(argsNew)){
argsNew.forEach((k,v)->{
List<ParamRule> pdList = paramDefs.stream().filter(m-> m.getSParam().equals(k)
|| m.getSParamValue().equals(k)
).collect(Collectors.toUnmodifiableList());
if(ObjectUtil.isNotEmpty(pdList)){
rMap.put(pdList.get(0).getSParamValue(),v);
}
});
}
}catch (Exception e){
}finally {
rMap.remove("sSlaveId");
rMap.remove("operateType");
}
return rMap;
}
}