基于java+ssm+vue的点餐微信小程序

🙊作者简介:多年编程开发经验,专注java技术领域和毕业设计项目实战,系统定制、远程部署调试、代码讲解、代码修改
🍅擅长语言:springboot、ssm、vue、html、jsp、php、python、爬虫、小程序、安卓app
⬇️源码获取:文末可以获取源码+数据库+文档

 

⚡感兴趣的可以先收藏+关注,后续会更新更多项目资料,所有项目均配有开发文档和安装配置教程

1da098108f344f2e884aab41fda814bf.png

系统介绍

点餐微信小程序按照操作主体分为管理员和用户。管理员的功能包括管理商品,回复商品评价,管理论坛帖子信息,管理公告,管理商品订单等;用户的功能包括购买商品,管理收货地址,对账户进行在线充值,管理订单,发布论坛帖子,管理购物车等。该系统采用了SSM框架,Mysql数据库,Java语言等技术实现管理员后台。采用微信开发者工具来对用户小程序端进行了开发。

系统主要技术

开发语言:Java

使用框架:SSM

系统架构:B/S

前端技术:Vue、JavaScript

数据库 :Mysql 5.7/8.0

编译工具:idea或者eclipse,jdk1.8,maven

系统功能结构设计

图4.1即为设计的管理员功能结构图

 

 

82b452ec8d574d459f2709c34087e6ff.png

图4.1 管理员功能结构

图4.2即为设计的用户功能结构,用户权限操作的功能包括购买商品,管理收货地址,对账户进行在线充值,管理订单,发布论坛帖子,管理购物车等。

4ff034e27e144d528ba22a9cfbb9655f.png

图4.2 用户功能结构

 

系统功能实现

5.1 管理员功能实现

5.1.1 商品管理

图5.1 即为编码实现的商品管理界面,商品信息有商品原价,商品库存,商品图片,商品名称等信息,管理员可以更改登记错误的商品信息,在商品管理界面可以新增商品,删除需要删除的商品,下架或上架商品,管理商品库存,包括增加库存,减少库存等操作。

4ded8f4267704d34a7e05da51d480fbc.png

图5.1 商品管理界面

5.1.2 商品订单管理

图5.2 即为编码实现的商品订单管理界面,商品订单包括用户姓名,配送员名称,实付价格,订单类型等信息,管理员可以查询商品订单,对商品订单出餐,对需要删除的商品订单进行删除等。

12a9cb2aa0e4457d8b790fbc7c3047e8.png

图5.2 商品订单管理界面

5.1.3 商品评价管理

图5.3 即为编码实现的商品评价管理界面,用户对点餐的商品进行评价之后,该评价信息需要得到管理员的查看和回复。

bfae0a523eb04469874833060c0d7c52.png

图5.3 商品评价管理界面

5.1.4 公告信息管理

图5.4 即为编码实现的公告信息管理界面,管理员对公告增删改查管理。

cb522921957246f3ad2c931990be4ee2.png

图5.4 公告信息管理界面

5.2 用户功能实现

5.2.1 商品信息

图5.5 即为编码实现的商品信息界面,用户查看商品演示视频,查看商品评价,查看商品详情等信息。用户如果想要快速下单,可以点击立即购买按钮下单。

845f3def67fc4c09ae21c6f34febefa0.png

图5.5 商品信息界面

5.2.2 订单确认

图5.6 即为编码实现的订单确认界面,用户在收货地址中选择需要的地址,对购买清单以及原价和折扣价等信息进行查看之后,就能进行支付。

80b07eb0af914e048d53bd560baf4cdd.png

图5.6 订单确认界面

5.2.3 我的商品订单

图5.7 即为编码实现的我的商品订单界面,用户已经支付的订单如果存在误操作行为,可以申请退款,同时用户可以查看已出餐订单,已评价订单以及已取餐订单等。

67cf64d876bb4b818094dcb68d8dd6ef.png

图5.7 我的商品订单界面

5.2.4 收货地址

图5.8 即为编码实现的收货地址界面,用户在收货地址界面新增地址,修改,删除已有收货地址信息。

72e44db30d9244ba83b752746237b7c8.png

图5.8 收货地址界面

5.2.5 用户充值

图5.9 即为编码实现的用户充值界面,用户的账户余额如果不够购买商品,那么用户可以对账户进行充值,在充值界面编辑充值的金额数据,然后提交即可。

7dd1f1a3e2224a3c9cc4b63ae97e100d.png

图5.9 用户充值界面

5.2.6 我的发帖

图5.10 即为编码实现的我的发帖界面,用户在我的发帖界面才可以发布帖子,我的发帖界面展示的帖子信息都是用户自己发布的帖子,因此用户可以修改,删除帖子,还可以查看帖子的评论信息。

e8b37e39fdcb4860a87ac2a1a0e886d8.png

图5.10 我的发帖界面

 

 

参考论文

f1b92442aab04a14bd6078fb25065af1.png

0beae460e6064810bd47c47fab527726.png

e62c8d64622442be805ca40b9b971a03.png

核心代码


package com.controller;

import java.io.File;
import java.math.BigDecimal;
import java.net.URL;
import java.text.SimpleDateFormat;
import com.alibaba.fastjson.JSONObject;
import java.util.*;
import org.springframework.beans.BeanUtils;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.context.ContextLoader;
import javax.servlet.ServletContext;
import com.service.TokenService;
import com.utils.*;
import java.lang.reflect.InvocationTargetException;

import com.service.DictionaryService;
import org.apache.commons.lang3.StringUtils;
import com.annotation.IgnoreAuth;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.entity.*;
import com.entity.view.*;
import com.service.*;
import com.utils.PageUtils;
import com.utils.R;
import com.alibaba.fastjson.*;

/**
 * 商品
 * 后端接口
 * @author
 * @email
*/
@RestController
@Controller
@RequestMapping("/caipin")
public class CaipinController {
    private static final Logger logger = LoggerFactory.getLogger(CaipinController.class);

    @Autowired
    private CaipinService caipinService;


    @Autowired
    private TokenService tokenService;
    @Autowired
    private DictionaryService dictionaryService;

    //级联表service

    @Autowired
    private YonghuService yonghuService;


    /**
    * 后端列表
    */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
        logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
        String role = String.valueOf(request.getSession().getAttribute("role"));
        if(false)
            return R.error(511,"永不会进入");
        else if("用户".equals(role))
            params.put("yonghuId",request.getSession().getAttribute("userId"));
        params.put("caipinDeleteStart",1);params.put("caipinDeleteEnd",1);
        if(params.get("orderBy")==null || params.get("orderBy")==""){
            params.put("orderBy","id");
        }
        PageUtils page = caipinService.queryPage(params);

        //字典表数据转换
        List<CaipinView> list =(List<CaipinView>)page.getList();
        for(CaipinView c:list){
            //修改对应字典表字段
            dictionaryService.dictionaryConvert(c, request);
        }
        return R.ok().put("data", page);
    }

    /**
    * 后端详情
    */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id, HttpServletRequest request){
        logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
        CaipinEntity caipin = caipinService.selectById(id);
        if(caipin !=null){
            //entity转view
            CaipinView view = new CaipinView();
            BeanUtils.copyProperties( caipin , view );//把实体数据重构到view中

            //修改对应字典表字段
            dictionaryService.dictionaryConvert(view, request);
            return R.ok().put("data", view);
        }else {
            return R.error(511,"查不到数据");
        }

    }

    /**
    * 后端保存
    */
    @RequestMapping("/save")
    public R save(@RequestBody CaipinEntity caipin, HttpServletRequest request){
        logger.debug("save方法:,,Controller:{},,caipin:{}",this.getClass().getName(),caipin.toString());

        String role = String.valueOf(request.getSession().getAttribute("role"));
        if(false)
            return R.error(511,"永远不会进入");

        Wrapper<CaipinEntity> queryWrapper = new EntityWrapper<CaipinEntity>()
            .eq("caipin_name", caipin.getCaipinName())
            .eq("caipin_video", caipin.getCaipinVideo())
            .eq("caipin_types", caipin.getCaipinTypes())
            .eq("caipin_kucun_number", caipin.getCaipinKucunNumber())
            .eq("caipin_clicknum", caipin.getCaipinClicknum())
            .eq("shangxia_types", caipin.getShangxiaTypes())
            .eq("caipin_delete", caipin.getCaipinDelete())
            ;

        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        CaipinEntity caipinEntity = caipinService.selectOne(queryWrapper);
        if(caipinEntity==null){
            caipin.setCaipinClicknum(1);
            caipin.setShangxiaTypes(1);
            caipin.setCaipinDelete(1);
            caipin.setCreateTime(new Date());
            caipinService.insert(caipin);
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }

    /**
    * 后端修改
    */
    @RequestMapping("/update")
    public R update(@RequestBody CaipinEntity caipin, HttpServletRequest request){
        logger.debug("update方法:,,Controller:{},,caipin:{}",this.getClass().getName(),caipin.toString());

        String role = String.valueOf(request.getSession().getAttribute("role"));
//        if(false)
//            return R.error(511,"永远不会进入");
        //根据字段查询是否有相同数据
        Wrapper<CaipinEntity> queryWrapper = new EntityWrapper<CaipinEntity>()
            .notIn("id",caipin.getId())
            .andNew()
            .eq("caipin_name", caipin.getCaipinName())
            .eq("caipin_video", caipin.getCaipinVideo())
            .eq("caipin_types", caipin.getCaipinTypes())
            .eq("caipin_kucun_number", caipin.getCaipinKucunNumber())
            .eq("caipin_clicknum", caipin.getCaipinClicknum())
            .eq("shangxia_types", caipin.getShangxiaTypes())
            .eq("caipin_delete", caipin.getCaipinDelete())
            ;

        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        CaipinEntity caipinEntity = caipinService.selectOne(queryWrapper);
        if("".equals(caipin.getCaipinPhoto()) || "null".equals(caipin.getCaipinPhoto())){
                caipin.setCaipinPhoto(null);
        }
        if("".equals(caipin.getCaipinVideo()) || "null".equals(caipin.getCaipinVideo())){
                caipin.setCaipinVideo(null);
        }
        if(caipinEntity==null){
            caipinService.updateById(caipin);//根据id更新
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }



    /**
    * 删除
    */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] ids){
        logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
        ArrayList<CaipinEntity> list = new ArrayList<>();
        for(Integer id:ids){
            CaipinEntity caipinEntity = new CaipinEntity();
            caipinEntity.setId(id);
            caipinEntity.setCaipinDelete(2);
            list.add(caipinEntity);
        }
        if(list != null && list.size() >0){
            caipinService.updateBatchById(list);
        }
        return R.ok();
    }


    /**
     * 批量上传
     */
    @RequestMapping("/batchInsert")
    public R save( String fileName, HttpServletRequest request){
        logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);
        Integer yonghuId = Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId")));
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        try {
            List<CaipinEntity> caipinList = new ArrayList<>();//上传的东西
            Map<String, List<String>> seachFields= new HashMap<>();//要查询的字段
            Date date = new Date();
            int lastIndexOf = fileName.lastIndexOf(".");
            if(lastIndexOf == -1){
                return R.error(511,"该文件没有后缀");
            }else{
                String suffix = fileName.substring(lastIndexOf);
                if(!".xls".equals(suffix)){
                    return R.error(511,"只支持后缀为xls的excel文件");
                }else{
                    URL resource = this.getClass().getClassLoader().getResource("../../upload/" + fileName);//获取文件路径
                    File file = new File(resource.getFile());
                    if(!file.exists()){
                        return R.error(511,"找不到上传文件,请联系管理员");
                    }else{
                        List<List<String>> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件
                        dataList.remove(0);//删除第一行,因为第一行是提示
                        for(List<String> data:dataList){
                            //循环
                            CaipinEntity caipinEntity = new CaipinEntity();
//                            caipinEntity.setCaipinName(data.get(0));                    //商品名称 要改的
//                            caipinEntity.setCaipinPhoto("");//详情和图片
//                            caipinEntity.setCaipinVideo(data.get(0));                    //视频演示 要改的
//                            caipinEntity.setCaipinTypes(Integer.valueOf(data.get(0)));   //商品类型 要改的
//                            caipinEntity.setCaipinKucunNumber(Integer.valueOf(data.get(0)));   //商品库存 要改的
//                            caipinEntity.setCaipinOldMoney(data.get(0));                    //商品原价 要改的
//                            caipinEntity.setCaipinNewMoney(data.get(0));                    //现价 要改的
//                            caipinEntity.setCaipinClicknum(Integer.valueOf(data.get(0)));   //点击次数 要改的
//                            caipinEntity.setShangxiaTypes(Integer.valueOf(data.get(0)));   //是否上架 要改的
//                            caipinEntity.setCaipinDelete(1);//逻辑删除字段
//                            caipinEntity.setCaipinContent("");//详情和图片
//                            caipinEntity.setCreateTime(date);//时间
                            caipinList.add(caipinEntity);


                            //把要查询是否重复的字段放入map中
                        }

                        //查询是否重复
                        caipinService.insertBatch(caipinList);
                        return R.ok();
                    }
                }
            }
        }catch (Exception e){
            e.printStackTrace();
            return R.error(511,"批量插入数据异常,请联系管理员");
        }
    }





    /**
    * 前端列表
    */
    @IgnoreAuth
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){
        logger.debug("list方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));

        // 没有指定排序字段就默认id倒序
        if(StringUtil.isEmpty(String.valueOf(params.get("orderBy")))){
            params.put("orderBy","id");
        }
        PageUtils page = caipinService.queryPage(params);

        //字典表数据转换
        List<CaipinView> list =(List<CaipinView>)page.getList();
        for(CaipinView c:list)
            dictionaryService.dictionaryConvert(c, request); //修改对应字典表字段
        return R.ok().put("data", page);
    }

    /**
    * 前端详情
    */
    @RequestMapping("/detail/{id}")
    public R detail(@PathVariable("id") Long id, HttpServletRequest request){
        logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
        CaipinEntity caipin = caipinService.selectById(id);
            if(caipin !=null){

                //点击数量加1
                caipin.setCaipinClicknum(caipin.getCaipinClicknum()+1);
                caipinService.updateById(caipin);

                //entity转view
                CaipinView view = new CaipinView();
                BeanUtils.copyProperties( caipin , view );//把实体数据重构到view中

                //修改对应字典表字段
                dictionaryService.dictionaryConvert(view, request);
                return R.ok().put("data", view);
            }else {
                return R.error(511,"查不到数据");
            }
    }


    /**
    * 前端保存
    */
    @RequestMapping("/add")
    public R add(@RequestBody CaipinEntity caipin, HttpServletRequest request){
        logger.debug("add方法:,,Controller:{},,caipin:{}",this.getClass().getName(),caipin.toString());
        Wrapper<CaipinEntity> queryWrapper = new EntityWrapper<CaipinEntity>()
            .eq("caipin_name", caipin.getCaipinName())
            .eq("caipin_video", caipin.getCaipinVideo())
            .eq("caipin_types", caipin.getCaipinTypes())
            .eq("caipin_kucun_number", caipin.getCaipinKucunNumber())
            .eq("caipin_clicknum", caipin.getCaipinClicknum())
            .eq("shangxia_types", caipin.getShangxiaTypes())
            .eq("caipin_delete", caipin.getCaipinDelete())
            ;
        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        CaipinEntity caipinEntity = caipinService.selectOne(queryWrapper);
        if(caipinEntity==null){
            caipin.setCaipinDelete(1);
            caipin.setCreateTime(new Date());
        caipinService.insert(caipin);
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }


}

 

 

  • 19
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值