PoiEL.java
1.2 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
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.lhcredit.common.utils.StringUtils;
import com.lhcredit.project.business.reportMake.ReportMakeService;
import java.util.List;
import java.util.Map;
public class PoiEL {
public String map(Object object){
return map(object,null);
}
public String map(Object object ,String fieldName){
if (null==object){
return ReportMakeService.no_data;
}
if (object instanceof String){
return StringUtils.isNotEmpty(object.toString())?object.toString(): ReportMakeService.no_data;
}
if (object instanceof List ||object instanceof JSONArray){
return ReportMakeService.no_data;
}
JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(object));
if (!jsonObject.containsKey(fieldName)){
return ReportMakeService.no_data;
} else if (StringUtils.isEmpty(jsonObject.getString(fieldName))) {
return ReportMakeService.no_data;
} else{
return jsonObject.getString(fieldName);
}
}
public String test(){
return ReportMakeService.no_data;
}
}