基于Springboot实现留守儿童管理系统

Posted 编程指南针

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了基于Springboot实现留守儿童管理系统相关的知识,希望对你有一定的参考价值。

作者主页:编程指南针

作者简介:Java领域优质创作者、CSDN博客专家 、掘金特邀作者、多年架构师设计经验、腾讯课堂常驻讲师

主要内容:Java项目、毕业设计、简历模板、学习资料、面试题库、技术互助

文末获取源码 

项目编号:BS-XX-149

一,项目简介

本项目基于Springboot+Mybatis开发实现一个儿童留守管理系统,主要为农村留守儿童做一个保障,进行关爱和关心。系统的用户主要有两个角色:管理员和社区工作人员

管理员:

  1. 管理员管理
  2. 留守儿童管理
  3. 社区工作人员管理
  4. 审核管理:人员注册审核、账户注销审核、删除儿童信息审核 审核结果发送到人员注册时的邮箱中
  5. 信息反馈
  6. 系统公告管理
  7. 信息反馈管理
  8. 信息统计

社区工作人员:

  1. 账户注册
  2. 留守儿童管理
  3. 信息反馈
  4. 信息统计

二,环境介绍

语言环境:Java:  jdk1.8

数据库:mysql: mysql5.7

应用服务器:Tomcat:  tomcat8.5.31

开发工具:IDEA或eclipse

后台开发技术:Springboot+Mybatis   邮件发送通知

前台开发技术:BootStrap+Jquery+Echart

三,系统展示

管理员

首页统计及公告查看

管理员管理

留守儿童管理

社区工作人员管理

注册审核

账户注销审核

删除儿童审核

系统公告

信息反馈管理

社区工作人员

登陆管理首页

留守儿童管理

信息反馈

个人中心

账户管理

四,核心代码展示

package com.wj2y.lbcmsystem.controller;



import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wj2y.lbcmsystem.mapper.RoleMapper;
import com.wj2y.lbcmsystem.mapper.UserMapper;
import com.wj2y.lbcmsystem.pojo.Role;
import com.wj2y.lbcmsystem.pojo.User;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;

import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.lang.reflect.Array;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;


/**
 * @author wj2y
 * @date 2022-01-06 15:49
 * @Version 1.0
 */
@Controller
public class AdminController 
    @Autowired
    UserMapper userMapper;

    @Autowired
    RoleMapper roleMapper;

    @RequestMapping("/adminList")
    public String adminList(Model model,@RequestParam(defaultValue = "1") Integer startPage,
                            @RequestParam(defaultValue = "10") Integer pageSize)
        PageHelper.startPage(startPage, pageSize);
        List<User> users = userMapper.queryUserList();
        PageInfo<User> usersPageInfo = new PageInfo<>(users);
        model.addAttribute("usersPageInfo", usersPageInfo);
        model.addAttribute("users",users);
        return "admin/adminList";
    

    @RequestMapping("/searchUser")
    public String searchUser(String userName, Model model, @RequestParam(defaultValue = "1") Integer startPage,
                             @RequestParam(defaultValue = "10") Integer pageSize, HttpSession session)
        PageHelper.startPage(startPage, pageSize);
        List<User> users = userMapper.queryListUserByUserName(userName);
        PageInfo<User> usersPageInfo = new PageInfo<>(users);
        session.setAttribute("userName",userName);
        model.addAttribute("usersPageInfo", usersPageInfo);
        model.addAttribute("users",users);
        return "admin/adminSearchList";
    
    @RequestMapping("/toAdminAdd")
    public String toAdminAdd()
        return "admin/adminAdd";
    
    @RequestMapping("/adminAdd")
    @ResponseBody
    public String adminAdd(String name, String username, String password,  String email, String tel, String role) 
        String msg = "";
        User user1 = userMapper.queryUserByUserName(username.replace(" ",""));
        if (StringUtils.isBlank(username) || username.equals(""))
            msg = "请输入用户名";
            return msg;
        
        if (StringUtils.isBlank(name) || name.equals(""))
            msg = "请输入姓名";
            return msg;
        
        if (StringUtils.isBlank(password) || password.equals(""))
            msg = "请输入密码";
            return msg;
        
        if (StringUtils.isBlank(email) || email.equals(""))
            msg = "请输入邮箱";
            return msg;
        
        if (StringUtils.isBlank(tel) || tel.equals(""))
            msg = "请输入电话号码";
            return msg;
        
        if (user1 != null && !username.equals(""))
            msg = "用户名已存在,请重新输入";
            return msg;
        
        String regEx4 = "^[A-Za-z0-9]+$";
        if (!username.matches(regEx4))
            msg = "用户名只能由字母和数字组成";
            return msg;
        
        String regEx3 = "^[\\u4e00-\\u9fa5]0,6$";
        if (!name.matches(regEx3))
            msg = "姓名只能由汉字组成";
            return msg;
        
        String regEx2 = "^[A-Za-z0-9]+$";
        if (!password.matches(regEx2))
            msg = "密码只能由数字和字母组成";
            return msg;
        
        String regEx1 = "^([a-z0-9A-Z]+[-|\\\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\\\.)+[a-zA-Z]2,$";
        Pattern p = Pattern.compile(regEx1);
        Matcher m = p.matcher(email);
        if (!m.matches() && !email.equals(""))
            msg = "邮箱格式错误,请重新输入";
            return msg;
        
        String REG_EXP = "^([0-9]3-?[0-9]8|[0-9]4-?[0-9]7)$";
        if (!tel.matches(REG_EXP) && !tel.equals(""))
            msg = "手机号码错误,请重新输入";
            return msg;
        
        else 
            msg = "OK";
            User user = new User();
            user.setName(name.replace(" ",""));
            user.setUserName(username.replace(" ",""));
            user.setPassWord(password);
            user.setRole(role);
            user.setEmail(email);
            user.setTel(tel);
            SimpleDateFormat sft = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            Date createTime = new Date();
            String time = sft.format(createTime);
            user.setCreateTime(time);
            //管理员添加账号直接通过审核 状态码设置为 1
            String examineStatus = "1";
            user.setExamineStatus(examineStatus);
            userMapper.addUser(user);
            return msg;
        
    

    @RequestMapping("/toAdminEdit/id")
    public String toAdminEdit(@PathVariable("id") Integer id, Model model)
        User user = userMapper.queryUserById(id);
        List<Role> roles = roleMapper.queryAll();
        model.addAttribute("roles",roles);
        model.addAttribute("user",user);
        return "admin/adminEdit";
    
    @RequestMapping("/adminEdit")
    @ResponseBody
    public String adminEdit(Integer id, String name, String passWord,
                             String email, String tel, String role)
        String msg = "";
        if (StringUtils.isBlank(name) || name.equals(""))
            msg = "请输入姓名";
            return msg;
        
        if (StringUtils.isBlank(passWord) || passWord.equals(""))
            msg = "请输入密码";
            return msg;
        
        if (StringUtils.isBlank(email) || email.equals(""))
            msg = "请输入邮箱";
            return msg;
        
        if (StringUtils.isBlank(tel) || tel.equals(""))
            msg = "请输入电话号码";
            return msg;
        
        String regEx3 = "^[\\u4e00-\\u9fa5]0,6$";
        if (!name.matches(regEx3))
            msg = "姓名只能由汉字组成";
            return msg;
        
        String regEx2 = "^[A-Za-z0-9]+$";
        if (!passWord.matches(regEx2))
            msg = "密码只能由数字和字母组成";
            return msg;
        
        String regEx1 = "^([a-z0-9A-Z]+[-|\\\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\\\.)+[a-zA-Z]2,$";
        Pattern p = Pattern.compile(regEx1);
        Matcher m = p.matcher(email);
        if (!m.matches() && !email.equals(""))
            msg = "邮箱格式错误,请重新输入";
            return msg;
        
        String REG_EXP = "^([0-9]3-?[0-9]8|[0-9]4-?[0-9]7)$";
        if (!tel.matches(REG_EXP) && !tel.equals(""))
            msg = "手机号码错误,请重新输入";
            return msg;
        
        else 
            userMapper.updateUserById(id,name,passWord,email,tel,role);
            msg = "OK";
            return msg;
        

    

    @RequestMapping("/adminDelete")
    @ResponseBody
    public String adminDelete(Integer id, Model model)
        String msg = "";
        try 
            userMapper.delUserById(id);
            msg = "OK";
            return msg;
        catch (Exception e)
            msg = "删除失败";
            return msg;
        
    
    @RequestMapping("/enableUser")
    @ResponseBody
    public String enableUser( Integer id, Model model)

        String msg = "";
        try 
            userMapper.enableUserById(id);
            msg = "OK";
            return msg;
        catch (Exception e)
            msg = "启用失败";
            return msg;
        
    
    @RequestMapping("/disableUser")
    @ResponseBody
    public String disableUser( Integer id, Model model)

        String msg = "";
        try 
            userMapper.disableUserById(id);
            msg = "OK";
            return msg;
        catch (Exception e)
            msg = "禁用失败";
            return msg;
        
    
    //初始化密码
    @RequestMapping("/initializePwd")
    @ResponseBody
    public String initializePwd( Integer id, Model model)

        String msg = "";
        try 
            userMapper.initializePwdById(id);
            msg = "OK";
            return msg;
        catch (Exception e)
            msg = "删除失败";
            return msg;
        
    

package com.wj2y.lbcmsystem.controller;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wj2y.lbcmsystem.mapper.ChildrenMapper;
import com.wj2y.lbcmsystem.mapper.ExamineMapper;
import com.wj2y.lbcmsystem.mapper.UserMapper;
import com.wj2y.lbcmsystem.pojo.Children;
import com.wj2y.lbcmsystem.pojo.Delchildren;
import com.wj2y.lbcmsystem.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

/**
 * @author znz
 * @date 2022-01-07 15:00
 * @Version 1.0
 */
@Controller
public class ChildrenController 

    @Autowired
    ChildrenMapper childrenMapper;
    @Autowired
    UserMapper userMapper;
    @Autowired
    ExamineMapper examineMapper;

    @RequestMapping("/childrenList")
    public String childrenList(Model model, @RequestParam(defaultValue = "1") Integer startPage,
                               @RequestParam(defaultValue = "10") Integer pageSize)
        PageHelper.startPage(startPage, pageSize);
        List<Children> childrens = childrenMapper.queryChildrenList();
        PageInfo<Children> childrensPageInfo = new PageInfo<>(childrens);
        model.addAttribute("childrensPageInfo", childrensPageInfo);
        model.addAttribute("childrens",childrens);
        return "children/childrenList";
    
    @RequestMapping("/searchChildren")
    public String searchChildren(Model model, @RequestParam(defaultValue = "1") Integer startPage,
                                 @RequestParam(defaultValue = "10") Integer pageSize, String name, HttpSession session)
        PageHelper.startPage(startPage, pageSize);
        List<Children> childrens = childrenMapper.queryListChildrenByName(name);
        PageInfo<Children> childrensPageInfo = new PageInfo<>(childrens);
        session.setAttribute("name",name);
        model.addAttribute("childrensPageInfo", childrensPageInfo);
        model.addAttribute("childrens",childrens);
        return "children/childrenSearchList";
    

    @RequestMapping("/childrenRecentlyList")
    public String childrenRecentlyList()
        return "children/childrenRecentlyList";
    

    @RequestMapping("/toChildrenAdd")
    public String tochildrenAdd()
        return "children/childrenAdd";
    
    @RequestMapping("/childrenAdd")
    @ResponseBody
    public String childrenAdd(Children children) 
        String msg = "";
        SimpleDateFormat sft = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date createTime = new Date();
        String time = sft.format(createTime);
        children.setCreateTime(time);
        children.setDeleteStatus(0);
        try 
            childrenMapper.addChildren(children);
            msg = "OK";
            return msg;
        catch (Exception e)
            msg = "新增失败";
            return msg;
        

    

    @RequestMapping("/childrenLookInfo/id")
    public String childrenLookInfo(@PathVariable("id") Integer id, Model model)
        Children children = childrenMapper.queryChildrenById(id);
        model.addAttribute("children",children);
        return "children/childrenLookInfo";
    

    @RequestMapping("/toChildrenEdit/id")
    public String toChildrenEdit(@PathVariable("id") Integer id, Model model)
        Children children = childrenMapper.queryChildrenById(id);
        model.addAttribute("children",children);
        return "children/childrenEdit";
    
    @RequestMapping("/childrenEdit")
    @ResponseBody
    public String childrenEdit(String name,Integer id,Integer age,String phone,String birthday,String school,String address,
                               String guardian,String guardianPhone,String healthCondition,Integer health
            ,Integer familyStatus)
        String msg = "";
        try
            childrenMapper.updateChildrenById(id,name, phone,birthday, age,school, address
                    ,guardian, guardianPhone,healthCondition, health,familyStatus);
            msg = "OK";
            return msg;
        catch (Exception e)
            System.out.println(e);
            msg = "修改失败";
            return msg;
        

    

    @RequestMapping("/childrenDelete")
    @ResponseBody
    public String childrenDelete(Integer id, Model model, String examineUser, Delchildren delchildren,String reason)
        String msg = "";
        try 
            User user = userMapper.queryUserByUserName(examineUser);
            Children children = childrenMapper.queryChildrenById(id);
            //工作人员删除 需要提交给管理员审核
            if (user.getRole().equals("1"))
                Integer deleteStatus = 2;//将删除状态码修改成 2   提交给管理员审核
                childrenMapper.delChildrenById(id,deleteStatus);
                Delchildren delchildren1 = examineMapper.queryDelChildren(id);
                if (delchildren1 != null)
                    msg = "该儿童信息已提交删除申请,请勿重复操作!";
                    return msg;
                else 
                    delchildren.setDelUser(examineUser);
                    delchildren.setId(children.getId());
                    delchildren.setName(children.getName());
                    delchildren.setPhone(children.getPhone());
                    delchildren.setBirthday(children.getBirthday());
                    delchildren.setAge(children.getAge());
                    delchildren.setSchool(children.getSchool());
                    delchildren.setAddress(children.getAddress());
                    delchildren.setGuardian(children.getGuardian());
                    delchildren.setGuardianPhone(children.getGuardianPhone());
                    delchildren.setHealth(children.getHealth());
                    delchildren.setHealthCondition(children.getHealthCondition());
                    delchildren.setFamilyStatus(children.getFamilyStatus());
                    delchildren.setDeleteStatus(2);
                    delchildren.setReason(reason);
                    SimpleDateFormat sft = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                    Date createTime = new Date();
                    String time = sft.format(createTime);
                    delchildren.setCreateTime(time);
                    examineMapper.addDelChildren(delchildren);
                    msg = "OK";
                    return msg;
                
            else 
                Integer deleteStatus = 1;
                childrenMapper.delChildrenById(id,deleteStatus);
                msg = "OK";
                return msg;
            

        catch (Exception e)
            msg = "删除失败";
            return msg;
        
    

五,项目总结

信息化社会内需要与之针对性的信息获取途径,但是途径的扩展基本上为人们所努力的方向,由于站在的角度存在偏差,人们经常能够获得不同类型信息,这也是技术最为难以攻克的课题。针对社区留守儿童帮扶系统等问题,对留守儿童帮扶进行研究分析,然后开发设计出社区留守儿童帮扶系统 以解决问题。

社区留守儿童帮扶系统主要功能模块包括用户管理、留守儿童、帮扶活动、捐献记录、机构捐献,采取面对对象的开发模式进行软件的开发和硬体的架设,能很好的满足实际使用的需求,完善了对应的软体架设以及程序编码的工作,采取MySQL作为后台数据的主要存储单元,采用springboot框架、Java技术、Ajax技术进行业务系统的编码及其开发,实现了本系统的全部功能。本次报告,首先分析了研究的背景、作用、意义,为研究工作的合理性打下了基础。针对社区留守儿童帮扶系统的各项需求以及技术问题进行分析,证明了系统的必要性和技术可行性,然后对设计系统需要使用的技术软件以及设计思想做了基本的介绍,最后来实现社区留守儿童帮扶系统和部署运行使用它。
 

以上是关于基于Springboot实现留守儿童管理系统的主要内容,如果未能解决你的问题,请参考以下文章

基于springboot实现留守儿童爱心网站平台源码+论文分享

计算机毕业设计之java+springboot基于vue的留守儿童爱心网站

计算机毕业设计springboot+vue+elementUI留守儿童爱心捐赠网站

基于java+mysql+jsp+ssm农村留守儿童社会支持信息系统

Marvin活动关爱留守儿童

计算机&大数据学院暑期社会实践回报家乡 AI筑梦系列一: 关爱留守儿童,奉献青春力量