阅读:7186回复:1
平台流程退回功能
平台的退回功能能不能进行二次开发呢?又或者说能不能在退回的时候给我们一个弹出框必须填了退回原因才能退回呢
图片:9N9VV{V5)R$WRHVSA{B5{[U.png |
|
沙发#
发布于:2017-05-09 09:15
API:
/** * 驳回流程到上一步节点 * @return * @throws Exception * @Description:【Json格式】 */ @GET @POST @Path("back") @Produces(MediaType.APPLICATION_JSON) public Response back() throws Exception { ZvanFLowResult zvanFLowResult = zvanFlowResource.back(request,response); if(zvanFLowResult!=null){ return Response.status(200).entity(zvanFLowResult).build(); }else{ return Response.status(500).build(); } }IMPL: public ZvanFLowResult back(HttpServletRequest request, HttpServletResponse response) { ZvanFLowResult result = new ZvanFLowResult(); try { String taskId = request.getParameter("taskId"); String runId = request.getParameter("runId"); if(StringUtils.isEmpty(taskId) && StringUtils.isEmpty(runId)){ result.setStatus(ZvanFLowResult.STATUS_ERROR); result.setMsg("至少传入taskId或者runId值!"); return result; } if(StringUtils.isEmpty(taskId) && StringUtils.isNotEmpty(runId)){ List<TaskInfo> taskInfos = wps.getTaskInfoByRunId(runId); if(taskInfos!=null && taskInfos.size()==1){ taskId = taskInfos.get(0).getTaskId(); }else{ result.setStatus(ZvanFLowResult.STATUS_ERROR); if(taskInfos.isEmpty()){ result.setMsg("该流程里没有活动的节点!"); }else if(taskInfos.size()>1){ result.setMsg("该流程里有多个活动的节点!无法通过流程实例ID(runId)进行流转。result的值为对应的多任务信息,可选择其一,通过taskId进行流转。"); result.setResult(taskInfos); } return result; } } Boolean isok = wps.reject(taskId); if(isok){ result.setStatus(ZvanFLowResult.STATUS_OK); result.setMsg(ZvanFLowResult.MSG_OK); }else{ result.setStatus(ZvanFLowResult.STATUS_ERROR); result.setMsg(ZvanFLowResult.MSG_ERROR); } } catch (Exception e) { result.setStatus(ZvanFLowResult.STATUS_ERROR); result.setMsg(e.getMessage()); e.printStackTrace(); } return result; } Result: public static final Integer STATUS_OK =1;//成功 public static final Integer STATUS_ERROR =0;//失败 public static final String MSG_OK ="操作成功";//操作成功 public static final String MSG_ERROR ="操作失败";//操作成功 private Integer status = STATUS_OK; private String msg = "OK"; private Object result = null; public Integer getStatus() { return status; } public void setStatus(Integer status) { this.status = status; } public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } public Object getResult() { return result; } public void setResult(Object result) { this.result = result; } |
|
|