Ejemplo n.º 1
0
  @RequestMapping(method = RequestMethod.POST, value = "/start")
  public ModelAndView start(
      Leave leave,
      ModelAndView mav,
      @RequestParam(value = "leavefile", required = false) MultipartFile leavefile)
      throws Exception {

    String fileUuid = FileUtils.uuidFileName(leavefile.getOriginalFilename());

    // 上传文件
    File targetFile = new File(ServletUtils.getRealPath(request) + "/upload/" + fileUuid);
    leavefile.transferTo(targetFile);

    leave.setFileName(leavefile.getOriginalFilename());
    leave.setFileId(fileUuid);

    current_user = (User) session.getAttribute(Constants.CURRENT_USER);
    leave.setSponsorLoginId(current_user.getLoginId());
    Map<String, Object> variables = new HashMap<String, Object>();
    // 设置流程发起人
    variables.put(WorkflowConstants.SPONSOR, current_user.getName());
    leaveService.startWorkflow(leave, variables);

    mav.setViewName("redirect:/workflow/process");
    return mav;
  }
Ejemplo n.º 2
0
  @RequestMapping(method = RequestMethod.POST, value = "/hrAudit")
  public ModelAndView hrAudit(
      ModelAndView mav,
      @RequestParam("leaveId") String leaveId,
      @RequestParam("taskId") String taskId,
      @RequestParam("hrAuditOpinion") String hrAuditOpinion,
      @RequestParam("hrPass") Boolean hrPass)
      throws Exception {

    mav.setViewName("redirect:/workflow/todoTasks");
    Leave leave = leaveService.get(Long.valueOf(leaveId));
    leave.setHrAuditOpinion(hrAuditOpinion);
    leaveService.save(leave);
    Map<String, Object> variables = new HashMap<String, Object>();
    variables.put("hrPass", hrPass);
    taskService.complete(taskId, variables);
    return mav;
  }