基于javaweb+mysql的ssm景点门票预订管理系统(java+ssm+jsp+bootstrap+mysql)
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的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版本;
技术栈
- 后端:Spring+SpringMVC+Mybatis 2. 前端:JSP+bootstrap+jQuery
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中db.properties配置文件中的数据库配置改为自己的配置; 4. 运行项目,输入localhost:8080/
@Controller
@RequestMapping("/touristtype.do")
public class TouristTypeController {
@Autowired
private TouristTypeService touristTypeService;
@RequestMapping(params="method=typeMain")
public ModelAndView typeMain(HttpServletRequest request,HttpServletResponse response){
ModelAndView mav = new ModelAndView();
mav.setViewName("admin/typeMain");
return mav;
}
@RequestMapping(params="method=typeMainData")
public ModelAndView typeMainData(HttpServletRequest request,HttpServletResponse response,@ModelAttribute TouristType type){
List<TouristType> list = new ArrayList<TouristType>();
JSONObject obj = new JSONObject();
try{
if(StringUtils.isBlank(type.getName())){
type.setName(null);
}
list=this.touristTypeService.findTouristTypeList(type);
}
catch(Exception ex){
}
obj.put("rows", list);
obj.put("total", list.size());
return CommonResponse.JsonAjax(obj.toString());
}
@RequestMapping(params="method=getTypeList")
public ModelAndView getTypeList(HttpServletRequest request,HttpServletResponse response){
List<TouristType> list = new ArrayList<TouristType>();
JSONArray array = new JSONArray();
try{
TouristType type = new TouristType();
list=this.touristTypeService.findTouristTypeList(type);
for(TouristType touristtyppe : list){
JSONObject obj = new JSONObject();
obj.put("code", touristtyppe.getId());
}
return CommonResponse.JsonAjax(obj.toString());
}
@RequestMapping(params="method=addUser")
public ModelAndView addUser(HttpServletRequest request,HttpServletResponse response,@ModelAttribute User user){
response.setContentType("text/html;charset=utf-8");
JSONObject obj = new JSONObject();
user.setRole(0);
user.setState(0);
try{
userService.save(user);
obj.put("statusCode", 200);
obj.put("title", "操作提示");
obj.put("message", "恭喜你,操作成功");
}
catch(Exception e){
obj.put("statusCode", 201);
obj.put("title", "操作提示");
obj.put("message", "添加用户失败");
}
return CommonResponse.JsonAjax(obj.toString());
}
@RequestMapping(params="method=toAddUser")
public ModelAndView toAddUser(HttpServletRequest request,HttpServletResponse response){
ModelAndView mav = new ModelAndView();
mav.setViewName("admin/userAdd");
return mav;
}
@RequestMapping(params="method=toEditUser")
public ModelAndView toEditUser(HttpServletRequest request,HttpServletResponse response){
ModelAndView mav = new ModelAndView();
mav.setViewName("admin/userEdit");
return mav;
}
@RequestMapping(params="method=toCheckUser")
public ModelAndView toCheckUser(HttpServletRequest request,HttpServletResponse response){
ModelAndView mav = new ModelAndView();
mav.setViewName("admin/userCheck");
return mav;
}
@RequestMapping(params="method=getUser")
public ModelAndView getUser(HttpServletRequest request,HttpServletResponse response){
@Autowired
private UserService userService;
@Autowired
private TouristService touristService;
@Autowired
private OrdersService ordersService;
@RequestMapping(params="method=getAllUser")
public ModelAndView getAllUser(HttpServletRequest request,HttpServletResponse reponse){
ModelAndView mav = new ModelAndView();
mav.setViewName("admin/allUser");
return mav;
}
@RequestMapping(params="method=checkAllUser")
public ModelAndView checkAllUser(HttpServletRequest request,HttpServletResponse reponse){
ModelAndView mav = new ModelAndView();
mav.setViewName("admin/checkUserList");
return mav;
}
@RequestMapping(params="method=getCheckUserData")
public ModelAndView getCheckUserData(HttpServletRequest request,HttpServletResponse response,@ModelAttribute User user){
List<User> findAll = new ArrayList<User>();
JSONObject obj = new JSONObject();
try{
if(user.getUsername()!=null&&StringUtils.isBlank(user.getUsername())){
user.setUsername(null);
}
user.setState(0);
findAll = userService.findAll(user);
}
catch(Exception e){
}
obj.put("rows", findAll);
obj.put("total", findAll.size());
catch(Exception e){
}
return CommonResponse.JsonAjax(JSONObject.fromObject(type).toString());
}
@RequestMapping(params="method=updateTouristType")
public ModelAndView updateTouristType(HttpServletRequest request,HttpServletResponse response,@ModelAttribute MessageBoard type){
JSONObject obj = new JSONObject();
try{
if(this.touristTypeService.update(type)){
obj.put("statusCode", 200);
obj.put("title", "操作提示");
obj.put("message", "恭喜你,操作成功");
}
else{
obj.put("statusCode", 201);
obj.put("title", "操作提示");
obj.put("message", "添加留言失败");
}
}
catch(Exception ex){
obj.put("statusCode", 201);
obj.put("title", "操作提示");
obj.put("message", "添加留言失败");
}
return CommonResponse.JsonAjax(obj.toString());
}
@RequestMapping(params="method=deleteTouristType")
public ModelAndView deleteTouristType(HttpServletRequest request,HttpServletResponse response){
JSONObject obj = new JSONObject();
try{
int id=Integer.valueOf(String.valueOf(request.getParameter("id")));
MessageBoard type = new MessageBoard();
type.setId(id);
if(this.touristTypeService.delete(type)){
obj.put("statusCode", 200);
obj.put("title", "操作提示");
obj.put("message", "恭喜你,操作成功");
}
else{
obj.put("statusCode", 201);
obj.put("title", "操作提示");
obj.put("message", "删除留言失败");
}
}
catch(Exception e){
obj.put("statusCode", 201);
obj.put("title", "操作提示");
obj.put("message", "删除留言失败");
}
return CommonResponse.JsonAjax(obj.toString());
return CommonResponse.JsonAjax(obj.toString());
}
@RequestMapping(params="method=addUser")
public ModelAndView addUser(HttpServletRequest request,HttpServletResponse response,@ModelAttribute User user){
response.setContentType("text/html;charset=utf-8");
JSONObject obj = new JSONObject();
user.setRole(0);
user.setState(0);
try{
userService.save(user);
obj.put("statusCode", 200);
obj.put("title", "操作提示");
obj.put("message", "恭喜你,操作成功");
}
catch(Exception e){
obj.put("statusCode", 201);
obj.put("title", "操作提示");
obj.put("message", "添加用户失败");
}
return CommonResponse.JsonAjax(obj.toString());
}
@RequestMapping(params="method=toAddUser")
public ModelAndView toAddUser(HttpServletRequest request,HttpServletResponse response){
ModelAndView mav = new ModelAndView();
mav.setViewName("admin/userAdd");
return mav;
}
@RequestMapping(params="method=toEditUser")
public ModelAndView toEditUser(HttpServletRequest request,HttpServletResponse response){
ModelAndView mav = new ModelAndView();
mav.setViewName("admin/userEdit");
return mav;
}
@RequestMapping(params="method=toCheckUser")
public ModelAndView toCheckUser(HttpServletRequest request,HttpServletResponse response){
ModelAndView mav = new ModelAndView();
mav.setViewName("admin/userCheck");
return mav;
}
@RequestMapping(params="method=getUser")
public ModelAndView getUser(HttpServletRequest request,HttpServletResponse response){
ModelAndView mav = new ModelAndView();
mav.setViewName("editUser");
return mav;
}
@RequestMapping(params="method=findUser")
public ModelAndView findUser(HttpServletRequest request,HttpServletResponse response){
int id =Integer.valueOf(request.getParameter("id"));
obj.put("total", list.size());
return CommonResponse.JsonAjax(obj.toString());
}
@RequestMapping(params="method=toAddTourist")
public ModelAndView toAddTourist(HttpServletRequest request,HttpServletResponse response){
ModelAndView mav = new ModelAndView();
mav.setViewName("admin/hotelAdd");
return mav;
}
@RequestMapping(params="method=addTourist")
public ModelAndView addTourist(HttpServletRequest request,HttpServletResponse response,@ModelAttribute Hotel tourist){
response.setContentType("text/html;charset=utf-8");
JSONObject obj = new JSONObject();
try{
this.hotelService.save(tourist);
obj.put("statusCode", 200);
obj.put("title", "操作提示");
obj.put("message", "恭喜你,添加酒店成功");
}
catch(Exception ex){
obj.put("statusCode", 201);
obj.put("title", "操作提示");
obj.put("message", "添加酒店失败");
}
return CommonResponse.JsonAjax(obj.toString());
}
@RequestMapping(params="method=toEditTourist")
public ModelAndView toEditTourist(HttpServletRequest request,HttpServletResponse response){
ModelAndView mav = new ModelAndView();
mav.setViewName("admin/hotelEdit");
return mav;
}
@RequestMapping(params="method=findTourist")
public ModelAndView findTourist(HttpServletRequest request,HttpServletResponse response){
response.setContentType("text/html;charset=utf-8");
Hotel tourist = new Hotel();
try{
int id =Integer.valueOf(request.getParameter("id"));
Hotel bean = new Hotel();
bean.setId(id);
tourist=this.hotelService.findHotelinfo(bean);
}
catch(Exception ex){
}
return CommonResponse.JsonAjax(JSONObject.fromObject(tourist).toString());
}
@RequestMapping(params="method=updateTourist")
public ModelAndView updateTourist(HttpServletRequest request,HttpServletResponse response,@ModelAttribute Hotel tourist){
mav.setViewName("site/tourist");
mav.addObject("tourist", zxinfo);
return mav;
}
@RequestMapping(params="method=openTicket")
public ModelAndView openTicket(HttpServletRequest request,HttpServletResponse response){
ModelAndView mav = new ModelAndView();
Integer id=Integer.valueOf(request.getParameter("id"));
Tourist bean = new Tourist();
bean.setId(id);
Tourist zxinfo = new Tourist();
zxinfo=this.touristService.findTourist(bean);
mav.setViewName("site/ticket");
mav.addObject("tourist", zxinfo);
return mav;
}
@RequestMapping(params="method=openHotel")
public ModelAndView openHotel(HttpServletRequest request,HttpServletResponse response){
ModelAndView mav = new ModelAndView();
Integer id=Integer.valueOf(request.getParameter("id"));
Hotel bean = new Hotel();
bean.setId(id);
Hotel zxinfo = new Hotel();
zxinfo=this.hotelService.findHotelinfo(bean);
mav.setViewName("site/hotel");
mav.addObject("hotel", zxinfo);
return mav;
}
@RequestMapping(params="method=openTrace")
public ModelAndView openTrace(HttpServletRequest request,HttpServletResponse response){
ModelAndView mav = new ModelAndView();
Integer id=Integer.valueOf(request.getParameter("id"));
TouristTrace bean = new TouristTrace();
bean.setId(id);
TouristTrace zxinfo = new TouristTrace();
zxinfo=this.touristTaceService.findTouristTrace(bean);
mav.setViewName("site/trace");
mav.addObject("trace", zxinfo);
return mav;
}
ModelAndView mav = new ModelAndView();
response.setContentType("text/html;charset=utf-8");
List<Tourist> list = new ArrayList<Tourist>();
Tourist t = new Tourist();
String name = request.getParameter("name");
t.setName(name);
list=this.touristService.findTouristList(t);
List<ZiXuninfo> zxs = new ArrayList<ZiXuninfo>();
zxs = this.ziXuninfoService.findZiXunList(new ZiXuninfo());
User user = (User)request.getSession().getAttribute("user");
List<Hotel> hotels=this.hotelService.findHotelList(new Hotel());
List<TouristTrace> traces = this.touristTaceService.findTouristTraceList( new TouristTrace());
if (user != null) {
List<Orders> orders = ordersService.findMyOrder(user.getId());
mav.addObject("orders", orders);
}
mav.addObject("zxs", zxs);
mav.setViewName("site/index");
mav.addObject("tourist",list);
mav.addObject("user",user);
mav.addObject("hotels", hotels);
mav.addObject("traces", traces);
mav.addObject("name", name);
return mav;
}
@RequestMapping(params="method=openZxinfo")
public ModelAndView openZxinfo(HttpServletRequest request,HttpServletResponse response){
ModelAndView mav = new ModelAndView();
Integer id=Integer.valueOf(request.getParameter("id"));
ZiXuninfo bean = new ZiXuninfo();
bean.setId(id);
ZiXuninfo zxinfo = new ZiXuninfo();
zxinfo=this.ziXuninfoService.findZiXuninfo(bean);
mav.setViewName("site/zxinfo");
mav.addObject("zxinfo", zxinfo);
return mav;
}
@RequestMapping(params="method=openTourist")
public ModelAndView openTourist(HttpServletRequest request,HttpServletResponse response){
ModelAndView mav = new ModelAndView();
Integer id=Integer.valueOf(request.getParameter("id"));
Tourist bean = new Tourist();
bean.setId(id);
}
@RequestMapping(params="method=addTourist")
public ModelAndView addTourist(HttpServletRequest request,HttpServletResponse response,@ModelAttribute Hotel tourist){
response.setContentType("text/html;charset=utf-8");
JSONObject obj = new JSONObject();
try{
this.hotelService.save(tourist);
obj.put("statusCode", 200);
obj.put("title", "操作提示");
obj.put("message", "恭喜你,添加酒店成功");
}
catch(Exception ex){
obj.put("statusCode", 201);
obj.put("title", "操作提示");
obj.put("message", "添加酒店失败");
}
return CommonResponse.JsonAjax(obj.toString());
}
@RequestMapping(params="method=toEditTourist")
public ModelAndView toEditTourist(HttpServletRequest request,HttpServletResponse response){
ModelAndView mav = new ModelAndView();
mav.setViewName("admin/hotelEdit");
return mav;
}
@RequestMapping(params="method=findTourist")
public ModelAndView findTourist(HttpServletRequest request,HttpServletResponse response){
response.setContentType("text/html;charset=utf-8");
Hotel tourist = new Hotel();
try{
int id =Integer.valueOf(request.getParameter("id"));
Hotel bean = new Hotel();
bean.setId(id);
tourist=this.hotelService.findHotelinfo(bean);
}
catch(Exception ex){
}
return CommonResponse.JsonAjax(JSONObject.fromObject(tourist).toString());
}
@RequestMapping(params="method=updateTourist")
public ModelAndView updateTourist(HttpServletRequest request,HttpServletResponse response,@ModelAttribute Hotel tourist){
response.setContentType("text/html;charset=utf-8");
JSONObject obj = new JSONObject();
try{
if(this.hotelService.update(tourist)){
obj.put("statusCode", 200);
obj.put("title", "操作提示");
obj.put("message", "恭喜你,操作成功");
}
else{
obj.put("statusCode", 201);
obj.put("statusCode", 200);
obj.put("title", "操作提示");
obj.put("message", "上传文件成功");
obj.put("filePath", filename);
// OutputUtil.jsonOutPut(response, null);
}catch (Exception e) {
// OutputUtil.errorOutPut(response, "系统异常");
obj.put("statusCode", 201);
obj.put("title", "操作提示");
obj.put("message", "上传文件失败");
}
return CommonResponse.JsonAjax(obj.toString());
}
}
@Controller
@RequestMapping("/touristtype.do")
public class TouristTypeController {
@Autowired
private TouristTypeService touristTypeService;
@RequestMapping(params="method=typeMain")
public ModelAndView typeMain(HttpServletRequest request,HttpServletResponse response){
ModelAndView mav = new ModelAndView();
file.transferTo(new File(path + File.separator + filename));
obj.put("statusCode", 200);
obj.put("title", "操作提示");
obj.put("message", "上传文件成功");
obj.put("filePath", filename);
// OutputUtil.jsonOutPut(response, null);
}catch (Exception e) {
// OutputUtil.errorOutPut(response, "系统异常");
obj.put("statusCode", 201);
obj.put("title", "操作提示");
obj.put("message", "上传文件失败");
}
return CommonResponse.JsonAjax(obj.toString());
}
}
@Controller("/zxinfo.do")
public class ZiXuninfoController {
@Autowired
private ZiXuninfoService touristService;
@RequestMapping(params="method=touristMain")
public ModelAndView touristMain(HttpServletRequest request,HttpServletResponse response){
ModelAndView mav = new ModelAndView();
mav.setViewName("admin/zxinfoMain");
return mav;
}
@RequestMapping(params="method=touristMainData")
@Controller
@RequestMapping("/touristtrace.do")
public class TouristTraceController {
@Autowired
private TouristTaceService touristtraceService;
@RequestMapping(params="method=touristMain")
public ModelAndView touristMain(HttpServletRequest request,HttpServletResponse response){
ModelAndView mav = new ModelAndView();
mav.setViewName("admin/touristtraceMain");
return mav;
}
@RequestMapping(params="method=touristMainData")
public ModelAndView touristMainData(HttpServletRequest request,HttpServletResponse response,@ModelAttribute TouristTrace tourist){
response.setContentType("text/html;charset=utf-8");
List<TouristTrace> list = new ArrayList<TouristTrace>();
JSONObject obj = new JSONObject();
try{
if(StringUtils.isBlank(tourist.getName())){
tourist.setName(null);
}
list=this.touristtraceService.findTouristTraceList(tourist);
}
catch(Exception e){
}
obj.put("rows", list);
obj.put("total", list.size());
return CommonResponse.JsonAjax(obj.toString());
}
@RequestMapping(params="method=toAddTourist")
public ModelAndView toAddTourist(HttpServletRequest request,HttpServletResponse response){
ModelAndView mav = new ModelAndView();
mav.setViewName("admin/touristtAdd");
return mav;
}
@RequestMapping(params="method=addTourist")
public ModelAndView addTourist(HttpServletRequest request,HttpServletResponse response,@ModelAttribute TouristTrace tourist){
response.setContentType("text/html;charset=utf-8");
JSONObject obj = new JSONObject();
try{
this.touristtraceService.save(tourist);
if (!filepath.getParentFile().exists()) {
filepath.getParentFile().mkdirs();
}
//将上传文件保存到一个目标文件当中
file.transferTo(new File(path + File.separator + filename));
obj.put("statusCode", 200);
obj.put("title", "操作提示");
obj.put("message", "上传文件成功");
obj.put("filePath", filename);
// OutputUtil.jsonOutPut(response, null);
}catch (Exception e) {
// OutputUtil.errorOutPut(response, "系统异常");
obj.put("statusCode", 201);
obj.put("title", "操作提示");
obj.put("message", "上传文件失败");
}
return CommonResponse.JsonAjax(obj.toString());
}
}
@Controller("/zxinfo.do")
public class ZiXuninfoController {
@Autowired
private ZiXuninfoService touristService;
@Autowired
private ZiXuninfoService touristService;
@RequestMapping(params="method=touristMain")
public ModelAndView touristMain(HttpServletRequest request,HttpServletResponse response){
ModelAndView mav = new ModelAndView();
mav.setViewName("admin/zxinfoMain");
return mav;
}
@RequestMapping(params="method=touristMainData")
public ModelAndView touristMainData(HttpServletRequest request,HttpServletResponse response,@ModelAttribute ZiXuninfo tourist){
response.setContentType("text/html;charset=utf-8");
List<ZiXuninfo> list = new ArrayList<ZiXuninfo>();
JSONObject obj = new JSONObject();
try{
if(StringUtils.isBlank(tourist.getName())){
tourist.setName(null);
}
list=this.touristService.findZiXunList(tourist);
}
catch(Exception e){
}
obj.put("rows", list);
obj.put("total", list.size());
return CommonResponse.JsonAjax(obj.toString());
}
@RequestMapping(params="method=toAddTourist")
public ModelAndView toAddTourist(HttpServletRequest request,HttpServletResponse response){
ModelAndView mav = new ModelAndView();
mav.setViewName("admin/zxinfoAdd");
return mav;
}
@RequestMapping(params="method=addTourist")
public ModelAndView addTourist(HttpServletRequest request,HttpServletResponse response,@ModelAttribute ZiXuninfo tourist){
response.setContentType("text/html;charset=utf-8");
JSONObject obj = new JSONObject();
try{
this.touristService.save(tourist);
obj.put("statusCode", 200);
obj.put("title", "操作提示");
obj.put("message", "恭喜你,添加资讯成功");
}
catch(Exception ex){
obj.put("statusCode", 201);
obj.put("title", "操作提示");
obj.put("message", "添加资讯失败");
@Controller
@RequestMapping("/tourist.do")
public class TouristController {
@Autowired
private TouristService touristService;
@Autowired
private ProvinceService provinceService;
@Autowired
private CityService cityService;
@RequestMapping(params="method=touristMain")
public ModelAndView touristMain(HttpServletRequest request,HttpServletResponse response){
ModelAndView mav = new ModelAndView();
mav.setViewName("admin/touristMain");
return mav;
}
@RequestMapping(params="method=touristMainData")
public ModelAndView touristMainData(HttpServletRequest request,HttpServletResponse response,@ModelAttribute Tourist tourist){
response.setContentType("text/html;charset=utf-8");
List<Tourist> list = new ArrayList<Tourist>();
JSONObject obj = new JSONObject();
try{
if(StringUtils.isBlank(tourist.getName())){
tourist.setName(null);
}
list=this.touristService.findTouristList(tourist);
}
catch(Exception e){
}
obj.put("rows", list);
obj.put("total", list.size());
return CommonResponse.JsonAjax(obj.toString());
}
@RequestMapping(params="method=toAddTourist")
public ModelAndView toAddTourist(HttpServletRequest request,HttpServletResponse response){
obj.put("message", "恭喜你,添加酒店成功");
}
catch(Exception ex){
obj.put("statusCode", 201);
obj.put("title", "操作提示");
obj.put("message", "添加酒店失败");
}
return CommonResponse.JsonAjax(obj.toString());
}
@RequestMapping(params="method=toEditTourist")
public ModelAndView toEditTourist(HttpServletRequest request,HttpServletResponse response){
ModelAndView mav = new ModelAndView();
mav.setViewName("admin/hotelEdit");
return mav;
}
@RequestMapping(params="method=findTourist")
public ModelAndView findTourist(HttpServletRequest request,HttpServletResponse response){
response.setContentType("text/html;charset=utf-8");
Hotel tourist = new Hotel();
try{
int id =Integer.valueOf(request.getParameter("id"));
Hotel bean = new Hotel();
bean.setId(id);
tourist=this.hotelService.findHotelinfo(bean);
}
catch(Exception ex){
}
return CommonResponse.JsonAjax(JSONObject.fromObject(tourist).toString());
}
@RequestMapping(params="method=updateTourist")
public ModelAndView updateTourist(HttpServletRequest request,HttpServletResponse response,@ModelAttribute Hotel tourist){
response.setContentType("text/html;charset=utf-8");
JSONObject obj = new JSONObject();
try{
if(this.hotelService.update(tourist)){
obj.put("statusCode", 200);
obj.put("title", "操作提示");
obj.put("message", "恭喜你,操作成功");
}
else{
obj.put("statusCode", 201);
obj.put("title", "操作提示");
obj.put("message", "更新酒店失败");
}
}
catch(Exception ex){
}
}
catch(Exception ex){
obj.put("statusCode", 201);
obj.put("title", "操作提示");
obj.put("message", "更新景点失败");
}
return CommonResponse.JsonAjax(obj.toString());
}
@RequestMapping(params="method=deleteTourist")
public ModelAndView deleteTourist(HttpServletRequest request,HttpServletResponse response,@ModelAttribute Tourist tourist){
response.setContentType("text/html;charset=utf-8");
JSONObject obj = new JSONObject();
try{
if(this.touristService.delete(tourist)){
obj.put("statusCode", 200);
obj.put("title", "操作提示");
obj.put("message", "恭喜你,操作成功");
}
else{
obj.put("statusCode", 201);
obj.put("title", "操作提示");
obj.put("message", "删除景点失败");
}
}
catch(Exception ex){
obj.put("statusCode", 201);
obj.put("title", "操作提示");
obj.put("message", "删除景点失败");
}
return CommonResponse.JsonAjax(obj.toString());
}
@RequestMapping(params="method=finProvinceList")
public ModelAndView finProvinceList(HttpServletRequest request,HttpServletResponse response){
response.setContentType("text/html;charset=utf-8");
List<Province> list = new ArrayList<Province>();
try{
list = this.provinceService.findProvinceList(new Province());
}
catch(Exception ex){
}
return CommonResponse.JsonAjax(JSONArray.fromObject(list).toString());
response.setContentType("text/html;charset=utf-8");
JSONObject obj = new JSONObject();
try{
this.touristService.save(tourist);
obj.put("statusCode", 200);
obj.put("title", "操作提示");
obj.put("message", "恭喜你,添加资讯成功");
}
catch(Exception ex){
obj.put("statusCode", 201);
obj.put("title", "操作提示");
obj.put("message", "添加资讯失败");
}
return CommonResponse.JsonAjax(obj.toString());
}
@RequestMapping(params="method=toEditTourist")
public ModelAndView toEditTourist(HttpServletRequest request,HttpServletResponse response){
ModelAndView mav = new ModelAndView();
mav.setViewName("admin/zxinfoEdit");
return mav;
}
@RequestMapping(params="method=findTourist")
public ModelAndView findTourist(HttpServletRequest request,HttpServletResponse response){
response.setContentType("text/html;charset=utf-8");
ZiXuninfo tourist = new ZiXuninfo();
try{
int id =Integer.valueOf(request.getParameter("id"));
ZiXuninfo bean = new ZiXuninfo();
bean.setId(id);
tourist=this.touristService.findZiXuninfo(bean);
}
catch(Exception ex){
}
return CommonResponse.JsonAjax(JSONObject.fromObject(tourist).toString());
}
@RequestMapping(params="method=updateTourist")
public ModelAndView updateTourist(HttpServletRequest request,HttpServletResponse response,@ModelAttribute ZiXuninfo tourist){
response.setContentType("text/html;charset=utf-8");
JSONObject obj = new JSONObject();
try{
if(this.touristService.update(tourist)){
obj.put("statusCode", 200);
obj.put("title", "操作提示");
obj.put("message", "恭喜你,操作成功");
}