package com.shuangyulin.action;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.text.SimpleDateFormat;
import java.util.UUID;
import org.apache.struts2.ServletActionContext;
import java.util.List;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.shuangyulin.dao.ProductCartDAO;
import com.shuangyulin.dao.OrderInfoDAO;
import com.shuangyulin.domain.ProductCart;
import com.shuangyulin.domain.OrderInfo;
import com.shuangyulin.dao.MemberInfoDAO;
import com.shuangyulin.domain.MemberInfo;
import com.shuangyulin.dao.OrderStateDAO;
import com.shuangyulin.domain.OrderState;
import com.shuangyulin.test.TestUtil;
public class OrderInfoAction extends ActionSupport {
/*界面层需要查询的属性: 订单编号*/
private String orderNo;
public void setOrderNo(String orderNo) {
this.orderNo = orderNo;
}
public String getOrderNo() {
return this.orderNo;
}
/*界面层需要查询的属性: 下单会员*/
private MemberInfo memberObj;
public void setMemberObj(MemberInfo memberObj) {
this.memberObj = memberObj;
}
public MemberInfo getMemberObj() {
return this.memberObj;
}
/*界面层需要查询的属性: 下单开始时间*/
private String orderStartTime;
public void setOrderStartTime(String orderStartTime) {
this.orderStartTime = orderStartTime;
}
public String getOrderStartTime() {
return this.orderStartTime;
}
/*界面层需要查询的属性: 下单结束时间*/
private String orderEndTime;
public void setOrderEndTime(String orderEndTime) {
this.orderEndTime = orderEndTime;
}
public String getOrderEndTime() {
return this.orderEndTime;
}
/*界面层需要查询的属性: 下单时间*/
private String orderTime;
public void setOrderTime(String orderTime) {
this.orderTime = orderTime;
}
public String getOrderTime() {
return this.orderTime;
}
/*界面层需要查询的属性: 订单状态*/
private OrderState orderStateObj;
public void setOrderStateObj(OrderState orderStateObj) {
this.orderStateObj = orderStateObj;
}
public OrderState getOrderStateObj() {
return this.orderStateObj;
}
/*界面层需要查询的属性: 收货人姓名*/
private String realName;
public void setRealName(String realName) {
this.realName = realName;
}
public String getRealName() {
return this.realName;
}
/*界面层需要查询的属性: 收货人电话*/
private String telphone;
public void setTelphone(String telphone) {
this.telphone = telphone;
}
public String getTelphone() {
return this.telphone;
}
/*当前第几页*/
private int currentPage;
public void setCurrentPage(int currentPage) {
this.currentPage = currentPage;
}
public int getCurrentPage() {
return currentPage;
}
/*一共多少页*/
private int totalPage;
public void setTotalPage(int totalPage) {
this.totalPage = totalPage;
}
public int getTotalPage() {
return totalPage;
}
/*当前查询的总记录数目*/
private int recordNumber;
public void setRecordNumber(int recordNumber) {
this.recordNumber = recordNumber;
}
public int getRecordNumber() {
return recordNumber;
}
/*业务层对象*/
OrderInfoDAO orderInfoDAO = new OrderInfoDAO();
/*待操作的OrderInfo对象*/
private OrderInfo orderInfo;
public void setOrderInfo(OrderInfo orderInfo) {
this.orderInfo = orderInfo;
}
public OrderInfo getOrderInfo() {
return this.orderInfo;
}
/*跳转到添加OrderInfo视图*/
public String AddView() {
ActionContext ctx = ActionContext.getContext();
/*查询所有的MemberInfo信息*/
MemberInfoDAO memberInfoDAO = new MemberInfoDAO();
List<MemberInfo> memberInfoList = memberInfoDAO.QueryAllMemberInfoInfo();
ctx.put("memberInfoList", memberInfoList);
/*查询所有的OrderState信息*/
OrderStateDAO orderStateDAO = new OrderStateDAO();
List<OrderState> orderStateList = orderStateDAO.QueryAllOrderStateInfo();
ctx.put("orderStateList", orderStateList);
return "add_view";
}
/*添加OrderInfo信息*/
@SuppressWarnings("deprecation")
public String AddOrderInfo() {
ActionContext ctx = ActionContext.getContext();
/*生成订单编号: 当前用户名 + 当前时间 */
String memberUserName = (String)ctx.getSession().get("memberUserName"); //获取到当前的会员名称
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
String timeStr = sdf.format(new java.util.Date());
String orderNo = memberUserName + timeStr;
/*验证订单编号是否已经存在*/
OrderInfo db_orderInfo = orderInfoDAO.GetOrderInfoByOrderNo(orderNo);
if(null != db_orderInfo) {
ctx.put("error", java.net.URLEncoder.encode("该订单编号已经存在!"));
return "error";
}
orderInfo.setOrderNo(orderNo);
//设置下单会员
MemberInfoDAO memberInfoDAO = new MemberInfoDAO();
MemberInfo memberObj = memberInfoDAO.GetMemberInfoByMemberUserName(memberUserName);
orderInfo.setMemberObj(memberObj);
/*获取到下单时间*/
sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
orderInfo.setOrderTime(sdf.format(new java.util.Date()));
/*设置订单状态: 未付款*/
OrderStateDAO orderStateDAO = new OrderStateDAO();
OrderState orderStateObj = orderStateDAO.GetOrderStateByStateId(1);
orderInfo.setOrderStateObj(orderStateObj);
/*遍历购物车计算订单总金额*/
float totalMoney = 0.0f;
ProductCartDAO productCartDAO = new ProductCartDAO();
List<ProductCart> productCartList = productCartDAO.QueryMyProductCartInfo(memberUserName);
for(int i=0;i<productCartList.size();i++) {
ProductCart productCart = productCartList.get(i);
totalMoney += productCart.getPrice() * productCart.getCount();
}
orderInfo.setTotalMoney(totalMoney);
try {
orderInfoDAO.AddOrderInfo(orderInfo,productCartList);
ctx.put("message", java.net.URLEncoder.encode("订单添加成功!"));
return "add_success";
} catch (Exception e) {
e.printStackTrace();
ctx.put("error", java.net.URLEncoder.encode("OrderInfo添加失败!"));
return "error";
}
}
/*即将提交订单*/
public String WillAddOrderInfo() {
ActionContext ctx = ActionContext.getContext();
String memberUserName = (String)ctx.getSession().get("memberUserName");
ProductCartDAO productCartDAO = new ProductCartDAO();
List<ProductCart> productCartList = productCartDAO.QueryMyProductCartInfo(memberUserName);
MemberInfo memberInfo = (new MemberInfoDAO()).GetMemberInfoByMemberUserName(memberUserName);
if(productCartList.size() == 0) {
ctx.put("error", java.net.URLEncoder.encode("请先选购商品!"));
return "error";
}
ctx.put("memberInfo", memberInfo);
ctx.put("productCartList", productCartList);
return "myOrderView";
}
/*查询OrderInfo信息*/
public String QueryOrderInfo() {
if(currentPage == 0) currentPage = 1;
if(orderNo == null) orderNo = "";
if(orderStartTime == null) orderStartTime = "";
if(orderEndTime == null) orderEndTime = "";
if(realName == null) realName = "";
if(telphone == null) telphone = "";
没有合适的资源?快使用搜索试试~ 我知道了~
安卓Android带支付宝在线支付购物商城app设计可升级AndroidStudio
共874个文件
class:376个
java:153个
xml:112个
需积分: 1 0 下载量 137 浏览量
2023-11-04
15:16:50
上传
评论 2
收藏 21.92MB ZIP 举报
温馨提示
## 在以前购物商城app的基础上增加了订单在线支付功能,本项目采用的是支付宝在线支付接口! 商品类别:类别编号,类别名称 商品信息:商品编号,商品类别,商品名称,商品图片,商品单价,商品库存,是否推荐,人气值,上架日期 是否信息:是否编号,是否信息 会员信息:会员用户名,登录密码,真实姓名,性别,出生日期,联系电话,联系邮箱,联系qq,家庭地址,会员照片 订单信息:订单编号,下单会员,下单时间,订单总金额,订单状态,付款方式,收货人姓名,收货人电话,邮政编码,收货地址,附加信息 订单状态信息:状态编号,订单状态名称 订单明细信息:记录编号,定单编号,商品名称,商品单价,订购数量 商品购物车:记录编号,用户名,商品名称,商品单价,商品数量 商品评价:评价编号,商品名称,用户名,评价内容,评价时间 系统公告:记录编号,公告标题,公告内容,发布日期 ## 程序开发软件: MyEclipse/Eclipse/Idea(服务器端) + Eclipse(客户端) + mysql ## 系统客户端和服务器端架构技术: 界面层,业务逻辑层,数据层3层分离技术,MVC设计思想!
资源推荐
资源详情
资源评论
收起资源包目录
安卓Android带支付宝在线支付购物商城app设计可升级AndroidStudio (874个子文件)
resources.ap_ 274KB
MobileClient.apk 678KB
OrderInfoAction.class 11KB
ProductInfoEditActivity.class 11KB
HttpUtil.class 11KB
ProductInfoAction.class 10KB
ProductInfoListActivity.class 10KB
OrderInfoDAO.class 10KB
MemberInfoListActivity.class 9KB
ProductCartAction.class 9KB
ProductInfoAddActivity.class 9KB
NoticeListActivity.class 9KB
OrderInfoListActivity.class 8KB
OrderDetailListActivity.class 8KB
ProductCartListActivity.class 8KB
EvaluateListOfOneProductActivity.class 8KB
EvaluateListActivity.class 8KB
ProductClassListActivity.class 8KB
OrderStateListActivity.class 8KB
ProductCartUserListActivity.class 8KB
OrderInfoServlet.class 8KB
YesOrNoListActivity.class 8KB
MemberInfoAction.class 8KB
MemberInfoEditActivity.class 8KB
OrderInfoUserAddActivity.class 8KB
OrderInfoDAO.class 7KB
OrderDetailAction.class 7KB
OrderInfoEditActivity.class 7KB
ProductInfoServlet.class 7KB
CrashHandler.class 7KB
EvaluateAction.class 7KB
ProductInfoDAO.class 7KB
ProductInfoService.class 7KB
OrderInfoService.class 7KB
ProductInfoDAO.class 7KB
MemberInfoServlet.class 7KB
ProductCartDAO.class 7KB
ProductCartDAO.class 6KB
ProductCartEditActivity.class 6KB
MemberRegisterActivity.class 6KB
MemberInfoAddActivity.class 6KB
ConnectionPool.class 6KB
OrderDetailEditActivity.class 6KB
MemberInfoService.class 6KB
EvaluateEditActivity.class 6KB
OrderInfoUserListActivity.class 6KB
OrderDetailService.class 6KB
ProductCartService.class 6KB
OrderDetailDAO.class 6KB
OrderInfoAddActivity.class 6KB
MemberInfoDAO.class 6KB
R$id.class 6KB
EvaluateService.class 6KB
OrderInfoUtil2_0.class 6KB
NoticeService.class 6KB
ProductInfoDetailActivity.class 6KB
MemberInfoDAO.class 6KB
EvaluateServlet.class 5KB
OrderDetailServlet.class 5KB
ProductCartServlet.class 5KB
OrderInfoQueryActivity.class 5KB
ProductInfoQueryActivity.class 5KB
NoticeServlet.class 5KB
EvaluateDAO.class 5KB
ProductClassService.class 5KB
ProductCartAddActivity.class 5KB
OrderStateService.class 5KB
OrderDetailAddActivity.class 5KB
EvaluateAddActivity.class 5KB
photoListActivity.class 5KB
MemberInfoEditActivity$3.class 5KB
ImageSimpleAdapter.class 5KB
YesOrNoService.class 5KB
MemberInfoAddActivity$3.class 5KB
MemberRegisterActivity$3.class 5KB
OrderDetailUserListActivity.class 5KB
NoticeDAO.class 5KB
NoticeAction.class 5KB
OrderDetailDAO.class 5KB
EvaluateDAO.class 5KB
NoticeDAO.class 4KB
ProductClassServlet.class 4KB
OrderStateServlet.class 4KB
Base64.class 4KB
ProductCartQueryActivity.class 4KB
OrderDetailQueryActivity.class 4KB
ProductInfoAddActivity$5.class 4KB
EvaluateQueryActivity.class 4KB
MainMenuActivity.class 4KB
UpPhotoServlet.class 4KB
ProductClassAction.class 4KB
OrderInfoAddActivity$3.class 4KB
ProductInfoEditActivity$5.class 4KB
YesOrNoServlet.class 4KB
OrderStateAction.class 4KB
MemberInfoDetailActivity.class 4KB
NotifyUrlServlet.class 4KB
ProductClassDAO.class 4KB
OrderInfoDetailActivity.class 4KB
OrderStateDAO.class 4KB
共 874 条
- 1
- 2
- 3
- 4
- 5
- 6
- 9
资源评论
软硬件源码设计案例
- 粉丝: 1712
- 资源: 1459
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功