/**
  * 工单执行(完成任务)
  *
  * @param testAudit
  * @param model
  * @return
  */
 @RequiresPermissions("oa:testAudit:edit")
 @RequestMapping(value = "saveAudit")
 public String saveAudit(TestAudit testAudit, Model model) {
   if (StringUtils.isBlank(testAudit.getAct().getFlag())
       || StringUtils.isBlank(testAudit.getAct().getComment())) {
     addMessage(model, "请填写审核意见。");
     return form(testAudit, model);
   }
   testAuditService.auditSave(testAudit);
   return "redirect:" + adminPath + "/act/task/todo/";
 }
  /**
   * 申请单填写
   *
   * @param testAudit
   * @param model
   * @return
   */
  @RequiresPermissions("oa:testAudit:view")
  @RequestMapping(value = "form")
  public String form(TestAudit testAudit, Model model) {

    String view = "testAuditForm";

    // 查看审批申请单
    if (StringUtils.isNotBlank(testAudit.getId())) { // .getAct().getProcInsId())){

      // 环节编号
      String taskDefKey = testAudit.getAct().getTaskDefKey();

      // 查看工单
      if (testAudit.getAct().isFinishTask()) {
        view = "testAuditView";
      }
      // 修改环节
      else if ("modify".equals(taskDefKey)) {
        view = "testAuditForm";
      }
      // 审核环节
      else if ("audit".equals(taskDefKey)) {
        view = "testAuditAudit";
        //				String formKey = "/oa/testAudit";
        //				return "redirect:" + ActUtils.getFormUrl(formKey, testAudit.getAct());
      }
      // 审核环节2
      else if ("audit2".equals(taskDefKey)) {
        view = "testAuditAudit";
      }
      // 审核环节3
      else if ("audit3".equals(taskDefKey)) {
        view = "testAuditAudit";
      }
      // 审核环节4
      else if ("audit4".equals(taskDefKey)) {
        view = "testAuditAudit";
      }
      // 兑现环节
      else if ("apply_end".equals(taskDefKey)) {
        view = "testAuditAudit";
      }
    }

    model.addAttribute("testAudit", testAudit);
    return "modules/oa/" + view;
  }