Пример #1
0
  @RequestMapping(value = "{id}/terminate")
  public String delete(
      @PathVariable("id") String processInstanceId,
      @RequestParam(value = Constants.BACK_URL, required = false) String backURL,
      RedirectAttributes redirectAttributes) {
    //        if (permissionList != null) {
    //            this.permissionList.assertHasDeletePermission();
    //        }

    try {
      userProcessService.terminateProcessInstanceById(processInstanceId);
      redirectAttributes.addFlashAttribute(Constants.MESSAGE, "终止成功");
    } catch (Exception e) {
      redirectAttributes.addFlashAttribute(Constants.ERROR, e.getMessage());
      log.error("", e);
    }
    return "redirect:/bpm/userprocess?processstatus=unfinished";
  }
Пример #2
0
  /**
   * 流程列表
   *
   * @param user 操作用户
   * @param processStatus 流程状态 unfinished finished involve
   * @param searchable
   * @param model
   * @return
   */
  @RequestMapping(method = RequestMethod.GET)
  public String list(
      @CurrentUser User user,
      @RequestParam("processstatus") String processStatus,
      Searchable searchable,
      Model model) {

    //		if (permissionList != null) {
    //			this.permissionList.assertHasViewPermission();
    //		}

    if (null != processStatus && "involve".equals(processStatus)) {

      Page<HistoricProcessInstance> processInstances =
          userProcessService.findInvolvedProcessInstances(user.getUsername(), searchable.getPage());
      Map<String, BpmProcess> processMap = new HashMap<String, BpmProcess>();
      for (HistoricProcessInstance processInstance : processInstances) {
        String processDefinitionId = processInstance.getProcessDefinitionId();
        BpmProcess bpmProcess =
            bpmProcessService.findByBpmConfBase(
                bpmConfBaseService.findByProcessDefinitionId(processDefinitionId));
        if (!processMap.containsKey(processDefinitionId)) {
          processMap.put(processDefinitionId, bpmProcess);
        }
      }
      model.addAttribute("bpmProcessMap", processMap);
      model.addAttribute("page", processInstances);
    } else if (null != processStatus && "unfinished".equals(processStatus)) {
      Page<HistoricProcessInstance> processInstances =
          userProcessService.findRunningProcessInstances(user.getUsername(), searchable.getPage());
      Map<String, BpmProcess> processMap = new HashMap<String, BpmProcess>();
      for (HistoricProcessInstance processInstance : processInstances) {
        String processDefinitionId = processInstance.getProcessDefinitionId();
        BpmProcess bpmProcess =
            bpmProcessService.findByBpmConfBase(
                bpmConfBaseService.findByProcessDefinitionId(processDefinitionId));
        if (!processMap.containsKey(processDefinitionId)) {
          processMap.put(processDefinitionId, bpmProcess);
        }
      }
      model.addAttribute("bpmProcessMap", processMap);
      model.addAttribute("page", processInstances);
    } else if (null != processStatus && "finished".equals(processStatus)) {
      Page<HistoricProcessInstance> processInstances =
          userProcessService.findCompletedProcessInstances(
              user.getUsername(), searchable.getPage());
      Map<String, BpmProcess> processMap = new HashMap<String, BpmProcess>();
      for (HistoricProcessInstance processInstance : processInstances) {
        String processDefinitionId = processInstance.getProcessDefinitionId();
        BpmProcess bpmProcess =
            bpmProcessService.findByBpmConfBase(
                bpmConfBaseService.findByProcessDefinitionId(processDefinitionId));
        if (!processMap.containsKey(processDefinitionId)) {
          processMap.put(processDefinitionId, bpmProcess);
        }
      }
      model.addAttribute("bpmProcessMap", processMap);
      model.addAttribute("page", processInstances);
    }
    if (listAlsoSetCommonData) {
      setCommonData(model);
    }

    return "bpm/userprocess/list";
  }