流浪猫狗救助管理系统。该项目分为前后台;
前台主要功能包括:会员的注册登陆,流浪猫狗知识,领养中心,团队活动,流浪宠物详情,申请领养等;
后台主要功能包括:管理员的用户信息管理,流浪猫狗信息管理,管理员信息管理,领养管理,评论管理,团队活动管理,志愿者申请信息管理,同意/不同意领养信息列表等
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 {
@Autowired
UserService userService;
@Autowired
PostMapper postMapper;
@Autowired
ShareMapper shareMapper;
@Autowired
SponsorMapper 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 {
@Autowired
IndexService indexService;
@Autowired
NoticeService noticeService;
@Autowired
DetailsService detailsService;
@Autowired
PostService postService;
@Autowired
SponsorService sponsorService;
@Autowired
ShareService shareService;
@Autowired
CommentMapper commentMapper;
@Autowired
HttpSession session;
@Autowired
ReportService reportService;
@Autowired
SentenceService sentenceService;
@GetMapping
public 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 {
@Autowired
UserService 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")
@ResponseBody
public 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")
@ResponseBody
public 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")
@ResponseBody
public 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")
@ResponseBody
public JsonResult getCode(@RequestParam(value ="userPhone") String userPhone,HttpSession session){
DuanxinService duanxinService=new DuanxinService();
session.setAttribute(CatConst.USER_SESSION_CODE,"1234");
return new JsonResult(true,"发送成功");
}
}
相关知识
基于SSM的宠物(流浪猫狗)领养管理系统
基于springboot的流浪动物救助管理系统
【毕业设计之java系列】基于springboot流浪猫狗领养管理系统
流浪动物救助管理系统(开题报告+源码)
番茄牛肉人/流浪猫狗领养救助平台管理系统
java计算机毕业设计宠物救助管理系统(开题+程序+论文)
流浪猫狗领养管理系统
Java计算机毕业设计流浪宠物救助中心(开题报告+源码+论文)
流浪猫狗救助救援网站
java计算机毕业设计动物救助系统(开题+程序+论文)
网址: Java项目:流浪猫狗救助管理系统(java+SSM+JSP+bootstrap+jQuery+mysql) https://m.mcbbbk.com/newsview641125.html
上一篇: 【免费】基于SpringBoot |
下一篇: 给流浪宠物安个家 镇江“流浪猫狗 |