Example #1
0
 /** 流程监控 减少办理人 */
 public String delTransactor() throws Exception {
   WorkflowInstance instance = null;
   if (instanceId != null) instance = workflowInstanceManager.getWorkflowInstance(instanceId);
   else instance = workflowInstanceManager.getWorkflowInstance(workflowId);
   workflowId = instance.getProcessInstanceId();
   boolean isForkTask = taskService.isForkTask(workflowId);
   if (!isForkTask) { // 表示是分支汇聚任务时不让减少办理人
     List<String[]> currentTransactors = taskService.getActivityTaskTransactors(workflowId);
     List<String> currentPrincipals = taskService.getActivityTaskPrincipals(workflowId);
     if (currentTransactors != null) {
       if (currentTransactors.size() == 1) {
         Object[] transactors = currentTransactors.get(0);
         transactor = (transactors[1]).toString();
       }
       transactorNum = currentTransactors.size();
     }
     if (currentPrincipals != null) {
       if (transactorNum == 0 && currentPrincipals.size() == 1) {
         String loginName = currentPrincipals.get(0);
         User user = acsUtils.getUserByLoginName(loginName);
         if (user != null) {
           transactor = user.getName();
         }
       }
       transactorNum = transactorNum + currentPrincipals.size();
     }
   }
   // 判断当前环节是否是子流程
   hasActivitySubProcess = taskService.getActivetySubProcess(instance.getProcessInstanceId());
   return "delTransactor";
 }
Example #2
0
 /** 流程监控 增加办理人 */
 public String addTransactor() throws Exception {
   if (instanceId != null)
     workflowInstance = workflowInstanceManager.getWorkflowInstance(instanceId);
   else workflowInstance = workflowInstanceManager.getWorkflowInstance(workflowId);
   workflowId = workflowInstance.getProcessInstanceId();
   forkTask = taskService.isForkTask(workflowId);
   // 判断当前环节是否是子流程
   hasActivitySubProcess =
       taskService.getActivetySubProcess(workflowInstance.getProcessInstanceId());
   return "addTransactor";
 }
Example #3
0
 /** 流程监控 更改办理人 */
 public String changeTransactor() throws Exception {
   if (instanceId != null)
     workflowInstance = workflowInstanceManager.getWorkflowInstance(instanceId);
   else workflowInstance = workflowInstanceManager.getWorkflowInstance(workflowId);
   taskList =
       taskService.getActivityTasks(
           workflowInstance.getProcessInstanceId(), ContextUtils.getCompanyId());
   // 判断当前环节是否是子流程
   hasActivitySubProcess =
       taskService.getActivetySubProcess(workflowInstance.getProcessInstanceId());
   return "changeTransactor";
 }
Example #4
0
 /**
  * 批量环节跳转/选择环节
  *
  * @return
  * @throws Exception
  */
 @Action("task-volumeBackView")
 public String volumeBackView() throws Exception {
   String[] str = instanceIds.split(",");
   workflowIds = "";
   for (String s : str) {
     workflowInstance = workflowInstanceManager.getWorkflowInstance(Long.valueOf(s));
     if (workflowInstance != null) wfdId = workflowInstance.getWorkflowDefinitionId();
     workflowId = workflowInstance.getProcessInstanceId();
     boolean isForkTask = taskService.isForkTask(workflowId);
     if (!isForkTask) { // 当前任务是分支汇聚任务时不让跳转
       List<String> temp = taskService.getTaskNames(workflowId);
       if (temp != null && temp.size() > 0) {
         if (StringUtils.isNotEmpty(workflowIds)) {
           workflowIds += ",";
         }
         canBackTo = temp;
         workflowIds += workflowId;
       }
     } else {
       break;
     }
   }
   if (canBackTo == null) {
     canBackTo = new ArrayList<String>();
   }
   ApiFactory.getBussinessLogService().log("流程监控", "批量环节跳转选择环节页面", ContextUtils.getSystemId("wf"));
   return SUCCESS;
 }
Example #5
0
 /** 保存审批结果 */
 public String saveOpinion() throws Exception {
   workflowInstance = workflowInstanceManager.getWorkflowInstance(workflowId);
   Opinion opi = new Opinion();
   opi.setTransactor(ContextUtils.getUserName());
   opi.setCreatedTime(new Date());
   opi.setOpinion(opinion);
   opi.setWorkflowId(workflowInstance.getProcessInstanceId());
   opi.setCompanyId(ContextUtils.getCompanyId());
   opi.setTaskId(taskId);
   workflowInstanceManager.saveOpinion(opi);
   ApiFactory.getBussinessLogService().log("流程汇编", "保存意见", ContextUtils.getSystemId("wf"));
   return opinion();
 }
Example #6
0
 /**
  * 环节跳转/选择环节
  *
  * @return
  * @throws Exception
  */
 public String backView() throws Exception {
   workflowInstance = workflowInstanceManager.getWorkflowInstance(instanceId);
   if (workflowInstance != null) wfdId = workflowInstance.getWorkflowDefinitionId();
   workflowId = workflowInstance.getProcessInstanceId();
   boolean isForkTask = taskService.isForkTask(workflowId);
   if (!isForkTask) { // 当前任务是分支汇聚任务时不让跳转
     canBackTo = taskService.getTaskNames(workflowId);
   } else {
     canBackTo = new ArrayList<String>();
   }
   ApiFactory.getBussinessLogService().log("流程监控", "环节跳转选择环节页面", ContextUtils.getSystemId("wf"));
   return "goback";
 }
 // 新建word/excel
 @Action("office-createOffice")
 public String createOffice() throws Exception {
   WorkflowInstance instance = null;
   WorkflowTask task = null;
   if (id == null) {
     task = ApiFactory.getTaskService().getTask(taskId);
     instance = workflowInstanceManager.getWorkflowInstance(task.getProcessInstanceId());
     document.setTaskName(task.getName());
     document.setTaskMode(task.getProcessingMode());
     document.setWorkflowId(instance.getProcessInstanceId());
     document.setCreator(ContextUtils.getLoginName());
     document.setCreatorName(ContextUtils.getUserName());
     document.setCompanyId(ContextUtils.getCompanyId());
     document.setEditType("-1,0,0,0,0,0,1,1"); // 允许编辑,不显示和保留痕迹,允许批注
     document.setPrintSetting(true);
     document.setDownloadSetting(true);
     if (document.getFileType().equalsIgnoreCase("pdf")) {
       return "office-pdf";
     } else {
       String template =
           DefinitionXmlParse.getOfficialTextTemplate(
               instance.getProcessDefinitionId(), task.getName());
       if (StringUtils.isNotEmpty(template))
         document.setTemplateId(Long.valueOf(StringUtils.substringBetween(template, "[", "]")));
       setOfficeRight(document, instance, task);
       return "office-view";
     }
   } else {
     if (taskId == null) {
       instance = workflowInstanceManager.getWorkflowInstance(document.getWorkflowId());
       task = ApiFactory.getTaskService().getTask(instance.getFirstTaskId());
     } else {
       task = ApiFactory.getTaskService().getTask(taskId);
       instance = workflowInstanceManager.getWorkflowInstance(task.getProcessInstanceId());
     }
     setOfficeRight(document, instance, task);
     if (document.getFileType().equalsIgnoreCase("pdf")) {
       return "office-pdf";
     } else {
       return "office-view";
     }
   }
 }