admin 管理员组文章数量: 1184232
基于javaweb和mysql的ssm旅游综合服务管理系统(java+ssm+jsp+bootstrap+mysql)
私信源码获取及调试交流
私信源码获取及调试交流
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb的SSM旅游综合服务管理系统(java+ssm+jsp+bootstrap+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版本; 6.是否Maven项目:否;
技术栈
- 后端:Spring+SpringMVC+Mbytes 2. 前端:JSP+css+javascript+bootstrap+jQuery
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中config-jdbc.properties配置文件中的数据库配置改为自己的配置; 4. 运行项目,在浏览器中输入localhost:8080/ssm_lvyou_fuwu
try {
Admin a = adminService.Login(admin.getLogin());
System.out.println(admin);
if(a==null)
{
map.put("mgf", "用户不存在");
map.put("success", false);
}
else if(!a.getPwd().equals(admin.getPwd()))
{
map.put("mgf", "密码错误");
map.put("success", false);
}
else
{
request.getSession().setAttribute("admin", a);
map.put("mgf", "验证通过!");
map.put("success", true);
}
} catch (Exception e) {
map.put("mgf", "错误:"+e.getMessage());
map.put("success", false);
}
String result = new JSONObject(map).toString();
ResponseUtil.write(response, result);
return null;
}
@RequestMapping("/exit")
public String Exit() {
Map<String,Object> map = new HashMap<String,Object>();
try {
request.getSession().removeAttribute("admin");
map.put("mgf", "已安全退出!");
map.put("success", true);
} catch (Exception e) {
map.put("mgf", "错误:"+e.getMessage());
map.put("success", false);
}
String result = new JSONObject(map).toString();
ResponseUtil.write(response, result);
return null;
}
@RequestMapping("/tui")
@Autowired
public void setRoomDingService(RoomDingService roomdingService) {
this.roomdingService = roomdingService;
}
@Autowired
private HttpServletRequest request;
@Autowired
private HttpServletResponse response;
@InitBinder
public void initBinder(WebDataBinder binder) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
dateFormat.setLenient(false);
binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true)); // true:允许输入空值,false:不能为空值
}
@SuppressWarnings("finally")
@RequestMapping("/add")
public String add() {
int rid=Integer.parseInt(request.getParameter("rid"));
Room r=roomService.GetByID(rid);
Hotel h=hotelService.GetByID(r.getHotelId());
r.setHotel(h);
request.setAttribute("room", r);
return "addroomding";
}
@SuppressWarnings("finally")
@RequestMapping("/roomding_add")
public String add(RoomDing rd) {
Map<String,Object> map = new HashMap<String,Object>();
if(request.getSession().getAttribute("client")==null)
{
map.put("mgf", "您尚未登陆");
map.put("success", false);
String result = new JSONObject(map).toString();
ResponseUtil.write(response, result);
return null;
}
Client c=(Client)request.getSession().getAttribute("client");
try {
System.out.println(rd);
int rid=Integer.parseInt(request.getParameter("rid"));
rd.setRoomId(rid);
rd.setClientId(c.getId());
input = new FileInputStream(source);
output = new FileOutputStream(newFile);
byte[] buf = new byte[1024];
int bytesRead;
while ((bytesRead = input.read(buf)) > 0) {
output.write(buf, 0, bytesRead);
}
} finally {
input.close();
output.close();
}
}
}
@Controller
@RequestMapping("/jin")
public class JinController {
private JinService jinService;
public JinService getJinService() {
return jinService;
}
@Autowired
public void setJinService(JinService jinService) {
this.jinService = jinService;
}
@Autowired
private ClientService clientService;
@Autowired
private JinPingService jinpingService;
@Autowired
private HttpServletRequest request;
@Autowired
private HttpServletResponse response;
@SuppressWarnings("finally")
@RequestMapping("/add")
public String add() {
return "admin/addjin";
}
@SuppressWarnings("finally")
@RequestMapping(value="/jin_add", method = RequestMethod.POST)
public String add(Jin j) {
Map<String,Object> map = new HashMap<String,Object>();
try {
System.out.println(j);
@Controller
@RequestMapping("/line")
public class LineController {
private LineService lineService;
public LineService getLineService() {
return lineService;
}
@Autowired
public void setLineService(LineService lineService) {
this.lineService = lineService;
}
@Autowired
private HttpServletRequest request;
@Autowired
private HttpServletResponse response;
@SuppressWarnings("finally")
@RequestMapping("/add")
public String add() {
return "admin/addline";
}
dateFormat.setLenient(false);
binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true)); // true:允许输入空值,false:不能为空值
}
@SuppressWarnings("finally")
@RequestMapping("/lineding_add")
public String add(LineDing rd) {
Map<String,Object> map = new HashMap<String,Object>();
try {
if(request.getSession().getAttribute("client")==null)
{
map.put("mgf", "您尚未登陆");
map.put("success", false);
String result = new JSONObject(map).toString();
ResponseUtil.write(response, result);
return null;
}
Client c=(Client)request.getSession().getAttribute("client");
int lid=Integer.parseInt(request.getParameter("lid"));
rd.setClientId(c.getId());
rd.setLineId(lid);
int count = linedingService.Add(rd);
if(count>0)
{
map.put("mgf", "预订成功");
map.put("success", true);
}
else
{
map.put("mgf", "预订失败");
map.put("success", false);
}
} catch (Exception e) {
map.put("mgf", "错误:"+e.getMessage());
map.put("success", false);
}
String result = new JSONObject(map).toString();
ResponseUtil.write(response, result);
return "line";
} catch (Exception e) {
return null;
}
}
@RequestMapping("/line_messhow")
public String GetByID() {
try {
int id=Integer.parseInt(request.getParameter("id"));
Line l = lineService.GetByID(id);
request.setAttribute("line", l);
return "admin/addline";
} catch (Exception e) {
return null;
}
}
@SuppressWarnings("finally")
@RequestMapping(value="/line_del", method = RequestMethod.POST)
public String Del(@RequestParam(value = "id") int id) {
Map<String,Object> map = new HashMap<String,Object>();
try {
System.out.println("================================");
System.out.println(id);
//int id=Integer.parseInt(request.getParameter("id"));
int r = lineService.Del(id);
if(r>0)
{
map.put("mgf", "删除成功");
map.put("success", true);
}
else
{
map.put("mgf", "删除失败");
map.put("success", false);
}
} catch (Exception e) {
@Controller
public class UploadController {
String project_path="E:/ssm_lvyou_fuwu";//同时复制附件到项目下面,以便项目备份附件防止丢失
//上传文件
@ResponseBody
@RequestMapping("upload")
public String uploadFile(HttpServletRequest request,@Param("file") MultipartFile file) throws IOException {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSS");
//String res = sdf.format(new Date());//以yyyyMMddHHmmssSS格式命名
String res=StringUtil.SetOnlyKey();
public String Exit() {
Map<String,Object> map = new HashMap<String,Object>();
try {
request.getSession().removeAttribute("admin");
map.put("mgf", "已安全退出!");
map.put("success", true);
} catch (Exception e) {
map.put("mgf", "错误:"+e.getMessage());
map.put("success", false);
}
String result = new JSONObject(map).toString();
ResponseUtil.write(response, result);
return null;
}
@RequestMapping("/tui")
public String tui(Model model) {
Pages p=new Pages();
p.setPagesize(6);
Jin j=new Jin();
j.setPage(p);
Line l=new Line();
l.setPage(p);
List<Jin> jin = jinService.Get(j);
Introduce intr = introduceService.GetByID(1);
List<Line> ls = lineService.Get(l);
model.addAttribute("jin", jin);
model.addAttribute("intr", intr);
request.getSession().setAttribute("left_line", ls);
request.getSession().setAttribute("top_qiutype", qiutypeService.Get());
return "index";
}
}
else
sumcount=rcount/pagesize+1;
if(startindex==0)//判断是否是第一页
html="<a style=''>首页</a><a style=''>上一页</a>";
else
html="<a style='' href='"+pagename+"startindex=0'>首页</a><a style='' href='"+pagename+"startindex="+Integer.toString(startindex-1)+"'>上一页</a>";
if(sumcount-1==startindex)//判断是否是最后一页
html+="<a style=''>下一页</a><a style=''>尾页</a>";
else
html+="<a style='' href='"+pagename+"startindex="+Integer.toString(startindex+1)+"'>下一页</a><a style='' href='"+pagename+"startindex="+Integer.toString(sumcount-1)+"'>尾页</a>";
return html;
}
}
/**
* 一些公用的方法
*
*
*/
public class CommonUtils {
/**
* 获得32位的UUID
*
* @return
*/
public static String getUUID() {
String uuid = UUID.randomUUID().toString().replace("-", "");
return uuid;
}
/**
* 获得当前时间返回字符串
*
}
}
@RequestMapping("/web_list")
public String Get2(Hotel h) {
//分页参数设置
Pages p=new Pages();
p.setPagesize(10);//每页显示数量
int startindex=request.getParameter("startindex")==null?0:Integer.parseInt(request.getParameter("startindex"));//起始页,默认从第1页开始读
p.setStartindex(startindex);
h.setPage(p);
try {
List<Hotel> list = hotelService.Get(h);
System.out.println(list);
request.setAttribute("list", list);
//分页
request.setAttribute("pages", PageList.Page(request,"hotel/hotel_list.do", hotelService.GetCount(h),
p.getPagesize(), p.getStartindex(),request.getQueryString()));
return "hotel";
} catch (Exception e) {
return null;
}
}
@RequestMapping("/hotel_messhow")
public String GetByID() {
try {
int id=Integer.parseInt(request.getParameter("id"));
Hotel h = hotelService.GetByID(id);
request.setAttribute("hotel", h);
return "admin/addhotel";
} catch (Exception e) {
return null;
}
}
@SuppressWarnings("finally")
@RequestMapping(value="/hotel_del", method = RequestMethod.POST)
public String Del(@RequestParam(value = "id") int id) {
Map<String,Object> map = new HashMap<String,Object>();
try {
System.out.println("================================");
System.out.println(id);
//int id=Integer.parseInt(request.getParameter("id"));
int r = hotelService.Del(id);
}
@Autowired
public void setQiuTypeService(QiuTypeService qiutypeService) {
this.qiutypeService = qiutypeService;
}
@Autowired
private HttpServletRequest request;
@Autowired
private HttpServletResponse response;
@SuppressWarnings("finally")
@RequestMapping("/add")
public String add() {
return "admin/addqiutype";
}
@SuppressWarnings("finally")
@RequestMapping("/qiutype_add")
public String add(QiuType q) {
Map<String,Object> map = new HashMap<String,Object>();
try {
System.out.println(q);
String id=request.getParameter("id").trim().length()==0?"0":request.getParameter("id");
q.setId(Integer.parseInt(id));
int count=0;
if(q.getId()==0)
count = qiutypeService.Add(q);
else
count=qiutypeService.Edit(q);
if(count>0)
{
map.put("mgf", "操作成功");
map.put("success", true);
}
else
{
map.put("mgf", "操作失败");
map.put("success", false);
}
} catch (Exception e) {
map.put("mgf", "错误:"+e.getMessage());
map.put("success", false);
binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true)); // true:允许输入空值,false:不能为空值
}
@SuppressWarnings("finally")
@RequestMapping("/add")
public String add() {
int rid=Integer.parseInt(request.getParameter("rid"));
Room r=roomService.GetByID(rid);
Hotel h=hotelService.GetByID(r.getHotelId());
r.setHotel(h);
request.setAttribute("room", r);
return "addroomding";
}
@SuppressWarnings("finally")
@RequestMapping("/roomding_add")
public String add(RoomDing rd) {
Map<String,Object> map = new HashMap<String,Object>();
if(request.getSession().getAttribute("client")==null)
{
map.put("mgf", "您尚未登陆");
map.put("success", false);
String result = new JSONObject(map).toString();
ResponseUtil.write(response, result);
return null;
}
Client c=(Client)request.getSession().getAttribute("client");
try {
System.out.println(rd);
int rid=Integer.parseInt(request.getParameter("rid"));
rd.setRoomId(rid);
rd.setClientId(c.getId());
int count = roomdingService.Add(rd);
if(count>0)
{
map.put("mgf", "预订成功");
map.put("success", true);
}
else
{
map.put("mgf", "预订失败");
map.put("success", false);
}
} catch (Exception e) {
map.put("mgf", "错误:"+e.getMessage());
map.put("success", false);
}
String result = new JSONObject(map).toString();
@Controller
@RequestMapping("/line")
public class LineController {
private LineService lineService;
public LineService getLineService() {
return lineService;
}
@Autowired
public void setLineService(LineService lineService) {
this.lineService = lineService;
}
@Autowired
private HttpServletRequest request;
@Autowired
private HttpServletResponse response;
@SuppressWarnings("finally")
@RequestMapping("/add")
public String add() {
return "admin/addline";
@Controller
public class UploadController {
String project_path="E:/ssm_lvyou_fuwu";//同时复制附件到项目下面,以便项目备份附件防止丢失
//上传文件
@ResponseBody
@RequestMapping("upload")
public String uploadFile(HttpServletRequest request,@Param("file") MultipartFile file) throws IOException {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSS");
//String res = sdf.format(new Date());//以yyyyMMddHHmmssSS格式命名
String res=StringUtil.SetOnlyKey();
String root = request.getSession().getServletContext().getRealPath("/");//物理根路径
//服务器上使用
// String rootPath =request.getServletContext().getRealPath("/resource/uploads/");//target的目录
//本地使用
String rootPath =root+"file/";
//原始名称
String originalFilename = file.getOriginalFilename();
//新的文件名称
String newFileName = res+originalFilename.substring(originalFilename.lastIndexOf("."));
//创建年月文件夹
Calendar date = Calendar.getInstance();
File dateDirs = new File(String.valueOf(date.get(Calendar.MONTH)+1));
//新文件
File newFile = new File(rootPath+File.separator+dateDirs+File.separator+newFileName);
//判断目标文件所在的目录是否存在
if(!newFile.getParentFile().exists()) {
//如果目标文件所在的目录不存在,则创建父目录
newFile.getParentFile().mkdirs();
}
System.out.println(newFile);
//将内存中的数据写入磁盘
file.transferTo(newFile);
//完整的url
String fileUrl = "file/"+(date.get(Calendar.MONTH)+1)+ "/"+ newFileName;
Map<String,Object> map = new HashMap<String,Object>();
Map<String,Object> map2 = new HashMap<String,Object>();
map.put("code",0);//0表示成功,1失败
map.put("msg","上传成功");//提示消息
map.put("data",map2);
map2.put("src",fileUrl);//图片url
map2.put("title",newFileName);//图片名称,这个会显示在输入框里
String result = new JSONObject(map).toString();
copyFileUsingFileStreams(newFile,dateDirs,newFileName);
//System.out.println(project_dir);
return result;
String pagename="";
if(urlstring==null)
pagename=basePath+pageurl+"?1=1&&";
else
{
//处理重复的参数
if(urlstring.indexOf("startindex")>0)
urlstring=urlstring.substring(0,urlstring.indexOf("startindex")-2);
pagename = basePath+pageurl+"?"+urlstring+"&&";
}
if(rcount%pagesize==0)
sumcount=rcount/pagesize;
else
sumcount=rcount/pagesize+1;
if(startindex==0)//判断是否是第一页
html="<a style=''>首页</a><a style=''>上一页</a>";
else
html="<a style='' href='"+pagename+"startindex=0'>首页</a><a style='' href='"+pagename+"startindex="+Integer.toString(startindex-1)+"'>上一页</a>";
if(sumcount-1==startindex)//判断是否是最后一页
html+="<a style=''>下一页</a><a style=''>尾页</a>";
else
html+="<a style='' href='"+pagename+"startindex="+Integer.toString(startindex+1)+"'>下一页</a><a style='' href='"+pagename+"startindex="+Integer.toString(sumcount-1)+"'>尾页</a>";
return html;
}
}
/**
* 一些公用的方法
*
*
}
}
public class PageList {
public static String Page(HttpServletRequest request,String pageurl,int rcount,int pagesize,int startindex,String urlstring)
{
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
String html="";
int sumcount=0;
String pagename="";
if(urlstring==null)
pagename=basePath+pageurl+"?1=1&&";
else
{
//处理重复的参数
if(urlstring.indexOf("startindex")>0)
urlstring=urlstring.substring(0,urlstring.indexOf("startindex")-2);
pagename = basePath+pageurl+"?"+urlstring+"&&";
}
if(rcount%pagesize==0)
sumcount=rcount/pagesize;
else
sumcount=rcount/pagesize+1;
if(startindex==0)//判断是否是第一页
html="<a style=''>首页</a><a style=''>上一页</a>";
else
html="<a style='' href='"+pagename+"startindex=0'>首页</a><a style='' href='"+pagename+"startindex="+Integer.toString(startindex-1)+"'>上一页</a>";
if(sumcount-1==startindex)//判断是否是最后一页
html+="<a style=''>下一页</a><a style=''>尾页</a>";
else
html+="<a style='' href='"+pagename+"startindex="+Integer.toString(startindex+1)+"'>下一页</a><a style='' href='"+pagename+"startindex="+Integer.toString(sumcount-1)+"'>尾页</a>";
return html;
{
Line l=lineService.GetByID(list.get(i).getLineId());
list.get(i).setLine(l);
/*Client c=clientService.GetByID(list.get(i).getClientId());
list.get(i).setClient(c);*/
}
System.out.println(list);
request.setAttribute("list", list);
return "mylineding";
} catch (Exception e) {
return null;
}
}
@RequestMapping("/admin_list")
public String Get() {
try {
List<LineDing> list = linedingService.Get();
for(int i=0;i<list.size();i++)
{
Line l=lineService.GetByID(list.get(i).getLineId());
list.get(i).setLine(l);
Client c=clientService.GetByID(list.get(i).getClientId());
list.get(i).setClient(c);
}
System.out.println(list);
request.setAttribute("list", list);
return "admin/lineding";
} catch (Exception e) {
return null;
}
}
@SuppressWarnings("finally")
@RequestMapping(value="/lineding_del", method = RequestMethod.POST)
public String Del(@RequestParam(value = "id") String id) {
Map<String,Object> map = new HashMap<String,Object>();
try {
System.out.println("================================");
System.out.println(id);
//int id=Integer.parseInt(request.getParameter("id"));
int r = linedingService.Del(Integer.parseInt(id));
if(r>0)
{
map.put("mgf", "退订成功");
map.put("success", true);
}
本文标签: 管理系统 旅游 SSM JavaWeb MySQL
版权声明:本文标题:基于javaweb和mysql的ssm旅游综合服务管理系统(java+ssm+jsp+bootstrap+mysql) 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://roclinux.cn/b/1759991934a3143513.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论