Bootstrap

计算机毕业设计-基于Java+SSM架构的花卉库存管理系统项目开发实战(附源码+论文)

大家好!我是程序员一帆,感谢您阅读本文,欢迎一键三连哦。

💞当前专栏:Java毕业设计

精彩专栏推荐👇🏻👇🏻👇🏻

🎀 Python毕业设计
🌎微信小程序毕业设计

开发环境

  • 开发语言:Java
  • 框架:ssm
  • JDK版本:JDK1.8
  • 服务器:tomcat7
  • 数据库:mysql 5.7
  • 数据库工具:Navicat12
  • 开发软件:eclipse/myeclipse/idea
  • Maven包:Maven3.3.9
  • 浏览器:谷歌浏览器

源码下载地址:

https://download.csdn.net/download/2301_76953549/89298684

论文目录

【如需全文请按文末获取联系】
在这里插入图片描述
在这里插入图片描述

一、项目简介

花卉库存管理系统实现的功能包括货物出入库管理,货物出入库详情管理,货物管理,仓库管理,分库管理员管理,员工管理等功能。该系统采用了Mysql数据库,Java语言,SSM框架等技术进行编程实现。

二、系统设计

2.1软件功能模块设计

图4.1即为设计的管理员功能结构,管理员权限操作的功能包括管理员工和分库管理员,以及对货物,仓库,出入库信息进行管理。
在这里插入图片描述

图4.2即为设计的分库管理员功能结构,分库管理员权限操作的功能包括查看货物出入库的信息,增删改查仓库以及货物信息,查看公告等。
在这里插入图片描述
图4.3即为设计的员工功能结构,员工权限操作的功能包括对货物入库,对货物出库,查看货物出入库明细,查看货物信息,仓库信息以及公告信息等。
在这里插入图片描述

2.2数据库设计

(1)图4.4即为仓库这个实体所拥有的属性值。
在这里插入图片描述
(2)图4.5即为货物这个实体所拥有的属性值。
在这里插入图片描述
(3)图4.6即为分库管理员这个实体所拥有的属性值。
在这里插入图片描述
(5)图4.8即为上面介绍的实体中存在的联系。
在这里插入图片描述

三、系统项目部分截图

3.1管理员功能实现

分库管理员管理
图5.1 即为编码实现的分库管理员管理界面,分库管理员信息有手机号,姓名,头像等信息,管理员除了可以新增分库管理员信息,也能使用修改功能对有错误数据的分库管理员信息进行更正以及删除需要删除的分库管理员信息等。
在这里插入图片描述
员工管理
图5.3 即为编码实现的员工管理界面,员工的信息管理也是管理员管理的内容,管理方式主要还是增删改查员工信息。
在这里插入图片描述

3.2分库管理员功能实现

仓库信息管理
图5.4 即为编码实现的仓库信息管理界面,仓库信息包括最大库存,最小库存,货物现有库存,仓库地址等信息,分库管理员主要负责新增仓库信息,查看仓库详情,查询仓库信息以及删除需要删除的仓库信息等。
在这里插入图片描述
货物管理
图5.5 即为编码实现的货物管理界面,货物信息包括了仓库类型,货物名称,货物供应商,货物库存,货物存放规则等信息,分库管理员需要新增货物信息,选择查询条件来查询货物,查询条件包括货物供应商,货物名称,仓库编号,仓库类型等。分库管理员也能在货物管理界面修改货物信息,对货物信息进行下架操作或者是上架操作等。
在这里插入图片描述
出入库查看
图5.6 即为编码实现的出入库查看界面,分库管理员只能查询货物出入库信息,或者是对货物的入库信息,出库信息的详情进行查看。
在这里插入图片描述

3.3员工功能实现

货物出库
图5.7 即为编码实现的货物出库界面,员工可以对需要出库的货物进行出库操作,需要员工先选择需要出库的货物,然后对其出库数量进行增加或减少,最后提交该货物的出库信息。
在这里插入图片描述
货物入库
图5.8 即为编码实现的货物入库界面,员工对需要入库的货物进行入库操作,包括选择需要入库的货物,然后对其入库的数量进行增减,登记货物入库的备注信息,最后提交货物入库信息。
在这里插入图片描述
货物查看
图5.9 即为编码实现的货物查看界面,员工查询货物,在查询框中编辑货物名称也能查询,通过货物供应商也能查询,或者是通过仓库编号也能查询货物。除了可以查询货物之外,员工也能查看货物详情。
在这里插入图片描述

四、部分核心代码


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

    @Autowired
    private XianhuaChuruInoutService xianhuaChuruInoutService;


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

    //级联表service
    @Autowired
    private YonghuService yonghuService;

    // 列表详情的表级联service
    @Autowired
    private XianhuaChuruInoutListService xianhuaChuruInoutListService;
//    @Autowired
//    private YonghuService yonghuService;
    @Autowired
    private XianhuaService xianhuaService;
    @Autowired
    private FenkuguanliService fenkuguanliService;


    /**
    * 后端列表
    */
    @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("fenkuguanliId",request.getSession().getAttribute("userId"));
        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 = xianhuaChuruInoutService.queryPage(params);

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

                //级联表
                YonghuEntity yonghu = yonghuService.selectById(xianhuaChuruInout.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 XianhuaChuruInoutEntity xianhuaChuruInout, HttpServletRequest request){
        logger.debug("save方法:,,Controller:{},,xianhuaChuruInout:{}",this.getClass().getName(),xianhuaChuruInout.toString());

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

        Wrapper<XianhuaChuruInoutEntity> queryWrapper = new EntityWrapper<XianhuaChuruInoutEntity>()
            .eq("xianhua_churu_inout_uuid_number", xianhuaChuruInout.getXianhuaChuruInoutUuidNumber())
            .eq("yonghu_id", xianhuaChuruInout.getYonghuId())
            .eq("xianhua_churu_inout_name", xianhuaChuruInout.getXianhuaChuruInoutName())
            .eq("xianhua_churu_inout_types", xianhuaChuruInout.getXianhuaChuruInoutTypes())
            ;

        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        XianhuaChuruInoutEntity xianhuaChuruInoutEntity = xianhuaChuruInoutService.selectOne(queryWrapper);
        if(xianhuaChuruInoutEntity==null){
            xianhuaChuruInout.setInsertTime(new Date());
            xianhuaChuruInout.setCreateTime(new Date());
            xianhuaChuruInoutService.insert(xianhuaChuruInout);
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }

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

        String role = String.valueOf(request.getSession().getAttribute("role"));
//        if(false)
//            return R.error(511,"永远不会进入");
//        else if("员工".equals(role))
//            xianhuaChuruInout.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
        //根据字段查询是否有相同数据
        Wrapper<XianhuaChuruInoutEntity> queryWrapper = new EntityWrapper<XianhuaChuruInoutEntity>()
            .notIn("id",xianhuaChuruInout.getId())
            .andNew()
            .eq("xianhua_churu_inout_uuid_number", xianhuaChuruInout.getXianhuaChuruInoutUuidNumber())
            .eq("yonghu_id", xianhuaChuruInout.getYonghuId())
            .eq("xianhua_churu_inout_name", xianhuaChuruInout.getXianhuaChuruInoutName())
            .eq("xianhua_churu_inout_types", xianhuaChuruInout.getXianhuaChuruInoutTypes())
            ;

        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        XianhuaChuruInoutEntity xianhuaChuruInoutEntity = xianhuaChuruInoutService.selectOne(queryWrapper);
        if(xianhuaChuruInoutEntity==null){
            xianhuaChuruInoutService.updateById(xianhuaChuruInout);//根据id更新
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }


    /**
    * 出库
    */
    @RequestMapping("/outXianhuaChuruInoutList")
    public R outXianhuaChuruInoutList(@RequestBody  Map<String, Object> params,HttpServletRequest request){
        logger.debug("outXianhuaChuruInoutList方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));

        String role = String.valueOf(request.getSession().getAttribute("role"));

        //取出入库名称并判断是否存在
        String xianhuaChuruInoutName = String.valueOf(params.get("xianhuaChuruInoutName"));
        Wrapper<XianhuaChuruInoutEntity> queryWrapper = new EntityWrapper<XianhuaChuruInoutEntity>()
            .eq("xianhua_churu_inout_name", xianhuaChuruInoutName)
            ;
        XianhuaChuruInoutEntity xianhuaChuruInoutSelectOne = xianhuaChuruInoutService.selectOne(queryWrapper);
        if(xianhuaChuruInoutSelectOne != null)
            return R.error(511,"出入库名称已被使用");


    //取当前表的级联表并判断是否前台传入

        Map<String, Integer> map = (Map<String, Integer>) params.get("map");
        if(map == null || map.size() == 0)
            return R.error(511,"列表内容不能为空");


        Set<String> ids = map.keySet();

        List<XianhuaEntity> xianhuaList = xianhuaService.selectBatchIds(ids);
        if(xianhuaList == null || xianhuaList.size() == 0){
            return R.error(511,"查数据库查不到数据");
        }else{
            for(XianhuaEntity w:xianhuaList){
                Integer value = w.getXianhuaKucunNumber()-map.get(String.valueOf(w.getId()));
                if(value <0){
                    return R.error(511,"出库数量大于库存数量");
                }
                w.setXianhuaKucunNumber(value);
            }
        }

        //当前表
        XianhuaChuruInoutEntity xianhuaChuruInoutEntity = new XianhuaChuruInoutEntity<>();
            xianhuaChuruInoutEntity.setXianhuaChuruInoutUuidNumber(String.valueOf(new Date().getTime()));
            if("员工".equals(role))
                xianhuaChuruInoutEntity.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
            xianhuaChuruInoutEntity.setXianhuaChuruInoutName(xianhuaChuruInoutName);
            xianhuaChuruInoutEntity.setXianhuaChuruInoutTypes(1);
            xianhuaChuruInoutEntity.setXianhuaChuruInoutContent(String.valueOf(params.get("xianhuaChuruInoutContent")));
            xianhuaChuruInoutEntity.setInsertTime(new Date());
            xianhuaChuruInoutEntity.setCreateTime(new Date());

        boolean insertXianhuaChuruInout = xianhuaChuruInoutService.insert(xianhuaChuruInoutEntity);
        if(insertXianhuaChuruInout){
            //级联表
            ArrayList<XianhuaChuruInoutListEntity> xianhuaChuruInoutLists = new ArrayList<>();
            for(String id:ids){
                XianhuaChuruInoutListEntity xianhuaChuruInoutListEntity = new XianhuaChuruInoutListEntity();
                    xianhuaChuruInoutListEntity.setXianhuaChuruInoutId(xianhuaChuruInoutEntity.getId());
                    xianhuaChuruInoutListEntity.setXianhuaId(Integer.valueOf(id));
                    xianhuaChuruInoutListEntity.setXianhuaChuruInoutListNumber(map.get(id));
                    xianhuaChuruInoutListEntity.setInsertTime(new Date());
                    xianhuaChuruInoutListEntity.setCreateTime(new Date());
                xianhuaChuruInoutLists.add(xianhuaChuruInoutListEntity);
                xianhuaService.updateBatchById(xianhuaList);
            }
            xianhuaChuruInoutListService.insertBatch(xianhuaChuruInoutLists);
        }
        return R.ok();
    }

    /**
    *入库
    */
    @RequestMapping("/inXianhuaChuruInoutList")
    public R inXianhuaChuruInoutList(@RequestBody  Map<String, Object> params,HttpServletRequest request){
        logger.debug("inXianhuaChuruInoutList方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
        //params:{"map":{"1":2,"2":3},"wuziOutinName":"订单1"}

        String role = String.valueOf(request.getSession().getAttribute("role"));

        //取当前表名称并判断
        String xianhuaChuruInoutName = String.valueOf(params.get("xianhuaChuruInoutName"));
        Wrapper<XianhuaChuruInoutEntity> queryWrapper = new EntityWrapper<XianhuaChuruInoutEntity>()
            .eq("xianhua_churu_inout_name", xianhuaChuruInoutName)
            ;
        XianhuaChuruInoutEntity xianhuaChuruInoutSelectOne = xianhuaChuruInoutService.selectOne(queryWrapper);
        if(xianhuaChuruInoutSelectOne != null)
            return R.error(511,"出入库名称已被使用");


        //取当前表的级联表并判断是否前台传入

        Map<String, Integer> map = (Map<String, Integer>) params.get("map");
        if(map == null || map.size() == 0)
            return R.error(511,"列表内容不能为空");

        Set<String> ids = map.keySet();

        List<XianhuaEntity> xianhuaList = xianhuaService.selectBatchIds(ids);
        if(xianhuaList == null || xianhuaList.size() == 0){
            return R.error(511,"查数据库查不到数据");
        }else{
            for(XianhuaEntity w:xianhuaList){
                w.setXianhuaKucunNumber(w.getXianhuaKucunNumber()+map.get(String.valueOf(w.getId())));
            }
        }

        //当前表
        XianhuaChuruInoutEntity xianhuaChuruInoutEntity = new XianhuaChuruInoutEntity<>();
            xianhuaChuruInoutEntity.setXianhuaChuruInoutUuidNumber(String.valueOf(new Date().getTime()));
            if("员工".equals(role))
                xianhuaChuruInoutEntity.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
            xianhuaChuruInoutEntity.setXianhuaChuruInoutName(xianhuaChuruInoutName);
            xianhuaChuruInoutEntity.setXianhuaChuruInoutTypes(2);
            xianhuaChuruInoutEntity.setXianhuaChuruInoutContent(String.valueOf(params.get("xianhuaChuruInoutContent")));
            xianhuaChuruInoutEntity.setInsertTime(new Date());
            xianhuaChuruInoutEntity.setCreateTime(new Date());


        boolean insertXianhuaChuruInout = xianhuaChuruInoutService.insert(xianhuaChuruInoutEntity);
        if(insertXianhuaChuruInout){
            //级联表
            ArrayList<XianhuaChuruInoutListEntity> xianhuaChuruInoutLists = new ArrayList<>();
            for(String id:ids){
                XianhuaChuruInoutListEntity xianhuaChuruInoutListEntity = new XianhuaChuruInoutListEntity();
                xianhuaChuruInoutListEntity.setXianhuaChuruInoutId(xianhuaChuruInoutEntity.getId());
                xianhuaChuruInoutListEntity.setXianhuaId(Integer.valueOf(id));
                xianhuaChuruInoutListEntity.setXianhuaChuruInoutListNumber(map.get(id));
                xianhuaChuruInoutListEntity.setInsertTime(new Date());
                xianhuaChuruInoutListEntity.setCreateTime(new Date());
                xianhuaChuruInoutLists.add(xianhuaChuruInoutListEntity);
                xianhuaService.updateBatchById(xianhuaList);
            }
            xianhuaChuruInoutListService.insertBatch(xianhuaChuruInoutLists);
        }

        return R.ok();
    }
    /**
    * 删除
    */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] ids){
        logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
        xianhuaChuruInoutService.deleteBatchIds(Arrays.asList(ids));
        xianhuaChuruInoutListService.delete(new EntityWrapper<XianhuaChuruInoutListEntity>().in("xianhua_churu_inout_id",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<XianhuaChuruInoutEntity> xianhuaChuruInoutList = 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){
                            //循环
                            XianhuaChuruInoutEntity xianhuaChuruInoutEntity = new XianhuaChuruInoutEntity();
//                            xianhuaChuruInoutEntity.setXianhuaChuruInoutUuidNumber(data.get(0));                    //出入库流水号 要改的
//                            xianhuaChuruInoutEntity.setYonghuId(Integer.valueOf(data.get(0)));   //负责人 要改的
//                            xianhuaChuruInoutEntity.setXianhuaChuruInoutName(data.get(0));                    //出入库名称 要改的
//                            xianhuaChuruInoutEntity.setXianhuaChuruInoutTypes(Integer.valueOf(data.get(0)));   //出入库类型 要改的
//                            xianhuaChuruInoutEntity.setXianhuaChuruInoutContent("");//详情和图片
//                            xianhuaChuruInoutEntity.setInsertTime(date);//时间
//                            xianhuaChuruInoutEntity.setCreateTime(date);//时间
                            xianhuaChuruInoutList.add(xianhuaChuruInoutEntity);


                            //把要查询是否重复的字段放入map中
                                //出入库流水号
                                if(seachFields.containsKey("xianhuaChuruInoutUuidNumber")){
                                    List<String> xianhuaChuruInoutUuidNumber = seachFields.get("xianhuaChuruInoutUuidNumber");
                                    xianhuaChuruInoutUuidNumber.add(data.get(0));//要改的
                                }else{
                                    List<String> xianhuaChuruInoutUuidNumber = new ArrayList<>();
                                    xianhuaChuruInoutUuidNumber.add(data.get(0));//要改的
                                    seachFields.put("xianhuaChuruInoutUuidNumber",xianhuaChuruInoutUuidNumber);
                                }
                        }

                        //查询是否重复
                         //出入库流水号
                        List<XianhuaChuruInoutEntity> xianhuaChuruInoutEntities_xianhuaChuruInoutUuidNumber = xianhuaChuruInoutService.selectList(new EntityWrapper<XianhuaChuruInoutEntity>().in("xianhua_churu_inout_uuid_number", seachFields.get("xianhuaChuruInoutUuidNumber")));
                        if(xianhuaChuruInoutEntities_xianhuaChuruInoutUuidNumber.size() >0 ){
                            ArrayList<String> repeatFields = new ArrayList<>();
                            for(XianhuaChuruInoutEntity s:xianhuaChuruInoutEntities_xianhuaChuruInoutUuidNumber){
                                repeatFields.add(s.getXianhuaChuruInoutUuidNumber());
                            }
                            return R.error(511,"数据库的该表中的 [出入库流水号] 字段已经存在 存在数据为:"+repeatFields.toString());
                        }
                        xianhuaChuruInoutService.insertBatch(xianhuaChuruInoutList);
                        return R.ok();
                    }
                }
            }
        }catch (Exception e){
            e.printStackTrace();
            return R.error(511,"批量插入数据异常,请联系管理员");
        }
    }






}

获取源码或论文

如需对应的论文或源码,以及其他定制需求,也可以下方微❤联系。

;