基于javaweb的SSM+Maven在线旅游系统(java+jsp+ssm+spring+mysql+maven)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

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

适用

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

功能说明

250023102402

270023102402

280023102402

290023102402

300023102402

基于javaweb的SSM+Maven在线旅游系统(java+jsp+ssm+spring+mysql+maven)

一、项目简述

功能:用户的登录注册,旅游景点的展示,旅游预订,收藏,购买,以及酒店住宿留言等等,后台管理员,订单管理,景点管理,留言管理,分类管理吗,以及系统管理等等。

二、项目运行

环境配置:

Jdk1.8 + Tomcat8.5 + mysql + Idea2019(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
}

//删除景点线路
@RequestMapping("/delete.do")
@PreAuthorize("hasAnyAuthority('/routes/delete.do')")
public String delete(Integer rid) throws Exception{
routeService.delete(rid);
return "redirect:findAll.do";
}

//修改景点线路
@RequestMapping("/update.do")
@PreAuthorize("hasAnyAuthority('/routes/update.do')")
public String update(Route route) throws Exception{
if (route.getRimageStr().getSize()!=0&&route.getRimageStr()!=null){//修改过图片
String filename = Upload.uploadImg(RIMAGE,route.getRimageStr());
route.setRimage("img/product/small/"+filename);
routeService.update(route);
}else{//未修改图片
routeService.update(route);
}
return "redirect:findAll.do";
}

//根据rid查询线路信息
@RequestMapping("/findByRid.do")
@PreAuthorize("hasAnyAuthority('/routes/findByRid.do')")
public ModelAndView findByRid(Integer rid) throws Exception{
ModelAndView mv = new ModelAndView();
Route route = routeService.findByRid(rid);
mv.addObject("routeInfo",route);
List<Category> clist = categoryService.findAllCName();
List<Seller> slist = sellerService.findAll();
mv.addObject("CList",clist);
mv.addObject("SList",slist);
mv.setViewName("route-update");
return mv;
}

//查询所有线路
@RequestMapping("/findAll.do")
@PreAuthorize("hasAnyAuthority('/routes/findAll.do')")
public ModelAndView findAll(
@RequestParam(name="page",required = true, defaultValue = "1") Integer page,
@RequestParam(name="size",required = true, defaultValue = "10") Integer size,
@RequestParam(name="rname",required = true, defaultValue = "") String rname
) throws Exception{
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
        //根据roleId查询可以添加的权限
List<Permission> otherPermissions = roleService.findOtherPermissions(roleId);
mv.addObject("role", role);
mv.addObject("permissionList", otherPermissions);
mv.setViewName("role-permission-add");
return mv;
}
}
package com.admin.controller;



/**
* @Description: TODO(处理日志的切面)
*/
@Component
@Aspect
public class LogAop {

@Autowired
private HttpServletRequest request;

@Autowired
private ISysLogService sysLogService;

private Date visitTime; //开始时间
private Class clazz; //访问的类
private Method method;//访问的方法

//前置通知 主要是获取开始时间,执行的类是哪一个,执行的是哪一个方法
// @Before("execution(* com.admin.controller.*.*(..))")
public void doBefore(JoinPoint jp) throws NoSuchMethodException {
visitTime = new Date();//当前时间就是开始访问的时间
clazz = jp.getTarget().getClass(); //具体要访问的类
String methodName = jp.getSignature().getName(); //获取访问的方法的名称
Object[] args = jp.getArgs();//获取访问的方法的参数

//获取具体执行的方法的Method对象
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
54
@RequestMapping("/addRoleToUser.do")
@PreAuthorize("hasAnyAuthority('/users/addRoleToUser.do')")
public String addRoleToUser(@RequestParam(name = "userId", required = true) Integer userId, @RequestParam(name = "ids", required = true) int[] roleIds) throws Exception {
userService.addRoleToUser(userId, roleIds);
return "redirect:findAll.do";
}

//查询用户以及用户可以添加的角色
@RequestMapping("/findUserByIdAndAllRole.do")
@PreAuthorize("hasAnyAuthority('/users/findUserByIdAndAllRole.do')")
public ModelAndView findUserByIdAndAllRole(@RequestParam(name = "id", required = true) Integer uid) throws Exception {
ModelAndView mv = new ModelAndView();
//1.根据用户id查询用户
User user = userService.findByUid(uid);
//2.根据用户id查询可以添加的角色
List<Role> otherRoles = userService.findOtherRoles(uid);
mv.addObject("user", user);
mv.addObject("roleList", otherRoles);
mv.setViewName("user-role-add");
return mv;
}

//查询用户拥有的角色
@RequestMapping("/findRoleByUserId.do")
@PreAuthorize("hasAnyAuthority('/users/findRoleByUserId.do')")
public ModelAndView findRoleByUserId(Integer userId) throws Exception{
ModelAndView mv = new ModelAndView();
User user = userService.findByUid(userId);
List<Role> roleList = userService.findRoleByUserId(userId);
mv.addObject("user", user);
mv.addObject("roleList", roleList);
mv.setViewName("user-role-rmove");
return mv;
}

//移除用户指定的角色
@RequestMapping("/removeRole.do")
@PreAuthorize("hasAnyAuthority('/users/removeRole.do')")
public String removeRole( @RequestParam(name = "userId") Integer userId, @RequestParam(name = "ids") int[] roleIds) throws Exception{
userService.removeRole(userId,roleIds);
return "redirect:findAll.do";
}

//添加用户
@RequestMapping("/save.do")
@PreAuthorize("hasAnyAuthority('/users/save.do')")
public String save(User user) throws Exception {
userService.save(user);
return "redirect:findAll.do";
}

//删除用户,设置status=0
@RequestMapping("/delete.do")
@PreAuthorize("hasAnyAuthority('/users/delete.do')")
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
    @RequestMapping("/findByCid.do")
public ModelAndView findByCid(Integer cid) throws Exception {
ModelAndView mv = new ModelAndView();
Category cate = categoryService.findByCid(cid);
mv.addObject("cateInfo",cate);
mv.setViewName("cate-update");
return mv;
}

//查询所有线路分类
@RequestMapping("/findAll.do")
public ModelAndView findAll(
@RequestParam(name="page",required = true, defaultValue = "1") Integer page,
@RequestParam(name="size",required = true, defaultValue = "10") Integer size,
@RequestParam(name="cname",required = true, defaultValue = "") String cname
) throws Exception{
ModelAndView mv = new ModelAndView();
List<Category> list = categoryService.findAll(page,size,"%"+cname+"%");
PageInfo pageInfo = new PageInfo(list);
mv.addObject("pageInfo",pageInfo);
mv.setViewName("cate-list");
return mv;
}
}
package com.admin.controller;




/**
* @Description: TODO(景点图片信息)
*/
@Controller
@RequestMapping("/images")
public class ImageController {

@Autowired
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
                response.addCookie(user_cookie);
pswd_cookie.setMaxAge(0);
pswd_cookie.setPath("/");
response.addCookie(pswd_cookie);
reme_cookie.setMaxAge(0);
reme_cookie.setPath("/");
response.addCookie(reme_cookie);
}
if (!checkCodeMethod(request,response)){
return;
}
request.getSession().setAttribute("user",u);//登录成功标记
//登录成功
info.setFlag(true);
}
//响应数据
writeValue(info,response);
}

/**
* 查询一个
* @param request
* @param response
* @throws ServletException
* @throws IOException
*/
public void findOne(HttpServletRequest request, HttpServletResponse response) throws IOException {
//从session中获取登录用户
Object user = request.getSession().getAttribute("user");
//将user写回客户端
writeValue(user,response);
}

/**
* 退出功能
* @param request
* @param response
* @throws ServletException
* @throws IOException
*/
public void exit(HttpServletRequest request, HttpServletResponse response) throws IOException {
//1.销毁session
request.getSession().invalidate();
//2.跳转登录页面
response.sendRedirect(request.getContextPath()+"/login.jsp");
}
}


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