——————————DescriptionStart——————————
运行环境 Java≥8、MySQL≥5.7、Tomcat≥8
开发工具 eclipse/idea/myeclipse/sts等均可配置运行
适用 课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb的SSM+Maven超市管理系统(java+ssm+jsp+layui+jq+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.是否Maven项目: 是; 6.数据库:MySql 5.7等版本均可;
技术栈
后端:Spring、Springmvc、Mybatis 2. 前端:JSP+css+javascript+jQuery+LayUI
使用说明
使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中applicationContext.xml配置文件中的数据库配置改为自己的配置; 4. 运行项目,在浏览器中输入http://localhost:8080/ 登录 管理员账号/密码:admin/admin 总经理账号/密码:hqh/123
——————————CodeStart——————————
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 Order order = orderService.getTodayMaxNumber(); if (order != null ) { String purchaseNumber = order.getCode(); code.append(DateUtil.formatCode(purchaseNumber)); } else { code.append("0001" ); } return code.toString(); } @ResponseBody @RequestMapping("/order") public Map<String, Object> goodsList (HttpServletResponse response, Order order, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "limit", required = false) Integer limit) throws Exception { Map<String, Object> result = ResponseUtil.resultFye(page, limit); if (order.getCode()!=null ){ result.put("code" ,order.getCode()); } List<Order> orderList = orderService.findAll(result); Long count = orderService.count(result); for (int i = 0 ; i < orderList.size(); i++) { String releaseStr = DateUtil.format(orderList.get(i).getCreatedate()); String releaseStrPay = DateUtil.format(orderList.get(i).getPaydate()); orderList.get(i).setReleaseStr(releaseStr); orderList.get(i).setReleaseStrPay(releaseStrPay); } return ResponseUtil.result(orderList, count); } @ResponseBody @RequestMapping("/orderSave") public Map<String, Object> save (Order order) throws Exception { Map<String, Object> result = new HashMap<String, Object>(); SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd" ); Date pay =sdf.parse(order.getReleaseStrPay()); order.setPaydate(pay); orderService.add(order); result.put("success" , true ); return result; } }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 @Resource private UserRoleService userRoleService;@ResponseBody @RequestMapping("/login") public Map<String, Object> login (String imageCode, HttpSession session, User user) throws Exception { Map<String, Object> map = new HashMap<String, Object>(); if (!session.getAttribute("checkcode" ).equals(imageCode)) { map.put("success" , false ); map.put("errorInfo" , "验证码输入错误!" ); return map; } Subject subect = SecurityUtils.getSubject(); UsernamePasswordToken token = new UsernamePasswordToken(user.getUserName(), user.getPassword()); try { subect.login(token); String userName = (String) SecurityUtils.getSubject().getPrincipal(); User currentUser = userService.findByUserName(userName); UserRole userRole = userRoleService.findAll(currentUser.getUserName()); List<Menu> menuList = menuService.menuList(userRole.getRoleId()); session.setAttribute("menuList" , menuList); session.setAttribute("currentUser" , currentUser); map.put("success" , true ); return map; } catch (Exception e) { e.printStackTrace(); map.put("success" , false ); map.put("errorInfo" , "用户名或者密码错误!" ); return map; } } @ResponseBody @RequestMapping("/userList") public Map<String, Object> userList (User user, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "limit", required = false) Integer limit) throws Exception {
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 } @ResponseBody @RequestMapping("/goodsUpdate") public Map<String, Object> goodsUpdate (@RequestParam(value = "id", required = false) Integer id) throws Exception { Map<String, Object> result = new HashMap<String, Object>(); Goods goods = new Goods(); goods.setState(2 ); goods.setId(id); goodsService.update(goods); result.put("success" , true ); return result; } @ResponseBody @RequestMapping("/updatenumber") public Map<String, Object> updatenumber (Goods goods) throws Exception { Map<String, Object> result = new HashMap<String, Object>(); Goods goodsNumber = goodsService.findById(goods.getId()); goods.setSalenumber(goods.getNumber()); Integer number = goodsNumber.getNumber()- goods.getNumber(); if (number>0 ){ goods.setNumber(number); }else { result.put("success" , false ); result.put("errorInfo" , "卖你妈逼,都没了,还卖" ); return result; } goodsService.update(goods); result.put("success" , true ); return result; } } package com.supermarket.controller;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 */ private void setBackGround (Graphics g) { g.setColor(new Color(22 , 160 , 133 )); g.fillRect(0 , 0 , WIDTH, HEIGHT); } private void setBorder (Graphics g) { g.setColor(new Color(22 , 160 , 133 )); g.drawRect(1 , 1 , WIDTH - 2 , HEIGHT - 2 ); } private void drawRandomLine (Graphics g) { g.setColor(Color.WHITE); for (int i = 0 ; i < 5 ; i++) { int x1 = new Random().nextInt(WIDTH); int y1 = new Random().nextInt(HEIGHT); int x2 = new Random().nextInt(WIDTH); int y2 = new Random().nextInt(HEIGHT); g.drawLine(x1, y1, x2, y2); } }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 result.put("supplierList" , supplierList); return result; } } package com.supermarket.controller;@RestController @RequestMapping("/orderList") public class OrderController { @Resource private OrderService orderService; @RequestMapping("/genCode") public String genCode () throws Exception { StringBuffer code = new StringBuffer("JH" ); code.append(DateUtil.getCurrentDateStr()); Order order = orderService.getTodayMaxNumber(); if (order != null ) { String purchaseNumber = order.getCode(); code.append(DateUtil.formatCode(purchaseNumber)); } else { code.append("0001" ); }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 return result; } @ResponseBody @RequestMapping("/delete") public Map<String, Object> delete (@RequestParam(value = "id", required = false) Integer id) throws Exception { Map<String, Object> result = new HashMap<String, Object>(); supplierService.delete(id); result.put("success" , true ); return result; } @ResponseBody @RequestMapping("/update") public Map<String, Object> update (Supplier supplier) throws Exception { Map<String, Object> result = new HashMap<String, Object>(); supplierService.update(supplier); result.put("success" , true ); return result; } @ResponseBody @RequestMapping("/supplierlist") public Map<String, Object> supplier () throws Exception { Map<String, Object> result = new HashMap<String, Object>(); List<Supplier> supplierList = supplierService.findAll(null ); result.put("success" , true ); result.put("supplierList" , supplierList); return result; } } package com.supermarket.controller;
——————————PayStart——————————
项目链接: https://javayms.github.io?id=141023501103200zt https://javayms.pages.dev?id=141023501103200zt