package com.engine.htsc.doc.util;

import weaver.conn.RecordSet;
import weaver.general.BaseBean;

/**
 * 公文看阅流程工具类
 */
public class WorkFlowUtil {

    private static RecordSet rs = new RecordSet();
    private static BaseBean bb = new BaseBean();

    /**
     * 获取正文pdf
     * @param requestId
     */
    public static Integer getZwpdfDocid(String requestId) {

        bb.writeLog("WorkFlowUtil requestid :"+requestId);
        //根据requestid获取流程主表单所在的表名
        rs.executeQuery("select t2.tablename from workflow_requestbase t0,workflow_base t1,workflow_bill t2 where t0.workflowid = t1.id " +
                "and t1.formid = t2.id and  t0.requestid = ?",new Object[]{requestId});

        String tablename = "";
        if(rs.next()){
            tablename = rs.getString("tablename");
        }
        rs.executeQuery("select zwpdf from "+tablename+" where requestid = ?",requestId);
        rs.next();
        return rs.getInt("zwpdf");
    }
}
