Lost and Found | Design and Implementation of a Web-based Campus Lost and Found System

Author's homepage: Programming Thousand Paper Cranes

About the author: Java, front-end, and Pythone have been developed for many years, and have worked as a senior engineer, project manager, and architect

Main content: Java project development, graduation design development, interview technology arrangement, latest technology sharing

Favorites, likes, don't get lost, it's good to follow the author

Item number: BS-XX-158

introduction:

With the rapid development of the Internet, schools have also entered the information age. It is common for college students to lose items on campus. However, due to the lack of a good information exchange platform, the owner cannot find the lost item in time, which brings great inconvenience to life. Building a platform for teachers and students to release information through the Internet can effectively help them find lost items.

The campus lost and found system is developed based on Web technology and uses MySQL database to store data. It mainly includes two modules: user and administrator. and other functions; the administrator module can manage user information, finding information, recruiting information, personal information and administrator information.

1. Project Introduction

The traditional campus lost and found system uses paper and pen to record information. After a period of time, when the accumulated data reaches a certain level, the efficiency of re-query will be very low, and it is easy to cause data damage and loss. With the progress of society, green environmental protection has become a mainstream, and more and more companies have given up using paper and pen to record information, and have begun to send and store various information via the Internet [1]. This not only greatly saves the cost, but also saves more time and energy to do other work. By designing the campus lost and found system, users can use the Internet to enter the system, publish or view information on various items in the system. In this way, lost items can be found conveniently and quickly through information exchange among users, and human resources can also be saved, which is also in line with the concept of modern green environmental protection. Therefore, it is imperative to design a campus lost and found system.

Through the requirement analysis on the function of the system, it should have the following functions:

(1) Visitors must register an account before using the system to enter the system.

(2) Administrators can use corresponding permissions to manage ordinary users.

(3) Realize the management functions of the two modules of lost and found.

(4) It is possible to realize the search and search function for the lost and found by the user.

(5) Realize the user's management function on the message board.

(6) Personal information can be modified or updated in a timely manner.

(7) Realize that when logging in, the interface of successful or failed login can appear.

(8) Realize the user's exit function.

(9) The administrator can easily maintain the system and facilitate the operation of the user.

Any system needs to build a database when designing, and when building, it is necessary to clarify the purpose according to the requirements of the system, and finally carry out a reasonable design in the database so that each function can correspond one by one, so that the data can be effectively processed. storage to ensure the normal operation of the system.

The Web-based campus lost and found system uses MySQL database, which includes personal information form, lost property form, found property form, message form and classification form. These five tables are detailed as follows.

(1) The classification table mainly records the storage information of various items, as shown in Table 3-1.

Table 3-1 Classification table structure

serial number

Field Name

Field Type

length

Whether primary key

illustrate

1

classify_id

int

11

yes

auto-increment id

2

Classify_name

varchar

255

no

Category Name

(2) The personal information table mainly records the personal information related to the user, as shown in Table 3-2.

Table 3-2 Personal information table structure

serial number

Field Name

Field Type

length

Whether primary key

illustrate

1

userId

int

11

yes

auto-increment id

2

user_name

varchar

255

no

username

3

user_password

varchar

255

no

password

4

user_real_name

varchar

255

no

actual name

5

email

varchar

255

no

Mail

6

tel

int

11

no

Telephone

7

role

int

11

no

User ID

8

academy

varchar

255

no

Faculty

(3) The lost and found table mainly records the relevant information of the items lost by the user, as shown in Table 3-3.

Table 3-3 Lost and found table structure

serial number

Field Name

Field Type

length

Whether primary key

illustrate

1

lost_id

int

11

yes

auto-increment id

2

lost_name

varchar

255

no

Item Name

3

lost_time

varchar

255

no

time

4

describe

varchar

255

no

describe

5

place

varchar

255

no

Place

6

sort

int

11

no

Item classification

7

user_id

int

11

no

user

(4) The pick-up table mainly records the relevant information of various picked-up items, as shown in Table 3-4.

Table 3-4 Pickup table structure

serial number

Field Name

Field Type

length

Whether primary key

illustrate

1

found_id

int

11

yes

auto-increment id

2

found_goods_name

varchar

255

no

Item Name

3

time

varchar

255

no

time

4

describe

varchar

255

no

describe

5

place

varchar

255

no

Place

6

sort

int

11

no

Item classification

7

user_id

int

11

no

user

(5) The message table mainly records various message information of users, as shown in Table 3-5.

Table 3-5 Message table structure

serial number

Field Name

Field Type

length

Whether primary key

illustrate

1

id

int

11

yes

Id self-increment

2

user_id

varchar

255

no

user

3

content

varchar

255

no

content

Second, the environment introduction

Locale: Java: jdk1.8

Database: Mysql: mysql5.7

Application server: Tomcat: tomcat8.5.31

Development tools: IDEA or eclipse

Background development technology: SSM framework

Front-end development technology: JSP+JQUERY+CSS+JS

Three, system display

4.1 Design and implementation of front-end function modules

4.1.1 User registration module

When the user comes to the system interface and clicks the registration button, he will jump to the registration interface. When registering, he needs to enter some basic information such as real name, login password, mobile phone number, user name, email address, college, etc. The mobile phone number must be 11 digits, the email format must be correct. After entering these information, click Register to register successfully, and then jump to the login interface to log in. The registration interface when the user registers is shown in Figure 4-1.

Figure 4-1 User registration

4.1.2 User login module

After the user comes to the login interface, he can log in according to the registered user name and password, and needs to enter the correct verification code to log in successfully. If the verification code is complicated and difficult to recognize, he can directly click on the picture to replace the new verification code. After successful login, the system will automatically identify the identity of the user or administrator according to the logged-in account, so that you can enter different interfaces.

Figure 4-2 shows the interface when the user logs in.

Figure 4-2 User login interface

4.1.3 Browse module

4.1.3.1 Finding information browsing

After the user enters the home page, click the "Browse" button and select "Browse the lost object information", and the lost information of various items will appear, including the category of the item, the name of the item, the time when it was lost, the place where it was lost, the information of the lost person and the description of the item. Among them, if the user has published the object-finding information before, it will also be displayed on it, and after clicking the "Edit" button, you can jump to the interface of adding object-finding information to complete the update of the object-finding information, and click the "Update object-finding" button to complete the search You can update the item information, and you can also delete the expired information by yourself.

The interface used to browse the lost item information is shown in Figure 4-3.

Figure 4-3 Lost information browsing interface

The interface for updating the object finding information is shown in Figure 4-4.

Figure 4-4 Update the object finding information interface

4.1.3.2 Recruitment Information Browsing

After the user enters the homepage, click the "Browse" button and select "Browse Recruitment Information", and the recruitment information of various items will appear, including the category of the item, the item to be recruited, the time of discovery, the location of the discovery, the user and the description of the item. If the user has picked up the lost item before and posted the claim information on it, it will also appear on it. If the owner finds his lost property, after deleting the lost item information, the claim information will be cleared. You can also enter the keyword of the lost item in the search box above the home page to search for the item. If there is the item, the information of the item will be displayed, if not, it will not be displayed.

The interface for browsing recruitment information is shown in Figure 4-5.

Figure 4-5 Recruitment Information Browsing Interface

The search result interface using the search function is shown in Figure 4-6.

Figure 4-6 Search result interface

4.1.4 Release the object finding information module

The user can click the "Release Finding Information" button on the homepage to enter the interface of adding lost item information, where you can add information about the lost item, including selecting the category of the item, adding the lost time, description of the lost item, the name of the item, and the lost item. The location of the item. After filling in the information, click the "Add Lost" button to successfully add the lost item information, as shown in Figure 4-7.

Figure 4-7 Add object finding information interface

4.1.5 Publish recruitment information module

The user clicks the "Publish Recruitment Information" button on the home page to enter the Add Recruitment Information interface, where he can add the item information he picked up, including selecting the type of item, the name of the item, the time of discovery, the location of discovery, and the description of the item. After completion Click the "Add Recruitment" button to successfully add recruitment information, and other users can also see this information when using the system, as shown in Figure 4-8.

Figure 4-8 Add recruitment information interface

4.1.6 Message board module

Users can click the "Message Board" button on the home page to enter the message board module, where users can post their own messages at any time. The user only needs to enter the content of the message in the message box, click the "Send" button, and the saved message information will be displayed on this interface, and all users can see it. If the content of the message is inappropriate, you can click on the operation column Click the "Delete" button, and the inappropriate message content will be cleared, as shown in Figure 4-9.

Figure 4-9 User message interface

4.1.7 Personal information module

Users can click the "Personal Information" button on the homepage to enter the personal information modification interface. Users can modify their personal information on this interface, including modifying user login name, user password, user real name, mobile phone number, email address and After completing the modification, click the "Modify" button below to complete the modification, as shown in Figure 4-10.

Figure 4-10 Personal information modification interface

4.2 Design and implementation of administrator function module

4.2.1 User information management module

4.2.1.1 User List

The administrator can use the administrator account to enter the background management system, and click user information management on the left side of the system, select the user list, and enter the user information overview interface, where user information can be viewed and deleted. For some users Users who use the system to promote improper information can perform deletion operations, and click the "Delete" button to complete the operation, as shown in Figure 4-11.

Figure 4-11 User information interface

4.2.1.2 Add user information

The administrator can select user information management in the background management system, and click the "Add User Information" button to jump to the administrator adding user interface. In this interface, the administrator can help the user add information. The user information to be added includes the user login name , user password, user's real name, mobile phone number, email address, and affiliation. After all the information is written, click the "Add" button to complete the user addition, as shown in Figure 4-12.

Figure 4-12 Admin add user interface

4.2.2 Recruitment information management module

4.2.2.1 Recruitment list

The administrator can select recruitment information management in the background user management system, and click the "Recruitment List" button to jump to the recruitment information interface, which includes the category, name, discovery time, description, and location of the recruitment items For the found user-related information, click the "Edit" button in the operation bar to jump to the update interface for editing or deletion, as shown in Figure 4-13.

Figure 4-13 Recruitment information interface

4.2.2.2 Add recruitment information

The administrator can select recruiting information management in the background management system, and click the "Add Recruiting Information" button to jump to the adding recruiting information interface, where you can choose to add the category of recruiting items, the name of the item, the time of discovery, the location of discovery and Item description, after filling in the information, click the "Add Claim" button below to save the claim information to the claim list, as shown in Figure 4-14.

Figure 4-14 Add recruiting information interface

4.2.3 Object-finding information management module

4.2.3.1 Object list

The administrator can select the missing object information management in the background management system, click the "Lost Object List" button, and it will jump to the lost information interface, including the category of the lost item, item name, lost time, lost location, lost person information and For the description of the item, you can choose to edit or delete the item in the operation column. After clicking the "Edit" button, you will jump to the interface of adding the missing item information, and you can update the information of the item, as shown in Figure 4-15.

Figure 4-15 Lost information interface

4.2.3.2 Add object finding information

The administrator can select the missing object information management in the background management system, and click the "Add missing object information button" to jump to the interface of adding the missing object information, including selecting the type of added item, item name, lost time, lost location and lost item After filling in all the information, click the "Add Object" button to save it, as shown in Figure 4-16.

Figure 4-16 Add object finding information interface

4.2.4 Personal information management module

4.2.4.1 Modification of personal information

The administrator can select personal information management in the background management system, click the "personal information modification" button, and it will jump to the personal information modification interface, including modifying the user login name, user password, user real name, mobile phone number, email address and affiliated hospital After completing the modification, click the "Modify" button to save the modified personal information, as shown in Figure 4-17.

Figure 4-17 Personal information modification interface

4.2.4.2 Add administrator

The administrator can choose personal information management in the background management system, and click the "Add Administrator" button to add user login name, user password, user real name, mobile phone number, email address and affiliation. After filling in and saving all the information, Then you can add a new administrator and have all the permissions of the administrator, as shown in Figure 4-18.

Figure 4-18 Add administrator interface

Fourth, the core code display

package com.czmec.action;

import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.czmec.bean.FoundGoodsBean;
import com.czmec.bean.GoodsByNameBean;
import com.czmec.bean.LostGoodsBean;
import com.czmec.bean.UserBean;
import com.czmec.service.AdminService;
import com.czmec.service.FoundService;
import com.czmec.service.LostService;
import com.czmec.service.UserService;

//管理员操作
@Controller
@RequestMapping("AdminAction")
public class AdminAction {

	@Resource(name = "adminService")
	AdminService admiservice;

	@Resource(name = "lostService")
	LostService lostservice;

	@Resource(name = "foundService")
	FoundService foundservice;

	@Resource(name = "userService")
	private UserService userservice;

	@RequestMapping("adminindex")
	public String Adminindex(HttpServletRequest req) {
		List<UserBean> list = admiservice.SelectUser();
		req.setAttribute("listUser", list);
		return "/admin/UserList";
	}

	@RequestMapping("test")
	public String test() {
      return "/admin/test";
	}

	// 获取寻物信息列表
	/*@RequestMapping("lostlist")
	@ResponseBody
	public List<LostGoodsBean> LostList() {
		List<LostGoodsBean> list = lostservice.SelectLostGoods();
		return list;
	}*/

	// 管理员添加用户
	@RequestMapping("AddUser")
	public String AddUser() {
		return "/admin/AddUser";
	}

	// 管理员添加用户具体实现
	@RequestMapping("AddUserImpl")
	public String AddUserImpl(UserBean user, HttpServletRequest req) {
		user.setRole(1);
		int i = userservice.AddUser(user);
		if (i > 0) {
			req.setAttribute("message", "添加成功");
		} else {
			req.setAttribute("message", "添加失败");
		}
		List<UserBean> list = admiservice.SelectUser();
		req.setAttribute("listUser", list);
		
		return "/admin/UserList";
	}

	// 管理员添加管理具体实现
		@RequestMapping("AddAdminImpl")
		public String AddAdminImpl(UserBean user, HttpServletRequest req) {
			user.setRole(0);
			int i = userservice.AddUser(user);
			if (i > 0) {
				req.setAttribute("message", "添加成功");
			} else {
				req.setAttribute("message", "添加失败");
			}
			List<UserBean> list = admiservice.SelectUser();
			req.setAttribute("listUser", list);
			return "/admin/UserList";
		}
		
	// 管理员添加招领
	@RequestMapping("AddFound")
	public String AddFound() {
		return "/admin/AddFound";
	}

	// 添加拾物列表
	@RequestMapping("AddFoundImpl")
	public String AddFoundImpl(FoundGoodsBean foundgoodsbean, HttpServletRequest req) {
		int i = foundservice.AddFoundGoods(foundgoodsbean);
		if (i > 0) {
			req.setAttribute("message", "添加成功");
		} else {
			req.setAttribute("message", "添加失败");
		}
		List<FoundGoodsBean> list = foundservice.SelectFoundGoods();
		req.setAttribute("foundList", list);
		return "/admin/FoundList";
	}

	// 添加一条丢物信息
	@RequestMapping("AddLost")
	public String AddLost() {
		return "/admin/AddLost";
	}

	// 添加丢物列表
	@RequestMapping("AddLostImpl")
	public String AddLostImpl(LostGoodsBean losetgoodsbean, HttpServletRequest req) {
		int i = lostservice.AddLostGoods(losetgoodsbean);
		if (i > 0) {
			req.setAttribute("message", "添加成功");
		} else {
			req.setAttribute("message", "添加失败");
		}
		List<LostGoodsBean> list = lostservice.SelectLostGoods();
		req.setAttribute("lostlist", list);
		return "/admin/LostList";
	}

	// 管理员链接到招领列表
	@RequestMapping("FoundList")
	public String FoundList(HttpServletRequest req) {
		List<FoundGoodsBean> list = foundservice.SelectFoundGoods();
		req.setAttribute("foundList", list);
		return "/admin/FoundList";
	}

	// 管理员链接到寻物列表
	@RequestMapping("LostList")
	public String LostList(HttpServletRequest req) {
		List<LostGoodsBean> list = lostservice.SelectLostGoods();
		req.setAttribute("lostlist", list);
		return "/admin/LostList";
	}

	// 个人信息修改
	@RequestMapping("UpdatUser")
	public String UpdatUser(HttpSession session) {
		if (((UserBean)session.getAttribute("user")).getRole()==0) {
			return "/admin/UpdatUser";
		}
		else {
			return "UpdatUser";
		}
	}
	// 个人信息修改
		@RequestMapping("UpdatUserImpl")
		public String UpdatUserImpl(UserBean user,HttpServletRequest req) {
		int i=userservice.UpdateUser(user);
			if (i > 0) {
				req.setAttribute("message", "修改成功");
			} else {
				req.setAttribute("message", "修改失败");
			}
			return "/admin/UpdatUser";
		}
	// 添加管理员
	@RequestMapping("AddAdmin")
	public String AddAdmin() {
		return "/admin/AddAdmin";
	}
	
	//删除用户
	@RequestMapping("DelUser")
	public String DelUser(UserBean user,HttpServletRequest req){
		int i=userservice.DelUser(user);
		if (i > 0) {
			req.setAttribute("Dmessage", "删除成功");
		} else {
			req.setAttribute("Dmessage", "删除失败");
		}
		List<UserBean> list = admiservice.SelectUser();
		req.setAttribute("listUser", list);
		return "/admin/UserList";
	}
	
	//删除招领信息
		@RequestMapping("DelFoundGoods")
		public String DelFoundGoods(FoundGoodsBean foundgoodsbean,HttpServletRequest req){
			int i=foundservice.DelFoundGoods(foundgoodsbean);
			if (i > 0) {
				req.setAttribute("Dmessage", "删除成功");
			} else {
				req.setAttribute("Dmessage", "删除失败");
			}
			List<FoundGoodsBean> list = foundservice.SelectFoundGoods();
			req.setAttribute("foundList", list);
			return "/admin/FoundList";
		}

		//删除寻物信息
		@RequestMapping("DelLostGoods")
		public String DelLostGoods(LostGoodsBean lostgoodsbean,HttpServletRequest req){
			int i=lostservice.DelLostGoods(lostgoodsbean);
			if (i > 0) {
				req.setAttribute("Dmessage", "删除成功");
			} else {
				req.setAttribute("Dmessage", "删除失败");
			}
			List<LostGoodsBean> list = lostservice.SelectLostGoods();
			req.setAttribute("lostlist", list);
			return "/admin/LostList";
		}
		
		//根据物品名字模糊查询
		@RequestMapping("SelectFoundGoodsByName")
		public String SelectFoundGoodsByName(@Param("foundName")String foundName,HttpServletRequest request) throws UnsupportedEncodingException{
		   foundName = java.net.URLDecoder.decode(foundName,"UTF-8"); 
		   GoodsByNameBean goodsbyNameBean=new GoodsByNameBean();
		  goodsbyNameBean.setFoundName(foundName);  
		 List<GoodsByNameBean> list=foundservice.SelectFoundGoodsByName(goodsbyNameBean);
			request.setAttribute("goodsByName", list);
			return "admin/SelectByNameList";
		}
		//根据ID查询个人信息
		@RequestMapping("selectUserById")
		public String selectUserById(UserBean user,HttpServletRequest request){
			List<UserBean> list=admiservice.SelectUserById(user);
		  request.setAttribute("geren",list);
	     	return "admin/IdUser";
		}
		
		//更新一条招领记录
		@RequestMapping("updatafound")
		public String UpdataFoundList(@Param("foundId")int foundId,HttpServletRequest request){
		FoundGoodsBean fBean=foundservice.SelectFoundById(foundId);
		request.setAttribute("fBean", fBean);
			return "admin/AddFound";
		}
		
		//更新一条招领记录实现
		@RequestMapping("updatafoundImpl")
		public String updtafoundImpl(FoundGoodsBean foundgoodsbean,HttpServletRequest req){
			foundservice.UpdateFoundGoods(foundgoodsbean);
			List<FoundGoodsBean> list = foundservice.SelectFoundGoods();
			req.setAttribute("foundList", list);
			return "/admin/FoundList";
		}
		
		
		//更新一条寻物记录
				@RequestMapping("updatalost")
				public String UpdataLostList(@Param("lostId")int lostId,HttpServletRequest request){
             LostGoodsBean lBean=lostservice.SelectLostById(lostId);
				request.setAttribute("lBean", lBean);
					return "admin/AddLost";
				}
				
				//更新一条寻物实现
				@RequestMapping("updatalostImpl")
				public String updtalostImpl(LostGoodsBean lostGoodsBean,HttpServletRequest req){
					lostservice.UpdateLostGoods(lostGoodsBean);
					
					List<LostGoodsBean> list = lostservice.SelectLostGoods();
					req.setAttribute("lostlist", list);
					return "/admin/LostList";
				}
		
}

package com.czmec.action;

import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.czmec.bean.WordsBean;
import com.czmec.service.WordsService;

//用户操作
@Controller
@RequestMapping("userAction")
public class UserAction {
	
	@Resource
	WordsService wordsservice;
	
	//主页面
	@RequestMapping("main")
	public String UserMain(){
		return "main";
	}
	
	//感恩
	@RequestMapping("WordsList")
	public String WordsList(HttpServletRequest request){
	 List<WordsBean> list=	wordsservice.SelectAllWords();
	 System.out.println(list);
	 request.setAttribute("wordslist",list);
		return "WordsList";
	}
	
	//添加一条感恩信
	@RequestMapping("addWords")
	public String AddWords(WordsBean wBean,HttpServletRequest request){
		 wordsservice.AddWords(wBean);
		
		List<WordsBean> list=	wordsservice.SelectAllWords();
		 System.out.println(list);
		 request.setAttribute("wordslist",list);
			return "WordsList";
	}

	
	
	//删除一条感恩信
		@RequestMapping("DelWords")
		public String DelWords(WordsBean wBean,HttpServletRequest request){
			wordsservice.DelWords(wBean);
			
			List<WordsBean> list=	wordsservice.SelectAllWords();
			 System.out.println(list);
			 request.setAttribute("wordslist",list);
				return "WordsList";
		}
}

package com.czmec.action;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.List;
import java.util.Random;

import javax.annotation.Resource;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.czmec.bean.UserBean;
import com.czmec.service.AdminService;
import com.czmec.service.UserService;

/*
 * 用户登录action
 */
@Controller
@RequestMapping("user")
public class UserLogin {
	
	@Resource(name="adminService")
	AdminService admiservice;
	
	@Resource(name="userService")
	private UserService userservice;
	
	@RequestMapping("login")
	public String login(){
		return "login";
	}
	
	@RequestMapping("checkLogin")
	public String checkLogin(UserBean user,@Param("checkcode")String checkcode,HttpSession session,HttpServletRequest request){
		String piccode=(String) request.getSession().getAttribute("piccode");
		 checkcode=checkcode.toUpperCase();//全部改成大写
		if(checkcode.equals(piccode)){
	        UserBean user1=userservice.login(user);
		    if(user1!=null){
			    if(user1.getRole()==0){
				session.setAttribute("countfound", admiservice.SelectCountFoundGoods());
				session.setAttribute("countlost",admiservice.SelectCountLostGoods());
				session.setAttribute("countuser", admiservice.SelectCountUser());
				session.setAttribute("user", user1);
			    List<UserBean> list=	admiservice.SelectUser();
			    session.setAttribute("listUser", list);
				return "/admin/index";
			}else {
				session.setAttribute("user", user1);
				  return "index";
			}
			
		}
		else {
			session.setAttribute("error", "用户名或密码错误");
			 return "Error";
		}
	}
	else {
		request.setAttribute("image", "验证码不正确");
		 return "login";
		}
}

	
	@RequestMapping("error")
	public String Error(){
		return "Error";
	}
	
	//用户注册界面
	@RequestMapping("register")
	public String register(){
		return "register";
	}
	
	//用户注册界面功能
		@RequestMapping("registerAction")
		public String registerAction(UserBean user,HttpServletRequest req){
			user.setRole(1);
		int i=	userservice.AddUser(user);
		if (i>0) {
			req.setAttribute("message", "注册成功");
			
			}else{
				req.setAttribute("message", "注册失败");
				
			}
		  return "login";
		}
	//用户退出系统
    @RequestMapping("out")
    public String out(){
    	return "login";
    }
    
    //发布寻物信息
    @RequestMapping("AddLost")
	public String Addlost(){
		return "AddLost";
	}
    
    //验证码的实现
    @RequestMapping("image")
    public void Image(HttpServletRequest request,HttpServletResponse response) throws IOException{
    	BufferedImage bi=new BufferedImage(68,22,BufferedImage.TYPE_INT_RGB);
		Graphics g=bi.getGraphics();
		Color c=new Color(200,150,255);
		g.setColor(c);
		//背景
		g.fillRect(0, 0, 68, 22);
		
		char[] ch="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".toCharArray();
		//随机获取4个字符
		Random r=new Random();
		//范围数组,随机的位置
		int len=ch.length,index;
		StringBuffer  sb=new StringBuffer();
		for(int i=0;i<4;i++)
		{
			
			//获取随机数
			index=r.nextInt(len);//获得一个随机的位置,一个字符
			//放在图片上
			g.setColor(new Color(r.nextInt(88),r.nextInt(188),r.nextInt(255)));//给个颜色
			//字符画在图片上,及位置
			g.drawString(ch[index]+"", (i*15)+3, 18);
			//字符保存StringBuffer
			sb.append(ch[index]);
			
		}
		request.getSession().setAttribute("piccode", sb.toString());
		//输出
		ImageIO.write(bi, "JPG", response.getOutputStream());
    }
    
    
}

V. Project Summary

The campus lost and found system makes it more convenient and effective for users to retrieve lost items, and also makes it easier and easier for managers to work. Through the reasonable allocation of manpower and material resources, the efficiency and quality of campus lost and found work are improved.

The main features are:

①The interface is simple and beautiful, easy to use.

② Low hardware requirements and easy maintenance.

Guess you like

Origin blog.csdn.net/BS009/article/details/127990914
Recommended