pathinfopcoessimpl.java
来自「公司自己开发的工作流引擎」· Java 代码 · 共 986 行 · 第 1/3 页
JAVA
986 行
package cn.com.iaspec.workflow.helper.pathinfo;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.JspException;
import javax.servlet.http.HttpSession;
import javax.servlet.jsp.tagext.Tag;
import cn.com.iaspec.workflow.vo.workflow.NextActivityInfo;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspWriter;
import cn.com.iaspec.workflow.vo.workflow.UserInfo;
import java.util.List;
import cn.com.iaspec.workflow.helper.WorkflowHelper;
import cn.com.iaspec.workflow.util.FlowWebKeys;
import org.apache.log4j.Logger;
import java.util.HashMap;
import cn.com.iaspec.workflow.helper.OrganizationHelper;
import java.util.ArrayList;
import java.util.Set;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Iterator;
import cn.com.iaspec.workflow.vo.workflow.ActivityAgenInfo;
import cn.com.iaspec.workflow.organize.tree.SelectActorTree;
import java.util.Vector;
import cn.com.iaspec.workflow.helper.SystemConfigurations;
import cn.com.iaspec.workflow.vo.db.WfUser;
import cn.com.iaspec.workflow.vo.workflow.SelectActorParam;
import cn.com.iaspec.workflow.util.ConvertWorkitemDatetime;
import cn.com.iaspec.workflow.helper.SysManageHelper;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2006</p>
*
* <p>Company: iASPEC Technologies</p>
*
* @author xiesonglin
* @version 1.5
*/
public class PathInfoPcoessImpl
implements PathInfoPcoessInterface{
private static Logger logger=Logger.getLogger(PathInfoPcoessInterface.class);
private static String WF_TABLE_STYLE_CLASS="WF_TABLE_STYLE_CLASS";
private static String WF_TR_STYLE_CLASS="WF_TR_STYLE_CLASS";
private static String WF_TD_STYLE_CLASS="WF_TD_STYLE_CLASS";
private static String WF_SELECT_STYLE_CLASS="WF_SELECT_STYLE_CLASS";
private static String WF_SELECT_SPAN_STYLE_CLASS="WF_SELECT_SPAN_STYLE_CLASS";
private static String WF_TEXT_STYLE_CLASS="WF_TEXT_STYLE_CLASS";
private static String WF_CHECKBOX_STYLE_CLASS="WF_CHECKBOX_STYLE_CLASS";
public PathInfoPcoessImpl(){
}
public int process(PageContext pageContext)
throws JspException{
long startTime=System.currentTimeMillis();
logger.info("begin doEndTag...");
JspWriter out=pageContext.getOut();
HttpServletRequest request=(HttpServletRequest)pageContext.getRequest();
//取得工作项id
String workItemId="";
if(request.getAttribute("wf_workitem_id")!=null){
workItemId=(String)request.getAttribute("wf_workitem_id");
}
else{
workItemId=(String)request.getParameter("wf_workitem_id");
}
//取得项目id
String projectId="";
if(request.getAttribute("wf_project_id")!=null){
projectId=(String)request.getAttribute("wf_project_id");
}
else{
projectId=(String)request.getParameter("wf_project_id");
}
//取得申诉登记号
String businessId="";
if(request.getAttribute("wf_business_id")!=null){
businessId=(String)request.getAttribute("wf_business_id");
}
else{
businessId=request.getParameter("wf_business_id")==null?"":
request.getParameter("wf_business_id");
}
//是否是启动工作流
String startWorkflowTag=request.getParameter("wf_start_workflow_tag")==null?
"0":request.getParameter("wf_start_workflow_tag");
//取得用户信息
HttpSession session=request.getSession(false);
UserInfo userInfo=(UserInfo)session.getAttribute(FlowWebKeys.USER_SESSION);
if(workItemId==null||workItemId.equals("")){
throw new JspException("工作项id为空");
}
//取得父流程实例id
String parentProInstId="";
if(request.getAttribute("wf_parent_process_instance_id")!=null){
parentProInstId=(String)request.getAttribute(
"wf_parent_process_instance_id");
}
else{
parentProInstId=(String)request.getParameter(
"wf_parent_process_instance_id");
}
//取得辅助子流程标识
String aidSubflowTag="";
if(request.getAttribute("wf_aid_subflow_tag")!=null){
aidSubflowTag=(String)request.getAttribute("wf_aid_subflow_tag");
}
else{
aidSubflowTag=(String)request.getParameter("wf_aid_subflow_tag");
}
//取得所属行政区
String caseAreaId="02";
NextActivityInfo nextInfo=null;
WorkflowHelper helper=new WorkflowHelper();
try{
//检出工作项
helper.checkOutWorkItem(userInfo,Long.parseLong(workItemId));
//取得当前及下一活动信息
//返回活动节点的对象NextActivityInfod对象(根据userinfo和工作项的ID:workItemID查询)
nextInfo=helper.getNextActivityInfo(userInfo,Long.parseLong(workItemId));
}
catch(Exception ex){
throw new JspException(ex.getMessage());
}
try{
if(nextInfo==null){
out.println("没有取到流向信息。");
return Tag.EVAL_PAGE;
}
//取得当前结点的流程实例ID
long pro_instance_id=0;
//取得活动实例ID
long activity_instance_id=0;
if(nextInfo!=null){
pro_instance_id=nextInfo.getProcInstID();
activity_instance_id=nextInfo.getActivityInstanceID();
}
out.println("<span style=\"display:none\">");
out.println("<input type=\"hidden\" name=\"wf_project_id\" value=\""+
projectId+"\">");
out.println(
"<input type=\"hidden\" name=\"wf_curr_activity_name\" value=\""+
nextInfo.getActivityName().trim()+"\">");
out.println("<input type=\"hidden\" name=\"wf_workitem_id\" value=\""+
workItemId+"\">");
out.println("<input type=\"hidden\" name=\"wf_business_id\" value=\""+
businessId+"\">");
out.println(
"<input type=\"hidden\" name=\"wf_start_workflow_tag\" value=\""+
startWorkflowTag+"\">");
out.println(
"<input type=\"hidden\" name=\"wf_process_instance_id\" value=\""+
pro_instance_id+"\">");
out.println(
"<input type=\"hidden\" name=\"wf_activity_instance_id\" value=\""+
activity_instance_id+"\">");
out.println(
"<input type=\"hidden\" name=\"wf_parent_process_instance_id\" value=\""+
parentProInstId+"\">");
out.println("<input type=\"hidden\" name=\"wf_aid_subflow_tag\" value=\""+
aidSubflowTag+"\">");
out.println("<input type=\"hidden\" name=\"case_area_id\" value=\""+
caseAreaId+"\">");
String fromRecord=request.getParameter("wf_from_workitem_record")==null?
"0":request.getParameter("wf_from_workitem_record");
out.println("</span>");
if(fromRecord!=null&&fromRecord.equals("1")){
return Tag.EVAL_PAGE;
}
out.println("<table class=\""+WF_TABLE_STYLE_CLASS+"\" width=\"100%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">");
//取的流向选择方式(多选,单选,隐藏)
String selectElementType="radio";
if(nextInfo.getAtd_split()==2){
selectElementType="checkbox";
}
//设置“处理”行显示样式
String flowPathColStyle="display:";
//设置"办理人"行显示样式
String processColStyle="display:";
int colSpan=2;
request.setAttribute("selectElementType",
Integer.toString(nextInfo.getAtd_split()));
List nextList=nextInfo.getNextActivity();
HashMap actActorMap=getActivityActorInfo(nextInfo,userInfo,caseAreaId);
HashMap actorSelectParam=this.getActSelectActorParam(nextInfo);
if(nextList!=null&&nextList.size()>0){
//取得流向显示方式
colSpan=nextList.size()+1;
String flowShowStyle=getFlowShowStyle(nextInfo,actActorMap,
actorSelectParam);
//自动隐藏
if(flowShowStyle.equals("auto:hide")){
//设置“处理”行隐藏
flowPathColStyle="display:none";
//设置“办理人”行隐藏
processColStyle="display:none";
selectElementType="hidden";
colSpan=2;
}
//自动显示
else if(flowShowStyle.equals("auto:show")){
}
//隐藏流向名称
else if(flowShowStyle.equals("auto:hide_act_name")){
//设置“处理”行隐藏
flowPathColStyle="display:none";
selectElementType="hidden";
colSpan=2;
}
//只显示一个流向
else if(flowShowStyle.equals("auto:show:single")){
colSpan=2;
}
//显示
else if(flowShowStyle.equals("show")){
}
//隐藏
else if(flowShowStyle.equals("hide")){
//设置“处理”行隐藏
flowPathColStyle="display:none";
//设置“办理人”行隐藏
processColStyle="display:none";
selectElementType="hidden";
colSpan=2;
}
//"处理"行-------------------------------------------
//流向处理元素
String pathInfoEml=getPathInfoElements(selectElementType,flowShowStyle,
nextInfo,actActorMap,actorSelectParam);
out.println("<tr class=\""+WF_TR_STYLE_CLASS+"\" style=\""+
flowPathColStyle+"\">");
out.println("<td width=\"60\" height=\"25\" align=\"right\" class=\""+
WF_TD_STYLE_CLASS+"\" >处 理:</td>");
out.println("<td>");
out.println("<table width=\"100%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">");
out.println("<tr width=\"100%\">");
out.println(pathInfoEml);
out.println("<td class=\""+WF_TD_STYLE_CLASS+"\"> </td>");
out.println("</tr>");
out.println("</table>");
out.println("</td>");
out.println("</tr>");
//"办理人"行----------------------------------------
out.println("<tr class=\""+WF_TR_STYLE_CLASS+"\" style=\""+
processColStyle+"\">");
out.println("<td width=\"60\" height=\"25\" align=\"right\" class=\""+
WF_TD_STYLE_CLASS+
"\"><span id=\"wf_process_actor_span_id\" style=\"display:\">办理人:</span></td>");
//out.println("<td colspan=\""+colSpan+"\" class=\""+WF_TD_STYLE_CLASS+"\">");
out.println("<td class=\""+WF_TD_STYLE_CLASS+"\">");
for(int j=0;j<nextList.size();j++){
String spanStyle="display:none";
String defaultSelect=nextInfo.getActParamValueByName("defaultSelect");
if(j==0&&(flowShowStyle.equals("auto:hide_act_name")||
flowShowStyle.equals("auto:show:single")||
defaultSelect.equals("yes"))){
spanStyle="display:";
}
NextActivityInfo actInfo=(NextActivityInfo)nextList.get(j);
String uid=actInfo.getUid();
//如果是嵌套子流程,则取得子流程的首节点信息
if(actInfo.getActType()==2&&actInfo.getFirstNestingActivity()!=null){
NextActivityInfo subflowInfo=actInfo.getFirstNestingActivity();
//取得嵌套活动第一个节点的信息
uid=subflowInfo.getUid();
}
ArrayList actorList=(ArrayList)actActorMap.get(uid);
SelectActorParam actorParam=(SelectActorParam)actorSelectParam.get(
uid);
//选择人员元素
String selectActorElm=this.getActorElements(nextInfo,
actInfo.getActivityID(),actorParam,actorList,
request.getContextPath());
//办理时限元素
String timeLimitElements=this.getTimeLimitElements(nextInfo,
actInfo.getActivityID());
//签收元素
String signInElements=this.getSignInElements(nextInfo,
actInfo.getActivityID());
out.println(
"<span align=\"left\" id=\"act_process_span\" tag_value=\""+
actInfo.getActivityID()+"\" style=\""+spanStyle+"\">");
out.println(selectActorElm);
out.println(timeLimitElements);
out.println(signInElements);
out.println("</span>");
}
out.println("</tr");
out.println("</table>");
out.println("<span style=\"display:none\"><input type=\"hidden\" name=\"flow_show_style\" value=\""+
flowShowStyle+"\"></span>");
}
out.println("</table>");
}
catch(Exception ex){
throw new JspException(ex);
}
logger.info("Execution process cost time:"+(System.currentTimeMillis()-
startTime)+" ms.");
return Tag.EVAL_PAGE;
}
/**
* 在列表中取得type类型的节点个数
* @param treeList ArrayList
* @param type String
* @return int
*/
private int getActorCount(ArrayList treeList,String type){
int count=0;
if(treeList!=null&&treeList.size()>0){
for(int i=0;i<treeList.size();i++){
SelectActorTree treeNode=(SelectActorTree)treeList.get(i);
if(type.equals(treeNode.getTreeType())){
count++;
}
}
}
return count;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?