基于SSM框架的公交车查询系统的设计与实现

源码获取:回复【SSM、公交查询】获取

更多选题参考:
Java练手项目 & 个人学习等选题参考

文章目录


前言

提示:这里可以添加本文要记录的大概内容:

随着生活水平的提高,人们出行的次数和范围都在增加,公交车作为人们出行最方便,使用最广泛的公共交通工具,由于公交车的便利性,它人们的生活中扮演着越来越重要的角色。据调查,在中国的中大型城市中,虽有大量的私家车、出租车、地铁等可乘,但公交汽车仍是大多然民众的首选。


提示:以下是本篇文章正文内容,下面案例可供参考

一、背景及意义

选题背景

城市公共交通路线推荐系统

在日常乘坐公共交通工具的时候,当在一个陌生的地方或是要去往一个陌生的地点时,希望能够有个路线的参考,否则可能需要打听路线或依靠自己猜测,很有可能信息不准,走了冤枉路,影响效率。本系统旨在为本城市的用户提供公共交通的线路推荐服务。

目前,公共交通查询管理系统的开发已经在理论和技术上进入一个相对成熟的阶段,外部总线查询管理系统已经实现了情报化、信息化和社会化。出行者在出行方式选择的上,首要目的是便捷,出行者会选择最为便捷的交通方式来优化其出行活动。优化活动主要体现在出行时间、出行线路、出行所需要时间这三个方面,然而在这些关键因素上,我国公交系统的信息化比较低,出行者可获得的实时信息量比较少,这给居民的公交出行选择上带来了很多不确定性,而且存在一定的风险性,因此居民对于公交出行的选择意愿也比较低,进而也就降低了整个城市居民公交出行的选择。

选题目的

本系统是公交查询系统的设计与实现,其中包括了公交查询系统的基本功能,并提供了用户留言的功能,方便根据用户提供的留言信息或是提出的建议对系统进行修改和完善,并提供了管理员用户后台维护公交信息的功能,做到能够实时添加和删除公交车次站点。除主要功能以外本系统还附带新闻公告模块。本系统目标是方便市民进行公交信息查询,其主要思想是做到系统管理的人性化、数据处理的可靠性、可维护性以及程序的健壮性。系统提供了用户留言的功能,根据用户提供的留言信息或提出的建议提高公交公司的服务质量,体现出一个智能的公交车查询系统的信息化水平。

二、系统设计

技术路线

本系统使用SSM架构搭建完成,其中在控制器使用当下最为流行的Spring MVC作为视图控制器,业务层使用Spring作为业务逻辑处理框架,其数据化持久层采用对比Hibernate较为轻量级的MyBatis作为数据持久框架。本系统完全满足了城市公交车线路查询的日常管理与数据统计方便了其在运营中的各个环节,使用MVC模型构建保证了系统二次开发的方便,二次开发打算要增加更多角色和并对角色所处理的功能进行分类与数据统计实现

主要功能

管理员管理功能:用户信息管理,站点管理(根据站点名称查询),公交车次管理(根据线路名称,起点站,终到站,所属公司查询),用户留言管理,发布公告(如某路公交车线路因修路等原因临时修改等)。

公交系统管理员需要对公交线路进行维护,包括线路名称、各站点名称、站点位置、 两站间路程等,最好能够提供导入的模板,方便管理员一次性导入大量数据。

用户在查看站点时可以是文字版的信息,也可以是地图版的信息展示。

系统可以利用手机定位功能获得当前位置,从而推荐乘坐的公交车路线

查询功能:系统需要提供几种不同方式的查询手段

包括了公交车线路号查询,站点名查询,起始站名至目的站名查询,显示所有查询结果。

信息反馈功能:用户可根据实际情况对路线报错以便及时修改错误。

随着使用群体的扩大及需求的不断变化,本系统很可能会需要继续完善和增加相应的功能,希望系统能够具有良好的可扩展性。

功能结构

技术路线

(1)使用JSP、java SSM框架实现服务器端和客户端脚本页面的开发;

(2)使用数据库(MySQL)实现系统相关数据的存储和管理;

(3)后台使用Struts进行视图层设计,业务逻辑通过Spring实现,Spring很好的支持AOP;

(4)使用路径计算方法实现车辆换乘的查询;

(5)使用软件工程技术实现对系统开发过程的管理;

(6)实现支持并发、实时访问的系统查询软件。

运行环境

(1)操作系统:windows 10/11或者 Mac OS

(2)数据库:mysql-8.0.29 版本及以上

(3)开发环境: IntelliJ IDEA 2018.3.4 x64,IntelliJ IDEA 2022.2.2都可以

(4)服务器:apache-maven-3.8.6、apache-tomcat-9.0.22

(5)浏览器:qq浏览器或 Win10自带浏览器或者其他浏览器都可以

大部分配置都是越高越好,但难免有些新出版本不稳定,所以一定要选稳定的


三、系统实现

部分页面截图展示

用户登入页面展示

http://localhost:8080/bus_ssm/index.jsp#






管理员页面展示

http://localhost:8080/bus_ssm/login.jsp#







部分代码展示

线路管理代码

java 复制代码
<form action="rk" method="post">
 <div class="rt_content">
      <div class="page_title">
       <h2 class="fl">请输入车辆信息</h2>
      </div>
      <ul class="ulColumn2">
       <li>
        <span class="item_name" style="width:120px;">名称:</span>
        <input type="text" name="name" class="textbox textbox_225"  placeholder="名称..."/>
       </li>
       <li>
        <span class="item_name" style="width:120px;">时间:</span>
        <input type="text" name="number" class="textbox textbox_225"  placeholder="时间"/>
       </li>
       <li>
        <span class="item_name" style="width:120px;" name="sex介绍:</span>
       <input type="text" name="money" class="textbox textbox_225"  placeholder="介绍.."/>
       </li>
       <li>
        <span class="item_name" style="width:120px;">地区:</span>
        <input type="text"  name="gy" class="textbox textbox_225" placeholder="地区..."/>
       </li>
       <li>
        <span class="item_name" style="width:120px;">分类:</span>
        <input type="tel" name="phone" class="textbox textbox_225"  placeholder="分类..."/>
       </li>
       <li>
        <span class="item_name" style="width:120px;"></span>
        <input type="submit" class="link_btn" value="提交"/>
       </li>
      </ul>
 </div>
 </form>

按照查询条件查询公交车次记录代码

java 复制代码
 /*按照查询条件分页查询公交车次记录*/
    public ArrayList<BusLine> queryBusLine(String name,BusStation startStation,BusStation endStation,String company,int currentPage) throws Exception { 
     	String where = "where 1=1";
    	if(!name.equals("")) where = where + " and t_busLine.name like '%" + name + "%'";
    	if(null != startStation && startStation.getStationId()!= null && startStation.getStationId()!= 0)  where += " and t_busLine.startStation=" + startStation.getStationId();
    	if(null != endStation && endStation.getStationId()!= null && endStation.getStationId()!= 0)  where += " and t_busLine.endStation=" + endStation.getStationId();
    	if(!company.equals("")) where = where + " and t_busLine.company like '%" + company + "%'";
    	int startIndex = (currentPage-1) * this.rows;
    	return busLineMapper.queryBusLine(where, startIndex, this.rows);
    }

    /*按照查询条件查询所有记录*/
    public ArrayList<BusLine> queryBusLine(String name,BusStation startStation,BusStation endStation,String company) throws Exception  { 
     	String where = "where 1=1";
    	if(!name.equals("")) where = where + " and t_busLine.name like '%" + name + "%'";
    	if(null != startStation && startStation.getStationId()!= null && startStation.getStationId()!= 0)  where += " and t_busLine.startStation=" + startStation.getStationId();
    	if(null != endStation && endStation.getStationId()!= null && endStation.getStationId()!= 0)  where += " and t_busLine.endStation=" + endStation.getStationId();
    	if(!company.equals("")) where = where + " and t_busLine.company like '%" + company + "%'";
    	return busLineMapper.queryBusLineList(where);
    }

ajax方式按照查询条件分页查询站点信息

java 复制代码
	@RequestMapping(value = { "/list" }, method = {RequestMethod.GET,RequestMethod.POST})
	public void list(String stationName,Integer page,Integer rows, Model model, HttpServletRequest request,HttpServletResponse response) throws Exception {
		if (page==null || page == 0) page = 1;
		if (stationName == null) stationName = "";
		if(rows != 0)busStationService.setRows(rows);
		List<BusStation> busStationList = busStationService.queryBusStation(stationName, page);
	    /*计算总的页数和总的记录数*/
	    busStationService.queryTotalPageAndRecordNumber(stationName);
	    /*获取到总的页码数目*/
	    int totalPage = busStationService.getTotalPage();
	    /*当前查询条件下总记录数*/
	    int recordNumber = busStationService.getRecordNumber();
        response.setContentType("text/json;charset=UTF-8");
		PrintWriter out = response.getWriter();
		//将要被返回到客户端的对象
		JSONObject jsonObj=new JSONObject();
		jsonObj.accumulate("total", recordNumber);
		JSONArray jsonArray = new JSONArray();
		for(BusStation busStation:busStationList) {
			JSONObject jsonBusStation = busStation.getJsonObject();
			jsonArray.put(jsonBusStation);
		}
		jsonObj.accumulate("rows", jsonArray);
		out.println(jsonObj.toString());
		out.flush();
		out.close();
	}

	@RequestMapping(value = { "/listAll" }, method = {RequestMethod.GET,RequestMethod.POST})
	public void listAll(HttpServletResponse response) throws Exception {
		List<BusStation> busStationList = busStationService.queryAllBusStation();
        response.setContentType("text/json;charset=UTF-8"); 
		PrintWriter out = response.getWriter();
		JSONArray jsonArray = new JSONArray();
		for(BusStation busStation:busStationList) {
			JSONObject jsonBusStation = new JSONObject();
			jsonBusStation.accumulate("stationId", busStation.getStationId());
			jsonBusStation.accumulate("stationName", busStation.getStationName());
			jsonArray.put(jsonBusStation);
		}
		out.println(jsonArray.toString());
		out.flush();
		out.close();
	}

	/*前台按照查询条件分页查询站点信息信息*/
	@RequestMapping(value = { "/frontlist" }, method = {RequestMethod.GET,RequestMethod.POST})
	public String frontlist(String stationName,Integer currentPage, Model model, HttpServletRequest request) throws Exception  {
		if (currentPage==null || currentPage == 0) currentPage = 1;
		if (stationName == null) stationName = "";
		List<BusStation> busStationList = busStationService.queryBusStation(stationName, currentPage);
	    /*计算总的页数和总的记录数*/
	    busStationService.queryTotalPageAndRecordNumber(stationName);
	    /*获取到总的页码数目*/
	    int totalPage = busStationService.getTotalPage();
	    /*当前查询条件下总记录数*/
	    int recordNumber = busStationService.getRecordNumber();
	    request.setAttribute("busStationList",  busStationList);
	    request.setAttribute("totalPage", totalPage);
	    request.setAttribute("recordNumber", recordNumber);
	    request.setAttribute("currentPage", currentPage);
	    request.setAttribute("stationName", stationName);
		return "BusStation/busStation_frontquery_result"; 
	}

四、源码获取

lzp5348851

相关推荐
图像僧10 小时前
vs2019中的属性页使用说明
java·开发语言·jvm
武子康10 小时前
Java-03 深入浅出 MyBatis 增删改查与映射配置详解
java·后端
静心观复10 小时前
.puml文件是什么,怎么用
java
YOU OU10 小时前
SpringBoot 日志
java·开发语言
snowfoootball11 小时前
解决低版本navicat连接PostgreSQl的不兼容报错问题
数据库·postgresql
江南十四行11 小时前
并发编程(二)
java·开发语言
徐sir(徐慧阳)11 小时前
ORACLE RAC GI目录下crfclust.bdb文件过大问题处理
数据库·oracle
qingfeng1541511 小时前
企业微信 API 自动化开发指南:从消息回调到智能运营实战
java·开发语言·python·自动化·企业微信
琢磨先生David11 小时前
人大金仓(KingbaseES)数据库简介
数据库