基于SpringBoot的精准扶贫管理系统

news2024/10/5 5:11:01

目录

前言

 一、技术栈

二、系统功能介绍

用户信息管理

贫困户信息管理

新闻类型管理

志愿者招聘管理

志愿者招聘

留言反馈管理

贫困户

三、核心代码

1、登录模块

 2、文件上传模块

3、代码封装


前言

随着信息技术在管理上越来越深入而广泛的应用,管理信息系统的实施在技术上已逐步成熟。本文介绍了精准扶贫管理系统的开发全过程。通过分析精准扶贫管理系统管理的不足,创建了一个计算机管理精准扶贫管理系统的方案。文章介绍了精准扶贫管理系统的系统分析部分,包括可行性分析等,系统设计部分主要介绍了系统功能设计和数据库设计。

本精准扶贫管理系统管理员和用户。管理员功能有个人中心,用户管理,贫困户管理,热门新闻管理,新闻类型管理,志愿者招聘管理,用户招聘管理,留言板管理,系统管理等。用户功能有个人中心,贫困户管理,用户应聘管理,我的收藏管理。因而具有一定的实用性。

本站是一个B/S模式系统,采用Spring Boot框架,MYSQL数据库设计开发,充分保证系统的稳定性。系统具有界面清晰、操作简单,功能齐全的特点,使得精准扶贫管理系统管理工作系统化、规范化。本系统的使用使管理人员从繁重的工作中解脱出来,实现无纸化办公,能够有效的提高精准扶贫管理系统管理效率。

 一、技术栈

末尾获取源码
SpringBoot+Vue+JS+ jQuery+Ajax...

二、系统功能介绍

用户信息管理

精准扶贫管理系统的系统管理员可以管理用户,可以对用户信息修改删除以及查询操作。

贫困户信息管理

系统管理员可以对贫困户信息进行审核操作。

新闻类型管理

系统管理员可以对新闻类型进行添加,修改,删除以及查询操作。

 

志愿者招聘管理

系统管理员可以对志愿者招聘进行添加修改删除操作。

志愿者招聘

用户可以在志愿者招聘进行收藏和应聘。

 

留言反馈管理

用户可以进行留言反馈。

贫困户

用户可以查看贫困户信息。

 

三、核心代码

1、登录模块

 
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){
//    	ValidatorUtils.validateEntity(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);
    }
    
    /**
     * 获取用户的session用户信息
     */
    @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){
//    	ValidatorUtils.validateEntity(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){
//        ValidatorUtils.validateEntity(user);
        userService.updateById(user);//全部更新
        return R.ok();
    }
 
    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
        userService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }
}

 2、文件上传模块

package com.controller;
 
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.UUID;
 
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.util.ResourceUtils;
import org.springframework.web.bind.annotation.PathVariable;
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.RestController;
import org.springframework.web.multipart.MultipartFile;
 
import com.annotation.IgnoreAuth;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.ConfigEntity;
import com.entity.EIException;
import com.service.ConfigService;
import com.utils.R;
 
/**
 * 上传文件映射表
 */
@RestController
@RequestMapping("file")
@SuppressWarnings({"unchecked","rawtypes"})
public class FileController{
	@Autowired
    private ConfigService configService;
	/**
	 * 上传文件
	 */
	@RequestMapping("/upload")
	public R upload(@RequestParam("file") MultipartFile file,String type) throws Exception {
		if (file.isEmpty()) {
			throw new EIException("上传文件不能为空");
		}
		String fileExt = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1);
		File path = new File(ResourceUtils.getURL("classpath:static").getPath());
		if(!path.exists()) {
		    path = new File("");
		}
		File upload = new File(path.getAbsolutePath(),"/upload/");
		if(!upload.exists()) {
		    upload.mkdirs();
		}
		String fileName = new Date().getTime()+"."+fileExt;
		File dest = new File(upload.getAbsolutePath()+"/"+fileName);
		file.transferTo(dest);
		FileUtils.copyFile(dest, new File("C:\\Users\\Desktop\\jiadian\\springbootl7own\\src\\main\\resources\\static\\upload"+"/"+fileName));
		if(StringUtils.isNotBlank(type) && type.equals("1")) {
			ConfigEntity configEntity = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "faceFile"));
			if(configEntity==null) {
				configEntity = new ConfigEntity();
				configEntity.setName("faceFile");
				configEntity.setValue(fileName);
			} else {
				configEntity.setValue(fileName);
			}
			configService.insertOrUpdate(configEntity);
		}
		return R.ok().put("file", fileName);
	}
	
	/**
	 * 下载文件
	 */
	@IgnoreAuth
	@RequestMapping("/download")
	public ResponseEntity<byte[]> download(@RequestParam String fileName) {
		try {
			File path = new File(ResourceUtils.getURL("classpath:static").getPath());
			if(!path.exists()) {
			    path = new File("");
			}
			File upload = new File(path.getAbsolutePath(),"/upload/");
			if(!upload.exists()) {
			    upload.mkdirs();
			}
			File file = new File(upload.getAbsolutePath()+"/"+fileName);
			if(file.exists()){
				/*if(!fileService.canRead(file, SessionManager.getSessionUser())){
					getResponse().sendError(403);
				}*/
				HttpHeaders headers = new HttpHeaders();
			    headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);    
			    headers.setContentDispositionFormData("attachment", fileName);    
			    return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file),headers, HttpStatus.CREATED);
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
		return new ResponseEntity<byte[]>(HttpStatus.INTERNAL_SERVER_ERROR);
	}
	
}

3、代码封装

package com.utils;
 
import java.util.HashMap;
import java.util.Map;
 
/**
 * 返回数据
 */
public class R extends HashMap<String, Object> {
	private static final long serialVersionUID = 1L;
	
	public R() {
		put("code", 0);
	}
	
	public static R error() {
		return error(500, "未知异常,请联系管理员");
	}
	
	public static R error(String msg) {
		return error(500, msg);
	}
	
	public static R error(int code, String msg) {
		R r = new R();
		r.put("code", code);
		r.put("msg", msg);
		return r;
	}
 
	public static R ok(String msg) {
		R r = new R();
		r.put("msg", msg);
		return r;
	}
	
	public static R ok(Map<String, Object> map) {
		R r = new R();
		r.putAll(map);
		return r;
	}
	
	public static R ok() {
		return new R();
	}
 
	public R put(String key, Object value) {
		super.put(key, value);
		return this;
	}
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1085151.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

【笔记】【信息论与编码】第三章 离散信源

本文是笔者在学习《信息论与编码》课程中所做的笔记&#xff0c;供个人学习记忆使用。 第三章 离散信源 文章目录 一、离散信源概念离散无记忆信源K重符号序列离散信源 二、离散信源的熵单符号离散无记忆信源熵K重符号序列离散无记忆信源熵K重符号序列离散有记忆信源熵马尔可夫…

如何在Docker部署Drupal并结合内网穿透实现远程访问

文章目录 前言1. Docker安装Drupal2. 本地局域网访问3 . Linux 安装cpolar4. 配置Drupal公网访问地址5. 公网远程访问Drupal6. 固定Drupal 公网地址 前言 Dupal是一个强大的CMS&#xff0c;适用于各种不同的网站项目&#xff0c;从小型个人博客到大型企业级门户网站。它的学习…

NZ系列工具NZ05:VBA不打开工作簿获取其内容

我的教程一共九套及VBA汉英手册一部&#xff0c;分为初级、中级、高级三大部分。是对VBA的系统讲解&#xff0c;从简单的入门&#xff0c;到数据库&#xff0c;到字典&#xff0c;到高级的网抓及类的应用。大家在学习的过程中可能会存在困惑&#xff0c;这么多知识点该如何组织…

Linux 测试端口是否放行

Linux 测试端口是否放行 1、准备2、在 CentOS 7 上放行端口&#xff0c;你可以使用以下方法&#xff1a;4、错误解决&#xff1a;[rootlocalhost backup]# netcat -l -p 11111 netcat: cannot use -p and -l 装了netcat不能用5、能用telnet去测试吗6、效果&#xff1a; 1、准备…

简易计算器的实现:使用C语言进行基础算术运算

&#x1f337;&#x1f341; 博主猫头虎 带您 Go to New World.✨&#x1f341; &#x1f984; 博客首页——猫头虎的博客&#x1f390; &#x1f433;《面试题大全专栏》 文章图文并茂&#x1f995;生动形象&#x1f996;简单易学&#xff01;欢迎大家来踩踩~&#x1f33a; &a…

S/4 HANA 大白话 - 财务会计-4 应付、应收账款

Business Partner 业务伙伴 业务伙伴现在包括供应商伙伴和客户伙伴。 只要不是个搞空壳玩泡沫的公司&#xff0c;你基本都得有从供应商那里拿原材料或者购买零部件&#xff0c;然后进行生产&#xff0c;再售卖给客户。你得和银行打交道&#xff0c;同时也得有员工。所有这些关…

【python自动化神器pyautogui使用步骤】

python自动化神器pyautogui使用步骤 这篇文章主要给大家介绍了关于python自动化神器pyautogui使用步骤的相关资料,在Python当中不仅代码简单,而且有着非常丰富的模块,pyautogui就可以称之为自动化操作的"神器",需要的朋友可以参考下 文章目录 python自动化神器pyauto…

关于SpringBoot2.x集成SpringSecurity+JJWT(0.7.0-->0.11.5)生成Token登录鉴权的问题

项目场景&#xff1a; 问题&#xff1a;遵循版本稳定的前提下&#xff0c;搭建权限认证框架&#xff0c;基于SpringBoot2.xSpringSecurity向上依赖jjwt0.7.0构建用户认证鉴权&#xff0c;起因是某L觉得jjwt0.7.0版本&#xff0c;官方已经放弃维护&#xff0c;且从maven仓库对0…

C++11发展史

文章目录 1.ChatGpt怎么说?2.C官方文档3.C11的诞生4.C11的意义 1.ChatGpt怎么说? C11是C编程语言的一个重要版本&#xff0c;也被称为C0x。它于2011年发布&#xff0c;并引入了许多新的特性和改进&#xff0c;使得C编程更加现代化和强大。 下面是C11的一些主要特性和发展历…

IDEA报Error:java:无效的源发行版13解决方式

出现问题原因&#xff1a;原本项目是spingboot2.0版本开发的&#xff0c;IDEA启动正常&#xff0c;后期新项目使用spingboot3.0&#xff0c;通过原来的IDEA版本及JDK1.8启动报上述错误&#xff0c;以下为版本文件 解决方式&#xff1a; 项目背景&#xff1a;项目已经上线&…

C++算法:图中的最短环

题目 现有一个含 n 个顶点的 双向 图&#xff0c;每个顶点按从 0 到 n - 1 标记。图中的边由二维整数数组 edges 表示&#xff0c;其中 edges[i] [ui, vi] 表示顶点 ui 和 vi 之间存在一条边。每对顶点最多通过一条边连接&#xff0c;并且不存在与自身相连的顶点。 返回图中 …

【Python中单引号、双引号和三引号具体的用法及注意点】

Python中单引号、双引号和三引号具体的用法及注意点 这篇文章主要给大家介绍了关于Python中单引号、双引号和三引号具体的用法及注意点的相关资料,Python中单引号、双引号、三引号中使用常常困惑,想弄明白这三者相同点和不同点,需要的朋友可以参考下 文章目录 Python中单引号、…

Zabbix监控系统详解1 :zabbix服务部署、自定义监控项、自动发现与自动注册

文章目录 1. Zabbix 概述1.1 简介1.2 zabbix的功能组件1.2.1 Zabbix Server1.2.2 数据库1.2.3 Web 界面1.2.4 Zabbix Agent1.2.5 Zabbix Proxy1.2.6 Java Gateway 1.3 工作原理1.4 常用端口号1.5 zabbix中预设的键值1.6 自定义监控项相关流程1.7 邮件报警配置思路1.8 Zabbix自动…

气膜建筑的可持续性:能源效益与环境影响

气膜建筑作为现代建筑技术的一种创新形式&#xff0c;不仅为城市景观增添了未来感&#xff0c;同时也在建筑领域引发了可持续性发展的讨论。本文将探讨气膜建筑在可持续性方面的关键议题&#xff0c;特别聚焦于其能源效益和环境影响&#xff0c;以期为未来气膜建筑设计和规划提…

dm关键字提示报错

问题出现 还是那个项目&#xff0c;然后呢因为其中涉及到了关键字&#xff0c;导致查询报错&#xff0c; 提示是REFERENCE出现错误。 问题处理 对于所有的关键字增加双引号可以处理。

服务器中了balckhoues勒索病毒怎么办?勒索病毒解密,数据恢复

近日&#xff0c;云天数据恢复中心发现&#xff0c;有多位用户的服务器中了一种名为balckhoues的勒索病毒&#xff0c;因为绝大多数用户是第一次遇到这种情况&#xff0c;所以对这种类型的勒索病毒并不是很了解。那接下来我们将对balckhoues勒索病毒做一个分析。 中毒特征 服务…

10.12作业

以下是一个简单的比喻&#xff0c;将多态概念与生活中的实际情况相联系&#xff1a; 比喻&#xff1a;动物园的讲解员和动物表演 想象一下你去了一家动物园&#xff0c;看到了许多不同种类的动物&#xff0c;如狮子、大象、猴子等。现在&#xff0c;动物园里有一位讲解员&…

运放供电设计 以及电压反馈电流反馈选择

因为OPA350可以直接驱动大电容 不需要对称&#xff0c;只要输出在电压范围内就可以 注&#xff1a;电流反馈运放一定要注意电阻取值&#xff0c;并且不能并电容

如何swagger关闭及给swagger加参数信息

项目的swagger方便研发人员调试&#xff0c;上线之后需要将swagger关闭这时候需要给原来的Configuration注解换成ConditionlOnProperty注解及可。注解参数信息 ConditionalOnProperty(name "swagger.enable", havingValue "true")若swagger想加入额外参…

Halcon我的基础教程(一)(我的菜鸟教程笔记)-halcon仿射变换(Affine Transformation)的探究与学习

目录 什么是仿射变换?仿射变换有哪些方式?任何仿射变换都能由以下基本变换构造而来:在Halocn中,仿射变换具有重要的作用,那我们本文章重点讨论仿射变换基础性知识。 使用Halcon中的重要算子,仿射变换一般解决步骤,案例应用会在以后的文章中我们重点解答与讨论。 我们首先…