Exemplo n.º 1
0
 /**
  * 功能:获取部门盘点设备明细Excel文件
  *
  * @return File
  * @throws DataTransException
  */
 public File getExportFile() throws DataTransException {
   File file = null;
   try {
     CostCheckResultModel modelProducer = (CostCheckResultModel) sqlProducer;
     SQLModel sqlModel = modelProducer.getPageQueryModel();
     String reportTitle = "盘点结果报表(按部门)";
     String fileName = reportTitle + ".xls";
     String filePath = WorldConstant.USER_HOME;
     filePath += WorldConstant.FILE_SEPARATOR;
     filePath += fileName;
     TransRule rule = new TransRule();
     rule.setDataSource(sqlModel);
     rule.setSourceConn(conn);
     rule.setTarFile(filePath);
     DataRange range = new DataRange();
     rule.setDataRange(range);
     rule.setFieldMap(getFieldMap());
     CustomTransData custData = new CustomTransData();
     custData.setReportTitle(reportTitle);
     custData.setReportPerson(userAccount.getUsername());
     custData.setNeedReportDate(true);
     rule.setCustData(custData);
     rule.setCalPattern(LINE_PATTERN);
     TransferFactory factory = new TransferFactory();
     DataTransfer transfer = factory.getTransfer(rule);
     transfer.transData();
     file = (File) transfer.getTransResult();
   } catch (SQLModelException ex) {
     ex.printLog();
     throw new DataTransException(ex);
   }
   return file;
 }
Exemplo n.º 2
0
  /**
   * 功能:导出Excel文件。
   *
   * @return File
   * @throws com.sino.base.exception.DataTransException
   */
  public File exportFile() throws DataTransException {
    File file = null;
    try {
      DataTransfer transfer = null;
      SQLModel sqlModel = sqlProducer.getPageQueryModel();
      TransRule rule = new TransRule();
      rule.setDataSource(sqlModel);
      rule.setCalPattern(CalendarConstant.LINE_PATTERN);
      rule.setSourceConn(conn);

      String fileName = "基站地点统计表.xls";
      String filePath = WorldConstant.USER_HOME;
      filePath += WorldConstant.FILE_SEPARATOR;
      filePath += fileName;
      rule.setTarFile(filePath);

      DataRange range = new DataRange();
      rule.setDataRange(range);

      Map fieldMap = new HashMap();
      fieldMap.put("WORKORDER_OBJECT_CODE", "地点编号");
      fieldMap.put("WORKORDER_OBJECT_NAME", "地点简称");
      fieldMap.put("WORKORDER_OBJECT_LOCATION", "所在地点");
      fieldMap.put("ORGANIZATION_ID", "组织ID");
      fieldMap.put("COUNTY_NAME", "所在区县");
      fieldMap.put("DISABLE_DATE", "失效日期");
      fieldMap.put("CATEGORY_NAME", "地点类别");
      //		fieldMap.put("IS_TEMP_ADDR", "是否临时地点");
      fieldMap.put("CREATION_DATE", "创建日期");
      fieldMap.put("CREATED_BY", "创建人");
      fieldMap.put("PROJECT_NAME", "所属工程");

      rule.setFieldMap(fieldMap);

      CustomTransData custData = new CustomTransData();
      custData.setReportTitle(fileName);
      custData.setReportPerson(sfUser.getUsername());
      custData.setNeedReportDate(true);
      rule.setCustData(custData);
      /*rule.setSheetSize(1000);*/
      // 设置分页显示
      TransferFactory factory = new TransferFactory();
      transfer = factory.getTransfer(rule);
      transfer.transData();
      file = (File) transfer.getTransResult();
    } catch (SQLModelException ex) {
      ex.printLog();
      throw new DataTransException(ex);
    }
    return file;
  }
Exemplo n.º 3
0
  /**
   * 功能:导出Excel文件。
   *
   * @return File
   * @throws com.sino.base.exception.DataTransException
   */
  public File exportFileM() throws DataTransException {
    File file = null;
    try {
      //            SQLModel sqlModel = sqlProducer.getPageQueryModel();     //获得查询的sql
      AmsHouseInfoDTO HLDTO = (AmsHouseInfoDTO) dtoParameter;
      GetMisHousInfoModel updateEII = new GetMisHousInfoModel(userAccount, HLDTO);
      SQLModel sqlModel = updateEII.getDispositionModel();

      TransRule rule = new TransRule();
      rule.setDataSource(sqlModel);
      rule.setCalPattern(CalendarConstant.LINE_PATTERN);
      rule.setSourceConn(conn);
      String fileName = "房屋土地信息表.xls";
      String filePath = WorldConstant.USER_HOME;
      filePath += WorldConstant.FILE_SEPARATOR;
      filePath += fileName;
      rule.setTarFile(filePath);
      DataRange range = new DataRange();
      rule.setDataRange(range);
      Map fieldMap = new HashMap();
      fieldMap.put("BARCODE", "条码");
      fieldMap.put("ITEM_NAME", "名称");
      fieldMap.put("ITEM_SPEC", "型号");
      fieldMap.put("HOUSE_ADDRESS", "地点");
      fieldMap.put("HOUSE_AREA", "房屋面积");
      fieldMap.put("OCCUPY_AREA", "占地面积");
      fieldMap.put("OFFICE_USAGE", "用途");
      fieldMap.put("OFFICE_TYPE", "类型");
      fieldMap.put("HOUSE_CERTIFICATE_NO", "房产证号");
      fieldMap.put("LAND_CERTFICATE_NO", "土地证号");
      fieldMap.put("ATTRIBUTE2", "是否处理");
      rule.setFieldMap(fieldMap);
      CustomTransData custData = new CustomTransData();
      custData.setReportTitle("房屋土地信息表");
      custData.setReportPerson(userAccount.getUsername());
      custData.setNeedReportDate(true);
      rule.setCustData(custData);
      TransferFactory factory = new TransferFactory();
      DataTransfer transfer = factory.getTransfer(rule);
      transfer.transData();
      file = (File) transfer.getTransResult();
    } catch (SQLModelException ex) {
      ex.printLog();
      throw new DataTransException(ex);
    }
    return file;
  }
Exemplo n.º 4
0
 /**
  * 功能:导出未处理的Excel文件。
  *
  * @return File
  * @throws com.sino.base.exception.DataTransException
  */
 public File exportMisFile() throws DataTransException {
   File file = null;
   try {
     SQLModel sqlModel = sqlProducer.getPageQueryModel(); // 获得查询的sql
     TransRule rule = new TransRule();
     rule.setDataSource(sqlModel);
     rule.setCalPattern(CalendarConstant.LINE_PATTERN);
     rule.setSourceConn(conn);
     String fileName = "未导入房屋土地信息表.xls";
     String filePath = WorldConstant.USER_HOME;
     filePath += WorldConstant.FILE_SEPARATOR;
     filePath += fileName;
     rule.setTarFile(filePath);
     DataRange range = new DataRange();
     rule.setDataRange(range);
     Map fieldMap = new HashMap();
     fieldMap.put("TAG_NUMBER", "条码");
     fieldMap.put("ASSETS_DESCRIPTION", "名称");
     fieldMap.put("MODEL_NUMBER", "型号");
     fieldMap.put("ASSIGNED_TO_NAME", "责任人");
     fieldMap.put("DATE_PLACED_IN_SERVICE", "启用日期");
     fieldMap.put("ASSETS_LOCATION", "地点");
     rule.setFieldMap(fieldMap);
     CustomTransData custData = new CustomTransData();
     custData.setReportTitle("信息表");
     custData.setReportPerson(userAccount.getUsername());
     custData.setNeedReportDate(true);
     rule.setCustData(custData);
     TransferFactory factory = new TransferFactory();
     DataTransfer transfer = factory.getTransfer(rule);
     transfer.transData();
     file = (File) transfer.getTransResult();
   } catch (SQLModelException ex) {
     ex.printLog();
     throw new DataTransException(ex);
   }
   return file;
 }
Exemplo n.º 5
0
  public File exportFile() throws DataTransException {
    File file = null;
    try {
      SQLModel sqlModel = sqlProducer.getPageQueryModel();
      TransRule rule = new TransRule();
      rule.setDataSource(sqlModel);
      rule.setSourceConn(conn);

      String fileName = "备件业务单据统计表.xls";
      String filePath = WorldConstant.USER_HOME;
      filePath += WorldConstant.FILE_SEPARATOR;
      filePath += fileName;
      rule.setTarFile(filePath);

      DataRange range = new DataRange();
      rule.setDataRange(range);

      Map fieldMap = new HashMap();
      fieldMap.put("TRANS_NO", "单据号");
      fieldMap.put("CREATED_USER", "创建人");
      fieldMap.put("CREATION_DATE", "创建日期");
      fieldMap.put("TRANS_STATUS_NAME", "单据状态");
      fieldMap.put("TRANS_TYPE_NAME", "单据类型");
      rule.setFieldMap(fieldMap);

      CustomTransData custData = new CustomTransData();
      custData.setReportTitle(fileName);
      custData.setReportPerson(sfUser.getUsername());
      custData.setNeedReportDate(true);
      rule.setCustData(custData);
      /*rule.setSheetSize(1000);*/
      // 设置分页显示
      TransferFactory factory = new TransferFactory();
      DataTransfer transfer = factory.getTransfer(rule);
      transfer.transData();
      file = (File) transfer.getTransResult();
    } catch (SQLModelException ex) {
      ex.printLog();
      throw new DataTransException(ex);
    }
    return file;
  }
Exemplo n.º 6
0
  public File exportFile() throws DataTransException {
    File file = null;
    try {
      ItemInfoDTO itemInfoDto = (ItemInfoDTO) dtoParameter;
      if (itemInfoDto.getQryType().equals(WebAttrConstant.BY_DAIWEI)) {
        SQLModel sqlModel = sqlProducer.getPageQueryModel();
        TransRule rule = new TransRule();
        rule.setDataSource(sqlModel);
        rule.setCalPattern(CalendarConstant.LINE_PATTERN);
        rule.setSourceConn(conn);
        String fileName = "设备信息.xls";
        String filePath = WorldConstant.USER_HOME;
        filePath += WorldConstant.FILE_SEPARATOR;
        filePath += fileName;
        rule.setTarFile(filePath);
        DataRange range = new DataRange();
        rule.setDataRange(range);

        Map fieldMap = new HashMap();
        //            fieldMap.put("ORG_NAME", "公司");
        fieldMap.put("BARCODE", "条码");
        fieldMap.put("ITEM_NAME", "设备名称");
        fieldMap.put("ITEM_SPEC", "规格型号");
        fieldMap.put("WORKORDER_OBJECT_CODE", "地点编号");
        fieldMap.put("WORKORDER_OBJECT_LOCATION", "所在地点");
        fieldMap.put("NAME", "代维公司");

        rule.setFieldMap(fieldMap);

        CustomTransData custData = new CustomTransData();
        custData.setReportTitle("设备信息");
        custData.setReportPerson(sfUser.getUsername());
        custData.setNeedReportDate(true);
        rule.setCustData(custData);
        TransferFactory factory = new TransferFactory();
        DataTransfer transfer = factory.getTransfer(rule);
        transfer.transData();
        file = (File) transfer.getTransResult();
      } else {
        SQLModel sqlModel = sqlProducer.getPageQueryModel();
        TransRule rule = new TransRule();
        rule.setDataSource(sqlModel);
        rule.setCalPattern(CalendarConstant.LINE_PATTERN);
        rule.setSourceConn(conn);
        String fileName = "设备信息.xls";
        String filePath = WorldConstant.USER_HOME;
        filePath += WorldConstant.FILE_SEPARATOR;
        filePath += fileName;
        rule.setTarFile(filePath);
        DataRange range = new DataRange();
        rule.setDataRange(range);

        Map fieldMap = new HashMap();
        //            fieldMap.put("ORG_NAME", "公司");
        fieldMap.put("BARCODE", "条码");
        fieldMap.put("ITEM_NAME", "设备名称");
        fieldMap.put("ITEM_SPEC", "规格型号");
        fieldMap.put("ITEM_CATEGORY", "设备分类");
        fieldMap.put("START_DATE", "启用日期");
        fieldMap.put("PROJECT_NAME", "所属工程");
        fieldMap.put("WORKORDER_OBJECT_NAME", "所属地点");
        fieldMap.put("COUNTY_NAME", "所属区县");

        rule.setFieldMap(fieldMap);

        CustomTransData custData = new CustomTransData();
        custData.setReportTitle("设备信息");
        custData.setReportPerson(sfUser.getUsername());
        custData.setNeedReportDate(true);
        rule.setCustData(custData);
        TransferFactory factory = new TransferFactory();
        DataTransfer transfer = factory.getTransfer(rule);
        transfer.transData();
        file = (File) transfer.getTransResult();
      }
    } catch (SQLModelException ex) {
      ex.printLog();
      throw new DataTransException(ex);
    }
    return file;
  }