예제 #1
0
  /** 处理记录导出 */
  public String exportOperatedList() {
    List<AlarmEntity> exportlist;
    UserInfo user = getCurrentUser();

    if (searchVO.getOrganization_id() == null || "".equals(searchVO.getOrganization_id())) {
      searchVO.setOrganization_id(user.getOrganizationID());
    }
    try {
      searchVO.setOperate_state("1"); // 已处理
      exportlist = this.service.getObjects("VehicleCheckManage.getVehicleCheckList", searchVO);
      for (AlarmEntity obj : exportlist) {
        // 处理类型
        if (Constants.VECHICLE_ILLEAGAL_USE.equals(obj.getOperate_type())) {
          obj.setOperate_type("公车私用");
        } else {
          obj.setOperate_type("正常使用");
        }
      }
    } catch (BusinessException e) {
      log.error("Export error:" + e.getMessage(), e);
      return ERROR;
    }
    String title = "异常用车处理记录";
    return exportList(title, "operatedExport", exportlist);
  }
예제 #2
0
  /** 从菜单进入页面 */
  public String readyPage() {
    // 设置默认查询条件
    searchVO.setBeginTime(DateUtil.getMonthFirstDay1());
    searchVO.setEndTime(DateUtil.getCurrentDay());
    searchVO.setCurr_date(DateUtil.getCurrentDay());

    return SUCCESS;
  }
예제 #3
0
  /** 异常用车导出 */
  public String exportIllList() {
    List<AlarmEntity> exportlist;
    UserInfo user = getCurrentUser();

    if (searchVO.getOrganization_id() == null || "".equals(searchVO.getOrganization_id())) {
      searchVO.setOrganization_id(user.getOrganizationID());
    }
    try {
      searchVO.setOperate_state("0"); // 未处理
      exportlist = this.service.getObjects("VehicleCheckManage.getVehicleCheckList", searchVO);
    } catch (BusinessException e) {
      log.error("Export error:" + e.getMessage(), e);
      return ERROR;
    }
    String title = "异常用车记录";
    return exportList(title, "illListExport", exportlist);
  }
예제 #4
0
  /** 公车私用巡检列表,处理记录查询 */
  public String operatedList() {
    // 根据传过来的查询参数查询列表数据
    String browseTitle = "公车私用巡检列表,处理记录查询";
    // 用户信息
    UserInfo userInfo = getCurrentUser();
    HttpServletRequest request = getCurrentRequest();

    try {
      // 分页
      String rpNum = request.getParameter("rp");
      String pageIndex = request.getParameter("page");
      String sortName = request.getParameter("sortname");
      String sortOrder = request.getParameter("sortorder");
      searchVO.setSortName(sortName);
      searchVO.setSortOrder(sortOrder);

      searchVO.setOrganization_id(userInfo.getOrganizationID());
      int totalCount = 0;
      totalCount = this.service.getCount("VehicleCheckManage.getVehicleCheckCount", searchVO);
      List<AlarmEntity> list =
          this.service.getObjectsByPage(
              "VehicleCheckManage.getVehicleCheckList",
              searchVO,
              (Integer.parseInt(pageIndex) - 1) * Integer.parseInt(rpNum),
              Integer.parseInt(rpNum));
      // 添加列表为空提示
      if (list.size() == 0) {
        addActionMessage(getText("nodata.list"));
      } else {
        this.map = getOperatedPagination(list, totalCount, pageIndex, rpNum); // 转换map
      }

    } catch (BusinessException e) {
      this.log.error("公车私用巡检列表,处理记录查询出错", e);
    }
    // 设置操作描述
    this.addOperationLog(browseTitle);
    // 设置操作类型
    this.setOperationType(Constants.SELECT);
    // 设置所属应用系统
    this.setApplyId(Constants.XC_P_CODE);
    // 设置所属模块
    this.setModuleId(MouldId.XCP_ALARM_QUERY_ID);
    return SUCCESS;
  }
예제 #5
0
  /** 导出 */
  public String exportList(String title, String sheetName, List<AlarmEntity> exportList) {
    String filePath = "";
    OutputStream outputStream = null;
    try {

      filePath = "/tmp/" + UUIDGenerator.getUUID() + sheetName + ".xls";

      File file = new File(filePath);
      if (!file.getParentFile().exists()) {
        file.getParentFile().mkdirs();
      }
      outputStream = new FileOutputStream(filePath);
      // 使用Excel导出器IEExcelExporter
      IEExcelExporter excelExporter = new IEExcelExporter(outputStream);
      excelExporter.setTitle(
          title + "(" + searchVO.getBeginTime() + "~" + searchVO.getEndTime() + ")");

      excelExporter.putAutoExtendSheets(sheetName, 0, exportList);
      // 将Excel写入到指定的流中
      excelExporter.write();
    } catch (FileNotFoundException e) {
      log.error("Export error:" + e.getMessage());
      return ERROR;
    } catch (Exception e) {
      log.error("Export error:" + e.getMessage());
      return ERROR;
    } finally {
      // 关闭流
      if (null != outputStream) {
        try {
          outputStream.close();
        } catch (IOException e) {;
        }
      }
    }
    // 设置下载文件属性
    FileInputStream fileInputStream = null;
    OutputStream out = null;
    try {
      // 设置下载文件属性
      String fileName = URLEncoder.encode(title, "UTF8");
      HttpServletResponse response = ServletActionContext.getResponse();
      response.setHeader(
          "Content-disposition",
          "attachment;filename="
              + fileName
              + "-"
              + DateUtil.formatDateToString(new Date(), "yyyyMMddHHmmss")
              + ".xls");
      response.setContentType("application/msexcel; charset=\"utf-8\"");

      // 下载刚生成的文件
      fileInputStream = new FileInputStream(filePath);
      out = response.getOutputStream();
      int i = 0;
      while ((i = fileInputStream.read()) != -1) {
        out.write(i);
      }
    } catch (FileNotFoundException e) {
      log.error("Export error:" + e.getMessage());
      return ERROR;
    } catch (Exception e) {
      log.error("Export error:" + e.getMessage());
      return ERROR;
    } finally {
      // 关闭流
      if (null != fileInputStream) {
        try {
          fileInputStream.close();
        } catch (IOException e) {;
        }
      }
      if (null != out) {
        try {
          out.close();
        } catch (IOException e) {;
        }
      }
    }
    return null;
  }