Software engineering graduation set up a fixed asset management system based on java web [source code + paper]

Tip: The way to obtain the project is at the end of the article


foreword

Today, seniors share with you a java web design project:

Fixed assets management system based on java web

Project acquisition:
https://gitee.com/sinonfin/L-javaWebSha

1. Project design

1. Modular design

insert image description here
The system is mainly divided into four modules:

Asset Management Module:

According to the unique numbers of different assets, the assets are purchased, destroyed, modified attributes, and query operations of various combination conditions, etc., including corresponding logic verification and prompts. For asset maintenance, add repair equipment, delete repaired information, and query operations; support printing of fixed asset inventory reports in multiple formats.

User management module:

You can directly add employees as users and assign them different permissions. Administrator permissions are the most powerful permissions in this system, and you can perform maintenance and query operations on all equipment and personnel. Operators do not have the function of assigning permissions, and can complete all functions except this module, such as: first, they can record assets, query all assets in different ways, destroy certain devices, modify device attribute information, and Track and change the status of lending and returning, and update the status of equipment and all information of equipment in stock in a timely manner. Secondly, it can perform corresponding maintenance such as adding, deleting, modifying information and querying employees, and can print out inventory equipment information according to different needs.

Staff management:

Supports the maintenance of school staff information, including adding new employees, deleting employees, modifying the status of employees, and querying details of employees, etc.

System Management:

Modify the login password of the login user and log out of the system safely to ensure the normal operation of the system.

2. Realize the effect

insert image description here

insert image description here
insert image description here
insert image description here

insert image description here

insert image description here
There are too many functions, so I won’t show them one by one here

2. Part of the source code

There are a lot of source codes, and the length of the article is limited, so I won’t post them here. Only a small part of the key codes will be shown. Those who need it can go to the link at the end of the article to get the source codes.

Some code examples:

StrutsAction的实现类是这个登陆页的核心内容,就来看看它是怎么实现的吧,如下所示:
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.jdy.gdzc.web.struts.form.LoginForm;
public class LoginAction extends BaseAction {
    
    		
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			                 HttpServletRequest request, HttpServletResponse response) {
    
    
		  String err = "";
		  HttpSession session=(HttpSession)request.getSession();//获得图片上的验证码
		  String randCode = (String) session.getAttribute("code");		
		  LoginForm lf=(LoginForm)form;
		  String username=lf.getUsername();
		  String password=lf.getPassword();
			if (lf.getCheckcode().equals(randCode)) {
    
    
				if (assetManagerImpl.login(username, password)) {
    
    
					// 把登录成功的用户名,放在cookie中
					Cookie c = new Cookie("username",username);
					c.setMaxAge(60 * 60 * 24);
					response.addCookie(c);
					// 登录成功,跳到显示所有课程的页面
					String competence=userManaManagerImpl.competence(username);
					session.setAttribute("username", username);
					session.setAttribute("competence", competence);
					return mapping.findForward("success");
				} else {
    
    
					err = "用户名或密码错误!";
				}
			} else {
    
    
				err = "验证码错误!";
			}		
			request.setAttribute("gdzc.login.error", err);
			return mapping.findForward("fail");		
	}
}
StrutsAction实现类的execute()方法是最先被执行的,这个方法本身也没有具体的事务,而是根据action的参数不同执行相应的方法。在登陆页里面可以找到有一个“action=login” 的字样,它的目的就是在这里做逻辑判断。当action=login时进入Action中执行execute()方法。execute()方法从LoginForm中得到用户提交的数据,然后在调用控制层中的login()方法,并将从LoginForm中得到的username, password做为参数传给控制层,调用后会返回一个boolean型的值。控制层再继续调用DAO层,DAO层得到从上层传进来的username, password并进行处理,调用后会返回一个boolean型的值并传给上层。如果为真则将username用户名放到session范围中,并返回“mapping.findForward("success")”,进入系统主页;否则返回“mapping.findForward("fail")”,将错误信息存到request范围中,跳到登陆界面并提示登陆错误信息:用户名或者密码错误、验证码错误。需要用户重新正确输入才能完成登录。接下来看一下DAO层是如何实现登陆:
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import com.jdy.gdzc.dao.IUserDAO;
public class UserDAOImpl implements IUserDAO {
    
    	
	  private SessionFactory sessionFactory;
	  public void setSessionFactory(SessionFactory sessionFactory) {
    
    
		    this.sessionFactory = sessionFactory;
	        }
	  protected Session getSession() {
    
    
		    return sessionFactory.getCurrentSession();
	        }
	  public boolean login(String userName, String password) {
    
    
		    boolean flag = false;
		    Session session = this.getSession();
		    String hql = "select pwd from UserInfo where userName=:userName";
		    try {
    
    
			    Query query = session.createQuery(hql);
			    query.setString("userName", userName);
			    String pwd = (String) query.setMaxResults(1).uniqueResult();
			    if (password.equals(pwd)) {
    
    
				    flag = true;
			        }
		        } catch (Exception e) {
    
    
			          e.printStackTrace();
		              }
		   return flag;
	}
}

Project source code

Project acquisition:
https://gitee.com/sinonfin/L-javaWebSha

Guess you like

Origin blog.csdn.net/mojikopi/article/details/131865125