基于javaweb+mysql的ssm+maven进销存系统wms(java+ssm+bootstrap+shiro+maven+mysql)
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的SSM+Maven进销存系统wms(java+ssm+bootstrap+shiro+maven+mysql)
功能介绍
系统操作权限管理。系统提供基本的登入登出功能,同时系统包含两个角色:系统超级管理员和普通管理员,超级管理员具有最高的操作权限,而普通管理员仅具有最基本的操作权限,而且仅能操作自己被指派的仓库。
请求URL鉴权。对于系统使用者登陆后进行操作发送请求的URL,后台会根据当前用户的角色判断是否拥有请求该URL的权限。 基础数据信息管理。对包括:货物信息、供应商信息、客户信息、仓库信息在内的基础数据信息进行管理,提供的操作有:添加、删除、修改、条件查询、导出为Excel和到从Excel导入。 仓库管理员管理。对仓库管理员信息CRUD操作,或者为指定的仓库管理员指派所管理的仓库。上述中的仓库管理员可以以普通管理员身份登陆到系统。 库存信息管理。对库存信息的CRUD操作,导入导出操作,同时查询的时候可以根据仓库以及商品ID等信息进行多条件查询。 基本仓库事务操作。执行货物的入库与出库操作。 系统登陆日志查询。超级管理员可以查询某一用户在特定时间段内的系统登陆日志。
系统操作日志查询。超级管理员可以查询某一用户在特定时间段内对系统进行操作的操作记录
环境需要
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版本;
技术栈
Apache POI MyBatis Spring Framework Spring MVC Apache Shiro Ehcache Apache Commons Log4j Slf4j Jackson C3P0 Junit MySQL-Connector jQuery Bootstrap
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,配置tomcat,然后运行; 3. 将项目中config/DBConfig.properties配置文件中的数据库配置改为自己的配置; 4. 运行项目,输入localhost:8080/ 登录 超级管理员账号:1001 密码:123456 普通管理员账号:1018 或者 1019 密码:123456
session.setAttribute("code",lineCaptcha.getCode());
try {
ServletOutputStream outputStream = response.getOutputStream();
lineCaptcha.write(outputStream);
outputStream.close();
} catch (IOException e) {
e.printStackTrace();
/**
* 查询所有用户信息
* @param userVO
* @return
*/
@SysLog("用户查询操作")
* 删除单条数据
* @param id
* @return
*/
@SysLog("用户删除操作")
@RequestMapping("/deleteOne")
public Result deleteOne(int id) {
boolean bool = userService.removeById(id);
try {
if (bool) {
* 删除单条数据
* @param id
* @return
*/
@SysLog("类别删除操作")
@RequestMapping("/deleteOne")
public Result deleteOne(int id) {
boolean bool = categoryService.removeById(id);
if(bool){
return Result.success(true,"200","删除成功!");
return Result.error(false,null,"删除失败!");
用户管理控制层:
@RestController
public DataGridViewResult categoryList(CategoryVO categoryVO) {
//创建分页信息 参数1 当前页 参数2 每页显示条数
IPage<Category> page = new Page<>(categoryVO.getPage(), categoryVO.getLimit());
QueryWrapper<Category> queryWrapper = new QueryWrapper<>();
queryWrapper.like(!StringUtils.isEmpty(categoryVO.getCatename()),"catename", categoryVO.getCatename());
IPage<Category> categoryIPage = categoryService.page(page, queryWrapper);
/**
* logsIPage.getTotal() 总条数
* logsIPage.getRecords() 分页记录列表
*/
return new DataGridViewResult(categoryIPage.getTotal(),categoryIPage.getRecords());
/**
* @return
*/
@SysLog("用户添加操作")
@RequestMapping("/saveUserRole")
public Result saveUserRole(String roleids, int userid) {
try {
if (userService.saveUserRole(userid, roleids)) {
return Result.success(true, null, "分配成功");
} catch (Exception e) {
e.printStackTrace();
return Result.error(false, null, "分配失败");
/**
* 修改密码
* @param newPassWord1
/**
* 类别批量删除
* @param ids
* @return
*/
@SysLog("类别删除操作")
@RequestMapping("/deleteList")
public Result deleteList(String ids) {
//将字符串拆分成数组
String[] idsStr = ids.split(",");
List<String> list = Arrays.asList(idsStr);
用户管理控制层:
@RestController
@RequestMapping("/user")
public class UserController {
@Autowired
private UserService userService;
@Autowired
private RoleService roleService;
/**
* 登录
@RequestMapping("/deleteOne")
public Result deleteOne(int id) {
boolean bool = customerService.removeById(id);
if(bool){
return Result.success(true,"200","删除成功!");
return Result.error(false,null,"删除失败!");
/**
* 加载下拉框
* @return
*/
* 修改客户信息
* @param customer
* @return
*/
@SysLog("客户修改操作")
@PostMapping("/updatecustomer")
public Result updateCustomer(Customer customer){
boolean bool = customerService.updateById(customer);
if(bool){
return Result.success(true,"200","修改成功!");
return Result.error(false,null,"修改失败!");
if (rid == roleId) {
flag = true;
break;
map.put("LAY_CHECKED", flag);
} catch (Exception e) {
e.printStackTrace();
return new DataGridViewResult(Long.valueOf(mapList.size()), mapList);
/**
* 为用户分配角色
* @param roleids
* @param userid
* @return
@SysLog("用户查询操作")
@RequestMapping("/userList")
public DataGridViewResult userList(UserVO userVO) {
//分页构造函数
IPage<User> page = new Page<>(userVO.getPage(), userVO.getLimit());
QueryWrapper<User> queryWrapper = new QueryWrapper<>();
queryWrapper.like(!StringUtils.isEmpty(userVO.getUsername()), "username", userVO.getUsername());
queryWrapper.like(!StringUtils.isEmpty(userVO.getUname()), "uname", userVO.getUname());
/**
* 翻页查询
* @param page 翻页对象
* @param queryWrapper 实体对象封装操作类
* @param category
* @return
*/
@SysLog("类别添加操作")
@PostMapping("/addcategory")
public Result addCategory(Category category){
boolean bool = categoryService.save(category);
if(bool){
return Result.success(true,"200","添加成功!");
return Result.error(false,null,"添加失败!");
/**
* 修改类别信息
* @param category
if (user != null) {
map.put("exist", true);
map.put("message", "用户名已存在");
} else {
map.put("exist", false);
map.put("message", "用户名可以使用");
} catch (Exception e) {
e.printStackTrace();
return JSON.toJSONString(map);
/**
* 修改用户信息
* @param user
* @return
*/
} catch (Exception e) {
e.printStackTrace();
return Result.error(false, null, "修改失败!");
/**
* 删除单条数据
* @param id
* @return
*/
@SysLog("用户删除操作")
@RequestMapping("/deleteOne")
public Result deleteOne(int id) {
boolean bool = userService.removeById(id);
try {
if (bool) {
@PostMapping("/addcustomer")
public Result addCustomer(Customer customer){
String id = RandomStringUtils.randomAlphanumeric(10);
customer.setCustvip(id);
boolean bool = customerService.save(customer);
if(bool){
return Result.success(true,"200","添加成功!");
return Result.error(false,null,"添加失败!");
/**
* 修改客户信息
* @param customer
* @return
boolean bool = categoryService.save(category);
if(bool){
return Result.success(true,"200","添加成功!");
return Result.error(false,null,"添加失败!");
/**
* 修改类别信息
* @param category
* @return
*/
@SysLog("类别修改操作")
@PostMapping("/updatecategory")
public Result updateCategory(Category category){
boolean bool = userService.updateById(user);
if (bool){
return Result.success(true,null,"修改成功");
}else {
return Result.error(false,null,"修改失败!");
}else {
return Result.error(false,null,"修改失败,两次密码不一致!");
客户管理控制层:
@RestController
@RequestMapping("/customer")
public class CustomerController {
@Autowired
private CustomerService customerService;
* @param password 密码
* @param request
* @return
*/
@SysLog("登陆操作")
@PostMapping("/login")
public Result login(String username, String password, HttpServletRequest request) {
try {
//获取当前登录主体对象
Subject subject = SecurityUtils.getSubject();
/**
* 删除单条数据
* @param id
* @return
*/
@SysLog("客户删除操作")
@RequestMapping("/deleteOne")
public Result deleteOne(int id) {
boolean bool = customerService.removeById(id);
if(bool){
return Result.success(true,"200","删除成功!");
user.setUcreatetime(new Date());
String salt = UUIDUtil.randomUUID();
user.setPassword(PasswordUtil.md5("000000", salt, 2));
user.setSalt(salt);
user.setType(1);
boolean bool = userService.save(user);
try {
if (bool) {
return Result.success(true, "200", "添加成功!");
} catch (Exception e) {
e.printStackTrace();
return Result.error(false, null, "添加失败!");
/**
* 校验用户名是否存在
/**
* 修改密码
* @param newPassWord1
* @param newPassWord2
* @return
*/
@RequestMapping("/updateUserPassWord")
public Result updateUserPassWord(String newPassWord1, String newPassWord2,HttpSession session) {
User sessionUser = (User) session.getAttribute("username");
if (newPassWord1.equals(newPassWord2)){
User user = new User();
String salt = UUIDUtil.randomUUID();
user.setUid(sessionUser.getUid());
*/
@RequestMapping("/getCode")
public void getCode(HttpServletResponse response, HttpSession session) throws IOException {
//定义图形验证码的长和宽
LineCaptcha lineCaptcha = CaptchaUtil.createLineCaptcha(116, 36,4,5);
session.setAttribute("code",lineCaptcha.getCode());
try {
ServletOutputStream outputStream = response.getOutputStream();
lineCaptcha.write(outputStream);
outputStream.close();
} catch (IOException e) {
e.printStackTrace();
/**
/**
* 根据id查询当前用户拥有的角色
* @param id
* @return
*/
@RequestMapping("/initRoleByUserId")
public DataGridViewResult initRoleByUserId(int id) {
List<Map<String, Object>> mapList = null;
try {
//查询所有角色列表
IPage<Category> page = new Page<>(categoryVO.getPage(), categoryVO.getLimit());
QueryWrapper<Category> queryWrapper = new QueryWrapper<>();
queryWrapper.like(!StringUtils.isEmpty(categoryVO.getCatename()),"catename", categoryVO.getCatename());
IPage<Category> categoryIPage = categoryService.page(page, queryWrapper);
/**
* logsIPage.getTotal() 总条数
* logsIPage.getRecords() 分页记录列表
*/
return new DataGridViewResult(categoryIPage.getTotal(),categoryIPage.getRecords());
/**
* 类别批量删除
* @param ids
* @return
* @return
*/
@SysLog("登陆操作")
@PostMapping("/login")
public Result login(String username, String password, HttpServletRequest request) {
try {
//获取当前登录主体对象
Subject subject = SecurityUtils.getSubject();
UsernamePasswordToken token = new UsernamePasswordToken(username, password);
subject.login(token);
LoginUserVO userDTO = (LoginUserVO) subject.getPrincipal();
request.getSession().setAttribute("username", userDTO.getUser());