From 45c591ea615e0b841a9f1f86a8bc2fc81f983fef Mon Sep 17 00:00:00 2001 From: liuz Date: Fri, 27 Jul 2018 19:20:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=81=E7=A8=8B=E6=9D=83=E9=99=90=E7=9A=84?= =?UTF-8?q?=E9=85=8D=E7=BD=AE(=E8=BF=9C=E7=A8=8B)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Common/WorkFlow/FlowBackSubmitDialog.jsp | 400 +++++++++--------- .../com/tenwa/flow/task/TenwaFlowTask.java | 134 +++--- 2 files changed, 284 insertions(+), 250 deletions(-) diff --git a/WebContent/Common/WorkFlow/FlowBackSubmitDialog.jsp b/WebContent/Common/WorkFlow/FlowBackSubmitDialog.jsp index 13a72021a..e0b905ef4 100644 --- a/WebContent/Common/WorkFlow/FlowBackSubmitDialog.jsp +++ b/WebContent/Common/WorkFlow/FlowBackSubmitDialog.jsp @@ -1,196 +1,204 @@ -<%@page import="com.amarsoft.are.jbo.ql.Parser"%> -<%@page import="com.amarsoft.biz.workflow.*"%> -<%@page import="com.amarsoft.app.flow.*"%> -<%@page import="com.tenwa.flow.task.*"%> -<%@page import="com.amarsoft.are.lang.StringX"%> -<%@include file="/Frame/resources/include/include_begin.jspf"%> -<%@include file="/Tenwa/Core/FlowManager/BaseFunction/BaseFlowListFunction.jspf" %> -<%@page contentType="text/html; charset=GBK"%> -<% - String taskNo = CurPage.getParameter("TaskNo"); - String applyType = CurPage.getParameter("applyType"); - String phasename = CurPage.getParameter("phasename"); - if(StringX.isSpace(taskNo)) taskNo = ""; - if(StringX.isSpace(applyType)) applyType = ""; - if(StringX.isSpace(phasename)) phasename = ""; - String userID = CurUser.getUserID(); - JBOTransaction tx = JBOFactory.createJBOTransaction(); - TenwaFlowTask ft = new TenwaFlowTask(taskNo, tx);//使用jboTrans - String routeInfo=ft.getFlowRebackInfo(); - String flowNo = ft.FlowNo; - String phaseNo=ft.PhaseNo; - String objectNo=ft.ObjectNo; - String flowState = ft.FlowState; - //会签历史纪录阶段号问题 - tx.commit(); - -%> - -
- - - - - -
<%=new Button("提交","确认提交","javascript:backMethod();","","btn_icon_Submit","").getHtmlText()%><%=new Button("放弃","放弃提交","javascript:doCancel();","","btn_icon_delete","").getHtmlText()%>
-
- -
-
- 请选择退回后提交方式: -
-
- 直接提交退回步骤 - 逐级审批 - -
-
- 请选择退回路径: -
-
- -
-
-
- -
-
- -
-
-
- - - - -
-
- -<%@include file="/Frame/resources/include/include_end.jspf"%> +<%@page import="com.amarsoft.are.jbo.ql.Parser"%> +<%@page import="com.amarsoft.biz.workflow.*"%> +<%@page import="com.amarsoft.app.flow.*"%> +<%@page import="com.tenwa.flow.task.*"%> +<%@page import="com.amarsoft.are.lang.StringX"%> +<%@include file="/Frame/resources/include/include_begin.jspf"%> +<%@include file="/Tenwa/Core/FlowManager/BaseFunction/BaseFlowListFunction.jspf" %> +<%@page contentType="text/html; charset=GBK"%> +<% + String taskNo = CurPage.getParameter("TaskNo"); + String applyType = CurPage.getParameter("applyType"); + String phasename = CurPage.getParameter("phasename"); + if(StringX.isSpace(taskNo)) taskNo = ""; + if(StringX.isSpace(applyType)) applyType = ""; + if(StringX.isSpace(phasename)) phasename = ""; + String userID = CurUser.getUserID(); + JBOTransaction tx = JBOFactory.createJBOTransaction(); + TenwaFlowTask ft = new TenwaFlowTask(taskNo, tx);//使用jboTrans + String routeInfo=ft.getFlowRebackInfo(); + String flowNo = ft.FlowNo; + String phaseNo=ft.PhaseNo; + String objectNo=ft.ObjectNo; + String flowState = ft.FlowState; + //会签历史纪录阶段号问题 + tx.commit(); + +%> + +
+ + + + + +
<%=new Button("提交","确认提交","javascript:backMethod();","","btn_icon_Submit","").getHtmlText()%><%=new Button("放弃","放弃提交","javascript:doCancel();","","btn_icon_delete","").getHtmlText()%>
+
+ +
+
+ 请选择退回后提交方式: +
+
+ 直接提交退回步骤 + 逐级审批 + +
+
+ 请选择退回路径: +
+
+ +
+
+
+ +
+
+ +
+
+
+ + + + +
+
+ +<%@include file="/Frame/resources/include/include_end.jspf"%> diff --git a/src_core/com/tenwa/flow/task/TenwaFlowTask.java b/src_core/com/tenwa/flow/task/TenwaFlowTask.java index 19c1bc885..2657b3f07 100644 --- a/src_core/com/tenwa/flow/task/TenwaFlowTask.java +++ b/src_core/com/tenwa/flow/task/TenwaFlowTask.java @@ -1,12 +1,11 @@ package com.tenwa.flow.task; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import jbo.sys.FLOW_MODEL; -import jbo.sys.FLOW_TASK; - +import com.alibaba.fastjson.JSON; import com.amarsoft.amarscript.Any; import com.amarsoft.amarscript.ELContext; import com.amarsoft.amarscript.Expression; @@ -19,9 +18,13 @@ import com.amarsoft.are.util.json.JSONDecoder; import com.amarsoft.are.util.json.JSONObject; import com.amarsoft.biz.workflow.FlowTask; import com.amarsoft.context.ASUser; +import com.tenwa.comm.util.jboutil.DataOperatorUtil; import com.tenwa.flow.service.FlowUserManageServie; import com.tenwa.flow.service.FlowUserManageServieImp; +import jbo.sys.FLOW_MODEL; +import jbo.sys.FLOW_TASK; + public class TenwaFlowTask extends FlowTask { public JBOTransaction baseTrans = null; @@ -395,69 +398,92 @@ public class TenwaFlowTask extends FlowTask { * @throws Exception */ public String getFlowRebackInfo() throws Exception { - BizObjectManager bm = JBOFactory.getBizObjectManager( - FLOW_MODEL.CLASS_NAME, this.baseTrans); - BizObject bo = bm.createQuery("flowno=:flowno and phaseno=:phaseno") - .setParameter("flowno", this.FlowNo) - .setParameter("phaseno", this.PhaseNo).getSingleResult(false); - String backnexttype = bo.getAttribute("BACKSTEPNEXTTYPE").getString(); - if (backnexttype == "") { - backnexttype = ""; - } - String backSteps = bo.getAttribute("BACKSTEPS").getString(); - String returnMessage = "{\"backnexttype\":\"" + backnexttype - + "\",\"backstept\":["; + Map resultJson = new HashMap(); + BizObjectManager bm = JBOFactory.getBizObjectManager(FLOW_MODEL.CLASS_NAME, this.baseTrans); + BizObject bo = bm.createQuery("flowno=:flowno and phaseno=:phaseno").setParameter("flowno", this.FlowNo).setParameter("phaseno", this.PhaseNo).getSingleResult(false); + String backnexttype = bo.getAttribute("BACKSTEPNEXTTYPE").getString();// backnextCust + String backSteps = bo.getAttribute("BACKSTEPS").getString();// 01申请人发起(0010) + List> backStepList = new ArrayList>(); + resultJson.put("backnexttype", backnexttype); + resultJson.put("backstept", backStepList); String fixedSteps = ""; - if (backSteps.length() > 1) { + if (backSteps != null && backSteps.length() > 1) { fixedSteps = this.getBackStepsByConfig(backSteps); } String sql = ""; + Mapcondition=new HashMap(); if (backSteps.length() <= 1) { - sql = " SELECT O.phaseno,O.phasename FROM O left join jbo.sys.FLOW_MODEL fm on o.phaseno=fm.phaseno and o.flowno=fm.flowno WHERE o.flowno=:flowno and o.objectno='" - + this.ObjectNo + "' "; - sql += "AND O.phaseno<'" - + this.PhaseNo - + "' and fm.ATTRIBUTE7='01' order by O.phaseno DESC,begintime desc"; - + //没有判断退回路径时 + + if(this.ForkState.equals("INFORK")){ + //第一种并行中退回 + sql="select o.phaseno,o.phasename from ("; + sql=sql+ " SELECT * FROM flow_task START WITH serialno =:serialno CONNECT BY PRIOR relativeserialno = serialno "; + sql=sql+" )o left join FLOW_MODEL fm on o.phaseno=fm.phaseno and o.flowno=fm.flowno where to_number(fm.phaseno)'INFORK' OR (nvl(o.forkstate,'e') ='INFORK' and forkno=:forkno) )and fm.ATTRIBUTE7='01' order by begintime"; + condition.put("serialno", this.RelativeSerialNo); + condition.put("forkno", this.ForkNo); + }else{ + //第二种一般路径,不能退回并行中 + sql="select o.phaseno,o.phasename from ( "; + sql=sql+" SELECT * FROM flow_task START WITH serialno =:serialno CONNECT BY PRIOR relativeserialno = serialno "; + sql=sql+" )o left join FLOW_MODEL fm on o.phaseno=fm.phaseno and o.flowno=fm.flowno where to_number(fm.phaseno)'INFORK' and fm.ATTRIBUTE7='01' order by begintime"; + condition.put("serialno", this.RelativeSerialNo); + } } else { - sql = " SELECT O.phaseno,O.phasename FROM O WHERE o.flowno=:flowno and o.objectno='" - + this.ObjectNo + "' "; - sql += "AND O.phaseno in (" + fixedSteps - + ") order by O.phaseno DESC,begintime desc"; + sql = " SELECT O.phaseno,O.phasename FROM flow_task O WHERE o.flowno=:flowno and o.objectno=:objectno "; + sql += "AND O.phaseno in (" + fixedSteps + ") order by O.phaseno DESC,begintime desc"; + condition.put("flowno", this.FlowNo); + condition.put("objectno", this.ObjectNo); } - List bos = JBOFactory - .getBizObjectManager(FLOW_TASK.CLASS_NAME, this.baseTrans) - .createQuery(sql).setParameter("flowno", this.FlowNo) - .getResultList(false); - if (backSteps.length() == 0) { - // 加载退回上一步 - returnMessage += "{\"phaseNo\":\"" - + bos.get(0).getAttribute("phaseno").getString() - + "\",\"phaseName\":\"" - + bos.get(0).getAttribute("phasename").getString() + "\"}"; - } else { + List>bos= DataOperatorUtil.getDataBySql(this.baseTrans,sql,condition); + + BizObjectManager taskManages = JBOFactory.getBizObjectManager(FLOW_TASK.CLASS_NAME, this.baseTrans); + + if(bos.size() == 0 && this.RelativeSerialNo != null) { + BizObject fromTask = null; + if(this.AssignedTaskNo.length() > 0) { + BizObjectQuery fromQuery = taskManages.createQuery("o.flowno=:flowno and o.objectno=:objectno and o.flowstate in ('START','NORMAL') and o.phaseopinion1=:phaseopinion1"); + fromQuery.setParameter("flowno", this.FlowNo); + fromQuery.setParameter("objectno", this.ObjectNo); + fromQuery.setParameter("phaseopinion1", this.PhaseNo); + List result = fromQuery.getResultList(false); + if (result.size() > 0) { + fromTask = result.get(0); + } + } + if(fromTask == null) { + BizObjectQuery fromQuery = taskManages.createQuery("o.SerialNo=:SerialNo and o.objectno=:objectno"); + fromQuery.setParameter("SerialNo", this.RelativeSerialNo); + fromQuery.setParameter("objectno", this.ObjectNo); + fromTask = fromQuery.getSingleResult(false); + } + if(fromTask != null) { + Map step = new HashMap(); + step.put("phaseNo", fromTask.getAttribute("phaseno").getString()); + step.put("phaseName", fromTask.getAttribute("phasename").getString()); + backStepList.add(step); + } + } +// else if (backSteps.length() == 0) { +// // 加载退回上一步 +// Map step = new HashMap(); +// step.put("phaseNo", bos.get(0).getAttribute("phaseno").getString()); +// step.put("phaseName", bos.get(0).getAttribute("phasename").getString()); +// backStepList.add(step); +// } + else { Map tasks = new HashMap(); - int findex = 0; for (int i = 0; i < bos.size(); i++) { - - if (!tasks.containsKey(bos.get(i).getAttribute("phaseno") - .getString())) { - findex++; - if (findex > 1) { - returnMessage += ","; - } - tasks.put(bos.get(i).getAttribute("phaseno").getString(), - ""); - returnMessage += "{\"phaseNo\":\"" - + bos.get(i).getAttribute("phaseno").getString() - + "\",\"phaseName\":\"" - + bos.get(i).getAttribute("phasename").getString() - + "\"}"; + if (!tasks.containsKey(bos.get(i).get("PHASENO"))) { + tasks.put(bos.get(i).get("PHASENO"), ""); + Map step = new HashMap(); + step.put("phaseNo", bos.get(i).get("PHASENO")); + step.put("phaseName", bos.get(i).get("PHASENAME")); + backStepList.add(step); } } } - returnMessage += "]}"; - return returnMessage; + return JSON.toJSONString(resultJson); }