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
package com.vci.server.query.util;
 
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
 
import com.vci.server.base.utility.OmdHelper;
import com.vci.server.cache.OMCacheProvider;
 
/**
 * 服务端的查询工具类
 * 修改链接类型查询的缓慢的问题时修改,不确定Tool是否被客户端引用,因此单独实现所需的方法
 * @author weidy
 *
 */
public class ServerTool {
 
    public static final DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
 
    /**
     * 视图cols 
     * viewName.col as col2
     * @param ltName
     * @return
     */
    public static List<String> getViewColsWithAlias(String[] btNames, String viewName) {
        List<String> cols = new ArrayList<String>();
        String[] sysAbItems = OmdHelper.getBTSysANames();
        for(String sysAbItem : sysAbItems){
            cols.add(viewName + "." + sysAbItem + " AS " + sysAbItem + "2");
        }
        Set<String> userAttrNameSet = getUserAttrNameSet(btNames);
        for(String userAttrName : userAttrNameSet){
            cols.add(viewName + "." + userAttrName + " AS " + userAttrName + "2");
        }
        return cols;
    }
    
 
    /**
     * 获取业务类型属性总集合
     * @param btNames
     * @return
     */
    private static Set<String> getUserAttrNameSet(String[] btNames){
        Set<String> set = new LinkedHashSet<String>();
        try{
            for(String btName : btNames){
                //String[] abNames = ServerServiceProvider.getOMDService().getBTMService().getBtmApNameArray(btName);
                String[] abNames = OMCacheProvider.getBizType(btName).apNameArray;
                for(String abName : abNames){
                    set.add(abName);
                }
            }
        } catch (Throwable e) {
            e.printStackTrace();
        }
        return set;
    }
}