项目编号:BS-XX-022
本系统基于JSP,SERVLET实现开发,前端采用layui框架实现,数据库采用MYSQL,开发工具采用IDEA或ECLIPSE。主要实现如下功能:
从管理员角度看:
用户登入系统后,可以修改管理员的密码。同时具有以下功能:
1、管理员可以管理具体项目信息。
2、管理员可以管理项目经费信息。
3、管理员可以管理项目资源信息。
4、管理员可以管理项目进度信息。
5、管理员可以管理项目成果信息。
部分展示功能如下:admin / admin
后台管理主界面
项目信息管理
项目经费管理
项目资源管理
项目进度管理
项目成果管理
本项目基本功能完整,运行无误,适合做毕业设计使用。
部门核心代码:
package com.action;
import java.io.IOException;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.dao.DB;
import com.orm.TChengguo;
import com.util.DateUtils;
public class chengguo_servlet extends HttpServlet
{
public void service(HttpServletRequest req,HttpServletResponse res)throws ServletException, IOException
{
String type=req.getParameter("type");
if(type.endsWith("chengguoAdd"))
{
chengguoAdd(req, res);
}
if(type.endsWith("chengguoMana"))
{
chengguoMana(req, res);
}
}
public void chengguoAdd(HttpServletRequest req,HttpServletResponse res)
{
String xiangmu_id=req.getParameter("xiangmu_id");
String shijian=DateUtils.formatDate2Str(new Date(), "yyyy-MM-dd HH:mm:ss");
String mingcheng=req.getParameter("mingcheng");
String miaoshu=req.getParameter("miaoshu");
String fujian=req.getParameter("fujian");
String fujianYuanshiming=req.getParameter("fujianYuanshiming");
String sql="insert into t_chengguo (xiangmu_id,mingcheng,miaoshu,shijian,fujian,fujianYuanshiming)" +
"values(?,?,?,?,?,?)";
Object[] params={xiangmu_id,mingcheng,miaoshu,shijian,fujian,fujianYuanshiming};
DB mydb=new DB();
mydb.doPstm(sql, params);
mydb.closed();
req.setAttribute("message", "操作成功");
req.setAttribute("path", "chengguo?type=chengguoMana");
String targetURL = "/common/success.jsp";
dispatch(targetURL, req, res);
}
public void chengguoMana(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException
{
String sql="select ta.*,tb.mingcheng xmmc from t_chengguo ta,t_xiangmu tb " +
"where ta.xiangmu_id=tb.id and del='no'";
List chengguoList=new ArrayList();
Object[] params={};
DB mydb=new DB();
try
{
mydb.doPstm(sql, params);
ResultSet rs=mydb.getRs();
while(rs.next())
{
TChengguo chengguo=new TChengguo();
chengguo.setId(rs.getInt("id"));
chengguo.setXmmc(rs.getString("xmmc"));
chengguo.setShijian(rs.getString("shijian"));
chengguo.setMingcheng(rs.getString("mingcheng"));
chengguo.setMiaoshu(rs.getString("miaoshu"));
chengguo.setFujian(rs.getString("fujian"));
chengguo.setFujianYuanshiming(rs.getString("fujianYuanshiming"));
chengguoList.add(chengguo);
}
rs.close();
}
catch(Exception e)
{
e.printStackTrace();
}
mydb.closed();
req.setAttribute("chengguoList", chengguoList);
req.getRequestDispatcher("admin/chengguo/chengguoMana.jsp").forward(req, res);
}
public void dispatch(String targetURI,HttpServletRequest request,HttpServletResponse response)
{
RequestDispatcher dispatch = getServletContext().getRequestDispatcher(targetURI);
try
{
dispatch.forward(request, response);
return;
}
catch (ServletException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
}
public void init(ServletConfig config) throws ServletException
{
super.init(config);
}
public void destroy()
{
}
}
package com.action;
import java.io.IOException;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.dao.DB;
import com.orm.TJindu;
import com.util.DateUtils;
public class jindu_servlet extends HttpServlet
{
public void service(HttpServletRequest req,HttpServletResponse res)throws ServletException, IOException
{
String type=req.getParameter("type");
if(type.endsWith("jinduAdd"))
{
jinduAdd(req, res);
}
if(type.endsWith("jinduMana"))
{
jinduMana(req, res);
}
}
public void jinduAdd(HttpServletRequest req,HttpServletResponse res)
{
String xiangmu_id=req.getParameter("xiangmu_id");
String shijian=req.getParameter("shijian");
String miaoshu=req.getParameter("miaoshu");
String baifenbi=req.getParameter("baifenbi");
String sql="insert into t_jindu (xiangmu_id,shijian,miaoshu,baifenbi) values(?,?,?,?)";
Object[] params={xiangmu_id,shijian,miaoshu,baifenbi};
DB mydb=new DB();
mydb.doPstm(sql, params);
mydb.closed();
req.setAttribute("message", "操作成功");
req.setAttribute("path", "jindu?type=jinduMana");
String targetURL = "/common/success.jsp";
dispatch(targetURL, req, res);
}
public void jinduMana(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException
{
String sql="select ta.*,tb.mingcheng from t_jindu ta,t_xiangmu tb " +
"where ta.xiangmu_id=tb.id and del='no'";
List jinduList=new ArrayList();
Object[] params={};
DB mydb=new DB();
try
{
mydb.doPstm(sql, params);
ResultSet rs=mydb.getRs();
while(rs.next())
{
TJindu jindu=new TJindu();
jindu.setId(rs.getInt("id"));
jindu.setXmmc(rs.getString("mingcheng"));
jindu.setShijian(rs.getString("shijian"));
jindu.setMiaoshu(rs.getString("miaoshu"));
jindu.setBaifenbi(rs.getString("baifenbi"));
jinduList.add(jindu);
}
rs.close();
}
catch(Exception e)
{
e.printStackTrace();
}
mydb.closed();
req.setAttribute("jinduList", jinduList);
req.getRequestDispatcher("admin/jindu/jinduMana.jsp").forward(req, res);
}
public void dispatch(String targetURI,HttpServletRequest request,HttpServletResponse response)
{
RequestDispatcher dispatch = getServletContext().getRequestDispatcher(targetURI);
try
{
dispatch.forward(request, response);
return;
}
catch (ServletException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
}
public void init(ServletConfig config) throws ServletException
{
super.init(config);
}
public void destroy()
{
}
}
package com.action;
import java.io.IOException;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.dao.DB;
import com.orm.TJingfei;
import com.util.DateUtils;
public class jingfei_servlet extends HttpServlet
{
public void service(HttpServletRequest req,HttpServletResponse res)throws ServletException, IOException
{
String type=req.getParameter("type");
if(type.endsWith("jingfeiAdd"))
{
jingfeiAdd(req, res);
}
if(type.endsWith("jingfeiMana"))
{
jingfeiMana(req, res);
}
if(type.endsWith("jingfeiDel"))
{
jingfeiDel(req, res);
}
}
public void jingfeiAdd(HttpServletRequest req,HttpServletResponse res)
{
String xiangmu_id=req.getParameter("xiangmu_id");
String shijian=req.getParameter("shijian");
String jine=req.getParameter("jine");
String sql="insert into t_jingfei (xiangmu_id,jine,shijian) values(?,?,?)";
Object[] params={xiangmu_id,jine,shijian};
DB mydb=new DB();
mydb.doPstm(sql, params);
mydb.closed();
req.setAttribute("message", "操作成功");
req.setAttribute("path", "jingfei?type=jingfeiMana");
String targetURL = "/common/success.jsp";
dispatch(targetURL, req, res);
}
public void jingfeiDel(HttpServletRequest req,HttpServletResponse res)
{
String id=req.getParameter("id");
String sql="update t_jingfei set del='yes' where id=?";
Object[] params={id};
DB mydb=new DB();
mydb.doPstm(sql, params);
mydb.closed();
req.setAttribute("message", "操作成功");
req.setAttribute("path", "jingfei?type=jingfeiMana");
String targetURL = "/common/success.jsp";
dispatch(targetURL, req, res);
}
public void jingfeiMana(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException
{
String sql="select ta.*,tb.mingcheng from t_jingfei ta,t_xiangmu tb " +
"where ta.xiangmu_id=tb.id and del='no'";
List jingfeiList=new ArrayList();
Object[] params={};
DB mydb=new DB();
try
{
mydb.doPstm(sql, params);
ResultSet rs=mydb.getRs();
while(rs.next())
{
TJingfei jingfei=new TJingfei();
jingfei.setId(rs.getInt("id"));
jingfei.setXmmc(rs.getString("mingcheng"));
jingfei.setShijian(rs.getString("shijian"));
jingfei.setJine(rs.getString("jine"));
jingfeiList.add(jingfei);
}
rs.close();
}
catch(Exception e)
{
e.printStackTrace();
}
mydb.closed();
req.setAttribute("jingfeiList", jingfeiList);
req.getRequestDispatcher("admin/jingfei/jingfeiMana.jsp").forward(req, res);
}
public void dispatch(String targetURI,HttpServletRequest request,HttpServletResponse response)
{
RequestDispatcher dispatch = getServletContext().getRequestDispatcher(targetURI);
try
{
dispatch.forward(request, response);
return;
}
catch (ServletException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
}
public void init(ServletConfig config) throws ServletException
{
super.init(config);
}
public void destroy()
{
}
}
package com.action;
import com.jspsmart.upload.SmartUpload;
import com.jspsmart.upload.SmartUploadException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
public class SmartDownloadServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
this.doPost(req, resp);
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String filename = req.getParameter("filename");
SmartUpload su = new SmartUpload();
su.initialize(getServletConfig(), req, resp);
// 设置响应类型
su.setContentDisposition(null);
try {
su.downloadFile(filename);
} catch (SmartUploadException e) {
e.printStackTrace();
}
}
}