Java毕业设计-基于SSM框架的仓库在线管理系统项目实战(附源码+论文)

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

💞当前专栏: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/89292509

论文目录

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

一、项目简介

本次使用Java技术开发的仓库在线管理系统,就是运用计算机来管理仓库物品出入库信息,该系统是可以实现物品管理,出入库管理,公告管理,供货方管理,员工管理等功能。

二、系统设计

2.1软件功能模块设计

本小节运用功能结构图来描述管理员具备的详细的功能,对管理员的功能结构图绘制结果如图4.1所示。管理员对员工信息,物品信息,公告信息,出入库信息等信息的管理。
在这里插入图片描述
本小节运用功能结构图来描述员工具备的详细的功能,对员工的功能结构图绘制结果如图4.2所示。员工查看物品,查看公告,对物品进行入库操作或出库操作,查询物品出入库明细信息。
在这里插入图片描述

2.2数据库设计

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

三、系统项目部分截图

3.1管理员功能实现

物品信息管理
管理员点击导航栏的物品信息管理链接就进入物品信息管理界面。物品信息管理界面如图5.1所示。本功能允许管理员对物品的基本资料进行修改,添加,查询,删除。
在这里插入图片描述
员工管理
管理员点击导航栏的员工管理链接就进入员工管理界面。员工管理界面如图5.2所示。本功能允许管理员对员工基础资料进行修改,查询,添加,删除。
在这里插入图片描述

3.2员工功能实现

物品信息查看
员工在物品信息查看界面可以对物品的信息进行查询和查看。物品信息查看界面如图5.4所示。员工需要了解各个物品的库存以及供货方等信息。
在这里插入图片描述
出入库管理
员工点击导航栏的出入库管理链接就进入出入库管理界面。出入库管理界面如图5.5所示。本功能允许员工对物品进行入库,对物品进行出库等操作。
在这里插入图片描述

四、部分核心代码


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

    @Autowired
    private ShangpinChuruInoutService shangpinChuruInoutService;


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

    //级联表service

    // 列表详情的表级联service
    @Autowired
    private ShangpinChuruInoutListService shangpinChuruInoutListService;
//    @Autowired
//    private YonghuService yonghuService;
    @Autowired
    private ShangpinService shangpinService;
    @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 = shangpinChuruInoutService.queryPage(params);

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

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

    }

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

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

        Wrapper<ShangpinChuruInoutEntity> queryWrapper = new EntityWrapper<ShangpinChuruInoutEntity>()
            .eq("shangpin_churu_inout_uuid_number", shangpinChuruInout.getShangpinChuruInoutUuidNumber())
            .eq("shangpin_churu_inout_name", shangpinChuruInout.getShangpinChuruInoutName())
            .eq("shangpin_churu_inout_types", shangpinChuruInout.getShangpinChuruInoutTypes())
            .eq("shangpin_danwei", shangpinChuruInout.getShangpinDanwei())
            .eq("shangpin_jingshouren", shangpinChuruInout.getShangpinJingshouren())
            ;

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

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

        String role = String.valueOf(request.getSession().getAttribute("role"));
//        if(false)
//            return R.error(511,"永远不会进入");
        //根据字段查询是否有相同数据
        Wrapper<ShangpinChuruInoutEntity> queryWrapper = new EntityWrapper<ShangpinChuruInoutEntity>()
            .notIn("id",shangpinChuruInout.getId())
            .andNew()
            .eq("shangpin_churu_inout_uuid_number", shangpinChuruInout.getShangpinChuruInoutUuidNumber())
            .eq("shangpin_churu_inout_name", shangpinChuruInout.getShangpinChuruInoutName())
            .eq("shangpin_churu_inout_types", shangpinChuruInout.getShangpinChuruInoutTypes())
            .eq("shangpin_danwei", shangpinChuruInout.getShangpinDanwei())
            .eq("shangpin_jingshouren", shangpinChuruInout.getShangpinJingshouren())
            ;

        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        ShangpinChuruInoutEntity shangpinChuruInoutEntity = shangpinChuruInoutService.selectOne(queryWrapper);
        if(shangpinChuruInoutEntity==null){
            shangpinChuruInoutService.updateById(shangpinChuruInout);//根据id更新
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }
    /**
    * 出库
    */
    @RequestMapping("/outShangpinChuruInoutList")
    public R outShangpinChuruInoutList(@RequestBody  Map<String, Object> params,HttpServletRequest request){
        logger.debug("outShangpinChuruInoutList方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));

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

        //取出入库名称并判断是否存在
        String shangpinChuruInoutName = String.valueOf(params.get("shangpinChuruInoutName"));
        Wrapper<ShangpinChuruInoutEntity> queryWrapper = new EntityWrapper<ShangpinChuruInoutEntity>()
            .eq("shangpin_churu_inout_name", shangpinChuruInoutName)
            ;
        ShangpinChuruInoutEntity shangpinChuruInoutSelectOne = shangpinChuruInoutService.selectOne(queryWrapper);
        if(shangpinChuruInoutSelectOne != 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<ShangpinEntity> shangpinList = shangpinService.selectBatchIds(ids);
        if(shangpinList == null || shangpinList.size() == 0){
            return R.error(511,"查数据库查不到数据");
        }else{
            for(ShangpinEntity w:shangpinList){
                Integer value = w.getShangpinKucunNumber()-map.get(String.valueOf(w.getId()));
                if(value <0){
                    return R.error(511,"出库数量大于库存数量");
                }
                w.setShangpinKucunNumber(value);
            }
        }

        //当前表
        ShangpinChuruInoutEntity shangpinChuruInoutEntity = new ShangpinChuruInoutEntity<>();
            shangpinChuruInoutEntity.setShangpinChuruInoutUuidNumber(String.valueOf(new Date().getTime()));
            shangpinChuruInoutEntity.setShangpinChuruInoutName(shangpinChuruInoutName);
            shangpinChuruInoutEntity.setShangpinChuruInoutTypes(1);
            shangpinChuruInoutEntity.setShangpinDanwei(String.valueOf(params.get("shangpinDanwei")));//???????????????
            shangpinChuruInoutEntity.setShangpinJingshouren(String.valueOf(params.get("shangpinJingshouren")));//???????????????
            shangpinChuruInoutEntity.setShangpinChuruInoutContent("");
            shangpinChuruInoutEntity.setInsertTime(new Date());
            shangpinChuruInoutEntity.setCreateTime(new Date());

        boolean insertShangpinChuruInout = shangpinChuruInoutService.insert(shangpinChuruInoutEntity);
        if(insertShangpinChuruInout){
            //级联表
            ArrayList<ShangpinChuruInoutListEntity> shangpinChuruInoutLists = new ArrayList<>();
            for(String id:ids){
                ShangpinChuruInoutListEntity shangpinChuruInoutListEntity = new ShangpinChuruInoutListEntity();
                    shangpinChuruInoutListEntity.setShangpinChuruInoutId(shangpinChuruInoutEntity.getId());
                    shangpinChuruInoutListEntity.setShangpinId(Integer.valueOf(id));
                    shangpinChuruInoutListEntity.setShangpinChuruInoutListNumber(map.get(id));
                    shangpinChuruInoutListEntity.setInsertTime(new Date());
                    shangpinChuruInoutListEntity.setCreateTime(new Date());
                shangpinChuruInoutLists.add(shangpinChuruInoutListEntity);
                shangpinService.updateBatchById(shangpinList);
            }
            shangpinChuruInoutListService.insertBatch(shangpinChuruInoutLists);
        }
        return R.ok();
    }

    /**
    *入库
    */
    @RequestMapping("/inShangpinChuruInoutList")
    public R inShangpinChuruInoutList(@RequestBody  Map<String, Object> params,HttpServletRequest request){
        logger.debug("inShangpinChuruInoutList方法:,,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 shangpinChuruInoutName = String.valueOf(params.get("shangpinChuruInoutName"));
        Wrapper<ShangpinChuruInoutEntity> queryWrapper = new EntityWrapper<ShangpinChuruInoutEntity>()
            .eq("shangpin_churu_inout_name", shangpinChuruInoutName)
            ;
        ShangpinChuruInoutEntity shangpinChuruInoutSelectOne = shangpinChuruInoutService.selectOne(queryWrapper);
        if(shangpinChuruInoutSelectOne != 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<ShangpinEntity> shangpinList = shangpinService.selectBatchIds(ids);
        if(shangpinList == null || shangpinList.size() == 0){
            return R.error(511,"查数据库查不到数据");
        }else{
            for(ShangpinEntity w:shangpinList){
                w.setShangpinKucunNumber(w.getShangpinKucunNumber()+map.get(String.valueOf(w.getId())));
            }
        }

        //当前表
        ShangpinChuruInoutEntity shangpinChuruInoutEntity = new ShangpinChuruInoutEntity<>();
            shangpinChuruInoutEntity.setShangpinChuruInoutUuidNumber(String.valueOf(new Date().getTime()));
            shangpinChuruInoutEntity.setShangpinChuruInoutName(shangpinChuruInoutName);
            shangpinChuruInoutEntity.setShangpinChuruInoutTypes(2);
            shangpinChuruInoutEntity.setShangpinDanwei(String.valueOf(params.get("shangpinDanwei")));//?????????????????
            shangpinChuruInoutEntity.setShangpinJingshouren(String.valueOf(params.get("shangpinJingshouren")));//?????????????????
            shangpinChuruInoutEntity.setShangpinChuruInoutContent("");
            shangpinChuruInoutEntity.setInsertTime(new Date());
            shangpinChuruInoutEntity.setCreateTime(new Date());


        boolean insertShangpinChuruInout = shangpinChuruInoutService.insert(shangpinChuruInoutEntity);
        if(insertShangpinChuruInout){
            //级联表
            ArrayList<ShangpinChuruInoutListEntity> shangpinChuruInoutLists = new ArrayList<>();
            for(String id:ids){
                ShangpinChuruInoutListEntity shangpinChuruInoutListEntity = new ShangpinChuruInoutListEntity();
                shangpinChuruInoutListEntity.setShangpinChuruInoutId(shangpinChuruInoutEntity.getId());
                shangpinChuruInoutListEntity.setShangpinId(Integer.valueOf(id));
                shangpinChuruInoutListEntity.setShangpinChuruInoutListNumber(map.get(id));
                shangpinChuruInoutListEntity.setInsertTime(new Date());
                shangpinChuruInoutListEntity.setCreateTime(new Date());
                shangpinChuruInoutLists.add(shangpinChuruInoutListEntity);
                shangpinService.updateBatchById(shangpinList);
            }
            shangpinChuruInoutListService.insertBatch(shangpinChuruInoutLists);
        }

        return R.ok();
    }
    /**
    * 删除
    */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] ids){
        logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
        shangpinChuruInoutService.deleteBatchIds(Arrays.asList(ids));
        shangpinChuruInoutListService.delete(new EntityWrapper<ShangpinChuruInoutListEntity>().in("shangpin_churu_inout_id",ids));
        return R.ok();
    }


    /**
     * 批量上传
     */
    @RequestMapping("/batchInsert")
    public R save( String fileName){
        logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);
        try {
            List<ShangpinChuruInoutEntity> shangpinChuruInoutList = 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){
                            //循环
                            ShangpinChuruInoutEntity shangpinChuruInoutEntity = new ShangpinChuruInoutEntity();
//                            shangpinChuruInoutEntity.setShangpinChuruInoutUuidNumber(data.get(0));                    //出入库流水号 要改的
//                            shangpinChuruInoutEntity.setShangpinChuruInoutName(data.get(0));                    //出入库名称 要改的
//                            shangpinChuruInoutEntity.setShangpinChuruInoutTypes(Integer.valueOf(data.get(0)));   //出入库类型 要改的
//                            shangpinChuruInoutEntity.setShangpinDanwei(data.get(0));                    //收货单位 要改的
//                            shangpinChuruInoutEntity.setShangpinJingshouren(data.get(0));                    //经手人 要改的
//                            shangpinChuruInoutEntity.setShangpinChuruInoutContent("");//照片
//                            shangpinChuruInoutEntity.setInsertTime(date);//时间
//                            shangpinChuruInoutEntity.setCreateTime(date);//时间
                            shangpinChuruInoutList.add(shangpinChuruInoutEntity);


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

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






}

获取源码或论文

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值