文章目录
- 快递物流仓库管理系统
- 一、项目演示
- 二、项目介绍
- 三、部分功能截图
- 四、部分代码展示
- 五、底部获取项目源码(9.9¥带走)
快递物流仓库管理系统
一、项目演示
快递物流仓库管理系统
二、项目介绍
语言: Java 数据库:MySQL 前后端分离
前端技术 : Vue2 + ElementUl
后端技术 : SpringBoot2 + MyBatisPlus
登录注册
基础管理:商品管理、员工管理、仓库管理
销售管理:销售开票、销售记录
配送管理:申请配送、配送列表
运输管理:车辆资料、驾驶员资料
图表分析:入库分析、出库分析
系统管理:安全设置、操作员管理、权限列表
日志管理:登录日志、操作日志
三、部分功能截图
四、部分代码展示
package com.example.api.controller;import com.example.api.exception.AccountAndPasswordError;
import com.example.api.model.dto.LoginDto;
import com.example.api.model.entity.Admin;
import com.example.api.model.entity.LoginLog;
import com.example.api.model.enums.Role;
import com.example.api.model.support.ResponseResult;
import com.example.api.repository.AdminRepository;
import com.example.api.service.AdminService;
import com.example.api.service.LoginLogService;
import com.example.api.utils.JwtTokenUtil;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/api/admin")
@Slf4j
public class AdminController {//获取日志对象Logger logger = LoggerFactory.getLogger(AdminController.class);@Resourceprivate AdminService adminService;@Resourceprivate AdminRepository adminRepository;@Resourceprivate LoginLogService loginLogService;@GetMapping("hasInit")public boolean hasInit() {return adminRepository.existsAdminByRoles(Role.ROLE_SUPER_ADMIN.getValue());}@PostMapping("/init")public Admin init(@RequestBody Admin admin) throws Exception {admin.setRoles(Role.ROLE_SUPER_ADMIN.getValue());return adminService.save(admin);}@GetMapping("")@PreAuthorize("hasAnyRole('ROLE_SUPER_ADMIN' ,'ROLE_ADMIN')")public List<Admin> findAll() {return adminService.findAll();}@DeleteMapping("")@PreAuthorize("hasAnyRole('ROLE_SUPER_ADMIN' ,'ROLE_ADMIN')")public void delete(String id) {adminService.delete(id);}@PostMapping("")@PreAuthorize("hasAnyRole('ROLE_SUPER_ADMIN' ,'ROLE_ADMIN')")public Admin save(@RequestBody Admin admin) throws Exception {return adminService.save(admin);}@PostMapping("/login")public Map<String, Object> loginByEmail(String type, @RequestBody LoginDto dto, HttpServletRequest request) throws Exception {Map<String, Object> map = new HashMap<>();Admin admin = null;String token = null;try {admin = type.equals("email") ? adminService.loginByEmail(dto) : adminService.loginByPassword(dto);token = adminService.createToken(admin,dto.isRemember() ? JwtTokenUtil.REMEMBER_EXPIRATION_TIME : JwtTokenUtil.EXPIRATION_TIME);}catch (Exception e){throw new Exception("邮箱或密码错误");}finally {loginLogService.recordLog(dto,admin,request);}map.put("admin", admin);map.put("token", token);return map;}@GetMapping("/sendEmail")public ResponseResult sendEmail(String email) throws Exception {Boolean flag = adminService.sendEmail(email);ResponseResult res = new ResponseResult();if (flag){res.setMsg("发送成功,请登录邮箱查看");}else {res.setMsg("发送验证码失败,请检查邮箱服务");}res.setStatus(flag);return res;}}
package com.example.api.controller;import com.example.api.model.entity.Inventory;
import com.example.api.model.entity.InventoryRecord;
import com.example.api.model.vo.CommodityChartVo;
import com.example.api.service.InventoryRecordService;
import com.example.api.service.InventoryService;
import org.springframework.web.bind.annotation.*;import javax.annotation.Resource;
import java.util.List;@RestController
@RequestMapping("/api/inventory")
public class InventoryController {@Resourceprivate InventoryService inventoryService;@Resourceprivate InventoryRecordService recordService;@GetMapping("")public List<Inventory> findAll() {return inventoryService.findAll();}@GetMapping("analyze")public List<CommodityChartVo> analyze(Integer type) {return recordService.analyzeCommodity(type);}//指定仓库id//查询某个仓库的库存情况@GetMapping("/warehouse/{id}")public List<Inventory> findByWarehouse(@PathVariable String id) {return inventoryService.findByWarehouseId(id);}//指定商品id//查询某个商品在所有仓库的库存@GetMapping("/commodity/{id}")public List<Inventory> findByCommodity(@PathVariable String id) {return inventoryService.findByCommodityId(id);}//指定仓库id//查询某个仓库库内商品的出库入库记录@GetMapping("/record/warehouse/{id}")public List<InventoryRecord> findRecordByWarehouse(@PathVariable String id) {return recordService.findAllByWarehouseId(id);}//指定商品id//查询某个商品在所有仓库出库入库记录@GetMapping("/record/commodity/{id}")public List<InventoryRecord> findRecordByCommodity(@PathVariable String id) {return recordService.findAllByCommodityId(id);}@PostMapping("/in")public InventoryRecord in(@RequestBody InventoryRecord record) throws Exception {return recordService.in(record);}@PostMapping("/out")public InventoryRecord out(@RequestBody InventoryRecord record) throws Exception {return recordService.out(record);}}
package com.example.api.service.impl;import com.example.api.exception.AccountAndPasswordError;
import com.example.api.model.dto.LoginDto;
import com.example.api.model.entity.Admin;
import com.example.api.model.entity.LoginLog;
import com.example.api.repository.AdminRepository;
import com.example.api.repository.LoginLogRepository;
import com.example.api.service.AdminService;
import com.example.api.service.EmailService;
import com.example.api.utils.DataTimeUtil;
import com.example.api.utils.JwtTokenUtil;
import org.springframework.stereotype.Service;import javax.annotation.Resource;
import java.util.Date;
import java.util.List;@Service
public class AdminServiceImpl implements AdminService {@Resourceprivate AdminRepository adminRepository;@Resourceprivate EmailService emailService;@Overridepublic Admin save(Admin admin) throws Exception {if (admin.getEmail().length() < 8 || admin.getPassword().length() < 5) throw new Exception("请求参数异常");admin.setCreateAt(DataTimeUtil.getNowTimeString());return adminRepository.save(admin);}@Overridepublic Admin findById(String id) {return adminRepository.findById(id).orElse(null);}@Overridepublic boolean sendEmail(String email) throws Exception {Admin admin = adminRepository.findAdminByEmail(email);if (admin == null) throw new Exception("不存在的邮箱账户");return emailService.sendVerificationCode(email);}@Overridepublic Admin loginByPassword(LoginDto dto) throws Exception {Admin one = adminRepository.findAdminByEmailAndPassword(dto.getEmail(), dto.getPassword());if (one == null) {throw new Exception("邮箱或密码错误");}return one;}@Overridepublic Admin loginByEmail(LoginDto dto) throws Exception {boolean status = emailService.checkVerificationCode(dto.getEmail(), dto.getCode());if (!status) throw new Exception("验证码错误");return adminRepository.findAdminByEmail(dto.getEmail());}@Overridepublic List<Admin> findAll() {return adminRepository.findAll();}@Overridepublic String createToken(Admin admin, long exp) {String rolesString = admin.getRoles();String[] roles = rolesString != null ? rolesString.split(";") : null;return JwtTokenUtil.createToken(admin.getEmail(), roles, exp);}@Overridepublic void delete(String id) {adminRepository.deleteById(id);}}
五、底部获取项目源码(9.9¥带走)
有问题,或者需要协助调试运行项目的也可以