Beispiel #1
0
 public String showVehicleDetail() {
   try {
     AnnouncementInfo info =
         (AnnouncementInfo) service.getObject("WxManage.getGonggaoInfoById", announcementInfo);
     String vins = info.getGonggao_veh();
     if (vins != null && !"".equals(vins)) {
       String vinStr = "";
       String[] tmp = vins.split(",");
       for (String v : tmp) {
         vinStr += "'" + v + "',";
       }
       if (!"".equals(vinStr)) vinStr = vinStr.substring(0, vinStr.length() - 1);
       UserInfo user = getCurrentUser();
       VehcileInfo vehinfo = new VehcileInfo();
       vehinfo.setOrganization_id(user.getOrganizationID());
       if (vehicle_ln != null && vehicle_ln != "") {
         vehinfo.setVehicle_ln(vehicle_ln.trim());
       }
       vehinfo.setVehicle_vin(vinStr);
       vehicleList = (List<VehcileInfo>) service.getObjects("WxManage.getInfosVeh", vehinfo);
     }
   } catch (BusinessException e) {
     super.addActionError(getText("info.db.error"));
     log.error(e.getMessage());
     return ERROR;
   } catch (Exception e) {
     super.addActionError(getText("info.db.error"));
     log.error(e.getMessage());
     return ERROR;
   }
   return SUCCESS;
 }
Beispiel #2
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);
  }
Beispiel #3
0
  /**
   * 页面初始化/查询
   *
   * @return
   */
  public String init() {

    try {
      UserInfo user = getCurrentUser();
      if (info == null) {
        info = new StudentInfo();
      }
      info.setOrganization_id(user.getOrganizationID());
      info.setEnterprise_id(user.getEntiID());
      studentList = (List<StudentInfo>) service.getObjects("User.getStudentList", info);

      if (studentList != null && studentList.size() == 0) {
        // 无用户信息
        addActionError("无任何记录信息!");
        return ERROR;
      }
    } catch (BusinessException e) {
      super.addActionError("数据库操作失败!");
      log.error(e.getMessage());
      return ERROR;
    } catch (Exception e) {
      super.addActionError("数据库操作失败!");
      log.error(e.getMessage());
      return ERROR;
    }

    return SUCCESS;
  }
Beispiel #4
0
 public String queryVehicle() {
   try {
     UserInfo user = getCurrentUser();
     VehcileInfo vehinfo = new VehcileInfo();
     vehinfo.setOrganization_id(user.getOrganizationID());
     if (vehicle_ln != null && vehicle_ln != "") {
       vehinfo.setVehicle_ln(vehicle_ln.trim());
     }
     vehicleList = (List<VehcileInfo>) service.getObjects("WxManage.getInfosVeh", vehinfo);
     if (vehicleList != null && vehicleList.size() == 0) {
       // 无用户信息
       addActionError(getText("nodata.list"));
       return ERROR;
     }
   } catch (BusinessException e) {
     super.addActionError(getText("info.db.error"));
     log.error(e.getMessage());
     return ERROR;
   } catch (Exception e) {
     super.addActionError(getText("info.db.error"));
     log.error(e.getMessage());
     return ERROR;
   }
   return SUCCESS;
 }
Beispiel #5
0
  public String addAnnouncement() {
    if (null == announcementInfo) {
      return addBefore();
    }
    final String addTitle = getText("announcement.add.info");
    log.info(addTitle);
    try {
      UserInfo user = getCurrentUser();
      announcementInfo.setGonggao_author(user.getUserID());
      announcementInfo.setGonggao_id(UUIDGenerator.getUUID());
      announcementInfo.setEnterprise_id(user.getOrganizationID());
      service.insert("WxManage.insertannouncementInfo", announcementInfo);
    } catch (BusinessException e) {
      log.error(addTitle, e);
      addActionError(e.getMessage());
      return ERROR;
    }
    setMessage("announcement.addsuccess.message");

    this.addOperationLog(formatLog(addTitle, null));
    // 设置操作类型
    this.setOperationType(Constants.INSERT);
    // 设置所属应用系统
    this.setApplyId(Constants.CLW_P_CODE);
    // 设置所属模块
    //        this.setModuleId(MouldId.XCP_DRIVERMANAGE_ADD);
    return SUCCESS;
  }
Beispiel #6
0
  /**
   * 查询刷卡记录列表
   *
   * @return
   */
  public String getDriverRecordList() {
    HttpServletRequest request =
        (HttpServletRequest)
            ActionContext.getContext().get(org.apache.struts2.StrutsStatics.HTTP_REQUEST);
    String searchTimeType = request.getParameter("searchTimeType");
    String driverIds = request.getParameter("driverIds");
    DriverStatInfo info = new DriverStatInfo();
    String rpNum = request.getParameter("rp");
    String pageIndex = request.getParameter("page");
    String sortName = request.getParameter("sortname");
    String sortOrder = request.getParameter("sortorder");
    String state = request.getParameter("state");
    String ln = request.getParameter("ln");
    info.setSortname(sortName);
    info.setSortorder(sortOrder);
    info.setState(state);
    info.setVehicleLn(ln);
    try {
      if ("1".equals(searchTimeType)) { // 按时段查询
        String start_time = request.getParameter("start_time");
        String end_time = request.getParameter("end_time");
        info.setBegTime(start_time + " 00:00:00");
        info.setEndTime(end_time + " 23:59:59");
      } else {
        String month = request.getParameter("month");
        String first = month + "-01";
        Calendar cal = Calendar.getInstance();
        cal.set(Calendar.YEAR, Integer.parseInt(month.substring(0, 4)));
        cal.set(Calendar.MONTH, Integer.parseInt(month.substring(5, 7)));
        cal.set(Calendar.DAY_OF_MONTH, 1);
        cal.add(Calendar.DAY_OF_MONTH, -1);
        info.setBegTime(first + " 00:00:00");
        info.setEndTime(month + "-" + cal.get(Calendar.DAY_OF_MONTH) + " 23:59:59");
      }
      String searchIds = "";
      if (driverIds.length() > 0) {
        String[] Ids = driverIds.split(","); // 字符串转字符数组
        for (String id : Ids) {
          searchIds = searchIds + "'" + id + "',";
        }
        info.setDriverId(searchIds.substring(0, searchIds.length() - 1));
      }
      UserInfo user =
          (UserInfo) ActionContext.getContext().getSession().get(Constants.USER_SESSION_KEY);
      info.setEnterpriseId(user.getOrganizationID());
      int totalCount = service.getCount("Drivershuaka.getDriverRecordCount", info);
      List<DriverStatInfo> list =
          service.getObjectsByPage(
              "Drivershuaka.getDriverRecordList",
              info,
              (Integer.parseInt(pageIndex) - 1) * Integer.parseInt(rpNum),
              Integer.parseInt(rpNum));

      this.map = getDriverRecordPagination(list, totalCount, pageIndex, rpNum);
    } catch (BusinessException e) {
      log.info("司机刷卡记录查询异常", e);
      return ERROR;
    }
    return SUCCESS;
  }
Beispiel #7
0
 /**
  * 浏览公告信息
  *
  * @return
  */
 public String announcementBrowse() {
   final String browseTitle = getText("wx.announcement.browse.title");
   log.info(browseTitle);
   HttpServletRequest request =
       (HttpServletRequest)
           ActionContext.getContext().get(org.apache.struts2.StrutsStatics.HTTP_REQUEST);
   UserInfo user = getCurrentUser();
   try {
     if (null == announcementInfo) {
       announcementInfo = new AnnouncementInfo();
     }
     announcementInfo.setGonggao_author(author);
     announcementInfo.setStart_time(start_time + " 00:00:00");
     announcementInfo.setEnd_time(end_time + " 23:59:59");
     announcementInfo.setEnterprise_id(user.getOrganizationID());
     String rpNum = request.getParameter("rp");
     String pageIndex = request.getParameter("page");
     String sortName = request.getParameter("sortname");
     String sortOrder = request.getParameter("sortorder");
     announcementInfo.setSortname(sortName);
     announcementInfo.setSortorder(sortOrder);
     int totalCount = 0;
     totalCount = service.getCount("WxManage.getCount", announcementInfo);
     // Page pageObj = new Page(page, totalCount, pageSize, url, param);
     // this.pageBar = PageHelper.getPageBar(pageObj);
     announcementList =
         (List<AnnouncementInfo>)
             service.getObjectsByPage(
                 "WxManage.getInfos",
                 announcementInfo,
                 (Integer.parseInt(pageIndex) - 1) * Integer.parseInt(rpNum),
                 Integer.parseInt(rpNum));
     this.map = getPagination(announcementList, totalCount, pageIndex, rpNum); // 转换map
     //            if (announcementList.size() == 0) {
     //                addActionMessage(getText("nodata.list"));
     //            }
     // 用于添加或者删除时显示消息
     if (null != message) {
       addActionMessage(getText(message));
     }
     // 设置操作描述
     this.addOperationLog(formatLog(browseTitle, null));
     // 设置操作类型
     this.setOperationType(Constants.SELECT);
     // 设置所属应用系统
     this.setApplyId(Constants.CLW_P_CODE);
     // 设置所属模块
     //            this.setModuleId(MouldId.XCP_DRIVERMANAGE_QUERY);
   } catch (BusinessException e) {
     addActionError(getText(e.getMessage()));
     log.error(browseTitle, e);
     return ERROR;
   }
   return SUCCESS;
 }
Beispiel #8
0
  /** 为了行车规划做的学生列表 */
  public String stList() {
    final String vehTitle = "学生选择列表";
    int totalCount = 0;
    UserInfo user = getCurrentUser();

    HttpServletRequest request =
        (HttpServletRequest)
            ActionContext.getContext().get(org.apache.struts2.StrutsStatics.HTTP_REQUEST);
    // 每页显示条数
    String rpNum = request.getParameter("rp");
    // 当前页码
    String pageIndex = request.getParameter("page");
    String sortName = request.getParameter("sortname");
    String sortOrder = request.getParameter("sortorder");

    try {
      if (info == null) {
        info = new StudentInfo();
      }
      info.setOrganization_id(user.getOrganizationID());
      info.setEnterprise_id(user.getEntiID());
      info.setSortname(sortName);
      info.setSortorder(sortOrder);
      // info.setRp(rpNum);
      // info.setPage(pageIndex);
      totalCount = service.getCount("RidingPlan.getCountST", info);

      studentList =
          (List<StudentInfo>)
              service.getObjectsByPage(
                  "RidingPlan.getStudentList",
                  info,
                  (Integer.parseInt(pageIndex) - 1) * Integer.parseInt(rpNum),
                  Integer.parseInt(rpNum));

      this.map = getPagination(studentList, totalCount, pageIndex);

      // 设置操作描述
      // this.addOperationLog(formatLog(vehTitle, null));
      // 设置操作类型
      // this.setOperationType(Constants.SELECT);
      // 设置所属应用系统
      // this.setApplyId(Constants.CLW_P_CODE);
      // 设置所属模块
      // this.setModuleId(MouldId.YTP_OILMANAGE_QUREY_ID);
    } catch (BusinessException e) {
      addActionError(getText(e.getMessage()));
      log.error(vehTitle, e);
      return ERROR;
    }

    return SUCCESS;
  }
Beispiel #9
0
  /** 展示详细 */
  public String stShow() {
    final String vehTitle = "学生选择列表";
    int totalCount = 0;
    UserInfo user = getCurrentUser();

    HttpServletRequest request =
        (HttpServletRequest)
            ActionContext.getContext().get(org.apache.struts2.StrutsStatics.HTTP_REQUEST);
    // 每页显示条数
    String rpNum = request.getParameter("rp");
    // 当前页码
    String pageIndex = request.getParameter("page");
    String sortName = request.getParameter("sortname");
    String sortOrder = request.getParameter("sortorder");

    try {
      if (info == null) {
        info = new StudentInfo();
      }
      info.setOrganization_id(user.getOrganizationID());
      info.setEnterprise_id(user.getEntiID());
      info.setSortname(sortName);
      info.setSortorder(sortOrder);
      if (info.getStu_id() == null
          || "none".equals(info.getStu_id())
          || "".equals(info.getStu_id())) {
        info.setStu_id("-1");
      }
      totalCount = service.getCount("RidingPlan.getCountSTShow", info);

      studentList =
          (List<StudentInfo>)
              service.getObjectsByPage(
                  "RidingPlan.getStudentShow",
                  info,
                  (Integer.parseInt(pageIndex) - 1) * Integer.parseInt(rpNum),
                  Integer.parseInt(rpNum));

      this.map = getPagination2(studentList, totalCount, pageIndex);
    } catch (BusinessException e) {
      addActionError(getText(e.getMessage()));
      log.error(vehTitle, e);
      return ERROR;
    }

    return SUCCESS;
  }
Beispiel #10
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);
  }
Beispiel #11
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;
  }
Beispiel #12
0
  /** 为了行车规划做的新学生列表 */
  public String stList2() {
    final String vehTitle = "学生选择列表";
    UserInfo user = getCurrentUser();

    try {
      if (info == null) {
        info = new StudentInfo();
      }
      info.setOrganization_id(user.getOrganizationID());
      info.setEnterprise_id(user.getEntiID());
      info.setStu_name(stu_name);
      info.setStu_code(stu_code);
      info.setStu_class(stu_class);
      info.setStu_school(stu_school);
      info.setSite_desc(site_desc);
      info.setUpnotexist(upnotexist);
      info.setDownnotexist(downnotexist);
      info.setRoute_id(route_id);
      info.setDelupexistdata(delupexistdata);
      info.setDeldownexistdata(deldownexistdata);
      info.setSearchparam(searchparam);
      studentList = (List<StudentInfo>) service.getObjects("RidingPlan.getStudentList", info);
      // 设置操作描述
      // this.addOperationLog(formatLog(vehTitle, null));
      // 设置操作类型
      // this.setOperationType(Constants.SELECT);
      // 设置所属应用系统
      // this.setApplyId(Constants.CLW_P_CODE);
      // 设置所属模块
      // this.setModuleId(MouldId.YTP_OILMANAGE_QUREY_ID);
    } catch (BusinessException e) {
      addActionError(getText(e.getMessage()));
      log.error(vehTitle, e);
      return ERROR;
    }

    return SUCCESS;
  }
Beispiel #13
0
 /** 意见批量处理 */
 public void batchOperate() {
   // 用户信息
   UserInfo userInfo = getCurrentUser();
   HttpServletRequest request = getCurrentRequest();
   String ids = request.getParameter("ids");
   String desc = request.getParameter("desc");
   String type = request.getParameter("type");
   // 处理的告警参数
   AlarmEntity alarm = new AlarmEntity();
   alarm.setDeal_flag(Constants.ALARM_E_CODE); // 已处理
   alarm.setUser_id(userInfo.getUserID());
   alarm.setConfirm_time(DateUtil.formatDateToString(new Date(), "yyyy-MM-dd HH:mm:ss"));
   alarm.setIds(formatString(ids));
   alarm.setOpeerate_desc(desc);
   alarm.setOperate_type(type);
   try {
     this.service.update("VehicleCheckManage.updateAlarm", alarm);
   } catch (BusinessException e) {
     this.log.error("意见批量处理出错", e);
     this.printWriter("处理失败!");
   }
   this.printWriter("处理成功!");
 }
Beispiel #14
0
 /**
  * 按记录导出
  *
  * @return
  */
 public String exportRecord() {
   String exportTitle = "驾驶员刷卡记录";
   List<DriverStatInfo> list = new ArrayList<DriverStatInfo>();
   try {
     if ("1".equals(exportObj.getSearchTimeType())) { // 按时段查询
       String start_time = exportObj.getBegTime();
       String end_time = exportObj.getEndTime();
       exportObj.setBegTime(start_time + " 00:00:00");
       exportObj.setEndTime(end_time + " 23:59:59");
     } else {
       String month = exportObj.getMonth();
       String first = month + "-01";
       Calendar cal = Calendar.getInstance();
       cal.set(Calendar.YEAR, Integer.parseInt(month.substring(0, 4)));
       cal.set(Calendar.MONTH, Integer.parseInt(month.substring(5, 7)));
       cal.set(Calendar.DAY_OF_MONTH, 1);
       cal.add(Calendar.DAY_OF_MONTH, -1);
       exportObj.setBegTime(first + " 00:00:00");
       System.out.println(cal.get(Calendar.DAY_OF_MONTH));
       exportObj.setEndTime(month + "-" + cal.get(Calendar.DAY_OF_MONTH) + " 23:59:59");
     }
     String driverIds = exportObj.getDriverId();
     String searchIds = "";
     if (driverIds.length() > 0) {
       String[] Ids = driverIds.split(","); // 字符串转字符数组
       for (String id : Ids) {
         searchIds = searchIds + "'" + id + "',";
       }
       exportObj.setDriverId(searchIds.substring(0, searchIds.length() - 1));
     }
     UserInfo user =
         (UserInfo) ActionContext.getContext().getSession().get(Constants.USER_SESSION_KEY);
     exportObj.setEnterpriseId(user.getOrganizationID());
     if ("1".equals(exportObj.getState())) exportObj.setState("UP");
     else if ("2".equals(exportObj.getState())) exportObj.setState("DOWN");
     list =
         (List<DriverStatInfo>) service.getObjects("Drivershuaka.getDriverRecordList", exportObj);
   } catch (BusinessException e) {
     setMessage("info.db.error");
     log.error(exportTitle + "Export Data error:" + e.getMessage());
     return ERROR;
   } catch (Exception e) {
     e.printStackTrace();
     setMessage("info.db.error");
     log.error(exportTitle + "Export Data error:" + e.getMessage());
     return ERROR;
   }
   String filePath = "";
   OutputStream outputStream = null;
   try {
     filePath = "/tmp/" + UUIDGenerator.getUUID() + "DriverShuaka.xls";
     File file = new File(filePath);
     if (!file.getParentFile().exists()) {
       file.getParentFile().mkdirs();
     }
     outputStream = new FileOutputStream(filePath);
     IEExcelExporter excelExporter = new IEExcelExporter(outputStream);
     if ("1".equals(exportObj.getSearchTimeType())) // 按时段查询
     excelExporter.setTitle(
           exportTitle
               + "("
               + exportObj.getBegTime().substring(0, 10)
               + "——"
               + exportObj.getEndTime().substring(0, 10)
               + ")");
     else excelExporter.setTitle(exportTitle + "(" + exportObj.getMonth() + ")");
     if (null == list || list.size() < 1) {
       list.add(new DriverStatInfo());
     }
     excelExporter.putAutoExtendSheets("exportDriverShuaka", 0, list);
     // 将Excel写入到指定的流中
     excelExporter.write();
   } catch (FileNotFoundException e) {
     setMessage("file.export.error");
     log.error(exportTitle + "Export Data error:" + e.getMessage());
     return ERROR;
   } catch (Exception e) {
     setMessage("file.export.error");
     log.error(exportTitle + "Export Data error:" + e.getMessage());
     return ERROR;
   } finally {
     // 关闭流
     if (null != outputStream) {
       try {
         outputStream.close();
       } catch (IOException e) {;
       }
     }
   }
   // 设置下载文件属性
   HttpServletResponse response = ServletActionContext.getResponse();
   response.setHeader(
       "Content-disposition",
       "attachment;filename=driver_shuaka_info-" + DateUtil.getCurrentDayTime() + ".xls");
   response.setContentType("application/msexcel; charset=\"utf-8\"");
   FileInputStream fileInputStream = null;
   OutputStream out = null;
   try {
     // 下载刚生成的文件
     fileInputStream = new FileInputStream(filePath);
     out = response.getOutputStream();
     int i = 0;
     while ((i = fileInputStream.read()) != -1) {
       out.write(i);
     }
   } catch (FileNotFoundException e) {
     setMessage("file.export.error");
     log.error("Export student error:" + e.getMessage());
     return ERROR;
   } catch (Exception e) {
     setMessage("file.export.error");
     log.error("Export student error:" + e.getMessage());
     return null;
   } finally {
     // 关闭流
     if (null != fileInputStream) {
       try {
         fileInputStream.close();
       } catch (IOException e) {;
       }
     }
     if (null != out) {
       try {
         out.close();
       } catch (IOException e) {;
       }
     }
   }
   // 导出文件成功
   return null;
 }