<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="weaver.general.BaseBean" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="com.alibaba.fastjson.JSONArray" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"%>

<%!
    private boolean isEmpty(String str) {
        if ("".equals(str) ||"(null)".equals(str) || str == null) {
            return true;
        } else {
            return false;
        }
    }
%>
<%
    RecordSet rs = new RecordSet();
    BaseBean bb=new BaseBean();
    JSONArray array = new JSONArray();
    JSONObject json = new JSONObject();
    bb.writeLog("进入getdeleType.jsp-->");
    String workflowid=request.getParameter("workflowid");
    String nodeid="-1";
    String requestid=request.getParameter("requestid");
    rs.execute("select lastnodeid from workflow_requestbase where requestid = "+requestid);
    if(rs.next()){
        nodeid = rs.getString(1);
    }
    if (!isEmpty(workflowid) && !isEmpty(nodeid)) {
        bb.writeLog("workflowid和nodeid不为空");
        int cnt = 0;
        //查询配置表
        String sczlc = "select COUNT(*) as cnt from uf_sczlc where workflowid=" + workflowid + " and nodeid=" + nodeid;
        bb.writeLog("sczlcSql-->" + sczlc);
        try {
            rs.execute(sczlc);
            bb.writeLog("sczlc查询数据-->");
            if (rs.next()) {
                cnt = rs.getInt("cnt");
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        bb.writeLog("cnt结果-->" + cnt);
        if (cnt>0){
            json.put("code",0);
            json.put("count",cnt);
            array.add(json);
            out.print(array.toJSONString());
        }else {
            json.put("code",1);
            json.put("errMsg","查无此workflowid或nodeid数据");
            array.add(json);
            out.print(array.toJSONString());
        }
    }else {
        json.put("code",1);
        json.put("errMsg","workflowid或nodeid为空");
        array.add(json);
        out.print(array.toJSONString());
    }

%>

