package com.itbaizhan.daowen.action;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.text.MessageFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.itbaizhan.daowen.bll.SystemParam;
import com.itbaizhan.daowen.dal.DALBase;
import com.itbaizhan.daowen.entity.Attachement;
import com.itbaizhan.daowen.entity.Dingdan;
import com.itbaizhan.daowen.entity.Dingdanitems;
import com.itbaizhan.daowen.entity.Huiyuan;
import com.itbaizhan.daowen.entity.Shangpin;
import com.itbaizhan.daowen.util.PagerMetal;
public class DingdanAction extends PageActionBase {
public void onLoad() {
String actiontype = request.getParameter("actiontype");
System.out.println("actiontype=" + actiontype);
if (actiontype == null)
return ;
if(actiontype.equals("modifyAmount")){
modifyAmount();
}
if (actiontype.equals("shopcart")) {
shopcart();
}
if (actiontype.equals("clearshopcart")) {
clearshopcart();
}
if (actiontype.equals("removeShangpin")) {
removeShangpin();
}
if(actiontype.equals("payfor"))
fukuan();
if(actiontype.equals("fahuo"))
fahuo();
}
private void fahuo() {
String ddid=request.getParameter("ddid");
String fahuoren=request.getParameter("fahuoren");
if(ddid!=null)
{
Dingdan dingdan=(Dingdan)DALBase.load("dingdan", "where id="+ddid);
dingdan.setStatus("已发货");
dingdan.setFahuoren(fahuoren);
dingdan.setFahuotime(new Date());
DALBase.update(dingdan);
}
String forwardurl = request.getParameter("forwardurl");
if (forwardurl != null)
try {
response.sendRedirect(SystemParam.getSiteRoot() + forwardurl);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private void fukuan() {
String ddid=request.getParameter("ddid");
String accountname=request.getParameter("accountname");
String errorurl=request.getParameter("errorurl");
if(ddid!=null)
{
Dingdan dingdan=(Dingdan)DALBase.load("dingdan", "where id="+ddid);
if(accountname!=null)
{
Huiyuan hy=(Huiyuan)DALBase.load("huiyuan", "where accountname='"+accountname+"'");
if(hy.getYue()<dingdan.getTotalprice()){
request.setAttribute("errormsg", "<label class='error'>账户余额不足于支付订单,请充值</label>");
try {
request.getRequestDispatcher("/e/huiyuan/fukuan.jsp?id="+ddid).forward(request, response);
return;
} catch (ServletException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}else {
hy.setYue((float)(hy.getYue()-dingdan.getTotalprice()));
hy.setJifen(hy.getJifen()+(int)dingdan.getTotalprice());
DALBase.update(hy);
dingdan.setStatus("已付款");
DALBase.update(dingdan);
request.getSession().setAttribute("huiyuan", hy);
}
}
}
String forwardurl = request.getParameter("forwardurl");
if (forwardurl != null)
try {
response.sendRedirect(SystemParam.getSiteRoot() + forwardurl);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/*
* 修改购物车数量
* */
private void modifyAmount(){
String spid=request.getParameter("spid");
String shuliang=request.getParameter("shuliang");
List<Dingdanitems> temlist=(List<Dingdanitems>)request.getSession().getAttribute("cart");
if(temlist!=null)
{
for(Iterator<Dingdanitems> it= temlist.iterator();it.hasNext();)
{
Dingdanitems ddi=it.next();
if(ddi.getSpid()==new Integer(spid))
{
ddi.setShuliang(new Integer(shuliang));
}
}
}
calcuateTotalfee();
String forwardurl = request.getParameter("forwardurl");
if (forwardurl != null)
try {
response.sendRedirect(SystemParam.getSiteRoot() + forwardurl);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private void removeShangpin() {
String spid=request.getParameter("spid");
List<Dingdanitems> temlist=(List<Dingdanitems>)request.getSession().getAttribute("cart");
if(temlist!=null)
{
for(Iterator<Dingdanitems> it= temlist.iterator();it.hasNext();)
{
Dingdanitems ddi=it.next();
if(ddi.getSpid()==new Integer(spid))
{
it.remove();
float totalfee=Float.parseFloat(request.getSession().getAttribute("totalfee").toString());
totalfee-=ddi.getShuliang()* Float.parseFloat(ddi.getJiage());
request.getSession().setAttribute("totalfee", totalfee);
}
}
}
String forwardurl = request.getParameter("forwardurl");
if (forwardurl != null)
try {
response.sendRedirect(SystemParam.getSiteRoot() + forwardurl);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private void clearshopcart() {
request.getSession().removeAttribute("cart");
request.getSession().removeAttribute("totalfee");
String forwardurl = request.getParameter("forwardurl");
if (forwardurl != null)
try {
response.sendRedirect(SystemParam.getSiteRoot() + forwardurl);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private void calcuateTotalfee()
{
List<Dingdanitems> cart = (List<Dingdanitems>) request.getSession()
.getAttribute("cart");
int totalfee=0;
for (Dingdanitems dditem : cart) {
totalfee += dditem.getShuliang()
* new Double(dditem.getJiage());
}
request.getSession().setAttribute("totalfee", totalfee);
}
private void shopcart() {
String forwardurl = request.getParameter("forwardurl");
// 商品ID
String spid = request.getParameter("spid");
// 商品名
String spname2 = request.getParameter("spname");
//
String command = request.getParameter("command");
// request.setCharacterEncoding("UTF-8");
float totalfee = 0;
List<Dingdanitems> cart = (List<Dingdanitems>) request.getSession()
.getAttribute("cart");
if (spid != null) {
if (cart == null) {
cart = new ArrayList<Dingdanitems>();
request.getSession().setAttribute("cart", cart);
}
Shangpin addshangpin = (Shangpin) DALBase.load("shangpin",
"where id=" + spid);
Boolean hasin = false;
for (Dingdanitems dditem : cart) {
System.out.println("addshangpin.getId()" + addshangpin.getId());
System.out.println("dditem.getId()" + dditem.getId());
if (addshangpin.getId() == dditem.getSpid()) {
hasin = true;
if (command!=null&&command.equals("modifyCount")) {
String shuliang = request.getParameter("shuliang");
dditem.setShuliang(new Integer(shuliang));
} else
dditem.setShuliang(dditem.getShuliang() + 1);
}
totalfee += dditem.getSh
没有合适的资源?快使用搜索试试~ 我知道了~
基于spring+struts2+web的宠物管理系统源码
共1431个文件
js:282个
png:263个
gif:211个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 62 浏览量
2023-05-12
17:40:03
上传
评论
收藏 43.34MB ZIP 举报
温馨提示
1.从用户角度来看: 用户同时使用网站的注册登录功能,进入系统后可以获得一部分功能。在处理消息时,可以进行对宠物资料的浏览,进行购买宠物用品然后对订单进行单个购买或者取消,同时也可以清空购物车中的所有订单,或者全部进行结账等功能。 2.从网站的角度看: (1)网站应该包含宠物搜索功能。 (2)订单处理功能,确认订单方式: a). 电话通知方式 b). E-mail方式 (3)管理员管理: 其任务是查看用户订单,查看用户信息,并在根据查看了用户的信息和用户订单之后,将商品的发送到购买者的身边。 (4)宠物浏览 a). 宠物名 b).宠物类型 c). 价格 d). 订购号 通过分析,系统主要分为前台和后台两大模块,前台主要由用户体验使用,实现了用户登录、注册、查找商品、商品类别等功能导航;后台主要由系统管理员操作使用,用来维护系统,管理员主要实现了订单管理、商品管理、公告管理、会员管理、用户管理、个人信息维护等主要功能。
资源推荐
资源详情
资源评论
收起资源包目录
基于spring+struts2+web的宠物管理系统源码 (1431个子文件)
DingdanAction.class 14KB
HuiyuanAction.class 11KB
ShangpinAction.class 10KB
XinxiAction.class 9KB
DALBase.class 9KB
UsersAction.class 8KB
SupplyorAction.class 8KB
SitenavAction.class 8KB
AlbumAction.class 8KB
LeavewordAction.class 8KB
CommentAction.class 7KB
AlbumtypeAction.class 7KB
RecursionTree.class 7KB
ShangpinBuilder.class 7KB
AlbumitemAction.class 7KB
DaowenPagerTag.class 6KB
JiaodiantuAction.class 6KB
NoticeAction.class 6KB
FriendlinkAction.class 6KB
IndexcolumnsAction.class 6KB
LanmuBuilder.class 6KB
DropdownList.class 6KB
SpcategoryAction.class 5KB
RadioButtonList.class 5KB
SysconfigAction.class 5KB
LanmuAction.class 5KB
ListItem.class 5KB
UibuilderBase.class 4KB
MutiFileUpload.class 4KB
Huiyuan.class 4KB
SingleFileUpload.class 4KB
Xinxi.class 4KB
Shangpin.class 3KB
Dingdan.class 3KB
Topic.class 3KB
Users.class 3KB
UploadAction.class 3KB
LoginAction.class 3KB
FileUploadBase.class 3KB
ExtHelper.class 3KB
ProductViewHistory.class 3KB
HibernateSessionFactory.class 3KB
Test.class 3KB
SitenavBuilder.class 2KB
FocusgraphicBLL.class 2KB
Attachement.class 2KB
Leaveword.class 2KB
SequenceUtil.class 2KB
Dingdanitems.class 2KB
LeavewordBLL.class 2KB
PageActionBase.class 2KB
Album.class 2KB
CommentBLL.class 2KB
Supplyor.class 2KB
Comment.class 2KB
Lanmu.class 2KB
SpcategoryBuilder.class 2KB
HTMLUtil.class 2KB
Notice.class 2KB
Acl.class 2KB
EncodingFilter.class 2KB
Jiaodiantu.class 2KB
NoticeService.class 2KB
NoticeBLL.class 2KB
FriendlinkBLL.class 2KB
IndexColumnsBuilder.class 2KB
Spcategory.class 2KB
Indexcolumns.class 2KB
DateJsonValueProcessor.class 1KB
Test.class 1KB
Sitenav.class 1KB
PagerMetal.class 1KB
SpcategoryTree.class 1KB
LanmuTree.class 1KB
Sysconfig.class 1KB
Albumitem.class 1KB
Friendlink.class 1KB
Control.class 1KB
DaowenUIHelper.class 968B
Albumtype.class 960B
Role.class 864B
Json1.class 792B
TotalJson.class 759B
NameUtil.class 753B
TotalRow.class 747B
RequestParseWrapper.class 667B
SystemParam.class 605B
PhotographerUibuilder.class 572B
IRecursionTree.class 522B
Total.class 500B
TextBox.class 310B
UploadFileFilter.class 180B
.classpath 4KB
org.eclipse.wst.common.component 553B
org.eclipse.wst.jsdt.ui.superType.container 49B
jquery-ui.css 31KB
jquery.treetable.theme.default.css 29KB
web2table.css 27KB
jquery-ui.min.css 26KB
index.css 26KB
共 1431 条
- 1
- 2
- 3
- 4
- 5
- 6
- 15
资源评论
老了敲不动了
- 粉丝: 83
- 资源: 4289
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功