基于javaweb的SSM+Maven仓库管理系统(java+ssm+maven+bootstrap+mysql)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

280023172402

290023172402

300023172402

310023172402

320023172402

330023172402

基于javaweb的SSM+Maven仓库管理系统(java+ssm+maven+bootstrap+mysql)

功能:

  • 系统操作权限管理。系统提供基本的登入登出功能,同时系统包含两个角色:系统超级管理员和普通管理员,超级管理员具有最高的操作权限,而普通管理员仅具有最基本的操作权限,而且仅能操作自己被指派的仓库。 * 请求URL鉴权。对于系统使用者登陆后进行操作发送请求的URL,后台会根据当前用户的角色判断是否拥有请求该URL的权限。 * 基础数据信息管理。对包括:货物信息、供应商信息、客户信息、仓库信息在内的基础数据信息进行管理,提供的操作有:添加、删除、修改、条件查询、导出为Excel和到从Excel导入。 * 仓库管理员管理。对仓库管理员信息CRUD操作,或者为指定的仓库管理员指派所管理的仓库。上述中的仓库管理员可以以普通管理员身份登陆到系统。 * 库存信息管理。对库存信息的CRUD操作,导入导出操作,同时查询的时候可以根据仓库以及商品ID等信息进行多条件查询。 * 基本仓库事务操作。执行货物的入库与出库操作。 * 系统登陆日志查询。超级管理员可以查询某一用户在特定时间段内的系统登陆日志。 * 系统操作日志查询。超级管理员可以查询某一用户在特定时间段内对系统进行操作的操作记录。、 * 密码修改。

使用到的框架和库:

  • Apache POI * MyBatis * Spring Framework * Spring MVC * Apache Shiro * Ehcache * Apache Commons * Log4j * Slf4j * Jackson * C3P0 * Junit * MySQL-Connector * jQuery * Bootstrap

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
 *
*/
@Controller
@RequestMapping("/commons/fileSource")
public class FileSourceHandler {

@RequestMapping(value = "download/{fileName:.+}", method = RequestMethod.GET)
public void fileDownload(@PathVariable("fileName") String fileName, HttpServletRequest request,
HttpServletResponse response) throws IOException {

if (fileName == null)
return;

// 获取文件
ServletContext context = request.getServletContext();
String directory = context.getRealPath("/WEB-INF/download");
Path file = Paths.get(directory, fileName);
if (Files.exists(file)) {
// 设置响应头
response.addHeader("Content-Disposition", "attachment;filename=" + file.getFileName());
Files.copy(file, response.getOutputStream());
response.getOutputStream().flush();
}
}
}
package com.ken.wms.security.controller;


/**
* 页面重定向
*
*/
@RequestMapping("/")
@Controller
public class PageForwardHandler {

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
}

/**
* 查询库存信息,查询所属的仓库为session保存的信息
*
* @param keyword 查询关键字
* @param searchType 查询类型
* @param offset 分页偏移值
* @param limit 分页大小
* @param request 请求
* @return 结果的一个Map,其中: key为 rows 的代表记录数据;key 为 total 代表结果记录的数量
*/
@SuppressWarnings("unchecked")
@RequestMapping(value = "getStorageList", method = RequestMethod.GET)
public
@ResponseBody
Map<String, Object> getStorageList(@RequestParam("keyword") String keyword,
@RequestParam("searchType") String searchType, @RequestParam("offset") int offset,
@RequestParam("limit") int limit, HttpServletRequest request) throws StorageManageServiceException {
// 初始化 Response
Response responseContent = ResponseFactory.newInstance();

List<Storage> rows = null;
long total = 0;

HttpSession session = request.getSession();
UserInfoDTO userInfo = (UserInfoDTO) session.getAttribute("userInfo");
Integer repositoryID = userInfo.getRepositoryBelong();
if (repositoryID > 0) {
Map<String, Object> queryResult = query(searchType, keyword, repositoryID.toString(), offset, limit);
if (queryResult != null) {
rows = (List<Storage>) queryResult.get("data");
total = (long) queryResult.get("total");
}
}

if (rows == null)
rows = new ArrayList<>();

// 设置 Response
responseContent.setCustomerInfo("rows", rows);
responseContent.setResponseTotal(total);
return responseContent.generateResponse();
}

/**
* 添加一条库存信息
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

/**
* 供应商信息管理请求 Handler
*
*/
@RequestMapping(value = "/**/supplierManage")
@Controller
public class SupplierManageHandler {

@Autowired
private SupplierManageService supplierManageService;

private static final String SEARCH_BY_ID = "searchByID";
private static final String SEARCH_BY_NAME = "searchByName";
private static final String SEARCH_ALL = "searchAll";

/**
* 通用的记录查询
*
* @param searchType 查询类型
* @param keyWord 查询关键字
* @param offset 分页偏移值
* @param limit 分页大小
* @return 返回所有符合条件的记录
*/
private Map<String, Object> query(String searchType, String keyWord, int offset, int limit) throws SupplierManageServiceException {
Map<String, Object> queryResult = null;

switch (searchType) {
case SEARCH_BY_ID:
if (StringUtils.isNumeric(keyWord)) {
queryResult = supplierManageService.selectById(Integer.valueOf(keyWord));
}
break;
case SEARCH_BY_NAME:
queryResult = supplierManageService.selectByName(offset, limit, keyWord);
break;
case SEARCH_ALL:
queryResult = supplierManageService.selectAll(offset, limit);
break;
default:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
    // 获取货物信息
Goods goods = null;
Map<String, Object> queryResult = goodsManageService.selectById(goodsID);
if (queryResult != null) {
goods = (Goods) queryResult.get("data");
if (goods != null) {
result = Response.RESPONSE_RESULT_SUCCESS;
}
}

// 设置 Response
responseContent.setResponseResult(result);
responseContent.setResponseData(goods);
return responseContent.generateResponse();
}

/**
* 更新货物信息
*
* @param goods 货物信息
* @return 返回一个map,其中:key 为 result表示操作的结果,包括:success 与 error
*/
@RequestMapping(value = "updateGoods", method = RequestMethod.POST)
public
@ResponseBody
Map<String, Object> updateGoods(@RequestBody Goods goods) throws GoodsManageServiceException {
// 初始化 Response
Response responseContent = ResponseFactory.newInstance();

// 更新
String result = goodsManageService.updateGoods(goods) ? Response.RESPONSE_RESULT_SUCCESS : Response.RESPONSE_RESULT_ERROR;

// 设置 Response
responseContent.setResponseResult(result);
return responseContent.generateResponse();
}

/**
* 删除货物记录
*
* @param goodsID 货物ID
* @return 返回一个map,其中:key 为 result表示操作的结果,包括:success 与 error
*/
@RequestMapping(value = "deleteGoods", method = RequestMethod.GET)
public
@ResponseBody
Map<String, Object> deleteGoods(@RequestParam("goodsID") Integer goodsID) throws GoodsManageServiceException {
// 初始化 Response
Response responseContent = ResponseFactory.newInstance();
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50

if (startDateFormatCheck && endDateFormatCheck && userIDCheck) {
// 转到 Service 执行查询
Integer userID = -1;
if (StringUtils.isNumeric(userIDStr))
userID = Integer.valueOf(userIDStr);
Map<String, Object> queryResult = systemLogService.selectAccessRecord(userID, accessType, startDateStr, endDateStr, offset, limit);
if (queryResult != null) {
rows = (List<AccessRecordDO>) queryResult.get("data");
total = (long) queryResult.get("total");
}
} else
response.setResponseMsg("Request Argument Error");

if (rows == null)
rows = new ArrayList<>(0);

// 返回 Response
response.setCustomerInfo("rows", rows);
response.setResponseTotal(total);
return response.generateResponse();
}

/**
* 查询系统的操作日志
*
* @param userIDStr 用户ID
* @param startDateStr 记录的起始日期
* @param endDateStr 记录的结束日期
* @param offset 分页的偏移值
* @param limit 分页的大小
* @return 返回 JSON 数据 其中:Key为rows的值代表所有记录数据,Key为total的值代表记录的总条数
* @throws SystemLogServiceException SystemLogServiceException
*/
@SuppressWarnings("unchecked")
@RequestMapping(value = "getUserOperationRecords")
public @ResponseBody
Map<String, Object> selectUserOperationRecords(@RequestParam("userID") String userIDStr,
@RequestParam("startDate") String startDateStr,
@RequestParam("endDate") String endDateStr,
@RequestParam("offset") int offset,
@RequestParam("limit") int limit) throws SystemLogServiceException {
// 创建 Response
Response response = ResponseFactory.newInstance();
List<UserOperationRecordDTO> rows = null;
long total = 0;

// 检查参数
String regex = "([0-9]{4})-([0-9]{2})-([0-9]{2})";
boolean startDateFormatCheck = (StringUtils.isEmpty(startDateStr) || startDateStr.matches(regex));
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
 * @param keyWord    查询关键字
* @param offset 分页偏移值
* @param limit 分页大小
* @return 返回一个 Map ,包含所有符合要求的查询结果,以及记录的条数
*/
private Map<String, Object> query(String searchType, String keyWord, int offset, int limit) throws GoodsManageServiceException {
Map<String, Object> queryResult = null;

switch (searchType) {
case SEARCH_BY_ID:
if (StringUtils.isNumeric(keyWord))
queryResult = goodsManageService.selectById(Integer.valueOf(keyWord));
break;
case SEARCH_BY_NAME:
queryResult = goodsManageService.selectByName(keyWord);
break;
case SEARCH_ALL:
queryResult = goodsManageService.selectAll(offset, limit);
break;
default:
// do other thing
break;
}

return queryResult;
}

/**
* 搜索货物信息
*
* @param searchType 搜索类型
* @param offset 如有多条记录时分页的偏移值
* @param limit 如有多条记录时分页的大小
* @param keyWord 搜索的关键字
* @return 返回所有符合要求的记录
*/
@SuppressWarnings("unchecked")
@RequestMapping(value = "getGoodsList", method = RequestMethod.GET)
public
@ResponseBody
Map<String, Object> getGoodsList(@RequestParam("searchType") String searchType,
@RequestParam("offset") int offset, @RequestParam("limit") int limit,
@RequestParam("keyWord") String keyWord) throws GoodsManageServiceException {
// 初始化 Response
Response responseContent = ResponseFactory.newInstance();
List<Supplier> rows = null;
long total = 0;

// 查询
Map<String, Object> queryResult = query(searchType, keyWord, offset, limit);


项目链接:
https://javayms.github.io?id=351422302105200gn
https://javayms.pages.dev?id=351422302105200gn