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);
|
}
|
}
|
}
|
}
|
}
|