首页 > 分享 > 案例138基于Spring Boot的宠物领养系统的设计与实现

案例138基于Spring Boot的宠物领养系统的设计与实现

目录

功能描述

系统设计

功能展示

实现代码

为什么选择我?

项目推荐

获取源码

结尾名片获取源码

开发语言:Java

框架:SpringBoot

持久化框架:Mybatis-plus

JDK版本:JDK1.8

服务器:tomcat789

数据库:mysql 5.7以上

数据库工具:Navicat11以上

开发软件:eclipse/myeclipse/idea

Maven:Maven3.5.4

浏览器:谷歌浏览器Edge

功能描述

如今社会上各行各业,都在用属于自己专用的软件来进行工作,互联网发展到这个时候,人们已经发现离不开了互联网。互联网的发展,离不开一些新的技术,而新技术的产生往往是为了解决现有问题而产生的。针对于宠物领养信息管理方面的不规范,容错率低,管理人员处理数据费工费时,采用新开发的宠物领养系统可以从根源上规范整个数据处理流程的正规性和合法性。

宠物领养系统能够实现用户管理,宠物领养管理,宠物认领管理,教学视频管理,感谢信管理,公告管理,宠物领养审核管理,宠物认领审核管理等功能。该系统采用了Mysql数据库,Java语言,Spring Boot框架等技术进行编程实现。

宠物领养系统可以提高宠物领养信息管理问题的解决效率,优化宠物领养信息处理流程,并且能够保证存储数据的安全,它是一个非常可靠,非常安全的应用程序。

系统设计

图4.1即为设计的管理员功能结构,管理员权限操作的功能包括对注册用户信息的管理,对宠物领养,宠物认领,教学视频,感谢信以及公告进行管理,审核宠物领养以及认领的信息。

 

图4.2即为设计的用户功能结构,用户权限操作的功能包括申请领养宠物,申请认领宠物,查看申请的宠物领养或申请的宠物认领的审核状态,发布感谢信,查看或对教学视频进行收藏以及留言。 

 

功能展示

图5.1 即为编码实现的宠物领养管理界面,管理员在该界面中发布需要领养的宠物的资料,可以对宠物领养的信息进行更改,查询,删除。

 

图5.2 即为编码实现的宠物领养审核管理界面,管理员在该界面中对用户申请领养的宠物进行线上审核,管理员对宠物领养的信息审核通过之后,该宠物的领养状态就是被领养的状态了。 

 

图5.3 即为编码实现的宠物认领管理界面,管理员在该界面中发布宠物的认领信息,其中包括宠物的图片,宠物的类型等信息,管理员对宠物的认领信息也能更改,查询,删除。 

 

图5.4 即为编码实现的宠物认领审核管理界面,管理员在该界面中对用户申请认领的宠物信息进行线上审核,审核后的宠物认领信息只能进行查看和查询。 

 

图5.5 即为编码实现的教学视频管理界面,管理员在该界面中主要是上传教学视频,对教学视频信息包括视频文件,视频标题等资料进行更改,查询,或删除,可以查看已发布教学视频的用户点赞数等信息。 

 

图5.6 即为编码实现的宠物领养界面,用户在该界面中查看宠物领养的介绍信息,只能对未被领养的宠物进行申请领养,已经被领养的宠物只能查看其介绍信息。 

 

图5.7 即为编码实现的宠物认领界面,用户在该界面中查看宠物认领信息,已经找到主人的宠物不支持认领。还没有找到主人的宠物才能进行申请认领。 

 

图5.8 即为编码实现的教学视频界面,用户在该界面中主要就是播放教学视频,在教学视频下方发布留言,该教学视频也支持用户在当前页面进行收藏,方便下次查看。 

 

图5.9 即为编码实现的感谢信管理界面,用户在该界面中可以发布感谢信,对感谢信的内容进行更改,查询,删除。 

 

实现代码

Controller层

package com.controller;

import java.util.Arrays;

import java.util.Calendar;

import java.util.Date;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.stereotype.Controller;

import org.springframework.web.bind.annotation.GetMapping;

import org.springframework.web.bind.annotation.PathVariable;

import org.springframework.web.bind.annotation.PostMapping;

import org.springframework.web.bind.annotation.RequestBody;

import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;

import org.springframework.web.bind.annotation.ResponseBody;

import org.springframework.web.bind.annotation.RestController;

import com.annotation.IgnoreAuth;

import com.baomidou.mybatisplus.mapper.EntityWrapper;

import com.entity.TokenEntity;

import com.entity.UserEntity;

import com.service.TokenService;

import com.service.UserService;

import com.utils.CommonUtil;

import com.utils.MD5Util;

import com.utils.MPUtil;

import com.utils.PageUtils;

import com.utils.R;

import com.utils.ValidatorUtils;

@RequestMapping("users")

@RestController

public class UserController{

@Autowired

private UserService userService;

@Autowired

private TokenService tokenService;

@IgnoreAuth

@PostMapping(value = "/login")

public R login(String username, String password, String captcha, HttpServletRequest request) {

UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));

if(user==null || !user.getPassword().equals(password)) {

return R.error("账号或密码不正确");

}

String token = tokenService.generateToken(user.getId(),username, "users", user.getRole());

return R.ok().put("token", token);

}

@IgnoreAuth

@PostMapping(value = "/register")

public R register(@RequestBody UserEntity user){

if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {

return R.error("用户已存在");

}

userService.insert(user);

return R.ok();

}

@GetMapping(value = "logout")

public R logout(HttpServletRequest request) {

request.getSession().invalidate();

return R.ok("退出成功");

}

@IgnoreAuth

@RequestMapping(value = "/resetPass")

public R resetPass(String username, HttpServletRequest request){

UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));

if(user==null) {

return R.error("账号不存在");

}

user.setPassword("123456");

userService.update(user,null);

return R.ok("密码已重置为:123456");

}

@RequestMapping("/page")

public R page(@RequestParam Map<String, Object> params,UserEntity user){

EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();

PageUtils page = userService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.allLike(ew, user), params), params));

return R.ok().put("data", page);

}

@RequestMapping("/list")

public R list( UserEntity user){

EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();

ew.allEq(MPUtil.allEQMapPre( user, "user"));

return R.ok().put("data", userService.selectListView(ew));

}

@RequestMapping("/info/{id}")

public R info(@PathVariable("id") String id){

UserEntity user = userService.selectById(id);

return R.ok().put("data", user);

}

@RequestMapping("/session")

public R getCurrUser(HttpServletRequest request){

Long id = (Long)request.getSession().getAttribute("userId");

UserEntity user = userService.selectById(id);

return R.ok().put("data", user);

}

@PostMapping("/save")

public R save(@RequestBody UserEntity user){

if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {

return R.error("用户已存在");

}

userService.insert(user);

return R.ok();

}

@RequestMapping("/update")

public R update(@RequestBody UserEntity user){

userService.updateById(user);

return R.ok();

}

@RequestMapping("/delete")

public R delete(@RequestBody Long[] ids){

userService.deleteBatchIds(Arrays.asList(ids));

return R.ok();

}

}

Dao层

package com.dao;

import java.util.List;

import org.apache.ibatis.annotations.Param;

import com.baomidou.mybatisplus.mapper.BaseMapper;

import com.baomidou.mybatisplus.mapper.Wrapper;

import com.baomidou.mybatisplus.plugins.pagination.Pagination;

import com.entity.UserEntity;

public interface UserDao extends BaseMapper<UserEntity> {

List<UserEntity> selectListView(@Param("ew") Wrapper<UserEntity> wrapper);

List<UserEntity> selectListView(Pagination page,@Param("ew") Wrapper<UserEntity> wrapper);

}

Server层

package com.service;

import java.util.List;

import java.util.Map;

import org.apache.ibatis.annotations.Param;

import com.baomidou.mybatisplus.mapper.Wrapper;

import com.baomidou.mybatisplus.service.IService;

import com.entity.UserEntity;

import com.utils.PageUtils;

public interface UserService extends IService<UserEntity> {

PageUtils queryPage(Map<String, Object> params);

List<UserEntity> selectListView(Wrapper<UserEntity> wrapper);

PageUtils queryPage(Map<String, Object> params,Wrapper<UserEntity> wrapper);

}

package com.service.impl;

import java.util.List;

import java.util.Map;

import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.mapper.EntityWrapper;

import com.baomidou.mybatisplus.mapper.Wrapper;

import com.baomidou.mybatisplus.plugins.Page;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;

import com.dao.UserDao;

import com.entity.UserEntity;

import com.service.UserService;

import com.utils.PageUtils;

import com.utils.Query;

@Service("userService")

public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements UserService {

@Override

public PageUtils queryPage(Map<String, Object> params) {

Page<UserEntity> page = this.selectPage(

new Query<UserEntity>(params).getPage(),

new EntityWrapper<UserEntity>()

);

return new PageUtils(page);

}

@Override

public List<UserEntity> selectListView(Wrapper<UserEntity> wrapper) {

return baseMapper.selectListView(wrapper);

}

@Override

public PageUtils queryPage(Map<String, Object> params,

Wrapper<UserEntity> wrapper) {

Page<UserEntity> page =new Query<UserEntity>(params).getPage();

page.setRecords(baseMapper.selectListView(page,wrapper));

PageUtils pageUtil = new PageUtils(page);

return pageUtil;

}

}

权限验证

package com.interceptor;

import java.io.IOException;

import java.io.PrintWriter;

import java.util.HashMap;

import java.util.Map;

import com.alibaba.fastjson.JSONObject;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

import org.apache.commons.lang3.StringUtils;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.stereotype.Component;

import org.springframework.web.method.HandlerMethod;

import org.springframework.web.servlet.HandlerInterceptor;

import com.annotation.IgnoreAuth;

import com.entity.EIException;

import com.entity.TokenEntity;

import com.service.TokenService;

import com.utils.R;

@Component

public class AuthorizationInterceptor implements HandlerInterceptor {

public static final String LOGIN_TOKEN_KEY = "Token";

@Autowired

private TokenService tokenService;

@Override

public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {

response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");

response.setHeader("Access-Control-Max-Age", "3600");

response.setHeader("Access-Control-Allow-Credentials", "true");

response.setHeader("Access-Control-Allow-Headers", "x-requested-with,request-source,Token, Origin,imgType, Content-Type, cache-control,postman-token,Cookie, Accept,authorization");

response.setHeader("Access-Control-Allow-Origin", request.getHeader("Origin"));

IgnoreAuth annotation;

if (handler instanceof HandlerMethod) {

annotation = ((HandlerMethod) handler).getMethodAnnotation(IgnoreAuth.class);

} else {

return true;

}

String token = request.getHeader(LOGIN_TOKEN_KEY);

if(annotation!=null) {

return true;

}

TokenEntity tokenEntity = null;

if(StringUtils.isNotBlank(token)) {

tokenEntity = tokenService.getTokenEntity(token);

}

if(tokenEntity != null) {

request.getSession().setAttribute("userId", tokenEntity.getUserid());

request.getSession().setAttribute("role", tokenEntity.getRole());

request.getSession().setAttribute("tableName", tokenEntity.getTablename());

request.getSession().setAttribute("username", tokenEntity.getUsername());

return true;

}

PrintWriter writer = null;

response.setCharacterEncoding("UTF-8");

response.setContentType("application/json; charset=utf-8");

try {

writer = response.getWriter();

writer.print(JSONObject.toJSONString(R.error(401, "请先登录")));

} finally {

if(writer != null){

writer.close();

}

}

return false;

}

}

为什么选择我?

选择我作为您的毕业设计系统开发伙伴,是基于以下几个关键理由:

专业经验:我拥有丰富的软件开发经验,特别是在教育技术和信息系统方面。我了解毕业设计流程的复杂性,能够针对性地提供解决方案,确保系统的实用性和高效性。

定制化服务:我明白每个教育机构都有其独特的需求和挑战。我将与您紧密合作,深入了解您的具体要求,从而开发出完全符合您需求的定制化系统。

技术专长:我对最新的编程语言和开发工具有深入的了解,能够运用先进的技术来构建安全、稳定且易于维护的系统。无论是前端用户体验还是后端数据处理,我都能够提供专业的技术支持。

项目管理能力:我具备良好的项目管理技能,能够确保项目按时按质完成。我会制定详细的项目计划,并与您保持密切沟通,确保项目的每个阶段都能满足预期目标。

持续支持与维护:系统开发完成后,我将提供持续的技术支持和维护服务。这包括定期的系统更新、故障排除以及根据用户反馈进行的功能改进。

成本效益:我提供的是高性价比的服务。通过高效的项目管理和合理的资源配置,我能够在保证质量的前提下,为您节省不必要的开支。

综上所述,我的专业技能、定制化服务、技术专长、项目管理能力以及对客户的长期承诺,都是您选择我作为毕业设计系统开发伙伴的有力理由。

项目推荐

题目未定的小伙伴可以看看下面找找灵感

Java Spring Boot框架合集

Java 微信小程序(UNIAPP、云原生)合集

Java Android合集

Java SSM框架合集

Python Djaogo框架合集

获取源码

大家点赞、关注加收藏!下方名片获取源码啦!

相关知识

基于Spring Boot的宠物领养系统开发教程及源码
基于 Spring Boot + Vue 的宠物领养系统设计与实现
基于Spring Boot的宠物领养系统的设计与实现
基于Spring Boot的宠物医院管理系统设计与实现
(附源码)基于Spring Boot与Vue的宠物用品销售系统设计与实现
基于Spring Boot的宠物咖啡馆平台的设计与实现
Spring Boot宠物医院管理系统设计与实现
基于Spring Boot的宠物医院管理系统的设计与实现
基于宠物领养系统的设计与实现
Spring Boot宠物购物商城网站系统设计与实现

网址: 案例138基于Spring Boot的宠物领养系统的设计与实现 https://m.mcbbbk.com/newsview842987.html

所属分类:萌宠日常
上一篇: 基于Javaweb的宠物认领管理
下一篇: 基于springboot的宠物认