基于javaweb+mysql的ssm+maven网吧计费管理系统(java+ssm+js+jsp+mysql)
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的SSM+Maven网吧计费管理系统(java+ssm+js+jsp+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. 前端:HTML+CSS+JavaScript+jsp
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中application.yml配置文件中的数据库配置改为自己的配置; 4. 运行项目,输入localhost:8080/ 登录
@Controller
public class turnover {
@Resource
private turnoverService turn;
// 获取信息总数量
@RequestMapping(value = "/getTPageCount", method = RequestMethod.POST)
@ResponseBody
public String getPageCount(@RequestParam int pageSize) throws Exception {
Map map = new HashMap();
map.put("count", turn.getPageCount());
return JSON.toJSONString(map);
}
// 查询营业额信息,分页显示
@RequestMapping(value = "/chaYingServlet", method = RequestMethod.POST)
@ResponseBody
public String chaYingServlet(@RequestParam int pageNo, @RequestParam int pageSize) throws Exception {
pageModel pm = new pageModel();
pm.setPageNo((pageNo-1)*pageSize);
pm.setPageSize(pageSize);
List list = new ArrayList();
list = turn.chaYingServlet(pm);
return JSON.toJSONString(list);
}
// 结账打烊信息查询
@RequestMapping(value = "/dayangServlet", method = RequestMethod.POST)
@ResponseBody
public String daYang() throws Exception {
Map map = turn.daYang();
String json=JSON.toJSONString(map);
return json;
}
}
// 对机位状态初始化
ballinfo ball = new ballinfo();
ball.setTableid(taihao);
t.doCloseTable(ball);
Map map = new HashMap();
map.put("rs", "yeah");
return JSON.toJSONString(map);
}
// 现金结账后操作
@RequestMapping(value = "/xianjin", method = RequestMethod.POST)
@ResponseBody
public String xianJin(@RequestParam double zongji, @RequestParam int taihao, HttpServletRequest req)
throws Exception {
// 消费信息计入营业额
String man = (String) req.getSession().getAttribute("info");
turnover tur = new turnover();
tur.setTaihao(taihao);
tur.setPrice(zongji);
tur.setMan(man);
turn.shuaka(tur);
// 清除该机位的烟饮料消费记录
salwater s = new salwater();
s.setTaihao(taihao);
sal.deleteInfo(s);
// 对机位状态初始化
ballinfo ball = new ballinfo();
ball.setTableid(taihao);
int a = t.doCloseTable(ball);
Map map = new HashMap();
map.put("fan", a);
return JSON.toJSONString(map);
}
}
@RequestMapping(value = "/shukaServlet", method = RequestMethod.POST)
@ResponseBody
public String getMemInfo(@RequestParam int kahao) throws Exception {
Member member = new Member();
member.setMemid(kahao);
Member m = new Member();
m = mem.getMemberInfo(member);
if (m != null) {
return JSON.toJSONString(m);
} else {
Map map = new HashMap();
map.put("mname", "wu");
return JSON.toJSONString(map);
}
}
// 获取信息总数量
@RequestMapping(value = "/getPageCount", method = RequestMethod.POST)
@ResponseBody
public String getPageCount(@RequestParam int pageSize) throws Exception {
Map map = new HashMap();
map.put("count",mem.getPageCount());
return JSON.toJSONString(map);
}
// 查询会员信息
@RequestMapping(value = "/chaVIPServlet", method = RequestMethod.POST)
@ResponseBody
public String chaVIPServlet(@RequestParam int pageNo, @RequestParam int pageSize) throws Exception {
pageModel pm = new pageModel();
pm.setPageNo((pageNo-1)*pageSize);
pm.setPageSize(pageSize);
return JSON.toJSONString(mem.chaVIPServlet(pm));
}
// 会员充值
@RequestMapping(value = "/chongServlet", method = RequestMethod.POST)
@ResponseBody
public String chongServlet(@RequestParam int kahao, @RequestParam double jine,HttpServletRequest req) throws Exception {
Member me = new Member();
me.setMemid(kahao);
me.setYue(jine);
mem.chongZhi(me);
String name=(String)req.getSession().getAttribute("info");
turnover t=new turnover();
t.setLaiyuan("会员充值");
t.setMan(name);
// 刷卡结账后操作
@RequestMapping(value = "/afterJieServlet", method = RequestMethod.POST)
@ResponseBody
public String shuaka(@RequestParam int kahao, @RequestParam double zongji, @RequestParam int taihao,
HttpServletRequest req) throws Exception {
// 消费信息计入营业额
String man = (String) req.getSession().getAttribute("info");
turnover tur = new turnover();
tur.setTaihao(taihao);
tur.setPrice(zongji);
tur.setMan(man);
turn.shuaka(tur);
// 对会员卡内余额扣除操作
Member mem = new Member();
mem.setMemid(kahao);
mem.setYue(zongji);
mm.updateYue(mem);
// 清除该机位的烟饮料消费记录
salwater s = new salwater();
s.setTaihao(taihao);
sal.deleteInfo(s);
// 对机位状态初始化
ballinfo ball = new ballinfo();
ball.setTableid(taihao);
t.doCloseTable(ball);
Map map = new HashMap();
map.put("rs", "yeah");
return JSON.toJSONString(map);
}
// 现金结账后操作
@RequestMapping(value = "/xianjin", method = RequestMethod.POST)
@ResponseBody
public String xianJin(@RequestParam double zongji, @RequestParam int taihao, HttpServletRequest req)
throws Exception {
// 消费信息计入营业额
String man = (String) req.getSession().getAttribute("info");
turnover tur = new turnover();
tur.setTaihao(taihao);
tur.setPrice(zongji);
tur.setMan(man);
turn.shuaka(tur);
// 清除该机位的烟饮料消费记录
salwater s = new salwater();
s.setTaihao(taihao);
public class account {
@Resource
private service ser;
// 验证登录账号和密码
@RequestMapping(value = "/loginServlet", method = RequestMethod.POST)
@ResponseBody
public String doLogin(@RequestParam String name, @RequestParam String pwd, HttpServletRequest request,
HttpSession session) throws Exception {
Manager manager = new Manager();
manager.setAccount(name);
manager.setPassword(md5test.getMD5(pwd));
Manager man = ser.getNamePwd(manager);
Map map = new HashMap();
if (man != null) {
// 查询结果存在,则跳转回本页面
session.setAttribute("info", man.getAccount());
map.put("result", "you");
return JSON.toJSONString(map);
} else {
// 页面跳转(index.jsp)带出提示信息--转发
map.put("result", "wu");
return JSON.toJSONString(map);
}
}
// 验证用户名是否可用
@RequestMapping(value = "/zhuServlet", method = RequestMethod.POST)
@ResponseBody
public String doName(@RequestParam String name) throws Exception {
Manager manager = new Manager();
manager.setAccount(name);
Manager man = ser.selectName(manager);
Map map = new HashMap();
if (man != null) {
map.put("result", "you");
} else {
map.put("result", "wu");
}
return JSON.toJSONString(map);
}
} else {
// 页面跳转(index.jsp)带出提示信息--转发
map.put("result", "wu");
return JSON.toJSONString(map);
}
}
// 验证用户名是否可用
@RequestMapping(value = "/zhuServlet", method = RequestMethod.POST)
@ResponseBody
public String doName(@RequestParam String name) throws Exception {
Manager manager = new Manager();
manager.setAccount(name);
Manager man = ser.selectName(manager);
Map map = new HashMap();
if (man != null) {
map.put("result", "you");
} else {
map.put("result", "wu");
}
return JSON.toJSONString(map);
}
// 注册用户
@RequestMapping(value = "/updateServlet", method = RequestMethod.POST)
public String doRegister(@RequestParam String name, @RequestParam String pwd, @RequestParam String quanXian)
throws Exception {
if (quanXian == null || !quanXian.equals("mana")) {
quanXian = "Service";
} else {
quanXian = "Manager";
}
Manager manager = new Manager();
manager.setAccount(name);
manager.setPassword(md5test.getMD5(pwd));
manager.setRank(quanXian);
try {
int a = ser.doRegister(manager);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
turn.shuaka(tur);
// 对会员卡内余额扣除操作
Member mem = new Member();
mem.setMemid(kahao);
mem.setYue(zongji);
mm.updateYue(mem);
// 清除该机位的烟饮料消费记录
salwater s = new salwater();
s.setTaihao(taihao);
sal.deleteInfo(s);
// 对机位状态初始化
ballinfo ball = new ballinfo();
ball.setTableid(taihao);
t.doCloseTable(ball);
Map map = new HashMap();
map.put("rs", "yeah");
return JSON.toJSONString(map);
}
// 现金结账后操作
@RequestMapping(value = "/xianjin", method = RequestMethod.POST)
@ResponseBody
public String xianJin(@RequestParam double zongji, @RequestParam int taihao, HttpServletRequest req)
throws Exception {
// 消费信息计入营业额
String man = (String) req.getSession().getAttribute("info");
turnover tur = new turnover();
tur.setTaihao(taihao);
tur.setPrice(zongji);
tur.setMan(man);
turn.shuaka(tur);
// 清除该机位的烟饮料消费记录
salwater s = new salwater();
s.setTaihao(taihao);
sal.deleteInfo(s);
// 对机位状态初始化
ballinfo ball = new ballinfo();
ball.setTableid(taihao);
int a = t.doCloseTable(ball);
Map map = new HashMap();
map.put("fan", a);
return JSON.toJSONString(map);
}
}
// 结账数据查询
@RequestMapping(value = "/jieZhangServlet", method = RequestMethod.POST)
@ResponseBody
public String tableInfo(@RequestParam int taihao) throws Exception {
List list = t.tableInfo(taihao);
Map map = new HashMap();
map.put("openTime", list.get(0));
map.put("usedTime", list.get(1));
map.put("taifei", list.get(2));
map.put("water", list.get(3));
map.put("zongJi", list.get(4));
return JSON.toJSONString(map);
}
// 刷卡结账后操作
@RequestMapping(value = "/afterJieServlet", method = RequestMethod.POST)
@ResponseBody
public String shuaka(@RequestParam int kahao, @RequestParam double zongji, @RequestParam int taihao,
HttpServletRequest req) throws Exception {
// 消费信息计入营业额
String man = (String) req.getSession().getAttribute("info");
turnover tur = new turnover();
tur.setTaihao(taihao);
tur.setPrice(zongji);
tur.setMan(man);
turn.shuaka(tur);
// 对会员卡内余额扣除操作
Member mem = new Member();
mem.setMemid(kahao);
mem.setYue(zongji);
mm.updateYue(mem);
// 清除该机位的烟饮料消费记录
salwater s = new salwater();
s.setTaihao(taihao);
sal.deleteInfo(s);
// 对机位状态初始化
ballinfo ball = new ballinfo();
ball.setTableid(taihao);
t.doCloseTable(ball);
Map map = new HashMap();
map.put("rs", "yeah");
return JSON.toJSONString(map);
}
}
// 现金结账后操作
@RequestMapping(value = "/xianjin", method = RequestMethod.POST)
@ResponseBody
public String xianJin(@RequestParam double zongji, @RequestParam int taihao, HttpServletRequest req)
throws Exception {
// 消费信息计入营业额
String man = (String) req.getSession().getAttribute("info");
turnover tur = new turnover();
tur.setTaihao(taihao);
tur.setPrice(zongji);
tur.setMan(man);
turn.shuaka(tur);
// 清除该机位的烟饮料消费记录
salwater s = new salwater();
s.setTaihao(taihao);
sal.deleteInfo(s);
// 对机位状态初始化
ballinfo ball = new ballinfo();
ball.setTableid(taihao);
int a = t.doCloseTable(ball);
Map map = new HashMap();
map.put("fan", a);
return JSON.toJSONString(map);
}
}
@Controller
public class member {
@Resource
// 注销登录
@RequestMapping(value = "/guanbiServlet", method = RequestMethod.POST)
public String guanBi(@RequestParam String dayang, HttpServletRequest req, HttpServletResponse resp)
throws Exception {
req.getSession().removeAttribute("info");
String path = req.getContextPath();
String basePath = req.getScheme() + "://" + req.getServerName() + ":" + req.getServerPort() + path + "/";
if (dayang.equals("tui")) {
resp.sendRedirect(basePath + "index.jsp");
}
return null;
}
// 退出登录
@RequestMapping(value = "/tuichuServlet", method = RequestMethod.GET)
public String tuichu(HttpServletRequest req) throws Exception {
req.getSession().removeAttribute("info");
return "index";
}
}
@Controller
public class turnover {
@Resource
private turnoverService turn;
// 获取信息总数量
@RequestMapping(value = "/getTPageCount", method = RequestMethod.POST)
@ResponseBody
public String getPageCount(@RequestParam int pageSize) throws Exception {
map.put("yi", arr[0]);
map.put("er", arr[1]);
map.put("san", arr[2]);
map.put("si", arr[3]);
map.put("wu", arr[4]);
String json = JSON.toJSONString(map);
return json;
}
// 开机操作
@RequestMapping(value = "/open", method = RequestMethod.POST)
@ResponseBody
public String openTable(@RequestParam int taihao) throws Exception {
ballinfo ball = new ballinfo();
ball.setTableid(taihao);
int count = t.doOpen(ball);
Map map = new HashMap();
map.put("xin", count);
return JSON.toJSONString(map);
}
// 结账数据查询
@RequestMapping(value = "/jieZhangServlet", method = RequestMethod.POST)
@ResponseBody
public String tableInfo(@RequestParam int taihao) throws Exception {
List list = t.tableInfo(taihao);
Map map = new HashMap();
map.put("openTime", list.get(0));
map.put("usedTime", list.get(1));
map.put("taifei", list.get(2));
map.put("water", list.get(3));
map.put("zongJi", list.get(4));
return JSON.toJSONString(map);
}
// 刷卡结账后操作
@RequestMapping(value = "/afterJieServlet", method = RequestMethod.POST)
@ResponseBody
public String shuaka(@RequestParam int kahao, @RequestParam double zongji, @RequestParam int taihao,
HttpServletRequest req) throws Exception {
// 消费信息计入营业额
String man = (String) req.getSession().getAttribute("info");
turnover tur = new turnover();
tur.setTaihao(taihao);
tur.setPrice(zongji);
tur.setMan(man);
turn.shuaka(tur);
// 对会员卡内余额扣除操作
Member mem = new Member();
mem.setMemid(kahao);
mem.setYue(zongji);
public class member {
@Resource
private memberService mem;
@Resource
private turnoverService turn;
// 查询卡号是否存在,存在则返回相应的会员信息
@RequestMapping(value = "/shukaServlet", method = RequestMethod.POST)
@ResponseBody
public String getMemInfo(@RequestParam int kahao) throws Exception {
Member member = new Member();
member.setMemid(kahao);
Member m = new Member();
m = mem.getMemberInfo(member);
if (m != null) {
return JSON.toJSONString(m);
} else {
Map map = new HashMap();
map.put("mname", "wu");
return JSON.toJSONString(map);
}
}
// 获取信息总数量
@RequestMapping(value = "/getPageCount", method = RequestMethod.POST)
@ResponseBody
public String getPageCount(@RequestParam int pageSize) throws Exception {
Map map = new HashMap();
map.put("count",mem.getPageCount());
return JSON.toJSONString(map);
}
// 查询会员信息
@RequestMapping(value = "/chaVIPServlet", method = RequestMethod.POST)
@ResponseBody
public String chaVIPServlet(@RequestParam int pageNo, @RequestParam int pageSize) throws Exception {
pageModel pm = new pageModel();
pm.setPageNo((pageNo-1)*pageSize);
pm.setPageSize(pageSize);
return JSON.toJSONString(mem.chaVIPServlet(pm));
}
// 会员充值
@RequestMapping(value = "/chongServlet", method = RequestMethod.POST)
@ResponseBody
public String chongServlet(@RequestParam int kahao, @RequestParam double jine,HttpServletRequest req) throws Exception {
Member me = new Member();
me.setMemid(kahao);
me.setYue(jine);
mem.chongZhi(me);
String name=(String)req.getSession().getAttribute("info");
turnover t=new turnover();
@Controller
public class table {
@Resource
private tableService t;
@Resource
private turnoverService turn;
@Resource
private salwaterService sal;
@Resource
private memberService mm;
// 初始化机位计费信息
@RequestMapping(value = "/initServlet", method = RequestMethod.POST)
@ResponseBody
public String doInit() throws Exception {
int[] list = { 1, 2, 3, 4, 5 };
String[] arr = t.getInit(list);
Map map = new HashMap();
map.put("yi", arr[0]);
map.put("er", arr[1]);
map.put("san", arr[2]);
map.put("si", arr[3]);
map.put("wu", arr[4]);
String json = JSON.toJSONString(map);
return json;
}
// 开机操作
@RequestMapping(value = "/open", method = RequestMethod.POST)
@ResponseBody
public String openTable(@RequestParam int taihao) throws Exception {
ballinfo ball = new ballinfo();
ball.setTableid(taihao);
int count = t.doOpen(ball);
Map map = new HashMap();
map.put("xin", count);
return JSON.toJSONString(map);
}
// 结账数据查询
@RequestMapping(value = "/jieZhangServlet", method = RequestMethod.POST)
@ResponseBody
public String tableInfo(@RequestParam int taihao) throws Exception {
List list = t.tableInfo(taihao);
Map map = new HashMap();
map.put("openTime", list.get(0));
turnover tur = new turnover();
tur.setTaihao(taihao);
tur.setPrice(zongji);
tur.setMan(man);
turn.shuaka(tur);
// 对会员卡内余额扣除操作
Member mem = new Member();
mem.setMemid(kahao);
mem.setYue(zongji);
mm.updateYue(mem);
// 清除该机位的烟饮料消费记录
salwater s = new salwater();
s.setTaihao(taihao);
sal.deleteInfo(s);
// 对机位状态初始化
ballinfo ball = new ballinfo();
ball.setTableid(taihao);
t.doCloseTable(ball);
Map map = new HashMap();
map.put("rs", "yeah");
return JSON.toJSONString(map);
}
// 现金结账后操作
@RequestMapping(value = "/xianjin", method = RequestMethod.POST)
@ResponseBody
public String xianJin(@RequestParam double zongji, @RequestParam int taihao, HttpServletRequest req)
throws Exception {
// 消费信息计入营业额
String man = (String) req.getSession().getAttribute("info");
turnover tur = new turnover();
tur.setTaihao(taihao);
tur.setPrice(zongji);
tur.setMan(man);
turn.shuaka(tur);
// 清除该机位的烟饮料消费记录
salwater s = new salwater();
s.setTaihao(taihao);
sal.deleteInfo(s);
// 对机位状态初始化
ballinfo ball = new ballinfo();
ball.setTableid(taihao);
int a = t.doCloseTable(ball);
Map map = new HashMap();
String path = req.getContextPath();
String basePath = req.getScheme() + "://" + req.getServerName() + ":" + req.getServerPort() + path + "/";
if (dayang.equals("tui")) {
resp.sendRedirect(basePath + "index.jsp");
}
return null;
}
// 退出登录
@RequestMapping(value = "/tuichuServlet", method = RequestMethod.GET)
public String tuichu(HttpServletRequest req) throws Exception {
req.getSession().removeAttribute("info");
return "index";
}
}
@Controller
public class turnover {
@Resource
private turnoverService turn;
// 获取信息总数量
@RequestMapping(value = "/getTPageCount", method = RequestMethod.POST)
map.put("taifei", list.get(2));
map.put("water", list.get(3));
map.put("zongJi", list.get(4));
return JSON.toJSONString(map);
}
// 刷卡结账后操作
@RequestMapping(value = "/afterJieServlet", method = RequestMethod.POST)
@ResponseBody
public String shuaka(@RequestParam int kahao, @RequestParam double zongji, @RequestParam int taihao,
HttpServletRequest req) throws Exception {
// 消费信息计入营业额
String man = (String) req.getSession().getAttribute("info");
turnover tur = new turnover();
tur.setTaihao(taihao);
tur.setPrice(zongji);
tur.setMan(man);
turn.shuaka(tur);
// 对会员卡内余额扣除操作
Member mem = new Member();
mem.setMemid(kahao);
mem.setYue(zongji);
mm.updateYue(mem);
// 清除该机位的烟饮料消费记录
salwater s = new salwater();
s.setTaihao(taihao);
sal.deleteInfo(s);
// 对机位状态初始化
ballinfo ball = new ballinfo();
ball.setTableid(taihao);
t.doCloseTable(ball);
Map map = new HashMap();
map.put("rs", "yeah");
return JSON.toJSONString(map);
}
// 现金结账后操作
@RequestMapping(value = "/xianjin", method = RequestMethod.POST)
@ResponseBody
public String xianJin(@RequestParam double zongji, @RequestParam int taihao, HttpServletRequest req)
@Controller
public class table {
@Resource
private tableService t;
@Resource
private turnoverService turn;
@Resource
private salwaterService sal;
@Resource
private memberService mm;
// 初始化机位计费信息
@RequestMapping(value = "/initServlet", method = RequestMethod.POST)
@ResponseBody
public String doInit() throws Exception {
int[] list = { 1, 2, 3, 4, 5 };
String[] arr = t.getInit(list);
Map map = new HashMap();
map.put("yi", arr[0]);
map.put("er", arr[1]);
map.put("san", arr[2]);
// 退出登录
@RequestMapping(value = "/tuichuServlet", method = RequestMethod.GET)
public String tuichu(HttpServletRequest req) throws Exception {
req.getSession().removeAttribute("info");
return "index";
}
}
@Controller
public class turnover {
@Resource
private turnoverService turn;
// 获取信息总数量
@RequestMapping(value = "/getTPageCount", method = RequestMethod.POST)
@ResponseBody
public String getPageCount(@RequestParam int pageSize) throws Exception {
Map map = new HashMap();
map.put("count", turn.getPageCount());
return JSON.toJSONString(map);
}
// 查询营业额信息,分页显示
@RequestMapping(value = "/chaYingServlet", method = RequestMethod.POST)
@ResponseBody
public String chaYingServlet(@RequestParam int pageNo, @RequestParam int pageSize) throws Exception {
pageModel pm = new pageModel();
pm.setPageNo((pageNo-1)*pageSize);
pm.setPageSize(pageSize);
List list = new ArrayList();