基于SSM的失物招领信息交互平台

news/2024/7/5 3:30:13

末尾获取源码
开发语言:Java
Java开发工具:JDK1.8
后端框架:SSM
前端:Vue
数据库:MySQL5.7和Navicat管理工具结合
服务器:Tomcat8.5
开发软件:IDEA / Eclipse
是否Maven项目:是


目录

一、项目简介

二、系统功能

三、系统项目截图

管理员功能模块    

用户管理

失物招领管理

物品类型管理

失物认领管理

物品挂失管理

寻物论坛

网站资讯

前台首页功能模块

用户注册、用户登录

​编辑 

个人中心

失物招领

用户功能模块

失物招领管理

物品挂失管理

四、核心代码

登录相关

文件上传

封装


一、项目简介

21世纪的今天,随着社会的不断发展与进步,人们对于信息科学化的认识,已由低层次向高层次发展,由原来的感性认识向理性认识提高,管理工作的重要性已逐渐被人们所认识,科学化的管理,使信息存储达到准确、快速、完善,并能提高工作管理效率,促进其发展。

论文主要是对失物招领信息交互平台进行了介绍,包括研究的现状,还有涉及的开发背景,然后还对系统的设计目标进行了论述,还有系统的需求,以及整个的设计方案,对系统的设计以及实现,也都论述的比较细致,最后对失物招领信息交互平台进行了一些具体测试。

本文以Java为开发技术,实现了一个失物招领信息交互平台。失物招领信息交互平台的主要实现功能包括:管理员:首页、个人中心、用户管理、失物招领管理、物品类型管理、失物认领管理、物品挂失管理、寻物论坛、系统管理,用户;首页、个人中心、失物招领管理、失物认领管理、物品挂失管理、寻物论坛,前台首页;首页、失物招领、物品挂失、寻物论坛、网站资讯、个人中心、后台管理功能,基本上实现了整个失物招领信息交互平台的过程。

具体在系统设计上,采用了B/S的结构,同时,也使用Java技术在动态页面上进行了设计,后台上采用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{
	
	@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();
    }
}

文件上传

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);
	}
	
}

封装

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://lihuaxi.xjx100.cn/news/1617448.html

相关文章

python基于协同过滤算法商品商城购物推荐系统vue

随着移动互联网的普及&#xff0c;电子商务的发展也引来了新一轮的发展&#xff0c;越来越手动消费者的喜爱&#xff0c;网络经济的发展对国家经济的发展也带来了很大的利好&#xff0c;带动了很多实体经济的转型&#xff0c;用户可以通过网络可以买到自己称心如意的商品&#…

我的创作日

目录 机缘 收获 日常 成就 憧憬 机缘 《AR助教奇迹人总结》这是最开始大佬叫我写的文章&#xff0c;大佬说写完发到CSDN&#xff0c;刚开始我还纳闷什么叫CSDN呢&#xff0c;无意间我看到我的码龄竟然是两年&#xff0c;哈哈可能是无意间自己注册的吧&#xff0c;连我自己…

【计算机毕业设计】python学生成绩补考通知管理系统

经过分析和研究&#xff0c;基于Web的学生成绩管理系统主要包括学生信息管理模块&#xff0c;学生成绩管理模块&#xff0c;学生班级管理模块&#xff0c;学生课程管理模块和系统管理模块。其中信息管理包括信息的浏览和处理&#xff0c;成绩管理包括成绩查询和处理&#xff0c…

手把手带你用Python和文心一言搭建《AI看图写诗》网页项目(附上完整项目源码)

今年年初&#xff0c;ChatGPT的火爆在全球掀起AI大模型的开发热潮&#xff0c;国内外的科技公司纷纷加入“百模大战”行列。百度在率先发布了国内第一款人工智能大语言模型“文心一言”后&#xff0c;又推出了文心千帆大模型平台&#xff0c;帮助企业和开发者加速大模型应用落地…

同源多页面实时通信之BroadcastChannel实现及简单封装

目录 背景介绍及API使用是什么对象实例化发送消息监听消息错误处理关闭通道 项目中简单封装channel.js文件&#xff0c;引入到使用的页面中发送端send.html监听端运行测试一下吧 浏览器兼容程度总结 背景 日常开发做项目时&#xff0c;如果采用非Vue脚手架时&#xff0c;肯定会…

【从0开发】百度BML全功能AI开发平台【实操:以部署情感分析模型为例】

目录 一、全功能AI开发平台介绍二、AI项目落地应用流程&#xff08;以文本分类为例&#xff09;2-0、项目开始2-1、项目背景2-2、数据准备介绍2-3、项目数据2-4、建模调参介绍2-5、项目的建模调参2-6、开发部署2-7、项目在公有云的部署 附录&#xff1a;调用api代码总结 一、全…

2023年中国尾气净化催化材料产量、需求量及行业市场规模分析[图]

尾气处理催化单元系由催化剂厂商将以催化材料和活性组分物质为主要组成的催化剂涂覆在蜂窝陶瓷或金属等载体上而成&#xff0c;催化剂则起到处理尾气中有害物质的各类化学反应的关键催化作用&#xff0c;主要由稀土材料、氧化铝材料、贵金属材料等催化材料和增强催化材料性能的…

网站列表页加密:三次请求后返回内容多\r

一、抓包第一次请求 url aHR0cDovL2N5eHcuY24vQ29sdW1uLmFzcHg/Y29saWQ9MTA抓包&#xff0c;需要清理浏览器cookie&#xff0c;或者无痕模式打开网址&#xff0c;否则返回的包不全&#xff0c;依照下图中的第一个包进行requests请求 第一次请求后返回 <!DOCTYPE html>…