Java项目:SSH固定资产管理系统

作者主页:夜未央5788

 简介:Java领域优质创作者、Java项目、学习资料、技术互助

文末获取源码

项目介绍

固定资产管理系统是对高校固定资产的一个信息化管理系统,基本功能包括:对固定资产的购进、接触、销毁,对物品的使用状态、借出状态、库存状态等进行标识,对各类物品进行编号,根据编号进行查询,根据名称进行查询等。本系统结构如下:
(1)系统登录:
用户登录模块:登录功能
重置
(2)系统用户管理:
对系统用户的增加
系统用户的权限修改
系统用户的删除
分配系统用户的权限
修改本身登录密码
资产的相关维护
(3)员工信息管理:
教工的增加、修改、删除、查询
(4)资产入库管理:
资产的录入
资产的属性修改
资产的报废删除
资产的属性查询
(5)资产维护管理:
物资的维修、维护物资的信息修改
(7)资产借还管理:
增加借出资产
查询借出资产
归还已借出资产
(8)打印报表

由于本程序规模不大,可供课程设计,毕业设计学习演示之用

环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 
5.数据库:MySql 5.7版本;

6.是否Maven项目:否;

技术栈

1. 后端:Spring+Struts+Hibernate

2. 前端:JSP+JavaScript+CSS

使用说明

1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;

2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;

若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;

3. 将项目中WebRoot/WEB-INF/applicationContext.xml配置文件中的数据库配置改为自己的配置;
4. 运行项目,输入http://localhost:8080/gdzc/login/login.jsp 登录 注:tomcat中配置项目路径必须为gdzc,否则登录不成功;

管理员账号/密码:admin/admin

运行截图

 

 

 

 

 

 

 

相关代码 

AddAssetsAction

package com.niuys.gdzc.web.struts.action;

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.niuys.gdzc.model.ZcInfo;
import com.niuys.gdzc.web.struts.form.ZCForm;

public class AddAssetsAction extends BaseAction {	
	
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {	
		HttpSession session=(HttpSession)request.getSession();
		ZCForm zc = (ZCForm) form;
		String err1="入库时间必须晚于产品的生产日期";
		String err2="资产编号已经存在";
		
		ZcInfo zcinfo=new ZcInfo();
		zcinfo.setZcId(zc.getZc_id());
		zcinfo.setZcNo(zc.getZc_no());
		zcinfo.setZcName(zc.getZc_name());
		zcinfo.setZcPrice(Float.parseFloat(zc.getZc_price()));
		zcinfo.setZcFactory(zc.getZc_factory());
		zcinfo.setZcProduceTime(zc.getZc_produceTime());
		zcinfo.setZcBuyTime(zc.getZc_buyTime());		
		zcinfo.setZcBuyer(zc.getZc_buyer());
		zcinfo.setZcType(zc.getZc_type());
		zcinfo.setZcStatus(zc.getZc_status()); 
		zcinfo.setZcBzxx(zc.getZc_bzxx());	
		
		String zc_buyTime = zc.getZc_buyTime();
		String[] buy_numbers = zc_buyTime.split("-");
		int buy_year = Integer.parseInt(buy_numbers[0]);
		int buy_month = Integer.parseInt(buy_numbers[1]);
		int buy_date = Integer.parseInt(buy_numbers[2]);

		String zc_proTime =zc.getZc_produceTime();
		String[] pro_numbers = zc_proTime.split("-");
		int pro_year = Integer.parseInt(pro_numbers[0]);
		int pro_month = Integer.parseInt(pro_numbers[1]);
		int pro_date = Integer.parseInt(pro_numbers[2]);

		if(assetManagerImpl.checkZCID(zc.getZc_id())){
			if (buy_year >= pro_year) {
				if (buy_year == pro_year) {
					if (buy_month >= pro_month) {
						if (buy_month == pro_month) {
							if (buy_date >= pro_date) {
								assetManagerImpl.addAssets(zcinfo);
								return mapping.findForward("success");
							} else {
								request.setAttribute("gdzc.add.error1", err1);
								return mapping.findForward("fail");
							}
						}else{
							assetManagerImpl.addAssets(zcinfo);
							return mapping.findForward("success");
							}
					} else {
						request.setAttribute("gdzc.add.error1", err1);
						return mapping.findForward("fail");
					}
				} else {
					assetManagerImpl.addAssets(zcinfo);
					return mapping.findForward("success");
				}
			}else{
				request.setAttribute("gdzc.add.error1", err1);
				return mapping.findForward("fail");
			}
		}else{
			request.setAttribute("gdzc.add.error2", err2);
			return mapping.findForward("fail");
		}
	}
}

AddEmployeeAction

package com.niuys.gdzc.web.struts.action;

import java.util.List;

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;

public class AddEmployeeAction extends BaseAction {

	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		HttpSession session = (HttpSession) request.getSession();

		List list = null;

		try {
			list = employeeManagerImpl.showAlldept();
			session.setAttribute("list", list);
			return mapping.findForward("success");
		} catch (Exception e) {

			e.printStackTrace();
			return mapping.findForward("fail");
		}
	}

}

BaseAction

package com.niuys.gdzc.web.struts.action;

import org.apache.struts.action.Action;

import com.niuys.gdzc.service.AssetManager;
import com.niuys.gdzc.service.IAssetPerManager;
import com.niuys.gdzc.service.IEmployeeManager;
import com.niuys.gdzc.service.IInOutAssetManager;
import com.niuys.gdzc.service.IUserManaManager;



public class BaseAction extends Action {

	protected AssetManager assetManagerImpl;
	public void setAssetManagerImpl(AssetManager assetManagerImpl) {
		this.assetManagerImpl = assetManagerImpl;
	}
	
	protected IAssetPerManager  assetPerManagerImpl;
	public void setAssetPerManagerImpl(IAssetPerManager assetPerManagerImpl) {
		this.assetPerManagerImpl = assetPerManagerImpl;
	}

	protected IInOutAssetManager  inOutAssetManagerImpl;
	public void setInOutAssetManagerImpl(IInOutAssetManager inOutAssetManagerImpl) {
		this.inOutAssetManagerImpl = inOutAssetManagerImpl;
	}
	
	
	protected IEmployeeManager employeeManagerImpl;

	public void setEmployeeManagerImpl(IEmployeeManager employeeManagerImpl) {
		this.employeeManagerImpl = employeeManagerImpl;
	}
	
	
	protected IUserManaManager userManaManagerImpl;
	
	public void setUserManaManagerImpl(IUserManaManager userManaManagerImpl) {
		this.userManaManagerImpl = userManaManagerImpl;
	}
	

	
}

JHGLAction

package com.niuys.gdzc.web.struts.action;

import java.util.List;

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.niuys.gdzc.web.struts.form.ZCForm;

public class JHGLAction extends BaseAction {
	
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		
		HttpSession session = request.getSession();
		// 分页
		int pageCount = 10; // 每页显示的记录数
		int totalCount = 0; // 总记录数
		int currrentPage = 1; // 当前页面编号
		int totalPage = 0; // 页面总数

		String tempStr = request.getParameter("currentPage");
		if (tempStr != null) {
			currrentPage = Integer.parseInt(tempStr);

		}
		// 计算总记录数
		totalCount = inOutAssetManagerImpl.showLendAssets().size();

		// 计算总页数
		totalPage = (totalCount % pageCount == 0) ? (totalCount / pageCount)
				: (totalCount / pageCount + 1);
		if (totalPage == 0) {
			totalPage = 1;
		}

		// 修正当前页面编号,确保: 1<=currrentPage<=totalPage
		if (currrentPage > totalPage) {
			currrentPage = totalPage;
		} else if (currrentPage < 1) {
			currrentPage = 1;
		}

		// 计算当前页面所显示的第一个记录的索引
		int pageStartRow = (currrentPage - 1) * pageCount;
		List list = inOutAssetManagerImpl.findPageLendAssets(pageStartRow, pageCount);
		request.setAttribute("totalCount", totalCount);
		request.setAttribute("pageCount", pageCount);
		session.setAttribute("countpage", totalPage);
		request.setAttribute("pages", currrentPage);
		session.setAttribute("list", list);

		return mapping.findForward("success");	
	}
}

LoginAction

package com.niuys.gdzc.web.struts.action;

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.niuys.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);
					System.out.println("username为:"+username);
					System.out.println("password为:"+password);
					return mapping.findForward("success");
				} else {
					err = "用户名或密码错误!";
				}
			} else {
			
				err = "验证码错误!";
			}
			System.out.println(err+"====================");
			request.getSession().setAttribute("err", err);
			return mapping.findForward("fail");		
	}
}

StoreInShowAllAction

package com.niuys.gdzc.web.struts.action;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.niuys.gdzc.model.ZcInfo;
import com.niuys.gdzc.util.DataPageBean;


public class StoreInShowAllAction extends BaseAction {
	
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		
//开始分页
		
		List<ZcInfo> list = assetManagerImpl.showAllAssets();
		DataPageBean dpb = new DataPageBean();
		int _countRecord = list.size();
		dpb.setAll(_countRecord, 3);
		
		int currentPage = 1;
		String currentPage1 = request.getParameter("currentPage");
		if(currentPage1 != null){
			currentPage = Integer.parseInt(currentPage1);
		}
		
		if(currentPage>dpb.getCountPage()){
			currentPage=dpb.getCountPage();
		}else if(currentPage< 1){
			currentPage = 1;
		}
		
		int begin = (currentPage-1)*dpb.getSizePage();
		int size = dpb.getSizePage();
		
		List<ZcInfo> listPage = assetManagerImpl.findPageAssets(begin, size);
		
//结束分页
		
		request.setAttribute("countRecord", _countRecord);
		request.setAttribute("currentPage", currentPage);
		request.setAttribute("countPage", dpb.getCountPage());
		request.setAttribute("StoreInlist", listPage);
		return mapping.findForward("success");
	}

}

如果也想学习本系统,下面领取。关注并回复:018ssh

3.1基本信息管理 设备类型信息管理:设备类型信息包括(ID,名称)可以通过对类型编号(ID)或类型名称查询设备类型信息,并可以对这些信息进行添加,一般不删除,当该设备类型没有对应的设备信息时,可以删除,购置新的设备类型时可对设备类型信息进行添加。 设备基本信息管理:设备基本信息包括(设备编号,设备名称,设备型号,设备分类,所属部门,购买价格,折旧成本,购买日期,状态,报废日期,注销日期,设备数量)可以通过设备名或部门对设备的这些信息进行查询。 部门信息:部门信息包括部门编号,名称 3.2日常事务管理 设备添加:设备购置信息包括设备编号,设备型号,设备名称,所属类型,所属部门,购买价格,折旧价,购买日期,数量等,购入新设备时,应该完成对设备的添加。 删除设备:将删除本条设备的所有信息 借出借入管理:包括设备信息,借出借入部门 设备报废信息管理:设备报废信息包括设备编号,设备型号,设备名称,所属类型,所属部门,购买价格,折旧价,购买日期,报废日期等 3.3系统管理 管理员管理:(ID,名称,密码,权限类型,备注)包括系统管理员的添加,删除,赋予操作权限,取消操作权限,锁定用户,解除锁定,普通管理员只可以修改自己的密码,超级管理员不能修改普通管理员的密码其余操作都由超级管理员完成。 修改密码:登录系统的用户可以根据需要修改自己的密码 权限管理:超级管理员可以设置一般用户的操作权限。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

夜未央5788

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
>