团队作业(五):冲刺总结(五)

团队作业(五):冲刺总结(五)

项目:电子公文传输系统

今日任务

  • 完成昨日余留任务
  • 开展今日任务

今日任务的完成情况

学号&姓名 任务 完成情况
20191304商苏赫 后端设计处理login.jsp发回数据, 100%
20191314徐汇仁 后端设计处理head.jsp,audit.jsp发回数据 100%
20191323王予涵 前端设计left.jsp;audit.jsp; 89%
20191325施羿 数据库代码处理 92%
20191330雷清逸 前端设计password.jsp;systemuser.jsp 86%

任务片段

LoginController(login.jsp数据处理)
package controller;

import java.io.IOException;
import java.io.PrintWriter;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.util.ArrayList;

import javax.crypto.BadPaddingException;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import helper.TwoJiaMi;
import helper.FourJiaMi;
import pojo.DBHelper;

public class LoginController extends HttpServlet {

	/**
	 * Constructor of the object.
	 */
	public LoginController() {
		super();
	}

	/**
	 * Destruction of the servlet. <br>
	 */
	@Override
	public void destroy() {
		super.destroy(); // Just puts "destroy" string in log
		// Put your code here
	}

	/**
	 * The doGet method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to get.
	 *
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	@Override
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		doPost(request, response);
	}

	/**
	 * The doPost method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to post.
	 *
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	@Override
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		response.setContentType("text/html;charset=gb2312");
		request.setCharacterEncoding("gb2312");

		String name = request.getParameter("name");
		String pwd = request.getParameter("pwd");

		try {
			String sql = "select * from admin where name='"+name+"' and pwd='"+pwd+"'";
			String args[] = {"id","name","pwd","type","status"};
			System.out.print("--------------"+sql);
			DBHelper sb = new DBHelper();
			ArrayList al = sb.selectRow(args, sql);
			String responseText = "";

			if(al == null || al.size() == 0){
				responseText = "1";
			}else{
				HttpSession session = request.getSession();
				session.setAttribute("adminlogin", al);
				responseText = "2";
				ArrayList adminlogin = (ArrayList)session.getAttribute("adminlogin");
			}
			PrintWriter out = response.getWriter();
			out.print(responseText);
			out.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 * Initialization of the servlet. <br>
	 *
	 * @throws ServletException if an error occure
	 */
	@Override
	public void init() throws ServletException {
	}

}

left.jsp
<%@ page language="java" import="java.util.*" pageEncoding="gb2312"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
ArrayList adminlogin = (ArrayList)session.getAttribute("adminlogin");

%>

 <aside class="main-sidebar" style='height:100%;border-right:2px solid red'>
<section class="sidebar">
	<ul class="sidebar-menu">
 
<%
if(adminlogin != null && adminlogin.size() != 0){




if(adminlogin.get(3).equals("2")){
%>
  <li><a href="<%=path %>/admin/document.jsp">公文管理</a></li>
<%}else{ %>
  <li><a href="javascript:void(0)" style="color:#CCC">公文管理</a></li>
<%} %>
<%if(adminlogin.get(3).equals("3")){ %>
  <li><a href="<%=path %>/admin/audit.jsp">院领导审批</a></li>
  <li><a href="<%=path %>/admin/audit1.jsp">公文审批</a></li>
  <li><a href="<%=path %>/admin/xiafa.jsp">可下发公文</a></li>
<%}else{ %>
  <li><a href="javascript:void(0)" style="color:#CCC">院领导审批</a></li>
  <li><a href="javascript:void(0)" style="color:#CCC">公文审批</a></li>
  <li><a href="javascript:void(0)" style="color:#CCC">可下发公文</a></li>
<%} %>
<%if(adminlogin.get(3).equals("1")){ %>
  <li><a href="<%=path %>/admin/systemuser.jsp">系统用户管理</a></li>
  <li><a href="<%=path %>/admin/dep.jsp">学院部门管理</a></li>
<%}else{ %>
  <li><a href="javascript:void(0)" style="color:#CCC">系统用户管理</a></li>
  <li><a href="javascript:void(0)" style="color:#CCC">学院部门管理</a></li>
<%}} %>
</ul>
</section>
</aside>
		 
DBHelper
package pojo;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;

import helper.SQLConnection;

public class DBHelper {

	Connection conn = null;
	Statement st = null;
	ResultSet rs = null;

	/**
	 * 
	 * @param sql
	 * @param args
	 * @return ArrayList
	 * @��ȡ������Ϣ
	 */
	public ArrayList select(String sql, String[] args) {
		ArrayList al = new ArrayList();
		conn = SQLConnection.getConn();
		try {
			st = conn.createStatement();
			rs = st.executeQuery(sql);
			while (rs.next()) {
				ArrayList alRow = new ArrayList();
				for (int i = 0; i < args.length; i++) {
					alRow.add(rs.getString(args[i]));
				}
				al.add(alRow);
			}
		} catch (SQLException e) {
			e.printStackTrace();
		} finally {
			SQLConnection.close(conn, st, rs);
		}
		return al;
	}

	/**
	 * 
	 * @param sql
	 * @param args
	 */
	public ArrayList selectRow(String[] args, String sql) {
		ArrayList al = new ArrayList();
		conn = SQLConnection.getConn();
		try {
			st = conn.createStatement();
			rs = st.executeQuery(sql);
			rs.next();
			for (int i = 0; i < args.length; i++) {
				al.add(rs.getString(args[i]));
			}
		} catch (SQLException e) {
		} finally {
			SQLConnection.close(conn, st, rs);
		}
		return al;
	}

	/**
	 * 
	 * @param sql
	 * @param args
	 */
	public ArrayList selectRow(String sql, String[] args) {
		ArrayList al = new ArrayList();
		conn = SQLConnection.getConn();
		try {
			st = conn.createStatement();
			rs = st.executeQuery(sql);
			while (rs.next()) {
				for (int i = 0; i < args.length; i++) {
					al.add(rs.getString(args[i]));
				}
			}
		} catch (SQLException e) {
			e.printStackTrace();
		} finally {
			SQLConnection.close(conn, st, rs);
		}
		return al;
	}

	/**
	 * 
	 * @param sql
	 * @param args
	 * @return ArrayList @��ȡ��ҳ��Ϣ
	 */
	public ArrayList selectPage(String sql, String[] args, int showRow, int itemSum) {
		ArrayList al = new ArrayList();
		conn = SQLConnection.getConn();
		try {
			st = conn.createStatement();
			rs = st.executeQuery(sql);
			for (int i = 0; i < itemSum; i++) {
				rs.next();
			}
			for (int n = 0; n < showRow; n++) {
				rs.next();
				ArrayList alRow = new ArrayList();
				for (int i = 0; i < args.length; i++) {
					alRow.add(rs.getString(args[i]));
				}
				al.add(alRow);
			}
		} catch (SQLException e) {
			// TODO �Զ����� catch ��
			e.printStackTrace();
		} finally {
			SQLConnection.close(conn, st, rs);
		}
		return al;
	}
}

image

明日任务如下

学号&姓名 任务
20191304商苏赫 后端设计处理checker.java;DeleteController.java;FileController.java
20191314徐汇仁 后端设计处理CheckerController.java;DepartmentController.java;InsertAdminController.java
20191323王予涵 前端设计audit1.jsp;dep_add.jsp;dep.jsp;document_add.jsp;xiafa.jsp
20191325施羿 数据库代码处理sqlhelper.java;CRUDHelper.java
20191330雷清逸 前端设计document_show.jsp;document.jsp;systemuser_add.jsp

会议合照

image

燃尽图

posted @ 2021-12-09 23:37  1913新生代农民工  阅读(87)  评论(0编辑  收藏  举报