作者主页:夜未央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
794

被折叠的 条评论
为什么被折叠?



