基于SSM的社區管理系統

末尾獲取源碼
開發語言:Java
Java開發工具:JDK1.8
后端框架:SSM
前端:Vue
數據庫:MySQL5.7和Navicat管理工具結合
服務器:Tomcat8.5
開發軟件:IDEA / Eclipse
是否Maven項目:是


目錄

一、項目簡介

二、系統功能

三、系統項目截圖

用戶信息管理

社區活動管理

公共服務管理

社區政策管理

四、核心代碼

登錄相關

文件上傳

封裝


一、項目簡介

身處網絡時代,隨著網絡系統體系發展的不斷成熟和完善,人們的生活也隨之發生了很大的變化,人們在追求較高物質生活的同時,也在想著如何使自身的精神內涵得到提升,而讀書就是人們獲得精神享受非常重要的途徑。為了滿足人們隨時隨地只要有網絡就可以看書的要求,社區管理系統被開發研究了出來。

本文主要描述了該社區管理系統的具體開發過程,在SSM框架的基礎上,采用vue技術和MYSQL數據庫,使該社區管理系統具有很好的穩定性和安全性。本設計重點從系統概述、系統分析、系統設計、數據庫設計、系統測試和總結這幾個方面對該社區管理系統進行闡述,用戶通過該社區管理系統可以查詢自己喜歡的信息。

該社區管理系統不僅能夠穩定的運行,快捷方便的操作,界面簡潔清晰,而且功能齊全,實用性強。


二、系統功能

系統結構設計就像一個樹狀結構一樣,一個樹干有很多分支,大任務相當于樹干,小任務相當于樹枝,只有需求分析信息弄清楚之后,才能保證每個小任務都能實現目標,對初步設計好的系統再進行不斷優化,最終得到一個具體現實的系統結構。

?



三、系統項目截圖

用戶信息管理

此頁面提供給管理員的功能有:用戶信息的查詢管理,可以刪除用戶信息、修改用戶信息、新增用戶信息,還進行了對用戶名稱的模糊查詢的條件

?

社區活動管理

此頁面提供給管理員的功能有:查看已發布的社區活動數據,修改社區活動,社區活動作廢,即可刪除,還進行了對社區活動名稱的模糊查詢 社區活動信息的類型查詢等等一些條件。

?

?

公共服務管理

此頁面提供給管理員的功能有:根據公共服務進行條件查詢,還可以對公共服務進行新增、修改、查詢操作等等。

?

社區政策管理

此頁面提供給管理員的功能有:根據社區政策進行新增、修改、查詢操作等等。

?

?


四、核心代碼

登錄相關


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{@Autowiredprivate UserService userService;@Autowiredprivate 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();}
}

文件上傳

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{@Autowiredprivate 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);}}

封裝

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.pswp.cn/news/209072.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/209072.shtml
英文地址,請注明出處:http://en.pswp.cn/news/209072.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

LeetCode(52)最小棧【棧】【中等】

目錄 1.題目2.答案3.提交結果截圖 鏈接&#xff1a; 最小棧 1.題目 設計一個支持 push &#xff0c;pop &#xff0c;top 操作&#xff0c;并能在常數時間內檢索到最小元素的棧。 實現 MinStack 類: MinStack() 初始化堆棧對象。void push(int val) 將元素val推入堆棧。void…

區分工業設計軟件中CAD、CAE、CAM、PDM等概念

工業設計軟件是專門用于輔助工業設計師在產品設計和開發過程中進行各種任務的計算機程序。這些軟件提供了廣泛的工具和功能&#xff0c;幫助設計師創建、分析、修改和可視化產品的概念和詳細設計。 CAD 計算機輔助設計&#xff08;Computer-Aided Design&#xff0c;CAD&…

15、SQL注入——Sqlmap

文章目錄 一、Sqlmap簡介1.1 sqlmap可以對URL干嘛&#xff1f;1.2 Sqlmap支持的注入技術1.3 SQLmap檢測注入漏洞的流程1.4 Sqlmap的誤報檢測機制 二、sqlmap基本使用 一、Sqlmap簡介 sqlmap使用教程 1.1 sqlmap可以對URL干嘛&#xff1f; 判斷可注入的參數判斷可以使用哪一種…

汽車電子智能保險絲解決方案

一、背景知識 在過去的幾十年里&#xff0c;電子在汽車系統創新中發揮了關鍵作用。新型半導體器件具有新穎的功能&#xff0c;增強了車輛機械系統提供的功能。 雖然半導體解決方案和電子產品將繼續在汽車電子產品中發揮關鍵作用&#xff0c;但展望未來&#xff0c;汽車創新將…

css順時針旋轉90°再3D中繞Y軸旋轉180°

CSS 順時針旋轉 90 再 3D 中繞 Y 軸旋轉 180 的示例代碼如下&#xff1a; div {transform: rotate(90deg) perspective(500px) rotateY(180deg); }在這個示例中&#xff0c;元素被先進行了 2D 順時針旋轉 90&#xff0c;然后設置了 perspective 屬性來定義元素的視角距離&…

UE4 材質實現Glitch效果

材質實現Glitch效果 UE4 材質實現Glitch效果預覽1預覽2 UE4 材質實現Glitch效果 預覽1 添加材質函數&#xff1a; MF_RandomNoise 添加材質&#xff1a; 預覽2 添加材質函數MF_CustomPanner&#xff1a; 添加材質函數&#xff1a;MF_Glitch 材質添加&#xff1a; 下面用…

Docker 部署 2FAuth 服務

拉取最新版本的 2FAuth 鏡像&#xff1a; $ sudo docker pull 2fauth/2fauth:latest在本地預先創建好 2fauth 目錄, 用于映射 2FAuth 容器內的 /2fauth 目錄。 使用以下命令, 在 前臺 運行 2FAuth 容器: $ sudo docker run -it --rm --name 2fauth -p 10085:8000/tcp -v /ho…

3D材質編輯:制作被火燒的木頭

在線工具推薦&#xff1a; 3D數字孿生場景編輯器 - GLTF/GLB材質紋理編輯器 - 3D模型在線轉換 - Three.js AI自動紋理開發包 - YOLO 虛幻合成數據生成器 - 三維模型預覽圖生成器 - 3D模型語義搜索引擎 當談到游戲角色的3D模型風格時&#xff0c;有幾種不同的風格&#xf…

css實現頭部占一定高度,內容區占剩余高度可滾動

上下布局&#xff1a; <div class"container"><header class"header">頭部內容</header><div class"content">內容區域</div> </div>.container {display: flex;flex-direction: column;height: 100vh; /*…

SQL Server 2017數據庫window server服務器改名操作

在window服務器修改機器名重新加域后&#xff0c;需要執行下面的SQL語句修改數據庫里面記錄的機器名字&#xff0c;才能在修改后通過新名字連接數據庫。 if serverproperty(servername) <> servername begin declare server sysname set server ser…

53. Protocol buffer 的Go使用

文章目錄 一、介紹二、安裝三、protoc3語法1、 protoc3 與 protoc2區別2、proto3生成go代碼包Message內嵌Message字段單一標量字段單一message字段可重復字段slicemap字段枚舉 一、介紹 Protobuf是Google旗下的一款平臺無關&#xff0c;語言無關&#xff0c;可擴展的序列化結構…

AWS KeyPair密鑰格式轉換PPK<>PEM

概述說明 PEM&#xff08;Privacy Enhanced Mail&#xff09;和PPK&#xff08;Putty Private Key&#xff09;都是與加密和安全相關的文件格式&#xff0c;通常用于存儲私鑰信息。它們在不同的上下文中使用&#xff0c;并且與不同的軟件和協議相關聯。 PEM&#xff08;Priva…

【kubernetes】k3s集群搭建(正在更新……)

文章目錄 一、k3s簡介二、快速搭建1.控制平面2.鏡像加速 Pod容器集1.創建和管理pod Deployment(部署)與ReplicaSet(副本集)滾動更新 Service命名空間YAML語法管理對象常用命令縮寫YAML規范 聲明式配置對象標簽選擇器 容器運行時接口(CRI)與鏡像導入導出容器運行時接口(CRI) 金絲…

基于POSIX標準的Linux進程間通信

文章目錄 1 管道&#xff08;匿名管道&#xff09;1.1 管道抽象1.2 接口——pipe1.3 管道的特征1.4 管道的四種情況1.5 匿名管道用例 2 命名管道2.1 創建一個命名管道——mkfifo2.2 關閉一個管道文件——unlink2.3 管道和命名管道的補充2.4 命名管道用例 3 共享內存3.1 原理3.2…

案例二:SQL Server數據庫的備份和還原

1、備份類型。 在 SQL Server 中提供了三種常用的備份類型&#xff0c;分別是完整備份&#xff0e;差異備份和事務日志備份。 完整備份&#xff1a; 完整備份包括對整個數據庫、部分事務日志、數據庫結構和文件結構的備份。完整備份代表的是備份完成時刻的數據庫。 完整備份是…

【Hydro】Python繪制降雨徑流雙Y軸成果圖

目錄 說明源代碼說明 雙y軸圖像具有單y軸圖像沒有的對比效果,通常會用來繪制降雨徑流成果圖,在MATLAB中有plotyy函數可以實現,Python的實現方式沒有MATLAB那樣方便,不過實現效果卻也不見得差。 Python中的matplotlib通常使用twinx來生成雙Y軸,下圖便是使用matplotlib繪制…

8、操作符重載

友元 可以通過friend關鍵字&#xff0c;把一個全局函數、另一個類的成員函數或者另一個類整體&#xff0c;聲明為授權類的友元友元擁有訪問授權類任何非公有成員的特權友元聲明可以出現在授權類的公有、私有或者保護等任何區域且不受訪問控制限定符的約束友元不是成員&#xf…

elment-table設置el-table-column的label里面的文字換行居中顯示

效果圖如下&#xff1a; 直接上代碼&#xff1a; <el-table class"ut-mt-2" row-key"company" default-expand-all:data"stateQuery.data" style"width: 100%":tree-props"{ children: departList, hasChildren: hasChildre…

Si24R03—低功耗 SOC 芯片(集成RISC-V內核+2.4GHz無線收發器)

Si24R03是一款高度集成的低功耗SOC芯片&#xff0c;其集成了基于RISC-V核的低功耗MCU和工作在2.4GHz ISM頻段的無線收發器模塊。 MCU模塊具有低功耗、Low Pin Count、寬電壓工作范圍&#xff0c;集成了13/14/15/16位精度的ADC、LVD、UART、SPI、I2C、TIMER、WUP、IWDG、RTC等豐…