基于ssm+vue订餐点餐系统源码和论文

基于ssm+vue订餐点餐系统源码和论文157

 开发工具:idea 或eclipse
 数据库mysql5.7+
 数据库链接工具:navcat,小海豚等
  技术:ssm 

  • 选题依据、目的意义、主要参考文献
  1. 选题背景及依据

互联网使得我们的工作和生活发生了巨大的改变,全球经济一体化促进了管理信息化的发展,与此同时,管理信息化也促进了经济一体化的发展。早在20世纪80年代,美国就已经开始发展电子商务行业,良好的经济,完备的技术和稳定的社会条件,为管理信息化行业的发展提供了一种很好的发展氛围。1999年,为了每一个需要的用户都实现上网,欧盟委员会制定了电子欧洲计划。许多企业在其应用程序中加入了网上信息化管理的模式,它的形式新颖,具有个性化设计,多样化服务,上升空间极大,给相关企业带来巨大的利益,并且也为企业争取了本品牌在本行业的领先地位。

管理信息化行业具有较强的发展趋势,它是一股崭新的力量,正在不断地推动国家经济增长。物流安全、网络安全、用户信息安全等相关问题都得到了大大的改善,基本上很少出现这些人们所担心的问题。网络中的资源多,种类齐全,可对比性强,这为用户提供了极大的便捷。相比于国外,我国管理信息化出现的比较晚,但是相关的技术人员不断的发展与完善计算机技术,使得网络市场得到了空前的发展,吸引着越来越多的人们接受和使用,促进着管理信息化行业不断的发展,并且正逐渐与国外减少差距。马云在二十一世纪初,大力使用互联网技术,创办了支付宝、淘宝,在到后来唯品会、京东等电子商务平台,以及饿了么、美团等美食外卖平台的出现,标志着我国的电子商务正在逐渐走向成熟,也在另一方面证明着网络技术的发展使得我们的管理信息化行业水平达到了顶峰。

  1. 目的意义

现如今,互联网的广泛普及与应用,标志着信息化的时代已经到来,管理信息化行业在生活中占据着越来越重要的地位,信息化的服务与管理,大大简化了传统的管理模式,很大程度上,改善了使得人们的生活水平和工作方式。简单的来说订餐管理信息化的形式非常简单,操作方便快捷,相关的工作人员可直接在网上进行管理,管控也不需要受时间和空间的限制,随时随地皆可在网上完成管理。现在,随着互联网的普及与应用,管理信息化被广大使用者所认可,并且非常喜爱这样的方式管理订餐信息,使得网上管理变得越来越流行,实用价值极高,故而本人研发了网上订餐系统。相对于国外来说,我国的管理信息化行业萌发时间的起步较晚,但是近几年我国社会管理信息化服务行业的发展突飞猛进,并且正在逐渐与国外减小差距。从某种程度上来说,我们的生活越来越离不开互联网,与此同时,管理信息化行业也所占据也越来越重要的地位。本系统为用户提供了一个界面友好、使用简单的管理平台,使得订餐信息管理不再受到时间和空间的限制,随时随地可以进行管控,具有很重要的价值和意义。

  1. 主要参考文献

[1]田建勇.基于MVC架构的电子商务网站设计与实现[J].电脑知识与技术,2020,16(21):235-236.

[2]徐刚,翟梦娇.基于SSM的美容资讯商务网站的设计与实现[J].商丘职业技术学院学报,2019,18(06):65-71.

[3]唐滔.基于Web技术的农产品网站设计与实现[J].电脑编程技巧与维护,2019(12):18-20.

[4]王祺衡.B/S结构的软件开发技术研究[J].计算机产品与流通,2019(11):17.

[5]马成平. 商务网站行为分析系统的设计与实现[D].东南大学,2019.

[6]周燕玲.Spring MVC框架开发WEB应用程序的探索与研究[J].科技广场,2016(06):25-28.

[7]解晓源. 基于J2EE技术的微商城系统中前台模块的设计与实现[D].南京大学,2016.

[8]杨旭辉,周庆国,韩根亮,郑礴,祁昌禹.一种基于源代码的Java代码混淆器的设计与实现[J].甘肃科学学报,2015,27(02):28-32.

[9]郭姗姗. 轻量级J2EE关键技术在信息系统中的应用研究[D].武汉理工大学,2013.

[10]岳淑玲,宋艳萍,陆玉富.Web数据库技术在电子商务中的应用[J].中国商贸,2012(06):125-126.

package com.controller;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.*;
import javax.servlet.http.HttpServletRequest;

import com.entity.*;
import com.entity.view.CaipinView;
import com.service.*;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;

import com.utils.PageUtils;
import com.utils.R;

/**
 * 菜品表
 * 后端接口
 * @author
 * @email
 * @date 2024-03-08
*/
@RestController
@Controller
@RequestMapping("/caipin")
public class CaipinController {
    private static final Logger logger = LoggerFactory.getLogger(CaipinController.class);

    @Autowired
    private CaipinService caipinService;

    @Autowired
    private KuchuenService kuchuenService;

    @Autowired
    private LiushuiService liushuiService;


    @Autowired
    private YudingcanzhuoService yudingcanzhuoService;

    @Autowired
    private DingdanxiangqingService dingdanxiangqingService;

    /**
    * 后端列表
    */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params){
        logger.debug("Controller:"+this.getClass().getName()+",page方法");
        PageUtils page = caipinService.queryPage(params);
        return R.ok().put("data", page);
    }
    /**
    * 后端详情
    */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
        logger.debug("Controller:"+this.getClass().getName()+",info方法");
        CaipinEntity caipin = caipinService.selectById(id);
        if(caipin!=null){
            CaipinView caipinView = new CaipinView();
            BeanUtils.copyProperties(caipin, caipinView);
            KuchuenEntity kuchuenEntity = kuchuenService.selectById(caipin.getHxTypes());
            BeanUtils.copyProperties(kuchuenEntity, caipinView ,new String[]{ "id", "createDate"});
            return R.ok().put("data", caipinView);
        }else {
            return R.error(511,"查不到数据");
        }

    }

    /**
    * 后端保存
    */
    @RequestMapping("/save")
    public R save(@RequestBody CaipinEntity caipin, HttpServletRequest request){
        logger.debug("Controller:"+this.getClass().getName()+",save");
        Wrapper<CaipinEntity> queryWrapper = new EntityWrapper<CaipinEntity>()
            .eq("hx_types", caipin.getHxTypes())
            ;
        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        CaipinEntity caipinEntity = caipinService.selectOne(queryWrapper);
        if("".equals(caipin.getImgPhoto()) || "null".equals(caipin.getImgPhoto())){
            caipin.setImgPhoto(null);
        }
        if(caipinEntity==null){
            caipinService.insert(caipin);
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }

    /**
    * 修改
    */
    @RequestMapping("/update")
    public R update(@RequestBody CaipinEntity caipin, HttpServletRequest request){
        logger.debug("Controller:"+this.getClass().getName()+",update");
        //根据字段查询是否有相同数据
        Wrapper<CaipinEntity> queryWrapper = new EntityWrapper<CaipinEntity>()
            .notIn("id",caipin.getId())
            .eq("hx_types", caipin.getHxTypes())
            .eq("money", caipin.getMoney())
            .eq("caipin_content", caipin.getCaipinContent())
            ;
        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        CaipinEntity caipinEntity = caipinService.selectOne(queryWrapper);
        if("".equals(caipin.getImgPhoto()) || "null".equals(caipin.getImgPhoto())){
                caipin.setImgPhoto(null);
        }
        if(caipinEntity==null){
            caipinService.updateById(caipin);//根据id更新
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }


    /**
    * 删除
    */
    @RequestMapping("/diancai")
    public R diancai(@RequestParam Map<String, Object> params, HttpServletRequest request){
        if(params.size() == 0){
            return R.error("请选择要购买的菜品");
        }
        //获取系统当前时间的时间戳作为订单号
        long danhao = new Date().getTime();
        //new 一个订单详情表
        DingdanxiangqingEntity dingdanxiangqing = new DingdanxiangqingEntity();
        //new 一个流水表
        LiushuiEntity liushui = new LiushuiEntity();
        //循环前端传过来的key
            for (String id: params.keySet()) {
                //根据前端传来的key(id)查询数据
                CaipinEntity caipin = caipinService.selectOne(new EntityWrapper<CaipinEntity>().eq("hx_types",id));
                //判断查出来的数据是否为空
                if(caipin == null){
                    //为空返回前台
                    return R.error();
                }
                //判断前端传来的菜品数量是否为空或者小于0
                if(StringUtils.isBlank((String)params.get(id)) || Integer.parseInt(String.valueOf(params.get(id))) <= 0){
                    return R.error("您选择的菜品数量不能小于0哦");
                }

                //根据前台传来的key(id)去库存表中查询数据
                KuchuenEntity kuchuenEntity = kuchuenService.selectById(id);
                //如果为空返回前台
                if(kuchuenEntity == null){
                    return R.error("这件菜品菜品不存在于库存");
                }
                //把map中的值转为Integger
                Integer zhi = Integer.parseInt(String.valueOf(kuchuenEntity.getId()));
                //根据当前登录人的id去已预约的餐桌信息表中查询数据
                YudingcanzhuoEntity yudingcanzhuo = yudingcanzhuoService.selectOne(new EntityWrapper().eq("yh_types", request.getSession().getAttribute("userId")));
                //如果为空就返回前端
                if(yudingcanzhuo == null){
                    return R.error("请先预定餐桌后再预定菜品,以免餐桌不足");
                }
                //如果为空就返回前端
                if(yudingcanzhuo.getCzTypes() == null){
                    return R.error("请先预定餐桌后再预定菜品,以免餐桌不足");
                }

                //判断库存中的菜品数量是否大于用户购买的数量
                if(kuchuenEntity.getNumber() < Integer.parseInt(String.valueOf(params.get(String.valueOf(zhi))))){
                    //库存小于是返回并提示
                    return R.error(kuchuenEntity.getName()+" 库存只剩:"+kuchuenEntity.getNumber()+" 个,不足:"+ params.get(id)+" 个!!!");
                }

                //订单详情中添加进用户购买数量
                dingdanxiangqing.setNumber(zhi);
                //在订单详情表中存入生成的订单号
                dingdanxiangqing.setOdd(String.valueOf(danhao));
                //在订单详情表中存入菜品信息
                dingdanxiangqing.setHxTypes(caipin.getHxTypes());
                //订单详情表中存入菜品价格
                dingdanxiangqing.setMoney(caipin.getMoney());
                //新增订单详情信息
                dingdanxiangqingService.insert(dingdanxiangqing);


                //给流水表中的总价赋值为0
                liushui.setMaxMoney(0.0);
                //获取系统当前时间
                liushui.setCreateTime(new Date());
                //设置上面生成的订单号
                liushui.setOdd(String.valueOf(danhao));
                //在流水表存入中查出来的餐桌信息
                liushui.setCzTypes(yudingcanzhuo.getCzTypes());
                //在流水表存入当前登录用户的信息
                liushui.setYhTypes((Integer) request.getSession().getAttribute("userId"));
                //设置为未支付
                liushui.setSfTypes(2);
                //计算总价
                liushui.setMaxMoney(liushui.getMaxMoney()+(dingdanxiangqing.getMoney()*dingdanxiangqing.getNumber()));

                //库存数量减去用户购买数量
                int i = kuchuenEntity.getNumber() - zhi;
                //将库存数量更新
                kuchuenEntity.setNumber(i);
                //修改库存数量
                kuchuenService.updateById(kuchuenEntity);
            }
        //新增流水信息
        liushuiService.insert(liushui);
        return R.ok();
    }

    /**
    * 删除
    */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
        logger.debug("Controller:"+this.getClass().getName()+",delete");
        caipinService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }
}

package com.controller;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;

import com.utils.ValidatorUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.annotation.IgnoreAuth;

import com.entity.AddressEntity;
import com.entity.view.AddressView;

import com.service.AddressService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MPUtil;
import com.utils.CommonUtil;


/**
 * 地址
 * 后端接口
 * @author 
 * @email 
 * @date 2021-01-25 11:41:44
 */
@RestController
@RequestMapping("/address")
public class AddressController {
    @Autowired
    private AddressService addressService;
    


    /**
     * 后端列表
     */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params,AddressEntity address, HttpServletRequest request){
    	if(!request.getSession().getAttribute("role").toString().equals("管理员")) {
    		address.setUserid((Integer)request.getSession().getAttribute("userId"));
    	}

        EntityWrapper<AddressEntity> ew = new EntityWrapper<AddressEntity>();
		PageUtils page = addressService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, address), params), params));
        return R.ok().put("data", page);
    }
    
    /**
     * 前端列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params,AddressEntity address, HttpServletRequest request){
    	if(!request.getSession().getAttribute("role").toString().equals("管理员")) {
    		address.setUserid((Integer)request.getSession().getAttribute("userId"));
    	}

        EntityWrapper<AddressEntity> ew = new EntityWrapper<AddressEntity>();
		PageUtils page = addressService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, address), params), params));
        return R.ok().put("data", page);
    }

	/**
     * 列表
     */
    @RequestMapping("/lists")
    public R list( AddressEntity address){
       	EntityWrapper<AddressEntity> ew = new EntityWrapper<AddressEntity>();
      	ew.allEq(MPUtil.allEQMapPre( address, "address")); 
        return R.ok().put("data", addressService.selectListView(ew));
    }

	 /**
     * 查询
     */
    @RequestMapping("/query")
    public R query(AddressEntity address){
        EntityWrapper< AddressEntity> ew = new EntityWrapper< AddressEntity>();
 		ew.allEq(MPUtil.allEQMapPre( address, "address")); 
		AddressView addressView =  addressService.selectView(ew);
		return R.ok("查询地址成功").put("data", addressView);
    }
	
    /**
     * 后端详情
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
        AddressEntity address = addressService.selectById(id);
        return R.ok().put("data", address);
    }

    /**
     * 前端详情
     */
    @RequestMapping("/detail/{id}")
    public R detail(@PathVariable("id") Long id){
        AddressEntity address = addressService.selectById(id);
        return R.ok().put("data", address);
    }
    



    /**
     * 后端保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody AddressEntity address, HttpServletRequest request){
    	address.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
    	//ValidatorUtils.validateEntity(address);
    	address.setUserid((Integer)request.getSession().getAttribute("userId"));
		Integer userId = (Integer)request.getSession().getAttribute("userId");
    	if(address.getIsdefault().equals("是")) {
    		addressService.updateForSet("isdefault='否'", new EntityWrapper<AddressEntity>().eq("userid", userId));
    	}
    	address.setUserid(userId);

        addressService.insert(address);
        return R.ok();
    }
    
    /**
     * 前端保存
     */
    @RequestMapping("/add")
    public R add(@RequestBody AddressEntity address, HttpServletRequest request){
    	address.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
    	//ValidatorUtils.validateEntity(address);
    	address.setUserid((Integer)request.getSession().getAttribute("userId"));
		Integer userId = (Integer)request.getSession().getAttribute("userId");
    	if(address.getIsdefault().equals("是")) {
    		addressService.updateForSet("isdefault='否'", new EntityWrapper<AddressEntity>().eq("userid", userId));
    	}
    	address.setUserid(userId);

        addressService.insert(address);
        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody AddressEntity address, HttpServletRequest request){
        //ValidatorUtils.validateEntity(address);
        if(address.getIsdefault().equals("是")) {
    		addressService.updateForSet("isdefault='否'", new EntityWrapper<AddressEntity>().eq("userid", request.getSession().getAttribute("userId")));
    	}
        addressService.updateById(address);//全部更新
        return R.ok();
    }
    
    /**
     * 获取默认地址
     */
    @RequestMapping("/default")
    public R defaultAddress(HttpServletRequest request){
    	Wrapper<AddressEntity> wrapper = new EntityWrapper<AddressEntity>().eq("isdefault", "是").eq("userid", request.getSession().getAttribute("userId"));
        AddressEntity address = addressService.selectOne(wrapper);
        return R.ok().put("data", address);
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
        addressService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }
    
    /**
     * 提醒接口
     */
	@RequestMapping("/remind/{columnName}/{type}")
	public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request, 
						 @PathVariable("type") String type,@RequestParam Map<String, Object> map) {
		map.put("column", columnName);
		map.put("type", type);
		
		if(type.equals("2")) {
			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
			Calendar c = Calendar.getInstance();
			Date remindStartDate = null;
			Date remindEndDate = null;
			if(map.get("remindstart")!=null) {
				Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
				c.setTime(new Date()); 
				c.add(Calendar.DAY_OF_MONTH,remindStart);
				remindStartDate = c.getTime();
				map.put("remindstart", sdf.format(remindStartDate));
			}
			if(map.get("remindend")!=null) {
				Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
				c.setTime(new Date());
				c.add(Calendar.DAY_OF_MONTH,remindEnd);
				remindEndDate = c.getTime();
				map.put("remindend", sdf.format(remindEndDate));
			}
		}
		
		Wrapper<AddressEntity> wrapper = new EntityWrapper<AddressEntity>();
		if(map.get("remindstart")!=null) {
			wrapper.ge(columnName, map.get("remindstart"));
		}
		if(map.get("remindend")!=null) {
			wrapper.le(columnName, map.get("remindend"));
		}
		if(!request.getSession().getAttribute("role").toString().equals("管理员")) {
    		wrapper.eq("userid", (Long)request.getSession().getAttribute("userId"));
    	}


		int count = addressService.selectCount(wrapper);
		return R.ok().put("count", count);
	}
	


}

猜你喜欢

转载自blog.csdn.net/weixin_46437112/article/details/132753416