Esempio n. 1
0
 /**
  * 批量保存字段
  *
  * @param dataTable
  */
 @Transactional(readOnly = false)
 public void saveTableColumns(DataTable dataTable) {
   List<Object> list = JsonParser.getFormTableDatas(TableColumn.class);
   for (Object obj : list) {
     TableColumn column = (TableColumn) obj;
     column.setCompanyId(ContextUtils.getCompanyId());
     column.setDataTableId(dataTable.getId());
     tableColumnDao.save(column);
   }
 }
Esempio n. 2
0
  private void getSheetContent(String jsonString, HSSFSheet sheet) {
    try {
      MapType mt =
          TypeFactory.defaultInstance().constructMapType(HashMap.class, String.class, String.class);
      CollectionType ct =
          TypeFactory.defaultInstance().constructCollectionType(ArrayList.class, mt);
      List<Map<String, String>> prms = JsonParser.json2Object(ct, jsonString);

      for (int i = 0; i < prms.size(); i++) {
        HSSFRow rowi = sheet.createRow(i);
        Set<Entry<String, String>> set = prms.get(i).entrySet();
        for (Entry<String, String> en : set) {
          if (!"id".equals(en.getKey()) && !"displayOrder".equals(en.getKey())) {
            if (en.getValue() != null) {
              String value = en.getValue();
              if ("name".equals(en.getKey())) {
                HSSFCell celli0 = rowi.createCell(0);
                celli0.setCellValue(value);
                continue;
              }
              if ("dbColumnName".equals(en.getKey())) {
                HSSFCell celli1 = rowi.createCell(1);
                celli1.setCellValue(value);
                continue;
              }
              if ("alias".equals(en.getKey())) {
                HSSFCell celli2 = rowi.createCell(2);
                celli2.setCellValue(value);
                continue;
              }
              if ("dataType".equals(en.getKey())) {
                HSSFCell celli3 = rowi.createCell(3);
                celli3.setCellValue(value);
                continue;
              }
              if ("defaultValue".equals(en.getKey())) {
                HSSFCell celli4 = rowi.createCell(4);
                celli4.setCellValue(value);
                continue;
              }
              if ("maxLength".equals(en.getKey())) {
                HSSFCell celli5 = rowi.createCell(5);
                celli5.setCellValue(value);
                continue;
              }
            }
          }
        }
        HSSFCell celli6 = rowi.createCell(6);
        celli6.setCellValue(i);
      }
    } catch (Exception e) {
    }
  }
  // 我接收的流程
  @Action("tree-delegateAccept")
  public String delegateAccept() throws Exception {
    List<ZTreeNode> treeNodes = new ArrayList<ZTreeNode>();
    String name = getText("workflow.doing") + "(" + taskService.getAcceptTasksNum(false) + ")";
    ZTreeNode root = new ZTreeNode("ACC_ING", "0", name, "false", "false", "", "", "folder", "");
    treeNodes.add(root);

    name = getText("workflow.complete") + "(" + taskService.getAcceptTasksNum(true) + ")";
    root = new ZTreeNode("ACC_END", "0", name, "false", "false", "", "", "folder", "");
    treeNodes.add(root);
    renderText(JsonParser.object2Json(treeNodes));
    return null;
  }
  // 移交任务
  @Action("transfer-task-tree")
  public String transferTaskTree() throws Exception {
    List<ZTreeNode> treeNodes = new ArrayList<ZTreeNode>();
    String name =
        getText("workflow.doing")
            + "("
            + taskService.getTransferTaskNum(ContextUtils.getUserId(), false)
            + ")";
    ZTreeNode root =
        new ZTreeNode("TRANSFER_ING", "0", name, "false", "false", "", "", "folder", "");
    treeNodes.add(root);

    name =
        getText("workflow.complete")
            + "("
            + taskService.getTransferTaskNum(ContextUtils.getUserId(), true)
            + ")";
    root = new ZTreeNode("TRANSFER_END", "0", name, "false", "false", "", "", "folder", "");
    treeNodes.add(root);
    renderText(JsonParser.object2Json(treeNodes));
    return null;
  }
  // 我委托的流程
  @Action("tree-delegateMonitor")
  public String delegateMonitor() throws Exception {
    List<ZTreeNode> treeNodes = new ArrayList<ZTreeNode>();
    String name =
        getText("workflow.doing")
            + "("
            + taskService.getDelegateTasksNum(
                getCompanyId(), getCurrentUser(), ContextUtils.getUserId(), false)
            + ")";
    ZTreeNode root = new ZTreeNode("DEL_ING", "0", name, "false", "false", "", "", "folder", "");
    treeNodes.add(root);

    name =
        getText("workflow.complete")
            + "("
            + taskService.getDelegateTasksNum(
                getCompanyId(), getCurrentUser(), ContextUtils.getUserId(), true)
            + ")";
    root = new ZTreeNode("DEL_END", "0", name, "false", "false", "", "", "folder", "");
    treeNodes.add(root);
    renderText(JsonParser.object2Json(treeNodes));
    return null;
  }
  // 我受托的流程
  @Action("tree-superviseAsTrusteeTree")
  public String superviseAsTrusteeTree() throws Exception {
    List<ZTreeNode> treeNodes = new ArrayList<ZTreeNode>();
    String name =
        getText("workflow.doing")
            + "("
            + taskService.getTrusteeTasksNum(
                getCompanyId(), getCurrentUser(), ContextUtils.getUserId(), false)
            + ")";
    ZTreeNode root =
        new ZTreeNode("TRUSTEE_ING", "0", name, "false", "false", "", "", "folder", "");
    treeNodes.add(root);

    name =
        getText("workflow.complete")
            + "("
            + taskService.getTrusteeTasksNum(
                getCompanyId(), getCurrentUser(), ContextUtils.getUserId(), true)
            + ")";
    root = new ZTreeNode("TRUSTEE_END", "0", name, "false", "false", "", "", "folder", "");
    treeNodes.add(root);
    renderText(JsonParser.object2Json(treeNodes));

    //		StringBuilder tree = new StringBuilder("[ ");
    //		tree.append(JsTreeUtils.generateJsTreeNodeDefault("TRUSTEE_ING", null,
    //				getText("workflow.doing") + "(" +
    //				taskService.getTrusteeTasksNum(getCompanyId(), getCurrentUser(),ContextUtils.getUserId(),
    // false) + ")" )).append(",");
    //		tree.append(JsTreeUtils.generateJsTreeNodeDefault("TRUSTEE_END", null,
    //				getText("workflow.complete") + "(" +
    //				taskService.getTrusteeTasksNum(getCompanyId(), getCurrentUser(),
    // ContextUtils.getUserId(),true) + ")" ));
    //
    //	tree.append(" ]");
    return null;
  }
 /**
  * 流程及表单类型树
  *
  * @return
  * @throws Exception
  */
 @Action("tree-wfTypes")
 public String wfTypes() throws Exception {
   List<ZTreeNode> treeNodes = new ArrayList<ZTreeNode>();
   List<WorkflowType> wfTypes = workflowTypeManager.getAllWorkflowType();
   List<BusinessSystem> businessSystemList = acsApiManager.getAllBusiness(getCompanyId());
   String result = "";
   if ("INITIALIZED_PROCESS".equals(currentId)) {
     ZTreeNode root =
         new ZTreeNode("ENABLE_ALL_1", "0", "当前版本", "true", "false", "", "", "folder", "");
     treeNodes.add(root);
     getSecondNodesInWftypeTree(wfTypes, businessSystemList, "ENABLE", treeNodes, "ENABLE_ALL_1");
     ZTreeNode UnenableRoot =
         new ZTreeNode("UNABLE_ALL_1", "0", "历史版本", "false", "false", "", "", "folder", "");
     treeNodes.add(UnenableRoot);
     getSecondNodesInWftypeTree(wfTypes, businessSystemList, "UNABLE", treeNodes, "UNABLE_ALL_1");
   } else if ("INITIALIZED_MONITOR".equals(currentId)) {
     ZTreeNode root =
         new ZTreeNode("WFT_monitor_0", "0", "当前实例", "true", "false", "", "", "folder", "");
     treeNodes.add(root);
     getSecondNodesInMonitorTree(wfTypes, treeNodes, "WFT_monitor_0");
     root =
         new ZTreeNode(
             "WFT_history_monitor_0", "0", "归档实例", "false", "false", "", "", "folder", "");
     treeNodes.add(root);
     getSecondNodesInMonitorHistoryTree(wfTypes, treeNodes, "WFT_history_monitor_0");
   } else if ("INITIALIZED_DICT".equals(currentId)) {
     ZTreeNode root =
         new ZTreeNode("WFT_myCreate_0", "0", "所有数据", "false", "false", "", "", "folder", "");
     treeNodes.add(root);
     root = new ZTreeNode("WFT_type_0", "0", "类型管理", "false", "false", "", "", "folder", "");
     treeNodes.add(root);
   } else if ("INITIALIZED_TEMPLATE".equals(currentId)) {
     ZTreeNode root =
         new ZTreeNode(
             "WFT_0",
             "0",
             getText("workflow.allTemplate"),
             "false",
             "false",
             "",
             "",
             "folder",
             "");
     treeNodes.add(root);
     for (WorkflowType wft : wfTypes) {
       root =
           new ZTreeNode(
               "WFT_" + wft.getId(), "0", wft.getName(), "false", "false", "", "", "folder", "");
       treeNodes.add(root);
     }
   } else if ("INITIALIZED_WFD_TEMPLATE".equals(currentId)) {
     ZTreeNode root =
         new ZTreeNode(
             "WFDT_0",
             "0",
             getText("workflow.allTemplate"),
             "false",
             "false",
             "",
             "",
             "folder",
             "");
     treeNodes.add(root);
     for (WorkflowType wft : wfTypes) {
       root =
           new ZTreeNode(
               "WFDT_" + wft.getId(), "0", wft.getName(), "false", "false", "", "", "folder", "");
       treeNodes.add(root);
     }
   }
   result = JsonParser.object2Json(treeNodes);
   renderText(result);
   return null;
 }