Beispiel #1
0
  @SuppressWarnings("unchecked")
  public String start() throws Exception {
    log.debug("*** start 方法开始");
    log.debug(
        new StringBuilder("*** Received parameter:[")
            .append("processId:")
            .append(processId)
            .append("]")
            .toString());

    WorkflowDefinition wdf = workflowDefinitionManager.getWorkflowDefinitionByProcessId(processId);
    String wfdName = wdf.getName();
    String url =
        Struts2Utils.getRequest()
            .getRequestURL()
            .toString()
            .replaceFirst("task!start", "task!input");
    Map<String, String> urlMap = new HashMap<String, String>();
    urlMap.put(wfdName, url);
    Integer priority = 6;
    Map<String, String[]> parameterMap = Struts2Utils.getRequest().getParameterMap();
    String[] urgency = parameterMap.get(URGENCY);
    if (urgency != null && urgency.length > 0 && StringUtils.isNotEmpty(urgency[0]))
      priority = Integer.valueOf(urgency[0]);
    String to = "";
    CompleteTaskTipType result =
        workflowInstanceManager.startAndSubmitWorkflow(processId, urlMap, priority, null);
    switch (result) {
      case OK:
        this.addSuccessMessage(result.getContent());
        to = null;
        break;
      case MESSAGE:
        this.addErrorMessage(result.getContent());
        to = null;
        break;
      case RETURN_URL:
        to = assignTransactor();
        break;
    }
    ApiFactory.getBussinessLogService().log("工作流管理", "发起流程", ContextUtils.getSystemId("wf"));
    return to;
  }
  public void exportToExcel(OutputStream fileOut) throws IOException {
    HSSFWorkbook wb;
    try {
      wb = new HSSFWorkbook();
      HSSFSheet sheet = wb.createSheet("table-colums");

      HSSFFont boldFont = wb.createFont();
      boldFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);

      HSSFCellStyle boldStyle = wb.createCellStyle();
      boldStyle.setFont(boldFont);

      HSSFRow row = sheet.createRow(0);
      HSSFCell cell0 = row.createCell(0);
      cell0.setCellValue("字段名称");
      cell0.setCellStyle(boldStyle);
      HSSFCell cell1 = row.createCell(1);
      cell1.setCellValue("列名");
      cell1.setCellStyle(boldStyle);
      HSSFCell cell2 = row.createCell(2);
      cell2.setCellValue("字段别名");
      cell2.setCellStyle(boldStyle);
      HSSFCell cell3 = row.createCell(3);
      cell3.setCellValue("字段类型");
      cell3.setCellStyle(boldStyle);
      HSSFCell cell4 = row.createCell(4);
      cell4.setCellValue("默认值");
      cell4.setCellStyle(boldStyle);
      HSSFCell cell5 = row.createCell(5);
      cell5.setCellValue("最大长度");
      cell5.setCellStyle(boldStyle);
      HSSFCell cell6 = row.createCell(6);
      cell6.setCellValue("显示顺序");
      cell6.setCellStyle(boldStyle);

      String value = Struts2Utils.getParameter("subTableVals");
      String[] arr = value.split("=");
      String jsonString = arr[1];
      if (jsonString != null && StringUtils.isNotEmpty(jsonString.toString())) {
        getSheetContent(jsonString, sheet);
      }
      wb.write(fileOut);
    } catch (IOException exception) {
    }
  }
Beispiel #3
0
  /**
   * 设置办理人
   *
   * @return
   * @throws Exception
   */
  public String setTransactor() throws Exception {
    log.debug("*** setTransactor 办理任务方法开始");

    Map<String, List<String>> taskCondidates = new HashMap<String, List<String>>();
    for (String taskId : targetNames) {
      String[] condidates =
          Struts2Utils.getRequest().getParameterValues("targetTransactors_" + taskId);
      List<String> condidateList = new ArrayList<String>();
      for (String condidate : condidates) {
        condidateList.add(condidate.split("_")[0]);
      }
      taskCondidates.put(taskId, condidateList);
    }
    taskService.setTasksTransactor(taskId, taskCondidates);
    task = taskService.getTask(taskId);
    ApiFactory.getBussinessLogService().log("工作流管理", "设置办理人", ContextUtils.getSystemId("wf"));
    this.addSuccessMessage("任务已完成");
    log.debug("*** setTransactor 方法结束");
    return view();
  }