基於JSP開發的物流資訊管理系統

我最喜歡喝娃哈哈發表於2020-11-13

10064基於JSP開發的物流資訊管理系統

程式碼
鏈-椄:https://pan@baidu@com/s/1b_CCWhXdhnaGAwT6DNsLFA (把@換成 . 就可正常訪問)
趧-紶-碼:5345
f/u枝此段-吶傛開啟baidu網盤手機App,caozuo更方便哦

技術
JAVA + JSP

工具
eclipse + tomact + mysql + jdk

功能詳情

功能詳情
本站首頁
物流動態
物流知識
貨物資訊
車輛資訊
企業資訊
輔助工具
退出

系統相關截圖

● 系統首頁

在這裡插入圖片描述

package com.servlet;

import java.io.IOException;
import java.io.PrintWriter;

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

import com.daoImpl.DeptDaoImpl;
import com.daoImpl.EmploeDaoImpl;
import com.entity.Dept;

public class ManagerDeptAdd extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String did = request.getParameter(“did”);
String dname = request.getParameter(“dname”);
String dnumber = request.getParameter(“dnumber”);
String daddr = request.getParameter(“daddr”);
String eid = request.getParameter(“eid”);
Dept dept = new Dept();
dept.setDid(Integer.parseInt(did));
dept.setDname(dname);
dept.setDnumber(Integer.parseInt(dnumber));
dept.setDaddr(daddr);
dept.setEid(Integer.parseInt(eid));
DeptDaoImpl ddi = new DeptDaoImpl();
boolean flag = ddi.insertDept(dept);
if(flag){
EmploeDaoImpl edi = new EmploeDaoImpl();
boolean flag2 = edi.updatePidByEid(Integer.parseInt(eid), 2011);
if(flag2){
response.sendRedirect(“ManagerDeptTable”);
}
}
}

public void doPost(HttpServletRequest request, HttpServletResponse response)
		throws ServletException, IOException {
	this.doGet(request, response);
}

}
package com.servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;

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

import com.daoImpl.DeptDaoImpl;
import com.entity.Dept;
import com.entity.Message;

public class ManagerDeptTable extends HttpServlet {

public void doGet(HttpServletRequest request, HttpServletResponse response)
		throws ServletException, IOException {
	DeptDaoImpl ddi = new DeptDaoImpl();
	String pageNow =request.getParameter("n");
	if(pageNow==null||pageNow.equals("")){
		pageNow="1";
	}
	if(Integer.parseInt(pageNow)<1){
		pageNow="1";
	}
	int pageCount =1;
	if(request.getSession().getAttribute("pageCount")!=null&&!request.getSession().getAttribute("pageCount").equals("")){
		pageCount =(Integer)request.getSession().getAttribute("pageCount");
	}
	if(Integer.parseInt(pageNow)>pageCount){
		pageNow = pageCount+"";
	}
	ArrayList<Dept> deptlist = ddi.getAllDeptByPage(Integer.parseInt(pageNow));
	System.out.println("ÎÒÊÇ·ñΪ¿Õ"+deptlist.isEmpty());
	request.getSession().setAttribute("deptlist", deptlist);
	pageCount =ddi.getPageCount();
	request.getSession().setAttribute("pageCount", pageCount);
	request.getSession().setAttribute("pageNow", pageNow);
	int lineCount =ddi.getLineCount();
	request.getSession().setAttribute("lineCount", lineCount);
	response.sendRedirect("manager/dept_table.jsp");
}

public void doPost(HttpServletRequest request, HttpServletResponse response)
		throws ServletException, IOException {
		this.doGet(request, response);
}

}
package com.servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;

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

import com.daoImpl.DeptDaoImpl;
import com.daoImpl.EmploeDaoImpl;
import com.daoImpl.PostDaoImpl;
import com.entity.Emploe;
import com.entity.Post;

public class ManagerDeptTable_add extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
EmploeDaoImpl edi = new EmploeDaoImpl();
//適合當經理的職位架構師,列出所有適合人選
ArrayList pnameList = edi.getEmploeByPname(“架構師”);
request.getSession().setAttribute(“pnameList”, pnameList);
response.sendRedirect(“manager/dept_add.jsp”);
}

public void doPost(HttpServletRequest request, HttpServletResponse response)
		throws ServletException, IOException {
	this.doGet(request, response);
}

}
package com.servlet;

import java.io.IOException;
import java.util.ArrayList;

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

import com.daoImpl.*;
import com.entity.Dept;

public class ManagerDeptUpdate extends HttpServlet {

public void doGet(HttpServletRequest request, HttpServletResponse response)
		throws ServletException, IOException {
	String did = request.getParameter("did");
	DeptDaoImpl ddi = new DeptDaoImpl();
	Dept dept = ddi.getDeptById(Integer.parseInt(did));
	request.getSession().setAttribute("dept", dept);
	ArrayList<Dept> deptList = ddi.getAllDept();
	request.getSession().setAttribute("deptList", deptList);
	response.sendRedirect("manager/dept_update.jsp");
}

public void doPost(HttpServletRequest request, HttpServletResponse response)
		throws ServletException, IOException {
	this.doGet(request, response);
}

}
package com.servlet;

import java.io.IOException;
import java.io.PrintWriter;

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

import com.daoImpl.DeptDaoImpl;
import com.entity.Dept;

public class ManagerDeptUpdate_table extends HttpServlet {

public void doGet(HttpServletRequest request, HttpServletResponse response)
		throws ServletException, IOException {
	String did = request.getParameter("did");
	String dname = request.getParameter("dname");
	String dnumber = request.getParameter("dnumber");
	String daddr = request.getParameter("daddr");
	String eid= request.getParameter("eid");
	Dept dept = new Dept();
	dept.setDid(Integer.parseInt(did));
	dept.setDname(dname);
	dept.setDnumber(Integer.parseInt(dnumber));
	dept.setDaddr(daddr);
	dept.setEid(Integer.parseInt(eid));
	DeptDaoImpl ddi = new DeptDaoImpl();
	boolean flag = ddi.updateDept(Integer.parseInt(did), dept);
	if(flag){
		response.sendRedirect("ManagerDeptTable");
	}
}

public void doPost(HttpServletRequest request, HttpServletResponse response)
		throws ServletException, IOException {
	this.doGet(request, response);
}

}
package com.servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.text.ParseException;
import java.text.SimpleDateFormat;

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

import com.daoImpl.EmploeDaoImpl;
import com.entity.Emploe;

public class ManagerEmploeAdd extends HttpServlet {

public void doGet(HttpServletRequest request, HttpServletResponse response)
		throws ServletException, IOException {
	String eid =request.getParameter("eid");
	String ename =request.getParameter("ename");
	String esalary =request.getParameter("esalary");
	String esex =request.getParameter("esex");
	String ebir =request.getParameter("ebir");
	String emarry =request.getParameter("emarry");
	String eedu =request.getParameter("eedu");
	String did =request.getParameter("did");
	String pid =request.getParameter("pid");
	String eaddr =request.getParameter("eaddr");
	String ephone =request.getParameter("ephone");
	Emploe emploe = new Emploe();
	emploe.setEid(Integer.parseInt(eid));
	emploe.setEname(ename);
	emploe.setEsalary(esalary);
	emploe.setEsex(esex);
	SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
	try {
		emploe.setEbir(sdf.parse(ebir));
	} catch (ParseException e) {
		e.printStackTrace();
	}
	emploe.setEmarry(emarry);
	emploe.setEedu(eedu);
	emploe.setDid(Integer.parseInt(did));
	emploe.setPid(Integer.parseInt(pid));
	emploe.setEaddr(eaddr);
	emploe.setEphone(ephone);
	EmploeDaoImpl edi = new EmploeDaoImpl();
	boolean flag = edi.addEmploe(emploe);
	if(flag){
		response.sendRedirect("EmploeTable");
	}else{
		response.sendRedirect("ManagerEmploeTable_add");
	}
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
		throws ServletException, IOException {
	this.doGet(request, response);
}

}
package com.servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;

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

import com.daoImpl.DeptDaoImpl;
import com.daoImpl.PostDaoImpl;
import com.entity.Dept;
import com.entity.Post;

public class ManagerEmploeTable_add extends HttpServlet {

public void doGet(HttpServletRequest request, HttpServletResponse response)
		throws ServletException, IOException {
	DeptDaoImpl ddi = new DeptDaoImpl();
	ArrayList<Dept> deptList =ddi.getAllDept();
	PostDaoImpl pdi = new PostDaoImpl();
	ArrayList<Post> postList = pdi.getAllPost();
	request.getSession().setAttribute("deptList", deptList);
	request.getSession().setAttribute("postList", postList);
	response.sendRedirect("manager/emploe_add.jsp");
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
		throws ServletException, IOException {
	this.doGet(request, response);
}	

}
package com.servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.text.ParseException;
import java.text.SimpleDateFormat;

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

import com.daoImpl.DeptDaoImpl;
import com.daoImpl.EmploeDaoImpl;
import com.daoImpl.PostDaoImpl;
import com.entity.Dept;
import com.entity.Emploe;
import com.entity.Post;

public class ManagerEmploeUpdate extends HttpServlet {

public void doGet(HttpServletRequest request, HttpServletResponse response)
		throws ServletException, IOException {
	Emploe emploe =(Emploe)request.getSession().getAttribute("emploe");
	String eid = request.getParameter("eid");
	String ename = request.getParameter("ename");
	String esalary = request.getParameter("esalary");
	String esex = request.getParameter("esex");
	String ebir = request.getParameter("ebir");
	String emarry = request.getParameter("emarry");
	String eedu = request.getParameter("eedu");
	String did = request.getParameter("did");
	DeptDaoImpl ddi = new DeptDaoImpl();
	Dept dept = ddi.getDeptById(Integer.parseInt(did));
	request.getSession().setAttribute("dept", dept);
	String pid = request.getParameter("pid");
	PostDaoImpl pdi = new PostDaoImpl();
	Post post = pdi.getPostById(Integer.parseInt(pid));
	request.getSession().setAttribute("post", post);
	String ephone = request.getParameter("ephone");
	String eaddr = request.getParameter("eaddr");
	emploe.setEid(Integer.parseInt(eid));
	emploe.setEname(ename);
	emploe.setEsalary(esalary);
	emploe.setEsex(esex);
	SimpleDateFormat sfd = new SimpleDateFormat("yyyy-MM-dd");
	try {
		emploe.setEbir(sfd.parse(ebir));
	} catch (ParseException e) {
		e.printStackTrace();
	}
	emploe.setEmarry(emarry);
	emploe.setEedu(eedu);
	emploe.setDid(Integer.parseInt(did));
	emploe.setPid(Integer.parseInt(pid));
	emploe.setEphone(ephone);
	emploe.setEaddr(eaddr);
	EmploeDaoImpl edi = new EmploeDaoImpl();
	boolean flag = edi.updateEmploe(Integer.parseInt(eid), emploe);
	System.out.println("更新成功了沒");
	if(flag){
		System.out.println("恩");
		request.getSession().setAttribute("emploe", emploe);
		response.sendRedirect("EmploeDetail?eid="+eid);
	}
	
}

public void doPost(HttpServletRequest request, HttpServletResponse response)
		throws ServletException, IOException {
	this.doGet(request, response);
}

}
package com.servlet;

import java.io.IOException;
import java.io.PrintWriter;

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

import com.daoImpl.ManagerDaoImpl;
import com.entity.Manager;

public class ManagerLogin extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType(“text/html;charset=gb2312”);
PrintWriter out = response.getWriter();
String mname = request.getParameter(“mname”);
String mpassword = request.getParameter(“mpassword”);
String code = request.getParameter(“code”);
String trueCode = (String)request.getSession().getAttribute(“code”);
ManagerDaoImpl mdi = new ManagerDaoImpl();
if(code.equalsIgnoreCase(trueCode)){
out.print("¡Ì");
int n = mdi.managerLogin(mname, mpassword);
System.out.println(n);
if(n1){
Manager manager = mdi.getMangerByName(mname);
request.getSession().setAttribute(“mname”, mname);
request.getSession().setAttribute(“manager”, manager);
response.sendRedirect(“EmploeTable”);
}else if(n
2){
response.sendRedirect(“manager_login.jsp”);
}else{
response.sendRedirect(“manager_login.jsp”);
}
}else{
out.print("¡Á");
response.sendRedirect(“manager_login.jsp”);
}
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
this.doGet(request, response);
}

}
package com.servlet;

import java.io.IOException;
import java.io.PrintWriter;

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

import com.daoImpl.ManagerDaoImpl;
import com.entity.Manager;

public class ManagerMpasswordUpdate extends HttpServlet {

public void doGet(HttpServletRequest request, HttpServletResponse response)
		throws ServletException, IOException {
	Manager manager = (Manager)request.getSession().getAttribute("manager");
	String mid = request.getParameter("mid");
	String mpassword = request.getParameter("mpassword");
	String newPsw = request.getParameter("newPsw");
	String reNewPsw = request.getParameter("reNewPsw");
	String code = request.getParameter("code");
	String trueCode = (String)request.getSession().getAttribute("code");
	if(code.equalsIgnoreCase(trueCode)){
		if(newPsw.equals(reNewPsw)){
			if(mid.equals(manager.getMid()+"")){
				ManagerDaoImpl mdi = new ManagerDaoImpl();
				int n = mdi.managerLogin(manager.getMname(), mpassword);
				if(n==1){
					boolean flag = mdi.mupdatePassword(Integer.parseInt(mid), newPsw);
					if(flag){
						response.sendRedirect("manager_login.jsp");
					}
				}else if(n==2){
					response.sendRedirect("manager/mpassword_update.jsp");
				}
			}else{
				response.sendRedirect("manager/mpassword_update.jsp");
			}
		}else{
			response.sendRedirect("manager/mpassword_update.jsp");
		}
	}else{
		response.sendRedirect("manager/mpassword_update.jsp");
	}
	
	
}

public void doPost(HttpServletRequest request, HttpServletResponse response)
		throws ServletException, IOException {
	this.doGet(request, response);
}

}

相關文章