getCurrentNodeType.jsp 3.83 KB
<%--
  Created by IntelliJ IDEA.
  User: zhaiyaqi
  Date: 2020/3/15
  Time: 7:34 PM
  To change this template use File | Settings | File Templates.
--%>
<%@ page import="com.alibaba.fastjson.JSON" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="org.apache.commons.logging.Log" %>
<%@ page import="org.apache.commons.logging.LogFactory" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="java.io.ByteArrayOutputStream" %>
<%@ page import="java.io.InputStream" %>
<%@ page import="weaver.general.BaseBean" %>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="com.alibaba.fastjson.JSONArray" %>
<%@ page import="weaver.conn.RecordSetDataSource" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="kry.sql.util.StringUtil" %>
<%@ page import="java.util.Collections" %>
<%@ page import="emo.macro.ob.OB" %>
<%@ page import="java.util.Vector" %>
<%@ page import="java.math.BigDecimal" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    response.setContentType("application/json;charset=utf-8");
    out.clear();
    writeLog("【开始调用调拨获取当前节点接口】:");
    JSONObject result = new JSONObject(true);
    result.put("code", -1);
    String nodeId = null;
    try {
         nodeId = request.getParameter("nodeId");
        writeLog("接收参数: nodeId:"+nodeId);
      if (nodeId.equals("")){
          result.put("message", "传递参数为空");
          out.print(result.toJSONString());
          return ;
      }
    } catch (Exception e) {
        e.printStackTrace();
        result.put("message", "获取参数异常");
        out.print(result.toJSONString());
        return;
    }
    RecordSet rs = new RecordSet();
    String sql= "";
    sql = "select NODETYPE as nodeType from workflow_flownode where NODEID = '"+nodeId+"'";
    rs.execute(sql);
    while (rs.next()){
        String nodeType = rs.getString("nodeType");
        writeLog("节点信息 nodeType = "+nodeType);
        result.put("code", 0);
        result.put("message", "获取节点信息成功");
        result.put("nodeType", nodeType);
        out.print(result.toJSONString());
    }
%>
<%!
    private void writeLog(Object o) {
        Log var3 = LogFactory.getLog(this.getClass().getName());
        if(o instanceof Exception) {
            var3.info(this.getClass().getName(), (Exception)o);
        } else {
            var3.info(o);
        }
    }

    /**
     * 组装完整对象
     * @param columnNames
     * @param array
     * @return
     */
    public JSONObject getCompleteObject(String[] columnNames,JSONArray array){
        JSONObject object = new JSONObject();
        for (int j=0;j<array.size();j++){
            object.put(columnNames[j],array.get(j));
        }
        return object;

    }

    private String getGDZCKPH(String id) {
        if (id.equals("")) {
            return "";
        }
        RecordSetDataSource rsds = new RecordSetDataSource("HERP");
        String sql;
        sql = "select GDZCKPH from UF_GDZCB where id=" + id;
        rsds.execute(sql);
        rsds.next();
        return Util.null2String(rsds.getString("GDZCKPH"));
    }

    private String getLastName(String id) {
        RecordSet rs = new RecordSet();
        String sql;
        sql = "select lastname from hrmresource where id=" + id;
        rs.execute(sql);
        rs.next();
        return Util.null2String(rs.getString(1));
    }

    private byte[] readInputStream(InputStream inStream) throws Exception {
        ByteArrayOutputStream outSteam = new ByteArrayOutputStream();
        byte[] buffer = new byte[1024];
        boolean var3 = false;

        int len;
        while((len = inStream.read(buffer)) != -1) {
            outSteam.write(buffer, 0, len);
        }

        outSteam.close();
        inStream.close();
        return outSteam.toByteArray();
    }
%>