shichongfu
2023-04-25 ce0b49552668d3331055e2b1a1447a743dc54939
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
package com.product.admin.config;
 
import com.product.core.interceptor.support.DataValidateInterceptor;
import com.product.core.util.VerifyRegularUtil;
public class RegistValidate {
    
    
    private static RegistValidate registValidate;
    /**
     * 静态工厂方法 获取当前对象实例 多线程安全单例模式(使用双重同步锁)
     */
 
    public static synchronized RegistValidate getInstance() {
 
        if (registValidate == null) {
            synchronized (RegistValidate.class) {
                if (registValidate == null)
                    registValidate = new RegistValidate();
            }
        }
        return registValidate;
    }
 
    /**
     * @param api 接口地址
     * @param field 要验证的字段,可以多个用逗号分隔
     * @param validateType 验证的类型
     * 接口的参数验证
     */
    public void registValidateParameter() {
        /**除新增、修改接口外的接口参数验证***/
        /** @param api 接口地址
         * @param field 要验证的字段,可以多个用逗号分隔
//         * @param validateType 验证的类型*/    
        DataValidateInterceptor.registValidatPara("/api/prompt/findPrompt",CmnConst.PROMPT_NAME, VerifyRegularUtil.VALIDATE_REQUIRED);
//        DataValidateInterceptor.registValidatPara(InterfaceUrl.SYSTEM_PROMPT_ADD_URL,CmnConst.SOURCE_TABLE,VerifyRegularUtil.VALIDATE_REQUIRED);
//        DataValidateInterceptor.registValidatPara(InterfaceUrl.SYSTEM_PROMPT_ADD_URL,CmnConst.PROMPT_NAME,VerifyRegularUtil.VALIDATE_UNIQUE);
//        DataValidateInterceptor.registValidatPara(InterfaceUrl.SYSTEM_PROMPT_UPDATE_URL,CmnConst.SOURCE_TABLE,VerifyRegularUtil.VALIDATE_REQUIRED);
//        DataValidateInterceptor.registValidatPara(InterfaceUrl.SYSTEM_PROMPT_UPDATE_URL,CmnConst.PROMPT_NAME,VerifyRegularUtil.VALIDATE_UNIQUE);
//        DataValidateInterceptor.registValidatPara("/api/prompt/findPrompt","client_uuid",VerifyRegularUtil.VALIDATE_REQUIRED);
        //DataValidateInterceptor.registValidatPara("/api/*","prompt_name",VerifyRegularUtil.VALIDATE_REQUIRED);
 
        //菜单新增判断
        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_MENU_ADD_URL,CmnConst.MENU_NAME, VerifyRegularUtil.VALIDATE_REQUIRED);
        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_MENU_ADD_URL,CmnConst.MENU_DESCRIPTION, VerifyRegularUtil.VALIDATE_REQUIRED);
        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_MENU_ADD_URL,CmnConst.IS_SHOW, VerifyRegularUtil.VALIDATE_REQUIRED);
        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_MENU_ADD_URL,CmnConst.SEQUENCE, VerifyRegularUtil.VALIDATE_REQUIRED);
//        //菜单修改判断
//        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_MENU_UPDATE_URL,CmnConst.UUID, VerifyRegularUtil.VALIDATE_REQUIRED);
//        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_MENU_UPDATE_URL,CmnConst.MENU_NAME, VerifyRegularUtil.VALIDATE_REQUIRED);
//        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_MENU_UPDATE_URL,CmnConst.MENU_DESCRIPTION, VerifyRegularUtil.VALIDATE_REQUIRED);
//        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_MENU_UPDATE_URL,CmnConst.IS_SHOW, VerifyRegularUtil.VALIDATE_REQUIRED);
//        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_MENU_UPDATE_URL,CmnConst.SEQUENCE, VerifyRegularUtil.VALIDATE_REQUIRED);
        //菜单删除判断
        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_MENU_DELETE_URL,CmnConst.UUID, VerifyRegularUtil.VALIDATE_REQUIRED);
 
        //按钮新增判断
        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_BUTTONS_ADD_URL,CmnConst.BUTTON_TYPE, VerifyRegularUtil.VALIDATE_REQUIRED);
        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_BUTTONS_ADD_URL,CmnConst.BUTTON_NAME, VerifyRegularUtil.VALIDATE_REQUIRED);
        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_BUTTONS_ADD_URL,CmnConst.BUTTON_TITLE, VerifyRegularUtil.VALIDATE_REQUIRED);
        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_BUTTONS_ADD_URL,CmnConst.URL, VerifyRegularUtil.VALIDATE_REQUIRED);
        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_BUTTONS_ADD_URL,CmnConst.BUTTON_CATEGORY_UUID, VerifyRegularUtil.VALIDATE_REQUIRED);
        //按钮修改判断
        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_BUTTONS_UPDATE_URL,CmnConst.UUID, VerifyRegularUtil.VALIDATE_REQUIRED);
        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_BUTTONS_UPDATE_URL,CmnConst.FUNCTION_UUID, VerifyRegularUtil.VALIDATE_REQUIRED);
        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_BUTTONS_UPDATE_URL,CmnConst.BUTTON_TYPE, VerifyRegularUtil.VALIDATE_REQUIRED);
        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_BUTTONS_UPDATE_URL,CmnConst.BUTTON_NAME, VerifyRegularUtil.VALIDATE_REQUIRED);
        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_BUTTONS_UPDATE_URL,CmnConst.BUTTON_TITLE, VerifyRegularUtil.VALIDATE_REQUIRED);
        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_BUTTONS_UPDATE_URL,CmnConst.URL, VerifyRegularUtil.VALIDATE_REQUIRED);
        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_BUTTONS_UPDATE_URL,CmnConst.BUTTON_CATEGORY_UUID, VerifyRegularUtil.VALIDATE_REQUIRED);
        //按钮删除判断
        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_BUTTONS_DELETE_URL,CmnConst.UUID, VerifyRegularUtil.VALIDATE_REQUIRED);
 
        //客户查询判断
        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_CLIENTS_LIST_URL,CmnConst.CPAGE, VerifyRegularUtil.VALIDATE_INTEGER);
        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_CLIENTS_LIST_URL,CmnConst.PAGESIZE, VerifyRegularUtil.VALIDATE_INTEGER);
        //客户新增判断
        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_CLIENTS_ADD_URL,CmnConst.CLIENT_NAME, VerifyRegularUtil.VALIDATE_REQUIRED);
        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_CLIENTS_ADD_URL,CmnConst.VPN_USED, VerifyRegularUtil.VALIDATE_REQUIRED);
        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_CLIENTS_ADD_URL,CmnConst.VPN_IP, VerifyRegularUtil.VALIDATE_REQUIRED);
        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_CLIENTS_ADD_URL,CmnConst.VPN_USER, VerifyRegularUtil.VALIDATE_REQUIRED);
        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_CLIENTS_ADD_URL,CmnConst.VPN_PWD, VerifyRegularUtil.VALIDATE_REQUIRED);
        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_CLIENTS_ADD_URL,CmnConst.VPN_TYPE, VerifyRegularUtil.VALIDATE_REQUIRED);
        //客户修改判断
        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_CLIENTS_UPDATE_URL,CmnConst.UUID, VerifyRegularUtil.VALIDATE_REQUIRED);
        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_CLIENTS_UPDATE_URL,CmnConst.CLIENT_NAME, VerifyRegularUtil.VALIDATE_REQUIRED);
        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_CLIENTS_UPDATE_URL,CmnConst.VPN_USED, VerifyRegularUtil.VALIDATE_REQUIRED);
        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_CLIENTS_UPDATE_URL,CmnConst.VPN_IP, VerifyRegularUtil.VALIDATE_REQUIRED);
        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_CLIENTS_UPDATE_URL,CmnConst.VPN_USER, VerifyRegularUtil.VALIDATE_REQUIRED);
        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_CLIENTS_UPDATE_URL,CmnConst.VPN_PWD, VerifyRegularUtil.VALIDATE_REQUIRED);
        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_CLIENTS_UPDATE_URL,CmnConst.VPN_TYPE, VerifyRegularUtil.VALIDATE_REQUIRED);
        //客户删除判断
        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_CLIENTS_DELETE_URL,CmnConst.UUID, VerifyRegularUtil.VALIDATE_REQUIRED);
 
        //功能查询判断
        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_FUNCTIONS_LIST_URL,CmnConst.CPAGE, VerifyRegularUtil.VALIDATE_INTEGER);
        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_FUNCTIONS_LIST_URL,CmnConst.PAGESIZE, VerifyRegularUtil.VALIDATE_INTEGER);
        //功能新增判断
        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_FUNCTIONS_ADD_URL,CmnConst.MODULE_UUID, VerifyRegularUtil.VALIDATE_REQUIRED);
        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_FUNCTIONS_ADD_URL,CmnConst.FUNCTION_NAME, VerifyRegularUtil.VALIDATE_REQUIRED);
        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_FUNCTIONS_ADD_URL,CmnConst.IS_SYSTEM_FUNCTION, VerifyRegularUtil.VALIDATE_REQUIRED);
        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_FUNCTIONS_ADD_URL,CmnConst.FUNCTION_DESCRIPTION, VerifyRegularUtil.VALIDATE_REQUIRED);
        //功能修改判断
        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_FUNCTIONS_UPDATE_URL,CmnConst.UUID, VerifyRegularUtil.VALIDATE_REQUIRED);
        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_FUNCTIONS_UPDATE_URL,CmnConst.MODULE_UUID, VerifyRegularUtil.VALIDATE_REQUIRED);
        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_FUNCTIONS_UPDATE_URL,CmnConst.FUNCTION_NAME, VerifyRegularUtil.VALIDATE_REQUIRED);
        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_FUNCTIONS_UPDATE_URL,CmnConst.IS_SYSTEM_FUNCTION, VerifyRegularUtil.VALIDATE_REQUIRED);
        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_FUNCTIONS_UPDATE_URL,CmnConst.FUNCTION_DESCRIPTION, VerifyRegularUtil.VALIDATE_REQUIRED);
        //功能删除判断
        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_FUNCTIONS_DELETE_URL,CmnConst.UUID, VerifyRegularUtil.VALIDATE_REQUIRED);
        //功能查询判断
        DataValidateInterceptor.registValidatPara(InterfaceUrl.PRODUCT_SYS_FUNCTIONS_DETAILS_URL,CmnConst.UUID, VerifyRegularUtil.VALIDATE_REQUIRED);
 
        
        //邮件列表
        DataValidateInterceptor.registValidatPara(InterfaceUrl.MAILTEMPLATE_LIST_URL,CmnConst.CPAGE, VerifyRegularUtil.VALIDATE_INTEGER);
        DataValidateInterceptor.registValidatPara(InterfaceUrl.MAILTEMPLATE_LIST_URL,CmnConst.PAGESIZE, VerifyRegularUtil.VALIDATE_INTEGER);
        DataValidateInterceptor.registValidatPara(InterfaceUrl.MAILTEMPLATE_INFO_URL,CmnConst.UUID, VerifyRegularUtil.VALIDATE_REQUIRED);
        
        //数据字典
        DataValidateInterceptor.registValidatPara(InterfaceUrl.DICTIONARY_LIST_URL,CmnConst.CPAGE, VerifyRegularUtil.VALIDATE_INTEGER);
        DataValidateInterceptor.registValidatPara(InterfaceUrl.DICTIONARY_LIST_URL,CmnConst.PAGESIZE, VerifyRegularUtil.VALIDATE_INTEGER);
        DataValidateInterceptor.registValidatPara(InterfaceUrl.DICTIONARY_BYNAME_URL,CmnConst.DICT_NAME, VerifyRegularUtil.VALIDATE_REQUIRED);
//        DataValidateInterceptor.registValidatPara(InterfaceUrl.DICTIONARY_ADD_URL,CmnConst.DICT_NAME+",dict_label,dict_value", VerifyRegularUtil.VALIDATE_REQUIRED);
        //附件
        DataValidateInterceptor.registValidatPara(InterfaceUrl.ATTACHMENT_LIST_URL,CmnConst.CPAGE, VerifyRegularUtil.VALIDATE_INTEGER);
        DataValidateInterceptor.registValidatPara(InterfaceUrl.ATTACHMENT_LIST_URL,CmnConst.PAGESIZE, VerifyRegularUtil.VALIDATE_INTEGER);
 
//        DataValidateInterceptor.registValidatPara("/api/*",com.product.core.config.CmnConst.SYSTEM_LANGUAGE_CODE_,VerifyRegularUtil.VALIDATE_REQUIRED);
//        DataValidateInterceptor.registValidatPara("/api/*",com.product.core.config.CmnConst.SYSTEM_CLIENT_TYPE_,VerifyRegularUtil.VALIDATE_REQUIRED);
//        DataValidateInterceptor.registValidatPara("/api/*",com.product.core.config.CmnConst.SYSTEM_CLIENT_VERSION_,VerifyRegularUtil.VALIDATE_REQUIRED);
//      DataValidateInterceptor.registValidatPara("/api/testv/*","mm.bb",VerifyRegularUtil.VALIDATE_REQUIRED);
//      DataValidateInterceptor.registValidatPara("/api/testv/get-list/*","kk.cc",VerifyRegularUtil.VALIDATE_REQUIRED);
    }
    
    
}