dangsn
2024-12-26 4e9ff2ce6a830bb2340d7c8612c72eea0c5a553e
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
package com.vci.client.framework.util;
 
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
 
import com.vci.client.LogonApplication;
import com.vci.client.common.ConfigUtils;
import com.vci.client.common.objects.RoleObject;
import com.vci.client.common.objects.UserObject;
import com.vci.client.framework.delegate.FuncOperationClientDelegate;
import com.vci.client.framework.delegate.FunctionClientDelegate;
import com.vci.client.framework.delegate.RightManagementClientDelegate;
import com.vci.client.framework.delegate.RoleRightClientDelegate;
import com.vci.client.framework.delegate.SystemCfgClientDelegate;
import com.vci.client.framework.rightConfig.object.FuncOperationObject;
import com.vci.client.framework.rightConfig.object.FunctionObject;
import com.vci.client.framework.rightdistribution.object.RoleRightObject;
import com.vci.client.ui.exception.VCIException;
import com.vci.client.ui.locale.LocaleDisplay;
import com.vci.client.ui.swing.VCIOptionPane;
 
/**
 * 权限处理
 * 
 * @author xf
 * 
 *         2012-5-22
 */
public class RightControlUtil {
 
    public final static String CODE_SYSTEM_FLAG = "CodeSystem";
    public final static String RM_SYSTEM_FLAT = "RMSystem";
    public final static String Prefer_SYSTEM_FLAT = "PreferSystem";
    
    public enum ThreeAdminEnum {
        /**
         * 系统管理员
         */
        SYSADMIN,
        /**
         * 审计管理员
         */
        SECADMIN,
        /**
         * 审计管理员
         */
        AUDITADMIN
    }
    
 
    /**
     * 增加、增加分类、创建规则
     */
    public final static String CREATE = "ADD"; 
    /**
     * 修改、码值管理、  修改分类
     */
    public final static String UPDATE = "EDIT";
    /**
     * 删除 、删除分类
     */
    public final static String DELETE = "DELETE";
    /**
     * 剪切
     */
    public final static String CUT = "CUT";
    /**
     * 粘贴
     */
    public final static String PASTE = "PASTE";
    /**
     * 查询 
     */
    public final static String SEARCH = "SEARCH";
    /**
     * 导入 、分配部门 、 下移
     */
    public final static String IMPORT = "IMPORT";
    
    /**
     * 集团码导出
     */
    public final static String EXPORT2 = "EXPORT2";
    /**
     * 集团码导入
     */
    public final static String IMPORT2 = "IMPORT2";
    /**
     * 批量导入更改
     */
    public final static String BATCHUPDATE = "BATCHUPDATE";
    
    /**
     * 导出 、分配角色 、最上端
     */
    public final static String EXPORT = "EXPORT";
    /**
     * 码值管理
     */
    public final static String CODEVALUEMANAGE = "CODEVALUEMANAGE";
    /**
     * 集成配置
     */
    public final static String INTEGRATECONFIG = "INTEGRATECONFIG";
    
    /**
     * 清除、清空表、清空码值、清除规则、重置、取消设置
     */
    public final static String CLEAR = "CLEAR";
    
    /**
     *  冻结 、分配成员 、最下端
     */
    public final static String FREEZE = "FREEZE";
    /**
     *  解冻 、停用
     */
    public final static String UNFREZE = "UNFREZE";
    /**
     * 回收、启用、生成表
     */
    public final static String RECYCLE = "RECYCLE";
    /**
     * 码值申请
     */
    public final static String CODEAPPLY = "CODEAPPLY";
    
    /**
     * 授权 、上移、任务处理、设置
     */
    public final static String RIGHT = "RIGHT";
    /**
     * 报废、统计、  删除表  解锁、任务取消
     */
    public final static String DISCARD ="DISCARD";
 
    /**
     * 批量申请
     */
    public final static String BATCHAPPLY ="BATCHAPPLY";
    /**
     * 批量赋码
     */
    public final static String BATCHASSIGN ="BATCHASSIGN";
    /**
     * 下载文件
     */
    public final static String Downloadfile ="DOWNLOADFILE";
    /**
     * 查看文件
     */
    public final static String Viewfile ="VIEWFILE";
    /**
     * 查看,历史数据查看
     */
    public final static String VIEW ="VIEW";
    /**
     * 属性授权
     */
    public final static String attrRight ="ATTRRIGHT";
    /**
     * 分类授权
     */
    public final static String clsRight ="CLSRIGHT";
    /**
     * 数据授权
     */
    public final static String DataRight ="DATARIGHT";
    /**
     * 配置主数据
     */
    public final static String DataConfig ="DATACONFIG";
    
    /**
     * 当前用户所有权限
     */
//    private static Map<String, RoleRightObject[]> roleRightMap =  new HashMap<String, RoleRightObject[]>();
    
    /**
     * 通过用户名获取用户有权限的子级子级模块
     */
    public static FunctionObject[] getFunctionsByRight(String parentId,String userName){
        FunctionObject[] funcObjs =  null;
        try {
            if(RightControlUtil.isDeveloper(userName)){
                funcObjs = new FunctionClientDelegate().getModuleListByParentId(parentId, true);
            }else if(RightControlUtil.isAdmin(userName)){
                funcObjs = new FunctionClientDelegate().getModuleListByParentId(parentId, false);
            }else{
                funcObjs = new  FunctionClientDelegate().getModuleListByRoleRight(parentId, userName);
            }
        } catch (VCIException e) {
            e.printStackTrace();
            VCIOptionPane.showError(LogonApplication.frame, LocaleDisplay.getI18nString(e, "RMIPFramework", Locale.getDefault()));
        }
        return funcObjs;
    }
    
    public static FunctionObject[] getFunctionsByParentId(String parentId, String userName) {
        
        FunctionObject[] funcObjs =  null;
        try {
            if(RightControlUtil.isDeveloper(userName)){
                funcObjs = new FunctionClientDelegate().getChildrenFunctionsByParentId(parentId, true);
            } else {
                funcObjs = new FunctionClientDelegate().getChildrenFunctionsByParentId(parentId, false);
                //funcObjs = new FunctionClientDelegate().getModuleListByRoleRight(parentId, userName);
            }
        } catch (VCIException e) {
            e.printStackTrace();
            VCIOptionPane.showError(LogonApplication.frame, LocaleDisplay.getI18nString(e, "RMIPFramework", Locale.getDefault()));
        }
        return funcObjs;
    }
    
    /**
     * 用户具有权限的下级节点
     * @param parentId
     * @param userName
     * @return
     */
    public static FunctionObject[] getChildrenFunctionsByUserName(String parentId, String userName) {
        FunctionObject[] AllFunction = getFunctionsByParentId(parentId, userName);
        List<FunctionObject> functionObjects = new ArrayList<FunctionObject>();
        if(RightControlUtil.isDeveloper(userName)
                || RightControlUtil.isAdmin(userName)){
            for (int i = 0; i < AllFunction.length; i++) {
                if (!parentId.equals(AllFunction[i].getParentId())) {
                    continue;
                }
                functionObjects.add(AllFunction[i]);
            }
            return functionObjects.toArray(new FunctionObject[0]);
        }
        RoleRightObject[] currentUserRoleRights = getRoleRightByUserName(userName);
        
        for (int i = 0; i < AllFunction.length; i++) {
            if (!parentId.equals(AllFunction[i].getParentId())) {
                continue;
            }
            for (int j = 0; j < currentUserRoleRights.length; j++) {
                if (currentUserRoleRights[j].getFuncId().equals(AllFunction[i].getId())) {
                    functionObjects.add(AllFunction[i]);
                    break;
                }
            }
        }
        
        return functionObjects.toArray(new FunctionObject[0]);
    }
    
    /**
     * 获取当前用户具有权限的所有模块
     * @param parentId, 父模块id
     * @param userName, 用户名
     * @return
     */
    public static Map<String, List<FunctionObject>> getAllChildrenFunctionsByUserName(String parentId, String userName) {
        FunctionObject[] AllFunction = getFunctionsByParentId(parentId, userName);
        Map<String, List<FunctionObject>> map = new LinkedHashMap<String, List<FunctionObject>>();
        boolean isAllShow = RightControlUtil.isDeveloper(userName) || RightControlUtil.isAdmin(userName) || !isFunctionSwithOn();
        //System.out.println("================= " + isAllShow + " =====================");
        RoleRightObject[] currentUserRoleRights = null;
        if (!isAllShow) {
            currentUserRoleRights = getFunctionRoleRightByUserName(userName);
        }
        boolean isHasRight = false;
        for (int i = 0; i < AllFunction.length; i++) {
            isHasRight = false;
            if (isAllShow) {
                isHasRight = true;
            } else {
                for (int j = 0; j < currentUserRoleRights.length; j++) {
                    if (!isAllShow && !currentUserRoleRights[j].getFuncId().equals(AllFunction[i].getId())) {
                        continue;
                    }
                    isHasRight = true;
                    break;
                }
            }
            if (!isHasRight) {
                continue;
            }
            String cparentId = AllFunction[i].getParentId();
            List<FunctionObject> clist = null;
            if (map.containsKey(cparentId)) {
                clist = map.get(cparentId);
            } else {
                clist = new ArrayList<FunctionObject>();
            }
            clist.add(AllFunction[i]);
            map.put(cparentId, clist);
        }
        return map;
    }
    
    /**
     * 获取当前用户具有权限的所有模块
     * @param parentId, 父模块id
     * @param userName, 用户名
     * @param currentUserRoleRights, 当前用户具有的权限
     * @return
     */
    public static Map<String, List<FunctionObject>> getAllChildrenFunctionsByUserName(String parentId, String userName, RoleRightObject[] userRoleRights) {
        Map<String, List<RoleRightObject>> mapRight = new LinkedHashMap<String, List<RoleRightObject>>();
        for (int i = 0; i < userRoleRights.length; i++) {
            RoleRightObject right = userRoleRights[i];
            
            List<RoleRightObject> lstRight = null;
            if (mapRight.containsKey(right.getFuncId())) {
                lstRight = mapRight.get(right.getFuncId());
            } else {
                lstRight = new ArrayList<RoleRightObject>();
            }
            lstRight.add(right);
            mapRight.put(right.getFuncId(), lstRight);
        }
        
        FunctionObject[] AllFunction = getFunctionsByParentId(parentId, userName);
        Map<String, List<FunctionObject>> map = new LinkedHashMap<String, List<FunctionObject>>();
        boolean isAllShow = RightControlUtil.isDeveloper(userName) || RightControlUtil.isAdmin(userName) || !isFunctionSwithOn();
        boolean isHasRight = false;
        FunctionObject func;
        for (int i = 0; i < AllFunction.length; i++) {
            func = AllFunction[i];
            //System.out.println("=== FUNC:ID=" + func.getId()+ "  ParentID=" + func.getParentId() + ";  Name=" + func.getName());
            isHasRight = false;
            if (isAllShow) {
                isHasRight = true;
            } else {
                List<RoleRightObject> lstRight = null;
                if (mapRight.containsKey(func.getId())) {
                    lstRight = mapRight.get(func.getId());
                    //System.out.println("   === 有授权信息");
                }
 
                if (lstRight == null)
                    isHasRight = false;
                else{
                    if (lstRight.size() > 0)
                        isHasRight = true;
//                    for (int j = 0; j < lstRight.size(); j++) {
//                        long lRight = lstRight.get(j).getRightValue();
//                        if (lRight != 0){
//                            isHasRight = true;
//                            //System.out.println("      === 有授权");
//                            
//                            break;
//                        }
//                    }
                }
            }
            
            if (!isHasRight) {
                continue;
            }
            String cparentId = func.getParentId();
            
            //System.out.println("####==== ParentId=" + cparentId + "; Func=" + func.getName());
            List<FunctionObject> lstFunc = null;
            if (map.containsKey(cparentId)) {
                lstFunc = map.get(cparentId);
            } else {
                lstFunc = new ArrayList<FunctionObject>();
            }
            lstFunc.add(func);
            map.put(cparentId, lstFunc);
        }
        return map;
    }
    
    public static Map<String, List<FunctionObject>> getAllChildrenFunctionsByUserNameV2(String parentId, String userName, RoleRightObject[] currentUserRoleRights) {
        Map<String, List<FunctionObject>> map = new LinkedHashMap<String, List<FunctionObject>>();
 
        try{
            FunctionObject[] functions = new FunctionClientDelegate().getModuleListByParentId(parentId, true);
            
            for (int i = 0; i < functions.length; i++){
                String cparentId = functions[i].getParentId();
                List<FunctionObject> clist = null;
                if (map.containsKey(cparentId)) {
                    clist = map.get(cparentId);
                } else {
                    clist = new ArrayList<FunctionObject>();
                }
                clist.add(functions[i]);
                map.put(cparentId, clist);
                
                getSubChildrenFunctions(functions[i].getId(), userName, map);
            }
            
            return map;
        }  catch (VCIException e) {
            e.printStackTrace();
            VCIOptionPane.showError(LogonApplication.frame, LocaleDisplay.getI18nString(e, "RMIPFramework", Locale.getDefault()));
        }
        return map;
        
        
        /*FunctionObject[] AllFunction = getFunctionsByParentId(parentId, userName);
        Map<String, List<FunctionObject>> map = new LinkedHashMap<String, List<FunctionObject>>();
        boolean isAllShow = RightControlUtil.isDeveloper(userName) || RightControlUtil.isAdmin(userName) || !isFunctionSwithOn();
        boolean isHasRight = false;
        for (int i = 0; i < AllFunction.length; i++) {
            isHasRight = false;
            if (isAllShow) {
                isHasRight = true;
            } else {
                for (int j = 0; j < currentUserRoleRights.length; j++) {
                    if (currentUserRoleRights[j].getFuncId().equals(AllFunction[i].getId())) {
                        long lRight = currentUserRoleRights[j].getRightValue();
                        if (lRight != 0){
                            isHasRight = true;
                            break;
                        }
                    }
 
                    //isHasRight = true;
                    //break;
                }
            }
            if (!isHasRight) {
                continue;
            }
            String cparentId = AllFunction[i].getParentId();
            List<FunctionObject> clist = null;
            if (map.containsKey(cparentId)) {
                clist = map.get(cparentId);
            } else {
                clist = new ArrayList<FunctionObject>();
            }
            clist.add(AllFunction[i]);
            map.put(cparentId, clist);
        }
        return map;*/
    }
    
    public static void getSubChildrenFunctions(String parentId, String userName, Map<String, List<FunctionObject>> map) {
 
        try{
            FunctionObject[] functions = new FunctionClientDelegate().getModuleListByParentId(parentId, true);
            
            for (int i = 0; i < functions.length; i++){
                String cparentId = functions[i].getParentId();
                List<FunctionObject> clist = null;
                if (map.containsKey(cparentId)) {
                    clist = map.get(cparentId);
                } else {
                    clist = new ArrayList<FunctionObject>();
                }
                clist.add(functions[i]);
                map.put(cparentId, clist);
                
                getSubChildrenFunctions(functions[i].getId(), userName, map);
            }
        } catch (VCIException e) {
            e.printStackTrace();
            VCIOptionPane.showError(LogonApplication.frame, LocaleDisplay.getI18nString(e, "RMIPFramework", Locale.getDefault()));
        }
        
        
        /*FunctionObject[] AllFunction = getFunctionsByParentId(parentId, userName);
        Map<String, List<FunctionObject>> map = new LinkedHashMap<String, List<FunctionObject>>();
        boolean isAllShow = RightControlUtil.isDeveloper(userName) || RightControlUtil.isAdmin(userName) || !isFunctionSwithOn();
        boolean isHasRight = false;
        for (int i = 0; i < AllFunction.length; i++) {
            isHasRight = false;
            if (isAllShow) {
                isHasRight = true;
            } else {
                for (int j = 0; j < currentUserRoleRights.length; j++) {
                    if (currentUserRoleRights[j].getFuncId().equals(AllFunction[i].getId())) {
                        long lRight = currentUserRoleRights[j].getRightValue();
                        if (lRight != 0){
                            isHasRight = true;
                            break;
                        }
                    }
 
                    //isHasRight = true;
                    //break;
                }
            }
            if (!isHasRight) {
                continue;
            }
            String cparentId = AllFunction[i].getParentId();
            List<FunctionObject> clist = null;
            if (map.containsKey(cparentId)) {
                clist = map.get(cparentId);
            } else {
                clist = new ArrayList<FunctionObject>();
            }
            clist.add(AllFunction[i]);
            map.put(cparentId, clist);
        }
        return map;*/
    }
    
    /**
     * 判断功能权限是否开启
     * @return
     */
    public static boolean isFunctionSwithOn() {
        String functionRightSwith = ConfigUtils.getConfigValue("function.right.swith");
        if(functionRightSwith != null && "on".equalsIgnoreCase(functionRightSwith)){
            return true;
        }
        
        return false;
    }
    
    /**
     * 判断UI权限是否开启
     * @return
     */
    public static boolean isUIRightSwithOn() {
        String functionRightSwith = ConfigUtils.getConfigValue("ui.right.swith");
        if(functionRightSwith != null && "on".equalsIgnoreCase(functionRightSwith)){
            return true;
        }
        
        return false;
    }
    
    /**
     * 获取当前用户的权限
     * @param parentId
     * @param userName
     * @return
     */
    public static RoleRightObject[] getRoleRightByUserName(String userName){
        RoleRightObject[] roleRightObjs = null;
        try {
            roleRightObjs = new RoleRightClientDelegate().getRoleRightByUserName(userName);
        } catch (VCIException e) {
            e.printStackTrace();
            VCIOptionPane.showError(LogonApplication.frame, LocaleDisplay.getI18nString(e, "RMIPFramework", Locale.getDefault()));
        }
        return roleRightObjs;
    }
    
    public static Map<String, List<RoleRightObject>> getRoleRightMapByUserName(String userName){
        Map<String, List<RoleRightObject>> mapRight = new HashMap<String, List<RoleRightObject>>();
        try {
            RoleRightObject[] rights = new RoleRightClientDelegate().getRoleRightByUserName(userName);
            for (RoleRightObject right : rights)
            {
                if (!mapRight.containsKey(right.getFuncId()))
                    mapRight.put(right.getFuncId(), new ArrayList<RoleRightObject>());
                
                mapRight.get(right.getFuncId()).add(right);
            }
        } catch (VCIException e) {
            e.printStackTrace();
            VCIOptionPane.showError(LogonApplication.frame, LocaleDisplay.getI18nString(e, "RMIPFramework", Locale.getDefault()));
        }
        return mapRight;
    }
    
    /**
     * 获取当前用户具有的功能模块权限
     * @param userName
     * @return
     */
    public static RoleRightObject[] getFunctionRoleRightByUserName(String userName){
        RoleRightObject[] roleRightObjs = null;
        try {
            roleRightObjs = new RoleRightClientDelegate().getFunctionRoleRightByUserName(userName);
        } catch (VCIException e) {
            e.printStackTrace();
            VCIOptionPane.showError(LogonApplication.frame, LocaleDisplay.getI18nString(e, "RMIPFramework", Locale.getDefault()));
        }
        return roleRightObjs;
    }
    
    public static Map<String, List<RoleRightObject>> getFunctionRoleRightMapByUserName(String userName){
        Map<String, List<RoleRightObject>> mapRight = new HashMap<String, List<RoleRightObject>>();
        try {
            RoleRightObject[] rights = new RoleRightClientDelegate().getFunctionRoleRightByUserName(userName);
            for (RoleRightObject right : rights)
            {
                if (!mapRight.containsKey(right.getFuncId()))
                    mapRight.put(right.getFuncId(), new ArrayList<RoleRightObject>());
                
                mapRight.get(right.getFuncId()).add(right);
            }
        } catch (VCIException e) {
            e.printStackTrace();
            VCIOptionPane.showError(LogonApplication.frame, LocaleDisplay.getI18nString(e, "RMIPFramework", Locale.getDefault()));
        }
        return mapRight;
    }
    
    /**
     * 获得当前用户权限
     * @param userName
     * @param currentUserRoleRights
     * @return
     */
    public static RoleRightObject[] getRoleRightByUserName(String userName, RoleRightObject[] currentUserRoleRights){
        RoleRightObject[] roleRightObjs = null;
        try {
            if (currentUserRoleRights == null || currentUserRoleRights.length == 0) {
                roleRightObjs = new RoleRightClientDelegate().getRoleRightByUserName(userName);
            } else {
                return currentUserRoleRights;
            }
        } catch (VCIException e) {
            e.printStackTrace();
            VCIOptionPane.showError(LogonApplication.frame, LocaleDisplay.getI18nString(e, "RMIPFramework", Locale.getDefault()));
        }
        return roleRightObjs;
    }
    
    /**
     * 根据模块ID和用户名获取当前用户对当前模块的权限
     * @param funcId
     * @param userName
     * @return
     */
    public static boolean checkOperateRightByModule(String funcId,String identify){
        String userName = LogonApplication.getUserEntityObject().getUserName();
        if(RightControlUtil.isDeveloper(userName)){
            return true;
        }
        try {
            RoleRightObject[] roleRightObjs = new RoleRightClientDelegate().getRoleRightByModule(funcId, userName);
            FuncOperationObject funcOperation = new FuncOperationClientDelegate().getFuncOperationByIdentify(funcId, identify);
            /**modify by ligang 当操作类型为空时,系统取的operNum的值是默认的0,权限加载出错
            *funcOperation为空时,表明操作在该模块中没有配置
            *直接返回fasle,系统不处理
            */
            if("".equals(funcOperation.getId())) {
                return false;
            }
            if (!funcOperation.getIsValid()) {
                return false;
            }
            if(RightControlUtil.isAdmin(userName)){
                return true;
            }
            long operNum = funcOperation.getNumber();
            for(int i = 0;i < roleRightObjs.length;i++){
                if(hasRight(roleRightObjs[i].getRightValue(),operNum)){
                    return true;
                }
            }
        } catch (VCIException e) {
            e.printStackTrace();
            VCIOptionPane.showError(LogonApplication.frame, LocaleDisplay.getI18nString(e, "RMIPFramework", Locale.getDefault()));
        }
        return false;
    }
 
    private static boolean hasRight(long rightValue, long operNum){
        boolean res = false;
        //long preValue = (long)Math.pow(2, operNum);
        long preValue = (rightValue >> operNum) & 1;
        //if(preValue == (rightValue & preValue)){
        if (preValue == 1) {
            res = true;
        }
        return res;
    }
 
    // add by xchao 2012.09.20 统一归整管理员、开发者用户判断
    // 以便将来有可能修改管理员、开发者用户,对于判断依然有效
    private static String userNameAdmin = getValueByKey("user.admin");
    private static String userNameDeveloper = getValueByKey("user.developer");
    private static String userNameRoot = getValueByKey("user.rooter");
    
    public static String getUserNameRoot() {
        return userNameRoot;
    }
    
    public static String getUserNameAdmin() {
        return userNameAdmin;
    }
    
    public static String getUserNameDeveloper() {
        return userNameDeveloper;
    }
    
    public static boolean isAdmin(String userName){
        return userName.equals(getUserNameAdmin());
    }
    
    public static boolean isDeveloper(String userName){
        return userName.equals(getUserNameDeveloper());
    }
    
    public static boolean isRoot(String userName){
        return userName.equals(getUserNameRoot());
    }
    
    public static boolean isAdminOrDeveloperOrRoot(String userName){
        return isAdmin(userName) || isDeveloper(userName)||isRoot(userName);
    }
    
    public static boolean isThreeAdmin(ThreeAdminEnum eType) {
        
        RightManagementClientDelegate delegate = new RightManagementClientDelegate(LogonApplication.getUserEntityObject());
        
        UserObject user = LogonApplication.getUserObject();
        try {
            RoleObject[] roles = delegate.fetchRoleInfoByUserId(user.getId());
            for (RoleObject role : roles) {
                if (eType == ThreeAdminEnum.SYSADMIN && role.getName().equalsIgnoreCase("系统管理员")){
                    return true;
                }
                else if (eType == ThreeAdminEnum.SECADMIN && role.getName().equalsIgnoreCase("安全管理员")){
                    return true;
                }
                else if (eType == ThreeAdminEnum.AUDITADMIN && role.getName().equalsIgnoreCase("审计管理员")){
                    return true;
                }
            }
        } catch (VCIException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        
        return false;
    }
    
    public static boolean isThreeAdmin(String userName, ThreeAdminEnum eType) {
        
        RightManagementClientDelegate delegate = new RightManagementClientDelegate(LogonApplication.getUserEntityObject());
        
        try {
            RoleObject[] roles = delegate.fetchRoleInfoByUserName(userName);
            for (RoleObject role : roles) {
                if (eType == ThreeAdminEnum.SYSADMIN && role.getName().equalsIgnoreCase("系统管理员")){
                    return true;
                }
                else if (eType == ThreeAdminEnum.SECADMIN && role.getName().equalsIgnoreCase("安全管理员")){
                    return true;
                }
                else if (eType == ThreeAdminEnum.AUDITADMIN && role.getName().equalsIgnoreCase("审计管理员")){
                    return true;
                }
            }
        } catch (VCIException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        
        return false;
    }
 
    
    public static boolean isThreeAdminCurUser() {
        
        RightManagementClientDelegate delegate = new RightManagementClientDelegate(LogonApplication.getUserEntityObject());
        
        UserObject user = LogonApplication.getUserObject();
        try {
            RoleObject[] roles = delegate.fetchRoleInfoByUserId(user.getId());
            for (RoleObject role : roles) {
                if (role.getName().equalsIgnoreCase("系统管理员")){
                    return true;
                }
                else if (role.getName().equalsIgnoreCase("安全管理员")){
                    return true;
                }
                else if (role.getName().equalsIgnoreCase("审计管理员")){
                    return true;
                }
            }
        } catch (VCIException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        
        return false;
    }
    
    public static boolean isThreeAdmin(String userName) {
        
        RightManagementClientDelegate delegate = new RightManagementClientDelegate(LogonApplication.getUserEntityObject());
        
        //UserObject user = LogonApplication.getUserObject();
        try {
            RoleObject[] roles = delegate.fetchRoleInfoByUserName(userName);
            for (RoleObject role : roles) {
                if (role.getName().equalsIgnoreCase("系统管理员")){
                    return true;
                }
                else if (role.getName().equalsIgnoreCase("安全管理员")){
                    return true;
                }
                else if (role.getName().equalsIgnoreCase("审计管理员")){
                    return true;
                }
            }
        } catch (VCIException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        
        return false;
    }
    
    private static String getValueByKey(String key){
        String res = "";
        try{
            res = new SystemCfgClientDelegate().getConfigValue(key);
        }catch(VCIException ex){
            ex.printStackTrace();
        }
        return res;
    }
}