基于javaweb+mysql的ssm服装进销存管理系统(java+ssm+html+js+jsp+mysql)
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的SSM服装进销存管理系统(java+ssm+html+js+jsp+mysql)
项目介绍
管理员角色包含以下功能: 管理员登录,修改密码,管理员管理,货号管理,仓库管理,入库管理,出库管理,查看入库信息等功能。
环境需要
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.数据库:MySql 5.7版本;
技术栈
- 后端:Spring+SpringMVC+Mybatis 2. 前端:HTML+CSS+JavaScript+jsp
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中application.yml配置文件中的数据库配置改为自己的配置; 4. 运行项目,输入localhost:8080/ 登录
return responseContent.generateResponse();
/**
* 查询指定 ID 的仓库管理员信息
* @param repositoryAdminID 仓库管理员ID
* @return 返回一个map,其中:key 为 result 的值为操作的结果,包括:success 与 error;key 为 data
* 的值为仓库管理员信息
*/
@RequestMapping(value = "getRepositoryAdminInfo", method = RequestMethod.GET)
public
@ResponseBody
Map<String, Object> getRepositoryAdminInfo(Integer repositoryAdminID) throws RepositoryAdminManageServiceException {
// 初始化 Response
e.printStackTrace();
return Result.error(false, "400", "登录失败,用户名不存在");
}catch (IncorrectCredentialsException e) {
e.printStackTrace();
return Result.error(false, "400", "登录失败,密码错误");
}catch (AuthenticationException e) {
e.printStackTrace();
return Result.error(false, "400", "登录失败,账户禁用");
/**
* 得到登陆验证码
* @param response
* @param session
* @throws IOException
* @param offset 分页偏移值
* @param limit 分页大小
* @param keyWord 查询关键字
* @return 返回一个Map,其中key=rows,表示查询出来的记录;key=total,表示记录的总条数
*/
@SuppressWarnings("unchecked")
@RequestMapping(value = "getRepositoryAdminList", method = RequestMethod.GET)
public
@ResponseBody
Map<String, Object> getRepositoryAdmin(@RequestParam("searchType") String searchType,
} else {
map.put("exist", false);
map.put("message", "用户名可以使用");
} catch (Exception e) {
e.printStackTrace();
return JSON.toJSONString(map);
/**
* 修改用户信息
* @param user
* @return
*/
@SysLog("用户修改操作")
// 参数检查
if (repositoryIDStr != null) {
if (StringUtils.isNumeric(repositoryIDStr)) {
repositoryID = Integer.valueOf(repositoryIDStr);
} else {
argumentCheck = false;
responseContent.setResponseMsg("request argument error");
// 获取session中的信息
Subject currentUser = SecurityUtils.getSubject();
Session session = currentUser.getSession();
* @param repositoryAdmin 仓库管理员信息
* @return 返回一个map,其中:key 为 result 的值为操作的结果,包括:success 与 error;key 为 data
* 的值为仓库管理员信息
*/
@RequestMapping(value = "updateRepositoryAdmin", method = RequestMethod.POST)
public
@ResponseBody
Map<String, Object> updateRepositoryAdmin(@RequestBody RepositoryAdmin repositoryAdmin) throws RepositoryAdminManageServiceException {
// 初始化 Response
Response responseContent = ResponseFactory.newInstance();
// 更新
/**
* 为用户分配角色
* @param roleids
* @param userid
* @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) {
Map<String, Object> getRepositoryAdmin(@RequestParam("searchType") String searchType,
@RequestParam("keyWord") String keyWord, @RequestParam("offset") int offset,
@RequestParam("limit") int limit) throws RepositoryAdminManageServiceException {
// 初始化 Response
Response responseContent = ResponseFactory.newInstance();
List<RepositoryAdmin> rows = null;
long total = 0;
// 查询
Map<String, Object> queryResult = query(keyWord, searchType, offset, limit);
if (queryResult != null) {
rows = (List<RepositoryAdmin>) queryResult.get("data");
boolean argumentCheck = true;
Integer repositoryID = null;
// 参数检查
if (repositoryIDStr != null) {
if (StringUtils.isNumeric(repositoryIDStr)) {
repositoryID = Integer.valueOf(repositoryIDStr);
} else {
argumentCheck = false;
responseContent.setResponseMsg("request argument error");
// 获取session中的信息
Subject currentUser = SecurityUtils.getSubject();
Session session = currentUser.getSession();
boolean authorizeCheck = true;
boolean argumentCheck = true;
Integer repositoryID = null;
// 参数检查
if (repositoryIDStr != null) {
if (StringUtils.isNumeric(repositoryIDStr)) {
repositoryID = Integer.valueOf(repositoryIDStr);
} else {
argumentCheck = false;
responseContent.setResponseMsg("request argument error");
// 获取session中的信息
Subject currentUser = SecurityUtils.getSubject();
Session session = currentUser.getSession();
* @return
*/
@SysLog("用户删除操作")
@RequestMapping("/deleteOne")
public Result deleteOne(int id) {
boolean bool = userService.removeById(id);
try {
if (bool) {
return Result.success(true, "200", "删除成功!");
} catch (Exception e) {
* 删除指定 ID 的仓库管理员信息
* @param repositoryAdminID 仓库ID
* @return 返回一个map,其中:key 为 result 的值为操作的结果,包括:success 与 error;key 为 data
* 的值为仓库管理员信息
*/
@RequestMapping(value = "deleteRepositoryAdmin", method = RequestMethod.GET)
public
@ResponseBody
Map<String, Object> deleteRepositoryAdmin(Integer repositoryAdminID) throws RepositoryAdminManageServiceException {
// 初始化 Response
* @param repositoryIDStr 查询记录所对应的仓库ID
* @param endDateStr 查询的记录起始日期
* @param startDateStr 查询的记录结束日期
* @param limit 分页大小
* @param offset 分页偏移值
* @return 返回一个Map,其中:Key为rows的值代表所有记录数据,Key为total的值代表记录的总条数
*/
@SuppressWarnings({"SingleStatementInBlock", "unchecked"})
@RequestMapping(value = "searchStockRecord", method = RequestMethod.GET)
public @ResponseBody
Map<String, Object> getStockRecord(@RequestParam("searchType") String searchType,
@RequestParam("repositoryID") String repositoryIDStr,
user.setPassword(PasswordUtil.md5(newPassWord1, salt, 2));
user.setSalt(salt);
boolean bool = userService.updateById(user);
if (bool){
return Result.success(true,null,"修改成功");
}else {
return Result.error(false,null,"修改失败!");
}else {
return Result.error(false,null,"修改失败,两次密码不一致!");
进货入库管理控制层:
/**
* 商品出入库管理请求Handler
if (importInfo != null) {
total = (long) importInfo.get("total");
available = (long) importInfo.get("available");
result = Response.RESPONSE_RESULT_SUCCESS;
// 设置 Response
responseContent.setResponseResult(result);
responseContent.setResponseTotal(total);
responseContent.setCustomerInfo("available", available);
return responseContent.generateResponse();
/**
return Result.error(false, null, "重置失败!");
/**
* 根据id查询当前用户拥有的角色
* @param id
* @return
*/
@RequestMapping("/initRoleByUserId")
public DataGridViewResult initRoleByUserId(int id) {
List<Map<String, Object>> mapList = null;
try {
//查询所有角色列表
/**
* 得到登陆验证码
* @param response
* @param session
* @throws IOException
*/
@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 {
Subject currentUser = SecurityUtils.getSubject();
Session session = currentUser.getSession();
UserInfoDTO userInfo = (UserInfoDTO) session.getAttribute("userInfo");
String personInCharge = userInfo == null ? "none" : userInfo.getUserName();
Integer repositoryIDBelong = userInfo == null ? -1 : userInfo.getRepositoryBelong();
// 设置非管理员请求的仓库ID
if (!currentUser.hasRole("systemAdmin")) {
if (repositoryIDBelong < 0) {
authorizeCheck = false;
responseContent.setResponseMsg("You are not authorized");
} else {
repositoryID = repositoryIDBelong;