コード例 #1
0
  /**
   * 业务数据类型页读取
   *
   * @param is 需要读取的文件流
   */
  public List<PDMBusinessDataType> BusTypeReader(HSSFWorkbook wb) {
    List<PDMBusinessDataType> btList = new ArrayList<PDMBusinessDataType>();
    HSSFSheet sheet = wb.getSheet(BT_SHEET);
    if (sheet == null) {
      return btList;
    }
    HSSFFormulaEvaluator evaluator = wb.getCreationHelper().createFormulaEvaluator();
    for (int i = 2; i <= sheet.getLastRowNum(); i++) {

      HSSFRow row = sheet.getRow(i);
      PDMBusinessDataType bt = new PDMBusinessDataType();
      // 1
      HSSFCell cell = row.getCell(1);
      bt.setTypeName(POIUtils.getCellStringValue(cell, evaluator));
      // 2
      cell = row.getCell(2);
      bt.setTypeChineseName(POIUtils.getCellStringValue(cell, evaluator));
      // 3
      cell = row.getCell(3);
      bt.setStandardTypeName(POIUtils.getCellStringValue(cell, evaluator));
      // 4
      cell = row.getCell(4);
      bt.setLength(POIUtils.getCellStringValue(cell, evaluator));
      // 5
      cell = row.getCell(5);
      bt.setPrecision(POIUtils.getCellStringValue(cell, evaluator));
      // 6
      cell = row.getCell(6);
      bt.setDefaultValue(POIUtils.getCellStringValue(cell, evaluator));
      // 7
      cell = row.getCell(7);
      bt.setComment(POIUtils.getCellStringValue(cell, evaluator));
      btList.add(bt);
    }
    return btList;
  }
コード例 #2
0
  /**
   * 标准字段列表读取
   *
   * @param is 需要读取的文件流
   */
  public List<PDMStandardField> standardFieldReader(HSSFWorkbook wb) {
    List<PDMStandardField> stdList = new ArrayList<PDMStandardField>();
    HSSFSheet sheet = wb.getSheet(STD_SHEET);
    if (sheet == null) {
      return stdList;
    }
    HSSFFormulaEvaluator evaluator = wb.getCreationHelper().createFormulaEvaluator();
    for (int i = 2; i <= sheet.getLastRowNum(); i++) {
      HSSFRow row = sheet.getRow(i);
      PDMStandardField std = new PDMStandardField();
      stdList.add(std);
      // 1
      HSSFCell cell = row.getCell(1);
      std.setOldName(POIUtils.getCellStringValue(cell, evaluator));
      // 2
      cell = row.getCell(2);
      std.setOldChineseName(POIUtils.getCellStringValue(cell, evaluator));

      // 3
      cell = row.getCell(3);
      std.setOldBusType(POIUtils.getCellStringValue(cell, evaluator));
      // 4
      cell = row.getCell(4);
      String[] tableNameArray =
          StringUtils.split(
              StringUtils.defaultIfBlank(POIUtils.getCellStringValue(cell, evaluator), ""), ",,");
      for (String tableName : tableNameArray) {
        std.getBelongTableList().add(tableName);
      }
      // 5
      cell = row.getCell(5);
      std.getBolongSubSystemList().add((POIUtils.getCellStringValue(cell, evaluator)));
      // 6
      cell = row.getCell(6);
      std.setGenName(POIUtils.getCellStringValue(cell, evaluator));
      // 7
      cell = row.getCell(7);
      std.setNewName(POIUtils.getCellStringValue(cell, evaluator));
      // 8
      cell = row.getCell(8);
      std.setNewChineseName(POIUtils.getCellStringValue(cell, evaluator));
      // 9
      cell = row.getCell(9);
      std.setGenBusType(POIUtils.getCellStringValue(cell, evaluator));
      // 10
      cell = row.getCell(10);
      std.setNewBusType(POIUtils.getCellStringValue(cell, evaluator));
      // 11
      cell = row.getCell(11);
      std.setOldComment(POIUtils.getCellStringValue(cell, evaluator));
      // 12
      cell = row.getCell(12);
      std.setNewComment(POIUtils.getCellStringValue(cell, evaluator));
      // 13
      cell = row.getCell(13);
      std.setDictId(POIUtils.getCellStringValue(cell, evaluator));
      // 14
      cell = row.getCell(14);
      std.setModefyDesc(POIUtils.getCellStringValue(cell, evaluator));
      // 15
      cell = row.getCell(15);
      std.setImportPath(POIUtils.getCellStringValue(cell, evaluator));
    }
    return stdList;
  }