基于java+springboot+vue的流浪动物救助微信小程序

项目介绍

饲养宠物可以排解心情并给人带来陪伴,然而现实中有很多人因为冲动、搬家等多种原因遗弃宠物。一边购买宠物、一边遗弃宠物造成恶性循环,被遗弃的动物生活非常艰难,往往活不了多久就离开人世,而且被遗弃的动物也会带来社会的不安全性。喜欢动物的爱心人士非常多,想要对流浪动物进行救助却没有有效的途径,本流浪动物救助微信小程序基于此而开发,为被遗弃的动物提供帮助。

本流浪动物救助微信小程序采用Java语言开发,数据库软件采用Mysql,调试环境为Eclipse,框架为SpringBoot。本系统可以为用户和管理者提供更专业、全面的平台,共同更好的帮助流浪动物,让世面上减少流浪动物。本系统功能为信息发布管理、领养记录管理、动物小圈管理、求助日报管理等。本系统的使用角色为管理员和用户,用户可以发布自己捡到的流浪动物、求领养信息、申请领养,管理员负责系统信息的全面管理以及审核。本系统实现了流浪动物的领养、寻回,提供公益爱心服务。
在这里插入图片描述

开发环境

编程语言:Java
数据库 :Mysql
系统架构:B/S
后端框架:SpringBoot
编译工具:idea或者eclipse,微信开发者工具,jdk1.8,maven
支持定做:java/php/python/android/小程序vue/爬虫/c#/asp.net

系统实现

5.1前台界面的实现
在前台界面里采用导航栏,标题、变幻图、动物信息、搜索框等元素进行设计,前台界面的设计原则采用内容丰富、界面干净整洁的思想。前台是本系统的门面,所有共享信息都可以在此界面找到。管理员负责本界面信息的更新管理。前台界面的实现效果如下图5.1所示:
在这里插入图片描述

图5.1前台界面的实现效果

5.1.1主人寻宠功能的实现界面
主人寻宠界面里以列表框的方式进行展示,在每个列表框里都展示了信息的标题、简介和所属类型等。主人寻宠功能的实现界面如下图5.2所示:
在这里插入图片描述

图5.2主人寻宠功能的浏览界面

5.1.2宠物寻主功能的实现界面
此界面的信息由管理员、用户发布,用户可以浏览其它用户发布的寻主信息并进行评论、领养。宠物寻主功能的展示界面如下图5.3所示:
在这里插入图片描述

图5.3宠物寻主功能的展示界面

5.1.3领养记录功能的实现界面
用户可以在宠物寻主详情里进行领养,加入领养记录里可以在我的界面里查看具体的领养情况。领养记录功能的实现界面如下图5.4所示:
在这里插入图片描述

图5.4领养记录功能的实现界面

5.1.4用户注册、登录功能的实现界面
游客想要成为用户就必须注册,用户注册界面采用信息填写框设置。用户注册界面的实现界面如下图5.5所示:
在这里插入图片描述

图5.5用户注册功能的实现界面
注册成功后可以进入登录界面,在登录界面里设计了注册用户的按钮,实现界面如下图5.6所示:
在这里插入图片描述

图5.6用户登录功能的实现界面

5.1.5评论功能的实现界面
用户可以评论宠物寻主、主人寻宠信息。用户发表评论的实现界面如下图5.7所示:
在这里插入图片描述

图5.7用户发表评论功能的实现界面

5.1.6信息发布功能的实现界面
用户可以发布自己的需求,需要填写具体的资料。实现界面如下图5.8所示:
在这里插入图片描述

图5.8信息发布的功能实现界面

5.1.7动物小圈功能的实现界面
本界面里可以看到关于动物的帖子,用户可以回复和发布帖子。动物小圈功能的实现界面如下图5.9所示:
在这里插入图片描述

图5.9动物小圈功能的实现界面

5.2我的功能的实现界面
用户在我的界面里可以管理自己发布信息以及查询附近的宠物医院、管理发布的评论、查看领养记录、求助日报等。我的功能的实现界面如下图5.10所示:
在这里插入图片描述

图5.10我的功能的实现界面

5.3管理员角色的功能实现界面
管理员可以管理管理员信息、信息发布信息、求助日报信息、领养记录信息、动物小圈信息、个人中心信息、用户信息等。管理员设计的目的是起到监督和信息审核的作用。管理员角色的功能实现界面如下图5.11所示:
在这里插入图片描述
在这里插入图片描述

图5.11管理员角色的功能实现界面

核心代码

package com.controller;

import java.io.File;
import java.math.BigDecimal;
import java.net.URL;
import java.text.SimpleDateFormat;
import com.alibaba.fastjson.JSONObject;
import java.util.*;
import org.springframework.beans.BeanUtils;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.context.ContextLoader;
import javax.servlet.ServletContext;
import com.service.TokenService;
import com.utils.*;
import java.lang.reflect.InvocationTargetException;

import com.service.DictionaryService;
import org.apache.commons.lang3.StringUtils;
import com.annotation.IgnoreAuth;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.entity.*;
import com.entity.view.*;
import com.service.*;
import com.utils.PageUtils;
import com.utils.R;
import com.alibaba.fastjson.*;

/**
 * 信息发布
 * 后端接口
 * @author
 * @email
*/
@RestController
@Controller
@RequestMapping("/xinxifabu")
public class XinxifabuController {
    private static final Logger logger = LoggerFactory.getLogger(XinxifabuController.class);

    @Autowired
    private XinxifabuService xinxifabuService;


    @Autowired
    private TokenService tokenService;
    @Autowired
    private DictionaryService dictionaryService;

    //级联表service
    @Autowired
    private YonghuService yonghuService;



    /**
    * 后端列表
    */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
        logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
        String role = String.valueOf(request.getSession().getAttribute("role"));
        if(StringUtil.isEmpty(role))
            return R.error(511,"权限为空");
        else if("用户".equals(role))
            params.put("yonghuId",request.getSession().getAttribute("userId"));
        if(params.get("orderBy")==null || params.get("orderBy")==""){
            params.put("orderBy","id");
        }
        PageUtils page = xinxifabuService.queryPage(params);

        //字典表数据转换
        List<XinxifabuView> list =(List<XinxifabuView>)page.getList();
        for(XinxifabuView c:list){
            //修改对应字典表字段
            dictionaryService.dictionaryConvert(c, request);
        }
        return R.ok().put("data", page);
    }

    /**
    * 后端详情
    */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id, HttpServletRequest request){
        logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
        XinxifabuEntity xinxifabu = xinxifabuService.selectById(id);
        if(xinxifabu !=null){
            //entity转view
            XinxifabuView view = new XinxifabuView();
            BeanUtils.copyProperties( xinxifabu , view );//把实体数据重构到view中

                //级联表
                YonghuEntity yonghu = yonghuService.selectById(xinxifabu.getYonghuId());
                if(yonghu != null){
                    BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
                    view.setYonghuId(yonghu.getId());
                }
            //修改对应字典表字段
            dictionaryService.dictionaryConvert(view, request);
            return R.ok().put("data", view);
        }else {
            return R.error(511,"查不到数据");
        }

    }

    /**
    * 后端保存
    */
    @RequestMapping("/save")
    public R save(@RequestBody XinxifabuEntity xinxifabu, HttpServletRequest request){
        logger.debug("save方法:,,Controller:{},,xinxifabu:{}",this.getClass().getName(),xinxifabu.toString());

        String role = String.valueOf(request.getSession().getAttribute("role"));
        if(StringUtil.isEmpty(role))
            return R.error(511,"权限为空");
        else if("用户".equals(role))
            xinxifabu.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
        Wrapper<XinxifabuEntity> queryWrapper = new EntityWrapper<XinxifabuEntity>()
            .eq("xinxifabu_name", xinxifabu.getXinxifabuName())
            .eq("xinxifabu_types", xinxifabu.getXinxifabuTypes())
            .eq("yonghu_id", xinxifabu.getYonghuId())
            .eq("xinxifabu_address", xinxifabu.getXinxifabuAddress())
            .eq("chongwu_types", xinxifabu.getChongwuTypes())
            .eq("xinxi_types", xinxifabu.getXinxiTypes())
            ;

        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        XinxifabuEntity xinxifabuEntity = xinxifabuService.selectOne(queryWrapper);
        if(xinxifabuEntity==null){
            xinxifabu.setCreateTime(new Date());
            xinxifabuService.insert(xinxifabu);
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }

    /**
    * 后端修改
    */
    @RequestMapping("/update")
    public R update(@RequestBody XinxifabuEntity xinxifabu, HttpServletRequest request){
        logger.debug("update方法:,,Controller:{},,xinxifabu:{}",this.getClass().getName(),xinxifabu.toString());

        String role = String.valueOf(request.getSession().getAttribute("role"));
        if(StringUtil.isEmpty(role))
            return R.error(511,"权限为空");
        else if("用户".equals(role))
            xinxifabu.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
        //根据字段查询是否有相同数据
        Wrapper<XinxifabuEntity> queryWrapper = new EntityWrapper<XinxifabuEntity>()
            .notIn("id",xinxifabu.getId())
            .andNew()
            .eq("xinxifabu_name", xinxifabu.getXinxifabuName())
            .eq("xinxifabu_types", xinxifabu.getXinxifabuTypes())
            .eq("yonghu_id", xinxifabu.getYonghuId())
            .eq("xinxifabu_address", xinxifabu.getXinxifabuAddress())
            .eq("chongwu_types", xinxifabu.getChongwuTypes())
            .eq("xinxi_types", xinxifabu.getXinxiTypes())
            ;

        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        XinxifabuEntity xinxifabuEntity = xinxifabuService.selectOne(queryWrapper);
        if("".equals(xinxifabu.getXinxifabuPhoto()) || "null".equals(xinxifabu.getXinxifabuPhoto())){
                xinxifabu.setXinxifabuPhoto(null);
        }
        if(xinxifabuEntity==null){
            //  String role = String.valueOf(request.getSession().getAttribute("role"));
            //  if("".equals(role)){
            //      xinxifabu.set
            //  }
            xinxifabuService.updateById(xinxifabu);//根据id更新
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }

    /**
    * 删除
    */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] ids){
        logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
        xinxifabuService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }

    /**
     * 批量上传
     */
    @RequestMapping("/batchInsert")
    public R save( String fileName){
        logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);
        try {
            List<XinxifabuEntity> xinxifabuList = new ArrayList<>();//上传的东西
            Map<String, List<String>> seachFields= new HashMap<>();//要查询的字段
            Date date = new Date();
            int lastIndexOf = fileName.lastIndexOf(".");
            if(lastIndexOf == -1){
                return R.error(511,"该文件没有后缀");
            }else{
                String suffix = fileName.substring(lastIndexOf);
                if(!".xls".equals(suffix)){
                    return R.error(511,"只支持后缀为xls的excel文件");
                }else{
                    URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);//获取文件路径
                    File file = new File(resource.getFile());
                    if(!file.exists()){
                        return R.error(511,"找不到上传文件,请联系管理员");
                    }else{
                        List<List<String>> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件
                        dataList.remove(0);//删除第一行,因为第一行是提示
                        for(List<String> data:dataList){
                            //循环
                            XinxifabuEntity xinxifabuEntity = new XinxifabuEntity();
//                            xinxifabuEntity.setXinxifabuName(data.get(0));                    //标题 要改的
//                            xinxifabuEntity.setXinxifabuTypes(Integer.valueOf(data.get(0)));   //类型 要改的
//                            xinxifabuEntity.setYonghuId(Integer.valueOf(data.get(0)));   //发布用户 要改的
//                            xinxifabuEntity.setXinxifabuPhoto("");//照片
//                            xinxifabuEntity.setXinxifabuAddress(data.get(0));                    //地点 要改的
//                            xinxifabuEntity.setChongwuTypes(Integer.valueOf(data.get(0)));   //宠物类型 要改的
//                            xinxifabuEntity.setXinxifabuTime(new Date(data.get(0)));          //时间 要改的
//                            xinxifabuEntity.setXinxiTypes(Integer.valueOf(data.get(0)));   //信息状态 要改的
//                            xinxifabuEntity.setXinxifabuContent("");//照片
//                            xinxifabuEntity.setCreateTime(date);//时间
                            xinxifabuList.add(xinxifabuEntity);


                            //把要查询是否重复的字段放入map中
                        }

                        //查询是否重复
                        xinxifabuService.insertBatch(xinxifabuList);
                        return R.ok();
                    }
                }
            }
        }catch (Exception e){
            return R.error(511,"批量插入数据异常,请联系管理员");
        }
    }




    /**
    * 前端列表
    */
    @IgnoreAuth
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){
        logger.debug("list方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));

        // 没有指定排序字段就默认id倒序
        if(StringUtil.isEmpty(String.valueOf(params.get("orderBy")))){
            params.put("orderBy","id");
        }
        PageUtils page = xinxifabuService.queryPage(params);

        //字典表数据转换
        List<XinxifabuView> list =(List<XinxifabuView>)page.getList();
        for(XinxifabuView c:list)
            dictionaryService.dictionaryConvert(c, request); //修改对应字典表字段
        return R.ok().put("data", page);
    }

    /**
    * 前端详情
    */
    @RequestMapping("/detail/{id}")
    public R detail(@PathVariable("id") Long id, HttpServletRequest request){
        logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
        XinxifabuEntity xinxifabu = xinxifabuService.selectById(id);
            if(xinxifabu !=null){


                //entity转view
                XinxifabuView view = new XinxifabuView();
                BeanUtils.copyProperties( xinxifabu , view );//把实体数据重构到view中

                //级联表
                    YonghuEntity yonghu = yonghuService.selectById(xinxifabu.getYonghuId());
                if(yonghu != null){
                    BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
                    view.setYonghuId(yonghu.getId());
                }
                //修改对应字典表字段
                dictionaryService.dictionaryConvert(view, request);
                return R.ok().put("data", view);
            }else {
                return R.error(511,"查不到数据");
            }
    }


    /**
    * 前端保存
    */
    @RequestMapping("/add")
    public R add(@RequestBody XinxifabuEntity xinxifabu, HttpServletRequest request){
        logger.debug("add方法:,,Controller:{},,xinxifabu:{}",this.getClass().getName(),xinxifabu.toString());
        Wrapper<XinxifabuEntity> queryWrapper = new EntityWrapper<XinxifabuEntity>()
            .eq("xinxifabu_name", xinxifabu.getXinxifabuName())
            .eq("xinxifabu_types", xinxifabu.getXinxifabuTypes())
            .eq("yonghu_id", xinxifabu.getYonghuId())
            .eq("xinxifabu_address", xinxifabu.getXinxifabuAddress())
            .eq("chongwu_types", xinxifabu.getChongwuTypes())
            .eq("xinxi_types", xinxifabu.getXinxiTypes())
            ;
        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        XinxifabuEntity xinxifabuEntity = xinxifabuService.selectOne(queryWrapper);
        if(xinxifabuEntity==null){
            xinxifabu.setCreateTime(new Date());
        //  String role = String.valueOf(request.getSession().getAttribute("role"));
        //  if("".equals(role)){
        //      xinxifabu.set
        //  }
        xinxifabuService.insert(xinxifabu);
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }



}

论文参考

在这里插入图片描述

目 录
摘 要 I
Abstract II
第1章 绪论 1
1.1课题背景 1
1.2课题研究现状与实现意义 1
1.3课题实现内容 2
1.4课题实现的目标 2
第2章 系统开发所使用关键技术、环境的选择 3
2.1关键技术、环境的选择原则 3
2.2 Java语言介绍 3
2.3 Eclipse软件介绍 3
2.4 Mysql数据库 4
2.5 SpringBoot框架 4
2.6微信小程序 4
第3章 系统全面分析 5
3.1系统需求分析 5
3.2系统可行性分析 5
3.2.1技术可行性分析 5
3.2.2操作可行性分析 5
3.2.3安全可行性 6
3.3系统非功能方面的分析 6
3.4系统功能分析 6
3.5系统流程分析 7
3.6系统数据活动分析 8
3.7系统权限用例分析 9
第4章 系统设计 11
4.1系统设计目标 11
4.2系统功能结构图 11
4.3系统的数据库设计 11
4.3.1数据库概念结构设计 11
4.3.2数据库逻辑结构设计 14
第5章 系统实现 18
5.1前台界面的实现 18
5.1.1主人寻宠功能的实现界面 18
5.1.2宠物寻主功能的实现界面 19
5.1.3领养记录功能的实现界面 20
5.1.4用户注册、登录功能的实现界面 21
5.1.5评论功能的实现界面 23
5.1.6信息发布功能的实现界面 24
5.1.7动物小圈功能的实现界面 25
5.2我的功能的实现界面 26
5.3管理员角色的功能实现界面 27
第6章 系统测试 28
6.1系统测试的目的与重要性 28
6.2系统测试的方法与步骤 28
6.3系统测试的条件和环境 28
6.4测试实例 28
6.4.1管理员信息发布管理功能的测试 28
6.4.2用户发布功能的测试 29
6.4.3申请领养功能的测试 30
6.5测试总结 30
总 结 31
参考文献 32
致 谢 34

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

qq_3306428634

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值