资源简介

易买网

资源截图

代码片段和文件信息

package com.zxz.action;

import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import org.apache.struts2.interceptor.SessionAware;

import com.alibaba.fastjson.JSON;
import com.opensymphony.xwork2.ActionSupport;
import com.zxz.pojo.EasybuyOrder;
import com.zxz.pojo.EasybuyOrderDetail;
import com.zxz.pojo.EasybuyUser;
import com.zxz.pojo.EasybuyUserAddress;
import com.zxz.service.EasybuyOrderService;
import com.zxz.service.EasybuyProductService;
import com.zxz.service.EasybuyUserAddressService;
import com.zxz.service.impl.EasybuyOrderServiceImpl;
import com.zxz.service.impl.EasybuyProductServiceImpl;
import com.zxz.service.impl.EasybuyUserAddressServiceImpl;
import com.zxz.utils.RandomUtil;

/**
 * @author zhaoxuezhong
 *
 */
public class CartAction extends ActionSupport implements SessionAware{
private static final long serialVersionUID = 624932278086950947L;
private EasybuyProductService eps=new EasybuyProductServiceImpl();
private EasybuyUserAddressService euas=new EasybuyUserAddressServiceImpl();
private EasybuyOrderService eos=new EasybuyOrderServiceImpl();
private EasybuyOrderDetail orderDetail=new EasybuyOrderDetail();
private EasybuyUserAddress address=new EasybuyUserAddress();
private String result;
private String type;

@SuppressWarnings(“unchecked“)
public String addCart(){
Mapject> map=new HashMapject>();
try {
Mapject> cart=(Mapject>)session.get(“cart“);
if(cart==null)cart=new HashMapject>();
List items=(List)cart.get(“items“);
Float sum=(Float) cart.get(“sum“);
if(items==null){
items=new ArrayList();
sum=0f;
}
orderDetail.setProduct(eps.findEasybuyProduct(orderDetail.getProductId()));
orderDetail.setCost(orderDetail.getProduct().getPrice()*orderDetail.getQuantity());
sum+=orderDetail.getCost();
items.add(orderDetail);
cart.put(“items“ items);
cart.put(“sum“ sum);
session.put(“cart“ cart);
map.put(“status“ 1);
} catch (Exception e) {
e.printStackTrace();
map.put(“status“ -1);
map.put(“message“ e.getMessage());
}
finally{
this.result=JSON.toJSONString(map);
}
return SUCCESS;
}

public String refreshCart(){
return SUCCESS;
}

public String toSettlement(){
if(type!=null&&type.equals(“settlement2“)){
session.put(“userAddressList“ euas.findEasybuyUserAddressByuserId(((EasybuyUser)session.get(“loginUser“)).getId()));
}
return type!=null&&!type.equals(““)?type:“index“;
}

@SuppressWarnings(“unchecked“)
public String updateCart(){
Mapject> map=new HashMapject>();
try {
Mapject> cart=(Mapject>)session.get(“cart“);
List items=(List)cart.get(“ite

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       1266  2018-06-14 22:28  EasyBuy\.classpath

     文件        408  2018-06-25 14:43  EasyBuy\.myhibernatedata

     文件       1332  2018-06-12 17:26  EasyBuy\.project

     文件        522  2018-06-12 15:55  EasyBuy\.settings\.jsdtscope

     文件        103  2018-06-28 16:08  EasyBuy\.settings\com.genuitec.eclipse.core.prefs

     文件         78  2018-06-12 16:11  EasyBuy\.settings\org.eclipse.core.resources.prefs

     文件        364  2018-06-12 15:54  EasyBuy\.settings\org.eclipse.jdt.core.prefs

     文件        562  2018-06-12 16:09  EasyBuy\.settings\org.eclipse.wst.common.component

     文件        449  2018-06-12 15:56  EasyBuy\.settings\org.eclipse.wst.common.project.facet.core.xml

     文件         49  2018-06-12 15:55  EasyBuy\.settings\org.eclipse.wst.jsdt.ui.superType.container

     文件          6  2018-06-12 15:55  EasyBuy\.settings\org.eclipse.wst.jsdt.ui.superType.name

     文件       2567  2018-06-08 16:25  EasyBuy\dtd\mybatis-3-config.dtd

     文件       6996  2018-06-08 16:25  EasyBuy\dtd\mybatis-3-mapper.dtd

     文件      29633  2018-06-25 21:40  EasyBuy\easybuy.sql

     文件         18  2018-06-29 21:41  EasyBuy\readme.txt

     文件       1347  2018-06-25 20:55  EasyBuy\resources\com\zxz\dao\EasybuyCollectMapper.xml

     文件        626  2018-06-15 16:54  EasyBuy\resources\com\zxz\dao\EasybuyNewsMapper.xml

     文件       1523  2018-06-17 22:29  EasyBuy\resources\com\zxz\dao\EasybuyOrderDetailMapper.xml

     文件       2362  2018-06-17 22:52  EasyBuy\resources\com\zxz\dao\EasybuyOrderMapper.xml

     文件       2428  2018-06-16 17:29  EasyBuy\resources\com\zxz\dao\EasybuyProductCategoryMapper.xml

     文件       3022  2018-06-17 21:59  EasyBuy\resources\com\zxz\dao\EasybuyProductMapper.xml

     文件       1562  2018-06-17 23:30  EasyBuy\resources\com\zxz\dao\EasybuyUserAddressMapper.xml

     文件       1921  2018-06-13 15:39  EasyBuy\resources\com\zxz\dao\EasybuyUserMapper.xml

     文件        233  2018-06-12 16:11  EasyBuy\resources\database.properties

     文件       1805  2018-06-10 17:12  EasyBuy\resources\log4j.properties

     文件       1456  2018-06-12 20:11  EasyBuy\resources\mybatis-config.xml

     文件       1220  2018-06-17 18:26  EasyBuy\resources\struts.xml

     文件       5491  2018-06-28 15:58  EasyBuy\resources\struts_backend.xml

     文件       2133  2018-06-17 22:35  EasyBuy\resources\struts_cart.xml

     文件       1905  2018-06-25 20:58  EasyBuy\resources\struts_pre.xml

............此处省略616个文件信息

评论

共有 条评论