array(2) { ["docs"]=> array(10) { [0]=> array(10) { ["id"]=> string(3) "428" ["text"]=> string(77) "Visual Studio 2017 单独启动MSDN帮助(Microsoft Help Viewer)的方法" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(8) "DonetRen" ["tagsname"]=> string(55) "Visual Studio 2017|MSDN帮助|C#程序|.NET|Help Viewer" ["tagsid"]=> string(23) "[401,402,403,"300",404]" ["catesname"]=> string(0) "" ["catesid"]=> string(2) "[]" ["createtime"]=> string(10) "1511400964" ["_id"]=> string(3) "428" } [1]=> array(10) { ["id"]=> string(3) "427" ["text"]=> string(42) "npm -v;报错 cannot find module "wrapp"" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(4) "zzty" ["tagsname"]=> string(50) "node.js|npm|cannot find module "wrapp“|node" ["tagsid"]=> string(19) "[398,"239",399,400]" ["catesname"]=> string(0) "" ["catesid"]=> string(2) "[]" ["createtime"]=> string(10) "1511400760" ["_id"]=> string(3) "427" } [2]=> array(10) { ["id"]=> string(3) "426" ["text"]=> string(54) "说说css中pt、px、em、rem都扮演了什么角色" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(12) "zhengqiaoyin" ["tagsname"]=> string(0) "" ["tagsid"]=> string(2) "[]" ["catesname"]=> string(0) "" ["catesid"]=> string(2) "[]" ["createtime"]=> string(10) "1511400640" ["_id"]=> string(3) "426" } [3]=> array(10) { ["id"]=> string(3) "425" ["text"]=> string(83) "深入学习JS执行--创建执行上下文(变量对象,作用域链,this)" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(7) "Ry-yuan" ["tagsname"]=> string(33) "Javascript|Javascript执行过程" ["tagsid"]=> string(13) "["169","191"]" ["catesname"]=> string(0) "" ["catesid"]=> string(2) "[]" ["createtime"]=> string(10) "1511399901" ["_id"]=> string(3) "425" } [4]=> array(10) { ["id"]=> string(3) "424" ["text"]=> string(30) "C# 排序技术研究与对比" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(9) "vveiliang" ["tagsname"]=> string(0) "" ["tagsid"]=> string(2) "[]" ["catesname"]=> string(8) ".Net Dev" ["catesid"]=> string(5) "[199]" ["createtime"]=> string(10) "1511399150" ["_id"]=> string(3) "424" } [5]=> array(10) { ["id"]=> string(3) "423" ["text"]=> string(72) "【算法】小白的算法笔记:快速排序算法的编码和优化" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(9) "penghuwan" ["tagsname"]=> string(6) "算法" ["tagsid"]=> string(7) "["344"]" ["catesname"]=> string(0) "" ["catesid"]=> string(2) "[]" ["createtime"]=> string(10) "1511398109" ["_id"]=> string(3) "423" } [6]=> array(10) { ["id"]=> string(3) "422" ["text"]=> string(64) "JavaScript数据可视化编程学习(二)Flotr2,雷达图" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(7) "chengxs" ["tagsname"]=> string(28) "数据可视化|前端学习" ["tagsid"]=> string(9) "[396,397]" ["catesname"]=> string(18) "前端基本知识" ["catesid"]=> string(5) "[198]" ["createtime"]=> string(10) "1511397800" ["_id"]=> string(3) "422" } [7]=> array(10) { ["id"]=> string(3) "421" ["text"]=> string(36) "C#表达式目录树(Expression)" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(4) "wwym" ["tagsname"]=> string(0) "" ["tagsid"]=> string(2) "[]" ["catesname"]=> string(4) ".NET" ["catesid"]=> string(7) "["119"]" ["createtime"]=> string(10) "1511397474" ["_id"]=> string(3) "421" } [8]=> array(10) { ["id"]=> string(3) "420" ["text"]=> string(47) "数据结构 队列_队列实例:事件处理" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(7) "idreamo" ["tagsname"]=> string(40) "C语言|数据结构|队列|事件处理" ["tagsid"]=> string(23) "["246","247","248",395]" ["catesname"]=> string(12) "数据结构" ["catesid"]=> string(7) "["133"]" ["createtime"]=> string(10) "1511397279" ["_id"]=> string(3) "420" } [9]=> array(10) { ["id"]=> string(3) "419" ["text"]=> string(47) "久等了,博客园官方Android客户端发布" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(3) "cmt" ["tagsname"]=> string(0) "" ["tagsid"]=> string(2) "[]" ["catesname"]=> string(0) "" ["catesid"]=> string(2) "[]" ["createtime"]=> string(10) "1511396549" ["_id"]=> string(3) "419" } } ["count"]=> int(200) } 222 java+mysql+ssm+城市公交查询系统换乘模糊查询 - 爱码网

1.包含源程序,数据库脚本。代码和数据库脚本都有详细注释。
2.课题设计仅供参考学习使用,可以在此基础上进行扩展完善
开发环境: 代码已经上传github,下载地址:https://github.com/21503882/citybus
Eclipse ,MYSQL,JDK1.8,Tomcat 8.5
涉及技术点:
MVC模式、SpringBoot、Mybatis、Redis、HTML、log4j、druid、Bootstrap、
Semantic UI、Thymeleaf、JavaScript、CSS、JQUERY、Ajax等
适合学习J2EE的一段时间的熟手,代码思路清晰,注解详细,数据库用的是mysql5.1,服务器用的tomcat8.5,JDK版本1.8. 编程软件Eclispe J2EE版本。是典型MVC架构,并且前后台分离

java+mysql+ssm+城市公交查询系统换乘模糊查询

java+mysql+ssm+城市公交查询系统换乘模糊查询

java+mysql+ssm+城市公交查询系统换乘模糊查询

java+mysql+ssm+城市公交查询系统换乘模糊查询

java+mysql+ssm+城市公交查询系统换乘模糊查询

java+mysql+ssm+城市公交查询系统换乘模糊查询

java+mysql+ssm+城市公交查询系统换乘模糊查询

java+mysql+ssm+城市公交查询系统换乘模糊查询

java+mysql+ssm+城市公交查询系统换乘模糊查询

java+mysql+ssm+城市公交查询系统换乘模糊查询

 

 

package com.linxf.ticketsale.controller;

import com.linxf.ticketsale.pojo.Station;
import com.linxf.ticketsale.pojo.Train;
import com.linxf.ticketsale.service.TrainService;
import com.linxf.ticketsale.util.JedisUtil;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import java.util.*;

@Controller
@RequestMapping("/trainController")
public class TrainController {

    private static final Logger LOG = Logger.getLogger(TrainController.class);

    @Resource
    private TrainService trainService;

    // 根据车辆类型获取车辆信息列表
    @RequestMapping("/getTrainList.action")
    @ResponseBody
    public List<Train> getTrainList(String ttype) {
        List<Train> list = null;
        if (ttype == null) {
            return list;
        }
        try {
            list = trainService.getTrainList(ttype);
        } catch (Exception e) {
            LOG.info("getTrainList出错:" + e);
            e.printStackTrace();
        }
        return list;
    }

    // 获取所有车辆的编号
    @RequestMapping("/getTidList.action")
    @ResponseBody
    public List<String> getTidList() {
        List<String> list = null;
        try {
            list = trainService.getTidList();
        } catch (Exception e) {
            LOG.info("getTidList出错:" + e);
            e.printStackTrace();
        }
        return list;
    }

    // 根据编号获取车辆信息
    @RequestMapping("/getTrainInfoById.action")
    @ResponseBody
    public Map<String, Train> getTrainInfoById(String tid) {
        Map<String, Train> map = new HashMap<>();
        Train train = null;
        if (tid == null || "".equals(tid)) {
            return null;
        }
        try {
            train = trainService.getTrainInfoById(tid);
        } catch (Exception e) {
            LOG.info("getTrainInfoById出错:" + e);
            e.printStackTrace();
        }
        map.put("trainMap", train);
        return map;
    }

    // 跳转到车辆信息页面
    @RequestMapping("/toTrainInfo.action")
    public ModelAndView toTrainInfo(String tid) {
        if ("".equals(tid)) {
            tid = null;
        }
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.addObject("tid", tid);
        modelAndView.setViewName("WEB-INF/jsp/admin/train_info.jsp");
        return modelAndView;
    }

    // 跳转到座位类型管理页
    @RequestMapping("/toSeatManage.action")
    public ModelAndView toSeatManage(String tid) {
        if ("".equals(tid)) {
            tid = null;
        }
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.addObject("tid", tid);
        modelAndView.setViewName("WEB-INF/jsp/admin/seatType_admin.jsp");
        return modelAndView;
    }

    // 跳转到车辆类型管理页
    @RequestMapping("/toTypeManage.action")
    public ModelAndView toTypeManage(String ttype) {
        if ("".equals(ttype)) {
            ttype = null;
        }
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.addObject("ttype", ttype);
        modelAndView.setViewName("WEB-INF/jsp/admin/trainType_admin.jsp");
        return modelAndView;
    }

    // 跳转到车辆类型管理页
    @RequestMapping("/toAddTrain.action")
    public String toAddTrain() {
        return "WEB-INF/jsp/admin/addTrain.jsp";
    }

    // 跳转到路线查询页面
    @RequestMapping("/toSearchRout.action")
    public String toSearchRout() {
        return "WEB-INF/jsp/main/searchRout.jsp";
    }

    // 根据出发站-到达站查询列车列表--直达车
    @RequestMapping("/goSearch.action")
    public ModelAndView goSearch(String sname1, String sname2) {
        List<Train> trainList = new ArrayList<>();
        // 从缓存中获取直达车列表,若不存在则去数据库查
        List<Train> trainList1 = JedisUtil.get(sname1 + "-" + sname2 + "直达");
        if (trainList1 != null) {// 缓存中有,从缓存中获取
            trainList = trainList1;
        } else {// 缓存中没有,从数据库查
            try {// 查询直达车列表
                trainList = trainService.getTrainRout(sname1, sname2);
                if (trainList != null) {
                    List<Station> stationList = new ArrayList<>();
                    for (Train train : trainList) {
                        stationList = train.getStationList();
                        Station station = new Station();
                        int i = 10;// 间隔站次
                        Iterator<Station> it = stationList.iterator();
                        while (it.hasNext()) {
                            if (i == -1) {
                                i = 0;
                            }
                            i++;
                            station = it.next();
                            if (sname1.equals(station.getSname1())) {
                                if (sname2.equals(station.getSname2())) {
                                    i = 1;// 只有一站
                                    continue;
                                }
                                i = -1;
                                continue;
                            }
                            if (sname2.equals(station.getSname2())) {
                                continue;
                            }
                            it.remove();
                        }
                        train.setStacount(i);// 共几站
                        if (stationList.size() == 1) {// 只有一站
                            stationList.add(stationList.get(0));
                        }
                    }
                    // trainList去重
                } else {
                    trainList = null;// 没有直达车
                }
            } catch (Exception e) {
                LOG.info("goSearch出错:" + e);
                e.printStackTrace();
            }
            // 将结果存入缓存
            JedisUtil.put(sname1 + "-" + sname2 + "直达", trainList);
        }
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.addObject("trainList", trainList);
        modelAndView.addObject("sname1", sname1);
        modelAndView.addObject("sname2", sname2);
        modelAndView.setViewName("WEB-INF/jsp/main/searchRout.jsp");
        return modelAndView;
    }

    // 用户按照出发站和到达站查询路线功能--可换乘
    @RequestMapping("/changeSearch.action")
    public ModelAndView changeSearch(String sname1, String sname2) {
        ModelAndView modelAndView = new ModelAndView();
        List<Map<String, Object>> resultList = new ArrayList<>();
        // 从缓存中获取直达车列表,若不存在则去数据库查
        List<Map<String, Object>> resultList1 = JedisUtil.get(sname1 + "-" + sname2 + "换乘");
        if (resultList1 != null) {// 缓存中有,从缓存中获取
            resultList = resultList1;
        } else {// 缓存中没有,从数据库查
            try {
                List<Map<String, Object>> listMap = trainService.getTrainRout2(sname1, sname2);// 换乘车列表
                if (listMap != null) {
                    for (Map<String, Object> map : listMap) {
                        Map<String, Object> resmap = new HashMap<>();
                        String saname = (String) map.get("changeState");
                        Train train1 = (Train) map.get("train1");
                        Train train2 = (Train) map.get("train2");
                        int s1 = train1.getStationList().size();
                        int s2 = train2.getStationList().size();
                        if (saname != null && train1 != null && train2 != null) {
                            List<Station> stationList2 = train2.getStationList();
                            stationList2.set(0, stationList2.get(stationList2.size() - 1));
                            train1.setStacount(s1);// 共几站
                            train2.setStacount(s2);// 共几站
                            train2.setStationList(stationList2);
                            resmap.put("changeState", saname);// 换乘站
                            resmap.put("train1", train1);// 换乘车辆1
                            resmap.put("train2", train2);// 换乘车辆2
                        }
                        resultList.add(resmap);
                    }
                }
            } catch (Exception e) {
                LOG.info("changeSearch出错:" + e);
                e.printStackTrace();
            }
            // 将结果存入缓存
            JedisUtil.put(sname1 + "-" + sname2 + "换乘", resultList);
        }
        modelAndView.addObject("sname1", sname1);
        modelAndView.addObject("sname2", sname2);
        modelAndView.addObject("resultList", resultList);
        modelAndView.setViewName("WEB-INF/jsp/main/searchRout2.jsp");
        return modelAndView;
    }

    /*
     * 添加新车辆
     */
    @RequestMapping("/addnewtrain.action")
    public ModelAndView toStationManage(Train train) {
        ModelAndView modelAndView = new ModelAndView();
        String str = null;
        try {
            trainService.addnewtrain(train);
            str = "添加车辆成功";
        } catch (Exception e) {
            LOG.info("addnewtrain出错:" + e);
            e.printStackTrace();
        }
        modelAndView.addObject("result", str);
        modelAndView.setViewName("WEB-INF/jsp/admin/addTrainResult.jsp");
        return modelAndView;
    }

    /*
     * 跳转至车辆站点管理
     */
    @RequestMapping("/toStationManage.action")
    public ModelAndView toStationManage(String tid) {
        if ("".equals(tid)) {
            tid = null;
        }
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.addObject("tid", tid);
        modelAndView.setViewName("WEB-INF/jsp/admin/station_info.jsp");
        return modelAndView;
    }

    // 根据编号获取车辆的途经车站列表信息
    @RequestMapping("/getStationListById.action")
    @ResponseBody
    public List<Station> getStationListById(String tid) {
        List<Station> stationList = null;
        if (tid == null || "".equals(tid)) {
            return null;
        }
        try {
            stationList = trainService.getStationListById(tid);
        } catch (Exception e) {
            LOG.info("getStationListById出错:" + e);
            e.printStackTrace();
        }
        return stationList;
    }

    // 改变车辆的途经车站列表信息
    @RequestMapping("/changeStationList.action")
    public ModelAndView changeStationList(Train train) {
        ModelAndView modelAndView = new ModelAndView();
        String result = null;
        List<Station> listStation = train.getStationList();
        if(listStation != null){
            try {
                trainService.changeStationList(listStation);
                result = "修改成功!";
            } catch (Exception e) {
                LOG.info("changeStationList出错:" + e);
                e.printStackTrace();
            }
            modelAndView.addObject("result", result);
        }
        modelAndView.setViewName("WEB-INF/jsp/admin/station_info.jsp");
        return modelAndView;
    }

    /*
     * 跳转至车辆票价管理
     */
    @RequestMapping("/toStationTicketManage.action")
    public ModelAndView toStationTicketManage(String tid) {
        if ("".equals(tid)) {
            tid = null;
        }
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.addObject("tid", tid);
        modelAndView.setViewName("WEB-INF/jsp/admin/station_ticket.jsp");
        return modelAndView;
    }

    /*
     * 根据车站编号与sname1改变区间票价与数量
     */
    @RequestMapping("/updateStationByTrain.action")
    public ModelAndView updateStationByTrain(Train train) {
        String result = null;
        List<Station> listStation = train.getStationList();
        try {
            trainService.updateStationByTrain(listStation);
            result = "修改成功!";
        } catch (Exception e) {
            LOG.info("updateStationByTrain出错:" + e);
            e.printStackTrace();
        }
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.addObject("result", result);
        modelAndView.setViewName("WEB-INF/jsp/admin/station_ticket.jsp");
        return modelAndView;
    }

    /*
     * 根据车站编号改变火车座位类型与价格1
     */
    @ResponseBody
    @RequestMapping("/updateTrainSeatType1.action")
    public Map<String, Object> updateTrainSeatType1(Train train) {
        Map<String, Object> map = new HashMap<>();
        String result = null;
        try {
            trainService.updateTrainSeatType1(train);
            result = "修改成功!";
        } catch (Exception e) {
            LOG.info("updateTrainSeatType出错:" + e);
            e.printStackTrace();
        }
        map.put("result", result);
        return map;
    }

    /*
     * 根据车站编号改变火车座位类型与价格2
     */
    @ResponseBody
    @RequestMapping("/updateTrainSeatType2.action")
    public Map<String, Object> updateTrainSeatType2(Train train) {
        Map<String, Object> map = new HashMap<>();
        String result = null;
        try {
            trainService.updateTrainSeatType2(train);
            result = "修改成功!";
        } catch (Exception e) {
            LOG.info("updateTrainSeatType出错:" + e);
            e.printStackTrace();
        }
        map.put("result", result);
        return map;
    }

    /*
     * 根据车站编号改变火车座位类型与价格3
     */
    @ResponseBody
    @RequestMapping("/updateTrainSeatType3.action")
    public Map<String, Object> updateTrainSeatType3(Train train) {
        Map<String, Object> map = new HashMap<>();
        String result = null;
        try {
            trainService.updateTrainSeatType3(train);
            result = "修改成功!";
        } catch (Exception e) {
            LOG.info("updateTrainSeatType出错:" + e);
            e.printStackTrace();
            result = "修改失败,请重试!";
        }
        map.put("result", result);
        return map;
    }

}
 代码已经上传github,下载地址:https://github.com/21503882/citybus
————————————————

相关文章: