Java项目:流浪猫狗救助管理系统(java+SSM+JSP+bootstrap+jQuery+mysql)

编程入门 行业动态 更新时间:2024-10-26 20:24:35

Java项目:流浪猫狗救助<a href=https://www.elefans.com/category/jswz/34/1769858.html style=管理系统(java+SSM+JSP+bootstrap+jQuery+mysql)"/>

Java项目:流浪猫狗救助管理系统(java+SSM+JSP+bootstrap+jQuery+mysql)

源码获取:博客首页 "资源" 里下载!

项目介绍

流浪猫狗救助管理系统。该项目分为前后台;
前台主要功能包括:会员的注册登陆,流浪猫狗知识,领养中心,团队活动,流浪宠物详情,申请领养等;
后台主要功能包括:管理员的用户信息管理,流浪猫狗信息管理,管理员信息管理,领养管理,评论管理,团队活动管理,志愿者申请信息管理,同意/不同意领养信息列表等

环境需要

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 8.0版本;


技术栈

1. 后端:Spring SpringMVC MyBatis
2. 前端:JSP+bootstrap+jQuery


使用说明

1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 将项目中db.properties配置文件中的数据库配置改为自己的配置
3. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
若为maven项目,导入成功后请执行maven clean;maven install命令,配置tomcat,然后运行;
4. 运行项目,
前台地址 http://localhost:8080/web/animal/index.jsp
后台地址 http://localhost:8080/web/animal/admin/login.jsp

 

 

 

 

 

 

后台管理员控制层:

@Controller
@RequestMapping("admin/user")
public class adminUserController {@AutowiredUserService userService;@AutowiredPostMapper postMapper;@AutowiredShareMapper shareMapper;@AutowiredSponsorMapper sponsorMapper;@GetMapping("")public String write(Model model, HttpSession session,@RequestParam(value = "page", defaultValue = "1") int page,@RequestParam(value = "limit", defaultValue = "12") int limit){model.addAttribute("info",userService.queryUserAll(page,limit));return "admin/admin_user";}@GetMapping("delete")public String deleteUser(@RequestParam("userId") int userId){User user=userService.queryUserById(userId);if(user.getUserPhone().equals("1111")){return "redirect:/admin/user";}postMapper.deletePostByPhone(user.getUserPhone());shareMapper.deleteShareByPhone(user.getUserPhone());sponsorMapper.deleteSponsorByPhone(user.getUserPhone());userService.deleteUser(userId);return "redirect:/admin/user";}}

详情管理控制层: 

@Controller
@RequestMapping("details")
public class detailsController {@AutowiredIndexService indexService;@AutowiredNoticeService noticeService;@AutowiredDetailsService detailsService;@AutowiredPostService postService;@AutowiredSponsorService sponsorService;@AutowiredShareService shareService;@AutowiredCommentMapper commentMapper;@AutowiredHttpSession session;@AutowiredReportService reportService;@AutowiredSentenceService sentenceService;@GetMappingpublic String index(Model model,Integer id,String status){int i=-1;if(status.equals(IndexFrom.Post.getDesc())){i=0;}else if(status.equals(IndexFrom.Share.getDesc())){i=1;} else if(status.equals(IndexFrom.Sponsor.getDesc())){i=2;}session.setAttribute(CatConst.USER_DETAILS_STATUS,i);session.setAttribute(CatConst.USER_DETAILS_CODE,id);model.addAttribute("comments",detailsService.findComment(i,id));detailsService.addCount(id,i);model.addAttribute("count",commentMapper.queryCount1(id,i));model.addAttribute("recommends",detailsService.findRecommends(i));IndexVo info=detailsService.findDetails(id,i);model.addAttribute("info",info);model.addAttribute("url",TitleUtil.getUrl());List<IndexVo> indexMax=indexService.findMaxCount();List<Notice> notices=noticeService.queryNotice();model.addAttribute("notices",notices);model.addAttribute("indexMax",indexMax);Sentence sentence=sentenceService.findSentence();model.addAttribute("sentence",sentence);return "details";}@PostMapping("interceptor/addComment")public String comment(String comment,Model model){int i= (int) session.getAttribute(CatConst.USER_DETAILS_STATUS);int id= (int) session.getAttribute(CatConst.USER_DETAILS_CODE);User user= (User) session.getAttribute("user_session");Comment comment1=new Comment();comment1.setCommentContent(comment);comment1.setCommentPhone(user.getUserPhone());comment1.setCommentCreatetime(new Date());comment1.setCommentPsId(id);comment1.setCommentSource(i);commentMapper.addComment(comment1);model.addAttribute("comments",detailsService.findComment(i,id));detailsService.addCount(id,i);model.addAttribute("count",commentMapper.queryCount1(id,i));model.addAttribute("recommends",detailsService.findRecommends(i));IndexVo info=detailsService.findDetails(id,i);model.addAttribute("info",info);List<IndexVo> indexMax=indexService.findMaxCount();List<Notice> notices=noticeService.queryNotice();model.addAttribute("notices",notices);model.addAttribute("indexMax",indexMax);Sentence sentence=sentenceService.findSentence();model.addAttribute("sentence",sentence);model.addAttribute("url",TitleUtil.getUrl());return "details";}@PostMapping("interceptor/report")public String report(String reason,Model model){int i= (int) session.getAttribute(CatConst.USER_DETAILS_STATUS);int id= (int) session.getAttribute(CatConst.USER_DETAILS_CODE);User user= (User) session.getAttribute("user_session");if(reason.equals("")==false){Report report=new Report();report.setReportUser(user.getUserNickname());report.setReportCreatetime(new Date());report.setReportContent(reason);if(i==0){report.setReportFrom("启示");}if(i==1){report.setReportFrom("分享");}if(i==2){report.setReportFrom("赞助");}report.setReportFromId(id);reportService.addReport(report);}model.addAttribute("comments",detailsService.findComment(i,id));detailsService.addCount(id,i);model.addAttribute("recommends",detailsService.findRecommends(i));IndexVo info=detailsService.findDetails(id,i);model.addAttribute("info",info);List<IndexVo> indexMax=indexService.findMaxCount();List<Notice> notices=noticeService.queryNotice();model.addAttribute("notices",notices);model.addAttribute("indexMax",indexMax);Sentence sentence=sentenceService.findSentence();model.addAttribute("sentence",sentence);model.addAttribute("url",TitleUtil.getUrl());return "details";}
}

登录管理控制层:

@Controller
@RequestMapping("")
public class loginController {@AutowiredUserService userService;@GetMapping(value = {"/login"})public String login(){return "login";}@GetMapping("reBack")public String reBack(HttpSession session){String url= (String) session.getAttribute("user_old_url");if(url==null){url="/";}return "redirect:"+url;}@GetMapping(value = {"login1"})public String login1(@RequestParam(value ="userUrl") String userUrl,HttpSession session){if(userUrl!=null){session.setAttribute(CatConst.USER_SESSION_URL,userUrl);}return "login";}@PostMapping("login/getLogin")@ResponseBodypublic LoginResult getLogin(@RequestParam(value ="phone") String phone,@RequestParam(value ="password") String password, HttpSession session) {User user = userService.queryByPhone(phone);if(user!=null){if(user.getUserPassword().equals(MD5Util.getMD5(password))){session.setAttribute(CatConst.USER_SESSION_KEY, user);if(user.getUserPhone().equals("1111")){session.setAttribute(CatConst.USER_SESSION_administrators, user.getUserPhone());}return new LoginResult(true, "登录成功");}else {return new LoginResult(false, "密码错误");}}else {return new LoginResult(false, "用户名错误");}}@PostMapping("/login/register")@ResponseBodypublic JsonResult register(User user,@RequestParam(value ="userCode") String userCode,HttpSession session){String code=session.getAttribute(CatConst.USER_SESSION_CODE).toString();if(code.equals(userCode)){if(userService.queryByPhone(user.getUserPhone())!=null){return new JsonResult(false, "电话号码已经注册!");}else {user.setUserPassword(MD5Util.getMD5(user.getUserPassword()));user.setUserCreatetime(new Date());user.setUserUrl(TitleUtil.getUrl());int i=userService.addUser(user);if(i==1){session.removeAttribute(CatConst.USER_SESSION_CODE);return new JsonResult(true, "注册成功!");}else {return new JsonResult(false, "注册失败!");}}}else {return new JsonResult(false, "验证码错误!");}}@PostMapping("login/updatePassword")@ResponseBodypublic JsonResult updatePassword(@RequestParam(value ="userPhone") String userPhone,@RequestParam(value ="userCode") String userCode,@RequestParam(value ="userPassword") String userPassword,HttpSession session){String code=session.getAttribute(CatConst.USER_SESSION_CODE).toString();if(code.equals(userCode)){int i=userService.updateUserPhone(MD5Util.getMD5(userPassword),userPhone);if(i==1){session.removeAttribute(CatConst.USER_SESSION_CODE);return new JsonResult(true, "密码更新成功!");}else {return new JsonResult(false, "密码更新失败!");}}else {return new JsonResult(false, "验证码错误!");}}@PostMapping("login/getCode")@ResponseBodypublic JsonResult getCode(@RequestParam(value ="userPhone") String userPhone,HttpSession session){DuanxinService duanxinService=new DuanxinService();
//       int code=duanxinService.duanXin(userPhone);session.setAttribute(CatConst.USER_SESSION_CODE,"1234");return new JsonResult(true,"发送成功");}//    有时,一些网站的部分操作需要登录才能访问。如果跳转到登录界面登录成功后,怎样才能返回到登录之前的界面呢?
//    很简单,我们在代码部分中添加一部分很少的代码即可。在从一个页面跳转到登录界面之前的代码,我们用session保
//    存当前界面的url信息,在跳转到登录界面,登录成功后的代码中,判读是否有这个session信息,如果有,则跳转到
//    session所存的url,记住跳转前清空这个session,否则在未关闭浏览器重新登录时可能又会跳到session中所存储url的界面。}

源码获取:博客首页 "资源" 里下载! 

更多推荐

Java项目:流浪猫狗救助管理系统(java+SSM+JSP+bootstrap+jQuery+mysql)

本文发布于:2023-06-20 04:23:56,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/796037.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:管理系统   猫狗   项目   java   Java

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!