/** 处理记录导出 */ 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); }
/** 异常用车处理后指向下一条记录 */ public void getNextRow() { String ret = ""; try { List<AlarmEntity> list = this.service.getObjectsByPage("VehicleCheckManage.getVehicleCheckList", searchVO, 0, 1); if (list.size() > 0) { AlarmEntity info = list.get(0); ret = info.getAlarm_id() + "," + info.getVehicle_code() + "," + info.getVehicle_ln(); } } catch (BusinessException e) { ret = ""; this.log.error("异常用车处理后指向下一条记录出错", e); } this.printWriter(ret); }
/** 意见批量处理 */ 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("处理成功!"); }
/** * 转换Map 处理记录 * * @param list * @param totalCountDay * @param pageIndex * @return */ public Map<String, Object> getOperatedPagination( List<AlarmEntity> list, int totalCount, String pageIndex, String rpNum) { List<Object> mapList = new ArrayList<Object>(); Map<String, Object> mapData = new HashMap<String, Object>(); for (int i = 0; i < list.size(); i++) { AlarmEntity alarm = list.get(i); Map<String, Object> cellMap = new LinkedHashMap<String, Object>(); cellMap.put("id", alarm.getAlarm_id()); cellMap.put( "cell", new Object[] { alarm.getAlarm_id(), alarm.getVehicle_code(), alarm.getVehicle_ln(), alarm.getDriver_name(), alarm.getDriver_tel(), alarm.getEffect_time(), alarm.getAlarm_time(), alarm.getAlarm_end_time(), alarm.getUse_time(), alarm.getMileage(), alarm.getOperate_type(), alarm.getOpeerate_desc(), alarm.getUser_name(), alarm.getConfirm_time(), alarm.getAlarm_id() }); mapList.add(cellMap); } mapData.put("page", pageIndex); // 从前台获取当前第page页 mapData.put("total", totalCount); // 从数据库获取总记录数 mapData.put("rows", mapList); return mapData; }