基于javaweb的SSM+Mavenoa办公管理系统(java+layui+ssm+maven+mysql+jsp)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

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

适用

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

功能说明

180023192402

190023192402

200023192402

210023192402

220023192402

基于javaweb的SSM+Mavenoa办公管理系统(java+layui+ssm+maven+mysql+jsp)

一、项目运行 环境配置:

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
42
43
44
45
46
47
48
49
50
51
52
53
public JSONObject logout() {
JSONObject json = new JSONObject();
Subject subject = SecurityUtils.getSubject();
subject.logout();
json.put("msg", "注销成功!");
return json;
}

/**
* 获取图像
*
* @param request
*/
@RequestMapping("/accessToImages")
@ResponseBody
public void AccessToImages(HttpServletRequest request, HttpServletResponse response) throws IOException {
String imageUrl = request.getParameter("imageUrl");
File file = new File(request.getContextPath() + "/" + imageUrl); //开启IO流
if (file.exists()) {
FileInputStream fis = new FileInputStream(file);
long size = file.length();
byte[] temp = new byte[(int) size];
fis.read(temp, 0, (int) size);
fis.close();
OutputStream outputStream = response.getOutputStream();
outputStream.write(temp);
outputStream.flush();
outputStream.close();
}
}

/**
* 上传头像
*
* @param request
* @param file
* @return
*/
@RequestMapping("/uploadPhoto")
@ResponseBody
public JSONObject uploadPhoto(HttpServletRequest request, MultipartFile file) {
JSONObject json = new JSONObject();
try {
if (file.isEmpty()) {
json.put("type", "error");
json.put("msg", "上传文件不能为空!");
} else {
String employeeNumber = SecurityUtils.getSubject().getPrincipal().toString();
String originalFilename = file.getOriginalFilename(); //文件名
//创建要上传的路径
File file1 = new File(request.getContextPath() + "/" + "src/main/webapp/WEB-INF/employee/" + employeeNumber + "/");
if (!file1.exists()) {
file1.mkdirs();
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
public JSONObject flagNotice(HttpServletRequest request) {
JSONObject json = new JSONObject();
try {
String employeeNumber = SecurityUtils.getSubject().getPrincipal().toString(); //得到自身工号
String noticeIdStr = request.getParameter("noticeId");
if (noticeIdStr == null || employeeNumber == null) {
json.put("type", "error");
json.put("msg", "接收数据为空!");
return json;
}
int noticeId = Integer.parseInt(noticeIdStr);
if (noticeDao.flagNotice(noticeId, employeeNumber) > 0) {
json.put("type", "success");
json.put("msg", "已阅成功!");
return json;
}
} catch (Exception e) {
json.put("type", "error");
json.put("msg", MessageError.SYSTEM_ERROR);
System.out.println(e.getMessage());
return json;
}
json.put("type", "error");
json.put("msg", "已阅失败!");
return json;
}

@Override
public JSONObject bulkReleaseNotice(HttpServletRequest request) {
JSONObject json = new JSONObject();
try {
String employeeIdListStr = request.getParameter("employeeIdList");
String noticeIdStr = request.getParameter("noticeId");
if (noticeIdStr == null || employeeIdListStr == null) {
json.put("type", "error");
json.put("msg", "接收数据为空!");
return json;
}
Integer[] employeeIdList = JSONObject.parseObject(employeeIdListStr, Integer[].class);
int noticeId = Integer.parseInt(noticeIdStr);
if (noticeDao.bulkReleaseNotice(noticeId, employeeIdList) > 0) {
json.put("type", "success");
json.put("msg", "批量发布系统公告成功!");
return json;
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
        return departmentDao.deleteDepartment(departmentId);
}

@Override
public Integer verifyDepartmentTitle(Department department) {
return departmentDao.verifyDepartmentTitle(department);
}

@Override
public Integer verifyDepartmentByEmployee(Integer departmentId) {
return departmentDao.verifyDepartmentByEmployee(departmentId);
}

@Override
public JSONObject updateDepartmentPrincipal(HttpServletRequest request) {
JSONObject json = new JSONObject();
try {
String employeeNumber = request.getParameter("employeeNumber");
String departmentId = request.getParameter("departmentId");
if (employeeNumber == null || departmentId == null) {
json.put("type", "error");
json.put("msg", "数据获取失败");
return json;
}
Integer employeeId = departmentDao.selectEmployeeByNumber(employeeNumber);
if (employeeId <= 0) {
json.put("type", "error");
json.put("msg", "没有该工号");
return json;
}
if (departmentDao.updateDepartmentHead(employeeId, Integer.parseInt(departmentId)) > 0) {
json.put("type", "success");
json.put("msg", "修改成功!");
return json;
}
} catch (Exception e) {
json.put("type", "error");
json.put("msg", MessageError.SYSTEM_ERROR);
System.out.println(e.getMessage());
return json;
}
json.put("type", "error");
json.put("msg", "修改失败");
return json;
}
}
package com.njl.oa.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
@Autowired
private MenuService menuService;

/**
* 根据工号来获取菜单列表
*
* @param request
* @return
*/
@RequestMapping("/getMenuByEmployeeNumber")
@ResponseBody
public List<Menu> getMenuByEmployeeNumber(HttpServletRequest request) {
String employeeNumber = SecurityUtils.getSubject().getPrincipal().toString(); //得到自身工号
List<Menu> menuByEmployeeNumber = menuService.getMenuByEmployeeNumber(employeeNumber);
List<Menu> menuList = new ArrayList<>();
for (Menu menu : menuByEmployeeNumber) {
if (menu.getPid().equals(-1)) {
List<Menu> menuList1 = new ArrayList<>();
for (Menu menu1 : menuByEmployeeNumber) {
if (menu.getId() == menu1.getPid()) {
menuList1.add(menu1);
}
}
if (menuList1.size() > 0) {
menu.setChildren(menuList1);
}
menuList.add(menu);
}
}
return menuList;
}

/**
* 获取全部菜单信息
*
* @param request
* @return
*/
@RequestMapping("/getMenuAll")
@ResponseBody
public Map<String, Object> getMenuAll(HttpServletRequest request) {
Map<String, Object> map = new HashMap<>();
int page = Integer.parseInt(request.getParameter("page"));
int limit = Integer.parseInt(request.getParameter("limit"));
List<Menu> menuAll = menuService.getMenuAll((page - 1) * limit, limit);
map.put("code", 0);
map.put("msg", "");
map.put("count", menuService.getMenuAllCount());
map.put("data", menuAll);
return map;
}
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
     * @param request
* @param file
* @return
*/
@RequestMapping("/uploadPhoto")
@ResponseBody
public JSONObject uploadPhoto(HttpServletRequest request, MultipartFile file) {
JSONObject json = new JSONObject();
try {
if (file.isEmpty()) {
json.put("type", "error");
json.put("msg", "上传文件不能为空!");
} else {
String employeeNumber = SecurityUtils.getSubject().getPrincipal().toString();
String originalFilename = file.getOriginalFilename(); //文件名
//创建要上传的路径
File file1 = new File(request.getContextPath() + "/" + "src/main/webapp/WEB-INF/employee/" + employeeNumber + "/");
if (!file1.exists()) {
file1.mkdirs();
}
//文件上传到路径下
FileUtils.copyInputStreamToFile(file.getInputStream(), new File(file1, "photo.png"));
json.put("type", "success");
json.put("msg", "上传成功!");
json.put("value", "src/main/webapp/WEB-INF/employee/" + employeeNumber + "/photo.png");
}
} catch (Exception e) {
json.put("type", "error");
json.put("msg", e.getMessage());
}
return json;
}


}
package com.njl.oa.service.impl;


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