基于javaweb的SpringBoot校园物流快递管理系统(java+maven+thymeleaf+html+springboot+layui+mysql)

运行环境

Java≥8、MySQL≥5.7

开发工具

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

适用

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

功能说明

560023012403

560023012402

570023012402

580023012402

590023012402

010023022402

020023022402

基于javaweb的SpringBoot校园物流快递管理系统(java+maven+thymeleaf+html+springboot+layui+mysql)

一、项目运行 环境配置:

Jdk1.8 + mysql + Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)

项目技术:

JSP +SpringBoot + 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
@ResponseBody
public void findName(String name, HttpSession session, HttpServletResponse response) throws IOException {
User nowUser = (User) session.getAttribute("user");
Integer id = nowUser.getId();
response.setContentType("application/json;charset=utf-8");
QueryWrapper<User> wrapper = new QueryWrapper<User>().eq("name", name).ne("id", id);
User userInfo = userService.getOne(wrapper);
Map<String, Object> map = new HashMap<>();
if (userInfo != null) {
map.put("nameExit", true);
map.put("msg", "用户名已存在");
} else {
map.put("nameExit", false);
map.put("msg", "正确");
}
//将map转为json,并且传递给客户端
String s = JSON.toJSONString(map);
PrintWriter writer = response.getWriter();
writer.write(s);
writer.close();
}

@RequestMapping("/uploadAvatar")
public String uploadAvatar(@RequestParam("file") MultipartFile file, HttpSession session) {
String filename = file.getOriginalFilename();
try {
if (file != null) {
if (!"".equals(filename.trim())) {
File newFile = new File(filename);
FileOutputStream outputStream = new FileOutputStream(newFile);
outputStream.write(file.getBytes());
outputStream.close();
file.transferTo(newFile);
//返回图片的URL
String url = aliyunOssUtil.upLoad(newFile);
User userInfo = (User) session.getAttribute("user");
userInfo.setAvatar(url);
userService.saveOrUpdate(userInfo);
}
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return "redirect:/toUserInfo";
}


//我收到的
@GetMapping("/toUserPickUp")
public String toUserPickUp(@RequestParam(required = false, defaultValue = "1", value = "pageNum") int pageNum, HttpSession session, Model model, RedirectAttributes attributes) {
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
        User userInfo = (User) session.getAttribute("user");
if (userInfo != null) {
return "send";
} else {
attributes.addFlashAttribute("message", "权限不足,请先登录");
return "redirect:/toLogin";
}
}

@PostMapping("/sendPost")
public String sendPost(Post post,HttpSession session){
User user = (User) session.getAttribute("user");
post.setUserId(user.getId());
post.setCreateTime(new Date());
post.setUpdateTime(new Date());
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
String format = dateFormat.format(new Date());
String num = format.concat(String.valueOf(user.getId()));
String postNum = num.concat("2");
post.setNum(postNum);
postService.save(post);
return "redirect:/toUserSend";
}

@PostMapping("/updatePost")
public String updatePost(Post post){
post.setUpdateTime(new Date());
postService.updateById(post);
return "redirect:/toUserSend";
}

}
package com.ev.logistics.controller;



/**
*/
@Controller
public class IndexController {

@GetMapping({"/"})
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
        session.setAttribute("user", user);
return "userInfo";
} else {
attributes.addFlashAttribute("message", "权限不足,请先登录");
return "redirect:/toLogin";
}
}

@PostMapping("/updateUserInfo")
public String updateUserInfo(User user, HttpSession session) {
User userInfo = (User) session.getAttribute("user");
Integer id = userInfo.getId();
user.setId(id);
userService.updateById(user);
return "redirect:/toUserInfo";
}

@GetMapping("/findByName")
@ResponseBody
public void findName(String name, HttpSession session, HttpServletResponse response) throws IOException {
User nowUser = (User) session.getAttribute("user");
Integer id = nowUser.getId();
response.setContentType("application/json;charset=utf-8");
QueryWrapper<User> wrapper = new QueryWrapper<User>().eq("name", name).ne("id", id);
User userInfo = userService.getOne(wrapper);
Map<String, Object> map = new HashMap<>();
if (userInfo != null) {
map.put("nameExit", true);
map.put("msg", "用户名已存在");
} else {
map.put("nameExit", false);
map.put("msg", "正确");
}
//将map转为json,并且传递给客户端
String s = JSON.toJSONString(map);
PrintWriter writer = response.getWriter();
writer.write(s);
writer.close();
}

@RequestMapping("/uploadAvatar")
public String uploadAvatar(@RequestParam("file") MultipartFile file, HttpSession session) {
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
            PageInfo<Orders> pageInfo = new PageInfo<>(ordersList);
model.addAttribute("ordersList", ordersList);
model.addAttribute("pageInfo", pageInfo);
return "userPickUp";
} else {
attributes.addFlashAttribute("message", "权限不足,请先登录");
return "redirect:/toLogin";
}
}

//我寄出的
@GetMapping("/toUserSend")
public String toUserSend(@RequestParam(required = false, defaultValue = "1", value = "pageNum") int pageNum, HttpSession session, Model model, RedirectAttributes attributes) {
User userInfo = (User) session.getAttribute("user");
if (userInfo != null) {
PageHelper.startPage(pageNum, 6);
List<Post> postList = postService.findByUserId(userInfo.getId());
PageInfo<Post> pageInfo = new PageInfo<>(postList);
model.addAttribute("postList", postList);
model.addAttribute("pageInfo", pageInfo);
return "userSend";
} else {
attributes.addFlashAttribute("message", "权限不足,请先登录");
return "redirect:/toLogin";
}
}

@GetMapping("toPostDetail/{id}")
public String toPostDetail(@PathVariable Integer id, Model model) {
Post post = postService.findById(id);
model.addAttribute("post",post);
return "send3";
}

@GetMapping("toUpdatePost/{id}")
public String toUpdatePost(@PathVariable Integer id, Model model) {
Post post = postService.findById(id);
model.addAttribute("post",post);
return "send2";
}

@GetMapping("deletePost/{id}")
public String deletePost(@PathVariable Integer id) {
postService.removeById(id);
return "redirect:/toUserSend";
}

}
package com.ev.logistics.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
//寄件管理
@GetMapping("/toAdminSend")
public String toAdminSend(@RequestParam(required = false, defaultValue = "1", value = "pageNum") int pageNum, HttpSession session, Model model, RedirectAttributes attributes) {
User userInfo = (User) session.getAttribute("user");
if (userInfo != null) {
PageHelper.startPage(pageNum, 6);
List<Post> postList = postService.findAllPost();
PageInfo<Post> pageInfo = new PageInfo<>(postList);
model.addAttribute("postList", postList);
model.addAttribute("pageInfo", pageInfo);
List<Category> categoryList = categoryService.list();
model.addAttribute("categoryList", categoryList);
return "adminSend";
} else {
attributes.addFlashAttribute("message", "权限不足,请先登录");
return "redirect:/toLogin";
}
}

@GetMapping("adminSendPost/{id}")
public String adminSendPost(@PathVariable Integer id) {
postService.updatePostStatusTo1(id, new Date());
return "redirect:/toAdminSend";
}

@PostMapping("/searchPost")
public String searchPost(Post post, @RequestParam(required = false, defaultValue = "1", value = "pageNum") int pageNum, Model model) {
PageHelper.startPage(pageNum, 6);
List<Post> postList = postService.findPostBySearch(post);
PageInfo<Post> pageInfo = new PageInfo<>(postList);
List<Category> categoryList = categoryService.list();
model.addAttribute("categoryList", categoryList);
model.addAttribute("postList", postList);
model.addAttribute("pageInfo", pageInfo);
return "adminSend";
}


//收件管理
@GetMapping("adminPickUpPost/{id}")
public String adminPickUpPost(@PathVariable Integer id, Model model) {
Post post = postService.findById(id);
model.addAttribute("post", post);
QueryWrapper<Position> status0 = new QueryWrapper<Position>().eq("status", 0);
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
    return "redirect:/toUserInfo";
}

@GetMapping("/findByName")
@ResponseBody
public void findName(String name, HttpSession session, HttpServletResponse response) throws IOException {
User nowUser = (User) session.getAttribute("user");
Integer id = nowUser.getId();
response.setContentType("application/json;charset=utf-8");
QueryWrapper<User> wrapper = new QueryWrapper<User>().eq("name", name).ne("id", id);
User userInfo = userService.getOne(wrapper);
Map<String, Object> map = new HashMap<>();
if (userInfo != null) {
map.put("nameExit", true);
map.put("msg", "用户名已存在");
} else {
map.put("nameExit", false);
map.put("msg", "正确");
}
//将map转为json,并且传递给客户端
String s = JSON.toJSONString(map);
PrintWriter writer = response.getWriter();
writer.write(s);
writer.close();
}

@RequestMapping("/uploadAvatar")
public String uploadAvatar(@RequestParam("file") MultipartFile file, HttpSession session) {
String filename = file.getOriginalFilename();
try {
if (file != null) {
if (!"".equals(filename.trim())) {
File newFile = new File(filename);
FileOutputStream outputStream = new FileOutputStream(newFile);
outputStream.write(file.getBytes());
outputStream.close();
file.transferTo(newFile);
//返回图片的URL
String url = aliyunOssUtil.upLoad(newFile);
User userInfo = (User) session.getAttribute("user");
userInfo.setAvatar(url);
userService.saveOrUpdate(userInfo);
}
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return "redirect:/toUserInfo";
}



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