流程提交
This commit is contained in:
parent
d374b0f2e0
commit
75fad0d11e
@ -9,25 +9,21 @@ import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
import jbo.sys.FLOW_MODEL;
|
||||
import apx.com.amarsoft.als.base.flow.FlowTask;
|
||||
|
||||
import com.amarsoft.app.flow.FlowAction;
|
||||
import com.amarsoft.app.lc.workflow.action.GetFlowAction;
|
||||
import com.amarsoft.are.ARE;
|
||||
import com.amarsoft.are.jbo.BizObject;
|
||||
import com.amarsoft.are.jbo.BizObjectManager;
|
||||
import com.amarsoft.are.jbo.JBOException;
|
||||
import com.amarsoft.are.jbo.JBOFactory;
|
||||
import com.amarsoft.are.jbo.JBOTransaction;
|
||||
import com.amarsoft.are.lang.StringX;
|
||||
import com.amarsoft.awe.util.Transaction;
|
||||
import com.amarsoft.context.ASUser;
|
||||
import com.base.constant.RestfullConstant;
|
||||
import com.base.util.BizObjectUtil;
|
||||
import com.base.util.JsonUtil;
|
||||
import com.base.util.MultipartDataUtil;
|
||||
import com.base.util.ReturnMapUtil;
|
||||
import com.tenwa.flow.task.TenwaFlowTask;
|
||||
|
||||
public class DoSubmitService {
|
||||
private String taskNo; // 流水号
|
||||
@ -188,6 +184,8 @@ public class DoSubmitService {
|
||||
public Map<String, Object> doSubmitScanBefore(HttpServletRequest request,
|
||||
Transaction sqlca, JBOTransaction tx, Map<String, Object> fieldMap,
|
||||
ReturnMapUtil ReturnMapUtil) throws Exception {
|
||||
|
||||
|
||||
this.fieldMap = fieldMap;
|
||||
if (null == this.fieldMap) {
|
||||
Map<String, Object> testMap = (Map<String, Object>) MultipartDataUtil
|
||||
@ -238,22 +236,7 @@ public class DoSubmitService {
|
||||
FlowAction.setPhaseNo(phaseNo);
|
||||
FlowAction.setUserID(sUserId);
|
||||
|
||||
// // 检查该业务是否已经提交了(解决用户打开多个界面进行重复操作而产生的错误)
|
||||
// String sNewPhaseNo = FlowAction.getCurPhaseNo(tx);
|
||||
// if (!this.phaseNo.equals(sNewPhaseNo)) {
|
||||
// flag = false;
|
||||
// this.message = "该申请已经提交了,不能再次提交!";
|
||||
// } else {
|
||||
// // 获取未完成的任务流水号
|
||||
// String sTaskNo = FlowAction.getUnfinishedTaskNo(tx);
|
||||
// if (StringX.isSpace(sTaskNo)) {
|
||||
// flag = false;
|
||||
// this.message = "该申请所对应的流程任务不存在,请核对!";
|
||||
// }
|
||||
// }
|
||||
|
||||
// 检查是否签署意见
|
||||
// String sResult = FlowAction.getIsOpitionsRequire(tx);
|
||||
BizObject flowModel = GetFlowAction.getFlowModelParams(flowNo, phaseNo);
|
||||
String isOpitionRequired = flowModel.getAttribute("OPINIONSREQUIRED")
|
||||
.getString();
|
||||
@ -262,8 +245,9 @@ public class DoSubmitService {
|
||||
}
|
||||
|
||||
if (flag && "Y".equals(isOpitionRequired)) {
|
||||
String sResult = FlowAction.isSignOpinion(tx); // 返回值: yes-有意见; no-无意见;
|
||||
// error-查询出错
|
||||
String sResult = FlowAction.isSignOpinion(tx); // 返回值: yes-有意见;
|
||||
// no-无意见;
|
||||
// error-查询出错
|
||||
if (!"yes".equals(sResult)) {
|
||||
flag = false;
|
||||
// 该业务未签署意见,不能提交,请先签署意见!
|
||||
@ -335,113 +319,172 @@ public class DoSubmitService {
|
||||
String sUserId = request.getSession().getAttribute("userid").toString();
|
||||
|
||||
JBOTransaction tx1 = JBOFactory.createJBOTransaction();
|
||||
com.amarsoft.biz.workflow.FlowTask ft = new com.amarsoft.biz.workflow.FlowTask(
|
||||
taskNo, tx);// 使用jboTrans
|
||||
String flowNo = ft.FlowNo;
|
||||
String flowState = ft.FlowState;
|
||||
/*
|
||||
* com.amarsoft.biz.workflow.FlowTask ft = new
|
||||
* com.amarsoft.biz.workflow.FlowTask( taskNo, tx);// 使用jboTrans String
|
||||
* flowNo = ft.FlowNo; String flowState = ft.FlowState;
|
||||
*/
|
||||
|
||||
// 会签历史纪录阶段号问题
|
||||
if (("MEETING").equals(flowState)) {
|
||||
flowNo = flowNo + sUserId;
|
||||
}
|
||||
String[] phaseOpinions = ft.getChoiceList();
|
||||
tx1.commit();
|
||||
TenwaFlowTask ft1 = new TenwaFlowTask(taskNo, tx);// 使用jboTrans
|
||||
String routeInfo = ft1.getRouteInfo();
|
||||
flowNo = ft1.FlowNo;
|
||||
phaseNo = ft1.PhaseNo;
|
||||
flowState = ft1.FlowState;
|
||||
|
||||
String[] nextPhases;
|
||||
boolean bActionReqiured = true;
|
||||
FlowAction FlowAction = new FlowAction();
|
||||
boolean isPool = false, isHide = true;
|
||||
|
||||
FlowAction.setFlowNo(flowNo);
|
||||
String mPhaseName = "", mPhaseNo = "", mPhaseDes = "";
|
||||
|
||||
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
|
||||
for (String phaseOpinion : phaseOpinions) {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
List<Map<String, Object>> mList = new ArrayList<Map<String, Object>>();
|
||||
FlowAction.setTaskNo(taskNo);
|
||||
FlowAction.setPhaseOpinion(phaseOpinion);
|
||||
String nextPhaseAttrs = FlowAction.getNextPhaseAttr(tx);
|
||||
nextPhases = nextPhaseAttrs.split("@");
|
||||
// 非并行阶段
|
||||
if (nextPhases.length == 1) {
|
||||
String nextPhaseDes = "";
|
||||
nextPhaseDes = nextPhases[0].split(",")[2];
|
||||
if ("POOL".equals(nextPhaseDes) || "END".equals(nextPhaseDes)
|
||||
|| "SUPPLY".equals(nextPhaseDes)
|
||||
|| "FORK&POOL".equals(nextPhaseDes)) {
|
||||
bActionReqiured = false;
|
||||
if ("POOL".equals(nextPhaseDes))
|
||||
isPool = true;
|
||||
} else {
|
||||
bActionReqiured = true;
|
||||
JSONObject json = JsonUtil.str2JSONObject(routeInfo);
|
||||
String routeType = json.getString("routeType") == null ? "" : json
|
||||
.getString("routeType").toString();
|
||||
List<Map<String, Object>> list2 = new ArrayList<Map<String,Object>>();
|
||||
// 一般路由和条件路由初始化 APP 发起业务 只有一般路由
|
||||
if (routeType.equals("commroute") || routeType.equals("conditionroute")) {
|
||||
Map<String, Object> mMap = new HashMap<String, Object>();
|
||||
String route = json.getString("route") == null ? "" : json
|
||||
.getString("route").toString();
|
||||
if (route.length() > 0) {
|
||||
String type = "radio";
|
||||
JSONArray jsonArray = JsonUtil.str2JSONArray(route);
|
||||
|
||||
JSONObject jo = jsonArray.getJSONObject(0);
|
||||
|
||||
String joPhaseNo = jo.getString("phaseNo") == null ? "" : jo
|
||||
.getString("phaseNo").toString(); // phaseNo
|
||||
String joPhaseName = jo.getString("phaseName") == null ? "" : jo
|
||||
.getString("phaseName").toString(); // phaseName
|
||||
String joUserInfo = jo.getString("userInfo") == null ? "" : jo
|
||||
.getString("userInfo").toString(); // userInfo
|
||||
String joFlowUserOperatorType = jo.getString("flowUserOperatorType") == null ? "" : jo
|
||||
.getString("flowUserOperatorType").toString(); // flowUserOperatorType
|
||||
String joNodeType = jo.getString("nodeType") == null ? "" : jo
|
||||
.getString("nodeType").toString(); // nodeType
|
||||
|
||||
headMessage = "请选择" + joPhaseName + "用户:";
|
||||
mMap.put("phaseName", joPhaseName);
|
||||
mMap.put("phaseNo", joPhaseNo);
|
||||
mMap.put("nodeType", joNodeType);
|
||||
mMap.put("headMessage", headMessage);
|
||||
mMap.put("flowUserOperatorType", joFlowUserOperatorType);
|
||||
String [] vUser = joUserInfo.split("@");
|
||||
|
||||
if (!"01".equals(joFlowUserOperatorType)) {
|
||||
type = "checkBox";
|
||||
}
|
||||
}
|
||||
|
||||
String actionList = FlowAction.getActionList(tx);
|
||||
if (bActionReqiured) {
|
||||
if (StringX.isSpace(actionList)) {
|
||||
message = "所选阶段没有用户可以选择,请确认!";
|
||||
} else {
|
||||
if (nextPhases.length > 1) {
|
||||
for (int i = 0; i < nextPhases.length; i++) {
|
||||
mPhaseName = nextPhases[i].split(",")[1];
|
||||
mPhaseNo = nextPhases[i].split(",")[0];
|
||||
mPhaseDes = nextPhases[i].split(",")[2];
|
||||
FlowAction.setPhaseNo(mPhaseNo);
|
||||
if ("POOL".equals(mPhaseDes)
|
||||
|| "END".equals(mPhaseDes)
|
||||
|| "SUPPLY".equals(mPhaseDes)
|
||||
|| "FORK&POOL".equals(mPhaseDes)) {
|
||||
isHide = true;
|
||||
} else {
|
||||
isHide = false;
|
||||
}
|
||||
|
||||
Map<String, Object> mMap = queryPhaseMap(
|
||||
mPhaseName, mPhaseNo, mPhaseDes, phaseOpinion,
|
||||
actionList, FlowAction, tx);
|
||||
mList.add(mMap);
|
||||
}
|
||||
if ("".equals(headMessage)) {
|
||||
isPool = true;
|
||||
bodyMessage = "";
|
||||
}
|
||||
} else {
|
||||
mPhaseName = nextPhases[0].split(",")[1];
|
||||
mPhaseNo = nextPhases[0].split(",")[0];
|
||||
mPhaseDes = nextPhases[0].split(",")[2];
|
||||
FlowAction.setPhaseNo(mPhaseNo);
|
||||
Map<String, Object> mMap = queryPhaseMap(mPhaseName,
|
||||
mPhaseNo, mPhaseDes, phaseOpinion, actionList, FlowAction,
|
||||
tx);
|
||||
mList.add(mMap);
|
||||
isHide = false;
|
||||
}
|
||||
mMap.put("type", type);
|
||||
List<Map<String, Object>> list = new ArrayList<Map<String,Object>>();
|
||||
for (int i=0; i < vUser.length; i ++) {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
String [] vUserinfo=vUser[i].split(" ");
|
||||
map.put("userId", vUser[i]);
|
||||
map.put("userName", vUserinfo[1]);
|
||||
list.add(map);
|
||||
}
|
||||
} else {
|
||||
mPhaseName = nextPhases[0].split(",")[1];
|
||||
mPhaseNo = nextPhases[0].split(",")[0];
|
||||
mPhaseDes = nextPhases[0].split(",")[2];
|
||||
FlowAction.setPhaseNo(mPhaseNo);
|
||||
Map<String, Object> mMap = queryPhaseMap(mPhaseName, mPhaseNo, mPhaseDes,
|
||||
phaseOpinion, actionList, FlowAction, tx);
|
||||
mList.add(mMap);
|
||||
isHide = true;
|
||||
mMap.put("userInfo", list);
|
||||
list2.add(mMap);
|
||||
}
|
||||
|
||||
isMeeting = FlowAction.isMeeting(tx);
|
||||
bodyMessage = getNextPhaseInfo(phaseOpinion, tx, FlowAction);
|
||||
map.put("bodyMessage", bodyMessage);
|
||||
map.put("phaseInfo", mList);
|
||||
map.put("phaseOpinion", phaseOpinion);
|
||||
map.put("isMeeting", isMeeting);
|
||||
|
||||
map.put("userInfo",
|
||||
queryUserInfo(phaseOpinion, actionList, mPhaseNo,
|
||||
FlowAction, tx));
|
||||
list.add(map);
|
||||
}
|
||||
//
|
||||
// // 会签历史纪录阶段号问题
|
||||
// if (("MEETING").equals(flowState)) {
|
||||
// flowNo = flowNo + sUserId;
|
||||
// }
|
||||
//
|
||||
// String[] phaseOpinions = ft1.getChoiceList();
|
||||
// tx1.commit();
|
||||
//
|
||||
// String[] nextPhases;
|
||||
// boolean bActionReqiured = true;
|
||||
// FlowAction FlowAction = new FlowAction();
|
||||
// boolean isPool = false, isHide = true;
|
||||
//
|
||||
// FlowAction.setFlowNo(flowNo);
|
||||
// String mPhaseName = "", mPhaseNo = "", mPhaseDes = "";
|
||||
//
|
||||
// List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
|
||||
// for (String phaseOpinion : phaseOpinions) {
|
||||
// Map<String, Object> map = new HashMap<String, Object>();
|
||||
// List<Map<String, Object>> mList = new ArrayList<Map<String, Object>>();
|
||||
// FlowAction.setTaskNo(taskNo);
|
||||
// FlowAction.setPhaseOpinion(phaseOpinion);
|
||||
// String nextPhaseAttrs = FlowAction.getNextPhaseAttr(tx);
|
||||
// nextPhases = nextPhaseAttrs.split("@");
|
||||
// // 非并行阶段
|
||||
// if (nextPhases.length == 1) {
|
||||
// String nextPhaseDes = "";
|
||||
// nextPhaseDes = nextPhases[0].split(",")[2];
|
||||
// if ("POOL".equals(nextPhaseDes) || "END".equals(nextPhaseDes)
|
||||
// || "SUPPLY".equals(nextPhaseDes)
|
||||
// || "FORK&POOL".equals(nextPhaseDes)) {
|
||||
// bActionReqiured = false;
|
||||
// if ("POOL".equals(nextPhaseDes))
|
||||
// isPool = true;
|
||||
// } else {
|
||||
// bActionReqiured = true;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// String actionList = FlowAction.getActionList(tx);
|
||||
// if (bActionReqiured) {
|
||||
// if (StringX.isSpace(actionList)) {
|
||||
// message = "所选阶段没有用户可以选择,请确认!";
|
||||
// } else {
|
||||
// if (nextPhases.length > 1) {
|
||||
// for (int i = 0; i < nextPhases.length; i++) {
|
||||
// mPhaseName = nextPhases[i].split(",")[1];
|
||||
// mPhaseNo = nextPhases[i].split(",")[0];
|
||||
// mPhaseDes = nextPhases[i].split(",")[2];
|
||||
// FlowAction.setPhaseNo(mPhaseNo);
|
||||
// if ("POOL".equals(mPhaseDes)
|
||||
// || "END".equals(mPhaseDes)
|
||||
// || "SUPPLY".equals(mPhaseDes)
|
||||
// || "FORK&POOL".equals(mPhaseDes)) {
|
||||
// isHide = true;
|
||||
// } else {
|
||||
// isHide = false;
|
||||
// }
|
||||
//
|
||||
// Map<String, Object> mMap = queryPhaseMap(
|
||||
// mPhaseName, mPhaseNo, mPhaseDes,
|
||||
// phaseOpinion, actionList, FlowAction, tx);
|
||||
// mList.add(mMap);
|
||||
// }
|
||||
// if ("".equals(headMessage)) {
|
||||
// isPool = true;
|
||||
// bodyMessage = "";
|
||||
// }
|
||||
// } else {
|
||||
// mPhaseName = nextPhases[0].split(",")[1];
|
||||
// mPhaseNo = nextPhases[0].split(",")[0];
|
||||
// mPhaseDes = nextPhases[0].split(",")[2];
|
||||
// FlowAction.setPhaseNo(mPhaseNo);
|
||||
// Map<String, Object> mMap = queryPhaseMap(mPhaseName,
|
||||
// mPhaseNo, mPhaseDes, phaseOpinion, actionList,
|
||||
// FlowAction, tx);
|
||||
// mList.add(mMap);
|
||||
// isHide = false;
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// mPhaseName = nextPhases[0].split(",")[1];
|
||||
// mPhaseNo = nextPhases[0].split(",")[0];
|
||||
// mPhaseDes = nextPhases[0].split(",")[2];
|
||||
// FlowAction.setPhaseNo(mPhaseNo);
|
||||
// Map<String, Object> mMap = queryPhaseMap(mPhaseName, mPhaseNo,
|
||||
// mPhaseDes, phaseOpinion, actionList, FlowAction, tx);
|
||||
// mList.add(mMap);
|
||||
// isHide = true;
|
||||
// }
|
||||
|
||||
// isMeeting = FlowAction.isMeeting(tx);
|
||||
// bodyMessage = getNextPhaseInfo(phaseOpinion, tx, FlowAction);
|
||||
// map.put("bodyMessage", bodyMessage);
|
||||
// map.put("phaseInfo", mList);
|
||||
// map.put("phaseOpinion", phaseOpinion);
|
||||
// map.put("isMeeting", isMeeting);
|
||||
//
|
||||
// map.put("userInfo",
|
||||
// queryUserInfo(phaseOpinion, actionList, mPhaseNo,
|
||||
// FlowAction, tx));
|
||||
// list.add(map);
|
||||
// }
|
||||
|
||||
if (!StringX.isSpace(this.message)) {
|
||||
ARE.getLog().debug(this.message);
|
||||
@ -452,18 +495,17 @@ public class DoSubmitService {
|
||||
}
|
||||
|
||||
Map<String, Object> body = new HashMap<String, Object>();
|
||||
body.put("phaseAction", list);
|
||||
body.put("isPool", isPool);
|
||||
body.put("isHide", isHide);
|
||||
|
||||
body.put("phaseopinion", list2);
|
||||
body.put("routeType", routeType);
|
||||
ReturnMapUtil.setReturnMap(body,
|
||||
(String) RestfullConstant.baseProperty.get("SUCCESS"), "");
|
||||
return ReturnMapUtil.getReturnMap();
|
||||
}
|
||||
|
||||
public Map<String, Object> queryPhaseMap(String mPhaseName,
|
||||
String mPhaseNo, String mPhaseDes, String phaseOpinion, String actionList,
|
||||
FlowAction FlowAction, JBOTransaction tx) throws Exception {
|
||||
String mPhaseNo, String mPhaseDes, String phaseOpinion,
|
||||
String actionList, FlowAction FlowAction, JBOTransaction tx)
|
||||
throws Exception {
|
||||
Map<String, Object> mMap = new HashMap<String, Object>();
|
||||
|
||||
headMessage = "请选择" + mPhaseName + "用户:";
|
||||
|
||||
@ -116,8 +116,8 @@ public class FlowActionCommitServiceImpl implements FlowActionCommitService {
|
||||
this.phaseOpinion = this.fieldMap.get("phaseopinion") == null ? ""
|
||||
: this.fieldMap.get("phaseopinion").toString();
|
||||
|
||||
this.phaseAction = this.fieldMap.get("phaseaction") == null ? ""
|
||||
: this.fieldMap.get("phaseaction").toString();
|
||||
this.phaseAction = this.fieldMap.get("userinfo") == null ? ""
|
||||
: this.fieldMap.get("userinfo").toString();
|
||||
|
||||
this.nodeType = this.fieldMap.get("nodetype") == null ? ""
|
||||
: this.fieldMap.get("nodetype").toString();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user