/** * 页面初始化/查询 * * @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; }
/** * 转换为Map对象 * * @param dayList * @param totalCountDay * @param pageIndex * @return */ public Map getPagination(List stList, int totalCount, String pageIndex) { List mapList = new ArrayList(); Map mapData = new LinkedHashMap(); for (int i = 0; i < stList.size(); i++) { StudentInfo s = (StudentInfo) stList.get(i); Map cellMap = new LinkedHashMap(); String flag = findStudent(s.getStu_id()); String html = initcheckBoxHtml(s.getStu_id(), s.getStu_name(), flag); cellMap.put("id", s.getStu_id()); cellMap.put( "cell", new Object[] { html, s.getStu_code(), s.getStu_name(), s.getStu_school(), s.getStu_class(), flag }); mapList.add(cellMap); } // if (null == oilManage) { // oilManage = new OilManage(); // } mapData.put("page", pageIndex); // 从前台获取当前第page页 mapData.put("total", totalCount); // 从数据库获取总记录数 mapData.put("rows", mapList); return mapData; }
/** 为了行车规划做的学生列表 */ 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; }
/** 新选学生专用 */ public String stShow2() { final String vehTitle = "学生选择列表"; try { if (info == null) { info = new StudentInfo(); } if ("none".equals(stu_id) || "".equals(stu_id)) { info.setStu_id("-1"); } else { info.setStu_id(stu_id); } studentList = (List<StudentInfo>) service.getObjects("RidingPlan.getStudentShow", info); } catch (BusinessException e) { addActionError(getText(e.getMessage())); log.error(vehTitle, e); return ERROR; } return SUCCESS; }
/** 展示详细 */ 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; }
public void getupstudentname() { final String vehTitle = "取得学生姓名"; String studentname = ""; try { if (info == null) { info = new StudentInfo(); } info.setUpstudentids(upstudentids); studentname = (String) service.getObject("RidingPlan.getupstudentname", info); HttpServletResponse response = ServletActionContext.getResponse(); response.setCharacterEncoding("UTF-8"); try { response.getWriter().write(studentname); } catch (IOException ioException) {; } } catch (BusinessException e) { addActionError(getText(e.getMessage())); log.error(vehTitle, e); } }
/** 为了行车规划做的新学生列表 */ 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; }