基于java+springboot+vue的药店管理系统

项目介绍

传统信息的管理大部分依赖于管理人员的手工登记与管理,然而,随着近些年信息技术的迅猛发展,让许多比较老套的信息管理模式进行了更新迭代,药品信息因为其管理内容繁杂,管理数量繁多导致手工进行处理不能满足广大用户的需求,因此就应运而生出相应的药店管理系统。

本药店管理系统分为管理员还有用户两个权限,管理员可以管理用户的基本信息内容,可以管理供应商信息以及供应商的租赁信息,能够与用户进行相互交流等操作,用户可以查看药品信息,可以查看供应商以及查看管理员回复信息等操作。

该药店管理系统采用的是WEB应用程序开发中最受欢迎的B/S三层结构模式,使用占用空间小但功能齐全的MySQL数据库进行数据的存储操作,系统开发技术使用到了Vue技术。该药店管理系统能够解决许多传统手工操作的难题,比如数据查询耽误时间长,数据管理步骤繁琐等问题。总的来说,药店管理系统性能稳定,功能较全,投入运行使用性价比很高。

在这里插入图片描述

开发环境

编程语言:Java
数据库 :Mysql
系统架构:B/S
后端框架:SpringBoot
编译工具:idea或者eclipse,jdk1.8,maven
支持定做:java/php/python/android/小程序vue/爬虫/c#/asp.net

系统实现

5.1 管理员功能模块的实现
5.1.1 药品列表
如图5.1显示的就是药品列表页面,此页面提供给管理员的功能有:查看药品、新增药品、修改药品、删除药品等。
在这里插入图片描述

图5.1 药品列表页面

5.1.2 供应商信息管理
管理员可以对前台的注册用户的基本信息进行管理,可以设置注册用户的账号为冻结或者是在用状态,管理员也能选择很多个已经失效的注册用户的信息进行批量删除操作。注册用户管理界面如图5.2所示。
在这里插入图片描述

图5.2 供应商信息管理页面

5.1.3 供应商类型管理
供应商类型管理页面显示所有供应商类型,在此页面既可以让管理员添加新的供应商信息类型,也能对已有的供应商类型信息执行编辑更新,失效的供应商类型信息也能让管理员快速删除。下图就是供应商类型管理页面。供应商类型管理界面如图5.3所示。
在这里插入图片描述

图5.3供应商类型管理界面

核心代码

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

    @Autowired
    private XiaoshouService xiaoshouService;


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

    //级联表service
    @Autowired
    private YaopinService yaopinService;
    @Autowired
    private YuangongService yuangongService;



    /**
    * 后端列表
    */
    @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("yuangongId",request.getSession().getAttribute("userId"));
        if(params.get("orderBy")==null || params.get("orderBy")==""){
            params.put("orderBy","id");
        }
        PageUtils page = xiaoshouService.queryPage(params);

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

                //级联表
                YaopinEntity yaopin = yaopinService.selectById(xiaoshou.getYaopinId());
                if(yaopin != null){
                    BeanUtils.copyProperties( yaopin , view ,new String[]{ "id", "createTime", "insertTime", "updateTime"});//把级联的数据添加到view中,并排除id和创建时间字段
                    view.setYaopinId(yaopin.getId());
                }
                //级联表
                YuangongEntity yuangong = yuangongService.selectById(xiaoshou.getYuangongId());
                if(yuangong != null){
                    BeanUtils.copyProperties( yuangong , view ,new String[]{ "id", "createTime", "insertTime", "updateTime"});//把级联的数据添加到view中,并排除id和创建时间字段
                    view.setYuangongId(yuangong.getId());
                }
            //修改对应字典表字段
            dictionaryService.dictionaryConvert(view, request);
            return R.ok().put("data", view);
        }else {
            return R.error(511,"查不到数据");
        }

    }

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

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



        YaopinEntity yaopinEntity = yaopinService.selectById(xiaoshou.getYaopinId());
        if(yaopinEntity == null)
            return R.error("查不到药品");
        else if(yaopinEntity.getYaopinKucunNumber() == null)
            return R.error("查不到该药品的库存");
        else if((yaopinEntity.getYaopinKucunNumber()-xiaoshou.getXiaoshouShuliangNumber()) <0)
            return R.error("销售数量不能大于库存数量");
        yaopinEntity.setYaopinKucunNumber(yaopinEntity.getYaopinKucunNumber()-xiaoshou.getXiaoshouShuliangNumber());
        yaopinService.updateById(yaopinEntity);

            xiaoshou.setInsertTime(new Date());
            xiaoshou.setCreateTime(new Date());
            xiaoshouService.insert(xiaoshou);
            return R.ok();

    }

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

        String role = String.valueOf(request.getSession().getAttribute("role"));
//        if(false)
//            return R.error(511,"永远不会进入");
//        else if("员工".equals(role))
//            xiaoshou.setYuangongId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
        //根据字段查询是否有相同数据
        Wrapper<XiaoshouEntity> queryWrapper = new EntityWrapper<XiaoshouEntity>()
            .notIn("id",xiaoshou.getId())
            .andNew()
            .eq("xiaoshou_uuid_number", xiaoshou.getXiaoshouUuidNumber())
            .eq("yaopin_id", xiaoshou.getYaopinId())
            .eq("yuangong_id", xiaoshou.getYuangongId())
            .eq("xiaoshou_shuliang_number", xiaoshou.getXiaoshouShuliangNumber())
            ;

        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        XiaoshouEntity xiaoshouEntity = xiaoshouService.selectOne(queryWrapper);
        if(xiaoshouEntity==null){
            xiaoshouService.updateById(xiaoshou);//根据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());
        xiaoshouService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }


    /**
     * 批量上传
     */
    @RequestMapping("/batchInsert")
    public R save( String fileName){
        logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);
        try {
            List<XiaoshouEntity> xiaoshouList = 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){
                            //循环
                            XiaoshouEntity xiaoshouEntity = new XiaoshouEntity();
//                            xiaoshouEntity.setXiaoshouUuidNumber(data.get(0));                    //销售编号 要改的
//                            xiaoshouEntity.setYaopinId(Integer.valueOf(data.get(0)));   //药品 要改的
//                            xiaoshouEntity.setYuangongId(Integer.valueOf(data.get(0)));   //员工 要改的
//                            xiaoshouEntity.setXiaoshouShuliangNumber(Integer.valueOf(data.get(0)));   //销售数量 要改的
//                            xiaoshouEntity.setXiaoshouContent("");//照片
//                            xiaoshouEntity.setXiaoshouTime(new Date(data.get(0)));          //销售时间 要改的
//                            xiaoshouEntity.setInsertTime(date);//时间
//                            xiaoshouEntity.setCreateTime(date);//时间
                            xiaoshouList.add(xiaoshouEntity);


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

                        //查询是否重复
                         //销售编号
                        List<XiaoshouEntity> xiaoshouEntities_xiaoshouUuidNumber = xiaoshouService.selectList(new EntityWrapper<XiaoshouEntity>().in("xiaoshou_uuid_number", seachFields.get("xiaoshouUuidNumber")));
                        if(xiaoshouEntities_xiaoshouUuidNumber.size() >0 ){
                            ArrayList<String> repeatFields = new ArrayList<>();
                            for(XiaoshouEntity s:xiaoshouEntities_xiaoshouUuidNumber){
                                repeatFields.add(s.getXiaoshouUuidNumber());
                            }
                            return R.error(511,"数据库的该表中的 [销售编号] 字段已经存在 存在数据为:"+repeatFields.toString());
                        }
                        xiaoshouService.insertBatch(xiaoshouList);
                        return R.ok();
                    }
                }
            }
        }catch (Exception e){
            return R.error(511,"批量插入数据异常,请联系管理员");
        }
    }






}

论文参考

在这里插入图片描述

目 录
摘 要 I
Abstract II
目 录 III
第一章 课题背景及研究内容 1
1.1 课题背景 1
1.2 开发目的和意义 1
1.3 论文研究内容 1
第二章 相关技术 3
2.1 B/S结构 3
2.2 MySQL数据库 3
第三章 系统分析 5
3.1可行性分析 5
3.1.1时间可行性 5
3.1.2 经济可行性 5
3.1.3 操作可行性 5
3.1.4 技术可行性 5
3.1.5 法律可行性 5
3.2系统流程分析 6
3.3系统功能需求分析 7
3.4 系统非功能需求分析 7
第四章 系统设计 9
4.1 总体功能 9
4.2 系统模块设计 9
4.3 数据库设计 10
4.3.1 数据库设计 10
4.3.2 数据库E-R 图 10
4.3.3 数据库表设计 11
第五章 系统实现 14
5.1 管理员功能模块的实现 14
5.1.1 药品列表 14
5.1.2 供应商信息管理 14
5.1.3 供应商类型管理 15
第六章 系统测试 16
6.1软件测试 16
6.2测试环境 17
6.3 测试用例 17
6.3.1 用户登录测试 17
6.4.2 添加供应商类别测试 17
6.5测试结果 17
结 论 18
参考文献 20
致 谢 21

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

qq_3306428634

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值