zm
2020-05-18 a18bfacbf56b401f6e0fdae8710fbca4df8cff77
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
package cn.autoform.db.entity;
 
 
import java.util.ArrayList;
import java.util.List;
 
import cn.autoform.bean.ProcessState;
import cn.autoform.util.tool.JSONTool;
 
public class CustomButtonExtend{
    //扩展预算ID
    static final String buttonId = "q";
    //票库上传ID
    static final String buttonId1 = "bill_upload";
    //查看票据ID
    static final String buttonId2 = "showPic";
    //状态吗
    static final String TEN = "10";
    //记账按钮
    static final String ACCOUNT = "account";
    //审批成功
    static final String S = "30";
    //记账失败状态 
    static final String A = "49";
    /**
     * 添加工具栏 
     */
    private List<CustomButtonEntity> addCustomButton = new ArrayList<>();
    
    /**
     * 修改工具栏 
     */
    private List<CustomButtonEntity> updateCustomButton = new ArrayList<>();
    
    /**
     * 详细工具栏 
     */
    private List<CustomButtonEntity> detailedCustomButton = new ArrayList<>();
    
    /**
     * 列表工具栏 
     */
    private List<CustomButtonEntity> listCustomButton = new ArrayList<>();
 
    public List<CustomButtonEntity> getAddCustomButton() {
        return addCustomButton;
    }
 
    public void setAddCustomButton(List<CustomButtonEntity> addCustomButton) {
        this.addCustomButton = addCustomButton;
    }
 
    public List<CustomButtonEntity> getUpdateCustomButton() {
        return updateCustomButton;
    }
 
    public void setUpdateCustomButton(List<CustomButtonEntity> updateCustomButton) {
        this.updateCustomButton = updateCustomButton;
    }
 
    public List<CustomButtonEntity> getDetailedCustomButton() {
        return detailedCustomButton;
    }
 
    public void setDetailedCustomButton(List<CustomButtonEntity> detailedCustomButton) {
        this.detailedCustomButton = detailedCustomButton;
    }
 
    public List<CustomButtonEntity> getListCustomButton() {
        return listCustomButton;
    }
 
    public void setListCustomButton(List<CustomButtonEntity> listCustomButton) {
        this.listCustomButton = listCustomButton;
    }
    
    public void subCustomButton(List<CustomButtonEntity> list,ProcessState state,String setting){
//        System.err.println(state.getProcessState());
        System.out.println("所有自定义按钮:"+JSONTool.toJson(list));
        if(list !=null){
            for(CustomButtonEntity cust : list){
                if(cust.getType()!=null && cust.getType().equals("TJ")){//提交
                    this.addCustomButton.add(cust);
//                }else if(cust.getType()!=null && cust.getType().equals("XG")){//修改
//                    this.updateCustomButton.add(cust);
                }else if(cust.getType()!=null && (cust.getType().equals("XX") || cust.getType().equals("XG"))){//详细
                    //判断是否是表单设置页面传来的请求
                    if(!setting.equals("1")){
                        //根据判断是否是自动审单中, 是否启用   票据上传按钮
                            if(cust.getButtonId()!=null&&cust.getButtonId().equals(buttonId1)){
                                if(state==null || !TEN.equals(state.getProcessState())){
                                    continue;
                                }
                                if((state!=null && TEN.equals(state.getOrderStatus()))
                                        ||state.getOrderCode()!=null){
                                    System.err.println(111);
                                    continue;
                                    }
                                
                        }
                        //根据按钮的状态码 和 表单状态码 比较, 什么时候显示扩展预算
                        if(cust.getButtonId()!=null&&cust.getButtonId().equals(buttonId)){
                            //System.err.println("0000"+!cust.getButState().contains(state.getProcessState()));
                            if(state!=null&&cust.getButState()!=null&&!S.equals(state.getProcessState())){
                                continue;
                            }
                        }
                        //根据判断rdercode 是否启用查看票据
                        if(cust.getButtonId()!=null&&cust.getButtonId().equals(buttonId2)){
                            if(state==null || state.getOrderCode()==null || "".equals(state.getOrderCode())){
                                continue;
                            }
                        }
                        //判断添加记账按钮
                        if(cust.getButtonId()!=null && cust.getButtonId().equals(ACCOUNT)){
                            if(state!=null && !A.equals(state.getOrderStatus())){
                                continue;
                            }
                        }
                    }
                    if(cust.getType().equals("XG")){
                        this.updateCustomButton.add(cust);
                    }else{
                        this.detailedCustomButton.add(cust);
                    }
                    
                }else if(cust.getType()!=null && cust.getType().equals("LB")){//列表
                    this.listCustomButton.add(cust);
                }
            }
        }
    }
}