ludc
2025-01-16 986aa62ed00bee39363bab41b4eeb8259d446efd
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
package com.vci.client.portal.utility;
 
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
 
import com.vci.client.common.providers.ServiceProvider;
import com.vci.corba.common.VCIError;
import com.vci.corba.omd.atm.AttribItem;
import com.vci.corba.omd.etm.EnumChild;
import com.vci.corba.omd.etm.EnumItem;
import com.vci.omd.objects.OtherInfo;
 
public class PRM {
    private String showCols = "3";
    private String formQtName = "";
    
    private List<PRMItem> prmItemList;
 
    /**
     * form查询模板名字
     * @return
     */
    public String getShowCols() {
        return showCols;
    }
 
    public void setShowCols(String showCols) {
        this.showCols = showCols;
    }
 
    
    public String getFormQtName() {
        return formQtName;
    }
 
    public void setFormQtName(String formQtName) {
        this.formQtName = formQtName;
    }
 
    public List<PRMItem> getPrmItemList() {
        return prmItemList;
    }
 
    public void setPrmItemList(List<PRMItem> prmItemList) {
        this.prmItemList = prmItemList;
    }
    
    /**
     * field 与  显示名字
     * @return
     */
    public Map<String, String> getColAndNameMap(){
        if(this.prmItemList == null || this.prmItemList.size() <= 0){
            return null;
        }
        Map<String, String> map = new LinkedHashMap<String, String>();
        for(int i = 0; i < this.prmItemList.size(); i++){
            PRMItem p = this.prmItemList.get(i);
            String itemField = p.getItemField();
            
            if(itemField == null || itemField.equals("")){
                continue;
            }
            String[] fields = itemField.split("\\.");
            String field = fields[fields.length - 1];
            String name = p.getItemName();
            map.put(itemField, name);
            //将枚举类型的枚举名或者日期标识_DATE放入map
            //key为_field
            String itemType = p.getItemType();
            String _field = "_" + itemField;
            
            if(itemType.equals("select") || itemType.equals("checkbox")){
                try {
                
                    AttribItem attr;
                        attr = ServiceProvider.getOMDService().getAttributeService().getAttribItemByName(field);
                    OtherInfo otherInfo = OtherInfo.getOtherInfoByText(attr.other);
                    String enumName = otherInfo.getEnumName();
                    if (enumName != null && !enumName.equals("")) {
                        EnumItem enumItem = ServiceProvider.getOMDService().getEnumService().getEmItemByName(enumName);
                        StringBuilder stb = new StringBuilder("全部");
                        for(EnumChild child : enumItem.children){
                            stb.append(",");
                            stb.append(child.name);
                        }
                        map.put(_field, stb.toString());
                    }
                } catch (VCIError e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }else if(itemType.equals("date") || itemType.equals("time") || itemType.equals("datetime")){
                map.put(_field, "_DATE");
            }
        }
        if(map.size() == 0){
            return null;
        }
        return map;
    }
}