package aiyh.utils.zwl.common; import weaver.common.StringUtil; import weaver.conn.RecordSetTrans; import weaver.general.Util; import weaver.hrm.User; import weaver.interfaces.workflow.action.Action; import weaver.soa.workflow.request.RequestInfo; import weaver.workflow.request.RequestManager; /** * 自定义Action实现类,添加通用参数 * @author bleach * @date 2019-10-09 * @version 1.0 */ public abstract class CusBaseAction extends ToolUtil implements Action { //当前类名称 private String className = this.getClass().getName(); protected RequestInfo requestInfo;//流程请求信息实体类 protected RecordSetTrans rsts = null;//流程操作事务数据集 protected String tablename;//当前流程表单名称 protected String requestId;//流程请求ID protected String workflowId;//流程类型ID protected User user = null;//当前用户 protected int creater = -1;//流程创建人ID protected RequestManager reqManager = null; protected String[] baseArray = new String[3]; protected abstract String handle();//Action 具体操作 /** * 实现父类方法 * * @param requestInfo requestInfo对象 * @return string类型的数据 */ @Override public String execute(RequestInfo requestInfo) { this.requestInfo = requestInfo; this.rsts = requestInfo.getRsTrans(); if (this.rsts == null) { rsts = new RecordSetTrans(); } this.initParam(); return handle(); } /** * 初始化常用参数 */ private void initParam() { this.requestId = StringUtil.vString(requestInfo.getRequestid()); this.workflowId = StringUtil.vString(requestInfo.getWorkflowid()); this.reqManager = requestInfo.getRequestManager(); this.user = reqManager.getUser(); this.creater = reqManager.getCreater(); this.tablename = requestInfo.getRequestManager().getBillTableName(); //通过系统请求管理类获取表单名称失败,再次查询 if ("".equals(this.tablename)) { tablename = getBillTableNameByWorkflowId(this.workflowId); } //获取流程基础数据 String select_base_sql = "select * from workflow_requestbase where requestid = ?"; try { if (rsts == null) { rsts = new RecordSetTrans(); } String request_name = ""; String request_mark = ""; if (rsts.executeQuery(select_base_sql, requestId)) { while (rsts.next()) { request_name = Util.null2String(rsts.getString("requestname")); request_mark = Util.null2String(rsts.getString("requestmark")); } } baseArray[0] = this.requestId; baseArray[1] = request_name; baseArray[2] = request_mark; this.writeNewDebuggerLog(className, "main_requestname:[" + request_name + "],main_requestmark:[" + request_mark + "],workflowid:[" + workflowId + "],requestid:[" + requestId + "],tablename:[" + tablename + "]"); } catch (Exception e1) { // TODO Auto-generated catch block e1.printStackTrace(); this.writeNewDebuggerLog(className, "get workflow dataset error:[" + e1.getMessage() + "/" + e1.toString() + "]"); } } }