资源简介

毕设的定制项目开发,有需要可以拿去,完爆毕设!

资源截图

代码片段和文件信息

package com.action;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;

import com.dao.THangbanDAO;
import com.dao.TOrderDAO;
import com.dao.TOrderitemDAO;
import com.dao.TUserDAO;
import com.model.THangban;
import com.model.TOrder;
import com.model.TOrderitem;
import com.model.TUser;
import com.opensymphony.xwork2.ActionSupport;
import com.util.Cart;

public class buyAction extends ActionSupport
{
private String message;
private String path;

private THangbanDAO hangbanDAO;
private TOrderDAO orderDAO;
private TOrderitemDAO orderitemDAO;
private TUserDAO userDAO;

public String addToCart()
{
HttpServletRequest request=ServletActionContext.getRequest();
HttpSession session=request.getSession();
Cart cart =(Cart)session.getAttribute(“cart“);

String id=String.valueOf(new Date().getTime());
String orderId=““;
//获得客户端发来的请求参数即获得名为times的请求值
int hangbanId=Integer.parseInt(request.getParameter(“hangbanId“));//getParameter获取参数
String piaoleixing=request.getParameter(“piaoleixing“);
String zuoweihao = request.getParameter(“zuoweihao“);
String zwIndex = request.getParameter(“zwIndex“);
int danjia=0;
if(piaoleixing.equals(“成人票“)){danjia=hangbanDAO.findById(hangbanId).getChengrenpiaojia();}if(piaoleixing.equals(“儿童票“)){danjia=hangbanDAO.findById(hangbanId).getErtongpiaojia();}

int shuliang=Integer.parseInt(request.getParameter(“shuliang“));
THangban hangban=hangbanDAO.findById(hangbanId);

TOrderitem orderItem=new TOrderitem();

orderItem.setId(id);
orderItem.setOrderId(orderId);
orderItem.setHangbanId(hangbanId);
orderItem.setPiaoleixing(piaoleixing);

orderItem.setDanjia(danjia);
orderItem.setShuliang(shuliang);
orderItem.setHangban(hangban);
orderItem.setZuoweihao(zuoweihao);
orderItem.setZwIndex(zwIndex);

cart.addHangban(id orderItem);

session.setAttribute(“cart“ cart);

request.setAttribute(“msg“ “成功加入购物车“);
return “msg“;
}


public String delFromCart()//用户自己删除订单
{
HttpServletRequest request=ServletActionContext.getRequest();//获取session对象
HttpSession session=request.getSession();//在session中获取user对象
Cart cart =(Cart)session.getAttribute(“cart“);

cart.delHangban(request.getParameter(“id“));

        session.setAttribute(“cart“ cart);

request.setAttribute(“msg“ “删除完毕“);
return “msg“;
}


public String orderAdd()
{
HttpServletRequest request=ServletActionContext.getRequest();
HttpSession session=request.getSession();
Cart cart =(Cart)session.getAttribute(“cart“);
TUser user=(TUser)session.getAttribute(“user“);

String id=String.valueOf(new Date().getTime());

TOrder order=new TOrder();

order.setId(id);
order.

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-03-30 10:49  air\
     目录           0  2018-03-30 10:40  air\air\
     文件        8036  2018-03-30 10:47  air\air.sql
     文件        5774  2018-03-26 16:33  air\air\.classpath
     目录           0  2018-03-30 10:40  air\air\.externalToolBuilders\
     文件         557  2018-03-26 17:05  air\air\.externalToolBuilders\com.genuitec.eclipse.ast.deploy.core.DeploymentBuilder (1).launch
     文件         557  2015-10-28 19:52  air\air\.externalToolBuilders\com.genuitec.eclipse.ast.deploy.core.DeploymentBuilder.launch
     文件         550  2015-10-28 13:43  air\air\.externalToolBuilders\com.genuitec.eclipse.hibernate.HibernateBuilder.launch
     文件         565  2018-03-26 17:05  air\air\.externalToolBuilders\com.genuitec.eclipse.j2eedt.core.DeploymentDescriptorValidator.launch
     文件         556  2018-03-26 17:05  air\air\.externalToolBuilders\com.genuitec.eclipse.j2eedt.core.J2EEProjectValidator.launch
     文件         555  2018-03-26 17:05  air\air\.externalToolBuilders\com.genuitec.eclipse.j2eedt.core.WebClasspathBuilder.launch
     文件         553  2015-11-02 08:29  air\air\.externalToolBuilders\com.genuitec.eclipse.springframework.springbuilder.launch
     文件         552  2015-10-26 15:36  air\air\.externalToolBuilders\org.eclipse.wst.common.project.facet.core.builder (2).launch
     文件         548  2015-11-03 08:29  air\air\.externalToolBuilders\org.eclipse.wst.jsdt.core.javascriptValidator (2).launch
     文件         547  2015-10-26 21:56  air\air\.externalToolBuilders\org.eclipse.wst.validation.validationbuilder (1).launch
     文件         547  2018-03-26 17:05  air\air\.externalToolBuilders\org.eclipse.wst.validation.validationbuilder.launch
     目录           0  2016-10-23 23:55  air\air\.myeclipse\
     文件         509  2015-10-26 23:04  air\air\.myhibernatedata
     文件         285  2015-12-15 18:09  air\air\.mymetadata
     文件        4988  2018-03-26 17:05  air\air\.project
     目录           0  2018-03-30 10:40  air\air\.settings\
     文件         500  2015-10-28 12:42  air\air\.settings\.jsdtscope
     文件          86  2018-03-23 16:09  air\air\.settings\org.eclipse.core.resources.prefs
     文件         629  2015-10-29 07:34  air\air\.settings\org.eclipse.jdt.core.prefs
     文件          99  2015-11-04 22:56  air\air\.settings\org.eclipse.jdt.ui.prefs
     文件         450  2015-11-02 17:44  air\air\.settings\org.eclipse.wst.common.component
     文件         252  2015-11-02 16:13  air\air\.settings\org.eclipse.wst.common.project.facet.core.xml
     文件          49  2015-11-03 04:09  air\air\.settings\org.eclipse.wst.jsdt.ui.superType.container
     文件           6  2015-11-02 12:19  air\air\.settings\org.eclipse.wst.jsdt.ui.superType.name
     文件         474  2015-10-31 14:11  air\air\.springBeans
     目录           0  2018-03-30 10:40  air\air\src\
............此处省略389个文件信息

评论

共有 条评论