海鲜市场|基于springboot的网络海鲜市场系设计与实现(附项目源码+论文+数据库)

 私信或留言即免费送开题报告和任务书(可指定任意题目)

目录

一、摘要

二、相关技术

三、系统设计

四、数据库设计     

五、核心代码      

六、论文参考 

七、源码获取 


一、摘要

计算机网络发展到现在已经好几十年了,在理论上面已经有了很丰富的基础,并且在现实生活中也到处都在使用,可以说,经过几十年的发展,互联网技术已经把地域信息的隔阂给消除了,让整个世界都可以即时通话和联系,极大的方便了人们的生活。所以说,网络海鲜市场系统用计算机技术来进行设计,不仅在管理方面更加的系统化,操作性强,最重要的是关于数据的保存和使用都能节约大量的时间,该系统非常的好用。

网络海鲜市场系统管理数据的工具是MySQL,编码的语言是Java,运用的框架是Spring Boot框架。该系统可以实现对商品的购买,对论坛帖子的发布与回复论坛帖子,查看商品资讯,修改或删除购物车商品,对订单信息进行管理等功能。

网络海鲜市场系统不仅能让操作人员使用更加地方便,并且设计的也很合理,能有效的避免误操作,让数据在录入的环节就符合设计需要,极大的规避了源头性的输入误差,顺利的让数据变得更加可控并且可靠,让出错的几率降到最低。

关键词:网络海鲜市场系统;购物车;订单

二、相关技术

java、tomcat、mysql、spring、springBoot、mybatis、query、vue

三、系统设计

3.1 整体功能设计图

对管理员具体功能的设计结果将以图4.1所示的管理员功能结构图来进行体现。管理员对于网络海鲜市场系统操作的功能包括对商品资讯,用户信息,商品信息等进行增删改查,同时可以回复用户对商品的评价,以及管理商品订单和论坛帖子。

对用户具体功能的设计结果将以图4.2所示的用户功能结构图来进行体现。用户对于网络海鲜市场系统操作的功能包括在前台购买商品,管理收货地址,管理购买的商品信息,查看商品资讯,管理购物车等。

3.2 功能具体细节设计    

1、管理员功能实现
论坛管理

该功能主要用于实现对论坛帖子基本信息的管理,论坛管理界面的运行效果见图5.1。在此界面,管理员不仅需要跟踪论坛帖子,比如查看论坛帖子的回复,删除论坛帖子的回复信息等,修改论坛帖子的内容,删除需要删除的论坛帖子信息等。

商品管理

该功能主要用于实现对商品信息基本信息的管理,商品管理界面的运行效果见图5.2。在此界面,对商品的类型,商品原价,商品库存,商品名称等信息都需要管理员负责添加和修改,同时还需要对商品的库存进行管理,比如增加商品的库存,或者是对商品库存进行减少以及对销量不好的商品进行下架,对新的商品进行上架等操作。

商品评价管理

该功能主要用于实现对商品评价基本信息的管理,商品评价管理界面的运行效果见图5.3。在此界面,商品的评价内容,以及评价用户和评价的商品等信息都能让管理员查看,同时管理员也能对评价商品的用户进行回复。

商品订单管理

该功能主要用于实现对商品订单基本信息的管理,商品订单管理界面的运行效果见图5.4。在此界面,管理员主要处理已经销售的商品信息,即商品订单信息,管理员需要对用户刚刚支付的商品订单进行及时发货,以及对各个商品订单的更多的详细信息进行认真查看。

商品资讯管理

该功能主要用于实现对商品资讯基本信息的管理,商品资讯管理界面的运行效果见图5.5。在此界面,商品资讯的内容以及图片等信息都是管理员负责登记的信息,也包括后期对商品资讯信息的针对性修改和删除等都是管理员负责的内容。

2、用户功能实现

商品信息

商品信息界面的运行效果见图5.6。在此界面,用户可以查看商品信息界面展示的商品相关视频,以及通过对商品的相关介绍信息来了解商品,用户如果有购买的需求,可以通过立即购买功能立即下单。

确认下单

确认下单界面的运行效果见图5.7。在此界面,用户不仅需要确认收货地址是否正确,还需要确认需要购买的商品的数量以及商品信息是否正确,最后查看实付金额信息,然后进行下单。

商品订单

商品订单界面的运行效果见图5.8。在此界面展示的信息都是用户购买商品之后产生的信息,用户不仅可以查看信息,还可以根据自身实际情况对商品订单进行相应操作,包括退款或评价等。

购物车

购物车界面的运行效果见图5.9。在此界面,用户可以统一处理购物车里面的商品信息,比如修改各个商品的购买数量,可以增加购买数量,也能减少购买数量,或者是清理一些不需要购买的商品信息,最后查看支付金额,然后统一下单。

在线论坛 

在线论坛界面的运行效果见图5.10。在此界面,用户对在线论坛展示的帖子进行查看,每个论坛帖子都允许用户查看后提交评论信息。在在线论坛的界面,用户点击右上角的发帖链接即可发布自己的帖子。

四、数据库设计     

(1)商品包括的属性有商品照片,商品库存,商品原价等。其属性图如下。

(2)商品订单包括的属性有购买数量,订单类型,支付类型等。其属性图如下。

(3)管理员包括的属性有用户名,角色等。其属性图如下。

(4)用户包括的属性有用户头像,性别,电子邮箱等。其属性图如下。

(5)设计的各实体间关系E-R图如下。

五、核心代码      


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("/cart")
public class CartController {
    private static final Logger logger = LoggerFactory.getLogger(CartController.class);

    @Autowired
    private CartService cartService;


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

    //级联表service
    @Autowired
    private HaixianService haixianService;
    @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"));
        if(params.get("orderBy")==null || params.get("orderBy")==""){
            params.put("orderBy","id");
        }
        PageUtils page = cartService.queryPage(params);

        //字典表数据转换
        List<CartView> list =(List<CartView>)page.getList();
        for(CartView 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);
        CartEntity cart = cartService.selectById(id);
        if(cart !=null){
            //entity转view
            CartView view = new CartView();
            BeanUtils.copyProperties( cart , view );//把实体数据重构到view中

                //级联表
                HaixianEntity haixian = haixianService.selectById(cart.getHaixianId());
                if(haixian != null){
                    BeanUtils.copyProperties( haixian , view ,new String[]{ "id", "createTime", "insertTime", "updateTime"});//把级联的数据添加到view中,并排除id和创建时间字段
                    view.setHaixianId(haixian.getId());
                }
                //级联表
                YonghuEntity yonghu = yonghuService.selectById(cart.getYonghuId());
                if(yonghu != null){
                    BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createTime", "insertTime", "updateTime"});//把级联的数据添加到view中,并排除id和创建时间字段
                    view.setYonghuId(yonghu.getId());
                }
            //修改对应字典表字段
            dictionaryService.dictionaryConvert(view, request);
            return R.ok().put("data", view);
        }else {
            return R.error(511,"查不到数据");
        }

    }

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

        String role = String.valueOf(request.getSession().getAttribute("role"));
        if(false)
            return R.error(511,"永远不会进入");
        else if("用户".equals(role))
            cart.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));

        Wrapper<CartEntity> queryWrapper = new EntityWrapper<CartEntity>()
            .eq("yonghu_id", cart.getYonghuId())
            .eq("haixian_id", cart.getHaixianId())
            .eq("buy_number", cart.getBuyNumber())
            ;

        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        CartEntity cartEntity = cartService.selectOne(queryWrapper);
        if(cartEntity==null){
            cart.setCreateTime(new Date());
            cart.setInsertTime(new Date());
            cartService.insert(cart);
            return R.ok();
        }else {
            return R.error(511,"商品已添加到购物车");
        }
    }

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

        String role = String.valueOf(request.getSession().getAttribute("role"));
//        if(false)
//            return R.error(511,"永远不会进入");
//        else if("用户".equals(role))
//            cart.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
        //根据字段查询是否有相同数据
        Wrapper<CartEntity> queryWrapper = new EntityWrapper<CartEntity>()
            .notIn("id",cart.getId())
            .andNew()
            .eq("yonghu_id", cart.getYonghuId())
            .eq("haixian_id", cart.getHaixianId())
            .eq("buy_number", cart.getBuyNumber())
            ;

        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        CartEntity cartEntity = cartService.selectOne(queryWrapper);
        cart.setUpdateTime(new Date());
        if(cartEntity==null){
            cartService.updateById(cart);//根据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());
        cartService.deleteBatchIds(Arrays.asList(ids));
        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<CartEntity> cartList = 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("static/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){
                            //循环
                            CartEntity cartEntity = new CartEntity();
//                            cartEntity.setYonghuId(Integer.valueOf(data.get(0)));   //所属用户 要改的
//                            cartEntity.setHaixianId(Integer.valueOf(data.get(0)));   //商品 要改的
//                            cartEntity.setBuyNumber(Integer.valueOf(data.get(0)));   //购买数量 要改的
//                            cartEntity.setCreateTime(date);//时间
//                            cartEntity.setUpdateTime(sdf.parse(data.get(0)));          //更新时间 要改的
//                            cartEntity.setInsertTime(date);//时间
                            cartList.add(cartEntity);


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

                        //查询是否重复
                        cartService.insertBatch(cartList);
                        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 = cartService.queryPage(params);

        //字典表数据转换
        List<CartView> list =(List<CartView>)page.getList();
        for(CartView 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);
        CartEntity cart = cartService.selectById(id);
            if(cart !=null){


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

                //级联表
                    HaixianEntity haixian = haixianService.selectById(cart.getHaixianId());
                if(haixian != null){
                    BeanUtils.copyProperties( haixian , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
                    view.setHaixianId(haixian.getId());
                }
                //级联表
                    YonghuEntity yonghu = yonghuService.selectById(cart.getYonghuId());
                if(yonghu != null){
                    BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
                    view.setYonghuId(yonghu.getId());
                }
                //修改对应字典表字段
                dictionaryService.dictionaryConvert(view, request);
                return R.ok().put("data", view);
            }else {
                return R.error(511,"查不到数据");
            }
    }


    /**
    * 前端保存
    */
    @RequestMapping("/add")
    public R add(@RequestBody CartEntity cart, HttpServletRequest request){
        logger.debug("add方法:,,Controller:{},,cart:{}",this.getClass().getName(),cart.toString());
        Wrapper<CartEntity> queryWrapper = new EntityWrapper<CartEntity>()
            .eq("yonghu_id", cart.getYonghuId())
            .eq("haixian_id", cart.getHaixianId())
            .eq("buy_number", cart.getBuyNumber())
            ;
        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        CartEntity cartEntity = cartService.selectOne(queryWrapper);
        if(cartEntity==null){
            cart.setCreateTime(new Date());
            cart.setInsertTime(new Date());
        cartService.insert(cart);
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }


}

六、论文参考 

七、源码获取 

点赞、收藏、关注、评论啦。

联系即送开题报告和任务书,欢迎咨询

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值