⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 administratorsendorder.java

📁 电子商务网站使用MVC模式B/S结构功能不是很全适合初学者看
💻 JAVA
字号:
package Administrator;
import java.io.*;
import java.text.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import Common.DBConnectBean;

public class administratorSendOrder extends HttpServlet{
	public void doGet(HttpServletRequest request,HttpServletResponse response)throws IOException,ServletException{
		ServletContext application=getServletConfig().getServletContext(); 
		request.setCharacterEncoding("gb2312");
		HttpSession session=request.getSession();
		String identify=(String)session.getAttribute("identify".toUpperCase());
		if(identify==null||!(identify.equals("administrator"))){
			application.getRequestDispatcher("/client/clientList.jsp?logged=false").forward(request,response);	
		}
		String orderID="";
		orderID=request.getParameter("orderID");
		ArrayList userOrder=new ArrayList();
		DBConnectBean dbBean=new DBConnectBean("sun.jdbc.odbc.JdbcOdbcDriver","jdbc:odbc:shopping","","");
		String addDay=new SimpleDateFormat("yyyy年MM月dd日HH时mm分ss秒").format(Calendar.getInstance().getTime());
		String consignment=addDay+"发货";
		dbBean.updata("update userOrders set consignment='"+consignment+"' where orderID='"+orderID+"'");
		String sql="select * from orders where orderID='"+orderID+"'";
	
		ArrayList list=new ArrayList();
		Hashtable table=new Hashtable();
		list=dbBean.getAllRecord(sql);
		if(list!=null){
			for(int i=0;i<list.size();i++){
				table=(Hashtable)list.get(i);
				String card=table.get("card".toUpperCase()).toString();
				String num=table.get("num".toUpperCase()).toString();
				String commodityNum=table.get("commodityNum".toUpperCase()).toString();
				sql="select * from commodity where card='"+card+"' and num='"+num+"'";
				System.out.println(sql+" thisexecuted");
				table=dbBean.getOneRecord(sql);
				int j=Integer.parseInt(table.get("restNum".toUpperCase()).toString())-Integer.parseInt(commodityNum);	
				sql="update commodity set restNum="+j+" where id="+table.get("id".toUpperCase()) ;
				System.out.println(sql+"   welldone");
				dbBean.updata(sql);
			}
		}
		application.getRequestDispatcher("/administratorShowOrderAction").forward(request,response);
	}
	public void doPost(HttpServletRequest request,HttpServletResponse response)throws IOException,ServletException{
	   	doGet(request,response);
	}
}
	
	
	

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -