重庆分公司,新征程启航

为企业提供网站建设、域名注册、服务器等服务

Java项目:SSM场地预订管理系统-创新互联

作者主页:源码空间站2022

简介:Java领域优质创作者、Java项目、学习资料、技术互助

创新互联是一家专业提供涞源企业网站建设,专注与成都网站设计、成都网站制作、外贸网站建设H5场景定制、小程序制作等业务。10年已为涞源众多企业、政府机构等服务。创新互联专业网络公司优惠进行中。

文末获取源码

项目介绍

本项目分为前后台,前台为普通用户登录,后台为管理员登录;

用户角色包含以下功能:

按分类查看场地,用户登录,查看网站公告,按分类查看器材,查看商品详情,加入购物车,提交订单,查看订单,修改个人信息等功能。

管理员角色包含以下功能:

管理员登录,管理员信息管理,用户信息管理,新闻公告信息管理,实体类型信息管理,场地信息管理,器材信息管理,评价信息管理等功能。

环境需要

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项目:否;

技术栈

1. 后端:Spring+SpringMVC+Mybatis

2. 前端:JSP+CSS+JavaScript+jQuery

使用说明

1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;

2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;

若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;

3. 将项目中springmvc-servlet.xml配置文件中的数据库配置改为自己的配置;
4. 运行项目,在浏览器中输入http://localhost:8080/ 登录
用户账号/密码: user/123456

管理员账号/密码:admin/admin

运行截图 前台界面

后台界面

相关代码 OrdersAction
package com.action;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.entity.Orders;
import com.service.OrdersService;
import com.entity.Users;
import com.service.UsersService;
import com.util.PageHelper;
//定义为控制器
@Controller
// 设置路径
@RequestMapping(value = "/orders" , produces = "text/plain;charset=utf-8")
public class OrdersAction extends BaseAction {
// 注入Service 由于标签的存在 所以不需要getter setter
@Autowired
@Resource
private OrdersService ordersService;
@Autowired
@Resource
private UsersService usersService;

// 准备添加数据
@RequestMapping("createOrders.action")
public String createOrders() {
ListusersList = this.usersService.getAllUsers();
this.getRequest().setAttribute("usersList", usersList);
return "admin/addorders";
}
// 添加数据
@RequestMapping("addOrders.action")
public String addOrders(Orders orders) {
this.ordersService.insertOrders(orders);
return "redirect:/orders/createOrders.action";
}

// 通过主键删除数据
@RequestMapping("deleteOrders.action")
public String deleteOrders(String id) {
this.ordersService.deleteOrders(id);
return "redirect:/orders/getAllOrders.action";
}

// 批量删除数据
@RequestMapping("deleteOrdersByIds.action")
public String deleteOrdersByIds() {
String[] ids = this.getRequest().getParameterValues("ordersid");
for (String ordersid : ids) {
this.ordersService.deleteOrders(ordersid);
}
return "redirect:/orders/getAllOrders.action";
}

// 更新数据
@RequestMapping("updateOrders.action")
public String updateOrders(Orders orders) {
this.ordersService.updateOrders(orders);
return "redirect:/orders/getAllOrders.action";
}
// 显示全部数据
@RequestMapping("getAllOrders.action")
public String getAllOrders(String number) {
ListordersList = this.ordersService.getAllOrders();
PageHelper.getPage(ordersList, "orders", null, null, 10, number, this.getRequest(), null);
return "admin/listorders";
}

// 按条件查询数据 (模糊查询)
@RequestMapping("queryOrdersByCond.action")
public String queryOrdersByCond(String cond, String name, String number) {
Orders orders = new Orders();
if(cond != null){
if ("ordercode".equals(cond)) {
orders.setOrdercode(name);
}
if ("username".equals(cond)) {
orders.setUsername(name);
}
if ("total".equals(cond)) {
orders.setTotal(name);
}
if ("status".equals(cond)) {
orders.setStatus(name);
}
if ("addtime".equals(cond)) {
orders.setAddtime(name);
}
}

ListnameList = new ArrayList();
ListvalueList = new ArrayList();
nameList.add(cond);
valueList.add(name);
PageHelper.getPage(this.ordersService.getOrdersByLike(orders), "orders", nameList, valueList, 10, number, this.getRequest(), "query");
name = null;
cond = null;
return "admin/queryorders";
}

// 按主键查询数据
@RequestMapping("getOrdersById.action")
public String getOrdersById(String id ) {
Orders orders = this.ordersService.getOrdersById(id);
this.getRequest().setAttribute("orders", orders);
ListusersList = this.usersService.getAllUsers();
this.getRequest().setAttribute("usersList", usersList);
return "admin/editorders";
}

public OrdersService getOrdersService() { return ordersService; }

public void setOrdersService(OrdersService ordersService) { this.ordersService = ordersService; }

}
JiancaiAction
package com.action;

import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.entity.Jiancai;
import com.service.JiancaiService;
import com.entity.Cate;
import com.service.CateService;
import com.util.PageHelper;

//定义为控制器
@Controller
// 设置路径
@RequestMapping(value = "/jiancai", produces = "text/plain;charset=utf-8")
public class JiancaiAction extends BaseAction {
	// 注入Service 由于标签的存在 所以不需要getter setter
	@Autowired
	@Resource
	private JiancaiService jiancaiService;
	@Autowired
	@Resource
	private CateService cateService;

	// 准备添加数据
	@RequestMapping("createJiancai.action")
	public String createJiancai() {
		ListcateList = this.cateService.getAllCate();
		this.getRequest().setAttribute("cateList", cateList);
		return "admin/addjiancai";
	}

	// 添加数据
	@RequestMapping("addJiancai.action")
	public String addJiancai(Jiancai jiancai) {
		jiancai.setHits("0");
		jiancai.setSellnum("0");
		this.jiancaiService.insertJiancai(jiancai);
		return "redirect:/jiancai/createJiancai.action";
	}

	// 通过主键删除数据
	@RequestMapping("deleteJiancai.action")
	public String deleteJiancai(String id) {
		this.jiancaiService.deleteJiancai(id);
		return "redirect:/jiancai/getAllJiancai.action";
	}

	// 批量删除数据
	@RequestMapping("deleteJiancaiByIds.action")
	public String deleteJiancaiByIds() {
		String[] ids = this.getRequest().getParameterValues("jiancaiid");
		for (String jiancaiid : ids) {
			this.jiancaiService.deleteJiancai(jiancaiid);
		}
		return "redirect:/jiancai/getAllJiancai.action";
	}

	// 更新数据
	@RequestMapping("updateJiancai.action")
	public String updateJiancai(Jiancai jiancai) {
		this.jiancaiService.updateJiancai(jiancai);
		return "redirect:/jiancai/getAllJiancai.action";
	}

	// 显示全部数据
	@RequestMapping("getAllJiancai.action")
	public String getAllJiancai(String number) {
		ListjiancaiList = this.jiancaiService.getAllJiancai();
		PageHelper.getPage(jiancaiList, "jiancai", null, null, 10, number, this.getRequest(), null);
		return "admin/listjiancai";
	}

	// 按条件查询数据 (模糊查询)
	@RequestMapping("queryJiancaiByCond.action")
	public String queryJiancaiByCond(String cond, String name, String number) {
		Jiancai jiancai = new Jiancai();
		if (cond != null) {
			if ("jiancainame".equals(cond)) {
				jiancai.setJiancainame(name);
			}
			if ("image".equals(cond)) {
				jiancai.setImage(name);
			}
			if ("cateid".equals(cond)) {
				jiancai.setCatename(name);
			}
			if ("price".equals(cond)) {
				jiancai.setPrice(name);
			}
			if ("recommend".equals(cond)) {
				jiancai.setRecommend(name);
			}
			if ("thestart".equals(cond)) {
				jiancai.setThestart(name);
			}
			if ("theend".equals(cond)) {
				jiancai.setTheend(name);
			}
			if ("hits".equals(cond)) {
				jiancai.setHits(name);
			}
			if ("sellnum".equals(cond)) {
				jiancai.setSellnum(name);
			}
			if ("contents".equals(cond)) {
				jiancai.setContents(name);
			}
		}

		ListnameList = new ArrayList();
		ListvalueList = new ArrayList();
		nameList.add(cond);
		valueList.add(name);
		PageHelper.getPage(this.jiancaiService.getJiancaiByLike(jiancai), "jiancai", nameList, valueList, 10, number, this.getRequest(), "query");
		name = null;
		cond = null;
		return "admin/queryjiancai";
	}

	// 按主键查询数据
	@RequestMapping("getJiancaiById.action")
	public String getJiancaiById(String id) {
		Jiancai jiancai = this.jiancaiService.getJiancaiById(id);
		this.getRequest().setAttribute("jiancai", jiancai);
		ListcateList = this.cateService.getAllCate();
		this.getRequest().setAttribute("cateList", cateList);
		return "admin/editjiancai";
	}

	public JiancaiService getJiancaiService() {
		return jiancaiService;
	}

	public void setJiancaiService(JiancaiService jiancaiService) {
		this.jiancaiService = jiancaiService;
	}

}
IndexAction
package com.action;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.entity.Article;
import com.entity.Cart;
import com.entity.Cate;
import com.entity.City;
import com.entity.Details;
import com.entity.Jiancai;
import com.entity.Orders;
import com.entity.Topic;
import com.entity.Users;
import com.service.ArticleService;
import com.service.CartService;
import com.service.CateService;
import com.service.PeihuoService;
import com.service.CityService;
import com.service.DetailsService;
import com.service.JiancaiService;
import com.service.OrdersService;
import com.service.TopicService;
import com.service.UsersService;
import com.util.VeDate;

//定义为控制器
@Controller
// 设置路径
@RequestMapping("/index")
public class IndexAction extends BaseAction {

	@Autowired
	@Resource
	private UsersService usersService;
	@Autowired
	@Resource
	private ArticleService articleService;
	@Autowired
	@Resource
	private CateService cateService;
	@Autowired
	@Resource
	private CityService cityService;
	@Autowired
	@Resource
	private PeihuoService peihuoService;
	@Autowired
	@Resource
	private JiancaiService jiancaiService;
	@Autowired
	@Resource
	private CartService cartService;
	@Autowired
	@Resource
	private OrdersService ordersService;
	@Autowired
	@Resource
	private DetailsService detailsService;
	@Autowired
	@Resource
	private TopicService topicService;

	// 公共方法 提供公共查询数据
	private void front() {
		this.getRequest().setAttribute("title", "优品场地网-力作中国大的场地网站");
		ListcateList = this.cateService.getAllCate();
		this.getRequest().setAttribute("cateList", cateList);
		ListhotList = this.jiancaiService.getJiancaiByHot();
		Collections.shuffle(hotList);
		this.getRequest().setAttribute("hotList", hotList);
	}

	// 首页显示
		@RequestMapping("index.action")
		public String index() {
			this.front();
			ListcateList = this.cateService.getCateFront();
			ListfrontList = new ArrayList();
			for (Cate cate : cateList) {
				ListflimList = this.jiancaiService.getJiancaiByCate(cate.getCateid());
				cate.setFlimList(flimList);
				frontList.add(cate);
			}
			this.getRequest().setAttribute("frontList", frontList);
			return "users/index";
		}
		
		// 首页显示
		@RequestMapping("network.action")
		public String network() {
			this.front();
			ListcateList = this.cateService.getCateFront();
			ListfrontList = new ArrayList();
			for (Cate cate : cateList) {
				ListflimList = this.jiancaiService.getJiancaiByCate(cate.getCateid());
				cate.setFlimList(flimList);
				frontList.add(cate);
			}
			this.getRequest().setAttribute("frontList", frontList);
			return "users/network";
		}

	// 公告
	@RequestMapping("article.action")
	public String article(String number) {
		this.front();
		List articleList = new ArrayList();
		List tempList = this.articleService.getAllArticle();
		int pageNumber = tempList.size();
		int maxPage = pageNumber;
		if (maxPage % 12 == 0) {
			maxPage = maxPage / 12;
		} else {
			maxPage = maxPage / 12 + 1;
		}
		if (number == null) {
			number = "0";
		}
		int start = Integer.parseInt(number) * 12;
		int over = (Integer.parseInt(number) + 1) * 12;
		int count = pageNumber - over;
		if (count<= 0) {
			over = pageNumber;
		}
		for (int i = start; i< over; i++) {
			Article x = tempList.get(i);
			articleList.add(x);
		}
		String html = "";
		StringBuffer buffer = new StringBuffer();
		buffer.append("  共为");
		buffer.append(maxPage);
		buffer.append("页  共有");
		buffer.append(pageNumber);
		buffer.append("条  当前为第");
		buffer.append((Integer.parseInt(number) + 1));
		buffer.append("页  ");
		if ((Integer.parseInt(number) + 1) == 1) {
			buffer.append("首页");
		} else {
			buffer.append("首页");
		}
		buffer.append("  ");
		if ((Integer.parseInt(number) + 1) == 1) {
			buffer.append("上一页");
		} else {
			buffer.append("上一页");
		}
		buffer.append("  ");
		if (maxPage<= (Integer.parseInt(number) + 1)) {
			buffer.append("下一页");
		} else {
			buffer.append("下一页");
		}
		buffer.append("  ");
		if (maxPage<= (Integer.parseInt(number) + 1)) {
			buffer.append("尾页");
		} else {
			buffer.append("尾页");
		}
		html = buffer.toString();
		this.getRequest().setAttribute("html", html);
		this.getRequest().setAttribute("articleList", articleList);
		return "users/article";
	}

	// 阅读公告
	@RequestMapping("read.action")
	public String read(String id) {
		this.front();
		Article article = this.articleService.getArticleById(id);
		article.setHits("" + (Integer.parseInt(article.getHits()) + 1));
		this.articleService.updateArticle(article);
		this.getRequest().setAttribute("article", article);
		return "users/read";
	}

	// 准备登录
	@RequestMapping("preLogin.action")
	public String prelogin() {
		this.front();
		return "users/login";
	}

	// 用户登录
	@RequestMapping("login.action")
	public String login() {
		this.front();
		String username = this.getRequest().getParameter("username");
		String password = this.getRequest().getParameter("password");
		Users u = new Users();
		u.setUsername(username);
		ListusersList = this.usersService.getUsersByCond(u);
		if (usersList.size() == 0) {
			this.getSession().setAttribute("message", "用户名不存在");
			return "redirect:/index/preLogin.action";
		} else {
			Users users = usersList.get(0);
			if (password.equals(users.getPassword())) {
				this.getSession().setAttribute("userid", users.getUsersid());
				this.getSession().setAttribute("username", users.getUsername());
				this.getSession().setAttribute("users", users);
				return "redirect:/index/index.action";
			} else {
				this.getSession().setAttribute("message", "密码错误");
				return "redirect:/index/preLogin.action";
			}
		}
	}

	// 准备注册
	@RequestMapping("preReg.action")
	public String preReg() {
		this.front();
		return "users/register";
	}

	// 用户注册
	@RequestMapping("register.action")
	public String register(Users users) {
		this.front();
		Users u = new Users();
		u.setUsername(users.getUsername());
		ListusersList = this.usersService.getUsersByCond(u);
		if (usersList.size() == 0) {
			users.setRegdate(VeDate.getStringDateShort());
			this.usersService.insertUsers(users);
		} else {
			this.getSession().setAttribute("message", "用户名已存在");
			return "redirect:/index/preReg.action";
		}

		return "redirect:/index/preLogin.action";
	}

	// 退出登录
	@RequestMapping("exit.action")
	public String exit() {
		this.front();
		this.getSession().removeAttribute("userid");
		this.getSession().removeAttribute("username");
		this.getSession().removeAttribute("users");
		return "index";
	}

	// 准备修改密码
	@RequestMapping("prePwd.action")
	public String prePwd() {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			return "redirect:/index/preLogin.action";
		}
		return "users/editpwd";
	}

	// 修改密码
	@RequestMapping("editpwd.action")
	public String editpwd() {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			return "redirect:/index/preLogin.action";
		}
		String userid = (String) this.getSession().getAttribute("userid");
		String password = this.getRequest().getParameter("password");
		String repassword = this.getRequest().getParameter("repassword");
		Users users = this.usersService.getUsersById(userid);
		if (password.equals(users.getPassword())) {
			users.setPassword(repassword);
			this.usersService.updateUsers(users);
		} else {
			this.getSession().setAttribute("message", "旧密码错误");
			return "redirect:/index/prePwd.action";
		}
		return "redirect:/index/prePwd.action";
	}

	@RequestMapping("usercenter.action")
	public String usercenter() {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			return "redirect:/index/preLogin.action";
		}
		return "users/usercenter";
	}

	@RequestMapping("userinfo.action")
	public String userinfo() {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			return "redirect:/index/preLogin.action";
		}
		String userid = (String) this.getSession().getAttribute("userid");
		this.getSession().setAttribute("users", this.usersService.getUsersById(userid));
		return "users/userinfo";
	}

	@RequestMapping("personal.action")
	public String personal(Users users) {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			return "redirect:/index/preLogin.action";
		}
		this.usersService.updateUsers(users);
		return "redirect:/index/userinfo.action";
	}

	// 添加产品到购物车
	@RequestMapping("addcart.action")
	public String addcart() {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			return "redirect:/index/preLogin.action";
		}
		String userid = (String) this.getSession().getAttribute("userid");
		Cart cart = new Cart();
		cart.setJiancaiid(getRequest().getParameter("goodsid"));
		cart.setNum(getRequest().getParameter("num"));
		cart.setPrice(getRequest().getParameter("price"));
		cart.setUsersid(userid);
		this.cartService.insertCart(cart);
		return "redirect:/index/cart.action";
	}

	// 查看购物车
	@RequestMapping("cart.action")
	public String cart() {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			return "redirect:/index/preLogin.action";
		}
		String userid = (String) this.getSession().getAttribute("userid");
		Cart cart = new Cart();
		cart.setUsersid(userid);
		ListcartList = this.cartService.getCartByCond(cart);
		this.getRequest().setAttribute("cartList", cartList);
		return "users/cart";
	}

	// 删除购物车中的产品
	@RequestMapping("deletecart.action")
	public String deletecart(String id) {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			return "redirect:/index/preLogin.action";
		}
		this.cartService.deleteCart(id);
		return "redirect:/index/cart.action";
	}

	// 准备结算
	@RequestMapping("preCheckout.action")
	public String preCheckout() {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			return "redirect:/index/preLogin.action";
		}
		String userid = (String) this.getSession().getAttribute("userid");
		Cart cart = new Cart();
		cart.setUsersid(userid);
		ListcartList = this.cartService.getCartByCond(cart);
		if (cartList.size() == 0) {
			this.getRequest().setAttribute("message", "请选购场地");
			return "redirect:/index/cart.action";
		}
		ListcityList = this.cityService.getAllCity();
		this.getRequest().setAttribute("cityList", cityList);
		return "users/checkout";
	}

	// 结算
	@RequestMapping("checkout.action")
	public String checkout() {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			return "redirect:/index/preLogin.action";
		}
		String userid = (String) this.getSession().getAttribute("userid");
		Cart cart1 = new Cart();
		cart1.setUsersid(userid);
		ListcartList = this.cartService.getCartByCond(cart1);
		if (cartList.size() == 0) {
			this.getRequest().setAttribute("message", "请选购场地");
			return "redirect:/index/cart.action";
		} else {
			// 获取一个1200-9999的随机数 防止同时提交
			String ordercode = "PD" + VeDate.getStringDatex();
			double total = 0;
			for (Cart cart : cartList) {
				Details details = new Details();
				details.setDetailsid(VeDate.getStringDatex() + (Math.random() * 9 + 1) * 1200);
				details.setJiancaiid(cart.getJiancaiid());
				details.setNum(cart.getNum());
				details.setOrdercode(ordercode);
				details.setPrice(cart.getPrice());
				details.setPeihuoid(this.getRequest().getParameter("peihuoid"));
				details.setCityid(this.getRequest().getParameter("cityid"));
				details.setViewdate(this.getRequest().getParameter("viewdate"));
				this.detailsService.insertDetails(details);
				Jiancai goods = this.jiancaiService.getJiancaiById(cart.getJiancaiid());
				goods.setSellnum("" + (Integer.parseInt(goods.getSellnum()) + Integer.parseInt(cart.getNum())));
				this.jiancaiService.updateJiancai(goods);
				total += Double.parseDouble(cart.getPrice()) * Double.parseDouble(cart.getNum());
				this.cartService.deleteCart(cart.getCartid());
			}
			Orders orders = new Orders();
			orders.setAddtime(VeDate.getStringDateShort());
			orders.setOrdercode(ordercode);
			orders.setStatus("未付款");
			orders.setTotal("" + total);
			orders.setUsersid(userid);
			this.ordersService.insertOrders(orders);
		}
		return "redirect:/index/showOrders.action";
	}

	// 查看订购
	@RequestMapping("showOrders.action")
	public String showOrders(String number) {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			return "redirect:/index/preLogin.action";
		}
		String userid = (String) this.getSession().getAttribute("userid");
		Orders orders = new Orders();
		orders.setUsersid(userid);
		ListordersList = new ArrayList();
		ListtempList = this.ordersService.getOrdersByCond(orders);
		int pageNumber = tempList.size();
		int maxPage = pageNumber;
		if (maxPage % 12 == 0) {
			maxPage = maxPage / 12;
		} else {
			maxPage = maxPage / 12 + 1;
		}
		if (number == null) {
			number = "0";
		}
		int start = Integer.parseInt(number) * 12;
		int over = (Integer.parseInt(number) + 1) * 12;
		int count = pageNumber - over;
		if (count<= 0) {
			over = pageNumber;
		}
		for (int i = start; i< over; i++) {
			Orders o = tempList.get(i);
			ordersList.add(o);
		}
		String html = "";
		StringBuffer buffer = new StringBuffer();
		buffer.append("  共为");
		buffer.append(maxPage);
		buffer.append("页  共有");
		buffer.append(pageNumber);
		buffer.append("条  当前为第");
		buffer.append((Integer.parseInt(number) + 1));
		buffer.append("页  ");
		if ((Integer.parseInt(number) + 1) == 1) {
			buffer.append("首页");
		} else {
			buffer.append("首页");
		}
		buffer.append("  ");
		if ((Integer.parseInt(number) + 1) == 1) {
			buffer.append("上一页");
		} else {
			buffer.append("上一页");
		}
		buffer.append("  ");
		if (maxPage<= (Integer.parseInt(number) + 1)) {
			buffer.append("下一页");
		} else {
			buffer.append("下一页");
		}
		buffer.append("  ");
		if (maxPage<= (Integer.parseInt(number) + 1)) {
			buffer.append("尾页");
		} else {
			buffer.append("尾页");
		}
		html = buffer.toString();
		this.getRequest().setAttribute("html", html);
		this.getRequest().setAttribute("ordersList", ordersList);
		return "users/orderlist";
	}

	// 准备付款
	@RequestMapping("prePay.action")
	public String prePay(String id) {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			return "redirect:/index/preLogin.action";
		}
		this.getRequest().setAttribute("id", id);
		return "users/pay";
	}

	// 付款
	@RequestMapping("pay.action")
	public String pay(String id) {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			return "redirect:/index/preLogin.action";
		}
		Orders orders = this.ordersService.getOrdersById(this.getRequest().getParameter("id"));
		orders.setStatus("已付款");
		this.ordersService.updateOrders(orders);
		return "redirect:/index/showOrders.action";
	}

	// 确认收货
	@RequestMapping("over.action")
	public String over(String id) {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			return "redirect:/index/preLogin.action";
		}
		Orders orders = this.ordersService.getOrdersById(this.getRequest().getParameter("id"));
		orders.setStatus("已收货");
		this.ordersService.updateOrders(orders);
		return "redirect:/index/showOrders.action";
	}

	// 取消订单
	@RequestMapping("cancel.action")
	public String cancel(String id) {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			return "redirect:/index/preLogin.action";
		}
		Orders orders = this.ordersService.getOrdersById(this.getRequest().getParameter("id"));
		orders.setStatus("已取消");
		this.ordersService.updateOrders(orders);
		return "redirect:/index/showOrders.action";
	}

	// 订单明细
	@RequestMapping("orderdetail.action")
	public String orderdetail(String id) {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			return "redirect:/index/preLogin.action";
		}
		Details details = new Details();
		details.setOrdercode(id);
		List
detailsList = this.detailsService.getDetailsByCond(details); this.getRequest().setAttribute("detailsList", detailsList); return "users/orderdetail"; } // 按分类查询 @RequestMapping("cate.action") public String cate(String id, String number) { this.front(); Jiancai goods = new Jiancai(); goods.setCateid(id); ListflimList = new ArrayList(); ListtempList = this.jiancaiService.getJiancaiByCond(goods); int pageNumber = tempList.size(); int maxPage = pageNumber; if (maxPage % 12 == 0) { maxPage = maxPage / 12; } else { maxPage = maxPage / 12 + 1; } if (number == null) { number = "0"; } int start = Integer.parseInt(number) * 12; int over = (Integer.parseInt(number) + 1) * 12; int count = pageNumber - over; if (count<= 0) { over = pageNumber; } for (int i = start; i< over; i++) { Jiancai x = tempList.get(i); flimList.add(x); } String html = ""; StringBuffer buffer = new StringBuffer(); buffer.append("  共为"); buffer.append(maxPage); buffer.append("页  共有"); buffer.append(pageNumber); buffer.append("条  当前为第"); buffer.append((Integer.parseInt(number) + 1)); buffer.append("页  "); if ((Integer.parseInt(number) + 1) == 1) { buffer.append("首页"); } else { buffer.append("首页"); } buffer.append("  "); if ((Integer.parseInt(number) + 1) == 1) { buffer.append("上一页"); } else { buffer.append("上一页"); } buffer.append("  "); if (maxPage<= (Integer.parseInt(number) + 1)) { buffer.append("下一页"); } else { buffer.append("下一页"); } buffer.append("  "); if (maxPage<= (Integer.parseInt(number) + 1)) { buffer.append("尾页"); } else { buffer.append("尾页"); } html = buffer.toString(); this.getRequest().setAttribute("html", html); this.getRequest().setAttribute("flimList", flimList); return "users/list"; } // 推荐产品 @RequestMapping("recommend.action") public String recommend(String number) { this.front(); Jiancai goods = new Jiancai(); goods.setRecommend("是"); ListflimList = new ArrayList(); ListtempList = this.jiancaiService.getJiancaiByCond(goods); int pageNumber = tempList.size(); int maxPage = pageNumber; if (maxPage % 12 == 0) { maxPage = maxPage / 12; } else { maxPage = maxPage / 12 + 1; } if (number == null) { number = "0"; } int start = Integer.parseInt(number) * 12; int over = (Integer.parseInt(number) + 1) * 12; int count = pageNumber - over; if (count<= 0) { over = pageNumber; } for (int i = start; i< over; i++) { Jiancai x = tempList.get(i); flimList.add(x); } String html = ""; StringBuffer buffer = new StringBuffer(); buffer.append("  共为"); buffer.append(maxPage); buffer.append("页  共有"); buffer.append(pageNumber); buffer.append("条  当前为第"); buffer.append((Integer.parseInt(number) + 1)); buffer.append("页  "); if ((Integer.parseInt(number) + 1) == 1) { buffer.append("首页"); } else { buffer.append("首页"); } buffer.append("  "); if ((Integer.parseInt(number) + 1) == 1) { buffer.append("上一页"); } else { buffer.append("上一页"); } buffer.append("  "); if (maxPage<= (Integer.parseInt(number) + 1)) { buffer.append("下一页"); } else { buffer.append("下一页"); } buffer.append("  "); if (maxPage<= (Integer.parseInt(number) + 1)) { buffer.append("尾页"); } else { buffer.append("尾页"); } html = buffer.toString(); this.getRequest().setAttribute("html", html); this.getRequest().setAttribute("flimList", flimList); return "users/list"; } // 推荐产品 @RequestMapping("hot.action") public String getHost(String number) { this.front(); Jiancai goods = new Jiancai(); goods.setRecommend("是"); ListflimList = new ArrayList(); ListtempList = this.jiancaiService.getJiancaiByHot(); int pageNumber = tempList.size(); int maxPage = pageNumber; if (maxPage % 12 == 0) { maxPage = maxPage / 12; } else { maxPage = maxPage / 12 + 1; } if (number == null) { number = "0"; } int start = Integer.parseInt(number) * 12; int over = (Integer.parseInt(number) + 1) * 12; int count = pageNumber - over; if (count<= 0) { over = pageNumber; } for (int i = start; i< over; i++) { Jiancai x = tempList.get(i); flimList.add(x); } String html = ""; StringBuffer buffer = new StringBuffer(); buffer.append("  共为"); buffer.append(maxPage); buffer.append("页  共有"); buffer.append(pageNumber); buffer.append("条  当前为第"); buffer.append((Integer.parseInt(number) + 1)); buffer.append("页  "); if ((Integer.parseInt(number) + 1) == 1) { buffer.append("首页"); } else { buffer.append("首页"); } buffer.append("  "); if ((Integer.parseInt(number) + 1) == 1) { buffer.append("上一页"); } else { buffer.append("上一页"); } buffer.append("  "); if (maxPage<= (Integer.parseInt(number) + 1)) { buffer.append("下一页"); } else { buffer.append("下一页"); } buffer.append("  "); if (maxPage<= (Integer.parseInt(number) + 1)) { buffer.append("尾页"); } else { buffer.append("尾页"); } html = buffer.toString(); this.getRequest().setAttribute("html", html); this.getRequest().setAttribute("flimList", flimList); return "users/list"; } // 全部产品 @RequestMapping("all.action") public String all(String number) { this.front(); ListflimList = new ArrayList(); ListtempList = this.jiancaiService.getAllJiancai(); int pageNumber = tempList.size(); int maxPage = pageNumber; if (maxPage % 12 == 0) { maxPage = maxPage / 12; } else { maxPage = maxPage / 12 + 1; } if (number == null) { number = "0"; } int start = Integer.parseInt(number) * 12; int over = (Integer.parseInt(number) + 1) * 12; int count = pageNumber - over; if (count<= 0) { over = pageNumber; } for (int i = start; i< over; i++) { Jiancai x = tempList.get(i); flimList.add(x); } String html = ""; StringBuffer buffer = new StringBuffer(); buffer.append("  共为"); buffer.append(maxPage); buffer.append("页  共有"); buffer.append(pageNumber); buffer.append("条  当前为第"); buffer.append((Integer.parseInt(number) + 1)); buffer.append("页  "); if ((Integer.parseInt(number) + 1) == 1) { buffer.append("首页"); } else { buffer.append("首页"); } buffer.append("  "); if ((Integer.parseInt(number) + 1) == 1) { buffer.append("上一页"); } else { buffer.append("上一页"); } buffer.append("  "); if (maxPage<= (Integer.parseInt(number) + 1)) { buffer.append("下一页"); } else { buffer.append("下一页"); } buffer.append("  "); if (maxPage<= (Integer.parseInt(number) + 1)) { buffer.append("尾页"); } else { buffer.append("尾页"); } html = buffer.toString(); this.getRequest().setAttribute("html", html); this.getRequest().setAttribute("flimList", flimList); return "users/list"; } // 查询场地 @RequestMapping("query.action") public String query(String name) { this.front(); Jiancai goods = new Jiancai(); goods.setJiancainame(name); ListflimList = this.jiancaiService.getJiancaiByLike(goods); this.getRequest().setAttribute("flimList", flimList); return "users/list"; } // 场地详情 @RequestMapping("detail.action") public String detail(String id) { this.front(); Jiancai goods = this.jiancaiService.getJiancaiById(id); goods.setHits("" + (Integer.parseInt(goods.getHits()) + 1)); this.jiancaiService.updateJiancai(goods); this.getRequest().setAttribute("goods", goods); if (this.getSession().getAttribute("userid") == null) { return "redirect:/index/preLogin.action"; } String userid = (String) this.getSession().getAttribute("userid"); Topic topic = new Topic(); topic.setJiancaiid(id); ListtopicList = this.topicService.getTopicByCond(topic); this.getRequest().setAttribute("topicList", topicList); this.getRequest().setAttribute("tnum", topicList.size()); return "users/detail"; } @RequestMapping("addTopic.action") public String addTopic(Topic topic) { this.front(); if (this.getSession().getAttribute("userid") == null) { return "redirect:/index/preLogin.action"; } String userid = (String) this.getSession().getAttribute("userid"); topic.setAddtime(VeDate.getStringDateShort()); topic.setContents(this.getRequest().getParameter("contents")); topic.setJiancaiid(this.getRequest().getParameter("goodsid")); topic.setNum(this.getRequest().getParameter("num")); topic.setUsersid(userid); this.topicService.insertTopic(topic); return "redirect:/index/detail.action?id=" + topic.getJiancaiid(); } }

如果也想学习本系统,下面领取。关注并回复:089ssm  

你是否还在寻找稳定的海外服务器提供商?创新互联www.cdcxhl.cn海外机房具备T级流量清洗系统配攻击溯源,准确流量调度确保服务器高可用性,企业级服务器适合批量采购,新人活动首月15元起,快前往官网查看详情吧


当前名称:Java项目:SSM场地预订管理系统-创新互联
网页URL:http://cqcxhl.cn/article/dogpdd.html

其他资讯

在线咨询
服务热线
服务热线:028-86922220
TOP