/**
  * 生成与流程相对应的业务信息
  *
  * @param message
  * @return
  */
 public TProcessBusiness insertProcessBusiness(TSuperviseTable sup, TaskAssgineeDto dto) {
   TProcessBusiness processBusiness = new TProcessBusiness();
   try {
     processBusiness.setBusinessKey(sup.getSuperviseId());
     processBusiness.setBusinessType(dto.getBusinessType());
     processBusiness.setBusinessTitle(sup.getSuperviseItem());
     processBusiness.setExecutionId(sup.getFlowId());
   } catch (Exception e) {
     log.error("生成实例标题信息", e);
   }
   return processBusiness;
 }
  /** 督办处理2 */
  @Override
  public TaskAssgineeDto insertSuperviseTable2(
      TSuperviseTable supervise,
      File[] files,
      String[] filesFileName,
      MUOUserSession muo,
      String btnType,
      TaskAssgineeDto taskAssgineeDto,
      String isFirst)
      throws Exception {
    String taskId = taskAssgineeDto.getNextTaskId();
    // if(taskAssgineeDto.getTransitionName()!=null&&!"".equals(taskAssgineeDto.getTransitionName()))
    // taskAssgineeDto.setTransitionName(new
    // String(taskAssgineeDto.getTransitionName().getBytes("iso-8859-1"),"UTF-8"));
    // 生成督办信息
    String submitType = "";
    if (supervise.getSuperviseId() == null || "".equals(supervise.getSuperviseId())) {
      supervise.setOrgid(String.valueOf(muo.getOrgid()));
      supervise.setCreateor(String.valueOf(muo.getEmpid()));
      String currDate = TimeUtil.getCntDtStr(new Date(), "yyyyMMddHHmmss");
      supervise.setCreateDate(currDate.substring(0, 8));
      supervise.setCreateTime(currDate.substring(8));
      HashMap<String, Object> map = new HashMap<String, Object>();
      map.put("user", String.valueOf(muo.getEmpid()));
      TaskAssgineeDto dto1 =
          jbpmService.startProcessByDefinition(taskAssgineeDto.getDefinitionId(), map);
      taskId = dto1.getNextTaskId();
      supervise.setNodeId(taskId);
      supervise.setNodeName1(jbpmService.getTaskById(taskId).getName());
      supervise.setFlowId(dto1.getExecutionId());
      taskAssgineeDto.setExecutionId(dto1.getExecutionId());
      tSuperviseTableDAO.insertSuperviseTable(supervise);
      // 保存流程的信息
      jbpmService.saveProcessBusiness(muo, insertProcessBusiness(supervise, taskAssgineeDto));
      supervise.setOpninion("");
      submitType = "05";
    } else {
      // 修改
      tSuperviseTableDAO.updateSuperviseTable(supervise);
      // 20140902修改督办单更新时出现一倍数据的问题
      TProcessBusiness business = jbpmService.findProcessBusiness(taskAssgineeDto);
      business.setBusinessTitle(supervise.getSuperviseItem());

      jbpmService.updateProcessBusiness(business);
      submitType = "05";
      /** 2014093 */
      if (supervise.getOpninion() == null || "null".equals(supervise.getOpninion()))
        supervise.setOpninion("");
      /* jbpmService.updateProcessBusiness(insertProcessBusiness(supervise,taskAssgineeDto));*/
    }
    tFileResourceTableService.fileUploads(
        makeFileBean(supervise, taskAssgineeDto), files, filesFileName, muo); // 保存文件
    if (!"1".equals(btnType)) {
      supervise.setNodeName1(jbpmService.getTaskById(taskId).getName());
      taskAssgineeDto.setTaskExeAssginee(String.valueOf(muo.getEmpid()));
      taskAssgineeDto.setTaskId(taskId);
      jbpmService.assignTask(taskAssgineeDto);
      if (!"退回".equals(taskAssgineeDto.getTransitionName())
          && !"退回办理".equals(taskAssgineeDto.getTransitionName())) { // 进入下一步
        taskAssgineeDto.setTaskAssigneeState("0");
        // taskAssgineeDto.setPreTaskAssingee(muo.getEmpid());
        jbpmService.updateTaskAssigneeState(taskAssgineeDto);
        // 20140903 解决下个操作人为null的问题

        if ("null".equals(taskAssgineeDto.getEmpNames())) taskAssgineeDto.setEmpNames("");
        if (isFirst == null
            && taskAssgineeDto.getEmpIds() != null
            && !"".equals(taskAssgineeDto.getEmpIds())) submitType = "01";
        /*if("处理".equals(taskAssgineeDto.getTransitionName())){//
            //暂无

        }else if("批示".equals(taskAssgineeDto.getTransitionName())){
            //String[] receiveEmp=taskAssgineeDto.getEmpIds().split(",");
            //for(int i=0;i<receiveEmp.length;i++){
        //  TSuperviceReceive record=new TSuperviceReceive();
            //record.setNodeId(taskId);
            //record.setNodeName(jbpmService.getTaskById(taskId).getName());
            //record.setContent(supervise.getContent());
            //record.setSuperviseId(supervise.getSuperviseId());
            //record.setReceiveEmp(receiveEmp[i]);
            //record.setReceiveDate("");
            //record.setReceiveTime("");
            //生成督办的人。
            //tSuperviceReceiveDAO.insert(record);
        //  }
        }else*/
        if ("反馈".equals(taskAssgineeDto.getTransitionName())) {
          submitType = "07";
          List<TProcessTaskAssigneePerson> task = jbpmService.getUnCompleted(taskAssgineeDto);
          /*                  taskAssgineeDto.setPreTaskAssingee(muo.getEmpid());
                              jbpmService.updateTaskAssigneeState(taskAssgineeDto);
                              TaskAssgineeDto tad=new TaskAssgineeDto();
                              tad.setParentId(taskAssgineeDto.getParentId());
                              tad.setExecutionId(taskAssgineeDto.getExecutionId());
                              tad.setIsUpdate("10");//10:子处理节点未完成的
                              tad.setTaskAssigneeState("3");//3:作废
                              jbpmService.updateTaskAssigneeState1(tad);//将部室下子处理节点未签的前辈作废
          */ if (task != null && task.size() <= 1) { // 用于所有人都操作完成后进入下一个节点
            jbpmService.completeTask(taskId, taskAssgineeDto.getTransitionName(), null);
            String nextTaskId = jbpmService.getNextTaskId(taskAssgineeDto.getExecutionId());
            taskAssgineeDto.setNextTaskId(nextTaskId);
            supervise.setNodeId(taskId);
            TaskAssgineeDto dto = makeTaskAssgineeDto(supervise, muo, taskAssgineeDto);
            jbpmService.saceTaskAssignee(dto);
          } else {
            // 删除当前节点办理人员,表示已经办理过
            TProcessTaskAssigneePerson tpap = new TProcessTaskAssigneePerson();
            tpap.setTaskAssigneeId(muo.getEmpid());
            tpap.setExecutionId(taskAssgineeDto.getExecutionId());
            this.tProcessTaskAssigneePersonDAO.deleteByTemplate(tpap);
          }

        } else if ("结束".equals(taskAssgineeDto.getTransitionName())) {
          supervise.setNodeId(taskId);
          TaskAssgineeDto taskAssginee = makeTaskAssgineeDto(supervise, muo, taskAssgineeDto);
          taskAssginee.setNextTaskId("");
          jbpmService.saceTaskAssignee(taskAssginee);
          jbpmService.completeTask(taskId, taskAssgineeDto.getTransitionName(), null);
          // 20140904 添加操作类型为结束
          submitType = "08";
        } else { // 进入下一步
          if ("批示".equals(taskAssgineeDto.getTransitionName())) submitType = "05";
          jbpmService.completeTask(taskId, taskAssgineeDto.getTransitionName(), null);
          String nextTaskId = jbpmService.getNextTaskId(taskAssgineeDto.getExecutionId());
          taskAssgineeDto.setNextTaskId(nextTaskId);
          supervise.setNodeId(taskId);
          jbpmService.saceTaskAssignee(makeTaskAssgineeDto(supervise, muo, taskAssgineeDto));
        }

        insertApproveOpninion(supervise, muo, taskId, submitType, taskAssgineeDto);
      } else { // 退回
        insertApproveOpninion(supervise, muo, taskId, "02", taskAssgineeDto);
        jbpmService.completeTask(taskId, taskAssgineeDto.getTransitionName(), null);
        jbpmService.turnBackTaskAssignee(makeTaskAssgineeDtoBack(taskAssgineeDto, supervise, muo));
      }
    }
    return null;
  }