基于javaweb的SSM+Maven进销存系统wms(java+ssm+bootstrap+shiro+maven+mysql)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

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

适用

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

功能说明

090023232402

100023232402

110023232402

120023232402

130023232402

140023232402

基于javaweb的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

使用说明

  1. 使用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

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
    // query
switch (searchType) {
case SEARCH_ALL:
queryResult = repositoryAdminManageService.selectAll(offset, limit);
break;
case SEARCH_BY_ID:
if (StringUtils.isNumeric(keyWord))
queryResult = repositoryAdminManageService.selectByID(Integer.valueOf(keyWord));
break;
case SEARCH_BY_NAME:
queryResult = repositoryAdminManageService.selectByName(offset, limit, keyWord);
break;
case SEARCH_BY_REPOSITORY_ID:
if (StringUtils.isNumeric(keyWord))
queryResult = repositoryAdminManageService.selectByRepositoryID(Integer.valueOf(keyWord));
break;
default:
// do other things
break;
}

return queryResult;
}

/**
* 查询仓库管理员信息
*
* @param searchType 查询类型
* @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,
@RequestParam("keyWord") String keyWord, @RequestParam("offset") int offset,
@RequestParam("limit") int limit) throws RepositoryAdminManageServiceException {
// 初始化 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
                               HttpServletResponse response) throws SupplierManageServiceException, IOException {

String fileName = "supplierInfo.xlsx";

// 根据查询类型进行查询
List<Supplier> suppliers = null;
Map<String, Object> queryResult;
queryResult = query(searchType, keyWord, -1, -1);

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

// 获取生成的文件
File file = supplierManageService.exportSupplier(suppliers);

// 写出文件
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();
}
}
}


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
Serializable sessionId = session.getId();

// 初始化用户的登陆队列,将用户的队列放入到缓存中
Deque<Serializable> deque = cache.get(userName);
if (deque == null) {
deque = new LinkedList<>();
cache.put(userName, deque);
}

// 如果队列中没有此用户的 sessionId 且用户没有被踢出,则放入队列
if (!deque.contains(sessionId) && session.getAttribute("kickOut") == null) {
deque.push(sessionId);
}

// 若队列中的 sessionId 是否超出最大会话数目, 则踢出用户
while (deque.size() > maxSessionNum) {
Serializable kickOutSessionId;
if (kickOutAfter) {
kickOutSessionId = deque.removeFirst();
} else {
kickOutSessionId = deque.removeLast();
}

// 设置 sessionId 对应的 session 中的字段,表示该用户已经被踢出
try {
Session kickOutSession = sessionManager.getSession(new DefaultSessionKey(kickOutSessionId));
if (kickOutSession != null) {
kickOutSession.setAttribute("kickOut", true);
}
} catch (Exception e) {
// do logging
e.printStackTrace();
}
}

// 如果当前登陆用户被踢出,则退出并跳转
if (session.getAttribute("kickOut") != null && Boolean.TRUE.equals(session.getAttribute("kickOut"))) {
try {
// 登出
subject.logout();

// 根据请求类型作出处理
HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
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
        // 转换为 Integer
Integer customerID = Integer.valueOf(customerIDStr);

// 刪除
String result = customerManageService.deleteCustomer(customerID) ? Response.RESPONSE_RESULT_SUCCESS : Response.RESPONSE_RESULT_ERROR;
responseContent.setResponseResult(result);
} else
responseContent.setResponseResult(Response.RESPONSE_RESULT_ERROR);

return responseContent.generateResponse();
}

/**
* 导入客户信息
*
* @param file 保存有客户信息的文件
* @return 返回一个map,其中:key 为 result表示操作的结果,包括:success 与
* error;key为total表示导入的总条数;key为available表示有效的条数
*/
@RequestMapping(value = "importCustomer", method = RequestMethod.POST)
public
@ResponseBody
Map<String, Object> importCustomer(@RequestParam("file") MultipartFile file) throws CustomerManageServiceException {
// 初始化 Response
Response responseContent = ResponseFactory.newInstance();
String result = Response.RESPONSE_RESULT_SUCCESS;

// 读取文件内容
int total = 0;
int available = 0;
if (file == null)
result = Response.RESPONSE_RESULT_ERROR;
Map<String, Object> importInfo = customerManageService.importCustomer(file);
if (importInfo != null) {
total = (int) importInfo.get("total");
available = (int) importInfo.get("available");
}

responseContent.setResponseResult(result);
responseContent.setResponseTotal(total);
responseContent.setCustomerInfo("available", available);
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

/**
* 库存管理请求处理
*
*/
@Controller
@RequestMapping(value = "/**/storageManage")
public class StorageManageHandler {

@Autowired
private StorageManageService storageManageService;
@Autowired
private StockRecordManageService stockRecordManageService;

private static final String SEARCH_BY_GOODS_ID = "searchByGoodsID";
private static final String SEARCH_BY_GOODS_NAME = "searchByGoodsName";
private static final String SEARCH_BY_GOODS_TYPE = "searchByGoodsType";
private static final String SEARCH_ALL = "searchAll";

/**
* 查询库存信息
*
* @param searchType 查询类型
* @param keyword 查询关键字
* @param repositoryBelong 查询仓库
* @param offset 分页偏移值
* @param limit 分页大小
* @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量
*/
private Map<String, Object> query(String searchType, String keyword, String repositoryBelong, int offset,
int limit) throws StorageManageServiceException {
Map<String, Object> queryResult = null;

switch (searchType) {
case SEARCH_ALL:
if (StringUtils.isNumeric(repositoryBelong)) {
Integer repositoryID = Integer.valueOf(repositoryBelong);
queryResult = storageManageService.selectAll(repositoryID, offset, limit);
} else {
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
            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();
}

/**
* 导出仓库管理员信息到文件中
*
* @param searchType 查询类型
* @param keyWord 查询关键字
* @param response HttpServletResponse
*/
@SuppressWarnings("unchecked")
@RequestMapping(value = "exportRepositoryAdmin", method = RequestMethod.GET)
public void exportRepositoryAdmin(@RequestParam("searchType") String searchType,
@RequestParam("keyWord") String keyWord, HttpServletResponse response) throws RepositoryAdminManageServiceException, IOException {

// 导出文件名
String fileName = "repositoryAdminInfo.xlsx";

// 查询
List<RepositoryAdmin> repositoryAdmins;
Map<String, Object> queryResult = query(keyWord, searchType, -1, -1);

if (queryResult != null)
repositoryAdmins = (List<RepositoryAdmin>) queryResult.get("data");
else
repositoryAdmins = new ArrayList<>();

// 生成文件
File file = repositoryAdminManageService.exportRepositoryAdmin(repositoryAdmins);

// 输出文件
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);


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