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

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

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

适用

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

功能说明

230023172402

250023172402

260023172402

270023172402

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

一、项目简述

功能包括: 仓库管理,出入库管理,仓库人员管理,基本信息管理, 供应商信息,系统管理等等。

二、项目运行

环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持)

项目技术: JSP +Spring + SpringMVC + MyBatis + html+ css + JavaScript + JQuery + Ajax + layui+ maven等等。

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
        if (stockRecordManageService.stockInOperation(supplierID, goodsID, repositoryID, number, personInCharge)) {
result = Response.RESPONSE_RESULT_SUCCESS;
}
}

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

/**
* 查询出入库记录
*
* @param searchType 查询类型(查询所有或仅查询入库记录或仅查询出库记录)
* @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,
@RequestParam("startDate") String startDateStr,
@RequestParam("endDate") String endDateStr,
@RequestParam("limit") int limit,
@RequestParam("offset") int offset) throws ParseException, StockRecordManageServiceException {
// 初始化 Response
Response responseContent = ResponseFactory.newInstance();
List<StockRecordDTO> rows = null;
long total = 0;

// 参数检查
String regex = "([0-9]{4})-([0-9]{2})-([0-9]{2})";
boolean startDateFormatCheck = (StringUtils.isEmpty(startDateStr) || startDateStr.matches(regex));
boolean endDateFormatCheck = (StringUtils.isEmpty(endDateStr) || endDateStr.matches(regex));
boolean repositoryIDCheck = (StringUtils.isEmpty(repositoryIDStr) || StringUtils.isNumeric(repositoryIDStr));

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

/**
* 导出货物信息
*
* @param searchType 查找类型
* @param keyWord 查找关键字
* @param response HttpServletResponse
*/
@SuppressWarnings("unchecked")
@RequestMapping(value = "exportGoods", method = RequestMethod.GET)
public void exportGoods(@RequestParam("searchType") String searchType, @RequestParam("keyWord") String keyWord,
HttpServletResponse response) throws GoodsManageServiceException, IOException {

String fileName = "goodsInfo.xlsx";

List<Goods> goodsList = null;
Map<String, Object> queryResult = query(searchType, keyWord, -1, -1);

if (queryResult != null) {
goodsList = (List<Goods>) queryResult.get("data");
}

// 获取生成的文件
File file = goodsManageService.exportGoods(goodsList);

// 写出文件
if (file != null) {
// 设置响应头
response.addHeader("Content-Disposition", "attachment;filename=" + fileName);

FileInputStream inputStream = new FileInputStream(file);
OutputStream outputStream = response.getOutputStream();
byte[] buffer = new byte[8192];

int len;
while ((len = inputStream.read(buffer, 0, buffer.length)) > 0) {
outputStream.write(buffer, 0, len);
outputStream.flush();
}

inputStream.close();
outputStream.close();

}
}
}
package com.ken.wms.security.controller;

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
52
                                 @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);

if (queryResult != null) {
rows = (List<Supplier>) queryResult.get("data");
total = (long) queryResult.get("total");
}

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

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

// 添加记录
String result = goodsManageService.addGoods(goods) ? Response.RESPONSE_RESULT_SUCCESS : Response.RESPONSE_RESULT_ERROR;

// 设置 Response
responseContent.setResponseResult(result);

return responseContent.generateResponse();
}

/**
* 查询指定 goods ID 货物的信息
*
* @param goodsID 货物ID
* @return 返回一个map,其中:key 为 result 的值为操作的结果,包括:success 与 error;key 为 data
* 的值为货物信息
*/
@RequestMapping(value = "getGoodsInfo", method = RequestMethod.GET)
public
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

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

/**
* 查询指定 ID 的仓库信息
*
* @param repositoryID 仓库ID
* @return 返回一个map,其中:key 为 result 的值为操作的结果,包括:success 与 error;key 为 data
* 的值为仓库信息
*/
@RequestMapping(value = "getRepositoryInfo", method = RequestMethod.GET)
public
@ResponseBody
Map<String, Object> getRepositoryInfo(@RequestParam("repositoryID") Integer repositoryID) throws RepositoryManageServiceException {
// 初始化 Response
Response responseContent = ResponseFactory.newInstance();
String result = Response.RESPONSE_RESULT_ERROR;

// 查询
Repository repository = null;
Map<String, Object> queryResult = repositoryService.selectById(repositoryID);
if (queryResult != null) {
repository = (Repository) queryResult.get("data");
if (repository != null)
result = Response.RESPONSE_RESULT_SUCCESS;
}

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

/**
* 更新仓库信息
*
* @param repository 仓库信息
* @return 返回一个map,其中:key 为 result 的值为操作的结果,包括:success 与 error;key 为 data
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
    // 初始化 Response
Response response = ResponseFactory.newInstance();

Subject currentSubject = SecurityUtils.getSubject();
if (currentSubject != null && currentSubject.isAuthenticated()) {
// 执行账户注销操作
currentSubject.logout();
response.setResponseResult(Response.RESPONSE_RESULT_SUCCESS);
} else {
response.setResponseResult(Response.RESPONSE_RESULT_ERROR);
response.setResponseMsg("did not login");
}

return response.generateResponse();
}

/**
* 修改账户密码
*
* @param passwordInfo 密码信息
* @param request 请求
* @return 返回一个 Map 对象,其中键值为 result 代表修改密码操作的结果,
* 值为 success 或 error;键值为 msg 代表需要返回给用户的信息
*/
@RequestMapping(value = "passwordModify", method = RequestMethod.POST)
public
@ResponseBody
Map<String, Object> passwordModify(@RequestBody Map<String, Object> passwordInfo,
HttpServletRequest request) {
//初始化 Response
Response responseContent = ResponseFactory.newInstance();

String errorMsg = null;
String result = Response.RESPONSE_RESULT_ERROR;

// 获取用户 ID
HttpSession session = request.getSession();
UserInfoDTO userInfo = (UserInfoDTO) session.getAttribute("userInfo");
Integer userID = userInfo.getUserID();

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
            FileInputStream inputStream = new FileInputStream(file);
OutputStream outputStream = response.getOutputStream();
byte[] buffer = new byte[8192];

int len;
while ((len = inputStream.read(buffer, 0, buffer.length)) > 0) {
outputStream.write(buffer, 0, len);
outputStream.flush();
}

inputStream.close();
outputStream.close();
}
}
}
package com.ken.wms.common.controller;



/**
* 货物信息管理请求 Handler
*


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