作者主页:夜未央5788
简介:Java领域优质创作者、Java项目、学习资料、技术互助
文末获取源码
项目介绍
主要功能包括:
旅游资源网站的主要使用者分为管理员和用户,实现功能包括:
管理员:首页、个人中心、用户管理、景点信息管理、购票信息管理、酒店信息管理、客房类型管理、客房信息管理、客房预订管理、交流论坛、系统管理
用户:首页、个人中心、购票信息管理、客房预订管理、我的收藏管理,前台首页;首页、景点信息、酒店信息、客房信息、交流论坛、红色文化、个人中心、后台管理、客服咨询
环境需要
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.是否Maven项目: 否;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目
6.数据库:MySql 5.7/8.0等版本均可;
技术栈
后端:SSM(Spring+SpringMVC+Mybatis)
前端:ElementUI+Vue
使用说明
1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,修改配置,运行项目;
3. 将项目中db.xml配置文件中的数据库配置改为自己的配置,然后运行;
运行截图
论文
前台界面
后管界面
相关代码
JinController
package com.java.controller;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.java.model.*;
import com.java.service.*;
import com.java.utils.CommonUtils;
import com.java.utils.PageList;
import com.java.utils.ResponseUtil;;
@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);
String id=request.getParameter("id").trim().length()==0?"0":request.getParameter("id");
j.setId(Integer.parseInt(id));
j.setContent(request.getParameter("content"));
int r=0;
if(j.getId()==0)
r = jinService.Add(j);
else
r=jinService.Edit(j);
if(r>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 null;
}
@RequestMapping("/jin_list")
public String Get(Jin j) {
//分页参数设置
Pages p=new Pages();
p.setPagesize(10);//每页显示数量
int startindex=request.getParameter("startindex")==null?0:Integer.parseInt(request.getParameter("startindex"));//起始页,默认从第1页开始读
p.setStartindex(startindex);
j.setPage(p);
try {
List<Jin> list = jinService.Get(j);
System.out.println(list);
request.setAttribute("list", list);
//分页
request.setAttribute("pages", PageList.Page(request,"jin/jin_list.do", jinService.GetCount(j),
p.getPagesize(), p.getStartindex(),request.getQueryString()));
return "admin/jin";
} catch (Exception e) {
return null;
}
}
@RequestMapping("/web_list")
public String Get2(Jin j) {
//分页参数设置
Pages p=new Pages();
p.setPagesize(6);//每页显示数量
int startindex=request.getParameter("startindex")==null?0:Integer.parseInt(request.getParameter("startindex"));//起始页,默认从第1页开始读
p.setStartindex(startindex);
j.setPage(p);
try {
List<Jin> list = jinService.Get(j);
System.out.println(list);
request.setAttribute("list", list);
//分页
request.setAttribute("pages", PageList.Page(request,"jin/web_list.do", jinService.GetCount(j),
p.getPagesize(), p.getStartindex(),request.getQueryString()));
return "jin";
} catch (Exception e) {
return null;
}
}
@RequestMapping("/jin_messhow")
public String GetByID() {
try {
int id=Integer.parseInt(request.getParameter("id"));
Jin j = jinService.GetByID(id);
request.setAttribute("jin", j);
return "admin/addjin";
} catch (Exception e) {
return null;
}
}
@RequestMapping("/web_messhow")
public String GetByID2(Model m) {
try {
int id=Integer.parseInt(request.getParameter("id"));
Jin j = jinService.GetByID(id);
m.addAttribute("jin", j);
List<JinPing> list = jinpingService.GetByJinID(Integer.parseInt(request.getParameter("id")));
for(int i=0;i<list.size();i++)
{
Client c=clientService.GetByID(list.get(i).getClinetId());
Jin jin=jinService.GetByID(list.get(i).getJinId());
list.get(i).setClient(c);
list.get(i).setJin(jin);
}
m.addAttribute("jin_list",list);
return "jinshow";
} catch (Exception e) {
return null;
}
}
@SuppressWarnings("finally")
@RequestMapping(value="/jin_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 r = jinService.Del(id);
if(r>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 null;
}
}
JinPingController
package com.java.controller;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.java.model.*;
import com.java.service.*;
import com.java.utils.CommonUtils;
import com.java.utils.ResponseUtil;;
@Controller
@RequestMapping("/jinping")
public class JinPingController {
private JinPingService jinpingService;
public JinPingService getJinPingService() {
return jinpingService;
}
@Autowired
public void setJinPingService(JinPingService jinpingService) {
this.jinpingService = jinpingService;
}
@Autowired
private JinService jinService;
@Autowired
private ClientService clientService;
@Autowired
private HttpServletRequest request;
@Autowired
private HttpServletResponse response;
@SuppressWarnings("finally")
@RequestMapping(value="/jinping_add", method = RequestMethod.POST)
public String add(JinPing jp) {
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;
}
System.out.println(jp.getContent());
Client c=(Client)request.getSession().getAttribute("client");
jp.setClinetId(c.getId());
jp.setContent(request.getParameter("content"));
jp.setJinId(Integer.parseInt(request.getParameter("id")));
int count = jinpingService.Add(jp);
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 null;
}
@RequestMapping("/my_list")
public String GetByClientID() {
try {
Client c=(Client)request.getSession().getAttribute("client");
List<JinPing> list = jinpingService.GetByClientID(c.getId());
for(int i=0;i<list.size();i++)
{
Jin j=jinService.GetByID(list.get(i).getJinId());
list.get(i).setJin(j);;
}
System.out.println(list);
request.setAttribute("list", list);
return "myjinping";
} catch (Exception e) {
return null;
}
}
@RequestMapping("/admin_list")
public String GetByNewsID(int jid) {
try {
List<JinPing> list = jinpingService.GetByJinID(jid);
for(int i=0;i<list.size();i++)
{
Jin n=jinService.GetByID(list.get(i).getJinId());
list.get(i).setJin(n);;
}
System.out.println(list);
request.setAttribute("list", list);
return "admin/pinglun";
} catch (Exception e) {
return null;
}
}
@SuppressWarnings("finally")
@RequestMapping(value="/jinping_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 = jinpingService.Del(id);
if(r>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 null;
}
}
如果也想学习本系统,下面领取。关注并回复:315ssm