Java项目:springboot医药进销存管理系统

作者主页:夜未央5788

 简介:Java领域优质创作者、Java项目、学习资料、技术互助

文末获取源码

功能介绍

医药进销存系统,主要分两种角色:员工、客户。本系统具有进销存系统的通用性,可以修改为其它进销存系统,如家电进销存、手机进销存等;

员工登录后主要功能模块有:
我的面板:个人信息、修改信息、修改密码;
员工管理:员工添加、员工查询;
药品管理:药品类别添加、药品类别查询、药品添加、药品查询;
客户管理:客户查询;
供货商管理:供货商添加、供货商查询;
账单管理:进货添加、进货查询、退货账单、销售账单查询;
客户登录后主要功能模块有:
我的面板:个人信息、修改信息、修改密码;

购买药品:药品展示、已购药品;

环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。

2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
5.是否Maven项目: 是;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目 

6.数据库:MySql 5.7版本;

系统框架

1.后端:SpringBoot

2.前端:HTML+Echarts+JQuery

使用说明

1. 使用IDEA/Eclipse/MyEclipse导入后端项目源码,Eclipse/MyEclipse导入时,若为maven项目请选择maven;

若为maven项目,导入成功后请执行maven clean;maven install命令,配置tomcat,然后运行;

2. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
3. 运行项目前,需要配置好MqSQL数据库,在application.properties中修改数据库对应的配置文件;
4. 配置Tomcat,在Tomcat中运行后端项目;
5. 运行成功后,在浏览器中访问:http://localhost:8888
6. 客户和员工对应数据库表t_customers和t_employees表,用户名是手机号,密码也是对应的手机号
客户账号:15133480838 密码:15133480838

员工账号:15133330551 密码:15133330551

运行截图

功能介绍

医药进销存系统,主要分两种角色:员工、客户。本系统具有进销存系统的通用性,可以修改为其它进销存系统,如家电进销存、手机进销存等;

员工登录后主要功能模块有:
我的面板:个人信息、修改信息、修改密码;
员工管理:员工添加、员工查询;
药品管理:药品类别添加、药品类别查询、药品添加、药品查询;
客户管理:客户查询;
供货商管理:供货商添加、供货商查询;
账单管理:进货添加、进货查询、退货账单、销售账单查询;
客户登录后主要功能模块有:
我的面板:个人信息、修改信息、修改密码;

购买药品:药品展示、已购药品;

演示视频:点此查看

由于本程序规模不大,可供课程设计,毕业设计学习演示之用

更多项目源码,请到“源码空间站”,地址:http://www.shuyue.fun/

环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。

2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
5.是否Maven项目: 是;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目 

6.数据库:MySql 5.7版本;

系统框架

1.后端:SpringBoot

2.前端:HTML+Echarts+JQuery

使用说明

1. 使用IDEA/Eclipse/MyEclipse导入后端项目源码,Eclipse/MyEclipse导入时,若为maven项目请选择maven;

若为maven项目,导入成功后请执行maven clean;maven install命令,配置tomcat,然后运行;

2. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
3. 运行项目前,需要配置好MqSQL数据库,在application.properties中修改数据库对应的配置文件;
4. 配置Tomcat,在Tomcat中运行后端项目;
5. 运行成功后,在浏览器中访问:http://localhost:8888
6. 客户和员工对应数据库表t_customers和t_employees表,用户名是手机号,密码也是对应的手机号
客户账号:15133480838 密码:15133480838

员工账号:15133330551 密码:15133330551

运行截图

 

 

 

 

 

 

 

 

 代码相关

用户管理控制器

@RestController		//相当于配置文件(Controller,ResponseBody)
@RequestMapping("/customer")
public class CustomerController extends BaseController {
	@Autowired	//自动装配
	private ICustomerService customerService;
	
	/**
	 * 注册用户
	 * @param user
	 * @return	返回成功
	 */
	@RequestMapping("/reg")
	public ResponseResult<Void> reg(Customer customer) {
		customerService.reg(customer);
		return new ResponseResult<Void>(SUCCESS);
	}
	
	/**
	 * 登录
	 * @param username
	 * @param password
	 * @return
	 */
	@PostMapping("/login")
	public ResponseResult<Customer> login(String phone,String password,HttpSession session) {
		Customer customer = customerService.getloginCustomer(phone, password);
		session.setAttribute( "user", customer );
		session.setAttribute( "uid", customer.getUid());
		session.setAttribute( "username", customer.getUsername() );
		return new ResponseResult<Customer>(SUCCESS,customer);
	}
	
	/**
	 * 查询客户数据,多条件查询
	 * @param drugCategory
	 * @return
	 * @throws JsonProcessingException 
	 */
	@RequestMapping("/selectCustomer")
	public ResponseResult<PaginationVO<Customer>> selectCustomer
	(String username,String gender,String address,String pageNoStr,String pageSizeStr) throws JsonProcessingException {
		//获取参数
		long pageNo = 1;	//如果没有传数据,默认为第一页
		if( pageNoStr != null && pageNoStr.trim().length()>0 ){
			pageNo = Long.parseLong(pageNoStr);
		}
		int pageSize = 1;	//如果没有传数据,默认为10条数据
		if( pageSizeStr != null && pageSizeStr.trim().length()>0 ){
			pageSize = Integer.parseInt(pageSizeStr);
		}
		long beginNo = (pageNo-1)*pageSize;
		Map<String ,Object> map = new HashMap<String ,Object>();
		map.put("beginNo", beginNo);
		map.put("pageSize", pageSize);
		map.put("username", username);
		map.put("gender", gender);
		map.put("address", address);
		PaginationVO<Customer> vo = customerService.getSelectCustomer(map);
		return new ResponseResult<PaginationVO<Customer>>(SUCCESS,vo);
	}
	
	/**
	 * 删除客户数据
	 * @param uid
	 * @param session
	 * @return
	 */
	@RequestMapping("/deleteCustomer")
	public ResponseResult<Void> deleteCustomer(Integer uid,HttpSession session){
		String username = (String) session.getAttribute("username");
		customerService.getdeleteId(uid, username);
		return new ResponseResult<Void>(SUCCESS);
	}
	
	/**
	 * 修改客户数据
	 */
	@RequestMapping("/updateCustomer")
	public ResponseResult<Void> updateCustomer(Customer customer,HttpSession session){
		String username = (String) session.getAttribute("username");
		customerService.getupdateCustomer(customer, username);
		return new ResponseResult<Void>(SUCCESS);
	}
	
	/**
	 * 展示个人信息
	 */
	@RequestMapping("/getfindByUid")
	public ResponseResult<Customer> getfindByUid(Integer uid){
		Customer customer = customerService.getfindByUid(uid);
		return new ResponseResult<Customer>(SUCCESS,customer);
	}
	
	/**
	 * 修改密码
	 */
	@RequestMapping("/getfindByUidPassword")
	public ResponseResult<Void> getfindByUidPassword(Integer uid,HttpSession session,String oldPassword,String newPassword){
		String username = (String) session.getAttribute("username");
		customerService.getfindByUidPassword(uid, username, oldPassword, newPassword);
		return new ResponseResult<Void>(SUCCESS);
	}
	
	/**
	 * 上传头像
	 * @param request
	 * @param file
	 * @return MultipartFile file
	 */
	@RequestMapping("/change_avatar")
	public ResponseResult<String> changeAvatar(HttpServletRequest request,@RequestParam("file") MultipartFile file){
		if(file.isEmpty()) {
			throw new FileEmptyException("上传头像错误!上传文件不能为空!");
		}
		if(!UPLOAD_CONTENT_TYPE.contains(file.getContentType())) {
			throw new FileContentTypeException("上传头像错误!不支持所选的文件类型!");
		}
		if(file.getSize()>UPLOAD_MAX_SIZE) {
			throw new FileSizeException("上传文件过大!请选择小于"+UPLOAD_MAX_SIZE+"的文件!");
		}
		String parentPath = request.getServletContext().getRealPath(UPLOAD_DIR);
		File parent = new File(parentPath);
		if(!parent.exists()) {
			parent.mkdirs();
		}
		String originalFilename = file.getOriginalFilename();
		//使用系统纳秒值给头像命名
		//String prefic = System.nanoTime()+"";
		//使用uid+username为头像文件命名,新头像会将旧头像替换
		HttpSession session = request.getSession();
		String prefic = session.getAttribute("uid").toString()+session.getAttribute("username").toString();
		int beginIndex = originalFilename.lastIndexOf(".");
		String suffix = "";
		if(beginIndex > 0) {
			suffix = originalFilename.substring(beginIndex);
		}
		String filename = prefic+suffix;
		File dest = new File(parent,filename);
		try {
			file.transferTo(dest);
		} catch (IllegalStateException e) {
			e.printStackTrace();
			throw new FileIllegalStateException("上传头像错误!存储头像文件时状态异常!");
		} catch (IOException e) {
			e.printStackTrace();
			throw new FileIOException("上传头像错误!读写文件时出现错误!");
		}
		Integer uid = getUidFromSession(session);
		String avatar = "/"+UPLOAD_DIR+"/"+filename;
		
		customerService.changeAvatar(avatar,uid);
		return new ResponseResult<String>(SUCCESS,avatar);
	}
	
	/**
	 * 查询客户的数量
	 */
	@RequestMapping("/selectIdCount")
	public ResponseResult<Long> selectIdCount(){
		Long count = customerService.getselectIdCount();
		return new ResponseResult<Long>(SUCCESS,count);
	}
	
	/**
	 * 图表展示,客户流量,输入年份,展示该年每一个月的客户注册量
	 * @param createdTime
	 * @return
	 */
	@RequestMapping("/selectYearTime")
	public ResponseResult<List<CustomerTime>> selectYearTime(String createdTime){
		String str = createdTime.substring(0, createdTime.indexOf("-"));
		Map<String,Object> map = new HashMap<String,Object>();
		map.put("createdTime", str);
		List<CustomerTime> customerTimeList = customerService.getselectYearMonth(map);
		return new ResponseResult<List<CustomerTime>>(SUCCESS,customerTimeList);
	}
	
}

药品管理控制器

@RestController
@RequestMapping("/drug")
public class DrugController extends BaseController{
	@Autowired	//自动装配
	private IDrugService drugService;
	@Autowired //自动装配 
	private IDrugCategoryService drugCategoryService;
	
	/**
	 * 添加数据。药品类别信息
	 * @param user
	 * @return	返回成功
	 */
	@RequestMapping("/addDrug")
	public ResponseResult<Void> addDrug(Drug drug,HttpSession session) {
		String username = (String) session.getAttribute("username");
		drugService.addDrug(drug, username);
		return new ResponseResult<Void>(SUCCESS);
	}
	
	/**
	 * 为添加药品时,药品类别选择所设计
	 * @return
	 */
	@RequestMapping("/selectDrugCategory")
	public ResponseResult<List<DrugCategory>> selectDrugCategory(){
		List<DrugCategory> list = drugCategoryService.getfindByCategoryIdCategoryName();
		return new ResponseResult<List<DrugCategory>>(SUCCESS,list);
	}
	
	/**
	 * 查询药品数据(关联查询)药品类别表,后期改为多条件查询
	 * @param drugCategory
	 * @return
	 * @throws JsonProcessingException 
	 */
	@RequestMapping("/selectDrug")
	public ResponseResult<PaginationVO<DrugANDDrugCategory>> selectDrug(String drugName,String unit,String origin,Integer categoryId,String pageNoStr,String pageSizeStr) throws JsonProcessingException {
		//获取参数
		long pageNo = 1;	//如果没有传数据,默认为第一页
		if( pageNoStr != null && pageNoStr.trim().length()>0 ){
			pageNo = Long.parseLong(pageNoStr);
		}
		int pageSize = 1;	//如果没有传数据,默认为10条数据
		if( pageSizeStr != null && pageSizeStr.trim().length()>0 ){
			pageSize = Integer.parseInt(pageSizeStr);
		}
		long beginNo = (pageNo-1)*pageSize;
		Map<String ,Object> map = new HashMap<String ,Object>();
		map.put("drugName", drugName);
		map.put("unit", unit);
		map.put("origin", origin);
		map.put("beginNo", beginNo);
		map.put("categoryId", categoryId);
		map.put("pageSize", pageSize);
		PaginationVO<DrugANDDrugCategory> vo = drugService.getselectDrug(map);
		return new ResponseResult<PaginationVO<DrugANDDrugCategory>>(SUCCESS,vo);
	}
	
	/**
	 * 根据uid查询药品全部数据
	 * @param uid
	 * @return
	 */
	@RequestMapping("/findId")
	public ResponseResult<Drug> getfindId(Integer id){
		Drug data = drugService.getfindId(id);
		return new ResponseResult<Drug>(SUCCESS,data);
	};
	
	/**
	 * 修改药品数据
	 * @param drug
	 * @param session
	 * @return
	 */
	@RequestMapping("/updateIdDrug")
	public ResponseResult<Void> updateIdDrug(Drug drug,HttpSession session) {
		String username = (String) session.getAttribute("username");
		drugService.getupdateIdDrug(drug, username);
		return new ResponseResult<Void>(SUCCESS);
	}
	
	/**
	 * 根据id删除药品数据
	 * @param id
	 * @param session
	 * @return
	 */
	@RequestMapping("/deleteIdDrug")
	public ResponseResult<Void> deleteIdDrug(String id,HttpSession session) {
		String[] ids = id.split(",");
		String username = (String) session.getAttribute("username");
		drugService.getdeleteIdDrug(ids, username);
		return new ResponseResult<Void>(SUCCESS);
	}
	
	
	/**
	 * 查询药品的数量
	 */
	@RequestMapping("/selectIdCount")
	public ResponseResult<Long> selectIdCount(){
		Long count = drugService.getselectIdCount();
		return new ResponseResult<Long>(SUCCESS,count);
	}
	
}

如果也想学习本系统,下面领取。回复:037springboot

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

夜未央5788

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

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

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

打赏作者

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

抵扣说明:

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

余额充值