Design of supermarket canteen management system based on JAVA SSM framework and JSP

Summary

        With the development of the times, the traditional supermarket shopping method can no longer meet people's needs. For customers, the problems of queuing up for shopping and paying shopping fees need to be solved urgently. For physical supermarkets, they are facing competitive pressure from online shopping. As supermarket managers, they want to reduce costs, save manpower, and facilitate customers' shopping and calculations. Therefore, the design and development of an online supermarket system is proposed. This article analyzes the current charging model of supermarkets, and proposes the design and development of an online supermarket unmanned vending system. Customers use the website system to pay, changing the original charging method, realizing self-service purchasing, timely payment, and real-time query. Not only can it save supermarket manpower, but it can also save customers time waiting for settlement. With the development and popularization of network technology, people's lives have changed rapidly. Especially with the application of computers in various fields of economy and society, in order to make consumers' online shopping process simple, convenient, safe and fast, online shopping has become a new popular shopping method.

Implemented functions

This system is divided into four roles: general user, administrator, salesperson, and buyer.

Functions should include: user login and registration, user management, category management, product management, order management, data statistics and other functions. Among them, ordinary users can register and log in, browse by category, place an order to buy, manage personal information and other functions.

Registration and login: Unregistered users can register, and after having an account, they can log in to the website;

User management: including managing system users and registered users, adding, deleting, modifying, and checking;

Category management: Realize the management of product categories, and you can query, add, modify, and delete categories;

Commodity management: realize the management of commodities, and can query, add, modify and delete commodities;

Order management: manage the user's order for purchasing goods;

Data statistics: Realize data statistics on the sales of commodities, all of which are analyzed with graphics.

Technology used

Backend: JAVA development language, SSM framework, MySql database

Front-end: jsp page, bootstrap framework

Partial code display

/**
 * 购物车
 */
@Controller
@RequestMapping("/car")
public class CarController {

    @Autowired
    private CarService carService;

    @Autowired
    private ItemService itemService;

    @RequestMapping("/exAdd")
    @ResponseBody
    public String exAdd(Car car, HttpServletRequest request){
        JSONObject js = new JSONObject();
        Object attribute = request.getSession().getAttribute(Consts.USERID);
        if(attribute==null){
            js.put(Consts.RES,0);
            return js.toJSONString();
        }
        //保存到购物车
        Integer userId = Integer.valueOf(attribute.toString());
        car.setUserId(userId);
        Item item = itemService.load(car.getItemId());
        String price = item.getPrice();
        Double valueOf = Double.valueOf(price);
        car.setPrice(valueOf);
        if(item.getZk()!=null){
            valueOf = valueOf*item.getZk()/10;
            BigDecimal bg = new BigDecimal(valueOf).setScale(2, RoundingMode.UP);
            car.setPrice(bg.doubleValue());
            valueOf = bg.doubleValue();
        }
        Integer num = car.getNum();
        Double t = valueOf*num;

        BigDecimal bg = new BigDecimal(t).setScale(2, RoundingMode.UP);
        double doubleValue = bg.doubleValue();
        car.setTotal(doubleValue+"");
        carService.insert(car);
        js.put(Consts.RES,1);
        return js.toJSONString();
    }

    /**
     * 转向我的购物车页面
     */
    @RequestMapping("/findBySql")
    public String findBySql(Model model,HttpServletRequest request){
        Object attribute = request.getSession().getAttribute(Consts.USERID);
        if(attribute==null){
            return "redirect:/login/toLogin";
        }
        Integer userId = Integer.valueOf(attribute.toString());
        String sql = "select * from car where user_id="+userId+" order by id desc";
        List<Car> list = carService.listBySqlReturnEntity(sql);
        model.addAttribute("list",list);
        return "car/car";
    }

    /**
     * 删除购物车
     */
    @RequestMapping("/delete")
    @ResponseBody
    public String delete(Integer id){
        carService.deleteById(id);
        return "success";
    }
}

 Demo video

Design of Supermarket Management System Based on JAVA SSM Framework and JSP

Guess you like

Origin blog.csdn.net/qq_28245905/article/details/132753526