基于javaweb+mysql的ssm航班机票预订平台系统(java+ssm+js+jsp+mysql)

基于javaweb+mysql的ssm航班机票预订平台系统(java+ssm+js+jsp+mysql)

私信源码获取及调试交流

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

基于javaweb的SSM航班机票预订平台系统(java+ssm+js+jsp+mysql)

项目介绍

管理员角色包含以下功能: 管理员登录,用户管理,客机管理,航班管理,机票管理,密码修改等功能。

用户角色包含以下功能: 查看所有机票,用户登录注册,机票预订,查看我的订单等功能。

环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可 4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 5.数据库:MySql 5.7版本;

技术栈

  1. 后端:Spring+SpringMVC+Mybatis 2. 前端:HTML+CSS+JavaScript+jsp

使用说明

  1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中application.yml配置文件中的数据库配置改为自己的配置; 4. 运行项目,输入localhost:8080/ 登录
    flight.setPage(pageBean.getStart());
    flight.setPageSize(pageBean.getPageSize());
    flight.setDateFrom(dateFrom);
    flight.setDateTo(dateTo);
    Integer count = flightService.getCount(flight);
    flightList = flightService.getIndexList(flight);
    // getPageNum(count, pageBean);
    ModelAndView mav = getPageCode(count, pageBean, request);
    return mav;
  }

  @RequestMapping("/list")
  public ModelAndView list(HttpServletRequest request) {
    PageBean pageBean = null;
    Flight flight = new Flight();
    String page = request.getParameter("page");
    if (page != null) {
      pageBean = new PageBean(Integer.parseInt(page), 10);
    }
    flight.setPage(pageBean.getStart());
    flight.setPageSize(pageBean.getPageSize());
    Integer count = flightService.getCount(flight);
    flightList = flightService.getIndexList(flight);
    // getPageNum(count, pageBean);
    ModelAndView mav = getPageCode(count, pageBean, request);
    return mav;
  }

  @RequestMapping("/save")
  @ResponseBody
  public Object save(Flight flight, HttpServletResponse response, HttpServletRequest request) {
    JSONObject result = new JSONObject();
    String fromTime = request.getParameter("fromTime");
    String toTime = request.getParameter("toTime");
    DateUtil dateUtil = new DateUtil();
    flight.setFromtime(dateUtil.formatString(fromTime, format));
    flight.setTotime(dateUtil.formatString(toTime, format));

    Integer i = 0;
    System.out.println("=========" + flight.getId());
    try {
      if (flight.getId() == null) {//用户添加
        String fcTicketTotal = request.getParameter("fctickettotal");
        String ecTicketTotal = request.getParameter("ectickettotal");
        flight.setEcticketremain(Integer.parseInt(ecTicketTotal));
        flight.setFcticketremain(Integer.parseInt(fcTicketTotal));
        i = flightService.insertSelective(flight);
      } else {//用户修改
        i = flightService.updateByPrimaryKeySelective(flight);
      }
      System.out.println("====flight====updateOrAdd===" + i);

public class CookiesFilter implements Filter {

  public void destroy() {

  }

  public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain)
          throws IOException, ServletException {
    HttpServletRequest request = (HttpServletRequest) req;
    HttpServletResponse response = (HttpServletResponse) resp;
    System.out.println(request.getRequestURI());
    String requestURI = request.getRequestURI();
   /* if (requestURI.indexOf("index") > -1 || requestURI.indexOf("resources") > -1 || requestURI.indexOf("managerLoginPage") > -1 || requestURI.indexOf("manager/login") > -1) {
      chain.doFilter(request, response);
      return;
    }
    if (requestURI.indexOf("/flight/") > -1 || requestURI.indexOf("/ticketOrder/") > -1 || requestURI.indexOf("/aircraft/") > -1 || requestURI.indexOf("/user/") > -1) {
      chain.doFilter(request, response);
      return;
    }*/
    if (!(requestURI.indexOf("/manager/") > -1)) {
      chain.doFilter(request, response);
      return;
    } else {
      if (requestURI.indexOf("/manager/managerLoginPage") > -1 || requestURI.indexOf("/manager/login") > -1) {
        chain.doFilter(request, response);
        return;
      }
      if (request.getCookies() != null) {
        Cookie[] cs = request.getCookies();
        System.out.println(cs.length);
        if (cs != null && cs.length > 0) {
          for (Cookie c : cs) {
            String cName = c.getName();
  private JsonDateValueProcessor jsonDateValueProcessor = new JsonDateValueProcessor(format);

  @RequestMapping("/adminTicketOrderPage")
  public String aircraftList() {
    return "admin/ticketOrderManage";
  }

  @RequestMapping("/myTicketOrderList")
  public ModelAndView myTicketOrderList(HttpServletRequest request) {
ModelAndView mav = new ModelAndView();
    String currentUser = request.getSession().getAttribute("currentUser").toString();
    List<Ticketorder> ticketOrderList = ticketOrderService.getTicketOrderByUserName(currentUser);
    JsonConfig jsonConfig = new JsonConfig();
    jsonConfig.registerJsonValueProcessor(Date.class, jsonDateValueProcessor);
    JSONArray array = JSONArray.fromObject(ticketOrderList, jsonConfig);
    mav.addObject("ticketOrderList",array);
    mav.setViewName("main_userCenter");
    request.setAttribute("mainPage","ticket/myTicketOrderList.jsp");
    return mav;
  }

  @RequestMapping("/preTicketOrder")
  public ModelAndView preTicketOrder(HttpServletRequest request){

      Integer  flightId = Integer.parseInt(request.getParameter("flightId"));
      String currentUser = request.getSession().getAttribute("currentUser").toString();
      User user = userService.getUserByUsername(currentUser);
      Flight flight = flightService.selectByPrimaryKey(flightId);
      ModelAndView mav = new ModelAndView();
      mav.addObject("flight",flight);
      mav.addObject("currentUser",user);
      mav.setViewName("main_userCenter");
      request.setAttribute("mainPage","ticket/ticketOrder.jsp");
      return mav;

  }

  @RequestMapping("/saveTicketOrder")
  public ModelAndView saveTicketOrder(HttpServletRequest request){

      ModelAndView mav = new ModelAndView();
  }

  @RequestMapping("/list")
  public ModelAndView list(HttpServletRequest request) {
    PageBean pageBean = null;
    Flight flight = new Flight();
    String page = request.getParameter("page");
    if (page != null) {
      pageBean = new PageBean(Integer.parseInt(page), 10);
    }
    flight.setPage(pageBean.getStart());
    flight.setPageSize(pageBean.getPageSize());
    Integer count = flightService.getCount(flight);
    flightList = flightService.getIndexList(flight);
    // getPageNum(count, pageBean);
    ModelAndView mav = getPageCode(count, pageBean, request);
    return mav;
  }

  @RequestMapping("/save")
  @ResponseBody
  public Object save(Flight flight, HttpServletResponse response, HttpServletRequest request) {
    JSONObject result = new JSONObject();
    String fromTime = request.getParameter("fromTime");
    String toTime = request.getParameter("toTime");
    DateUtil dateUtil = new DateUtil();
    flight.setFromtime(dateUtil.formatString(fromTime, format));
    flight.setTotime(dateUtil.formatString(toTime, format));

    Integer i = 0;
    System.out.println("=========" + flight.getId());
    try {
      if (flight.getId() == null) {//用户添加
        String fcTicketTotal = request.getParameter("fctickettotal");
        String ecTicketTotal = request.getParameter("ectickettotal");
        flight.setEcticketremain(Integer.parseInt(ecTicketTotal));
        flight.setFcticketremain(Integer.parseInt(fcTicketTotal));
        i = flightService.insertSelective(flight);
      } else {//用户修改
        i = flightService.updateByPrimaryKeySelective(flight);
      }
      System.out.println("====flight====updateOrAdd===" + i);
      if (i > 0) {
        flag = true;
      }
      result.put("success", flag);
      ResponseUtil.write(response, result);
    } catch (Exception e) {
      e.printStackTrace();
    }
    return null;
  }
    index_flight = getFlight(pageBean);
    index_flight.setFlighttype(flightType1);
    flightList1 = flightService.getIndexList(index_flight);
    index_flight.setFlighttype(flightType2);
    flightList2 = flightService.getIndexList(index_flight);
    mav.addObject("flightList1", flightList1);
    mav.addObject("flightList2", flightList2);
    mav.setViewName(viewName);
    return mav;
  }

  @RequestMapping("/search")
  public ModelAndView search(Flight flight, HttpServletRequest request) throws ParseException {
    String page = request.getParameter("page");
    String departTime = request.getParameter("departTime");
    Date dateFrom = null;
    Date dateTo = null;
    if(departTime!=null&&!departTime.equals("")){
    	SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        dateFrom = sdf.parse(departTime+" 00:00:00");
        dateTo = sdf.parse(departTime+" 23:59:59");
    }
    
    if (page == null) {
      page = "1";
    }
    PageBean pageBean = new PageBean(Integer.parseInt(page), 10);
    flight.setPage(pageBean.getStart());
    flight.setPageSize(pageBean.getPageSize());
    flight.setDateFrom(dateFrom);
    flight.setDateTo(dateTo);
    Integer count = flightService.getCount(flight);
    flightList = flightService.getIndexList(flight);
    // getPageNum(count, pageBean);
    ModelAndView mav = getPageCode(count, pageBean, request);
    return mav;
  }

  @RequestMapping("/list")
  public ModelAndView list(HttpServletRequest request) {
    PageBean pageBean = null;
    Flight flight = new Flight();
    String page = request.getParameter("page");
    if (page != null) {
      pageBean = new PageBean(Integer.parseInt(page), 10);
    }
    flight.setPage(pageBean.getStart());
    flight.setPageSize(pageBean.getPageSize());
    Integer count = flightService.getCount(flight);
    flightList = flightService.getIndexList(flight);
    // getPageNum(count, pageBean);
				flag = true;
				message = "数据全部成功删除!";
			} else {
				message = "id为" + flightId.substring(0, flightId.length() - 1) + "的客机有航班任务,不可进行删除操作!";
			}
			result.put("success", flag);
			result.put("message", message);
			ResponseUtil.write(response, result);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}

	@RequestMapping("/adminAircraftList")
	public String adminAircraftList(HttpServletRequest request, Aircraft aircraft, HttpServletResponse response) {
		PageBean pageBean = new PageBean();
		JSONObject result = new JSONObject();
		String page = request.getParameter("page");
		String rows = request.getParameter("rows");
		if (rows != null) {
			pageBean.setPageSize(Integer.parseInt(rows));
			aircraft.setPageSize(pageBean.getPageSize());
		}
		if (page != null) {
			pageBean.setPage(Integer.parseInt(page));
			aircraft.setPage(pageBean.getStart());
		}
		try {
			Integer count = aircraftService.getCount(aircraft);
			List<Aircraft> aircraftList = aircraftService.getAircraftList(aircraft);
			JsonConfig jsonConfig = new JsonConfig();
			jsonConfig.registerJsonValueProcessor(Date.class, new JsonDateValueProcessor(format));
			JSONArray array = JSONArray.fromObject(aircraftList, jsonConfig);
			result.put("rows", array);
			result.put("total", count);
			ResponseUtil.write(response, result);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}

	@RequestMapping("/managerLoginPage")
	public String managerLoginPage() {
		return loginPage;
	}


/**
 * com.chen.ssm.web
 * 作者      : 陈晓
 * 描述      :
 * 修改日期  :
 */

@Controller
@RequestMapping("/flight")
public class FlightController {

  private HttpServletRequest request;
  private HttpServletResponse response;
  private List<Flight> flightList;
  private List<Ticketorder> ticketorderList;
  private List<Flight> flightList1; // 国内航班
  private List<Flight> flightList2; // 国际航班
  private Flight search_flight;
  private Flight list_flight;
  private Flight index_flight;
  private String flightType1 = "国内航班";
  private String flightType2 = "国际航班";
  private String viewName = "main";
  private String page = null;
  private Integer pageCount;
  private String pageLi2 = "页</a></li>";
			result.put("rows", array);
			result.put("total", count);
			ResponseUtil.write(response, result);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}

	@RequestMapping("/adminDeleteFlight")
	public String adminDeleteFlight(HttpServletResponse response, HttpServletRequest request) {
		String ids = request.getParameter("ids");
		String[] split = ids.split(",");
		JSONObject result = new JSONObject();
		boolean flag = false;
		String flightId = "";
		String message = "";
		int count = 0;
		try {
			for (String i : split) {
				ticketorderList = ticketOrderService.selectListByFlightId(Integer.parseInt(i));
				if (ticketorderList.size() > 0) {
					flightId = flightId + i + ",";
					continue;
				} else {
					Integer integer = flightService.deleteByPrimaryKey(Integer.parseInt(i));
					count++;
				}
			}
			if (count == split.length) {
				flag = true;
				message = "数据全部成功删除!";
			} else {
				message = "id为" + flightId.substring(0, flightId.length() - 1) + "的航班有订单任务,不可进行删除操作!";
			}
			result.put("success", flag);
			result.put("message", message);
			ResponseUtil.write(response, result);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}

	@RequestMapping("/deleteAircraft")
	public String deleteAircraft(HttpServletResponse response, HttpServletRequest request) {
			Integer count = flightService.getCount(flight);
			List<Flight> flightList = flightService.getIndexList(flight);
			JsonConfig jsonConfig = new JsonConfig();
			jsonConfig.registerJsonValueProcessor(Date.class, new JsonDateValueProcessor(format));
			JSONArray array = JSONArray.fromObject(flightList, jsonConfig);
			result.put("rows", array);
			result.put("total", count);
			ResponseUtil.write(response, result);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}

	@RequestMapping("/adminDeleteFlight")
	public String adminDeleteFlight(HttpServletResponse response, HttpServletRequest request) {
		String ids = request.getParameter("ids");
		String[] split = ids.split(",");
		JSONObject result = new JSONObject();
		boolean flag = false;
		String flightId = "";
		String message = "";
		int count = 0;
		try {
			for (String i : split) {
				ticketorderList = ticketOrderService.selectListByFlightId(Integer.parseInt(i));
				if (ticketorderList.size() > 0) {
					flightId = flightId + i + ",";
					continue;
				} else {
					Integer integer = flightService.deleteByPrimaryKey(Integer.parseInt(i));
					count++;
				}
			}
			if (count == split.length) {
				flag = true;
				message = "数据全部成功删除!";
			} else {
				message = "id为" + flightId.substring(0, flightId.length() - 1) + "的航班有订单任务,不可进行删除操作!";
			}
			result.put("success", flag);
			result.put("message", message);
			ResponseUtil.write(response, result);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}

	@RequestMapping("/deleteAircraft")
	public String deleteAircraft(HttpServletResponse response, HttpServletRequest request) {
		String ids = request.getParameter("ids");
  @Resource
  private FlightService flightService;
  @Resource
  private UserService userService;

  private String format = "yyyy-MM-dd HH:mm:ss";
  private JsonDateValueProcessor jsonDateValueProcessor = new JsonDateValueProcessor(format);

  @RequestMapping("/adminTicketOrderPage")
  public String aircraftList() {
    return "admin/ticketOrderManage";
  }

  @RequestMapping("/myTicketOrderList")
  public ModelAndView myTicketOrderList(HttpServletRequest request) {
ModelAndView mav = new ModelAndView();
    String currentUser = request.getSession().getAttribute("currentUser").toString();
    List<Ticketorder> ticketOrderList = ticketOrderService.getTicketOrderByUserName(currentUser);
    JsonConfig jsonConfig = new JsonConfig();
    jsonConfig.registerJsonValueProcessor(Date.class, jsonDateValueProcessor);
    JSONArray array = JSONArray.fromObject(ticketOrderList, jsonConfig);
    mav.addObject("ticketOrderList",array);
    mav.setViewName("main_userCenter");
    request.setAttribute("mainPage","ticket/myTicketOrderList.jsp");
    return mav;
  }

  @RequestMapping("/preTicketOrder")
  public ModelAndView preTicketOrder(HttpServletRequest request){

      Integer  flightId = Integer.parseInt(request.getParameter("flightId"));
      String currentUser = request.getSession().getAttribute("currentUser").toString();
      User user = userService.getUserByUsername(currentUser);
      Flight flight = flightService.selectByPrimaryKey(flightId);
      ModelAndView mav = new ModelAndView();
      mav.addObject("flight",flight);
      mav.addObject("currentUser",user);
      mav.setViewName("main_userCenter");
      request.setAttribute("mainPage","ticket/ticketOrder.jsp");
      return mav;

  }

  @RequestMapping("/saveTicketOrder")
    String useDate = request.getParameter("useDate");
    //String name = request.getParameter("name");
    // String remark = request.getParameter("remark");
    DateUtil dateUtil = new DateUtil();
    aircraft.setBuydate(dateUtil.formatString(buyDate, format));
    aircraft.setUsedate(dateUtil.formatString(useDate, format));
    // aircraft.setName(name);
    //  aircraft.setRemark(remark);
    Integer i = 0;
    try {
      if (aircraft.getId() == null) {
        i = aircraftService.insertSelective(aircraft);
      } else {
        i = aircraftService.updateByPrimaryKeySelective(aircraft);
      }
      if (i > 0) {
        flag = true;
      }
      result.put("success", flag);
      ResponseUtil.write(response, result);
    } catch (Exception e) {
      e.printStackTrace();
    }
    return null;
  }

  /**
   * 获得客机的名称
   *
   * @param response
   * @return
   */
  @RequestMapping("/comboList")
  public String comboList(HttpServletResponse response) {
    JSONArray jsonArray = new JSONArray();
    JSONObject jsonObject = new JSONObject();
    jsonObject.put("id", "");
    jsonObject.put("name", "请选择...");

public class CookiesFilter implements Filter {

  public void destroy() {

  }

  public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain)
          throws IOException, ServletException {
    HttpServletRequest request = (HttpServletRequest) req;
    HttpServletResponse response = (HttpServletResponse) resp;
    System.out.println(request.getRequestURI());
    String requestURI = request.getRequestURI();
   /* if (requestURI.indexOf("index") > -1 || requestURI.indexOf("resources") > -1 || requestURI.indexOf("managerLoginPage") > -1 || requestURI.indexOf("manager/login") > -1) {
      chain.doFilter(request, response);
      return;
    }
    if (requestURI.indexOf("/flight/") > -1 || requestURI.indexOf("/ticketOrder/") > -1 || requestURI.indexOf("/aircraft/") > -1 || requestURI.indexOf("/user/") > -1) {
      chain.doFilter(request, response);
      return;
    }*/
    if (!(requestURI.indexOf("/manager/") > -1)) {
      chain.doFilter(request, response);
      return;
    } else {
      if (requestURI.indexOf("/manager/managerLoginPage") > -1 || requestURI.indexOf("/manager/login") > -1) {
        chain.doFilter(request, response);
        return;
      }
      if (request.getCookies() != null) {
        Cookie[] cs = request.getCookies();
        System.out.println(cs.length);
        if (cs != null && cs.length > 0) {
          for (Cookie c : cs) {
            String cName = c.getName();
            System.out.println(cName);
            if (cName.equals("adminToken")) {
              // String token = c.getValue();
              // String userAndPwd = new DesUtil().decrypt(token, key);
              // String[] uNameAndPwd = userAndPwd.split(value);
    return "list";
  }

  @RequestMapping("/index")
  public String index() {
    return "login";
  }

  @RequestMapping("/login")
  public String login(User user, HttpServletRequest request, HttpServletResponse response) throws Exception {
    user = userService.login(user);
    JSONObject result = new JSONObject();
    boolean flag = false;
    if (user != null) {
      request.getSession().setAttribute("currentUser", user.getUsername());
      setCurrentUserId(user.getId());
      cookiesUtil.addcookie("token", user.getUsername(), 1800, response);
      flag = true;
    } else {
      request.getSession().setAttribute("message", "用户名或密码有误!!!");
      System.out.println("用户名或密码有误");
    }
    result.put("success", flag);
    ResponseUtil.write(response, result);
    return "main";
  }

  @RequestMapping("/showUserInfo")
  public String showUserInfo(HttpServletRequest request) {
    HttpSession session = request.getSession();
    Integer currentUserId = getCurrentUserId();
    User userById = userService.getUserById(currentUserId);
    session.setAttribute("user", userById);
    request.setAttribute("mainPage", "userCenter/userInfo.jsp");
    return "main_userCenter";
  }

  @RequestMapping("/save")
  public String save(User user, HttpServletResponse response, HttpServletRequest request) throws Exception {
    System.out.println("user----save-----");
    JSONObject result = new JSONObject();
    String id = request.getParameter("id");
    boolean flag = false;
    Integer i;

  @Resource
  private FlightService flightService;

 /* @Resource
  private AircraftService aircraftService;

  @Resource
  private TicketOrderService ticketOrderService;*/

  @RequestMapping("/indexList")
  public ModelAndView indexList() {
    ModelAndView mav = new ModelAndView();
    PageBean pageBean = new PageBean(1, 5);
    index_flight = getFlight(pageBean);
    index_flight.setFlighttype(flightType1);
    flightList1 = flightService.getIndexList(index_flight);
    index_flight.setFlighttype(flightType2);
    flightList2 = flightService.getIndexList(index_flight);
    mav.addObject("flightList1", flightList1);
    mav.addObject("flightList2", flightList2);
    mav.setViewName(viewName);
    return mav;
  }

  @RequestMapping("/search")
  public ModelAndView search(Flight flight, HttpServletRequest request) throws ParseException {
    String page = request.getParameter("page");
    String departTime = request.getParameter("departTime");
    Date dateFrom = null;
    Date dateTo = null;
    if(departTime!=null&&!departTime.equals("")){
    	SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        dateFrom = sdf.parse(departTime+" 00:00:00");
        dateTo = sdf.parse(departTime+" 23:59:59");
    }
    
    if (page == null) {
      page = "1";
    }
    PageBean pageBean = new PageBean(Integer.parseInt(page), 10);
    flight.setPage(pageBean.getStart());
    flight.setPageSize(pageBean.getPageSize());
    flight.setDateFrom(dateFrom);
    flight.setDateTo(dateTo);
    Integer count = flightService.getCount(flight);
    flightList = flightService.getIndexList(flight);
    // getPageNum(count, pageBean);
    ModelAndView mav = getPageCode(count, pageBean, request);
    return mav;
  }

    }
    return null;
  }

  /**
   * 获得分页的信息
   *
   * @param total
   * @param pageBean
   * @param request
   * @return
   */
  private ModelAndView getPageCode(Integer total, PageBean pageBean, HttpServletRequest request) {
    ModelAndView mav = new ModelAndView();
    pageCount = total % pageBean.getPageSize() == 0 ? total / pageBean.getPageSize()
            : total / pageBean.getPageSize() + 1;
    request.setAttribute("mainPage", "flight/flightList.jsp");
    pageCode = PageUtil.genPaginationNoParam(request.getContextPath() + "/flight/list", total, pageBean.getPage(),
            pageBean.getPageSize()).toString();
    mav.addObject("flightList", flightList);
    mav.addObject("pageCode", pageCode + pageCount + pageLi2);
    mav.setViewName(viewName);
    return mav;
  }

  /**
   * 获得实体
   *
   * @param pageBean
   * @return
   */
  private Flight getFlight(PageBean pageBean) {
    Flight flight = new Flight();
    flight.setPage(pageBean.getStart());
    flight.setPageSize(pageBean.getPageSize());
    return flight;
  }

  }

  /**
   * 获得客机的名称
   *
   * @param response
   * @return
   */
  @RequestMapping("/comboList")
  public String comboList(HttpServletResponse response) {
    JSONArray jsonArray = new JSONArray();
    JSONObject jsonObject = new JSONObject();
    jsonObject.put("id", "");
    jsonObject.put("name", "请选择...");
    jsonArray.add(jsonObject);
    List<Aircraft> aircraftList = aircraftService.getAircraftList(new Aircraft());
    JsonConfig jsonConfig = new JsonConfig();
    JSONArray rows = JSONArray.fromObject(aircraftList, jsonConfig);
    jsonArray.addAll(rows);
    ResponseUtil.write(response, jsonArray);
    return null;
  }

}

public class CookiesFilter implements Filter {

  public void destroy() {

  }

  public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain)
          throws IOException, ServletException {
    HttpServletRequest request = (HttpServletRequest) req;
    HttpServletResponse response = (HttpServletResponse) resp;
    System.out.println(request.getRequestURI());
	@RequestMapping("/adminAircraftList")
	public String adminAircraftList(HttpServletRequest request, Aircraft aircraft, HttpServletResponse response) {
		PageBean pageBean = new PageBean();
		JSONObject result = new JSONObject();
		String page = request.getParameter("page");
		String rows = request.getParameter("rows");
		if (rows != null) {
			pageBean.setPageSize(Integer.parseInt(rows));
			aircraft.setPageSize(pageBean.getPageSize());
		}
		if (page != null) {
			pageBean.setPage(Integer.parseInt(page));
			aircraft.setPage(pageBean.getStart());
		}
		try {
			Integer count = aircraftService.getCount(aircraft);
			List<Aircraft> aircraftList = aircraftService.getAircraftList(aircraft);
			JsonConfig jsonConfig = new JsonConfig();
			jsonConfig.registerJsonValueProcessor(Date.class, new JsonDateValueProcessor(format));
			JSONArray array = JSONArray.fromObject(aircraftList, jsonConfig);
			result.put("rows", array);
			result.put("total", count);
			ResponseUtil.write(response, result);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}

	@RequestMapping("/managerLoginPage")
	public String managerLoginPage() {
		return loginPage;
	}

}

请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值