Exemplo n.º 1
0
 // 查看详细内容
 public Map<String, Object> view(String taskId, String piId) {
   if (taskId == null || "".equals(taskId)) {
     map = executionService.getVariables(piId, executionService.getVariableNames(piId));
   } else {
     Set<String> set = taskService.getVariableNames(taskId);
     map = taskService.getVariables(taskId, set);
   }
   return map;
 }
Exemplo n.º 2
0
 // 禀议撤销
 @Transactional
 public void delete(String taskId) {
   Task task = taskService.getTask(taskId);
   Execution execution = executionService.findExecutionById(task.getExecutionId());
   if (execution.getProcessInstance().isActive("填写经费报销")) {
     String wCode = (String) taskService.getVariable(taskId, "wCode");
     this.delete(wipeDao.getWipe(wCode));
     taskService.completeTask(taskId, "cancel");
   }
 }
Exemplo n.º 3
0
  // 根据当前任务号取得禀议详细信息
  @Transactional(readOnly = true)
  public WipeTask getWipeByTask(String taskId) {
    if (StringUtils.isEmpty(taskId)) return null;

    WipeTask wipeTask = new WipeTask();
    wipeTask.setTask(taskService.getTask(taskId));

    String wCode = (String) taskService.getVariable(taskId, "wCode");
    if (wCode != null)
      wipeTask.setWipe(
          wipeDao.findByProperty("wCode", wCode) == null
              ? null
              : wipeDao.findByProperty("wCode", wCode).get(0));
    return wipeTask;
  }
Exemplo n.º 4
0
 // 撤回流程的界面
 public Task updWipe(Wipe wipe, Long ju1) throws Exception {
   taskList = taskService.findPersonalTasks(String.valueOf(ju1));
   if (taskList != null && !taskList.isEmpty()) {
     String wCode = null;
     for (Task task : taskList) {
       wCode = (String) taskService.getVariable(task.getId(), "wCode");
       if (wCode != null) {
         if (wCode.equals(wipe.getwCode())) {
           this.task = task;
           taskService.completeTask(task.getId(), "To主管驳回");
         }
       }
     }
   }
   return this.task;
 }
Exemplo n.º 5
0
  // 根据当前任务号取得禀议详细信息
  @Transactional(readOnly = true)
  public Task getWipeByTid(String taskId) {
    if (StringUtils.isEmpty(taskId)) return null;

    Task task = taskService.getTask(taskId);

    return task;
  }
  // 审核
  public String audit() throws Exception {
    TaskService taskService = issueService.getTaskService();
    HttpSession session = request.getSession();
    User sessionUser = (User) session.getAttribute(LicenseWorkFlowConstants.SESSION_USER);
    User user = userService.getById(sessionUser.getId());
    Audit audit = new Audit(); // 审批意见
    String groupName = "";
    if (user.getGroups() != null && user.getGroups().size() > 0) {
      List<Group> groupList = new ArrayList<Group>();
      groupList.addAll(user.getGroups());
      groupName = groupList.get(0).getCnName();
    }
    // 设置审核的部门名称
    audit.setAuditDept(groupName);
    audit.setAuditNotion(auditNotion); // 审批意见
    audit.setAuditTime(new Date()); // 审批时间
    audit.setAuditUser(user); // 审批用户
    String outcome = ""; // 边
    if ("1".equals(result)) {
      outcome = "同意";
      audit.setAuditResult("同意");
    } else {
      outcome = "否决";
      audit.setAuditResult("不同意");
    }
    /** all the variables visible in the given task */
    Set<String> set = taskService.getVariableNames(taskId);
    /** retrieves a map of variables */
    Map<String, Object> variables = taskService.getVariables(taskId, set);
    if (issue.getId() == 0) throw new OceanRuntimeException("标识不合法");
    // 获取工单
    issue = issueService.getById(issue.getId());

    variables.put("createUser", "admin");

    // 执行任务
    taskService.completeTask(taskId, outcome, variables);
    // 修改工单的审核信息
    audit.setIssue(issue);
    Set<Audit> audits = issue.getAudits();
    audits.add(audit);
    issue.setAudits(audits);
    issueService.saveOrUpdate(issue); // 更新到库中
    return "indexAction";
  }
Exemplo n.º 7
0
 // 驳回
 public void reject(String taskId) {
   task = taskService.getTask(taskId);
   Set<String> set = taskService.getVariableNames(taskId);
   map = taskService.getVariables(taskId, set);
   map.put("reject", task.getAssignee()); // 驳回人
   taskService.setVariables(task.getId(), map);
   execution = executionService.findExecutionById(task.getExecutionId());
   if (execution.getProcessInstance().isActive("部门主管审批")) { // 部门主管不批准
     taskService.completeTask(taskId, "To主管驳回");
   } else if (execution.getProcessInstance().isActive("项目经理审批")) { // 项目经理不批准
     taskService.completeTask(taskId, "To项目经理驳回");
   } else if (execution.getProcessInstance().isActive("三级合议")) { // 总经理不批准的过程
     taskService.completeTask(taskId, "To三级驳回");
   } else if (execution.getProcessInstance().isActive("四级合议")) { // 四级议论
     taskService.completeTask(taskId, "To四级驳回");
   } else if (execution.getProcessInstance().isActive("最终决裁")) { // 五级审批
     taskService.completeTask(taskId, "To最终驳回");
   } else {
     taskService.completeTask(taskId);
   }
 }
Exemplo n.º 8
0
 // 根据当前用户取得驳回报销列表
 @Transactional(readOnly = true)
 public List<WipeTask> getRejectTasks(Long userId) {
   taskList = taskService.findPersonalTasks(String.valueOf(ActionUtil.getCurLoginInfo().getId()));
   List<WipeTask> list = null;
   if (taskList != null && !taskList.isEmpty()) {
     String wCode = null;
     list = new ArrayList<WipeTask>(taskList.size());
     WipeTask wipeTask = null;
     for (Task task : taskList) {
       if (task.getName().equalsIgnoreCase("填写经费报销")) {
         wipeTask = new WipeTask();
         wipeTask.setTask(task);
         wCode = (String) taskService.getVariable(task.getId(), "wCode");
         if (wCode != null) {
           wipeTask.setWipe(wipeDao.getWipe(wCode));
           list.add(wipeTask);
         }
       }
     }
   }
   return list;
 }
Exemplo n.º 9
0
 // 监测流程是否可以修改(如果相同的人批两次可能就会出问题。还没测试两个人是否会有问题。)
 public Task checkUpd(Wipe wipe) throws Exception {
   List<Judge> judgeList = judgeManager.selJudgeByCode(wipe.getId());
   Integer size = 0;
   if (judgeList != null) {
     size = judgeList.size();
   }
   this.task = null;
   taskList =
       taskService.findPersonalTasks(String.valueOf(wipe.getJudgeSet().get(0).getUser().getId()));
   if (taskList != null && !taskList.isEmpty()) {
     String wCode = null;
     for (Task task : taskList) {
       wCode = (String) taskService.getVariable(task.getId(), "wCode");
       if (wCode != null) {
         if (wCode.equals(wipe.getwCode()) && size < 1) // 还需要一个条件判断,审批人数必须小于=0;
         {
           this.task = task;
         }
       }
     }
   }
   return this.task;
 }
Exemplo n.º 10
0
  // 查询某个人的待办任务。
  public List<WipeTask> weiShenPiList() throws Exception {
    taskList = taskService.findPersonalTasks(String.valueOf(ActionUtil.getCurLoginInfo().getId()));
    List<WipeTask> list = null;
    if (taskList != null && !taskList.isEmpty()) {
      String wCode = null;
      list = new ArrayList<WipeTask>(taskList.size());
      WipeTask wipeTask = null;
      for (Task task : taskList) {

        if (task.getName().equalsIgnoreCase("填写经费报销")) continue;

        wipeTask = new WipeTask();
        wipeTask.setTask(task);
        wCode = (String) taskService.getVariable(task.getId(), "wCode");
        if (wCode != null) {
          if (wipeDao.getWipe(wCode) != null) {
            wipeTask.setWipe(wipeDao.getWipe(wCode));
            list.add(wipeTask);
          }
        }
      }
    }
    return list;
  }
Exemplo n.º 11
0
  // 不批准
  public void dissent(String taskId) {
    task = taskService.getTask(taskId);
    execution = executionService.findExecutionById(task.getExecutionId());

    if (execution.getProcessInstance().isActive("部门主管审批")) { // 部门主管不批准
      taskService.completeTask(taskId, "To主管不批准");
    } else if (execution.getProcessInstance().isActive("项目经理审批")) { // 项目经理不批准
      taskService.completeTask(taskId, "To项目经理不批准");
    } else if (execution.getProcessInstance().isActive("三级合议")) { // 总经理审批的过程
      taskService.completeTask(taskId, "To三级不批准");
    } else if (execution.getProcessInstance().isActive("四级合议")) { // 四级议论
      taskService.completeTask(taskId, "To四级不批准");
    } else if (execution.getProcessInstance().isActive("最终决裁")) { // 五级审批
      taskService.completeTask(taskId, "To最终驳回");
    } else {
      taskService.completeTask(taskId);
    }
  }
Exemplo n.º 12
0
 public List<Task> findTodos(String userId) {
   TaskService taskService = processEngine.getTaskService();
   List<Task> list = taskService.createTaskQuery().candidate(userId).list();
   list.addAll(taskService.findPersonalTasks(userId));
   return list;
 }
Exemplo n.º 13
0
 // 根据任务编号查询流程变量
 public Map<String, Object> reApply(String taskId) throws Exception {
   Set<String> set = taskService.getVariableNames(taskId);
   map = taskService.getVariables(taskId, set);
   return map;
 }
Exemplo n.º 14
0
 // 进入开始审批的界面
 public Map<String, Object> prepareJudge(String taskId) {
   Set<String> set = taskService.getVariableNames(taskId);
   map = taskService.getVariables(taskId, set);
   return map;
 }
Exemplo n.º 15
0
  // 审核待办任务
  @Transactional
  public Wipe confirm(String taskId, String topJudge, Wipe wipe) {

    task = taskService.getTask(taskId);
    execution = executionService.findExecutionById(task.getExecutionId());
    if (execution.getProcessInstance().isActive("部门主管审批")) { // 部门主管审批
      taskService.completeTask(taskId, "To"); // To二级决裁
    } else if (execution.getProcessInstance().isActive("项目经理审批")) { // 项目经理审批
      String variable = (String) taskService.getVariable(taskId, "sanJiUser");
      if (variable == null || "".equals(variable)) {
        taskService.completeTask(taskId, "To项目经理不批准");
        wipe.setState((short) 1);
      } else {
        taskService.completeTask(taskId, "To三级合议");
      }
    } else if (execution.getProcessInstance().isActive("三级合议")) { // 总经理审批的过程
      taskService.completeTask(taskId, "To四级合议");
    } else if (execution.getProcessInstance().isActive("四级合议")) { // 四级议论
      if (topJudge != null) {
        //				if (topJudge.equals("1"))
        //				{
        Map<String, Object> variables = new HashMap<String, Object>();
        variables.put("topUser", topJudge);
        taskService.setVariables(taskId, variables);
        taskService.completeTask(taskId, "To最终决裁"); // 这里还要根据经理是否需要老板决裁。
        wipe.setTopJudge(topJudge);
        wipe.setState((short) 1);
        //				}
        //				else if (topJudge.equals("0"))
        //				{
        //					wipe.setState((short) 1);
        //					taskService.completeTask(taskId, "To四级不批准");
        //				}
      } else taskService.completeTask(taskId, "To最终决裁");
    } else if (execution.getProcessInstance().isActive("最终决裁")) {
      wipe.setState((short) 1);
      // 五级审批
      taskService.completeTask(taskId, "To流程结束");
    } else {
      taskService.completeTask(taskId);
    }

    this.save(wipe);
    return wipe;
  }
Exemplo n.º 16
0
  // 添加wipe的方法
  @Transactional
  public Wipe saveWipe(Wipe wipe, List<WipeItem> itemList, List<WipeItemDetail> detailList) {
    Map<String, Object> variables = new HashMap<String, Object>();
    Integer type = wipe.getWType(); // 0部内,1部外。
    String yiji = String.valueOf(wipe.getJudgeSet().get(0).getUser().getId());
    String erji = String.valueOf(wipe.getJudgeSet().get(1).getUser().getId());
    String sanji = null, siji = null, wuji = null;
    if (type == 1) {
      if (wipe.getJudgeSet().get(2).getUser() == null) {
        sanji = null;
      } else {
        sanji = String.valueOf(wipe.getJudgeSet().get(2).getUser().getId());
      }
      if (wipe.getJudgeSet().get(3).getUser() == null) {
        siji = null;
      } else {
        siji = String.valueOf(wipe.getJudgeSet().get(3).getUser().getId());
      }
      if (wipe.getJudgeSet().get(4).getUser() == null) {
        wuji = null;
      } else {
        wuji = String.valueOf(wipe.getJudgeSet().get(4).getUser().getId());
      }
    }
    variables.put("wCode", wipe.getwCode()); // 把禀议编号存储在变量中。
    variables.put("deptUser", yiji);
    variables.put("projUser", erji);
    variables.put("sanJiUser", sanji);
    variables.put("manager", siji);
    variables.put("topUser", wuji);
    variables.put("fillUser", String.valueOf(ActionUtil.getCurLoginInfo().getId()));
    executionService.startProcessInstanceByKey("jingfeibaoxiao", variables);
    taskList = taskService.findPersonalTasks(String.valueOf(ActionUtil.getCurLoginInfo().getId()));
    task = taskList.get(taskList.size() - 1);
    taskService.completeTask(task.getId());
    execution = executionService.findExecutionById(task.getExecutionId());
    wipe.getJudgeSet().get(0).setWipe(wipe);
    wipe.getJudgeSet().get(1).setWipe(wipe);

    // 全公司
    if (type == 1) {
      if (wipe.getJudgeSet().get(2) == null) {
        wipe.getJudgeSet().set(2, null);
      } else {
        wipe.getJudgeSet().get(2).setWipe(wipe);
      }
      if (wipe.getJudgeSet().get(3) == null) {
        wipe.getJudgeSet().set(3, null);
      } else {
        wipe.getJudgeSet().get(3).setWipe(wipe);
      }
      if (wipe.getJudgeSet().get(4) == null) {
        wipe.getJudgeSet().set(4, null);
      } else {
        wipe.getJudgeSet().get(4).setWipe(wipe);
      }
    }

    wipe.setPId(execution.getProcessInstance().getId()); // 获得流程实例ID;

    this.save(wipe);
    if (itemList != null && itemList.size() != 0) {
      for (WipeItem wipeItem : itemList) {
        wipeItem.setWipe(wipe);
        if (detailList != null && detailList.size() != 0) {
          for (WipeItemDetail wipeItemDetail : detailList) {
            if (wipeItem.getiItem().equals(wipeItemDetail.getWipeItem().getiItem())) {
              wipeItemDetail.setWipeItem(wipeItem);
              wipeItemDetailService.save(wipeItemDetail);
            }
          }
        }

        wipeItemService.save(wipeItem);
      }
    }
    return wipe;
  }
Exemplo n.º 17
0
  // 撤回流程的操作
  @Transactional
  public void upd(
      Wipe wipe,
      String isCom,
      Long ju1,
      List<WipeItem> itemList,
      List<WipeItemDetail> detailList,
      String itemString,
      String detailString)
      throws Exception {
    judgeManager.del(wipe.getId());
    wipe.setwUser(userManager.get(wipe.getwUser().getId()));
    List<Judge> judgeSet = wipe.getJudgeSet();
    for (Judge judge : judgeSet) {
      if (judge.getUser().getId() == null) judge.setUser(null);
      else judge.setUser(userManager.get(judge.getUser().getId()));
    }
    wipe.setJudgeSet(judgeSet);
    wipe.setState((short) 0);

    if ("false".equals(isCom) && ju1 != null) updWipe(wipe, ju1);

    Map<String, Object> variables = new HashMap<String, Object>();
    Integer type = wipe.getWType(); // 0部内,1部外。
    String yiji = String.valueOf(wipe.getJudgeSet().get(0).getUser().getId());
    String erji = String.valueOf(wipe.getJudgeSet().get(1).getUser().getId());
    String sanji = null, siji = null, wuji = null;
    if (type == 1) {
      if (wipe.getJudgeSet().get(2).getUser() == null) {
        sanji = null;
      } else {
        sanji = String.valueOf(wipe.getJudgeSet().get(2).getUser().getId());
      }
      if (wipe.getJudgeSet().get(3).getUser() == null) {
        siji = null;
      } else {
        siji = String.valueOf(wipe.getJudgeSet().get(3).getUser().getId());
      }
      if (wipe.getJudgeSet().get(4).getUser() == null) {
        wuji = null;
      } else {
        wuji = String.valueOf(wipe.getJudgeSet().get(4).getUser().getId());
      }
    }
    variables.put("wCode", wipe.getwCode()); // 把禀议编号存储在变量中。
    variables.put("deptUser", yiji);
    variables.put("projUser", erji);
    variables.put("sanJiUser", sanji);
    variables.put("manager", siji);
    variables.put("topUser", wuji);
    variables.put("fillUser", String.valueOf(ActionUtil.getCurLoginInfo().getId()));

    wipe.getJudgeSet().get(0).setWipe(wipe);
    wipe.getJudgeSet().get(1).setWipe(wipe);

    // 全公司
    if (type == 1) {
      if (wipe.getJudgeSet().get(2) == null) {
        wipe.getJudgeSet().set(2, null);
      } else {
        wipe.getJudgeSet().get(2).setWipe(wipe);
      }
      if (wipe.getJudgeSet().get(3) == null) {
        wipe.getJudgeSet().set(3, null);
      } else {
        wipe.getJudgeSet().get(3).setWipe(wipe);
      }
      if (wipe.getJudgeSet().get(4) == null) {
        wipe.getJudgeSet().set(4, null);
      } else {
        wipe.getJudgeSet().get(4).setWipe(wipe);
      }
    }

    taskList = taskService.findPersonalTasks(String.valueOf(wipe.getwUser().getId()));
    if (taskList != null && !taskList.isEmpty()) {
      String wCode = null;
      for (Task task : taskList) {
        wCode = (String) taskService.getVariable(task.getId(), "wCode");
        if (wCode != null) {
          if (wCode.equals(wipe.getwCode())) {
            taskService.setVariables(task.getId(), variables);
            taskService.completeTask(task.getId());
          }
        }
      }
    }
    wipeDao.mery(wipe);

    String[] itemIds = itemString.split(",");
    String[] detailIds = detailString.split(",");

    for (int d = 0; d < detailIds.length; d++) {
      if (!detailIds[d].equals("")) wipeItemDetailService.delete(Long.parseLong(detailIds[d]));
    }
    for (int i = 0; i < itemIds.length; i++) {
      if (!itemIds[i].equals("")) wipeItemService.delete(Long.parseLong(itemIds[i]));
    }
    if (itemList != null && itemList.size() != 0) {
      for (WipeItem wipeItem : itemList) {
        wipeItem.setWipe(wipe); // 这里有错误,为什么为空。
        if (wipeItem.getId() == null || "".equals(wipeItem.getId())) wipeItemService.save(wipeItem);
        else wipeItemService.merge(wipeItem);
        if (detailList != null && detailList.size() != 0) {
          for (WipeItemDetail wipeItemDetail : detailList) {
            if (wipeItem.getiItem().equals(wipeItemDetail.getWipeItem().getiItem())) {
              wipeItemDetail.setWipeItem(wipeItem);
              if (wipeItemDetail.getId() == null || "".equals(wipeItemDetail.getId()))
                wipeItemDetailService.save(wipeItemDetail);
              else wipeItemDetailService.merge(wipeItemDetail);
            }
          }
        }
      }
    }
  }