audit_flow_process.go 3.3 KB
package models

import (
	"time"

	"github.com/astaxie/beego/orm"
)

type AuditFlowProcess struct {
	Id             int64     `orm:"column(id);pk" description:"唯一标识"`
	ChanceId       int64     `orm:"column(chance_id)" description:"实例id,关联chance表id"`
	Uid            int64     `orm:"column(uid)" description:"用户id(审批人)"`
	Level          int       `orm:"column(level)" description:"审批步骤"`
	IsActive       int8      `orm:"column(is_active)" description:"是否激活"`
	ApproveTime    time.Time `orm:"column(approve_time);type(timestamp);null" description:"审批时间"`
	BasicScore     float64   `orm:"column(basic_score);null;digits(4);decimals(1)" description:"基础评分"`
	ExtraScore     float64   `orm:"column(extra_score);null;digits(4);decimals(1)" description:"附加评分"`
	ValueScore     float64   `orm:"column(value_score);null;digits(4);decimals(1)" description:"价值评分"`
	DiscoveryScore float64   `orm:"column(discovery_score);null;digits(4);decimals(0)" description:"发现评分"`
	ReviewStatus   int8      `orm:"column(review_status)" description:"审核状态 审核状态 0:待处理 1:待审核 2:被退回 3:已通过 4:提交  "`
	AuditFlowType  int       `orm:"column(audit_flow_type)" description:"审核流类型 1.部门长 2.指定成员 3.指定角色 4.特殊审核人"`
	FlowType       int       `orm:"column(flow_type)" description:"审批类型 1:正常审核  2:特殊审核"`
	ActionType     int       `orm:"column(action_type)" description:"审批执行方式【1:or】【2:and】"`
	CreateAt       time.Time `orm:"column(create_at);type(timestamp)" description:"创建时间"`
	UpdateAt       time.Time `orm:"column(update_at);type(timestamp)" description:"更新时间"`
	EnableStatus   int8      `orm:"column(enable_status)" description:"有效状态 0:无效 1:有效 (被驳回以后,未完成的审核置为无效)"`
	ApproveData    string    `orm:"column(approve_data);size(500);null" description:"审核数据 json{公开状态 公开对象 分数}"`
	UserName       string    `orm:"column(user_name);size(50);null" description:"用户名-冗余"`
	RoleName       string    `orm:"column(role_name);size(50);null" description:"角色名-冗余"`
	RoleId         int       `orm:"column(role_id);null" description:"角色id-冗余"`
	ApproveMessage string    `orm:"column(approve_message);size(255);null" description:"审核消息-冗余"`
	TemplateId     int       `orm:"column(template_id);null" description:"模板编号"`
}

func (t *AuditFlowProcess) TableName() string {
	return "audit_flow_process"
}

func init() {
	orm.RegisterModel(new(AuditFlowProcess))
}

//有效状态 0:无效 1:有效 (被驳回以后,未完成的审核置为无效)
const (
	AuditFlowProcessEnableYes int = 1
	AuditFlowProcessEnableNo  int = 0
)

//审核状态 审核状态 0:待处理 1:待审核 2:被退回 3:已通过 4:提交
const (
	AuditFlowProcessReviewWait   int = 0
	AuditFlowProcessReviewIng    int = 1
	AuditFlowProcessReviewBack   int = 2
	AuditFlowProcessReviewPass   int = 3
	AuditFlowProcessReviewCommit int = 4
)

// GetAuditFlowProcessById retrieves AuditFlowProcess by Id. Returns error if
// Id doesn't exist
func GetAuditFlowProcessById(id int64) (v *AuditFlowProcess, err error) {
	o := orm.NewOrm()
	v = &AuditFlowProcess{Id: id}
	if err = o.Read(v); err == nil {
		return v, nil
	}
	return nil, err
}